From: Mauro Carvalho Chehab <mchehab@infradead.org>
To: LKML <linux-kernel@vger.kernel.org>
Cc: V4L-DVB Maintainers <v4l-dvb-maintainer@linuxtv.org>,
Mauro Carvalho Chehab <mchehab@infradead.org>
Subject: [PATCH 13/28] V4L/DVB (4980): Fixes bug 7267: PAL/60 is not working
Date: Wed, 27 Dec 2006 14:57:29 -0200 [thread overview]
Message-ID: <20061227165729.PS66228100013@infradead.org> (raw)
In-Reply-To: <20061227165016.PS89442900000@infradead.org>
From: Mauro Carvalho Chehab <mchehab@infradead.org>
On cx88 driver, sampling rate should be at chroma subcarrier freq (FSC).
However, driver were programming wrong values for PAL/60, PAL/Nc and
NTSC 4.43. This patch do the proper calculation. It also calculates
htotal, hdelay and hactive constants, according with the sampling
rate.
It is tested with PAL/60 by Piotr Maksymuk and Olivier. Also tested with
the already-supported standards.
Test is still required for PAL/Nc.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
---
drivers/media/video/cx88/cx88-core.c | 35 +++++++++++++++++++++-------------
drivers/media/video/cx88/cx88.h | 2 +-
2 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
index 453af5e..1899736 100644
--- a/drivers/media/video/cx88/cx88-core.c
+++ b/drivers/media/video/cx88/cx88-core.c
@@ -633,12 +633,12 @@ int cx88_reset(struct cx88_core *core)
static unsigned int inline norm_swidth(struct cx88_tvnorm *norm)
{
- return (norm->id & V4L2_STD_625_50) ? 922 : 754;
+ return (norm->id & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 754 : 922;
}
static unsigned int inline norm_hdelay(struct cx88_tvnorm *norm)
{
- return (norm->id & V4L2_STD_625_50) ? 186 : 135;
+ return (norm->id & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 135 : 186;
}
static unsigned int inline norm_vdelay(struct cx88_tvnorm *norm)
@@ -648,24 +648,33 @@ static unsigned int inline norm_vdelay(s
static unsigned int inline norm_fsc8(struct cx88_tvnorm *norm)
{
- static const unsigned int ntsc = 28636360;
- static const unsigned int pal = 35468950;
- static const unsigned int palm = 28604892;
-
if (norm->id & V4L2_STD_PAL_M)
- return palm;
+ return 28604892; // 3.575611 MHz
+
+ if (norm->id & (V4L2_STD_PAL_Nc))
+ return 28656448; // 3.582056 MHz
+
+ if (norm->id & V4L2_STD_NTSC) // All NTSC/M and variants
+ return 28636360; // 3.57954545 MHz +/- 10 Hz
- return (norm->id & V4L2_STD_625_50) ? pal : ntsc;
+ /* SECAM have also different sub carrier for chroma,
+ but step_db and step_dr, at cx88_set_tvnorm already handles that.
+
+ The same FSC applies to PAL/BGDKIH, PAL/60, NTSC/4.43 and PAL/N
+ */
+
+ return 35468950; // 4.43361875 MHz +/- 5 Hz
}
static unsigned int inline norm_htotal(struct cx88_tvnorm *norm)
{
- /* Should always be Line Draw Time / (4*FSC) */
- if (norm->id & V4L2_STD_PAL_M)
- return 909;
+ unsigned int fsc4=norm_fsc8(norm)/2;
- return (norm->id & V4L2_STD_625_50) ? 1135 : 910;
+ /* returns 4*FSC / vtotal / frames per seconds */
+ return (norm->id & V4L2_STD_625_50) ?
+ ((fsc4+312)/625+12)/25 :
+ ((fsc4+262)/525*1001+15000)/30000;
}
static unsigned int inline norm_vbipack(struct cx88_tvnorm *norm)
@@ -692,7 +701,7 @@ int cx88_set_scale(struct cx88_core *cor
value &= 0x3fe;
cx_write(MO_HDELAY_EVEN, value);
cx_write(MO_HDELAY_ODD, value);
- dprintk(1,"set_scale: hdelay 0x%04x\n", value);
+ dprintk(1,"set_scale: hdelay 0x%04x (width %d)\n", value,swidth);
value = (swidth * 4096 / width) - 4096;
cx_write(MO_HSCALE_EVEN, value);
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index 7054e94..a9575ad 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -91,7 +91,7 @@ struct cx88_tvnorm {
static unsigned int inline norm_maxw(struct cx88_tvnorm *norm)
{
- return (norm->id & V4L2_STD_625_50) ? 768 : 640;
+ return (norm->id & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 720 : 768;
}
next prev parent reply other threads:[~2006-12-27 17:10 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-27 16:50 [PATCH 00/28] V4L/DVB fixes Mauro Carvalho Chehab
2006-12-27 16:57 ` [PATCH 03/28] V4L/DVB (4958): Fix namespace conflict between w9968cf.c on MIPS Mauro Carvalho Chehab
2006-12-27 16:57 ` [PATCH 01/28] V4L/DVB (4955): Fix autosearch index Mauro Carvalho Chehab
2006-12-27 16:57 ` [PATCH 04/28] V4L/DVB (4959): Usbvision: possible cleanups Mauro Carvalho Chehab
2006-12-27 16:57 ` [PATCH 05/28] V4L/DVB (4960): Removal of unused code from usbvision-i2c.c Mauro Carvalho Chehab
2006-12-27 16:57 ` [PATCH 02/28] V4L/DVB (4956): [NOVA-T-USB2] Put remote-debugging in the right place Mauro Carvalho Chehab
2006-12-27 16:57 ` [PATCH 07/28] V4L/DVB (4967): Add missing tuner module option pal=60 for PAL-60 support Mauro Carvalho Chehab
2006-12-27 16:57 ` [PATCH 08/28] V4L/DVB (4968): Add PAL-60 support for cx2584x Mauro Carvalho Chehab
2006-12-27 16:57 ` [PATCH 06/28] V4L/DVB (4964): VIDEO_PALETTE_YUYV and VIDEO_PALETTE_YUV422 are the same palette Mauro Carvalho Chehab
2006-12-27 16:57 ` [PATCH 09/28] V4L/DVB (4970): Usbvision memory fixes Mauro Carvalho Chehab
2006-12-27 16:57 ` [PATCH 11/28] V4L/DVB (4973): Dvb-core: fix printk type warning Mauro Carvalho Chehab
2006-12-27 16:57 ` Mauro Carvalho Chehab [this message]
2006-12-27 16:57 ` [PATCH 10/28] V4L/DVB (4972): Dvb-core: fix bug in CRC-32 checking on 64-bit systems Mauro Carvalho Chehab
2006-12-27 16:57 ` [PATCH 12/28] V4L/DVB (4979): Fixes compilation when CONFIG_V4L1_COMPAT is not selected Mauro Carvalho Chehab
2006-12-27 16:57 ` [PATCH 15/28] V4L/DVB (4983): Force temporal filter to 0 when scaling to prevent ghosting Mauro Carvalho Chehab
2006-12-27 16:57 ` [PATCH 18/28] V4L/DVB (4990): Cpia2/cpia2_usb.c: fix error-path leak Mauro Carvalho Chehab
2006-12-27 16:57 ` [PATCH 14/28] V4L/DVB (4982): Fix broken audio mode handling for line-in in msp3400 Mauro Carvalho Chehab
2006-12-27 16:57 ` [PATCH 16/28] V4L/DVB (4984): LOG_STATUS should show the real temporal filter value Mauro Carvalho Chehab
2006-12-27 16:57 ` [PATCH 17/28] V4L/DVB (4988): Cx2341x audio_properties is an u16, not u8 Mauro Carvalho Chehab
2006-12-27 16:57 ` [PATCH 20/28] V4L/DVB (4992): Fix typo in saa7134-dvb.c Mauro Carvalho Chehab
2006-12-27 16:57 ` [PATCH 21/28] V4L/DVB (4994): Vivi: fix use after free in list_for_each() Mauro Carvalho Chehab
2006-12-27 16:57 ` [PATCH 22/28] V4L/DVB (4995): Vivi: fix kthread_run() error check Mauro Carvalho Chehab
2006-12-27 16:57 ` [PATCH 19/28] V4L/DVB (4991): Cafe_ccic.c: fix NULL dereference Mauro Carvalho Chehab
2006-12-27 16:57 ` [PATCH 24/28] V4L/DVB (4997): Bttv: delete duplicated ioremap() Mauro Carvalho Chehab
2006-12-27 16:57 ` [PATCH 28/28] V4L/DVB (5010): Cx88: Fix leadtek_eeprom tagging Mauro Carvalho Chehab
2006-12-27 16:57 ` [PATCH 25/28] V4L/DVB (5014): Allyesconfig build fixes on some non x86 arch Mauro Carvalho Chehab
2006-12-27 16:57 ` [PATCH 23/28] V4L/DVB (4996): Msp3400: fix kthread_run error check Mauro Carvalho Chehab
2006-12-27 16:57 ` [PATCH 26/28] V4L/DVB (5001): Add two required headers on kernel 2.6.20-rc1 Mauro Carvalho Chehab
2006-12-27 16:57 ` [PATCH 27/28] V4L/DVB (5012): Usbvision fix: It was using "&&" instead "&" Mauro Carvalho Chehab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061227165729.PS66228100013@infradead.org \
--to=mchehab@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=v4l-dvb-maintainer@linuxtv.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®