Commit 399426ca authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] cx88: make checkpatch.pl happy

Usually, I don't like fixing coding style issues on non-staging
drivers, as it could be a mess pretty easy, and could become like
a snow ball. That's the case of recent changes on two changesets:
they disalign some statements. Yet, a care a lot with cx88 driver,
as it was the first driver I touched at the Kernel, and I've been
maintaining it since 2005. So, several of the coding style issues
were due to my code.

Per Andrey's suggestion, I ran checkpatch.pl in strict mode, with
fixed several other issues, did some function alinments, but broke
other alinments.

So, I had to manually apply another round of manual fixes to make
sure that everything is ok, and to make checkpatch happy with
this patch.

With this patch, checkpatch.pl is now happy when called with:
	./scripts/checkpatch.pl -f --max-line-length=998 --ignore PREFER_PR_LEVEL

Also, the 80-cols violations that made sense were fixed.

Checkpatch would be happier if we convert it to use dev_foo(),
but this is a more complex change.

NOTE: there are some places with msleep(1). As this driver was
written at the time that the default was to sleep at least 10ms
on such calls (e. g. CONFIG_HZ=100), I replaced those calls by
usleep_range(10000, 20000), with should be safe to avoid breakages.

Fixes: 65bc2fe8 ("[media] cx88: convert it to use pr_foo() macros")
Fixes: 7b61ba8f ("[media] cx88: make checkpatch happier")
Suggested-by: default avatarAndrey Utkin <andrey_utkin@fastmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
Reviewed-by: default avatarAndrey Utkin <andrey_utkin@fastmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 1d389714
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -31,18 +31,22 @@ ...@@ -31,18 +31,22 @@
#define baseband_freq(carrier, srate, tone) ((s32)( \ #define baseband_freq(carrier, srate, tone) ((s32)( \
(compat_remainder(carrier + tone, srate)) / srate * 2 * INT_PI)) (compat_remainder(carrier + tone, srate)) / srate * 2 * INT_PI))
/* We calculate the baseband frequencies of the carrier and the pilot tones /*
* based on the the sampling rate of the audio rds fifo. */ * We calculate the baseband frequencies of the carrier and the pilot tones
* based on the the sampling rate of the audio rds fifo.
*/
#define FREQ_A2_CARRIER baseband_freq(54687.5, 2689.36, 0.0) #define FREQ_A2_CARRIER baseband_freq(54687.5, 2689.36, 0.0)
#define FREQ_A2_DUAL baseband_freq(54687.5, 2689.36, 274.1) #define FREQ_A2_DUAL baseband_freq(54687.5, 2689.36, 274.1)
#define FREQ_A2_STEREO baseband_freq(54687.5, 2689.36, 117.5) #define FREQ_A2_STEREO baseband_freq(54687.5, 2689.36, 117.5)
/* The frequencies below are from the reference driver. They probably need /*
* The frequencies below are from the reference driver. They probably need
* further adjustments, because they are not tested at all. You may even need * further adjustments, because they are not tested at all. You may even need
* to play a bit with the registers of the chip to select the proper signal * to play a bit with the registers of the chip to select the proper signal
* for the input of the audio rds fifo, and measure it's sampling rate to * for the input of the audio rds fifo, and measure it's sampling rate to
* calculate the proper baseband frequencies... */ * calculate the proper baseband frequencies...
*/
#define FREQ_A2M_CARRIER ((s32)(2.114516 * 32768.0)) #define FREQ_A2M_CARRIER ((s32)(2.114516 * 32768.0))
#define FREQ_A2M_DUAL ((s32)(2.754916 * 32768.0)) #define FREQ_A2M_DUAL ((s32)(2.754916 * 32768.0))
...@@ -83,8 +87,10 @@ static s32 int_cos(u32 x) ...@@ -83,8 +87,10 @@ static s32 int_cos(u32 x)
x = x % INT_PI; x = x % INT_PI;
if (x > INT_PI / 2) if (x > INT_PI / 2)
return -int_cos(INT_PI / 2 - (x % (INT_PI / 2))); return -int_cos(INT_PI / 2 - (x % (INT_PI / 2)));
/* Now x is between 0 and INT_PI/2. /*
* To calculate cos(x) we use it's Taylor polinom. */ * Now x is between 0 and INT_PI/2.
* To calculate cos(x) we use it's Taylor polinom.
*/
t2 = x * x / 32768 / 2; t2 = x * x / 32768 / 2;
t4 = t2 * x / 32768 * x / 32768 / 3 / 4; t4 = t2 * x / 32768 * x / 32768 / 3 / 4;
t6 = t4 * x / 32768 * x / 32768 / 5 / 6; t6 = t4 * x / 32768 * x / 32768 / 5 / 6;
...@@ -95,8 +101,10 @@ static s32 int_cos(u32 x) ...@@ -95,8 +101,10 @@ static s32 int_cos(u32 x)
static u32 int_goertzel(s16 x[], u32 N, u32 freq) static u32 int_goertzel(s16 x[], u32 N, u32 freq)
{ {
/* We use the Goertzel algorithm to determine the power of the /*
* given frequency in the signal */ * We use the Goertzel algorithm to determine the power of the
* given frequency in the signal
*/
s32 s_prev = 0; s32 s_prev = 0;
s32 s_prev2 = 0; s32 s_prev2 = 0;
s32 coeff = 2 * int_cos(freq); s32 coeff = 2 * int_cos(freq);
...@@ -115,12 +123,14 @@ static u32 int_goertzel(s16 x[], u32 N, u32 freq) ...@@ -115,12 +123,14 @@ static u32 int_goertzel(s16 x[], u32 N, u32 freq)
tmp = (s64)s_prev2 * s_prev2 + (s64)s_prev * s_prev - tmp = (s64)s_prev2 * s_prev2 + (s64)s_prev * s_prev -
(s64)coeff * s_prev2 * s_prev / 32768; (s64)coeff * s_prev2 * s_prev / 32768;
/* XXX: N must be low enough so that N*N fits in s32. /*
* Else we need two divisions. */ * XXX: N must be low enough so that N*N fits in s32.
* Else we need two divisions.
*/
divisor = N * N; divisor = N * N;
do_div(tmp, divisor); do_div(tmp, divisor);
return (u32) tmp; return (u32)tmp;
} }
static u32 freq_magnitude(s16 x[], u32 N, u32 freq) static u32 freq_magnitude(s16 x[], u32 N, u32 freq)
...@@ -187,7 +197,8 @@ static s32 detect_a2_a2m_eiaj(struct cx88_core *core, s16 x[], u32 N) ...@@ -187,7 +197,8 @@ static s32 detect_a2_a2m_eiaj(struct cx88_core *core, s16 x[], u32 N)
dual = freq_magnitude(x, N, dual_freq); dual = freq_magnitude(x, N, dual_freq);
noise = noise_magnitude(x, N, FREQ_NOISE_START, FREQ_NOISE_END); noise = noise_magnitude(x, N, FREQ_NOISE_START, FREQ_NOISE_END);
dprintk(1, "detect a2/a2m/eiaj: carrier=%d, stereo=%d, dual=%d, noise=%d\n", dprintk(1,
"detect a2/a2m/eiaj: carrier=%d, stereo=%d, dual=%d, noise=%d\n",
carrier, stereo, dual, noise); carrier, stereo, dual, noise);
if (stereo > dual) if (stereo > dual)
...@@ -201,8 +212,10 @@ static s32 detect_a2_a2m_eiaj(struct cx88_core *core, s16 x[], u32 N) ...@@ -201,8 +212,10 @@ static s32 detect_a2_a2m_eiaj(struct cx88_core *core, s16 x[], u32 N)
(carrier < max(stereo, dual) * 6) && (carrier < max(stereo, dual) * 6) &&
(carrier > 20 && carrier < 200) && (carrier > 20 && carrier < 200) &&
(max(stereo, dual) > min(stereo, dual))) { (max(stereo, dual) > min(stereo, dual))) {
/* For EIAJ the carrier is always present, /*
so we probably don't need noise detection */ * For EIAJ the carrier is always present,
* so we probably don't need noise detection
*/
return ret; return ret;
} }
} else { } else {
...@@ -243,7 +256,8 @@ static s16 *read_rds_samples(struct cx88_core *core, u32 *N) ...@@ -243,7 +256,8 @@ static s16 *read_rds_samples(struct cx88_core *core, u32 *N)
u32 current_address = cx_read(srch->ptr1_reg); u32 current_address = cx_read(srch->ptr1_reg);
u32 offset = (current_address - srch->fifo_start + bpl); u32 offset = (current_address - srch->fifo_start + bpl);
dprintk(1, "read RDS samples: current_address=%08x (offset=%08x), sample_count=%d, aud_intstat=%08x\n", dprintk(1,
"read RDS samples: current_address=%08x (offset=%08x), sample_count=%d, aud_intstat=%08x\n",
current_address, current_address,
current_address - srch->fifo_start, sample_count, current_address - srch->fifo_start, sample_count,
cx_read(MO_AUD_INTSTAT)); cx_read(MO_AUD_INTSTAT));
...@@ -308,9 +322,9 @@ s32 cx88_dsp_detect_stereo_sap(struct cx88_core *core) ...@@ -308,9 +322,9 @@ s32 cx88_dsp_detect_stereo_sap(struct cx88_core *core)
if (ret != UNSET) if (ret != UNSET)
dprintk(1, "stereo/sap detection result:%s%s%s\n", dprintk(1, "stereo/sap detection result:%s%s%s\n",
(ret & V4L2_TUNER_SUB_MONO) ? " mono" : "", (ret & V4L2_TUNER_SUB_MONO) ? " mono" : "",
(ret & V4L2_TUNER_SUB_STEREO) ? " stereo" : "", (ret & V4L2_TUNER_SUB_STEREO) ? " stereo" : "",
(ret & V4L2_TUNER_SUB_LANG2) ? " dual" : ""); (ret & V4L2_TUNER_SUB_LANG2) ? " dual" : "");
return ret; return ret;
} }
......
This diff is collapsed.
...@@ -24,10 +24,9 @@ ...@@ -24,10 +24,9 @@
#include "cx88.h" #include "cx88.h"
#include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/io.h>
#include <asm/io.h> #include <linux/module.h>
#include <media/v4l2-common.h> #include <media/v4l2-common.h>
...@@ -41,7 +40,8 @@ MODULE_PARM_DESC(i2c_scan, "scan i2c bus at insmod time"); ...@@ -41,7 +40,8 @@ MODULE_PARM_DESC(i2c_scan, "scan i2c bus at insmod time");
static unsigned int i2c_udelay = 5; static unsigned int i2c_udelay = 5;
module_param(i2c_udelay, int, 0644); module_param(i2c_udelay, int, 0644);
MODULE_PARM_DESC(i2c_udelay, "i2c delay at insmod time, in usecs (should be 5 or higher). Lower value means higher bus speed."); MODULE_PARM_DESC(i2c_udelay,
"i2c delay at insmod time, in usecs (should be 5 or higher). Lower value means higher bus speed.");
#define dprintk(level, fmt, arg...) do { \ #define dprintk(level, fmt, arg...) do { \
if (i2c_debug >= level) \ if (i2c_debug >= level) \
...@@ -139,7 +139,6 @@ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci) ...@@ -139,7 +139,6 @@ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci)
core->i2c_algo = cx8800_i2c_algo_template; core->i2c_algo = cx8800_i2c_algo_template;
core->i2c_adap.dev.parent = &pci->dev; core->i2c_adap.dev.parent = &pci->dev;
strlcpy(core->i2c_adap.name, core->name, sizeof(core->i2c_adap.name)); strlcpy(core->i2c_adap.name, core->name, sizeof(core->i2c_adap.name));
core->i2c_adap.owner = THIS_MODULE; core->i2c_adap.owner = THIS_MODULE;
...@@ -166,14 +165,14 @@ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci) ...@@ -166,14 +165,14 @@ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci)
dprintk(1, "i2c register ok\n"); dprintk(1, "i2c register ok\n");
switch (core->boardnr) { switch (core->boardnr) {
case CX88_BOARD_HAUPPAUGE_HVR1300: case CX88_BOARD_HAUPPAUGE_HVR1300:
case CX88_BOARD_HAUPPAUGE_HVR3000: case CX88_BOARD_HAUPPAUGE_HVR3000:
case CX88_BOARD_HAUPPAUGE_HVR4000: case CX88_BOARD_HAUPPAUGE_HVR4000:
pr_info("i2c init: enabling analog demod on HVR1300/3000/4000 tuner\n"); pr_info("i2c init: enabling analog demod on HVR1300/3000/4000 tuner\n");
i2c_transfer(core->i2c_client.adapter, &tuner_msg, 1); i2c_transfer(core->i2c_client.adapter, &tuner_msg, 1);
break; break;
default: default:
break; break;
} }
if (i2c_scan) if (i2c_scan)
do_i2c_scan(core->name, &core->i2c_client); do_i2c_scan(core->name, &core->i2c_client);
......
...@@ -62,11 +62,15 @@ static int ir_debug; ...@@ -62,11 +62,15 @@ static int ir_debug;
module_param(ir_debug, int, 0644); /* debug level [IR] */ module_param(ir_debug, int, 0644); /* debug level [IR] */
MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]"); MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]");
#define ir_dprintk(fmt, arg...) if (ir_debug) \ #define ir_dprintk(fmt, arg...) do { \
printk(KERN_DEBUG "%s IR: " fmt, ir->core->name, ##arg) if (ir_debug) \
printk(KERN_DEBUG "%s IR: " fmt, ir->core->name, ##arg);\
} while (0)
#define dprintk(fmt, arg...) if (ir_debug) \ #define dprintk(fmt, arg...) do { \
printk(KERN_DEBUG "cx88 IR: " fmt, ##arg) if (ir_debug) \
printk(KERN_DEBUG "cx88 IR: " fmt, ##arg); \
} while (0)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
...@@ -79,16 +83,17 @@ static void cx88_ir_handle_key(struct cx88_IR *ir) ...@@ -79,16 +83,17 @@ static void cx88_ir_handle_key(struct cx88_IR *ir)
gpio = cx_read(ir->gpio_addr); gpio = cx_read(ir->gpio_addr);
switch (core->boardnr) { switch (core->boardnr) {
case CX88_BOARD_NPGTECH_REALTV_TOP10FM: case CX88_BOARD_NPGTECH_REALTV_TOP10FM:
/* This board apparently uses a combination of 2 GPIO /*
to represent the keys. Additionally, the second GPIO * This board apparently uses a combination of 2 GPIO
can be used for parity. * to represent the keys. Additionally, the second GPIO
* can be used for parity.
Example: *
* Example:
for key "5" *
gpio = 0x758, auxgpio = 0xe5 or 0xf5 * for key "5"
for key "Power" * gpio = 0x758, auxgpio = 0xe5 or 0xf5
gpio = 0x758, auxgpio = 0xed or 0xfd * for key "Power"
* gpio = 0x758, auxgpio = 0xed or 0xfd
*/ */
auxgpio = cx_read(MO_GP1_IO); auxgpio = cx_read(MO_GP1_IO);
...@@ -142,7 +147,7 @@ static void cx88_ir_handle_key(struct cx88_IR *ir) ...@@ -142,7 +147,7 @@ static void cx88_ir_handle_key(struct cx88_IR *ir)
if (0 == (gpio & ir->mask_keyup)) if (0 == (gpio & ir->mask_keyup))
rc_keydown_notimeout(ir->dev, RC_TYPE_NECX, scancode, rc_keydown_notimeout(ir->dev, RC_TYPE_NECX, scancode,
0); 0);
else else
rc_keyup(ir->dev); rc_keyup(ir->dev);
...@@ -231,12 +236,14 @@ int cx88_ir_start(struct cx88_core *core) ...@@ -231,12 +236,14 @@ int cx88_ir_start(struct cx88_core *core)
return 0; return 0;
} }
EXPORT_SYMBOL(cx88_ir_start);
void cx88_ir_stop(struct cx88_core *core) void cx88_ir_stop(struct cx88_core *core)
{ {
if (core->ir->users) if (core->ir->users)
__cx88_ir_stop(core); __cx88_ir_stop(core);
} }
EXPORT_SYMBOL(cx88_ir_stop);
static int cx88_ir_open(struct rc_dev *rc) static int cx88_ir_open(struct rc_dev *rc)
{ {
...@@ -508,7 +515,7 @@ int cx88_ir_fini(struct cx88_core *core) ...@@ -508,7 +515,7 @@ int cx88_ir_fini(struct cx88_core *core)
struct cx88_IR *ir = core->ir; struct cx88_IR *ir = core->ir;
/* skip detach on non attached boards */ /* skip detach on non attached boards */
if (ir == NULL) if (!ir)
return 0; return 0;
cx88_ir_stop(core); cx88_ir_stop(core);
...@@ -576,7 +583,7 @@ static int get_key_pvr2000(struct IR_i2c *ir, enum rc_type *protocol, ...@@ -576,7 +583,7 @@ static int get_key_pvr2000(struct IR_i2c *ir, enum rc_type *protocol,
} }
dprintk("IR Key/Flags: (0x%02x/0x%02x)\n", dprintk("IR Key/Flags: (0x%02x/0x%02x)\n",
code & 0xff, flags & 0xff); code & 0xff, flags & 0xff);
*protocol = RC_TYPE_UNKNOWN; *protocol = RC_TYPE_UNKNOWN;
*scancode = code & 0xff; *scancode = code & 0xff;
...@@ -636,8 +643,8 @@ void cx88_i2c_init_ir(struct cx88_core *core) ...@@ -636,8 +643,8 @@ void cx88_i2c_init_ir(struct cx88_core *core)
info.platform_data = &core->init_data; info.platform_data = &core->init_data;
} }
if (i2c_smbus_xfer(&core->i2c_adap, *addrp, 0, if (i2c_smbus_xfer(&core->i2c_adap, *addrp, 0,
I2C_SMBUS_READ, 0, I2C_SMBUS_READ, 0,
I2C_SMBUS_QUICK, NULL) >= 0) { I2C_SMBUS_QUICK, NULL) >= 0) {
info.addr = *addrp; info.addr = *addrp;
i2c_new_device(&core->i2c_adap, &info); i2c_new_device(&core->i2c_adap, &info);
break; break;
......
This diff is collapsed.
/* /*
* cx88x-hw.h - CX2388x register offsets
cx88x-hw.h - CX2388x register offsets *
* Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de)
Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de) * 2001 Michael Eskin
2001 Michael Eskin * 2002 Yurij Sysoev <yurij@naturesoft.net>
2002 Yurij Sysoev <yurij@naturesoft.net> * 2003 Gerd Knorr <kraxel@bytesex.org>
2003 Gerd Knorr <kraxel@bytesex.org> *
* This program is free software; you can redistribute it and/or modify
This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
(at your option) any later version. *
* This program is distributed in the hope that it will be useful,
This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details.
GNU General Public License for more details. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _CX88_REG_H_ #ifndef _CX88_REG_H_
#define _CX88_REG_H_ #define _CX88_REG_H_
/* ---------------------------------------------------------------------- */ /*
/* PCI IDs and config space */ * PCI IDs and config space
*/
#ifndef PCI_VENDOR_ID_CONEXANT #ifndef PCI_VENDOR_ID_CONEXANT
# define PCI_VENDOR_ID_CONEXANT 0x14F1 # define PCI_VENDOR_ID_CONEXANT 0x14F1
...@@ -39,8 +35,9 @@ ...@@ -39,8 +35,9 @@
#define CX88X_EN_TBFX 0x02 #define CX88X_EN_TBFX 0x02
#define CX88X_EN_VSFX 0x04 #define CX88X_EN_VSFX 0x04
/* ---------------------------------------------------------------------- */ /*
/* PCI controller registers */ * PCI controller registers
*/
/* Command and Status Register */ /* Command and Status Register */
#define F0_CMD_STAT_MM 0x2f0004 #define F0_CMD_STAT_MM 0x2f0004
...@@ -63,8 +60,9 @@ ...@@ -63,8 +60,9 @@
#define F3_BAR0_MM 0x2f0310 #define F3_BAR0_MM 0x2f0310
#define F4_BAR0_MM 0x2f0410 #define F4_BAR0_MM 0x2f0410
/* ---------------------------------------------------------------------- */ /*
/* DMA Controller registers */ * DMA Controller registers
*/
#define MO_PDMA_STHRSH 0x200000 // Source threshold #define MO_PDMA_STHRSH 0x200000 // Source threshold
#define MO_PDMA_STADRS 0x200004 // Source target address #define MO_PDMA_STADRS 0x200004 // Source target address
...@@ -157,9 +155,9 @@ ...@@ -157,9 +155,9 @@
#define MO_DMA31_CNT2 0x300168 // {11}RW* DMA Table Size : Ch#31 #define MO_DMA31_CNT2 0x300168 // {11}RW* DMA Table Size : Ch#31
#define MO_DMA32_CNT2 0x30016C // {11}RW* DMA Table Size : Ch#32 #define MO_DMA32_CNT2 0x30016C // {11}RW* DMA Table Size : Ch#32
/*
/* ---------------------------------------------------------------------- */ * Video registers
/* Video registers */ */
#define MO_VIDY_DMA 0x310000 // {64}RWp Video Y #define MO_VIDY_DMA 0x310000 // {64}RWp Video Y
#define MO_VIDU_DMA 0x310008 // {64}RWp Video U #define MO_VIDU_DMA 0x310008 // {64}RWp Video U
...@@ -217,9 +215,9 @@ ...@@ -217,9 +215,9 @@
#define MO_VID_DMACNTRL 0x31C040 // {8}RW Video DMA control #define MO_VID_DMACNTRL 0x31C040 // {8}RW Video DMA control
#define MO_VID_XFR_STAT 0x31C044 // {1}RO Video transfer status #define MO_VID_XFR_STAT 0x31C044 // {1}RO Video transfer status
/*
/* ---------------------------------------------------------------------- */ * audio registers
/* audio registers */ */
#define MO_AUDD_DMA 0x320000 // {64}RWp Audio downstream #define MO_AUDD_DMA 0x320000 // {64}RWp Audio downstream
#define MO_AUDU_DMA 0x320008 // {64}RWp Audio upstream #define MO_AUDU_DMA 0x320008 // {64}RWp Audio upstream
...@@ -437,9 +435,9 @@ ...@@ -437,9 +435,9 @@
#define AUD_PHACC_FREQ_8LSB 0x320d2b #define AUD_PHACC_FREQ_8LSB 0x320d2b
#define AUD_QAM_MODE 0x320d04 #define AUD_QAM_MODE 0x320d04
/*
/* ---------------------------------------------------------------------- */ * transport stream registers
/* transport stream registers */ */
#define MO_TS_DMA 0x330000 // {64}RWp Transport stream downstream #define MO_TS_DMA 0x330000 // {64}RWp Transport stream downstream
#define MO_TS_GPCNT 0x33C020 // {16}RO TS general purpose counter #define MO_TS_GPCNT 0x33C020 // {16}RO TS general purpose counter
...@@ -455,9 +453,9 @@ ...@@ -455,9 +453,9 @@
#define TS_FIFO_OVFL_STAT 0x33C05C #define TS_FIFO_OVFL_STAT 0x33C05C
#define TS_VALERR_CNTRL 0x33C060 #define TS_VALERR_CNTRL 0x33C060
/*
/* ---------------------------------------------------------------------- */ * VIP registers
/* VIP registers */ */
#define MO_VIPD_DMA 0x340000 // {64}RWp VIP downstream #define MO_VIPD_DMA 0x340000 // {64}RWp VIP downstream
#define MO_VIPU_DMA 0x340008 // {64}RWp VIP upstream #define MO_VIPU_DMA 0x340008 // {64}RWp VIP upstream
...@@ -475,9 +473,9 @@ ...@@ -475,9 +473,9 @@
#define MO_VIP_INTCNTRL 0x34C05C // VIP Interrupt Control #define MO_VIP_INTCNTRL 0x34C05C // VIP Interrupt Control
#define MO_VIP_XFTERM 0x340060 // VIP transfer terminate #define MO_VIP_XFTERM 0x340060 // VIP transfer terminate
/*
/* ---------------------------------------------------------------------- */ * misc registers
/* misc registers */ */
#define MO_M2M_DMA 0x350000 // {64}RWp Mem2Mem DMA Bfr #define MO_M2M_DMA 0x350000 // {64}RWp Mem2Mem DMA Bfr
#define MO_GP0_IO 0x350010 // {32}RW* GPIOoutput enablesdata I/O #define MO_GP0_IO 0x350010 // {32}RW* GPIOoutput enablesdata I/O
...@@ -509,9 +507,9 @@ ...@@ -509,9 +507,9 @@
#define MO_INT1_STAT 0x35C064 // DMA RISC interrupt status #define MO_INT1_STAT 0x35C064 // DMA RISC interrupt status
#define MO_INT1_MSTAT 0x35C068 // DMA RISC interrupt masked status #define MO_INT1_MSTAT 0x35C068 // DMA RISC interrupt masked status
/*
/* ---------------------------------------------------------------------- */ * i2c bus registers
/* i2c bus registers */ */
#define MO_I2C 0x368000 // I2C data/control #define MO_I2C 0x368000 // I2C data/control
#define MO_I2C_DIV (0xf<<4) #define MO_I2C_DIV (0xf<<4)
...@@ -521,9 +519,11 @@ ...@@ -521,9 +519,11 @@
#define MO_I2C_SDA (1<<0) #define MO_I2C_SDA (1<<0)
/* ---------------------------------------------------------------------- */ /*
/* general purpose host registers */ * general purpose host registers
/* FIXME: tyops? s/0x35/0x38/ ?? */ *
* FIXME: tyops? s/0x35/0x38/ ??
*/
#define MO_GPHSTD_DMA 0x350000 // {64}RWp Host downstream #define MO_GPHSTD_DMA 0x350000 // {64}RWp Host downstream
#define MO_GPHSTU_DMA 0x350008 // {64}RWp Host upstream #define MO_GPHSTU_DMA 0x350008 // {64}RWp Host upstream
...@@ -545,9 +545,9 @@ ...@@ -545,9 +545,9 @@
#define MO_GPHST_XFR_STAT 0x38C044 // Host transfer status #define MO_GPHST_XFR_STAT 0x38C044 // Host transfer status
#define MO_GPHST_SOFT_RST 0x38C06C // Host software reset #define MO_GPHST_SOFT_RST 0x38C06C // Host software reset
/*
/* ---------------------------------------------------------------------- */ * RISC instructions
/* RISC instructions */ */
#define RISC_SYNC 0x80000000 #define RISC_SYNC 0x80000000
#define RISC_SYNC_ODD 0x80000000 #define RISC_SYNC_ODD 0x80000000
...@@ -578,9 +578,9 @@ ...@@ -578,9 +578,9 @@
#define RISC_CNT_RESET 0x00030000 #define RISC_CNT_RESET 0x00030000
#define RISC_JMP_SRP 0x01 #define RISC_JMP_SRP 0x01
/*
/* ---------------------------------------------------------------------- */ * various constants
/* various constants */ */
// DMA // DMA
/* Interrupt mask/status */ /* Interrupt mask/status */
......
...@@ -57,7 +57,8 @@ MODULE_PARM_DESC(always_analog, "force analog audio out"); ...@@ -57,7 +57,8 @@ MODULE_PARM_DESC(always_analog, "force analog audio out");
static unsigned int radio_deemphasis; static unsigned int radio_deemphasis;
module_param(radio_deemphasis, int, 0644); module_param(radio_deemphasis, int, 0644);
MODULE_PARM_DESC(radio_deemphasis, "Radio deemphasis time constant, 0=None, 1=50us (elsewhere), 2=75us (USA)"); MODULE_PARM_DESC(radio_deemphasis,
"Radio deemphasis time constant, 0=None, 1=50us (elsewhere), 2=75us (USA)");
#define dprintk(fmt, arg...) do { \ #define dprintk(fmt, arg...) do { \
if (audio_debug) \ if (audio_debug) \
...@@ -141,7 +142,10 @@ static void set_audio_finish(struct cx88_core *core, u32 ctl) ...@@ -141,7 +142,10 @@ static void set_audio_finish(struct cx88_core *core, u32 ctl)
if (core->board.mpeg & CX88_MPEG_BLACKBIRD) { if (core->board.mpeg & CX88_MPEG_BLACKBIRD) {
cx_write(AUD_I2SINPUTCNTL, 4); cx_write(AUD_I2SINPUTCNTL, 4);
cx_write(AUD_BAUDRATE, 1); cx_write(AUD_BAUDRATE, 1);
/* 'pass-thru mode': this enables the i2s output to the mpeg encoder */ /*
* 'pass-thru mode': this enables the i2s
* output to the mpeg encoder
*/
cx_set(AUD_CTL, EN_I2SOUT_ENABLE); cx_set(AUD_CTL, EN_I2SOUT_ENABLE);
cx_write(AUD_I2SOUTPUTCNTL, 1); cx_write(AUD_I2SOUTPUTCNTL, 1);
cx_write(AUD_I2SCNTL, 0); cx_write(AUD_I2SCNTL, 0);
...@@ -634,7 +638,6 @@ static void set_audio_standard_A2(struct cx88_core *core, u32 mode) ...@@ -634,7 +638,6 @@ static void set_audio_standard_A2(struct cx88_core *core, u32 mode)
case WW_M: case WW_M:
dprintk("%s Warning: wrong value\n", __func__); dprintk("%s Warning: wrong value\n", __func__);
return; return;
break;
} }
mode |= EN_FMRADIO_EN_RDS | EN_DMTRX_SUMDIFF; mode |= EN_FMRADIO_EN_RDS | EN_DMTRX_SUMDIFF;
...@@ -691,13 +694,15 @@ static void set_audio_standard_FM(struct cx88_core *core, ...@@ -691,13 +694,15 @@ static void set_audio_standard_FM(struct cx88_core *core,
{ /* end of list */ }, { /* end of list */ },
}; };
/* It is enough to leave default values? */ /*
/* No, it's not! The deemphasis registers are reset to the 75us * It is enough to leave default values?
*
* No, it's not! The deemphasis registers are reset to the 75us
* values by default. Analyzing the spectrum of the decoded audio * values by default. Analyzing the spectrum of the decoded audio
* reveals that "no deemphasis" is the same as 75 us, while the 50 us * reveals that "no deemphasis" is the same as 75 us, while the 50 us
* setting results in less deemphasis. */ * setting results in less deemphasis.
*/
static const struct rlist fm_no_deemph[] = { static const struct rlist fm_no_deemph[] = {
{AUD_POLYPH80SCALEFAC, 0x0003}, {AUD_POLYPH80SCALEFAC, 0x0003},
{ /* end of list */ }, { /* end of list */ },
}; };
...@@ -741,7 +746,7 @@ static int cx88_detect_nicam(struct cx88_core *core) ...@@ -741,7 +746,7 @@ static int cx88_detect_nicam(struct cx88_core *core)
} }
/* wait a little bit for next reading status */ /* wait a little bit for next reading status */
msleep(10); usleep_range(10000, 20000);
} }
dprintk("nicam is not detected.\n"); dprintk("nicam is not detected.\n");
...@@ -762,8 +767,10 @@ void cx88_set_tvaudio(struct cx88_core *core) ...@@ -762,8 +767,10 @@ void cx88_set_tvaudio(struct cx88_core *core)
/* prepare all dsp registers */ /* prepare all dsp registers */
set_audio_standard_A2(core, EN_A2_FORCE_MONO1); set_audio_standard_A2(core, EN_A2_FORCE_MONO1);
/* set nicam mode - otherwise /*
AUD_NICAM_STATUS2 contains wrong values */ * set nicam mode - otherwise
* AUD_NICAM_STATUS2 contains wrong values
*/
set_audio_standard_NICAM(core, EN_NICAM_AUTO_STEREO); set_audio_standard_NICAM(core, EN_NICAM_AUTO_STEREO);
if (cx88_detect_nicam(core) == 0) { if (cx88_detect_nicam(core) == 0) {
/* fall back to fm / am mono */ /* fall back to fm / am mono */
...@@ -797,19 +804,22 @@ void cx88_set_tvaudio(struct cx88_core *core) ...@@ -797,19 +804,22 @@ void cx88_set_tvaudio(struct cx88_core *core)
pr_info("unknown tv audio mode [%d]\n", core->tvaudio); pr_info("unknown tv audio mode [%d]\n", core->tvaudio);
break; break;
} }
return;
} }
EXPORT_SYMBOL(cx88_set_tvaudio);
void cx88_newstation(struct cx88_core *core) void cx88_newstation(struct cx88_core *core)
{ {
core->audiomode_manual = UNSET; core->audiomode_manual = UNSET;
core->last_change = jiffies; core->last_change = jiffies;
} }
EXPORT_SYMBOL(cx88_newstation);
void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t) void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t)
{ {
static const char * const m[] = { "stereo", "dual mono", "mono", "sap" }; static const char * const m[] = { "stereo", "dual mono",
static const char * const p[] = { "no pilot", "pilot c1", "pilot c2", "?" }; "mono", "sap" };
static const char * const p[] = { "no pilot", "pilot c1",
"pilot c2", "?" };
u32 reg, mode, pilot; u32 reg, mode, pilot;
reg = cx_read(AUD_STATUS); reg = cx_read(AUD_STATUS);
...@@ -866,13 +876,16 @@ void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t) ...@@ -866,13 +876,16 @@ void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t)
/* If software stereo detection is not supported... */ /* If software stereo detection is not supported... */
if (t->rxsubchans == UNSET) { if (t->rxsubchans == UNSET) {
t->rxsubchans = V4L2_TUNER_SUB_MONO; t->rxsubchans = V4L2_TUNER_SUB_MONO;
/* If the hardware itself detected stereo, also return /*
stereo as an available subchannel */ * If the hardware itself detected stereo, also return
* stereo as an available subchannel
*/
if (t->audmode == V4L2_TUNER_MODE_STEREO) if (t->audmode == V4L2_TUNER_MODE_STEREO)
t->rxsubchans |= V4L2_TUNER_SUB_STEREO; t->rxsubchans |= V4L2_TUNER_SUB_STEREO;
} }
return;
} }
EXPORT_SYMBOL(cx88_get_stereo);
void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual) void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual)
{ {
...@@ -928,7 +941,8 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual) ...@@ -928,7 +941,8 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual)
break; break;
} }
} else { } else {
if ((core->tvaudio == WW_I) || (core->tvaudio == WW_L)) { if ((core->tvaudio == WW_I) ||
(core->tvaudio == WW_L)) {
/* fall back to fm / am mono */ /* fall back to fm / am mono */
set_audio_standard_A2(core, EN_A2_FORCE_MONO1); set_audio_standard_A2(core, EN_A2_FORCE_MONO1);
} else { } else {
...@@ -976,8 +990,8 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual) ...@@ -976,8 +990,8 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual)
cx_read(AUD_CTL), cx_sread(SHADOW_AUD_VOL_CTL)); cx_read(AUD_CTL), cx_sread(SHADOW_AUD_VOL_CTL));
cx_andor(AUD_CTL, mask, ctl); cx_andor(AUD_CTL, mask, ctl);
} }
return;
} }
EXPORT_SYMBOL(cx88_set_stereo);
int cx88_audio_thread(void *data) int cx88_audio_thread(void *data)
{ {
...@@ -1027,8 +1041,10 @@ int cx88_audio_thread(void *data) ...@@ -1027,8 +1041,10 @@ int cx88_audio_thread(void *data)
case WW_FM: case WW_FM:
case WW_I2SADC: case WW_I2SADC:
hw_autodetect: hw_autodetect:
/* stereo autodetection is supported by hardware so /*
we don't need to do it manually. Do nothing. */ * stereo autodetection is supported by hardware so
* we don't need to do it manually. Do nothing.
*/
break; break;
} }
} }
...@@ -1036,11 +1052,4 @@ int cx88_audio_thread(void *data) ...@@ -1036,11 +1052,4 @@ int cx88_audio_thread(void *data)
dprintk("cx88: tvaudio thread exiting\n"); dprintk("cx88: tvaudio thread exiting\n");
return 0; return 0;
} }
/* ----------------------------------------------------------- */
EXPORT_SYMBOL(cx88_set_tvaudio);
EXPORT_SYMBOL(cx88_newstation);
EXPORT_SYMBOL(cx88_set_stereo);
EXPORT_SYMBOL(cx88_get_stereo);
EXPORT_SYMBOL(cx88_audio_thread); EXPORT_SYMBOL(cx88_audio_thread);
...@@ -20,7 +20,7 @@ MODULE_PARM_DESC(vbi_debug, "enable debug messages [vbi]"); ...@@ -20,7 +20,7 @@ MODULE_PARM_DESC(vbi_debug, "enable debug messages [vbi]");
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
int cx8800_vbi_fmt(struct file *file, void *priv, int cx8800_vbi_fmt(struct file *file, void *priv,
struct v4l2_format *f) struct v4l2_format *f)
{ {
struct cx8800_dev *dev = video_drvdata(file); struct cx8800_dev *dev = video_drvdata(file);
...@@ -48,8 +48,8 @@ int cx8800_vbi_fmt(struct file *file, void *priv, ...@@ -48,8 +48,8 @@ int cx8800_vbi_fmt(struct file *file, void *priv,
} }
static int cx8800_start_vbi_dma(struct cx8800_dev *dev, static int cx8800_start_vbi_dma(struct cx8800_dev *dev,
struct cx88_dmaqueue *q, struct cx88_dmaqueue *q,
struct cx88_buffer *buf) struct cx88_buffer *buf)
{ {
struct cx88_core *core = dev->core; struct cx88_core *core = dev->core;
...@@ -57,9 +57,9 @@ static int cx8800_start_vbi_dma(struct cx8800_dev *dev, ...@@ -57,9 +57,9 @@ static int cx8800_start_vbi_dma(struct cx8800_dev *dev,
cx88_sram_channel_setup(dev->core, &cx88_sram_channels[SRAM_CH24], cx88_sram_channel_setup(dev->core, &cx88_sram_channels[SRAM_CH24],
VBI_LINE_LENGTH, buf->risc.dma); VBI_LINE_LENGTH, buf->risc.dma);
cx_write(MO_VBOS_CONTROL, ((1 << 18) | // comb filter delay fixup cx_write(MO_VBOS_CONTROL, (1 << 18) | /* comb filter delay fixup */
(1 << 15) | // enable vbi capture (1 << 15) | /* enable vbi capture */
(1 << 11))); (1 << 11));
/* reset counter */ /* reset counter */
cx_write(MO_VBI_GPCNTRL, GP_COUNT_CONTROL_RESET); cx_write(MO_VBI_GPCNTRL, GP_COUNT_CONTROL_RESET);
...@@ -73,7 +73,7 @@ static int cx8800_start_vbi_dma(struct cx8800_dev *dev, ...@@ -73,7 +73,7 @@ static int cx8800_start_vbi_dma(struct cx8800_dev *dev,
cx_set(VID_CAPTURE_CONTROL, 0x18); cx_set(VID_CAPTURE_CONTROL, 0x18);
/* start dma */ /* start dma */
cx_set(MO_DEV_CNTRL2, (1<<5)); cx_set(MO_DEV_CNTRL2, (1 << 5));
cx_set(MO_VID_DMACNTRL, 0x88); cx_set(MO_VID_DMACNTRL, 0x88);
return 0; return 0;
...@@ -112,8 +112,8 @@ int cx8800_restart_vbi_queue(struct cx8800_dev *dev, ...@@ -112,8 +112,8 @@ int cx8800_restart_vbi_queue(struct cx8800_dev *dev,
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
static int queue_setup(struct vb2_queue *q, static int queue_setup(struct vb2_queue *q,
unsigned int *num_buffers, unsigned int *num_planes, unsigned int *num_buffers, unsigned int *num_planes,
unsigned int sizes[], struct device *alloc_devs[]) unsigned int sizes[], struct device *alloc_devs[])
{ {
struct cx8800_dev *dev = q->drv_priv; struct cx8800_dev *dev = q->drv_priv;
...@@ -125,7 +125,6 @@ static int queue_setup(struct vb2_queue *q, ...@@ -125,7 +125,6 @@ static int queue_setup(struct vb2_queue *q,
return 0; return 0;
} }
static int buffer_prepare(struct vb2_buffer *vb) static int buffer_prepare(struct vb2_buffer *vb)
{ {
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
......
This diff is collapsed.
...@@ -22,8 +22,7 @@ ...@@ -22,8 +22,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/io.h>
#include <asm/io.h>
MODULE_DESCRIPTION("driver for cx2388x VP3054 design"); MODULE_DESCRIPTION("driver for cx2388x VP3054 design");
MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>"); MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
...@@ -108,7 +107,7 @@ int vp3054_i2c_probe(struct cx8802_dev *dev) ...@@ -108,7 +107,7 @@ int vp3054_i2c_probe(struct cx8802_dev *dev)
return 0; return 0;
vp3054_i2c = kzalloc(sizeof(*vp3054_i2c), GFP_KERNEL); vp3054_i2c = kzalloc(sizeof(*vp3054_i2c), GFP_KERNEL);
if (vp3054_i2c == NULL) if (!vp3054_i2c)
return -ENOMEM; return -ENOMEM;
dev->vp3054 = vp3054_i2c; dev->vp3054 = vp3054_i2c;
...@@ -135,18 +134,17 @@ int vp3054_i2c_probe(struct cx8802_dev *dev) ...@@ -135,18 +134,17 @@ int vp3054_i2c_probe(struct cx8802_dev *dev)
return rc; return rc;
} }
EXPORT_SYMBOL(vp3054_i2c_probe);
void vp3054_i2c_remove(struct cx8802_dev *dev) void vp3054_i2c_remove(struct cx8802_dev *dev)
{ {
struct vp3054_i2c_state *vp3054_i2c = dev->vp3054; struct vp3054_i2c_state *vp3054_i2c = dev->vp3054;
if (vp3054_i2c == NULL || if (!vp3054_i2c ||
dev->core->boardnr != CX88_BOARD_DNTV_LIVE_DVB_T_PRO) dev->core->boardnr != CX88_BOARD_DNTV_LIVE_DVB_T_PRO)
return; return;
i2c_del_adapter(&vp3054_i2c->adap); i2c_del_adapter(&vp3054_i2c->adap);
kfree(vp3054_i2c); kfree(vp3054_i2c);
} }
EXPORT_SYMBOL(vp3054_i2c_probe);
EXPORT_SYMBOL(vp3054_i2c_remove); EXPORT_SYMBOL(vp3054_i2c_remove);
/* /*
* cx88-vp3054-i2c.h -- support for the secondary I2C bus of the
cx88-vp3054-i2c.h -- support for the secondary I2C bus of the * DNTV Live! DVB-T Pro (VP-3054), wired as:
DNTV Live! DVB-T Pro (VP-3054), wired as: * GPIO[0] -> SCL, GPIO[1] -> SDA
GPIO[0] -> SCL, GPIO[1] -> SDA *
* (c) 2005 Chris Pascoe <c.pascoe@itee.uq.edu.au>
(c) 2005 Chris Pascoe <c.pascoe@itee.uq.edu.au> *
* This program is free software; you can redistribute it and/or modify
This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
(at your option) any later version. *
* This program is distributed in the hope that it will be useful,
This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details.
GNU General Public License for more details. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
struct vp3054_i2c_state { struct vp3054_i2c_state {
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment