From d20f690594fe1e459fb4e61d65546fc133df3793 Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 16 Oct 2008 22:15:10 -0400 Subject: s5h1411: Improvements to the default registers From: Steven Toth s5h1411: Improvements to the default registers Priority: normal Signed-off-by: Steven Toth --- linux/drivers/media/dvb/frontends/s5h1411.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/frontends/s5h1411.c b/linux/drivers/media/dvb/frontends/s5h1411.c index 2febfb5a8..a642cae63 100644 --- a/linux/drivers/media/dvb/frontends/s5h1411.c +++ b/linux/drivers/media/dvb/frontends/s5h1411.c @@ -62,7 +62,7 @@ static struct init_tab { { S5H1411_I2C_TOP_ADDR, 0x08, 0x0047, }, { S5H1411_I2C_TOP_ADDR, 0x1c, 0x0400, }, { S5H1411_I2C_TOP_ADDR, 0x1e, 0x0370, }, - { S5H1411_I2C_TOP_ADDR, 0x1f, 0x342a, }, + { S5H1411_I2C_TOP_ADDR, 0x1f, 0x342c, }, { S5H1411_I2C_TOP_ADDR, 0x24, 0x0231, }, { S5H1411_I2C_TOP_ADDR, 0x25, 0x1011, }, { S5H1411_I2C_TOP_ADDR, 0x26, 0x0f07, }, @@ -100,7 +100,6 @@ static struct init_tab { { S5H1411_I2C_TOP_ADDR, 0x78, 0x3141, }, { S5H1411_I2C_TOP_ADDR, 0x7a, 0x3141, }, { S5H1411_I2C_TOP_ADDR, 0xb3, 0x8003, }, - { S5H1411_I2C_TOP_ADDR, 0xb5, 0xafbb, }, { S5H1411_I2C_TOP_ADDR, 0xb5, 0xa6bb, }, { S5H1411_I2C_TOP_ADDR, 0xb6, 0x0609, }, { S5H1411_I2C_TOP_ADDR, 0xb7, 0x2f06, }, -- cgit v1.2.3 From 8b08dc76bbe323b941b823d289c498f27057456f Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 16 Oct 2008 22:16:50 -0400 Subject: s5h1411: I/F related bugfix for 3.25 and remove spurious define From: Steven Toth This should improve performance. Priority: normal Signed-off-by: Steven Toth --- linux/drivers/media/dvb/frontends/s5h1411.c | 2 +- linux/drivers/media/dvb/frontends/s5h1411.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/frontends/s5h1411.c b/linux/drivers/media/dvb/frontends/s5h1411.c index a642cae63..25a3fb31e 100644 --- a/linux/drivers/media/dvb/frontends/s5h1411.c +++ b/linux/drivers/media/dvb/frontends/s5h1411.c @@ -392,7 +392,7 @@ static int s5h1411_set_if_freq(struct dvb_frontend *fe, int KHz) switch (KHz) { case 3250: - s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0x38, 0x10d9); + s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0x38, 0x10d5); s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0x39, 0x5342); s5h1411_writereg(state, S5H1411_I2C_QAM_ADDR, 0x2c, 0x10d9); break; diff --git a/linux/drivers/media/dvb/frontends/s5h1411.h b/linux/drivers/media/dvb/frontends/s5h1411.h index 7d542bc00..2370a06de 100644 --- a/linux/drivers/media/dvb/frontends/s5h1411.h +++ b/linux/drivers/media/dvb/frontends/s5h1411.h @@ -47,7 +47,6 @@ struct s5h1411_config { u16 mpeg_timing; /* IF Freq for QAM and VSB in KHz */ -#define S5H1411_IF_2500 2500 #define S5H1411_IF_3500 3500 #define S5H1411_IF_4000 4000 #define S5H1411_IF_5380 5380 -- cgit v1.2.3 From 18a36373dd651572c6d08e930a38e8421abcafe8 Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 16 Oct 2008 22:17:42 -0400 Subject: s5h1411: read_status() locking detection fixes. From: Steven Toth This includes new bit definitions for previously unknown bits. Priority: normal Signed-off-by: Steven Toth --- linux/drivers/media/dvb/frontends/s5h1411.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/frontends/s5h1411.c b/linux/drivers/media/dvb/frontends/s5h1411.c index 25a3fb31e..c79e23ded 100644 --- a/linux/drivers/media/dvb/frontends/s5h1411.c +++ b/linux/drivers/media/dvb/frontends/s5h1411.c @@ -636,28 +636,29 @@ static int s5h1411_read_status(struct dvb_frontend *fe, fe_status_t *status) *status = 0; - /* Get the demodulator status */ - reg = (s5h1411_readreg(state, S5H1411_I2C_TOP_ADDR, 0xf2) >> 15) - & 0x0001; - if (reg) - *status |= FE_HAS_LOCK | FE_HAS_CARRIER | FE_HAS_SIGNAL; + /* Register F2 bit 15 = Master Lock, removed */ switch (state->current_modulation) { case QAM_64: case QAM_256: reg = s5h1411_readreg(state, S5H1411_I2C_TOP_ADDR, 0xf0); - if (reg & 0x100) - *status |= FE_HAS_VITERBI; - if (reg & 0x10) - *status |= FE_HAS_SYNC; + if (reg & 0x10) /* QAM FEC Lock */ + *status |= FE_HAS_SYNC | FE_HAS_LOCK; + if (reg & 0x100) /* QAM EQ Lock */ + *status |= FE_HAS_VITERBI | FE_HAS_CARRIER | FE_HAS_SIGNAL; + break; case VSB_8: - reg = s5h1411_readreg(state, S5H1411_I2C_TOP_ADDR, 0x5e); - if (reg & 0x0001) - *status |= FE_HAS_SYNC; reg = s5h1411_readreg(state, S5H1411_I2C_TOP_ADDR, 0xf2); - if (reg & 0x1000) - *status |= FE_HAS_VITERBI; + if (reg & 0x1000) /* FEC Lock */ + *status |= FE_HAS_SYNC | FE_HAS_LOCK; + if (reg & 0x2000) /* EQ Lock */ + *status |= FE_HAS_VITERBI | FE_HAS_CARRIER | FE_HAS_SIGNAL; + + reg = s5h1411_readreg(state, S5H1411_I2C_TOP_ADDR, 0x53); + if (reg & 0x1) /* AFC Lock */ + *status |= FE_HAS_SIGNAL; + break; default: return -EINVAL; -- cgit v1.2.3 From 1b8500f35fad508989d5bdcd8865e059576eaa81 Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 16 Oct 2008 22:18:49 -0400 Subject: s5h1411: bugfix: Setting serial or parallel mode could destroy bits From: Steven Toth Adding a serialmode function to read/and/or/write the register for safety. Priority: normal Signed-off-by: Steven Toth --- linux/drivers/media/dvb/frontends/s5h1411.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/frontends/s5h1411.c b/linux/drivers/media/dvb/frontends/s5h1411.c index c79e23ded..4cb056140 100644 --- a/linux/drivers/media/dvb/frontends/s5h1411.c +++ b/linux/drivers/media/dvb/frontends/s5h1411.c @@ -470,6 +470,20 @@ static int s5h1411_set_spectralinversion(struct dvb_frontend *fe, int inversion) return s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0x24, val); } +static int s5h1411_set_serialmode(struct dvb_frontend *fe, int serial) +{ + struct s5h1411_state *state = fe->demodulator_priv; + u16 val; + + dprintk("%s(%d)\n", __func__, serial); + val = s5h1411_readreg(state, S5H1411_I2C_TOP_ADDR, 0xbd) & ~0x100; + + if (serial == 1) + val |= 0x100; + + return s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0xbd, val); +} + static int s5h1411_enable_modulation(struct dvb_frontend *fe, fe_modulation_t m) { @@ -611,10 +625,10 @@ static int s5h1411_init(struct dvb_frontend *fe) if (state->config->output_mode == S5H1411_SERIAL_OUTPUT) /* Serial */ - s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0xbd, 0x1101); + s5h1411_set_serialmode(fe, 1); else /* Parallel */ - s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0xbd, 0x1001); + s5h1411_set_serialmode(fe, 0); s5h1411_set_spectralinversion(fe, state->config->inversion); s5h1411_set_if_freq(fe, state->config->vsb_if); -- cgit v1.2.3 From 9ced9fd4c8815e0c6f005c4c2b578859b62be39f Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 16 Oct 2008 22:26:05 -0400 Subject: s5h1411: Remove meaningless code From: Steven Toth s5h1411: Remove meaningless code Priority: normal Signed-off-by: Steven Toth --- linux/drivers/media/dvb/frontends/s5h1411.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/frontends/s5h1411.c b/linux/drivers/media/dvb/frontends/s5h1411.c index 4cb056140..e328d88bc 100644 --- a/linux/drivers/media/dvb/frontends/s5h1411.c +++ b/linux/drivers/media/dvb/frontends/s5h1411.c @@ -463,8 +463,6 @@ static int s5h1411_set_spectralinversion(struct dvb_frontend *fe, int inversion) if (inversion == 1) val |= 0x1000; /* Inverted */ - else - val |= 0x0000; state->inversion = inversion; return s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0x24, val); -- cgit v1.2.3 From 7610bcd8a954afb71a5d0aa514e57458296cd513 Mon Sep 17 00:00:00 2001 From: Andy Walls Date: Sat, 18 Oct 2008 07:51:28 -0400 Subject: cx18: Fix memory leak on card initialization failure From: Andy Walls On error exit, the cx18_probe() function did not use the proper entry in cx18_cards[] with kfree() when card init failed; leaking memory. Priority: normal Signed-off-by: Andy Walls --- linux/drivers/media/video/cx18/cx18-driver.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/cx18/cx18-driver.c b/linux/drivers/media/video/cx18/cx18-driver.c index 085121c2b..ef60f561d 100644 --- a/linux/drivers/media/video/cx18/cx18-driver.c +++ b/linux/drivers/media/video/cx18/cx18-driver.c @@ -613,6 +613,7 @@ static int __devinit cx18_probe(struct pci_dev *dev, const struct pci_device_id *pci_id) { int retval = 0; + int i; int vbi_buf_size; u32 devtype; struct cx18 *cx; @@ -836,8 +837,11 @@ err: CX18_ERR("Error %d on initialization\n", retval); cx18_log_statistics(cx); - kfree(cx18_cards[cx18_cards_active]); - cx18_cards[cx18_cards_active] = NULL; + i = cx->num; + spin_lock(&cx18_cards_lock); + kfree(cx18_cards[i]); + cx18_cards[i] = NULL; + spin_unlock(&cx18_cards_lock); return retval; } -- cgit v1.2.3 From 1683669016ee3471754c212841fe20c3f91ce9c2 Mon Sep 17 00:00:00 2001 From: Andy Walls Date: Sat, 18 Oct 2008 08:00:26 -0400 Subject: cx18: Add __iomem address space qualifier to cx18_log_*_retries() argument From: Andy Walls cx18: Add __iomem address space qualifier to cx18_log_*_retries() addr argument to clean up sparse build warnings. Priority: normal Signed-off-by: Andy Walls --- linux/drivers/media/video/cx18/cx18-io.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/cx18/cx18-io.h b/linux/drivers/media/video/cx18/cx18-io.h index 197d4fbd9..287a5e8bf 100644 --- a/linux/drivers/media/video/cx18/cx18-io.h +++ b/linux/drivers/media/video/cx18/cx18-io.h @@ -39,7 +39,7 @@ static inline void cx18_io_delay(struct cx18 *cx) /* Statistics gathering */ static inline -void cx18_log_write_retries(struct cx18 *cx, int i, const void *addr) +void cx18_log_write_retries(struct cx18 *cx, int i, const void __iomem *addr) { if (i > CX18_MAX_MMIO_RETRIES) i = CX18_MAX_MMIO_RETRIES; @@ -48,7 +48,7 @@ void cx18_log_write_retries(struct cx18 *cx, int i, const void *addr) } static inline -void cx18_log_read_retries(struct cx18 *cx, int i, const void *addr) +void cx18_log_read_retries(struct cx18 *cx, int i, const void __iomem *addr) { if (i > CX18_MAX_MMIO_RETRIES) i = CX18_MAX_MMIO_RETRIES; -- cgit v1.2.3 From bf2453805a429184402ab0ea2ef0e9ad6c3ab278 Mon Sep 17 00:00:00 2001 From: Andy Walls Date: Sat, 18 Oct 2008 09:20:25 -0400 Subject: cx18: Don't mask many real init error codes by mapping them to ENOMEM From: Andy Walls Changes to let error return codes bubble up to the user visible error message on card initialization. A number of them were being remapped to ENOMEM when no memory or array resource shortage existed. That hampered diagnosis of user trouble reports. Priority: normal Signed-off-by: Andy Walls --- linux/drivers/media/video/cx18/cx18-driver.c | 3 ++- linux/drivers/media/video/cx18/cx18-streams.c | 36 ++++++++++++++++----------- 2 files changed, 24 insertions(+), 15 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/cx18/cx18-driver.c b/linux/drivers/media/video/cx18/cx18-driver.c index ef60f561d..7a1a7830a 100644 --- a/linux/drivers/media/video/cx18/cx18-driver.c +++ b/linux/drivers/media/video/cx18/cx18-driver.c @@ -699,7 +699,8 @@ static int __devinit cx18_probe(struct pci_dev *dev, /* active i2c */ CX18_DEBUG_INFO("activating i2c...\n"); - if (init_cx18_i2c(cx)) { + retval = init_cx18_i2c(cx); + if (retval) { CX18_ERR("Could not initialize i2c\n"); goto free_map; } diff --git a/linux/drivers/media/video/cx18/cx18-streams.c b/linux/drivers/media/video/cx18/cx18-streams.c index f85f4a2cd..8ead4025e 100644 --- a/linux/drivers/media/video/cx18/cx18-streams.c +++ b/linux/drivers/media/video/cx18/cx18-streams.c @@ -200,16 +200,18 @@ static int cx18_prep_dev(struct cx18 *cx, int type) /* Initialize v4l2 variables and register v4l2 devices */ int cx18_streams_setup(struct cx18 *cx) { - int type; + int type, ret; /* Setup V4L2 Devices */ for (type = 0; type < CX18_MAX_STREAMS; type++) { /* Prepare device */ - if (cx18_prep_dev(cx, type)) + ret = cx18_prep_dev(cx, type); + if (ret < 0) break; /* Allocate Stream */ - if (cx18_stream_alloc(&cx->streams[type])) + ret = cx18_stream_alloc(&cx->streams[type]); + if (ret < 0) break; } if (type == CX18_MAX_STREAMS) @@ -217,14 +219,14 @@ int cx18_streams_setup(struct cx18 *cx) /* One or more streams could not be initialized. Clean 'em all up. */ cx18_streams_cleanup(cx, 0); - return -ENOMEM; + return ret; } static int cx18_reg_dev(struct cx18 *cx, int type) { struct cx18_stream *s = &cx->streams[type]; int vfl_type = cx18_stream_info[type].vfl_type; - int num; + int num, ret; /* TODO: Shouldn't this be a VFL_TYPE_TRANSPORT or something? * We need a VFL_TYPE_TS defined. @@ -233,9 +235,10 @@ static int cx18_reg_dev(struct cx18 *cx, int type) /* just return if no DVB is supported */ if ((cx->card->hw_all & CX18_HW_DVB) == 0) return 0; - if (cx18_dvb_register(s) < 0) { + ret = cx18_dvb_register(s); + if (ret < 0) { CX18_ERR("DVB failed to register\n"); - return -EINVAL; + return ret; } } @@ -252,12 +255,13 @@ static int cx18_reg_dev(struct cx18 *cx, int type) } /* Register device. First try the desired minor, then any free one. */ - if (video_register_device(s->v4l2dev, vfl_type, num)) { + ret = video_register_device(s->v4l2dev, vfl_type, num); + if (ret < 0) { CX18_ERR("Couldn't register v4l2 device for %s kernel number %d\n", s->name, num); video_device_release(s->v4l2dev); s->v4l2dev = NULL; - return -ENOMEM; + return ret; } num = s->v4l2dev->num; @@ -290,18 +294,22 @@ static int cx18_reg_dev(struct cx18 *cx, int type) int cx18_streams_register(struct cx18 *cx) { int type; - int err = 0; + int err; + int ret = 0; /* Register V4L2 devices */ - for (type = 0; type < CX18_MAX_STREAMS; type++) - err |= cx18_reg_dev(cx, type); + for (type = 0; type < CX18_MAX_STREAMS; type++) { + err = cx18_reg_dev(cx, type); + if (err && ret == 0) + ret = err; + } - if (err == 0) + if (ret == 0) return 0; /* One or more streams could not be initialized. Clean 'em all up. */ cx18_streams_cleanup(cx, 1); - return -ENOMEM; + return ret; } /* Unregister v4l2 devices */ -- cgit v1.2.3 From 37c0bbb8b66b77c28483ce7de81c8ec00d37277f Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Sat, 18 Oct 2008 10:19:31 -0400 Subject: s5h1411: Add the #define for an existing supporting I/F From: Steven Toth s5h1411: Add the #define for an existing supporting I/F Priority: normal Signed-off-by: Steven Toth --- linux/drivers/media/dvb/frontends/s5h1411.h | 1 + 1 file changed, 1 insertion(+) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/frontends/s5h1411.h b/linux/drivers/media/dvb/frontends/s5h1411.h index 2370a06de..45ec0f829 100644 --- a/linux/drivers/media/dvb/frontends/s5h1411.h +++ b/linux/drivers/media/dvb/frontends/s5h1411.h @@ -47,6 +47,7 @@ struct s5h1411_config { u16 mpeg_timing; /* IF Freq for QAM and VSB in KHz */ +#define S5H1411_IF_3250 3250 #define S5H1411_IF_3500 3500 #define S5H1411_IF_4000 4000 #define S5H1411_IF_5380 5380 -- cgit v1.2.3 From fb62eda9894fa969ba3b15cce9f32fd74bdc42e7 Mon Sep 17 00:00:00 2001 From: Mike Isely Date: Sun, 19 Oct 2008 14:26:05 -0500 Subject: pvrusb2: Fix deadlock problem From: Mike Isely Fix deadlock problem in 2.6.27 caused by new USB core behavior in response to a USB device reset request. With older kernels, the USB device reset was "in line"; the reset simply took place and the driver retained its association with the hardware. However now this reset triggers a disconnect, and worse still the disconnect callback happens in the context of the caller who asked for the device reset. This results in an attempt by the pvrusb2 driver to recursively take a mutex it already has, which deadlocks the driver's worker thread. (Even if the disconnect callback were to happen on a different thread we'd still have problems however - because while the driver should survive and correctly disconnect / reconnect, it will then trigger another device reset during the repeated initialization, which will then cause another disconect, etc, forever.) The fix here is simply to not attempt the device reset (it was of marginal value anyway). Priority: normal Signed-off-by: Mike Isely --- linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c index b79829f8a..6a1edbe93 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -61,7 +61,6 @@ static struct pvr2_hdw *unit_pointers[PVR_NUM] = {[ 0 ... PVR_NUM-1 ] = NULL}; static DEFINE_MUTEX(pvr2_unit_mtx); static int ctlchg; -static int initusbreset = 1; static int procreload; static int tuner[PVR_NUM] = { [0 ... PVR_NUM-1] = -1 }; static int tolerance[PVR_NUM] = { [0 ... PVR_NUM-1] = 0 }; @@ -72,8 +71,6 @@ module_param(ctlchg, int, S_IRUGO|S_IWUSR); MODULE_PARM_DESC(ctlchg, "0=optimize ctl change 1=always accept new ctl value"); module_param(init_pause_msec, int, S_IRUGO|S_IWUSR); MODULE_PARM_DESC(init_pause_msec, "hardware initialization settling delay"); -module_param(initusbreset, int, S_IRUGO|S_IWUSR); -MODULE_PARM_DESC(initusbreset, "Do USB reset device on probe"); module_param(procreload, int, S_IRUGO|S_IWUSR); MODULE_PARM_DESC(procreload, "Attempt init failure recovery with firmware reload"); @@ -1984,9 +1981,6 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw) } hdw->fw1_state = FW1_STATE_OK; - if (initusbreset) { - pvr2_hdw_device_reset(hdw); - } if (!pvr2_hdw_dev_ok(hdw)) return; for (idx = 0; idx < hdw->hdw_desc->client_modules.cnt; idx++) { -- cgit v1.2.3 From ee5a0d9291be9e4a6074a71eada4bf40cb9dd506 Mon Sep 17 00:00:00 2001 From: Mike Isely Date: Sun, 19 Oct 2008 15:00:30 -0500 Subject: pvrusb2: Keep MPEG PTSs from drifting away From: Boris Dores (Mike Isely) This change was empirically figured out by Boris Dores after empirically comparing against behavior in the Windows driver. Priority: normal Signed-off-by: Mike Isely --- linux/drivers/media/video/pvrusb2/pvrusb2-encoder.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-encoder.c b/linux/drivers/media/video/pvrusb2/pvrusb2-encoder.c index da5b5a7e9..744bc192c 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-encoder.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-encoder.c @@ -435,6 +435,10 @@ static int pvr2_encoder_prep_config(struct pvr2_hdw *hdw) ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC,4, 0,3,0,0); ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC,4,15,0,0,0); + /* prevent the PTSs from slowly drifting away in the generated + MPEG stream */ + ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC, 2, 4, 1); + return ret; } -- cgit v1.2.3 From abcd262f5b8a6a16eca03ff6bfb92dfd1817b498 Mon Sep 17 00:00:00 2001 From: Douglas Schilling Landgraf Date: Mon, 20 Oct 2008 00:20:47 -0200 Subject: dsbr100: Correct bus_info string From: Alexey Klimov Replaced bus_info string from ISA to USB Priority: normal Signed-off-by: Alexey Klimov Signed-off-by: Douglas Schilling Landgraf --- linux/drivers/media/radio/dsbr100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/radio/dsbr100.c b/linux/drivers/media/radio/dsbr100.c index 7172977c7..c83e6ee55 100644 --- a/linux/drivers/media/radio/dsbr100.c +++ b/linux/drivers/media/radio/dsbr100.c @@ -266,7 +266,7 @@ static int vidioc_querycap(struct file *file, void *priv, { strlcpy(v->driver, "dsbr100", sizeof(v->driver)); strlcpy(v->card, "D-Link R-100 USB FM Radio", sizeof(v->card)); - sprintf(v->bus_info, "ISA"); + sprintf(v->bus_info, "USB"); v->version = RADIO_VERSION; v->capabilities = V4L2_CAP_TUNER; return 0; -- cgit v1.2.3 From 832d1aea3d116c85b4f80389a150c23aacf8d148 Mon Sep 17 00:00:00 2001 From: Douglas Schilling Landgraf Date: Mon, 20 Oct 2008 00:50:27 -0200 Subject: dsbr100: CodingStyle issue From: Alexey Klimov Fixed few coding style issues in dsbr100 Priority: normal Signed-off-by: Alexey Klimov Signed-off-by: Douglas Schilling Landgraf --- linux/drivers/media/radio/dsbr100.c | 52 +++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 23 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/radio/dsbr100.c b/linux/drivers/media/radio/dsbr100.c index c83e6ee55..9f0bd34bc 100644 --- a/linux/drivers/media/radio/dsbr100.c +++ b/linux/drivers/media/radio/dsbr100.c @@ -172,11 +172,11 @@ static int dsbr100_start(struct dsbr100_device *radio) if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), USB_REQ_GET_STATUS, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - 0x00, 0xC7, radio->transfer_buffer, 8, 300)<0 || + 0x00, 0xC7, radio->transfer_buffer, 8, 300) < 0 || usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), DSB100_ONOFF, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - 0x01, 0x00, radio->transfer_buffer, 8, 300)<0) + 0x01, 0x00, radio->transfer_buffer, 8, 300) < 0) return -1; radio->muted=0; return (radio->transfer_buffer)[0]; @@ -189,11 +189,11 @@ static int dsbr100_stop(struct dsbr100_device *radio) if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), USB_REQ_GET_STATUS, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - 0x16, 0x1C, radio->transfer_buffer, 8, 300)<0 || + 0x16, 0x1C, radio->transfer_buffer, 8, 300) < 0 || usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), DSB100_ONOFF, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - 0x00, 0x00, radio->transfer_buffer, 8, 300)<0) + 0x00, 0x00, radio->transfer_buffer, 8, 300) < 0) return -1; radio->muted=1; return (radio->transfer_buffer)[0]; @@ -202,24 +202,24 @@ static int dsbr100_stop(struct dsbr100_device *radio) /* set a frequency, freq is defined by v4l's TUNER_LOW, i.e. 1/16th kHz */ static int dsbr100_setfreq(struct dsbr100_device *radio, int freq) { - freq = (freq/16*80)/1000+856; + freq = (freq / 16 * 80) / 1000 + 856; if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), DSB100_TUNE, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - (freq>>8)&0x00ff, freq&0xff, - radio->transfer_buffer, 8, 300)<0 || + (freq >> 8) & 0x00ff, freq & 0xff, + radio->transfer_buffer, 8, 300) < 0 || usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), USB_REQ_GET_STATUS, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - 0x96, 0xB7, radio->transfer_buffer, 8, 300)<0 || + 0x96, 0xB7, radio->transfer_buffer, 8, 300) < 0 || usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), USB_REQ_GET_STATUS, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - 0x00, 0x24, radio->transfer_buffer, 8, 300)<0) { + 0x00, 0x24, radio->transfer_buffer, 8, 300) < 0) { radio->stereo = -1; return -1; } - radio->stereo = ! ((radio->transfer_buffer)[0]&0x01); + radio->stereo = !((radio->transfer_buffer)[0] & 0x01); return (radio->transfer_buffer)[0]; } @@ -230,10 +230,10 @@ static void dsbr100_getstat(struct dsbr100_device *radio) if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), USB_REQ_GET_STATUS, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - 0x00 , 0x24, radio->transfer_buffer, 8, 300)<0) + 0x00 , 0x24, radio->transfer_buffer, 8, 300) < 0) radio->stereo = -1; else - radio->stereo = ! (radio->transfer_buffer[0]&0x01); + radio->stereo = !(radio->transfer_buffer[0] & 0x01); } @@ -283,9 +283,9 @@ static int vidioc_g_tuner(struct file *file, void *priv, dsbr100_getstat(radio); strcpy(v->name, "FM"); v->type = V4L2_TUNER_RADIO; - v->rangelow = FREQ_MIN*FREQ_MUL; - v->rangehigh = FREQ_MAX*FREQ_MUL; - v->rxsubchans = V4L2_TUNER_SUB_MONO|V4L2_TUNER_SUB_STEREO; + v->rangelow = FREQ_MIN * FREQ_MUL; + v->rangehigh = FREQ_MAX * FREQ_MUL; + v->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; v->capability = V4L2_TUNER_CAP_LOW; if(radio->stereo) v->audmode = V4L2_TUNER_MODE_STEREO; @@ -310,7 +310,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, struct dsbr100_device *radio = video_drvdata(file); radio->curfreq = f->frequency; - if (dsbr100_setfreq(radio, radio->curfreq)==-1) + if (dsbr100_setfreq(radio, radio->curfreq) == -1) warn("Set frequency failed"); return 0; } @@ -332,8 +332,7 @@ static int vidioc_queryctrl(struct file *file, void *priv, for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { if (qc->id && qc->id == radio_qctrl[i].id) { - memcpy(qc, &(radio_qctrl[i]), - sizeof(*qc)); + memcpy(qc, &(radio_qctrl[i]), sizeof(*qc)); return 0; } } @@ -416,7 +415,7 @@ static int usb_dsbr100_open(struct inode *inode, struct file *file) radio->users = 1; radio->muted = 1; - if (dsbr100_start(radio)<0) { + if (dsbr100_start(radio) < 0) { warn("Radio did not start up properly"); radio->users = 0; unlock_kernel(); @@ -483,13 +482,20 @@ static int usb_dsbr100_probe(struct usb_interface *intf, { struct dsbr100_device *radio; - if (!(radio = kmalloc(sizeof(struct dsbr100_device), GFP_KERNEL))) + radio = kmalloc(sizeof(struct dsbr100_device), GFP_KERNEL); + + if (!radio) return -ENOMEM; - if (!(radio->transfer_buffer = kmalloc(TB_LEN, GFP_KERNEL))) { + + radio->transfer_buffer = kmalloc(TB_LEN, GFP_KERNEL); + + if (!(radio->transfer_buffer)) { kfree(radio); return -ENOMEM; } - if (!(radio->videodev = video_device_alloc())) { + radio->videodev = video_device_alloc(); + + if (!(radio->videodev)) { kfree(radio->transfer_buffer); kfree(radio); return -ENOMEM; @@ -499,7 +505,7 @@ static int usb_dsbr100_probe(struct usb_interface *intf, radio->removed = 0; radio->users = 0; radio->usbdev = interface_to_usbdev(intf); - radio->curfreq = FREQ_MIN*FREQ_MUL; + radio->curfreq = FREQ_MIN * FREQ_MUL; video_set_drvdata(radio->videodev, radio); if (video_register_device(radio->videodev, VFL_TYPE_RADIO, radio_nr) < 0) { warn("Could not register video device"); -- cgit v1.2.3 From 7681262f35ef9d10b8389c719207aa55a357b4c0 Mon Sep 17 00:00:00 2001 From: Douglas Schilling Landgraf Date: Mon, 20 Oct 2008 00:56:23 -0200 Subject: radio-mr800: Add BKL for usb_amradio_open() From: Alexey Klimov Added BKL for usb_amradio_open() Priority: high Signed-off-by: Alexey Klimov Signed-off-by: Douglas Schilling Landgraf --- linux/drivers/media/radio/radio-mr800.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'linux/drivers') diff --git a/linux/drivers/media/radio/radio-mr800.c b/linux/drivers/media/radio/radio-mr800.c index 2ae8e1447..5941127a5 100644 --- a/linux/drivers/media/radio/radio-mr800.c +++ b/linux/drivers/media/radio/radio-mr800.c @@ -472,16 +472,21 @@ static int usb_amradio_open(struct inode *inode, struct file *file) { struct amradio_device *radio = video_get_drvdata(video_devdata(file)); + lock_kernel(); + radio->users = 1; radio->muted = 1; if (amradio_start(radio) < 0) { warn("Radio did not start up properly"); radio->users = 0; + unlock_kernel(); return -EIO; } if (amradio_setfreq(radio, radio->curfreq) < 0) warn("Set frequency failed"); + + unlock_kernel(); return 0; } -- cgit v1.2.3 From fa2c7f7072fa52468acd23336dacef719c5ca706 Mon Sep 17 00:00:00 2001 From: Douglas Schilling Landgraf Date: Mon, 20 Oct 2008 01:00:03 -0200 Subject: dsbr100: Add frequency check From: Alexey Klimov Add checking for frequency and printk if -1 returned. Priority: normal Signed-off-by: Alexey Klimov Signed-off-by: Douglas Schilling Landgraf --- linux/drivers/media/radio/dsbr100.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/radio/dsbr100.c b/linux/drivers/media/radio/dsbr100.c index 9f0bd34bc..71836beea 100644 --- a/linux/drivers/media/radio/dsbr100.c +++ b/linux/drivers/media/radio/dsbr100.c @@ -410,6 +410,7 @@ static int vidioc_s_audio(struct file *file, void *priv, static int usb_dsbr100_open(struct inode *inode, struct file *file) { struct dsbr100_device *radio = video_drvdata(file); + int retval; lock_kernel(); radio->users = 1; @@ -421,7 +422,12 @@ static int usb_dsbr100_open(struct inode *inode, struct file *file) unlock_kernel(); return -EIO; } - dsbr100_setfreq(radio, radio->curfreq); + + retval = dsbr100_setfreq(radio, radio->curfreq); + + if (retval == -1) + printk(KERN_WARNING KBUILD_MODNAME ": Set frequency failed\n"); + unlock_kernel(); return 0; } -- cgit v1.2.3 From 702a75991fe92586daefdfd2517ed990bb2a6f76 Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Mon, 20 Oct 2008 09:17:08 -0400 Subject: s5h1411: Perform s5h1411 soft reset after tuning From: Devin Heitmueller If you instruct the tuner to change frequencies, it can take up to 2500ms to get a demod lock. By performing a soft reset after the tuning call (which is consistent with how the Pinnacle 801e Windows driver behaves), you get a demod lock inside of 300ms Priority: normal Signed-off-by: Devin Heitmueller Reviewed-by: Michael Krufky Acked-by: Steven Toth --- linux/drivers/media/dvb/frontends/s5h1411.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/frontends/s5h1411.c b/linux/drivers/media/dvb/frontends/s5h1411.c index e328d88bc..40e0fedf3 100644 --- a/linux/drivers/media/dvb/frontends/s5h1411.c +++ b/linux/drivers/media/dvb/frontends/s5h1411.c @@ -585,9 +585,6 @@ static int s5h1411_set_frontend(struct dvb_frontend *fe, s5h1411_enable_modulation(fe, p->u.vsb.modulation); - /* Allow the demod to settle */ - msleep(100); - if (fe->ops.tuner_ops.set_params) { if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); @@ -598,6 +595,10 @@ static int s5h1411_set_frontend(struct dvb_frontend *fe, fe->ops.i2c_gate_ctrl(fe, 0); } + /* Issue a reset to the demod so it knows to resync against the + newly tuned frequency */ + s5h1411_softreset(fe); + return 0; } -- cgit v1.2.3 From 053f35499249506e2e5aea4080483e318d4d45ea Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Mon, 20 Oct 2008 09:19:07 -0400 Subject: s5h1411: Skip reconfiguring demod modulation if already at the desired modulation From: Devin Heitmueller If we are already at the desired modulation, there is no need to reconfigure the demod (at a tuning time cost) Note that this change revealed that although the datasheet says the demod starts out in VSB-8 mode, the first tuning was failing consistently unless we went through the work of setting the registers. So add a field to denote this case so we always do the enable_frontend call, even if the first tuning request is for VSB-8. Signed-off-by: Devin Heitmueller Reviewed-by: Michael Krufky Acked-by: Steven Toth --- linux/drivers/media/dvb/frontends/s5h1411.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/frontends/s5h1411.c b/linux/drivers/media/dvb/frontends/s5h1411.c index 40e0fedf3..b9ac6d35a 100644 --- a/linux/drivers/media/dvb/frontends/s5h1411.c +++ b/linux/drivers/media/dvb/frontends/s5h1411.c @@ -38,6 +38,7 @@ struct s5h1411_state { struct dvb_frontend frontend; fe_modulation_t current_modulation; + unsigned int first_tune:1; u32 current_frequency; int if_freq; @@ -489,6 +490,12 @@ static int s5h1411_enable_modulation(struct dvb_frontend *fe, dprintk("%s(0x%08x)\n", __func__, m); + if ((state->first_tune == 0) && (m == state->current_modulation)) { + dprintk("%s() Already at desired modulation. Skipping...\n", + __func__); + return 0; + } + switch (m) { case VSB_8: dprintk("%s() VSB_8\n", __func__); @@ -513,6 +520,7 @@ static int s5h1411_enable_modulation(struct dvb_frontend *fe, } state->current_modulation = m; + state->first_tune = 0; s5h1411_softreset(fe); return 0; @@ -622,6 +630,11 @@ static int s5h1411_init(struct dvb_frontend *fe) /* The datasheet says that after initialisation, VSB is default */ state->current_modulation = VSB_8; + /* Although the datasheet says it's in VSB, empirical evidence + shows problems getting lock on the first tuning request. Make + sure we call enable_modulation the first time around */ + state->first_tune = 1; + if (state->config->output_mode == S5H1411_SERIAL_OUTPUT) /* Serial */ s5h1411_set_serialmode(fe, 1); -- cgit v1.2.3 From 97d64ef8425ad2941d697e352858021b9ed0b2c6 Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Mon, 20 Oct 2008 09:33:22 -0400 Subject: s5h1411: Power down s5h1411 when not in use From: Devin Heitmueller Power down the s5h1411 demodulator when not in use (on the Pinnacle 801e, this brings idle power from 123ma down to 84ma). Priority: normal Signed-off-by: Devin Heitmueller Acked-by: Steven Toth --- linux/drivers/media/dvb/frontends/s5h1411.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/frontends/s5h1411.c b/linux/drivers/media/dvb/frontends/s5h1411.c index b9ac6d35a..40644aacf 100644 --- a/linux/drivers/media/dvb/frontends/s5h1411.c +++ b/linux/drivers/media/dvb/frontends/s5h1411.c @@ -554,7 +554,7 @@ static int s5h1411_set_gpio(struct dvb_frontend *fe, int enable) return s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0xe0, val); } -static int s5h1411_sleep(struct dvb_frontend *fe, int enable) +static int s5h1411_set_powerstate(struct dvb_frontend *fe, int enable) { struct s5h1411_state *state = fe->demodulator_priv; @@ -570,6 +570,11 @@ static int s5h1411_sleep(struct dvb_frontend *fe, int enable) return 0; } +static int s5h1411_sleep(struct dvb_frontend *fe) +{ + return s5h1411_set_powerstate(fe, 1); +} + static int s5h1411_register_reset(struct dvb_frontend *fe) { struct s5h1411_state *state = fe->demodulator_priv; @@ -619,7 +624,7 @@ static int s5h1411_init(struct dvb_frontend *fe) dprintk("%s()\n", __func__); - s5h1411_sleep(fe, 0); + s5h1411_set_powerstate(fe, 0); s5h1411_register_reset(fe); for (i = 0; i < ARRAY_SIZE(init_tab); i++) @@ -889,6 +894,7 @@ static struct dvb_frontend_ops s5h1411_ops = { }, .init = s5h1411_init, + .sleep = s5h1411_sleep, .i2c_gate_ctrl = s5h1411_i2c_gate_ctrl, .set_frontend = s5h1411_set_frontend, .get_frontend = s5h1411_get_frontend, -- cgit v1.2.3 From 65aa32e2ff73aaa6f5ac4027e8265e0d81714f9e Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 18 Oct 2008 17:28:36 +0200 Subject: v4l2-int-if: Export more interfaces to modules From: Sakari Ailus Export v4l2_int_device_try_attach_all. This allows initiating the initialisation of int if device after the drivers have been registered. Also allow drivers to call ioctls if v4l2-int-if was compiled as module. Priority: normal Signed-off-by: Sakari Ailus Signed-off-by: Hans Verkuil --- linux/drivers/media/video/v4l2-int-device.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/v4l2-int-device.c b/linux/drivers/media/video/v4l2-int-device.c index 4434a9e9e..00c9bb7d6 100644 --- a/linux/drivers/media/video/v4l2-int-device.c +++ b/linux/drivers/media/video/v4l2-int-device.c @@ -33,7 +33,7 @@ static DEFINE_MUTEX(mutex); static LIST_HEAD(int_list); -static void v4l2_int_device_try_attach_all(void) +void v4l2_int_device_try_attach_all(void) { struct v4l2_int_device *m, *s; @@ -67,6 +67,7 @@ static void v4l2_int_device_try_attach_all(void) } } } +EXPORT_SYMBOL_GPL(v4l2_int_device_try_attach_all); static int ioctl_sort_cmp(const void *a, const void *b) { @@ -145,6 +146,7 @@ int v4l2_int_ioctl_0(struct v4l2_int_device *d, int cmd) find_ioctl(d->u.slave, cmd, (v4l2_int_ioctl_func *)no_such_ioctl_0))(d); } +EXPORT_SYMBOL_GPL(v4l2_int_ioctl_0); static int no_such_ioctl_1(struct v4l2_int_device *d, void *arg) { @@ -157,5 +159,6 @@ int v4l2_int_ioctl_1(struct v4l2_int_device *d, int cmd, void *arg) find_ioctl(d->u.slave, cmd, (v4l2_int_ioctl_func *)no_such_ioctl_1))(d, arg); } +EXPORT_SYMBOL_GPL(v4l2_int_ioctl_1); MODULE_LICENSE("GPL"); -- cgit v1.2.3 From 90a1ccb93b663837f6e2dbed7762ca08d94fc493 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 18 Oct 2008 18:39:53 +0200 Subject: v4l2: add video_ioctl2_unlocked for unlocked_ioctl support. From: Hans Verkuil Based on an older patch from Sakari Ailus. Priority: normal Signed-off-by: Hans Verkuil CC: Sakari Ailus --- linux/drivers/media/video/v4l2-ioctl.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/v4l2-ioctl.c b/linux/drivers/media/video/v4l2-ioctl.c index 3a68d6e35..871447bdd 100644 --- a/linux/drivers/media/video/v4l2-ioctl.c +++ b/linux/drivers/media/video/v4l2-ioctl.c @@ -631,8 +631,8 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, { struct video_device *vfd = video_devdata(file); const struct v4l2_ioctl_ops *ops = vfd->ioctl_ops; - void *fh = file->private_data; - int ret = -EINVAL; + void *fh = file->private_data; + int ret = -EINVAL; if ((vfd->debug & V4L2_DEBUG_IOCTL) && !(vfd->debug & V4L2_DEBUG_IOCTL_ARG)) { @@ -1862,3 +1862,14 @@ out: return err; } EXPORT_SYMBOL(video_ioctl2); + +long video_ioctl2_unlocked(struct file *file, + unsigned int cmd, unsigned long arg) +{ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20) + return video_ioctl2(file->f_dentry->d_inode, file, cmd, arg); +#else + return video_ioctl2(file->f_path.dentry->d_inode, file, cmd, arg); +#endif +} +EXPORT_SYMBOL(video_ioctl2_unlocked); -- cgit v1.2.3 From 97946d2468e9eceb02bebf7dc42571c261075c07 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 18 Oct 2008 18:42:24 +0200 Subject: ivtv: switch to unlocked_ioctl. From: Hans Verkuil Priority: normal Signed-off-by: Hans Verkuil --- linux/drivers/media/video/ivtv/ivtv-ioctl.c | 13 ++++++------- linux/drivers/media/video/ivtv/ivtv-ioctl.h | 3 +-- linux/drivers/media/video/ivtv/ivtv-streams.c | 4 ++-- 3 files changed, 9 insertions(+), 11 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/ivtv/ivtv-ioctl.c b/linux/drivers/media/video/ivtv/ivtv-ioctl.c index 208fb5484..09a75abcb 100644 --- a/linux/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/linux/drivers/media/video/ivtv/ivtv-ioctl.c @@ -1756,12 +1756,12 @@ static int ivtv_default(struct file *file, void *fh, int cmd, void *arg) return 0; } -static int ivtv_serialized_ioctl(struct ivtv *itv, struct inode *inode, struct file *filp, +static long ivtv_serialized_ioctl(struct ivtv *itv, struct file *filp, unsigned int cmd, unsigned long arg) { struct video_device *vfd = video_devdata(filp); struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data; - int ret; + long ret; /* Filter dvb ioctls that cannot be handled by the v4l ioctl framework */ switch (cmd) { @@ -1830,20 +1830,19 @@ static int ivtv_serialized_ioctl(struct ivtv *itv, struct inode *inode, struct f if (ivtv_debug & IVTV_DBGFLG_IOCTL) vfd->debug = V4L2_DEBUG_IOCTL | V4L2_DEBUG_IOCTL_ARG; - ret = video_ioctl2(inode, filp, cmd, arg); + ret = video_ioctl2_unlocked(filp, cmd, arg); vfd->debug = 0; return ret; } -int ivtv_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) +long ivtv_v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data; struct ivtv *itv = id->itv; - int res; + long res; mutex_lock(&itv->serialize_lock); - res = ivtv_serialized_ioctl(itv, inode, filp, cmd, arg); + res = ivtv_serialized_ioctl(itv, filp, cmd, arg); mutex_unlock(&itv->serialize_lock); return res; } diff --git a/linux/drivers/media/video/ivtv/ivtv-ioctl.h b/linux/drivers/media/video/ivtv/ivtv-ioctl.h index 70188588b..58f003412 100644 --- a/linux/drivers/media/video/ivtv/ivtv-ioctl.h +++ b/linux/drivers/media/video/ivtv/ivtv-ioctl.h @@ -30,7 +30,6 @@ void ivtv_set_funcs(struct video_device *vdev); int ivtv_s_std(struct file *file, void *fh, v4l2_std_id *std); int ivtv_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf); int ivtv_s_input(struct file *file, void *fh, unsigned int inp); -int ivtv_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg); +long ivtv_v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); #endif diff --git a/linux/drivers/media/video/ivtv/ivtv-streams.c b/linux/drivers/media/video/ivtv/ivtv-streams.c index 5bbf31e39..9b7aa79eb 100644 --- a/linux/drivers/media/video/ivtv/ivtv-streams.c +++ b/linux/drivers/media/video/ivtv/ivtv-streams.c @@ -48,7 +48,7 @@ static const struct file_operations ivtv_v4l2_enc_fops = { .read = ivtv_v4l2_read, .write = ivtv_v4l2_write, .open = ivtv_v4l2_open, - .ioctl = ivtv_v4l2_ioctl, + .unlocked_ioctl = ivtv_v4l2_ioctl, .compat_ioctl = v4l_compat_ioctl32, .release = ivtv_v4l2_close, .poll = ivtv_v4l2_enc_poll, @@ -59,7 +59,7 @@ static const struct file_operations ivtv_v4l2_dec_fops = { .read = ivtv_v4l2_read, .write = ivtv_v4l2_write, .open = ivtv_v4l2_open, - .ioctl = ivtv_v4l2_ioctl, + .unlocked_ioctl = ivtv_v4l2_ioctl, .compat_ioctl = v4l_compat_ioctl32, .release = ivtv_v4l2_close, .poll = ivtv_v4l2_dec_poll, -- cgit v1.2.3 From f6e813c74e024cb64e5770555129b7a4549e2899 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 18 Oct 2008 19:59:09 +0200 Subject: ivtv: avoid green flashing when loading ivtv From: Martin Dauskardt When loading ivtv the TV-out of the PVR-350 will flash green since the saa712x is activated before the MPEG decoder has been initialized. Deactivate the saa712x until the MPEG decoder has been initialized. Priority: normal Signed-off-by: Martin Dauskardt Signed-off-by: Hans Verkuil --- linux/drivers/media/video/ivtv/ivtv-driver.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/ivtv/ivtv-driver.c b/linux/drivers/media/video/ivtv/ivtv-driver.c index c9750a058..f3bff594b 100644 --- a/linux/drivers/media/video/ivtv/ivtv-driver.c +++ b/linux/drivers/media/video/ivtv/ivtv-driver.c @@ -1215,6 +1215,10 @@ static int __devinit ivtv_probe(struct pci_dev *dev, if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) { ivtv_call_i2c_clients(itv, VIDIOC_INT_S_STD_OUTPUT, &itv->std); + /* Turn off the output signal. The mpeg decoder is not yet + active so without this you would get a green image until the + mpeg decoder becomes active. */ + ivtv_saa7127(itv, VIDIOC_STREAMOFF, NULL); } /* clear interrupt mask, effectively disabling interrupts */ @@ -1334,6 +1338,10 @@ int ivtv_init_on_first_open(struct ivtv *itv) ivtv_s_frequency(NULL, &fh, &vf); if (itv->card->v4l2_capabilities & V4L2_CAP_VIDEO_OUTPUT) { + /* Turn on the TV-out: ivtv_init_mpeg_decoder() initializes + the mpeg decoder so now the saa7127 receives a proper + signal. */ + ivtv_saa7127(itv, VIDIOC_STREAMON, NULL); ivtv_init_mpeg_decoder(itv); } ivtv_s_std(NULL, &fh, &itv->tuner_std); @@ -1370,6 +1378,10 @@ static void ivtv_remove(struct pci_dev *pci_dev) /* Stop all decoding */ IVTV_DEBUG_INFO("Stopping decoding\n"); + + /* Turn off the TV-out */ + if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) + ivtv_saa7127(itv, VIDIOC_STREAMOFF, NULL); if (atomic_read(&itv->decoding) > 0) { int type; -- cgit v1.2.3 From 5b2bce737fc14b7bb7d6234cf959fc84b4d8a4ef Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 19 Oct 2008 23:54:26 +0200 Subject: v4l: use video_device.num instead of minor in video%d From: Hans Verkuil The kernel number of a v4l2 node (e.g. videoX, radioX or vbiX) is now independent of the minor number. So instead of using the minor field of the video_device struct one has to use the num field: this always contains the kernel number of the device node. I forgot about this when I did the v4l2 core change, so this patch converts all drivers that use it in one go. Luckily the change is trivial. Priority: high Signed-off-by: Hans Verkuil CC: michael@mihu.de CC: mchehab@infradead.org CC: corbet@lwn.net CC: luca.risolia@studio.unibo.it CC: isely@pobox.com CC: pe1rxq@amsat.org CC: royale@zerezo.com CC: mkrufky@linuxtv.org CC: stoth@linuxtv.org --- linux/drivers/media/common/saa7146_fops.c | 4 ++-- linux/drivers/media/video/arv.c | 2 +- linux/drivers/media/video/bt8xx/bttv-driver.c | 6 +++--- linux/drivers/media/video/c-qcam.c | 2 +- linux/drivers/media/video/cafe_ccic.c | 4 ++-- linux/drivers/media/video/cpia.c | 6 +++--- linux/drivers/media/video/cpia2/cpia2_v4l.c | 2 +- linux/drivers/media/video/cx23885/cx23885-417.c | 2 +- linux/drivers/media/video/cx23885/cx23885-video.c | 6 +++--- linux/drivers/media/video/cx88/cx88-blackbird.c | 2 +- linux/drivers/media/video/cx88/cx88-video.c | 6 +++--- linux/drivers/media/video/em28xx/em28xx-video.c | 2 +- linux/drivers/media/video/et61x251/et61x251_core.c | 24 +++++++++++----------- linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c | 6 +++--- linux/drivers/media/video/pwc/pwc-if.c | 2 +- linux/drivers/media/video/saa7134/saa7134-core.c | 6 +++--- .../drivers/media/video/saa7134/saa7134-empress.c | 2 +- linux/drivers/media/video/se401.c | 2 +- linux/drivers/media/video/sn9c102/sn9c102_core.c | 24 +++++++++++----------- linux/drivers/media/video/stk-webcam.c | 4 ++-- linux/drivers/media/video/stv680.c | 3 ++- linux/drivers/media/video/usbvideo/usbvideo.c | 2 +- linux/drivers/media/video/usbvideo/vicam.c | 3 ++- .../drivers/media/video/usbvision/usbvision-i2c.c | 2 +- .../media/video/usbvision/usbvision-video.c | 12 +++++------ linux/drivers/media/video/vivi.c | 6 +++--- linux/drivers/media/video/w9968cf.c | 16 +++++++-------- linux/drivers/media/video/zc0301/zc0301_core.c | 24 +++++++++++----------- linux/drivers/media/video/zr364xx.c | 2 +- 29 files changed, 93 insertions(+), 91 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/common/saa7146_fops.c b/linux/drivers/media/common/saa7146_fops.c index 37a227d01..867687b12 100644 --- a/linux/drivers/media/common/saa7146_fops.c +++ b/linux/drivers/media/common/saa7146_fops.c @@ -546,11 +546,11 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, if( VFL_TYPE_GRABBER == type ) { vv->video_minor = vfd->minor; INFO(("%s: registered device video%d [v4l2]\n", - dev->name, vfd->minor & 0x1f)); + dev->name, vfd->num)); } else { vv->vbi_minor = vfd->minor; INFO(("%s: registered device vbi%d [v4l2]\n", - dev->name, vfd->minor & 0x1f)); + dev->name, vfd->num)); } *vid = vfd; diff --git a/linux/drivers/media/video/arv.c b/linux/drivers/media/video/arv.c index a6c2ff1b4..bf706094f 100644 --- a/linux/drivers/media/video/arv.c +++ b/linux/drivers/media/video/arv.c @@ -871,7 +871,7 @@ static int __init ar_init(void) } printk("video%d: Found M64278 VGA (IRQ %d, Freq %dMHz).\n", - ar->vdev->minor, M32R_IRQ_INT3, freq); + ar->vdev->num, M32R_IRQ_INT3, freq); return 0; diff --git a/linux/drivers/media/video/bt8xx/bttv-driver.c b/linux/drivers/media/video/bt8xx/bttv-driver.c index c7bca940a..09188617b 100644 --- a/linux/drivers/media/video/bt8xx/bttv-driver.c +++ b/linux/drivers/media/video/bt8xx/bttv-driver.c @@ -4270,7 +4270,7 @@ static int __devinit bttv_register_video(struct bttv *btv) video_nr[btv->c.nr]) < 0) goto err; printk(KERN_INFO "bttv%d: registered device video%d\n", - btv->c.nr,btv->video_dev->minor & 0x1f); + btv->c.nr, btv->video_dev->num); if (device_create_file(&btv->video_dev->dev, &dev_attr_card)<0) { printk(KERN_ERR "bttv%d: device_create_file 'card' " @@ -4287,7 +4287,7 @@ static int __devinit bttv_register_video(struct bttv *btv) vbi_nr[btv->c.nr]) < 0) goto err; printk(KERN_INFO "bttv%d: registered device vbi%d\n", - btv->c.nr,btv->vbi_dev->minor & 0x1f); + btv->c.nr, btv->vbi_dev->num); if (!btv->has_radio) return 0; @@ -4299,7 +4299,7 @@ static int __devinit bttv_register_video(struct bttv *btv) radio_nr[btv->c.nr]) < 0) goto err; printk(KERN_INFO "bttv%d: registered device radio%d\n", - btv->c.nr,btv->radio_dev->minor & 0x1f); + btv->c.nr, btv->radio_dev->num); /* all done */ return 0; diff --git a/linux/drivers/media/video/c-qcam.c b/linux/drivers/media/video/c-qcam.c index ba4d43b90..b2929d213 100644 --- a/linux/drivers/media/video/c-qcam.c +++ b/linux/drivers/media/video/c-qcam.c @@ -816,7 +816,7 @@ static int init_cqcam(struct parport *port) } printk(KERN_INFO "video%d: Colour QuickCam found on %s\n", - qcam->vdev.minor, qcam->pport->name); + qcam->vdev.num, qcam->pport->name); qcams[num_cams++] = qcam; diff --git a/linux/drivers/media/video/cafe_ccic.c b/linux/drivers/media/video/cafe_ccic.c index 26c08f00b..1c41a4aea 100644 --- a/linux/drivers/media/video/cafe_ccic.c +++ b/linux/drivers/media/video/cafe_ccic.c @@ -2066,10 +2066,10 @@ static void cafe_dfs_cam_setup(struct cafe_camera *cam) if (!cafe_dfs_root) return; - sprintf(fname, "regs-%d", cam->v4ldev.minor); + sprintf(fname, "regs-%d", cam->v4ldev.num); cam->dfs_regs = debugfs_create_file(fname, 0444, cafe_dfs_root, cam, &cafe_dfs_reg_ops); - sprintf(fname, "cam-%d", cam->v4ldev.minor); + sprintf(fname, "cam-%d", cam->v4ldev.num); cam->dfs_cam_regs = debugfs_create_file(fname, 0444, cafe_dfs_root, cam, &cafe_dfs_cam_ops); } diff --git a/linux/drivers/media/video/cpia.c b/linux/drivers/media/video/cpia.c index 0bee440ab..84034183d 100644 --- a/linux/drivers/media/video/cpia.c +++ b/linux/drivers/media/video/cpia.c @@ -1352,7 +1352,7 @@ static void create_proc_cpia_cam(struct cam_data *cam) if (!cpia_proc_root || !cam) return; - snprintf(name, sizeof(name), "video%d", cam->vdev.minor); + snprintf(name, sizeof(name), "video%d", cam->vdev.num); ent = create_proc_entry(name, S_IFREG|S_IRUGO|S_IWUSR, cpia_proc_root); if (!ent) @@ -1377,7 +1377,7 @@ static void destroy_proc_cpia_cam(struct cam_data *cam) if (!cam || !cam->proc_entry) return; - snprintf(name, sizeof(name), "video%d", cam->vdev.minor); + snprintf(name, sizeof(name), "video%d", cam->vdev.num); remove_proc_entry(name, cpia_proc_root); cam->proc_entry = NULL; } @@ -4010,7 +4010,7 @@ void cpia_unregister_camera(struct cam_data *cam) } #ifdef CONFIG_PROC_FS - DBG("destroying /proc/cpia/video%d\n", cam->vdev.minor); + DBG("destroying /proc/cpia/video%d\n", cam->vdev.num); destroy_proc_cpia_cam(cam); #endif if (!cam->open_count) { diff --git a/linux/drivers/media/video/cpia2/cpia2_v4l.c b/linux/drivers/media/video/cpia2/cpia2_v4l.c index 897e8d1a5..1c6bd633f 100644 --- a/linux/drivers/media/video/cpia2/cpia2_v4l.c +++ b/linux/drivers/media/video/cpia2/cpia2_v4l.c @@ -1973,7 +1973,7 @@ void cpia2_unregister_camera(struct camera_data *cam) } else { LOG("/dev/video%d removed while open, " "deferring video_unregister_device\n", - cam->vdev->minor); + cam->vdev->num); } } diff --git a/linux/drivers/media/video/cx23885/cx23885-417.c b/linux/drivers/media/video/cx23885/cx23885-417.c index ae914cdc5..d98e64545 100644 --- a/linux/drivers/media/video/cx23885/cx23885-417.c +++ b/linux/drivers/media/video/cx23885/cx23885-417.c @@ -1823,7 +1823,7 @@ int cx23885_417_register(struct cx23885_dev *dev) cx23885_mc417_init(dev); printk(KERN_INFO "%s: registered device video%d [mpeg]\n", - dev->name, dev->v4l_device->minor & 0x1f); + dev->name, dev->v4l_device->num); return 0; } diff --git a/linux/drivers/media/video/cx23885/cx23885-video.c b/linux/drivers/media/video/cx23885/cx23885-video.c index bac79fff4..0b5d20481 100644 --- a/linux/drivers/media/video/cx23885/cx23885-video.c +++ b/linux/drivers/media/video/cx23885/cx23885-video.c @@ -1810,7 +1810,7 @@ int cx23885_video_register(struct cx23885_dev *dev) goto fail_unreg; } printk(KERN_INFO "%s/0: registered device video%d [v4l2]\n", - dev->name, dev->video_dev->minor & 0x1f); + dev->name, dev->video_dev->num); #if 0 dev->vbi_dev = cx23885_vdev_init(dev, dev->pci, &cx23885_vbi_template, "vbi"); @@ -1822,7 +1822,7 @@ int cx23885_video_register(struct cx23885_dev *dev) goto fail_unreg; } printk(KERN_INFO "%s/0: registered device vbi%d\n", - dev->name, dev->vbi_dev->minor & 0x1f); + dev->name, dev->vbi_dev->num); if (dev->has_radio) { dev->radio_dev = cx23885_vdev_init(dev, dev->pci, @@ -1835,7 +1835,7 @@ int cx23885_video_register(struct cx23885_dev *dev) goto fail_unreg; } printk(KERN_INFO "%s/0: registered device radio%d\n", - dev->name, dev->radio_dev->minor & 0x1f); + dev->name, dev->radio_dev->num); } #endif /* initial device configuration */ diff --git a/linux/drivers/media/video/cx88/cx88-blackbird.c b/linux/drivers/media/video/cx88/cx88-blackbird.c index 5f44368f6..3f33cb600 100644 --- a/linux/drivers/media/video/cx88/cx88-blackbird.c +++ b/linux/drivers/media/video/cx88/cx88-blackbird.c @@ -1307,7 +1307,7 @@ static int blackbird_register_video(struct cx8802_dev *dev) return err; } printk(KERN_INFO "%s/2: registered device video%d [mpeg]\n", - dev->core->name,dev->mpeg_dev->minor & 0x1f); + dev->core->name, dev->mpeg_dev->num); return 0; } diff --git a/linux/drivers/media/video/cx88/cx88-video.c b/linux/drivers/media/video/cx88/cx88-video.c index 79b6b0b6d..6250bc8bd 100644 --- a/linux/drivers/media/video/cx88/cx88-video.c +++ b/linux/drivers/media/video/cx88/cx88-video.c @@ -2185,7 +2185,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, goto fail_unreg; } printk(KERN_INFO "%s/0: registered device video%d [v4l2]\n", - core->name,dev->video_dev->minor & 0x1f); + core->name, dev->video_dev->num); dev->vbi_dev = cx88_vdev_init(core,dev->pci,&cx8800_vbi_template,"vbi"); err = video_register_device(dev->vbi_dev,VFL_TYPE_VBI, @@ -2196,7 +2196,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, goto fail_unreg; } printk(KERN_INFO "%s/0: registered device vbi%d\n", - core->name,dev->vbi_dev->minor & 0x1f); + core->name, dev->vbi_dev->num); if (core->board.radio.type == CX88_RADIO) { dev->radio_dev = cx88_vdev_init(core,dev->pci, @@ -2209,7 +2209,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, goto fail_unreg; } printk(KERN_INFO "%s/0: registered device radio%d\n", - core->name,dev->radio_dev->minor & 0x1f); + core->name, dev->radio_dev->num); } /* everything worked */ diff --git a/linux/drivers/media/video/em28xx/em28xx-video.c b/linux/drivers/media/video/em28xx/em28xx-video.c index 2d0cd4abc..740e73cc1 100644 --- a/linux/drivers/media/video/em28xx/em28xx-video.c +++ b/linux/drivers/media/video/em28xx/em28xx-video.c @@ -2104,7 +2104,7 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, goto fail_unreg; } em28xx_info("Registered radio device as /dev/radio%d\n", - dev->radio_dev->minor & 0x1f); + dev->radio_dev->num); } /* init video dma queues */ diff --git a/linux/drivers/media/video/et61x251/et61x251_core.c b/linux/drivers/media/video/et61x251/et61x251_core.c index f58aee5aa..25acf54f1 100644 --- a/linux/drivers/media/video/et61x251/et61x251_core.c +++ b/linux/drivers/media/video/et61x251/et61x251_core.c @@ -592,7 +592,7 @@ static int et61x251_stream_interrupt(struct et61x251_device* cam) cam->state |= DEV_MISCONFIGURED; DBG(1, "URB timeout reached. The camera is misconfigured. To " "use it, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -EIO; } @@ -1199,7 +1199,7 @@ static void et61x251_release_resources(struct kref *kref) cam = container_of(kref, struct et61x251_device, kref); - DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->minor); + DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->num); video_set_drvdata(cam->v4ldev, NULL); video_unregister_device(cam->v4ldev); usb_put_dev(cam->usbdev); @@ -1241,7 +1241,7 @@ static int et61x251_open(struct inode* inode, struct file* filp) if (cam->users) { DBG(2, "Device /dev/video%d is already in use", - cam->v4ldev->minor); + cam->v4ldev->num); DBG(3, "Simultaneous opens are not supported"); if ((filp->f_flags & O_NONBLOCK) || (filp->f_flags & O_NDELAY)) { @@ -1284,7 +1284,7 @@ static int et61x251_open(struct inode* inode, struct file* filp) cam->frame_count = 0; et61x251_empty_framequeues(cam); - DBG(3, "Video device /dev/video%d is open", cam->v4ldev->minor); + DBG(3, "Video device /dev/video%d is open", cam->v4ldev->num); out: mutex_unlock(&cam->open_mutex); @@ -1308,7 +1308,7 @@ static int et61x251_release(struct inode* inode, struct file* filp) cam->users--; wake_up_interruptible_nr(&cam->wait_open, 1); - DBG(3, "Video device /dev/video%d closed", cam->v4ldev->minor); + DBG(3, "Video device /dev/video%d closed", cam->v4ldev->num); kref_put(&cam->kref, et61x251_release_resources); @@ -1849,7 +1849,7 @@ et61x251_vidioc_s_crop(struct et61x251_device* cam, void __user * arg) cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_CROP failed because of hardware problems. To " "use the camera, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -EIO; } @@ -1862,7 +1862,7 @@ et61x251_vidioc_s_crop(struct et61x251_device* cam, void __user * arg) cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_CROP failed because of not enough memory. To " "use the camera, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -ENOMEM; } @@ -2072,7 +2072,7 @@ et61x251_vidioc_try_s_fmt(struct et61x251_device* cam, unsigned int cmd, cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_FMT failed because of hardware problems. To " "use the camera, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -EIO; } @@ -2084,7 +2084,7 @@ et61x251_vidioc_try_s_fmt(struct et61x251_device* cam, unsigned int cmd, cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_FMT failed because of not enough memory. To " "use the camera, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -ENOMEM; } @@ -2132,7 +2132,7 @@ et61x251_vidioc_s_jpegcomp(struct et61x251_device* cam, void __user * arg) cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_JPEGCOMP failed because of hardware " "problems. To use the camera, close and open " - "/dev/video%d again.", cam->v4ldev->minor); + "/dev/video%d again.", cam->v4ldev->num); return -EIO; } @@ -2609,7 +2609,7 @@ et61x251_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) goto fail; } - DBG(2, "V4L2 device registered as /dev/video%d", cam->v4ldev->minor); + DBG(2, "V4L2 device registered as /dev/video%d", cam->v4ldev->num); cam->module_param.force_munmap = force_munmap[dev_nr]; cam->module_param.frame_timeout = frame_timeout[dev_nr]; @@ -2662,7 +2662,7 @@ static void et61x251_usb_disconnect(struct usb_interface* intf) if (cam->users) { DBG(2, "Device /dev/video%d is open! Deregistration and " "memory deallocation are deferred.", - cam->v4ldev->minor); + cam->v4ldev->num); cam->state |= DEV_MISCONFIGURED; et61x251_stop_transfer(cam); cam->state |= DEV_DISCONNECTED; diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index 429c96d4f..4e9cd246a 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c @@ -894,7 +894,7 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file, static void pvr2_v4l2_dev_destroy(struct pvr2_v4l2_dev *dip) { - int minor_id = dip->devbase.minor; + int num = dip->devbase.num; struct pvr2_hdw *hdw = dip->v4lp->channel.mc_head->hdw; enum pvr2_config cfg = dip->config; int v4l_type = dip->v4l_type; @@ -910,7 +910,7 @@ static void pvr2_v4l2_dev_destroy(struct pvr2_v4l2_dev *dip) video_unregister_device(&dip->devbase); printk(KERN_INFO "pvrusb2: unregistered device %s%u [%s]\n", - get_v4l_name(v4l_type),minor_id & 0x1f, + get_v4l_name(v4l_type), num, pvr2_config_get_name(cfg)); } @@ -1317,7 +1317,7 @@ static void pvr2_v4l2_dev_init(struct pvr2_v4l2_dev *dip, } printk(KERN_INFO "pvrusb2: registered device %s%u [%s]\n", - get_v4l_name(dip->v4l_type),dip->devbase.minor & 0x1f, + get_v4l_name(dip->v4l_type), dip->devbase.num, pvr2_config_get_name(dip->config)); pvr2_hdw_v4l_store_minor_number(vp->channel.mc_head->hdw, diff --git a/linux/drivers/media/video/pwc/pwc-if.c b/linux/drivers/media/video/pwc/pwc-if.c index 69917b2f9..041bb96f7 100644 --- a/linux/drivers/media/video/pwc/pwc-if.c +++ b/linux/drivers/media/video/pwc/pwc-if.c @@ -1799,7 +1799,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id goto err; } else { - PWC_INFO("Registered as /dev/video%d.\n", pdev->vdev->minor & 0x3F); + PWC_INFO("Registered as /dev/video%d.\n", pdev->vdev->num); } /* occupy slot */ diff --git a/linux/drivers/media/video/saa7134/saa7134-core.c b/linux/drivers/media/video/saa7134/saa7134-core.c index c839114a0..1d1fdce21 100644 --- a/linux/drivers/media/video/saa7134/saa7134-core.c +++ b/linux/drivers/media/video/saa7134/saa7134-core.c @@ -1057,7 +1057,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, goto fail4; } printk(KERN_INFO "%s: registered device video%d [v4l2]\n", - dev->name,dev->video_dev->minor & 0x1f); + dev->name, dev->video_dev->num); dev->vbi_dev = vdev_init(dev, &saa7134_video_template, "vbi"); @@ -1066,7 +1066,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, if (err < 0) goto fail4; printk(KERN_INFO "%s: registered device vbi%d\n", - dev->name,dev->vbi_dev->minor & 0x1f); + dev->name, dev->vbi_dev->num); if (card_has_radio(dev)) { dev->radio_dev = vdev_init(dev,&saa7134_radio_template,"radio"); @@ -1075,7 +1075,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, if (err < 0) goto fail4; printk(KERN_INFO "%s: registered device radio%d\n", - dev->name,dev->radio_dev->minor & 0x1f); + dev->name, dev->radio_dev->num); } /* everything worked */ diff --git a/linux/drivers/media/video/saa7134/saa7134-empress.c b/linux/drivers/media/video/saa7134/saa7134-empress.c index 9ebe166cc..53de5545c 100644 --- a/linux/drivers/media/video/saa7134/saa7134-empress.c +++ b/linux/drivers/media/video/saa7134/saa7134-empress.c @@ -546,7 +546,7 @@ static int empress_init(struct saa7134_dev *dev) return err; } printk(KERN_INFO "%s: registered device video%d [mpeg]\n", - dev->name,dev->empress_dev->minor & 0x1f); + dev->name, dev->empress_dev->num); videobuf_queue_sg_init(&dev->empress_tsq, &saa7134_ts_qops, &dev->pci->dev, &dev->slock, diff --git a/linux/drivers/media/video/se401.c b/linux/drivers/media/video/se401.c index 5a346d0c5..c4f83c5b3 100644 --- a/linux/drivers/media/video/se401.c +++ b/linux/drivers/media/video/se401.c @@ -1420,7 +1420,7 @@ static int se401_probe(struct usb_interface *intf, return -EIO; } dev_info(&intf->dev, "registered new video device: video%d\n", - se401->vdev.minor); + se401->vdev.num); usb_set_intfdata (intf, se401); return 0; diff --git a/linux/drivers/media/video/sn9c102/sn9c102_core.c b/linux/drivers/media/video/sn9c102/sn9c102_core.c index fd867dadf..2d60d118d 100644 --- a/linux/drivers/media/video/sn9c102/sn9c102_core.c +++ b/linux/drivers/media/video/sn9c102/sn9c102_core.c @@ -1012,7 +1012,7 @@ static int sn9c102_stream_interrupt(struct sn9c102_device* cam) cam->state |= DEV_MISCONFIGURED; DBG(1, "URB timeout reached. The camera is misconfigured. " "To use it, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -EIO; } @@ -1738,7 +1738,7 @@ static void sn9c102_release_resources(struct kref *kref) cam = container_of(kref, struct sn9c102_device, kref); - DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->minor); + DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->num); video_set_drvdata(cam->v4ldev, NULL); video_unregister_device(cam->v4ldev); usb_put_dev(cam->usbdev); @@ -1796,7 +1796,7 @@ static int sn9c102_open(struct inode* inode, struct file* filp) if (cam->users) { DBG(2, "Device /dev/video%d is already in use", - cam->v4ldev->minor); + cam->v4ldev->num); DBG(3, "Simultaneous opens are not supported"); /* open() must follow the open flags and should block @@ -1849,7 +1849,7 @@ static int sn9c102_open(struct inode* inode, struct file* filp) cam->frame_count = 0; sn9c102_empty_framequeues(cam); - DBG(3, "Video device /dev/video%d is open", cam->v4ldev->minor); + DBG(3, "Video device /dev/video%d is open", cam->v4ldev->num); out: mutex_unlock(&cam->open_mutex); @@ -1874,7 +1874,7 @@ static int sn9c102_release(struct inode* inode, struct file* filp) cam->users--; wake_up_interruptible_nr(&cam->wait_open, 1); - DBG(3, "Video device /dev/video%d closed", cam->v4ldev->minor); + DBG(3, "Video device /dev/video%d closed", cam->v4ldev->num); kref_put(&cam->kref, sn9c102_release_resources); @@ -2436,7 +2436,7 @@ sn9c102_vidioc_s_crop(struct sn9c102_device* cam, void __user * arg) cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_CROP failed because of hardware problems. To " "use the camera, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -EIO; } @@ -2449,7 +2449,7 @@ sn9c102_vidioc_s_crop(struct sn9c102_device* cam, void __user * arg) cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_CROP failed because of not enough memory. To " "use the camera, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -ENOMEM; } @@ -2693,7 +2693,7 @@ sn9c102_vidioc_try_s_fmt(struct sn9c102_device* cam, unsigned int cmd, cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_FMT failed because of hardware problems. To " "use the camera, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -EIO; } @@ -2705,7 +2705,7 @@ sn9c102_vidioc_try_s_fmt(struct sn9c102_device* cam, unsigned int cmd, cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_FMT failed because of not enough memory. To " "use the camera, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -ENOMEM; } @@ -2752,7 +2752,7 @@ sn9c102_vidioc_s_jpegcomp(struct sn9c102_device* cam, void __user * arg) cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_JPEGCOMP failed because of hardware " "problems. To use the camera, close and open " - "/dev/video%d again.", cam->v4ldev->minor); + "/dev/video%d again.", cam->v4ldev->num); return -EIO; } @@ -3352,7 +3352,7 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) goto fail; } - DBG(2, "V4L2 device registered as /dev/video%d", cam->v4ldev->minor); + DBG(2, "V4L2 device registered as /dev/video%d", cam->v4ldev->num); video_set_drvdata(cam->v4ldev, cam); cam->module_param.force_munmap = force_munmap[dev_nr]; @@ -3406,7 +3406,7 @@ static void sn9c102_usb_disconnect(struct usb_interface* intf) if (cam->users) { DBG(2, "Device /dev/video%d is open! Deregistration and " "memory deallocation are deferred.", - cam->v4ldev->minor); + cam->v4ldev->num); cam->state |= DEV_MISCONFIGURED; sn9c102_stop_transfer(cam); cam->state |= DEV_DISCONNECTED; diff --git a/linux/drivers/media/video/stk-webcam.c b/linux/drivers/media/video/stk-webcam.c index f606300e8..9615b7678 100644 --- a/linux/drivers/media/video/stk-webcam.c +++ b/linux/drivers/media/video/stk-webcam.c @@ -1332,7 +1332,7 @@ static int stk_register_video_device(struct stk_camera *dev) STK_ERROR("v4l registration failed\n"); else STK_INFO("Syntek USB2.0 Camera is now controlling video device" - " /dev/video%d\n", dev->vdev.minor); + " /dev/video%d\n", dev->vdev.num); return err; } @@ -1427,7 +1427,7 @@ static void stk_camera_disconnect(struct usb_interface *interface) stk_remove_sysfs_files(&dev->vdev); STK_INFO("Syntek USB2.0 Camera release resources " - "video device /dev/video%d\n", dev->vdev.minor); + "video device /dev/video%d\n", dev->vdev.num); video_unregister_device(&dev->vdev); } diff --git a/linux/drivers/media/video/stv680.c b/linux/drivers/media/video/stv680.c index f74c08b41..5705414f9 100644 --- a/linux/drivers/media/video/stv680.c +++ b/linux/drivers/media/video/stv680.c @@ -1475,7 +1475,8 @@ static int stv680_probe (struct usb_interface *intf, const struct usb_device_id retval = -EIO; goto error_vdev; } - PDEBUG (0, "STV(i): registered new video device: video%d", stv680->vdev->minor); + PDEBUG(0, "STV(i): registered new video device: video%d", + stv680->vdev->num); usb_set_intfdata (intf, stv680); retval = stv680_create_sysfs_files(stv680->vdev); diff --git a/linux/drivers/media/video/usbvideo/usbvideo.c b/linux/drivers/media/video/usbvideo/usbvideo.c index c6d1e7dca..0b43cc9b5 100644 --- a/linux/drivers/media/video/usbvideo/usbvideo.c +++ b/linux/drivers/media/video/usbvideo/usbvideo.c @@ -1059,7 +1059,7 @@ int usbvideo_RegisterVideoDevice(struct uvd *uvd) dev_info(&uvd->dev->dev, "%s on /dev/video%d: canvas=%s videosize=%s\n", (uvd->handle != NULL) ? uvd->handle->drvName : "???", - uvd->vdev.minor, tmp2, tmp1); + uvd->vdev.num, tmp2, tmp1); usb_get_dev(uvd->dev); return 0; diff --git a/linux/drivers/media/video/usbvideo/vicam.c b/linux/drivers/media/video/usbvideo/vicam.c index bad26ccf8..77032eaa7 100644 --- a/linux/drivers/media/video/usbvideo/vicam.c +++ b/linux/drivers/media/video/usbvideo/vicam.c @@ -1187,7 +1187,8 @@ vicam_probe( struct usb_interface *intf, const struct usb_device_id *id) return -EIO; } - printk(KERN_INFO "ViCam webcam driver now controlling video device %d\n",cam->vdev.minor); + printk(KERN_INFO "ViCam webcam driver now controlling video device %d\n", + cam->vdev.num); usb_set_intfdata (intf, cam); diff --git a/linux/drivers/media/video/usbvision/usbvision-i2c.c b/linux/drivers/media/video/usbvision/usbvision-i2c.c index d98eb913e..888051b80 100644 --- a/linux/drivers/media/video/usbvision/usbvision-i2c.c +++ b/linux/drivers/media/video/usbvision/usbvision-i2c.c @@ -237,7 +237,7 @@ int usbvision_i2c_register(struct usb_usbvision *usbvision) sizeof(struct i2c_client)); sprintf(usbvision->i2c_adap.name + strlen(usbvision->i2c_adap.name), - " #%d", usbvision->vdev->minor & 0x1f); + " #%d", usbvision->vdev->num); PDEBUG(DBG_I2C,"Adaptername: %s", usbvision->i2c_adap.name); usbvision->i2c_adap.dev.parent = &usbvision->dev->dev; diff --git a/linux/drivers/media/video/usbvision/usbvision-video.c b/linux/drivers/media/video/usbvision/usbvision-video.c index e10b256ae..732496327 100644 --- a/linux/drivers/media/video/usbvision/usbvision-video.c +++ b/linux/drivers/media/video/usbvision/usbvision-video.c @@ -1444,7 +1444,7 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision) // vbi Device: if (usbvision->vbi) { PDEBUG(DBG_PROBE, "unregister /dev/vbi%d [v4l2]", - usbvision->vbi->minor & 0x1f); + usbvision->vbi->num); if (usbvision->vbi->minor != -1) { video_unregister_device(usbvision->vbi); } else { @@ -1456,7 +1456,7 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision) // Radio Device: if (usbvision->rdev) { PDEBUG(DBG_PROBE, "unregister /dev/radio%d [v4l2]", - usbvision->rdev->minor & 0x1f); + usbvision->rdev->num); if (usbvision->rdev->minor != -1) { video_unregister_device(usbvision->rdev); } else { @@ -1468,7 +1468,7 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision) // Video Device: if (usbvision->vdev) { PDEBUG(DBG_PROBE, "unregister /dev/video%d [v4l2]", - usbvision->vdev->minor & 0x1f); + usbvision->vdev->num); if (usbvision->vdev->minor != -1) { video_unregister_device(usbvision->vdev); } else { @@ -1494,7 +1494,7 @@ static int __devinit usbvision_register_video(struct usb_usbvision *usbvision) goto err_exit; } printk(KERN_INFO "USBVision[%d]: registered USBVision Video device /dev/video%d [v4l2]\n", - usbvision->nr,usbvision->vdev->minor & 0x1f); + usbvision->nr, usbvision->vdev->num); // Radio Device: if (usbvision_device_data[usbvision->DevModel].Radio) { @@ -1511,7 +1511,7 @@ static int __devinit usbvision_register_video(struct usb_usbvision *usbvision) goto err_exit; } printk(KERN_INFO "USBVision[%d]: registered USBVision Radio device /dev/radio%d [v4l2]\n", - usbvision->nr, usbvision->rdev->minor & 0x1f); + usbvision->nr, usbvision->rdev->num); } // vbi Device: if (usbvision_device_data[usbvision->DevModel].vbi) { @@ -1527,7 +1527,7 @@ static int __devinit usbvision_register_video(struct usb_usbvision *usbvision) goto err_exit; } printk(KERN_INFO "USBVision[%d]: registered USBVision VBI device /dev/vbi%d [v4l2] (Not Working Yet!)\n", - usbvision->nr,usbvision->vbi->minor & 0x1f); + usbvision->nr, usbvision->vbi->num); } // all done return 0; diff --git a/linux/drivers/media/video/vivi.c b/linux/drivers/media/video/vivi.c index 863024acc..692a90c35 100644 --- a/linux/drivers/media/video/vivi.c +++ b/linux/drivers/media/video/vivi.c @@ -1166,11 +1166,11 @@ static int vivi_release(void) if (-1 != dev->vfd->minor) { printk(KERN_INFO "%s: unregistering /dev/video%d\n", - VIVI_MODULE_NAME, dev->vfd->minor); + VIVI_MODULE_NAME, dev->vfd->num); video_unregister_device(dev->vfd); } else { printk(KERN_INFO "%s: releasing /dev/video%d\n", - VIVI_MODULE_NAME, dev->vfd->minor); + VIVI_MODULE_NAME, dev->vfd->num); video_device_release(dev->vfd); } @@ -1310,7 +1310,7 @@ static int __init vivi_init(void) dev->vfd = vfd; printk(KERN_INFO "%s: V4L2 device registered as /dev/video%d\n", - VIVI_MODULE_NAME, vfd->minor); + VIVI_MODULE_NAME, vfd->num); } if (ret < 0) { diff --git a/linux/drivers/media/video/w9968cf.c b/linux/drivers/media/video/w9968cf.c index 4e7a8400b..23e14bc64 100644 --- a/linux/drivers/media/video/w9968cf.c +++ b/linux/drivers/media/video/w9968cf.c @@ -2406,7 +2406,7 @@ error: cam->sensor = CC_UNKNOWN; DBG(1, "Image sensor initialization failed for %s (/dev/video%d). " "Try to detach and attach this device again", - symbolic(camlist, cam->id), cam->v4ldev->minor) + symbolic(camlist, cam->id), cam->v4ldev->num) return err; } @@ -2652,7 +2652,7 @@ static void w9968cf_release_resources(struct w9968cf_device* cam) { mutex_lock(&w9968cf_devlist_mutex); - DBG(2, "V4L device deregistered: /dev/video%d", cam->v4ldev->minor) + DBG(2, "V4L device deregistered: /dev/video%d", cam->v4ldev->num) video_unregister_device(cam->v4ldev); list_del(&cam->v4llist); @@ -2687,7 +2687,7 @@ static int w9968cf_open(struct inode* inode, struct file* filp) DBG(2, "No supported image sensor has been detected by the " "'ovcamchip' module for the %s (/dev/video%d). Make " "sure it is loaded *before* (re)connecting the camera.", - symbolic(camlist, cam->id), cam->v4ldev->minor) + symbolic(camlist, cam->id), cam->v4ldev->num) mutex_unlock(&cam->dev_mutex); up_read(&w9968cf_disconnect); return -ENODEV; @@ -2695,7 +2695,7 @@ static int w9968cf_open(struct inode* inode, struct file* filp) if (cam->users) { DBG(2, "%s (/dev/video%d) has been already occupied by '%s'", - symbolic(camlist, cam->id),cam->v4ldev->minor,cam->command) + symbolic(camlist, cam->id), cam->v4ldev->num, cam->command) if ((filp->f_flags & O_NONBLOCK)||(filp->f_flags & O_NDELAY)) { mutex_unlock(&cam->dev_mutex); up_read(&w9968cf_disconnect); @@ -2717,7 +2717,7 @@ static int w9968cf_open(struct inode* inode, struct file* filp) } DBG(5, "Opening '%s', /dev/video%d ...", - symbolic(camlist, cam->id), cam->v4ldev->minor) + symbolic(camlist, cam->id), cam->v4ldev->num) cam->streaming = 0; cam->misconfigured = 0; @@ -2955,7 +2955,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, .minheight = cam->minheight, }; sprintf(cap.name, "W996[87]CF USB Camera #%d", - cam->v4ldev->minor); + cam->v4ldev->num); cap.maxwidth = (cam->upscaling && w9968cf_vpp) ? max((u16)W9968CF_MAX_WIDTH, cam->maxwidth) : cam->maxwidth; @@ -3575,7 +3575,7 @@ w9968cf_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) goto fail; } - DBG(2, "V4L device registered as /dev/video%d", cam->v4ldev->minor) + DBG(2, "V4L device registered as /dev/video%d", cam->v4ldev->num) /* Set some basic constants */ w9968cf_configure_camera(cam, udev, mod_id, dev_nr); @@ -3626,7 +3626,7 @@ static void w9968cf_usb_disconnect(struct usb_interface* intf) DBG(2, "The device is open (/dev/video%d)! " "Process name: %s. Deregistration and memory " "deallocation are deferred on close.", - cam->v4ldev->minor, cam->command) + cam->v4ldev->num, cam->command) cam->misconfigured = 1; w9968cf_stop_transfer(cam); wake_up_interruptible(&cam->wait_queue); diff --git a/linux/drivers/media/video/zc0301/zc0301_core.c b/linux/drivers/media/video/zc0301/zc0301_core.c index 0be0f095e..3e3a24b24 100644 --- a/linux/drivers/media/video/zc0301/zc0301_core.c +++ b/linux/drivers/media/video/zc0301/zc0301_core.c @@ -543,7 +543,7 @@ static int zc0301_stream_interrupt(struct zc0301_device* cam) cam->state |= DEV_MISCONFIGURED; DBG(1, "URB timeout reached. The camera is misconfigured. To " "use it, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -EIO; } @@ -644,7 +644,7 @@ static void zc0301_release_resources(struct kref *kref) { struct zc0301_device *cam = container_of(kref, struct zc0301_device, kref); - DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->minor); + DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->num); video_set_drvdata(cam->v4ldev, NULL); video_unregister_device(cam->v4ldev); usb_put_dev(cam->usbdev); @@ -683,7 +683,7 @@ static int zc0301_open(struct inode* inode, struct file* filp) } if (cam->users) { - DBG(2, "Device /dev/video%d is busy...", cam->v4ldev->minor); + DBG(2, "Device /dev/video%d is busy...", cam->v4ldev->num); DBG(3, "Simultaneous opens are not supported"); if ((filp->f_flags & O_NONBLOCK) || (filp->f_flags & O_NDELAY)) { @@ -726,7 +726,7 @@ static int zc0301_open(struct inode* inode, struct file* filp) cam->frame_count = 0; zc0301_empty_framequeues(cam); - DBG(3, "Video device /dev/video%d is open", cam->v4ldev->minor); + DBG(3, "Video device /dev/video%d is open", cam->v4ldev->num); out: mutex_unlock(&cam->open_mutex); @@ -750,7 +750,7 @@ static int zc0301_release(struct inode* inode, struct file* filp) cam->users--; wake_up_interruptible_nr(&cam->wait_open, 1); - DBG(3, "Video device /dev/video%d closed", cam->v4ldev->minor); + DBG(3, "Video device /dev/video%d closed", cam->v4ldev->num); kref_put(&cam->kref, zc0301_release_resources); @@ -1279,7 +1279,7 @@ zc0301_vidioc_s_crop(struct zc0301_device* cam, void __user * arg) cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_CROP failed because of hardware problems. To " "use the camera, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -EIO; } @@ -1292,7 +1292,7 @@ zc0301_vidioc_s_crop(struct zc0301_device* cam, void __user * arg) cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_CROP failed because of not enough memory. To " "use the camera, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -ENOMEM; } @@ -1474,7 +1474,7 @@ zc0301_vidioc_try_s_fmt(struct zc0301_device* cam, unsigned int cmd, cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_FMT failed because of hardware problems. To " "use the camera, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -EIO; } @@ -1486,7 +1486,7 @@ zc0301_vidioc_try_s_fmt(struct zc0301_device* cam, unsigned int cmd, cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_FMT failed because of not enough memory. To " "use the camera, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -ENOMEM; } @@ -1533,7 +1533,7 @@ zc0301_vidioc_s_jpegcomp(struct zc0301_device* cam, void __user * arg) cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_JPEGCOMP failed because of hardware " "problems. To use the camera, close and open " - "/dev/video%d again.", cam->v4ldev->minor); + "/dev/video%d again.", cam->v4ldev->num); return -EIO; } @@ -2009,7 +2009,7 @@ zc0301_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) goto fail; } - DBG(2, "V4L2 device registered as /dev/video%d", cam->v4ldev->minor); + DBG(2, "V4L2 device registered as /dev/video%d", cam->v4ldev->num); cam->module_param.force_munmap = force_munmap[dev_nr]; cam->module_param.frame_timeout = frame_timeout[dev_nr]; @@ -2048,7 +2048,7 @@ static void zc0301_usb_disconnect(struct usb_interface* intf) if (cam->users) { DBG(2, "Device /dev/video%d is open! Deregistration and " "memory deallocation are deferred.", - cam->v4ldev->minor); + cam->v4ldev->num); cam->state |= DEV_MISCONFIGURED; zc0301_stop_transfer(cam); cam->state |= DEV_DISCONNECTED; diff --git a/linux/drivers/media/video/zr364xx.c b/linux/drivers/media/video/zr364xx.c index b0da282a5..1f43328a5 100644 --- a/linux/drivers/media/video/zr364xx.c +++ b/linux/drivers/media/video/zr364xx.c @@ -886,7 +886,7 @@ static int zr364xx_probe(struct usb_interface *intf, usb_set_intfdata(intf, cam); dev_info(&udev->dev, DRIVER_DESC " controlling video device %d\n", - cam->vdev->minor); + cam->vdev->num); return 0; } -- cgit v1.2.3 From cb8889206ccd1bba415637cab83e4ef38fd74b1e Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 19 Oct 2008 23:58:26 +0200 Subject: ivtvfb: FB_BLANK_POWERDOWN turns off video output From: Ian Armstrong When using FBIOBLANK, FB_BLANK_POWERDOWN will now switch off the video output. Since some televisions turn themselves off after a while with no signal, this is the closest we can get to power-saving. Priority: normal Signed-off-by: Ian Armstrong Signed-off-by: Hans Verkuil --- linux/drivers/media/video/ivtv/ivtv-i2c.c | 1 + linux/drivers/media/video/ivtv/ivtvfb.c | 6 ++++++ 2 files changed, 7 insertions(+) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/ivtv/ivtv-i2c.c b/linux/drivers/media/video/ivtv/ivtv-i2c.c index 6c37203db..c251ddb2f 100644 --- a/linux/drivers/media/video/ivtv/ivtv-i2c.c +++ b/linux/drivers/media/video/ivtv/ivtv-i2c.c @@ -760,6 +760,7 @@ int ivtv_saa7127(struct ivtv *itv, unsigned int cmd, void *arg) { return ivtv_call_i2c_client(itv, IVTV_SAA7127_I2C_ADDR, cmd, arg); } +EXPORT_SYMBOL(ivtv_saa7127); int ivtv_saa717x(struct ivtv *itv, unsigned int cmd, void *arg) { diff --git a/linux/drivers/media/video/ivtv/ivtvfb.c b/linux/drivers/media/video/ivtv/ivtvfb.c index 1ac3af3fc..5e3613d86 100644 --- a/linux/drivers/media/video/ivtv/ivtvfb.c +++ b/linux/drivers/media/video/ivtv/ivtvfb.c @@ -48,6 +48,7 @@ #endif #include "ivtv-driver.h" +#include "ivtv-i2c.h" #include "ivtv-udma.h" #include "ivtv-mailbox.h" @@ -903,11 +904,16 @@ static int ivtvfb_blank(int blank_mode, struct fb_info *info) switch (blank_mode) { case FB_BLANK_UNBLANK: ivtv_vapi(itv, CX2341X_OSD_SET_STATE, 1, 1); + ivtv_saa7127(itv, VIDIOC_STREAMON, NULL); break; case FB_BLANK_NORMAL: case FB_BLANK_HSYNC_SUSPEND: case FB_BLANK_VSYNC_SUSPEND: + ivtv_vapi(itv, CX2341X_OSD_SET_STATE, 1, 0); + ivtv_saa7127(itv, VIDIOC_STREAMON, NULL); + break; case FB_BLANK_POWERDOWN: + ivtv_saa7127(itv, VIDIOC_STREAMOFF, NULL); ivtv_vapi(itv, CX2341X_OSD_SET_STATE, 1, 0); break; } -- cgit v1.2.3 From 102df888ee48727bf1593559f4c301f33ecd7bab Mon Sep 17 00:00:00 2001 From: "darron@kewl.org" Date: Tue, 21 Oct 2008 14:42:00 +0100 Subject: cx88: initial fix for analogue only compilation From: Darron Broad Initial fix for when analogue only is selected for compilation (ie, !CX88_DVB) Priority: normal Signed-off-by: Darron Broad --- linux/drivers/media/video/cx88/cx88-i2c.c | 2 ++ linux/drivers/media/video/cx88/cx88-mpeg.c | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/cx88/cx88-i2c.c b/linux/drivers/media/video/cx88/cx88-i2c.c index 01de23007..1ab691d20 100644 --- a/linux/drivers/media/video/cx88/cx88-i2c.c +++ b/linux/drivers/media/video/cx88/cx88-i2c.c @@ -116,8 +116,10 @@ static int detach_inform(struct i2c_client *client) void cx88_call_i2c_clients(struct cx88_core *core, unsigned int cmd, void *arg) { +#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE) struct videobuf_dvb_frontends *f = &core->dvbdev->frontends; struct videobuf_dvb_frontend *fe = NULL; +#endif if (0 != core->i2c_rc) return; diff --git a/linux/drivers/media/video/cx88/cx88-mpeg.c b/linux/drivers/media/video/cx88/cx88-mpeg.c index bad3680b9..0c33ebdd6 100644 --- a/linux/drivers/media/video/cx88/cx88-mpeg.c +++ b/linux/drivers/media/video/cx88/cx88-mpeg.c @@ -808,8 +808,11 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, { struct cx8802_dev *dev; struct cx88_core *core; + int err; +#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE) struct videobuf_dvb_frontend *demod; - int err,i; + int i; +#endif /* general setup */ core = cx88_core_get(pci_dev); @@ -841,6 +844,7 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, INIT_LIST_HEAD(&dev->drvlist); list_add_tail(&dev->devlist,&cx8802_devlist); +#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE) mutex_init(&dev->frontends.lock); INIT_LIST_HEAD(&dev->frontends.felist); @@ -854,6 +858,7 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, goto fail_free; } } +#endif /* Maintain a reference so cx88-video can query the 8802 device. */ core->dvbdev = dev; -- cgit v1.2.3 From 2cfa489837712ce5e1f65039f8a9827907220aa5 Mon Sep 17 00:00:00 2001 From: "darron@kewl.org" Date: Tue, 21 Oct 2008 14:43:10 +0100 Subject: cx88: Not all boards that requires cx88-mpeg has frontends From: Mauro Carvalho Chehab The multifrontend changes on cx88 assumed that all boards that use cx88-mpeg supports DVB. This is not true. There also a few analog-only boards based on Blackboard design that also uses cx88-mpeg. For those boards, there's no need to allocate dvb frontends. This patch fixes videobuf allocation for those devices. Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/cx88/cx88-cards.c | 4 ++-- linux/drivers/media/video/cx88/cx88-mpeg.c | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/cx88/cx88-cards.c b/linux/drivers/media/video/cx88/cx88-cards.c index 1a79387c0..4897c852d 100644 --- a/linux/drivers/media/video/cx88/cx88-cards.c +++ b/linux/drivers/media/video/cx88/cx88-cards.c @@ -3077,8 +3077,8 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr) memcpy(&core->board, &cx88_boards[core->boardnr], sizeof(core->board)); - if (!core->board.num_frontends) - core->board.num_frontends=1; + if (!core->board.num_frontends && (core->board.mpeg & CX88_MPEG_DVB)) + core->board.num_frontends = 1; info_printk(core, "subsystem: %04x:%04x, board: %s [card=%d,%s], frontend(s): %d\n", pci->subsystem_vendor, pci->subsystem_device, core->board.name, diff --git a/linux/drivers/media/video/cx88/cx88-mpeg.c b/linux/drivers/media/video/cx88/cx88-mpeg.c index 0c33ebdd6..b21b0c26c 100644 --- a/linux/drivers/media/video/cx88/cx88-mpeg.c +++ b/linux/drivers/media/video/cx88/cx88-mpeg.c @@ -825,11 +825,6 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, if (!core->board.mpeg) goto fail_core; - if (!core->board.num_frontends) { - printk(KERN_ERR "%s() .num_frontends should be non-zero, err = %d\n", __func__, err); - goto fail_core; - } - err = -ENOMEM; dev = kzalloc(sizeof(*dev),GFP_KERNEL); if (NULL == dev) @@ -848,7 +843,8 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, mutex_init(&dev->frontends.lock); INIT_LIST_HEAD(&dev->frontends.felist); - printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__, core->board.num_frontends); + if (core->board.num_frontends) + printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__, core->board.num_frontends); for (i = 1; i <= core->board.num_frontends; i++) { demod = videobuf_dvb_alloc_frontend(&dev->frontends, i); -- cgit v1.2.3 From 0800cba094ff56d15c61cd0f633e0d8b1a80f3fb Mon Sep 17 00:00:00 2001 From: "darron@kewl.org" Date: Tue, 21 Oct 2008 15:18:47 +0100 Subject: cx88: dvb_remove debug output From: Darron Broad Add debug output for dvb_remove enter. Priority: normal Signed-off-by: Darron Broad --- linux/drivers/media/video/cx88/cx88-dvb.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/cx88/cx88-dvb.c b/linux/drivers/media/video/cx88/cx88-dvb.c index 2ae6bf129..83d006ef1 100644 --- a/linux/drivers/media/video/cx88/cx88-dvb.c +++ b/linux/drivers/media/video/cx88/cx88-dvb.c @@ -1256,8 +1256,11 @@ fail_core: static int cx8802_dvb_remove(struct cx8802_driver *drv) { + struct cx88_core *core = drv->core; struct cx8802_dev *dev = drv->core->dvbdev; + dprintk( 1, "%s\n", __func__); + videobuf_dvb_unregister_bus(&dev->frontends); vp3054_i2c_remove(dev); -- cgit v1.2.3 From 04aa4b62d67d07cdb0a26eff8eb37482dea62b42 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 21 Oct 2008 12:27:20 -0200 Subject: Get rid of inode parameter at v4l_compat_translate_ioctl() From: Mauro Carvalho Chehab The inode parameter at v4l_compat_translate_ioctl() were just passed over several places just to keep compatible with fops.ioctl. However, it weren't used anywere. This patch gets hid of this unused parameter. Priority: normal CC: Laurent Pinchart CC: Mike Isely Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/common/saa7146_video.c | 12 +- linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c | 11 +- linux/drivers/media/video/uvc/uvc_v4l2.c | 12 +- linux/drivers/media/video/v4l1-compat.c | 221 ++++++++++------------- linux/drivers/media/video/v4l2-ioctl.c | 6 +- 5 files changed, 127 insertions(+), 135 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/common/saa7146_video.c b/linux/drivers/media/common/saa7146_video.c index 8804d4e78..545bb42fe 100644 --- a/linux/drivers/media/common/saa7146_video.c +++ b/linux/drivers/media/common/saa7146_video.c @@ -835,7 +835,7 @@ static int video_end(struct saa7146_fh *fh, struct file *file) * copying is done already, arg is a kernel pointer. */ -int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int cmd, void *arg) +static int __saa7146_video_do_ioctl(struct file *file, unsigned int cmd, void *arg) { struct saa7146_fh *fh = file->private_data; struct saa7146_dev *dev = fh->dev; @@ -1216,12 +1216,18 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int } #endif default: - return v4l_compat_translate_ioctl(inode,file,cmd,arg, - saa7146_video_do_ioctl); + return v4l_compat_translate_ioctl(file, cmd, arg, + __saa7146_video_do_ioctl); } return 0; } +int saa7146_video_do_ioctl(struct inode *inode, struct file *file, + unsigned int cmd, void *arg) +{ + return __saa7146_video_do_ioctl(file, cmd, arg); +} + /*********************************************************************************/ /* buffer handling functions */ diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index 4e9cd246a..6fbd43f50 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c @@ -169,7 +169,7 @@ static const char *get_v4l_name(int v4l_type) * This is part of Video 4 Linux API. The procedure handles ioctl() calls. * */ -static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file, +static int __pvr2_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) { struct pvr2_v4l2_fh *fh = file->private_data; @@ -864,8 +864,8 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file, #endif default : - ret = v4l_compat_translate_ioctl(inode,file,cmd, - arg,pvr2_v4l2_do_ioctl); + ret = v4l_compat_translate_ioctl(file, cmd, + arg, __pvr2_v4l2_do_ioctl); } pvr2_hdw_commit_ctl(hdw); @@ -891,6 +891,11 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file, return ret; } +static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file, + unsigned int cmd, void *arg) +{ + return __pvr2_v4l2_do_ioctl(file, cmd, arg); +} static void pvr2_v4l2_dev_destroy(struct pvr2_v4l2_dev *dip) { diff --git a/linux/drivers/media/video/uvc/uvc_v4l2.c b/linux/drivers/media/video/uvc/uvc_v4l2.c index 78e4c4e09..758dfefab 100644 --- a/linux/drivers/media/video/uvc/uvc_v4l2.c +++ b/linux/drivers/media/video/uvc/uvc_v4l2.c @@ -464,7 +464,7 @@ static int uvc_v4l2_release(struct inode *inode, struct file *file) return 0; } -static int uvc_v4l2_do_ioctl(struct inode *inode, struct file *file, +static int __uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) { struct video_device *vdev = video_devdata(file); @@ -978,8 +978,8 @@ static int uvc_v4l2_do_ioctl(struct inode *inode, struct file *file, return uvc_xu_ctrl_query(video, arg, 1); default: - if ((ret = v4l_compat_translate_ioctl(inode, file, cmd, arg, - uvc_v4l2_do_ioctl)) == -ENOIOCTLCMD) + if ((ret = v4l_compat_translate_ioctl(file, cmd, arg, + __uvc_v4l2_do_ioctl)) == -ENOIOCTLCMD) uvc_trace(UVC_TRACE_IOCTL, "Unknown ioctl 0x%08x\n", cmd); return ret; @@ -988,6 +988,12 @@ static int uvc_v4l2_do_ioctl(struct inode *inode, struct file *file, return ret; } +static int uvc_v4l2_do_ioctl(struct inode *inode, struct file *file, + unsigned int cmd, void *arg) +{ + return __uvc_v4l2_do_ioctl(file, cmd, arg); +} + static int uvc_v4l2_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { diff --git a/linux/drivers/media/video/v4l1-compat.c b/linux/drivers/media/video/v4l1-compat.c index 5d8a65aa5..c2fadee58 100644 --- a/linux/drivers/media/video/v4l1-compat.c +++ b/linux/drivers/media/video/v4l1-compat.c @@ -62,8 +62,7 @@ MODULE_LICENSE("GPL"); */ static int -get_v4l_control(struct inode *inode, - struct file *file, +get_v4l_control(struct file *file, int cid, v4l2_kioctl drv) { @@ -72,12 +71,12 @@ get_v4l_control(struct inode *inode, int err; qctrl2.id = cid; - err = drv(inode, file, VIDIOC_QUERYCTRL, &qctrl2); + err = drv(file, VIDIOC_QUERYCTRL, &qctrl2); if (err < 0) dprintk("VIDIOC_QUERYCTRL: %d\n", err); if (err == 0 && !(qctrl2.flags & V4L2_CTRL_FLAG_DISABLED)) { ctrl2.id = qctrl2.id; - err = drv(inode, file, VIDIOC_G_CTRL, &ctrl2); + err = drv(file, VIDIOC_G_CTRL, &ctrl2); if (err < 0) { dprintk("VIDIOC_G_CTRL: %d\n", err); return 0; @@ -90,8 +89,7 @@ get_v4l_control(struct inode *inode, } static int -set_v4l_control(struct inode *inode, - struct file *file, +set_v4l_control(struct file *file, int cid, int value, v4l2_kioctl drv) @@ -101,7 +99,7 @@ set_v4l_control(struct inode *inode, int err; qctrl2.id = cid; - err = drv(inode, file, VIDIOC_QUERYCTRL, &qctrl2); + err = drv(file, VIDIOC_QUERYCTRL, &qctrl2); if (err < 0) dprintk("VIDIOC_QUERYCTRL: %d\n", err); if (err == 0 && @@ -119,7 +117,7 @@ set_v4l_control(struct inode *inode, + 32767) / 65535; ctrl2.value += qctrl2.minimum; - err = drv(inode, file, VIDIOC_S_CTRL, &ctrl2); + err = drv(file, VIDIOC_S_CTRL, &ctrl2); if (err < 0) dprintk("VIDIOC_S_CTRL: %d\n", err); } @@ -227,7 +225,6 @@ static int poll_one(struct file *file, struct poll_wqueues *pwq) } static int count_inputs( - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -237,14 +234,13 @@ static int count_inputs( for (i = 0;; i++) { memset(&input2, 0, sizeof(input2)); input2.index = i; - if (0 != drv(inode, file, VIDIOC_ENUMINPUT, &input2)) + if (0 != drv(file, VIDIOC_ENUMINPUT, &input2)) break; } return i; } static int check_size( - struct inode *inode, struct file *file, v4l2_kioctl drv, int *maxw, @@ -257,14 +253,14 @@ static int check_size( memset(&fmt2, 0, sizeof(fmt2)); desc2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - if (0 != drv(inode, file, VIDIOC_ENUM_FMT, &desc2)) + if (0 != drv(file, VIDIOC_ENUM_FMT, &desc2)) goto done; fmt2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; fmt2.fmt.pix.width = 10000; fmt2.fmt.pix.height = 10000; fmt2.fmt.pix.pixelformat = desc2.pixelformat; - if (0 != drv(inode, file, VIDIOC_TRY_FMT, &fmt2)) + if (0 != drv(file, VIDIOC_TRY_FMT, &fmt2)) goto done; *maxw = fmt2.fmt.pix.width; @@ -278,7 +274,6 @@ done: static noinline int v4l1_compat_get_capabilities( struct video_capability *cap, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -294,13 +289,13 @@ static noinline int v4l1_compat_get_capabilities( memset(cap, 0, sizeof(*cap)); memset(&fbuf, 0, sizeof(fbuf)); - err = drv(inode, file, VIDIOC_QUERYCAP, cap2); + err = drv(file, VIDIOC_QUERYCAP, cap2); if (err < 0) { dprintk("VIDIOCGCAP / VIDIOC_QUERYCAP: %d\n", err); goto done; } if (cap2->capabilities & V4L2_CAP_VIDEO_OVERLAY) { - err = drv(inode, file, VIDIOC_G_FBUF, &fbuf); + err = drv(file, VIDIOC_G_FBUF, &fbuf); if (err < 0) { dprintk("VIDIOCGCAP / VIDIOC_G_FBUF: %d\n", err); memset(&fbuf, 0, sizeof(fbuf)); @@ -322,8 +317,8 @@ static noinline int v4l1_compat_get_capabilities( if (fbuf.capability & V4L2_FBUF_CAP_LIST_CLIPPING) cap->type |= VID_TYPE_CLIPPING; - cap->channels = count_inputs(inode, file, drv); - check_size(inode, file, drv, + cap->channels = count_inputs(file, drv); + check_size(file, drv, &cap->maxwidth, &cap->maxheight); cap->audios = 0; /* FIXME */ cap->minwidth = 48; /* FIXME */ @@ -336,7 +331,6 @@ done: static noinline int v4l1_compat_get_frame_buffer( struct video_buffer *buffer, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -346,7 +340,7 @@ static noinline int v4l1_compat_get_frame_buffer( memset(buffer, 0, sizeof(*buffer)); memset(&fbuf, 0, sizeof(fbuf)); - err = drv(inode, file, VIDIOC_G_FBUF, &fbuf); + err = drv(file, VIDIOC_G_FBUF, &fbuf); if (err < 0) { dprintk("VIDIOCGFBUF / VIDIOC_G_FBUF: %d\n", err); goto done; @@ -391,7 +385,6 @@ done: static noinline int v4l1_compat_set_frame_buffer( struct video_buffer *buffer, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -420,7 +413,7 @@ static noinline int v4l1_compat_set_frame_buffer( break; } fbuf.fmt.bytesperline = buffer->bytesperline; - err = drv(inode, file, VIDIOC_S_FBUF, &fbuf); + err = drv(file, VIDIOC_S_FBUF, &fbuf); if (err < 0) dprintk("VIDIOCSFBUF / VIDIOC_S_FBUF: %d\n", err); return err; @@ -428,7 +421,6 @@ static noinline int v4l1_compat_set_frame_buffer( static noinline int v4l1_compat_get_win_cap_dimensions( struct video_window *win, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -443,7 +435,7 @@ static noinline int v4l1_compat_get_win_cap_dimensions( memset(win, 0, sizeof(*win)); fmt->type = V4L2_BUF_TYPE_VIDEO_OVERLAY; - err = drv(inode, file, VIDIOC_G_FMT, fmt); + err = drv(file, VIDIOC_G_FMT, fmt); if (err < 0) dprintk("VIDIOCGWIN / VIDIOC_G_WIN: %d\n", err); if (err == 0) { @@ -458,7 +450,7 @@ static noinline int v4l1_compat_get_win_cap_dimensions( } fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - err = drv(inode, file, VIDIOC_G_FMT, fmt); + err = drv(file, VIDIOC_G_FMT, fmt); if (err < 0) { dprintk("VIDIOCGWIN / VIDIOC_G_FMT: %d\n", err); goto done; @@ -477,7 +469,6 @@ done: static noinline int v4l1_compat_set_win_cap_dimensions( struct video_window *win, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -490,8 +481,8 @@ static noinline int v4l1_compat_set_win_cap_dimensions( return err; } fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - drv(inode, file, VIDIOC_STREAMOFF, &fmt->type); - err1 = drv(inode, file, VIDIOC_G_FMT, fmt); + drv(file, VIDIOC_STREAMOFF, &fmt->type); + err1 = drv(file, VIDIOC_G_FMT, fmt); if (err1 < 0) dprintk("VIDIOCSWIN / VIDIOC_G_FMT: %d\n", err1); if (err1 == 0) { @@ -499,7 +490,7 @@ static noinline int v4l1_compat_set_win_cap_dimensions( fmt->fmt.pix.height = win->height; fmt->fmt.pix.field = V4L2_FIELD_ANY; fmt->fmt.pix.bytesperline = 0; - err = drv(inode, file, VIDIOC_S_FMT, fmt); + err = drv(file, VIDIOC_S_FMT, fmt); if (err < 0) dprintk("VIDIOCSWIN / VIDIOC_S_FMT #1: %d\n", err); @@ -516,7 +507,7 @@ static noinline int v4l1_compat_set_win_cap_dimensions( fmt->fmt.win.chromakey = win->chromakey; fmt->fmt.win.clips = (void __user *)win->clips; fmt->fmt.win.clipcount = win->clipcount; - err2 = drv(inode, file, VIDIOC_S_FMT, fmt); + err2 = drv(file, VIDIOC_S_FMT, fmt); if (err2 < 0) dprintk("VIDIOCSWIN / VIDIOC_S_FMT #2: %d\n", err2); @@ -530,7 +521,6 @@ static noinline int v4l1_compat_set_win_cap_dimensions( static noinline int v4l1_compat_turn_preview_on_off( int *on, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -541,9 +531,9 @@ static noinline int v4l1_compat_turn_preview_on_off( /* dirty hack time. But v4l1 has no STREAMOFF * equivalent in the API, and this one at * least comes close ... */ - drv(inode, file, VIDIOC_STREAMOFF, &captype); + drv(file, VIDIOC_STREAMOFF, &captype); } - err = drv(inode, file, VIDIOC_OVERLAY, on); + err = drv(file, VIDIOC_OVERLAY, on); if (err < 0) dprintk("VIDIOCCAPTURE / VIDIOC_PREVIEW: %d\n", err); return err; @@ -551,7 +541,6 @@ static noinline int v4l1_compat_turn_preview_on_off( static noinline int v4l1_compat_get_input_info( struct video_channel *chan, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -561,7 +550,7 @@ static noinline int v4l1_compat_get_input_info( memset(&input2, 0, sizeof(input2)); input2.index = chan->channel; - err = drv(inode, file, VIDIOC_ENUMINPUT, &input2); + err = drv(file, VIDIOC_ENUMINPUT, &input2); if (err < 0) { dprintk("VIDIOCGCHAN / VIDIOC_ENUMINPUT: " "channel=%d err=%d\n", chan->channel, err); @@ -583,7 +572,7 @@ static noinline int v4l1_compat_get_input_info( break; } chan->norm = 0; - err = drv(inode, file, VIDIOC_G_STD, &sid); + err = drv(file, VIDIOC_G_STD, &sid); if (err < 0) dprintk("VIDIOCGCHAN / VIDIOC_G_STD: %d\n", err); if (err == 0) { @@ -600,14 +589,13 @@ done: static noinline int v4l1_compat_set_input( struct video_channel *chan, - struct inode *inode, struct file *file, v4l2_kioctl drv) { int err; v4l2_std_id sid = 0; - err = drv(inode, file, VIDIOC_S_INPUT, &chan->channel); + err = drv(file, VIDIOC_S_INPUT, &chan->channel); if (err < 0) dprintk("VIDIOCSCHAN / VIDIOC_S_INPUT: %d\n", err); switch (chan->norm) { @@ -622,7 +610,7 @@ static noinline int v4l1_compat_set_input( break; } if (0 != sid) { - err = drv(inode, file, VIDIOC_S_STD, &sid); + err = drv(file, VIDIOC_S_STD, &sid); if (err < 0) dprintk("VIDIOCSCHAN / VIDIOC_S_STD: %d\n", err); } @@ -631,7 +619,6 @@ static noinline int v4l1_compat_set_input( static noinline int v4l1_compat_get_picture( struct video_picture *pict, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -644,19 +631,19 @@ static noinline int v4l1_compat_get_picture( return err; } - pict->brightness = get_v4l_control(inode, file, + pict->brightness = get_v4l_control(file, V4L2_CID_BRIGHTNESS, drv); - pict->hue = get_v4l_control(inode, file, + pict->hue = get_v4l_control(file, V4L2_CID_HUE, drv); - pict->contrast = get_v4l_control(inode, file, + pict->contrast = get_v4l_control(file, V4L2_CID_CONTRAST, drv); - pict->colour = get_v4l_control(inode, file, + pict->colour = get_v4l_control(file, V4L2_CID_SATURATION, drv); - pict->whiteness = get_v4l_control(inode, file, + pict->whiteness = get_v4l_control(file, V4L2_CID_WHITENESS, drv); fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - err = drv(inode, file, VIDIOC_G_FMT, fmt); + err = drv(file, VIDIOC_G_FMT, fmt); if (err < 0) { dprintk("VIDIOCGPICT / VIDIOC_G_FMT: %d\n", err); goto done; @@ -674,7 +661,6 @@ done: static noinline int v4l1_compat_set_picture( struct video_picture *pict, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -690,15 +676,15 @@ static noinline int v4l1_compat_set_picture( } memset(&fbuf, 0, sizeof(fbuf)); - set_v4l_control(inode, file, + set_v4l_control(file, V4L2_CID_BRIGHTNESS, pict->brightness, drv); - set_v4l_control(inode, file, + set_v4l_control(file, V4L2_CID_HUE, pict->hue, drv); - set_v4l_control(inode, file, + set_v4l_control(file, V4L2_CID_CONTRAST, pict->contrast, drv); - set_v4l_control(inode, file, + set_v4l_control(file, V4L2_CID_SATURATION, pict->colour, drv); - set_v4l_control(inode, file, + set_v4l_control(file, V4L2_CID_WHITENESS, pict->whiteness, drv); /* * V4L1 uses this ioctl to set both memory capture and overlay @@ -708,7 +694,7 @@ static noinline int v4l1_compat_set_picture( */ fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - err = drv(inode, file, VIDIOC_G_FMT, fmt); + err = drv(file, VIDIOC_G_FMT, fmt); /* If VIDIOC_G_FMT failed, then the driver likely doesn't support memory capture. Trying to set the memory capture parameters would be pointless. */ @@ -719,13 +705,13 @@ static noinline int v4l1_compat_set_picture( palette_to_pixelformat(pict->palette)) { fmt->fmt.pix.pixelformat = palette_to_pixelformat( pict->palette); - mem_err = drv(inode, file, VIDIOC_S_FMT, fmt); + mem_err = drv(file, VIDIOC_S_FMT, fmt); if (mem_err < 0) dprintk("VIDIOCSPICT / VIDIOC_S_FMT: %d\n", mem_err); } - err = drv(inode, file, VIDIOC_G_FBUF, &fbuf); + err = drv(file, VIDIOC_G_FBUF, &fbuf); /* If VIDIOC_G_FBUF failed, then the driver likely doesn't support overlay. Trying to set the overlay parameters would be quite pointless. */ @@ -736,7 +722,7 @@ static noinline int v4l1_compat_set_picture( palette_to_pixelformat(pict->palette)) { fbuf.fmt.pixelformat = palette_to_pixelformat( pict->palette); - ovl_err = drv(inode, file, VIDIOC_S_FBUF, &fbuf); + ovl_err = drv(file, VIDIOC_S_FBUF, &fbuf); if (ovl_err < 0) dprintk("VIDIOCSPICT / VIDIOC_S_FBUF: %d\n", ovl_err); @@ -757,7 +743,6 @@ static noinline int v4l1_compat_set_picture( static noinline int v4l1_compat_get_tuner( struct video_tuner *tun, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -767,7 +752,7 @@ static noinline int v4l1_compat_get_tuner( v4l2_std_id sid; memset(&tun2, 0, sizeof(tun2)); - err = drv(inode, file, VIDIOC_G_TUNER, &tun2); + err = drv(file, VIDIOC_G_TUNER, &tun2); if (err < 0) { dprintk("VIDIOCGTUNER / VIDIOC_G_TUNER: %d\n", err); goto done; @@ -783,7 +768,7 @@ static noinline int v4l1_compat_get_tuner( for (i = 0; i < 64; i++) { memset(&std2, 0, sizeof(std2)); std2.index = i; - if (0 != drv(inode, file, VIDIOC_ENUMSTD, &std2)) + if (0 != drv(file, VIDIOC_ENUMSTD, &std2)) break; if (std2.id & V4L2_STD_PAL) tun->flags |= VIDEO_TUNER_PAL; @@ -793,7 +778,7 @@ static noinline int v4l1_compat_get_tuner( tun->flags |= VIDEO_TUNER_SECAM; } - err = drv(inode, file, VIDIOC_G_STD, &sid); + err = drv(file, VIDIOC_G_STD, &sid); if (err < 0) dprintk("VIDIOCGTUNER / VIDIOC_G_STD: %d\n", err); if (err == 0) { @@ -816,7 +801,6 @@ done: static noinline int v4l1_compat_select_tuner( struct video_tuner *tun, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -826,7 +810,7 @@ static noinline int v4l1_compat_select_tuner( t.index = tun->tuner; - err = drv(inode, file, VIDIOC_S_INPUT, &t); + err = drv(file, VIDIOC_S_INPUT, &t); if (err < 0) dprintk("VIDIOCSTUNER / VIDIOC_S_INPUT: %d\n", err); return err; @@ -834,7 +818,6 @@ static noinline int v4l1_compat_select_tuner( static noinline int v4l1_compat_get_frequency( unsigned long *freq, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -843,7 +826,7 @@ static noinline int v4l1_compat_get_frequency( memset(&freq2, 0, sizeof(freq2)); freq2.tuner = 0; - err = drv(inode, file, VIDIOC_G_FREQUENCY, &freq2); + err = drv(file, VIDIOC_G_FREQUENCY, &freq2); if (err < 0) dprintk("VIDIOCGFREQ / VIDIOC_G_FREQUENCY: %d\n", err); if (0 == err) @@ -853,7 +836,6 @@ static noinline int v4l1_compat_get_frequency( static noinline int v4l1_compat_set_frequency( unsigned long *freq, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -861,9 +843,9 @@ static noinline int v4l1_compat_set_frequency( struct v4l2_frequency freq2; memset(&freq2, 0, sizeof(freq2)); - drv(inode, file, VIDIOC_G_FREQUENCY, &freq2); + drv(file, VIDIOC_G_FREQUENCY, &freq2); freq2.frequency = *freq; - err = drv(inode, file, VIDIOC_S_FREQUENCY, &freq2); + err = drv(file, VIDIOC_S_FREQUENCY, &freq2); if (err < 0) dprintk("VIDIOCSFREQ / VIDIOC_S_FREQUENCY: %d\n", err); return err; @@ -871,7 +853,6 @@ static noinline int v4l1_compat_set_frequency( static noinline int v4l1_compat_get_audio( struct video_audio *aud, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -881,7 +862,7 @@ static noinline int v4l1_compat_get_audio( struct v4l2_tuner tun2; memset(&aud2, 0, sizeof(aud2)); - err = drv(inode, file, VIDIOC_G_AUDIO, &aud2); + err = drv(file, VIDIOC_G_AUDIO, &aud2); if (err < 0) { dprintk("VIDIOCGAUDIO / VIDIOC_G_AUDIO: %d\n", err); goto done; @@ -891,27 +872,27 @@ static noinline int v4l1_compat_get_audio( aud->name[sizeof(aud->name) - 1] = 0; aud->audio = aud2.index; aud->flags = 0; - i = get_v4l_control(inode, file, V4L2_CID_AUDIO_VOLUME, drv); + i = get_v4l_control(file, V4L2_CID_AUDIO_VOLUME, drv); if (i >= 0) { aud->volume = i; aud->flags |= VIDEO_AUDIO_VOLUME; } - i = get_v4l_control(inode, file, V4L2_CID_AUDIO_BASS, drv); + i = get_v4l_control(file, V4L2_CID_AUDIO_BASS, drv); if (i >= 0) { aud->bass = i; aud->flags |= VIDEO_AUDIO_BASS; } - i = get_v4l_control(inode, file, V4L2_CID_AUDIO_TREBLE, drv); + i = get_v4l_control(file, V4L2_CID_AUDIO_TREBLE, drv); if (i >= 0) { aud->treble = i; aud->flags |= VIDEO_AUDIO_TREBLE; } - i = get_v4l_control(inode, file, V4L2_CID_AUDIO_BALANCE, drv); + i = get_v4l_control(file, V4L2_CID_AUDIO_BALANCE, drv); if (i >= 0) { aud->balance = i; aud->flags |= VIDEO_AUDIO_BALANCE; } - i = get_v4l_control(inode, file, V4L2_CID_AUDIO_MUTE, drv); + i = get_v4l_control(file, V4L2_CID_AUDIO_MUTE, drv); if (i >= 0) { if (i) aud->flags |= VIDEO_AUDIO_MUTE; @@ -919,13 +900,13 @@ static noinline int v4l1_compat_get_audio( } aud->step = 1; qctrl2.id = V4L2_CID_AUDIO_VOLUME; - if (drv(inode, file, VIDIOC_QUERYCTRL, &qctrl2) == 0 && + if (drv(file, VIDIOC_QUERYCTRL, &qctrl2) == 0 && !(qctrl2.flags & V4L2_CTRL_FLAG_DISABLED)) aud->step = qctrl2.step; aud->mode = 0; memset(&tun2, 0, sizeof(tun2)); - err = drv(inode, file, VIDIOC_G_TUNER, &tun2); + err = drv(file, VIDIOC_G_TUNER, &tun2); if (err < 0) { dprintk("VIDIOCGAUDIO / VIDIOC_G_TUNER: %d\n", err); err = 0; @@ -944,7 +925,6 @@ done: static noinline int v4l1_compat_set_audio( struct video_audio *aud, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -956,24 +936,24 @@ static noinline int v4l1_compat_set_audio( memset(&tun2, 0, sizeof(tun2)); aud2.index = aud->audio; - err = drv(inode, file, VIDIOC_S_AUDIO, &aud2); + err = drv(file, VIDIOC_S_AUDIO, &aud2); if (err < 0) { dprintk("VIDIOCSAUDIO / VIDIOC_S_AUDIO: %d\n", err); goto done; } - set_v4l_control(inode, file, V4L2_CID_AUDIO_VOLUME, + set_v4l_control(file, V4L2_CID_AUDIO_VOLUME, aud->volume, drv); - set_v4l_control(inode, file, V4L2_CID_AUDIO_BASS, + set_v4l_control(file, V4L2_CID_AUDIO_BASS, aud->bass, drv); - set_v4l_control(inode, file, V4L2_CID_AUDIO_TREBLE, + set_v4l_control(file, V4L2_CID_AUDIO_TREBLE, aud->treble, drv); - set_v4l_control(inode, file, V4L2_CID_AUDIO_BALANCE, + set_v4l_control(file, V4L2_CID_AUDIO_BALANCE, aud->balance, drv); - set_v4l_control(inode, file, V4L2_CID_AUDIO_MUTE, + set_v4l_control(file, V4L2_CID_AUDIO_MUTE, !!(aud->flags & VIDEO_AUDIO_MUTE), drv); - err = drv(inode, file, VIDIOC_G_TUNER, &tun2); + err = drv(file, VIDIOC_G_TUNER, &tun2); if (err < 0) dprintk("VIDIOCSAUDIO / VIDIOC_G_TUNER: %d\n", err); if (err == 0) { @@ -990,7 +970,7 @@ static noinline int v4l1_compat_set_audio( tun2.audmode = V4L2_TUNER_MODE_LANG2; break; } - err = drv(inode, file, VIDIOC_S_TUNER, &tun2); + err = drv(file, VIDIOC_S_TUNER, &tun2); if (err < 0) dprintk("VIDIOCSAUDIO / VIDIOC_S_TUNER: %d\n", err); } @@ -1001,7 +981,6 @@ done: static noinline int v4l1_compat_capture_frame( struct video_mmap *mm, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -1018,7 +997,7 @@ static noinline int v4l1_compat_capture_frame( memset(&buf, 0, sizeof(buf)); fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - err = drv(inode, file, VIDIOC_G_FMT, fmt); + err = drv(file, VIDIOC_G_FMT, fmt); if (err < 0) { dprintk("VIDIOCMCAPTURE / VIDIOC_G_FMT: %d\n", err); goto done; @@ -1034,7 +1013,7 @@ static noinline int v4l1_compat_capture_frame( palette_to_pixelformat(mm->format); fmt->fmt.pix.field = V4L2_FIELD_ANY; fmt->fmt.pix.bytesperline = 0; - err = drv(inode, file, VIDIOC_S_FMT, fmt); + err = drv(file, VIDIOC_S_FMT, fmt); if (err < 0) { dprintk("VIDIOCMCAPTURE / VIDIOC_S_FMT: %d\n", err); goto done; @@ -1042,17 +1021,17 @@ static noinline int v4l1_compat_capture_frame( } buf.index = mm->frame; buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - err = drv(inode, file, VIDIOC_QUERYBUF, &buf); + err = drv(file, VIDIOC_QUERYBUF, &buf); if (err < 0) { dprintk("VIDIOCMCAPTURE / VIDIOC_QUERYBUF: %d\n", err); goto done; } - err = drv(inode, file, VIDIOC_QBUF, &buf); + err = drv(file, VIDIOC_QBUF, &buf); if (err < 0) { dprintk("VIDIOCMCAPTURE / VIDIOC_QBUF: %d\n", err); goto done; } - err = drv(inode, file, VIDIOC_STREAMON, &captype); + err = drv(file, VIDIOC_STREAMON, &captype); if (err < 0) dprintk("VIDIOCMCAPTURE / VIDIOC_STREAMON: %d\n", err); done: @@ -1062,7 +1041,6 @@ done: static noinline int v4l1_compat_sync( int *i, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -1074,7 +1052,7 @@ static noinline int v4l1_compat_sync( memset(&buf, 0, sizeof(buf)); buf.index = *i; buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - err = drv(inode, file, VIDIOC_QUERYBUF, &buf); + err = drv(file, VIDIOC_QUERYBUF, &buf); if (err < 0) { /* No such buffer */ dprintk("VIDIOCSYNC / VIDIOC_QUERYBUF: %d\n", err); @@ -1087,7 +1065,7 @@ static noinline int v4l1_compat_sync( } /* make sure capture actually runs so we don't block forever */ - err = drv(inode, file, VIDIOC_STREAMON, &captype); + err = drv(file, VIDIOC_STREAMON, &captype); if (err < 0) { dprintk("VIDIOCSYNC / VIDIOC_STREAMON: %d\n", err); goto done; @@ -1101,7 +1079,7 @@ static noinline int v4l1_compat_sync( if (err < 0 || /* error or sleep was interrupted */ err == 0) /* timeout? Shouldn't occur. */ break; - err = drv(inode, file, VIDIOC_QUERYBUF, &buf); + err = drv(file, VIDIOC_QUERYBUF, &buf); if (err < 0) dprintk("VIDIOCSYNC / VIDIOC_QUERYBUF: %d\n", err); } @@ -1109,7 +1087,7 @@ static noinline int v4l1_compat_sync( if (!(buf.flags & V4L2_BUF_FLAG_DONE)) /* not done */ goto done; do { - err = drv(inode, file, VIDIOC_DQBUF, &buf); + err = drv(file, VIDIOC_DQBUF, &buf); if (err < 0) dprintk("VIDIOCSYNC / VIDIOC_DQBUF: %d\n", err); } while (err == 0 && buf.index != *i); @@ -1119,7 +1097,6 @@ done: static noinline int v4l1_compat_get_vbi_format( struct vbi_format *fmt, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -1133,7 +1110,7 @@ static noinline int v4l1_compat_get_vbi_format( } fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE; - err = drv(inode, file, VIDIOC_G_FMT, fmt2); + err = drv(file, VIDIOC_G_FMT, fmt2); if (err < 0) { dprintk("VIDIOCGVBIFMT / VIDIOC_G_FMT: %d\n", err); goto done; @@ -1158,7 +1135,6 @@ done: static noinline int v4l1_compat_set_vbi_format( struct vbi_format *fmt, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -1184,7 +1160,7 @@ static noinline int v4l1_compat_set_vbi_format( fmt2->fmt.vbi.start[1] = fmt->start[1]; fmt2->fmt.vbi.count[1] = fmt->count[1]; fmt2->fmt.vbi.flags = fmt->flags; - err = drv(inode, file, VIDIOC_TRY_FMT, fmt2); + err = drv(file, VIDIOC_TRY_FMT, fmt2); if (err < 0) { dprintk("VIDIOCSVBIFMT / VIDIOC_TRY_FMT: %d\n", err); goto done; @@ -1201,7 +1177,7 @@ static noinline int v4l1_compat_set_vbi_format( err = -EINVAL; goto done; } - err = drv(inode, file, VIDIOC_S_FMT, fmt2); + err = drv(file, VIDIOC_S_FMT, fmt2); if (err < 0) dprintk("VIDIOCSVBIFMT / VIDIOC_S_FMT: %d\n", err); done: @@ -1213,8 +1189,7 @@ done: * This function is exported. */ int -v4l_compat_translate_ioctl(struct inode *inode, - struct file *file, +v4l_compat_translate_ioctl(struct file *file, int cmd, void *arg, v4l2_kioctl drv) @@ -1223,52 +1198,52 @@ v4l_compat_translate_ioctl(struct inode *inode, switch (cmd) { case VIDIOCGCAP: /* capability */ - err = v4l1_compat_get_capabilities(arg, inode, file, drv); + err = v4l1_compat_get_capabilities(arg, file, drv); break; case VIDIOCGFBUF: /* get frame buffer */ - err = v4l1_compat_get_frame_buffer(arg, inode, file, drv); + err = v4l1_compat_get_frame_buffer(arg, file, drv); break; case VIDIOCSFBUF: /* set frame buffer */ - err = v4l1_compat_set_frame_buffer(arg, inode, file, drv); + err = v4l1_compat_set_frame_buffer(arg, file, drv); break; case VIDIOCGWIN: /* get window or capture dimensions */ - err = v4l1_compat_get_win_cap_dimensions(arg, inode, file, drv); + err = v4l1_compat_get_win_cap_dimensions(arg, file, drv); break; case VIDIOCSWIN: /* set window and/or capture dimensions */ - err = v4l1_compat_set_win_cap_dimensions(arg, inode, file, drv); + err = v4l1_compat_set_win_cap_dimensions(arg, file, drv); break; case VIDIOCCAPTURE: /* turn on/off preview */ - err = v4l1_compat_turn_preview_on_off(arg, inode, file, drv); + err = v4l1_compat_turn_preview_on_off(arg, file, drv); break; case VIDIOCGCHAN: /* get input information */ - err = v4l1_compat_get_input_info(arg, inode, file, drv); + err = v4l1_compat_get_input_info(arg, file, drv); break; case VIDIOCSCHAN: /* set input */ - err = v4l1_compat_set_input(arg, inode, file, drv); + err = v4l1_compat_set_input(arg, file, drv); break; case VIDIOCGPICT: /* get tone controls & partial capture format */ - err = v4l1_compat_get_picture(arg, inode, file, drv); + err = v4l1_compat_get_picture(arg, file, drv); break; case VIDIOCSPICT: /* set tone controls & partial capture format */ - err = v4l1_compat_set_picture(arg, inode, file, drv); + err = v4l1_compat_set_picture(arg, file, drv); break; case VIDIOCGTUNER: /* get tuner information */ - err = v4l1_compat_get_tuner(arg, inode, file, drv); + err = v4l1_compat_get_tuner(arg, file, drv); break; case VIDIOCSTUNER: /* select a tuner input */ - err = v4l1_compat_select_tuner(arg, inode, file, drv); + err = v4l1_compat_select_tuner(arg, file, drv); break; case VIDIOCGFREQ: /* get frequency */ - err = v4l1_compat_get_frequency(arg, inode, file, drv); + err = v4l1_compat_get_frequency(arg, file, drv); break; case VIDIOCSFREQ: /* set frequency */ - err = v4l1_compat_set_frequency(arg, inode, file, drv); + err = v4l1_compat_set_frequency(arg, file, drv); break; case VIDIOCGAUDIO: /* get audio properties/controls */ - err = v4l1_compat_get_audio(arg, inode, file, drv); + err = v4l1_compat_get_audio(arg, file, drv); break; case VIDIOCSAUDIO: /* set audio controls */ - err = v4l1_compat_set_audio(arg, inode, file, drv); + err = v4l1_compat_set_audio(arg, file, drv); break; #if 0 case VIDIOCGMBUF: @@ -1277,16 +1252,16 @@ v4l_compat_translate_ioctl(struct inode *inode, transparent, thus there is no point to try that */ #endif case VIDIOCMCAPTURE: /* capture a frame */ - err = v4l1_compat_capture_frame(arg, inode, file, drv); + err = v4l1_compat_capture_frame(arg, file, drv); break; case VIDIOCSYNC: /* wait for a frame */ - err = v4l1_compat_sync(arg, inode, file, drv); + err = v4l1_compat_sync(arg, file, drv); break; case VIDIOCGVBIFMT: /* query VBI data capture format */ - err = v4l1_compat_get_vbi_format(arg, inode, file, drv); + err = v4l1_compat_get_vbi_format(arg, file, drv); break; case VIDIOCSVBIFMT: - err = v4l1_compat_set_vbi_format(arg, inode, file, drv); + err = v4l1_compat_set_vbi_format(arg, file, drv); break; default: err = -ENOIOCTLCMD; diff --git a/linux/drivers/media/video/v4l2-ioctl.c b/linux/drivers/media/video/v4l2-ioctl.c index 871447bdd..301000661 100644 --- a/linux/drivers/media/video/v4l2-ioctl.c +++ b/linux/drivers/media/video/v4l2-ioctl.c @@ -626,7 +626,7 @@ static int check_fmt(const struct v4l2_ioctl_ops *ops, enum v4l2_buf_type type) return -EINVAL; } -static int __video_do_ioctl(struct inode *inode, struct file *file, +static int __video_do_ioctl(struct file *file, unsigned int cmd, void *arg) { struct video_device *vfd = video_devdata(file); @@ -676,7 +676,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, V4L2 ioctls. ********************************************************/ if (_IOC_TYPE(cmd) == 'v' && _IOC_NR(cmd) < BASE_VIDIOCPRIVATE) - return v4l_compat_translate_ioctl(inode, file, cmd, arg, + return v4l_compat_translate_ioctl(file, cmd, arg, __video_do_ioctl); #endif @@ -1833,7 +1833,7 @@ int video_ioctl2(struct inode *inode, struct file *file, } /* Handles IOCTL */ - err = __video_do_ioctl(inode, file, cmd, parg); + err = __video_do_ioctl(file, cmd, parg); if (err == -ENOIOCTLCMD) err = -EINVAL; if (is_ext_ctrl) { -- cgit v1.2.3 From 0510435b844435b557b8c02c5c7d2b0f958cd67a Mon Sep 17 00:00:00 2001 From: "darron@kewl.org" Date: Tue, 21 Oct 2008 15:28:46 +0100 Subject: videobuf: split unregister bus creating self-contained frontend de-allocator From: Darron Broad This creates a self contained frontend de-allocator for the instances where an adapter has not been registered yet frontend de-allocation may be required. Priority: normal Signed-off-by: Darron Broad --- linux/drivers/media/video/videobuf-dvb.c | 52 ++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 23 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/videobuf-dvb.c b/linux/drivers/media/video/videobuf-dvb.c index b1fd7e91e..2d382373b 100644 --- a/linux/drivers/media/video/videobuf-dvb.c +++ b/linux/drivers/media/video/videobuf-dvb.c @@ -301,29 +301,7 @@ EXPORT_SYMBOL(videobuf_dvb_register_bus); void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f) { - struct list_head *list, *q; - struct videobuf_dvb_frontend *fe; - - mutex_lock(&f->lock); - list_for_each_safe(list, q, &f->felist) { - fe = list_entry(list, struct videobuf_dvb_frontend, felist); - if (fe->dvb.net.dvbdev) { - dvb_net_release(&fe->dvb.net); - fe->dvb.demux.dmx.remove_frontend(&fe->dvb.demux.dmx, - &fe->dvb.fe_mem); - fe->dvb.demux.dmx.remove_frontend(&fe->dvb.demux.dmx, - &fe->dvb.fe_hw); - dvb_dmxdev_release(&fe->dvb.dmxdev); - dvb_dmx_release(&fe->dvb.demux); - dvb_unregister_frontend(fe->dvb.frontend); - } - if (fe->dvb.frontend) - /* always allocated, may have been reset */ - dvb_frontend_detach(fe->dvb.frontend); - list_del(list); - kfree(fe); - } - mutex_unlock(&f->lock); + videobuf_dvb_dealloc_frontends(f); dvb_unregister_adapter(&f->adapter); } @@ -394,3 +372,31 @@ fail_alloc: return fe; } EXPORT_SYMBOL(videobuf_dvb_alloc_frontend); + +void videobuf_dvb_dealloc_frontends(struct videobuf_dvb_frontends *f) +{ + struct list_head *list, *q; + struct videobuf_dvb_frontend *fe; + + mutex_lock(&f->lock); + list_for_each_safe(list, q, &f->felist) { + fe = list_entry(list, struct videobuf_dvb_frontend, felist); + if (fe->dvb.net.dvbdev) { + dvb_net_release(&fe->dvb.net); + fe->dvb.demux.dmx.remove_frontend(&fe->dvb.demux.dmx, + &fe->dvb.fe_mem); + fe->dvb.demux.dmx.remove_frontend(&fe->dvb.demux.dmx, + &fe->dvb.fe_hw); + dvb_dmxdev_release(&fe->dvb.dmxdev); + dvb_dmx_release(&fe->dvb.demux); + dvb_unregister_frontend(fe->dvb.frontend); + } + if (fe->dvb.frontend) + /* always allocated, may have been reset */ + dvb_frontend_detach(fe->dvb.frontend); + list_del(list); /* remove list entry */ + kfree(fe); /* free frontend allocation */ + } + mutex_unlock(&f->lock); +} +EXPORT_SYMBOL(videobuf_dvb_dealloc_frontends); -- cgit v1.2.3 From 5bc1da174322b87407c811f8cae20235dd6ae4d7 Mon Sep 17 00:00:00 2001 From: "darron@kewl.org" Date: Tue, 21 Oct 2008 15:47:50 +0100 Subject: cx88: always de-alloc frontends on fault condition From: Darron Broad De-alloc frontends on fault condition. Priority: normal Signed-off-by: Darron Broad --- linux/drivers/media/video/cx88/cx88-dvb.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/cx88/cx88-dvb.c b/linux/drivers/media/video/cx88/cx88-dvb.c index 83d006ef1..898ce5ea8 100644 --- a/linux/drivers/media/video/cx88/cx88-dvb.c +++ b/linux/drivers/media/video/cx88/cx88-dvb.c @@ -796,7 +796,7 @@ static int dvb_register(struct cx8802_dev *dev) if (fe0->dvb.frontend) fe0->dvb.frontend->ops.i2c_gate_ctrl = NULL; if (attach_xc3028(0x61, dev) < 0) - return -EINVAL; + goto frontend_detach; break; case CX88_BOARD_PCHDTV_HD3000: fe0->dvb.frontend = dvb_attach(or51132_attach, &pchdtv_hd3000, @@ -1065,7 +1065,6 @@ static int dvb_register(struct cx8802_dev *dev) goto frontend_detach; core->prev_set_voltage = fe0->dvb.frontend->ops.set_voltage; fe0->dvb.frontend->ops.set_voltage = tevii_dvbs_set_voltage; - } } break; @@ -1117,10 +1116,7 @@ static int dvb_register(struct cx8802_dev *dev) &dev->pci->dev, adapter_nr, mfe_shared); frontend_detach: - if (fe0->dvb.frontend) { - dvb_frontend_detach(fe0->dvb.frontend); - fe0->dvb.frontend = NULL; - } + videobuf_dvb_dealloc_frontends(&dev->frontends); return -EINVAL; } -- cgit v1.2.3 From 9bb0976b93978009b15477a0809c54f5e6fe8594 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 21 Oct 2008 12:58:39 -0200 Subject: Remove unused inode parameter from video_ioctl2 From: Mauro Carvalho Chehab inode is never used on video_ioctl2. Remove it and rename the function to __video_ioctl2. This allows its usage directly as a callback at fops.unlocked_ioctl. Since we still need a callback with inode to be used with fops.ioctl, this patch adds video_ioctl2() that is just a call to __video_ioctl2(). Also, this patch adds some comments about video_ioctl2 and __video_ioctl2 usage at v4l2-ioctl.h. Priority: normal Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/ivtv/ivtv-ioctl.c | 2 +- linux/drivers/media/video/v4l2-ioctl.c | 16 ++++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/ivtv/ivtv-ioctl.c b/linux/drivers/media/video/ivtv/ivtv-ioctl.c index 09a75abcb..4bae38d21 100644 --- a/linux/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/linux/drivers/media/video/ivtv/ivtv-ioctl.c @@ -1830,7 +1830,7 @@ static long ivtv_serialized_ioctl(struct ivtv *itv, struct file *filp, if (ivtv_debug & IVTV_DBGFLG_IOCTL) vfd->debug = V4L2_DEBUG_IOCTL | V4L2_DEBUG_IOCTL_ARG; - ret = video_ioctl2_unlocked(filp, cmd, arg); + ret = __video_ioctl2(filp, cmd, arg); vfd->debug = 0; return ret; } diff --git a/linux/drivers/media/video/v4l2-ioctl.c b/linux/drivers/media/video/v4l2-ioctl.c index 301000661..a6f76c960 100644 --- a/linux/drivers/media/video/v4l2-ioctl.c +++ b/linux/drivers/media/video/v4l2-ioctl.c @@ -1769,7 +1769,7 @@ static int __video_do_ioctl(struct file *file, return ret; } -int video_ioctl2(struct inode *inode, struct file *file, +int __video_ioctl2(struct file *file, unsigned int cmd, unsigned long arg) { char sbuf[128]; @@ -1861,15 +1861,11 @@ out: kfree(mbuf); return err; } -EXPORT_SYMBOL(video_ioctl2); +EXPORT_SYMBOL(__video_ioctl2); -long video_ioctl2_unlocked(struct file *file, - unsigned int cmd, unsigned long arg) +int video_ioctl2(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20) - return video_ioctl2(file->f_dentry->d_inode, file, cmd, arg); -#else - return video_ioctl2(file->f_path.dentry->d_inode, file, cmd, arg); -#endif + return __video_ioctl2(file, cmd, arg); } -EXPORT_SYMBOL(video_ioctl2_unlocked); +EXPORT_SYMBOL(video_ioctl2); -- cgit v1.2.3 From 50002dfa8016241804a2e3b31a4605b5fe162d96 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 21 Jul 2008 20:03:34 -0700 Subject: backport commit a9b12619f7b6f19c871437ec24a088787a04b1de From: Mauro Carvalho Chehab Author: Greg Kroah-Hartman device create: misc: convert device_create_drvdata to device_create Now that device_create() has been audited, rename things back to the original call to be sane. kernel-sync: Priority: normal Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/dvb/dvb-core/dvbdev.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/dvb-core/dvbdev.c b/linux/drivers/media/dvb/dvb-core/dvbdev.c index 422af5a0d..c2e824710 100644 --- a/linux/drivers/media/dvb/dvb-core/dvbdev.c +++ b/linux/drivers/media/dvb/dvb-core/dvbdev.c @@ -242,7 +242,11 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, mutex_unlock(&dvbdev_register_lock); -#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 26) +#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 27) + clsdev = device_create(dvb_class, adap->device, + MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), + NULL, "dvb%d.%s%d", adap->num, dnames[type], id); +#elif LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 27) clsdev = device_create_drvdata(dvb_class, adap->device, MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), NULL, "dvb%d.%s%d", adap->num, dnames[type], id); -- cgit v1.2.3 From aa3a71395ad7559f94391984b4c1fd15540cc84e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 18 Oct 2008 20:28:37 -0700 Subject: backport commit 1a651a00e20fd4997f0b91258f6f95b7d96edcd9 From: Mauro Carvalho Chehab Author: Harvey Harrison byteorder: remove direct includes of linux/byteorder/swab[b].h A consolidated implementation will provide this generically through asm/byteorder, remove direct includes to avoid breakage when the changeover to the new implementation occurs. kernel-sync: Priority: normal Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/dvb/ttpci/av7110.c | 5 ++++- linux/drivers/media/video/cx18/cx18-driver.h | 1 + linux/drivers/media/video/ivtv/ivtv-driver.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/ttpci/av7110.c b/linux/drivers/media/dvb/ttpci/av7110.c index bb63e2121..2ef9f030f 100644 --- a/linux/drivers/media/dvb/ttpci/av7110.c +++ b/linux/drivers/media/dvb/ttpci/av7110.c @@ -36,7 +36,6 @@ #include #include #include -#include #include #include @@ -52,6 +51,10 @@ #include #include #include +#include +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27) +#include +#endif #include diff --git a/linux/drivers/media/video/cx18/cx18-driver.h b/linux/drivers/media/video/cx18/cx18-driver.h index fa8be0731..a4b1708fa 100644 --- a/linux/drivers/media/video/cx18/cx18-driver.h +++ b/linux/drivers/media/video/cx18/cx18-driver.h @@ -41,6 +41,7 @@ #include #include #include +#include #include #include diff --git a/linux/drivers/media/video/ivtv/ivtv-driver.h b/linux/drivers/media/video/ivtv/ivtv-driver.h index 5c401fae5..9128df0f3 100644 --- a/linux/drivers/media/video/ivtv/ivtv-driver.h +++ b/linux/drivers/media/video/ivtv/ivtv-driver.h @@ -55,6 +55,7 @@ #include #include #include +#include #include "compat.h" #include -- cgit v1.2.3 From 28112395096dc4e16c80176a29ee15dad1706bc6 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 14 Aug 2008 09:37:34 -0700 Subject: backport commit aa82661baf8a48379355ffa8bf162b07cf487600 From: Mauro Carvalho Chehab Author: Greg Kroah-Hartman USB: remove warn() macro from usb media drivers USB should not be having it's own printk macros, so remove warn() and use the system-wide standard of dev_warn() wherever possible. In the few places that will not work out, use a basic printk(). kernel-sync: Priority: normal Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/radio/dsbr100.c | 13 ++++++++----- linux/drivers/media/video/dabusb.c | 4 ++-- linux/drivers/media/video/ov511.c | 19 ++++++++++++------- linux/drivers/media/video/usbvideo/konicawc.c | 8 +++++--- .../drivers/media/video/usbvideo/quickcam_messenger.c | 14 ++++++++------ 5 files changed, 35 insertions(+), 23 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/radio/dsbr100.c b/linux/drivers/media/radio/dsbr100.c index 71836beea..752478fad 100644 --- a/linux/drivers/media/radio/dsbr100.c +++ b/linux/drivers/media/radio/dsbr100.c @@ -311,7 +311,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, radio->curfreq = f->frequency; if (dsbr100_setfreq(radio, radio->curfreq) == -1) - warn("Set frequency failed"); + dev_warn(&radio->usbdev->dev, "Set frequency failed\n"); return 0; } @@ -361,12 +361,14 @@ static int vidioc_s_ctrl(struct file *file, void *priv, case V4L2_CID_AUDIO_MUTE: if (ctrl->value) { if (dsbr100_stop(radio) == -1) { - warn("Radio did not respond properly"); + dev_warn(&radio->usbdev->dev, + "Radio did not respond properly\n"); return -EBUSY; } } else { if (dsbr100_start(radio) == -1) { - warn("Radio did not respond properly"); + dev_warn(&radio->usbdev->dev, + "Radio did not respond properly\n"); return -EBUSY; } } @@ -417,7 +419,8 @@ static int usb_dsbr100_open(struct inode *inode, struct file *file) radio->muted = 1; if (dsbr100_start(radio) < 0) { - warn("Radio did not start up properly"); + dev_warn(&radio->usbdev->dev, + "Radio did not start up properly\n"); radio->users = 0; unlock_kernel(); return -EIO; @@ -514,7 +517,7 @@ static int usb_dsbr100_probe(struct usb_interface *intf, radio->curfreq = FREQ_MIN * FREQ_MUL; video_set_drvdata(radio->videodev, radio); if (video_register_device(radio->videodev, VFL_TYPE_RADIO, radio_nr) < 0) { - warn("Could not register video device"); + dev_warn(&intf->dev, "Could not register video device\n"); video_device_release(radio->videodev); kfree(radio->transfer_buffer); kfree(radio); diff --git a/linux/drivers/media/video/dabusb.c b/linux/drivers/media/video/dabusb.c index 21280dbc3..7ba206b34 100644 --- a/linux/drivers/media/video/dabusb.c +++ b/linux/drivers/media/video/dabusb.c @@ -202,7 +202,7 @@ static void dabusb_iso_complete (struct urb *purb) err("dabusb_iso_complete: invalid len %d", len); } else - warn("dabusb_iso_complete: corrupted packet status: %d", purb->iso_frame_desc[i].status); + dev_warn(&purb->dev->dev, "dabusb_iso_complete: corrupted packet status: %d\n", purb->iso_frame_desc[i].status); if (dst != purb->actual_length) err("dst!=purb->actual_length:%d!=%d", dst, purb->actual_length); } @@ -299,7 +299,7 @@ static int dabusb_bulk (pdabusb_t s, pbulk_transfer_t pb) } if( ret == -EPIPE ) { - warn("CLEAR_FEATURE request to remove STALL condition."); + dev_warn(&s->usbdev->dev, "CLEAR_FEATURE request to remove STALL condition.\n"); if(usb_clear_halt(s->usbdev, usb_pipeendpoint(pipe))) err("request failed"); } diff --git a/linux/drivers/media/video/ov511.c b/linux/drivers/media/video/ov511.c index 9a5662024..00d5370c9 100644 --- a/linux/drivers/media/video/ov511.c +++ b/linux/drivers/media/video/ov511.c @@ -1098,9 +1098,10 @@ ov51x_clear_snapshot(struct usb_ov511 *ov) reg_w(ov, R51x_SYS_SNAP, 0x02); reg_w(ov, R51x_SYS_SNAP, 0x00); } else if (ov->bclass == BCL_OV518) { - warn("snapshot reset not supported yet on OV518(+)"); + dev_warn(&ov->dev->dev, + "snapshot reset not supported yet on OV518(+)\n"); } else { - err("clear snap: invalid bridge type"); + dev_err(&ov->dev->dev, "clear snap: invalid bridge type\n"); } } @@ -1115,14 +1116,16 @@ ov51x_check_snapshot(struct usb_ov511 *ov) if (ov->bclass == BCL_OV511) { ret = reg_r(ov, R51x_SYS_SNAP); if (ret < 0) { - err("Error checking snspshot status (%d)", ret); + dev_err(&ov->dev->dev, + "Error checking snspshot status (%d)\n", ret); } else if (ret & 0x08) { status = 1; } } else if (ov->bclass == BCL_OV518) { - warn("snapshot check not supported yet on OV518(+)"); + dev_warn(&ov->dev->dev, + "snapshot check not supported yet on OV518(+)\n"); } else { - err("check snap: invalid bridge type"); + dev_err(&ov->dev->dev, "clear snap: invalid bridge type\n"); } return status; @@ -5221,7 +5224,8 @@ saa7111a_configure(struct usb_ov511 *ov) if (ov->bclass == BCL_OV511) reg_w(ov, 0x11, 0x00); else - warn("SAA7111A not yet supported with OV518/OV518+"); + dev_warn(&ov->dev->dev, + "SAA7111A not yet supported with OV518/OV518+\n"); return 0; } @@ -5460,7 +5464,8 @@ ov518_configure(struct usb_ov511 *ov) * required. OV518 has no uncompressed mode, to save RAM. */ if (!dumppix && !ov->compress) { ov->compress = 1; - warn("Compression required with OV518...enabling"); + dev_warn(&ov->dev->dev, + "Compression required with OV518...enabling\n"); } if (ov->bridge == BRG_OV518) { diff --git a/linux/drivers/media/video/usbvideo/konicawc.c b/linux/drivers/media/video/usbvideo/konicawc.c index 5c11ea64c..73abbb3f4 100644 --- a/linux/drivers/media/video/usbvideo/konicawc.c +++ b/linux/drivers/media/video/usbvideo/konicawc.c @@ -234,7 +234,8 @@ static void konicawc_register_input(struct konicawc *cam, struct usb_device *dev cam->input = input_dev = input_allocate_device(); if (!input_dev) { - warn("Not enough memory for camera's input device\n"); + dev_warn(&dev->dev, + "Not enough memory for camera's input device\n"); return; } @@ -252,8 +253,9 @@ static void konicawc_register_input(struct konicawc *cam, struct usb_device *dev error = input_register_device(cam->input); if (error) { - warn("Failed to register camera's input device, err: %d\n", - error); + dev_warn(&dev->dev, + "Failed to register camera's input device, err: %d\n", + error); input_free_device(cam->input); cam->input = NULL; } diff --git a/linux/drivers/media/video/usbvideo/quickcam_messenger.c b/linux/drivers/media/video/usbvideo/quickcam_messenger.c index 2f7274aba..d363e3d64 100644 --- a/linux/drivers/media/video/usbvideo/quickcam_messenger.c +++ b/linux/drivers/media/video/usbvideo/quickcam_messenger.c @@ -98,7 +98,7 @@ static void qcm_register_input(struct qcm *cam, struct usb_device *dev) cam->input = input_dev = input_allocate_device(); if (!input_dev) { - warn("insufficient mem for cam input device"); + dev_warn(&dev->dev, "insufficient mem for cam input device\n"); return; } @@ -116,8 +116,9 @@ static void qcm_register_input(struct qcm *cam, struct usb_device *dev) error = input_register_device(cam->input); if (error) { - warn("Failed to register camera's input device, err: %d\n", - error); + dev_warn(&dev->dev, + "Failed to register camera's input device, err: %d\n", + error); input_free_device(cam->input); cam->input = NULL; } @@ -600,8 +601,9 @@ static int qcm_compress_iso(struct uvd *uvd, struct urb *dataurb) dataurb->iso_frame_desc[i].offset; if (st < 0) { - warn("Data error: packet=%d. len=%d. status=%d.", - i, n, st); + dev_warn(&uvd->dev->dev, + "Data error: packet=%d. len=%d. status=%d.\n", + i, n, st); uvd->stats.iso_err_count++; continue; } @@ -716,7 +718,7 @@ static void qcm_stop_data(struct uvd *uvd) ret = qcm_camera_off(uvd); if (ret) - warn("couldn't turn the cam off."); + dev_warn(&uvd->dev->dev, "couldn't turn the cam off.\n"); uvd->streaming = 0; -- cgit v1.2.3 From defa3edd60084d83303b9d17251493ad3da486c8 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 3 Sep 2008 09:49:20 +0100 Subject: backport commit aa7a7fb3990ffc74945494cbd2fc6e920825ee2c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Mauro Carvalho Chehab Author: David Woodhouse Define and use PCI_DEVICE_ID_MARVELL_88ALP01_CCIC for CAFÉ camera driver Also, stop looking at the NAND controller (0x4100) and checking the device class. For a while during development, all three functions on the chip had the same ID. We made them fix that fairly promptly, and we can forget about it now. Priority: normal Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/cafe_ccic.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/cafe_ccic.c b/linux/drivers/media/video/cafe_ccic.c index 1c41a4aea..6aba16f85 100644 --- a/linux/drivers/media/video/cafe_ccic.c +++ b/linux/drivers/media/video/cafe_ccic.c @@ -2103,15 +2103,8 @@ static int cafe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { int ret; - u16 classword; struct cafe_camera *cam; - /* - * Make sure we have a camera here - we'll get calls for - * the other cafe devices as well. - */ - pci_read_config_word(pdev, PCI_CLASS_DEVICE, &classword); - if (classword != PCI_CLASS_MULTIMEDIA_VIDEO) - return -ENODEV; + /* * Start putting together one of our big camera structures. */ @@ -2299,8 +2292,8 @@ static int cafe_pci_resume(struct pci_dev *pdev) static struct pci_device_id cafe_ids[] = { - { PCI_DEVICE(0x11ab, 0x4100) }, /* Eventual real ID */ - { PCI_DEVICE(0x11ab, 0x4102) }, /* Really eventual real ID */ + { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, + PCI_DEVICE_ID_MARVELL_88ALP01_CCIC) }, { 0, } }; -- cgit v1.2.3 From b50efdd812a5a18fb6f53e3229c7ea6e893e313d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 14 Oct 2008 12:20:48 +0000 Subject: zoran: Drop redundant printk From: Jean Delvare There's no point in logging two messages for the same error. Signed-off-by: Jean Delvare Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/zoran/zoran_driver.c | 1 - 1 file changed, 1 deletion(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/zoran/zoran_driver.c b/linux/drivers/media/video/zoran/zoran_driver.c index 9d57a630c..c2112e950 100644 --- a/linux/drivers/media/video/zoran/zoran_driver.c +++ b/linux/drivers/media/video/zoran/zoran_driver.c @@ -3061,7 +3061,6 @@ zoran_do_ioctl (struct inode *inode, break; default: - dprintk(3, "unsupported\n"); dprintk(1, KERN_ERR "%s: VIDIOC_S_FMT - unsupported type %d\n", -- cgit v1.2.3 From 77bb838365e9f6c70eabd358af6a365480ad3108 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 14 Oct 2008 15:46:59 +0000 Subject: Precalculate vivi yuv values From: Magnus Damm This patch improves the color space conversion code in vivi.c to directly draw with precalculated YUV values as palette instead of drawing with YUV that is calculated from RGB for every two pixels. This way we eliminate the need for 9 multiplications every two pixels. A side effect of this patch is that the time counter is changed from green text on black background to white text on black background. Signed-off-by: Magnus Damm Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/vivi.c | 117 +++++++++++++++++++-------------------- 1 file changed, 58 insertions(+), 59 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/vivi.c b/linux/drivers/media/video/vivi.c index f6a12b184..4eadd9982 100644 --- a/linux/drivers/media/video/vivi.c +++ b/linux/drivers/media/video/vivi.c @@ -193,6 +193,7 @@ struct vivi_fh { struct videobuf_queue vb_vidq; enum v4l2_buf_type type; + unsigned char bars[8][3]; }; /* ------------------------------------------------------------------ @@ -237,13 +238,41 @@ static u8 bars[8][3] = { #define TSTAMP_MAX_Y TSTAMP_MIN_Y+15 #define TSTAMP_MIN_X 64 -static void gen_line(char *basep, int inipos, int wmax, +static void gen_twopix(struct vivi_fh *fh, unsigned char *buf, int colorpos) +{ + unsigned char r_y, g_u, b_v; + unsigned char *p; + int color; + + r_y = fh->bars[colorpos][0]; /* R or precalculated Y */ + g_u = fh->bars[colorpos][1]; /* G or precalculated U */ + b_v = fh->bars[colorpos][2]; /* B or precalculated V */ + + for (color = 0; color < 4; color++) { + p = buf + color; + + switch (color) { + case 0: + case 2: + *p = r_y; + break; + case 1: + *p = g_u; + break; + case 3: + *p = b_v; + break; + } + } +} + +static void gen_line(struct vivi_fh *fh, char *basep, int inipos, int wmax, int hmax, int line, int count, char *timestr) { - int w, i, j, y; + int w, i, j; int pos = inipos; - char *p, *s; - u8 chr, r, g, b, color; + char *s; + u8 chr; /* We will just duplicate the second pixel at the packet */ wmax /= 2; @@ -251,27 +280,9 @@ static void gen_line(char *basep, int inipos, int wmax, /* Generate a standard color bar pattern */ for (w = 0; w < wmax; w++) { int colorpos = ((w + count) * 8/(wmax + 1)) % 8; - r = bars[colorpos][0]; - g = bars[colorpos][1]; - b = bars[colorpos][2]; - - for (color = 0; color < 4; color++) { - p = basep + pos; - - switch (color) { - case 0: - case 2: - *p = TO_Y(r, g, b); /* Luma */ - break; - case 1: - *p = TO_U(r, g, b); /* Cb */ - break; - case 3: - *p = TO_V(r, g, b); /* Cr */ - break; - } - pos++; - } + + gen_twopix(fh, basep + pos, colorpos); + pos += 4; /* only 16 bpp supported for now */ } /* Checks if it is possible to show timestamp */ @@ -286,38 +297,12 @@ static void gen_line(char *basep, int inipos, int wmax, for (s = timestr; *s; s++) { chr = rom8x16_bits[(*s-0x30)*16+line-TSTAMP_MIN_Y]; for (i = 0; i < 7; i++) { - if (chr & 1 << (7 - i)) { - /* Font color*/ - r = 0; - g = 198; - b = 0; - } else { - /* Background color */ - r = bars[BLACK][0]; - g = bars[BLACK][1]; - b = bars[BLACK][2]; - } - pos = inipos + j * 2; - for (color = 0; color < 4; color++) { - p = basep + pos; - - y = TO_Y(r, g, b); - - switch (color) { - case 0: - case 2: - *p = TO_Y(r, g, b); /* Luma */ - break; - case 1: - *p = TO_U(r, g, b); /* Cb */ - break; - case 3: - *p = TO_V(r, g, b); /* Cr */ - break; - } - pos++; - } + /* Draw white font on black background */ + if (chr & 1 << (7 - i)) + gen_twopix(fh, basep + pos, WHITE); + else + gen_twopix(fh, basep + pos, BLACK); j++; } } @@ -327,8 +312,9 @@ end: return; } -static void vivi_fillbuff(struct vivi_dev *dev, struct vivi_buffer *buf) +static void vivi_fillbuff(struct vivi_fh *fh, struct vivi_buffer *buf) { + struct vivi_dev *dev = fh->dev; int h , pos = 0; int hmax = buf->vb.height; int wmax = buf->vb.width; @@ -344,7 +330,7 @@ static void vivi_fillbuff(struct vivi_dev *dev, struct vivi_buffer *buf) return; for (h = 0; h < hmax; h++) { - gen_line(tmpbuf, 0, wmax, hmax, h, dev->mv_count, + gen_line(fh, tmpbuf, 0, wmax, hmax, h, dev->mv_count, dev->timestr); memcpy(vbuf + pos, tmpbuf, wmax * 2); pos += wmax*2; @@ -413,7 +399,7 @@ static void vivi_thread_tick(struct vivi_fh *fh) do_gettimeofday(&buf->vb.ts); /* Fill buffer */ - vivi_fillbuff(dev, buf); + vivi_fillbuff(fh, buf); dprintk(dev, 1, "filled buffer %p\n", buf); wake_up(&buf->vb.done); @@ -717,6 +703,8 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, { struct vivi_fh *fh = priv; struct videobuf_queue *q = &fh->vb_vidq; + unsigned char r, g, b; + int k; int ret = vidioc_try_fmt_vid_cap(file, fh, f); if (ret < 0) @@ -736,6 +724,17 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, fh->vb_vidq.field = f->fmt.pix.field; fh->type = f->type; + /* precalculate color bar values to speed up rendering */ + for (k = 0; k < 8; k++) { + r = bars[k][0]; + g = bars[k][1]; + b = bars[k][2]; + + fh->bars[k][0] = TO_Y(r, g, b); /* Luma */ + fh->bars[k][1] = TO_U(r, g, b); /* Cb */ + fh->bars[k][2] = TO_V(r, g, b); /* Cr */ + } + ret = 0; out: mutex_unlock(&q->vb_lock); -- cgit v1.2.3 From fab6e0e98e9f4237c1fee25032b28158ead2383c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 14 Oct 2008 15:47:09 +0000 Subject: Teach vivi about multiple pixel formats From: Magnus Damm This patch contains the ground work to add support for multiple pixel formats to vivi.c Signed-off-by: Magnus Damm Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/vivi.c | 97 +++++++++++++++++++++++++++------------- 1 file changed, 67 insertions(+), 30 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/vivi.c b/linux/drivers/media/video/vivi.c index 4eadd9982..df558c51f 100644 --- a/linux/drivers/media/video/vivi.c +++ b/linux/drivers/media/video/vivi.c @@ -131,12 +131,31 @@ struct vivi_fmt { int depth; }; -static struct vivi_fmt format = { - .name = "4:2:2, packed, YUYV", - .fourcc = V4L2_PIX_FMT_YUYV, - .depth = 16, +static struct vivi_fmt formats[] = { + { + .name = "4:2:2, packed, YUYV", + .fourcc = V4L2_PIX_FMT_YUYV, + .depth = 16, + }, }; +static struct vivi_fmt *get_format(struct v4l2_format *f) +{ + struct vivi_fmt *fmt; + unsigned int k; + + for (k = 0; k < ARRAY_SIZE(formats); k++) { + fmt = &formats[k]; + if (fmt->fourcc == f->fmt.pix.pixelformat) + break; + } + + if (k == ARRAY_SIZE(formats)) + return NULL; + + return &formats[k]; +} + struct sg_to_addr { int pos; struct scatterlist *sg; @@ -251,16 +270,20 @@ static void gen_twopix(struct vivi_fh *fh, unsigned char *buf, int colorpos) for (color = 0; color < 4; color++) { p = buf + color; - switch (color) { - case 0: - case 2: - *p = r_y; - break; - case 1: - *p = g_u; - break; - case 3: - *p = b_v; + switch (fh->fmt->fourcc) { + case V4L2_PIX_FMT_YUYV: + switch (color) { + case 0: + case 2: + *p = r_y; + break; + case 1: + *p = g_u; + break; + case 3: + *p = b_v; + break; + } break; } } @@ -625,11 +648,15 @@ static int vidioc_querycap(struct file *file, void *priv, static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, struct v4l2_fmtdesc *f) { - if (f->index > 0) + struct vivi_fmt *fmt; + + if (f->index >= ARRAY_SIZE(formats)) return -EINVAL; - strlcpy(f->description, format.name, sizeof(f->description)); - f->pixelformat = format.fourcc; + fmt = &formats[f->index]; + + strlcpy(f->description, fmt->name, sizeof(f->description)); + f->pixelformat = fmt->fourcc; return 0; } @@ -659,13 +686,12 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, enum v4l2_field field; unsigned int maxw, maxh; - if (format.fourcc != f->fmt.pix.pixelformat) { - dprintk(dev, 1, "Fourcc format (0x%08x) invalid. " - "Driver accepts only 0x%08x\n", - f->fmt.pix.pixelformat, format.fourcc); + fmt = get_format(f); + if (!fmt) { + dprintk(dev, 1, "Fourcc format (0x%08x) invalid.\n", + f->fmt.pix.pixelformat); return -EINVAL; } - fmt = &format; field = f->fmt.pix.field; @@ -704,7 +730,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, struct vivi_fh *fh = priv; struct videobuf_queue *q = &fh->vb_vidq; unsigned char r, g, b; - int k; + int k, is_yuv; int ret = vidioc_try_fmt_vid_cap(file, fh, f); if (ret < 0) @@ -718,7 +744,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, goto out; } - fh->fmt = &format; + fh->fmt = get_format(f); fh->width = f->fmt.pix.width; fh->height = f->fmt.pix.height; fh->vb_vidq.field = f->fmt.pix.field; @@ -729,10 +755,23 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, r = bars[k][0]; g = bars[k][1]; b = bars[k][2]; + is_yuv = 0; - fh->bars[k][0] = TO_Y(r, g, b); /* Luma */ - fh->bars[k][1] = TO_U(r, g, b); /* Cb */ - fh->bars[k][2] = TO_V(r, g, b); /* Cr */ + switch (fh->fmt->fourcc) { + case V4L2_PIX_FMT_YUYV: + is_yuv = 1; + break; + } + + if (is_yuv) { + fh->bars[k][0] = TO_Y(r, g, b); /* Luma */ + fh->bars[k][1] = TO_U(r, g, b); /* Cb */ + fh->bars[k][2] = TO_V(r, g, b); /* Cr */ + } else { + fh->bars[k][0] = r; + fh->bars[k][1] = g; + fh->bars[k][2] = b; + } } ret = 0; @@ -888,8 +927,6 @@ static int vidioc_s_ctrl(struct file *file, void *priv, File operations for the device ------------------------------------------------------------------*/ -#define line_buf_size(norm) (norm_maxw(norm)*(format.depth+7)/8) - static int vivi_open(struct inode *inode, struct file *file) { int minor = iminor(inode); @@ -938,7 +975,7 @@ unlock: fh->dev = dev; fh->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - fh->fmt = &format; + fh->fmt = &formats[0]; fh->width = 640; fh->height = 480; -- cgit v1.2.3 From 365109dcd86d8e5f257bb1c2312255e0dcea0d89 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 14 Oct 2008 15:47:25 +0000 Subject: Add uyvy pixel format support to vivi From: Magnus Damm This patch simply adds UYVY pixel format support to the vivi driver. Signed-off-by: Magnus Damm Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/vivi.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/vivi.c b/linux/drivers/media/video/vivi.c index df558c51f..ec6c971d8 100644 --- a/linux/drivers/media/video/vivi.c +++ b/linux/drivers/media/video/vivi.c @@ -137,6 +137,11 @@ static struct vivi_fmt formats[] = { .fourcc = V4L2_PIX_FMT_YUYV, .depth = 16, }, + { + .name = "4:2:2, packed, UYVY", + .fourcc = V4L2_PIX_FMT_UYVY, + .depth = 16, + }, }; static struct vivi_fmt *get_format(struct v4l2_format *f) @@ -285,6 +290,20 @@ static void gen_twopix(struct vivi_fh *fh, unsigned char *buf, int colorpos) break; } break; + case V4L2_PIX_FMT_UYVY: + switch (color) { + case 1: + case 3: + *p = r_y; + break; + case 0: + *p = g_u; + break; + case 2: + *p = b_v; + break; + } + break; } } } @@ -759,6 +778,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, switch (fh->fmt->fourcc) { case V4L2_PIX_FMT_YUYV: + case V4L2_PIX_FMT_UYVY: is_yuv = 1; break; } -- cgit v1.2.3 From df0d94ddb68d94430e1b5489d37eebda90a510fa Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 14 Oct 2008 15:47:35 +0000 Subject: Add support for rgb565 pixel formats to vivi From: Magnus Damm This patch adds RGB565 pixel format support to the vivi driver. Both little endian and big endian versions are added. The driver follows the RGB pixel format described in Table 2-2 of the V4L2 API spec, _not_ the older BGR interpretation described in Table 2-1. Signed-off-by: Magnus Damm Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/vivi.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/vivi.c b/linux/drivers/media/video/vivi.c index ec6c971d8..c1aa35ddc 100644 --- a/linux/drivers/media/video/vivi.c +++ b/linux/drivers/media/video/vivi.c @@ -142,6 +142,16 @@ static struct vivi_fmt formats[] = { .fourcc = V4L2_PIX_FMT_UYVY, .depth = 16, }, + { + .name = "RGB565 (LE)", + .fourcc = V4L2_PIX_FMT_RGB565, /* gggbbbbb rrrrrggg */ + .depth = 16, + }, + { + .name = "RGB565 (BE)", + .fourcc = V4L2_PIX_FMT_RGB565X, /* rrrrrggg gggbbbbb */ + .depth = 16, + }, }; static struct vivi_fmt *get_format(struct v4l2_format *f) @@ -304,6 +314,30 @@ static void gen_twopix(struct vivi_fh *fh, unsigned char *buf, int colorpos) break; } break; + case V4L2_PIX_FMT_RGB565: + switch (color) { + case 0: + case 2: + *p = (g_u << 5) | b_v; + break; + case 1: + case 3: + *p = (r_y << 3) | (g_u >> 3); + break; + } + break; + case V4L2_PIX_FMT_RGB565X: + switch (color) { + case 0: + case 2: + *p = (r_y << 3) | (g_u >> 3); + break; + case 1: + case 3: + *p = (g_u << 5) | b_v; + break; + } + break; } } } @@ -781,6 +815,12 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, case V4L2_PIX_FMT_UYVY: is_yuv = 1; break; + case V4L2_PIX_FMT_RGB565: + case V4L2_PIX_FMT_RGB565X: + r >>= 3; + g >>= 2; + b >>= 3; + break; } if (is_yuv) { -- cgit v1.2.3 From 361a7671a045c53ee8e1d5367bc2b1ebbbc757d5 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 14 Oct 2008 15:47:43 +0000 Subject: Add support for rgb555 pixel formats to vivi From: Magnus Damm This patch adds RGB555 pixel format support to the vivi driver. Both little endian and big endian versions are added. The driver follows the RGB pixel format described in Table 2-2 of the V4L2 API spec, _not_ the older BGR interpretation described in Table 2-1. Signed-off-by: Magnus Damm Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/vivi.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/vivi.c b/linux/drivers/media/video/vivi.c index c1aa35ddc..863024acc 100644 --- a/linux/drivers/media/video/vivi.c +++ b/linux/drivers/media/video/vivi.c @@ -152,6 +152,16 @@ static struct vivi_fmt formats[] = { .fourcc = V4L2_PIX_FMT_RGB565X, /* rrrrrggg gggbbbbb */ .depth = 16, }, + { + .name = "RGB555 (LE)", + .fourcc = V4L2_PIX_FMT_RGB555, /* gggbbbbb arrrrrgg */ + .depth = 16, + }, + { + .name = "RGB555 (BE)", + .fourcc = V4L2_PIX_FMT_RGB555X, /* arrrrrgg gggbbbbb */ + .depth = 16, + }, }; static struct vivi_fmt *get_format(struct v4l2_format *f) @@ -338,6 +348,30 @@ static void gen_twopix(struct vivi_fh *fh, unsigned char *buf, int colorpos) break; } break; + case V4L2_PIX_FMT_RGB555: + switch (color) { + case 0: + case 2: + *p = (g_u << 5) | b_v; + break; + case 1: + case 3: + *p = (r_y << 2) | (g_u >> 3); + break; + } + break; + case V4L2_PIX_FMT_RGB555X: + switch (color) { + case 0: + case 2: + *p = (r_y << 2) | (g_u >> 3); + break; + case 1: + case 3: + *p = (g_u << 5) | b_v; + break; + } + break; } } } @@ -821,6 +855,12 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, g >>= 2; b >>= 3; break; + case V4L2_PIX_FMT_RGB555: + case V4L2_PIX_FMT_RGB555X: + r >>= 3; + g >>= 3; + b >>= 3; + break; } if (is_yuv) { -- cgit v1.2.3 From 2f1835af8f95aeed8b722b47fcb6a70651f6e1a2 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 15 Oct 2008 17:47:36 +0000 Subject: saa7127: Fix two typos From: Jean Delvare Signed-off-by: Jean Delvare Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/saa7127.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/saa7127.c b/linux/drivers/media/video/saa7127.c index 0b126a849..fd7d15305 100644 --- a/linux/drivers/media/video/saa7127.c +++ b/linux/drivers/media/video/saa7127.c @@ -29,7 +29,7 @@ * Note: the saa7126 is identical to the saa7127, and the saa7128 is * identical to the saa7129, except that the saa7126 and saa7128 have * macrovision anti-taping support. This driver will almost certainly - * work find for those chips, except of course for the missing anti-taping + * work fine for those chips, except of course for the missing anti-taping * support. * * This program is free software; you can redistribute it and/or modify -- cgit v1.2.3 From 704a7ec5589888e2b165613d05c462b9b360e241 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Wed, 15 Oct 2008 16:00:31 -0400 Subject: au0828: add support for another USB id for Hauppauge HVR950Q From: Michael Krufky Add autodetection support for a new revision of the Hauppauge HVR950Q (2040:721e) Priority: high Signed-off-by: Michael Krufky --- linux/drivers/media/video/au0828/au0828-cards.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/au0828/au0828-cards.c b/linux/drivers/media/video/au0828/au0828-cards.c index 5f07a8a07..66e0edd58 100644 --- a/linux/drivers/media/video/au0828/au0828-cards.c +++ b/linux/drivers/media/video/au0828/au0828-cards.c @@ -90,6 +90,7 @@ static void hauppauge_eeprom(struct au0828_dev *dev, u8 *eeprom_data) case 72221: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and basic analog video */ case 72231: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and basic analog video */ case 72241: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM and basic analog video */ + case 72251: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and basic analog video */ case 72301: /* WinTV-HVR850 (Retail, IR, ATSC and basic analog video */ case 72500: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM */ break; @@ -198,6 +199,8 @@ struct usb_device_id au0828_usb_id_table [] = { .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q }, { USB_DEVICE(0x2040, 0x721b), .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q }, + { USB_DEVICE(0x2040, 0x721e), + .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q }, { USB_DEVICE(0x2040, 0x721f), .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q }, { USB_DEVICE(0x2040, 0x7280), -- cgit v1.2.3 From 14db198f2e10236768bd1e8f685e7d65880ca406 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Wed, 15 Oct 2008 16:05:34 -0400 Subject: sms1xxx: support two new revisions of the Hauppauge WinTV MiniStick From: Michael Krufky Autodetect 2040:5520 and 2040:5530 as Hauppauge WinTV MiniStick Priority: high Signed-off-by: Michael Krufky --- linux/drivers/media/dvb/siano/sms-cards.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/siano/sms-cards.c b/linux/drivers/media/dvb/siano/sms-cards.c index 9da260fe3..6f9b77360 100644 --- a/linux/drivers/media/dvb/siano/sms-cards.c +++ b/linux/drivers/media/dvb/siano/sms-cards.c @@ -42,6 +42,10 @@ struct usb_device_id smsusb_id_table[] = { .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, { USB_DEVICE(0x2040, 0x5510), .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, + { USB_DEVICE(0x2040, 0x5520), + .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, + { USB_DEVICE(0x2040, 0x5530), + .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, { USB_DEVICE(0x2040, 0x5580), .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, { USB_DEVICE(0x2040, 0x5590), -- cgit v1.2.3 From ed4d56c859ac68c4480862375d42f62cc9cff38e Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 17 Oct 2008 00:49:27 +0200 Subject: soc-camera: move sensor power management to soc_camera_platform.c Switching sensors on and off is now done by sensor drivers themselves, typically using platform-provided hooks. Update soc_camera_platform.c to do the same. Also remove a refundant struct soc_camera_platform_info definition from soc_camera_platform.c. Signed-off-by: Guennadi Liakhovetski Tested-by: Magnus Damm --- linux/drivers/media/video/soc_camera_platform.c | 20 +++++++++++--------- linux/include/media/soc_camera_platform.h | 1 + 2 files changed, 12 insertions(+), 9 deletions(-) --- linux/drivers/media/video/soc_camera_platform.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/soc_camera_platform.c b/linux/drivers/media/video/soc_camera_platform.c index 1adc257eb..bb7a9d480 100644 --- a/linux/drivers/media/video/soc_camera_platform.c +++ b/linux/drivers/media/video/soc_camera_platform.c @@ -18,15 +18,7 @@ #include #include #include - -struct soc_camera_platform_info { - int iface; - char *format_name; - unsigned long format_depth; - struct v4l2_pix_format format; - unsigned long bus_param; - int (*set_capture)(struct soc_camera_platform_info *info, int enable); -}; +#include struct soc_camera_platform_priv { struct soc_camera_platform_info *info; @@ -44,11 +36,21 @@ soc_camera_platform_get_info(struct soc_camera_device *icd) static int soc_camera_platform_init(struct soc_camera_device *icd) { + struct soc_camera_platform_info *p = soc_camera_platform_get_info(icd); + + if (p->power) + p->power(1); + return 0; } static int soc_camera_platform_release(struct soc_camera_device *icd) { + struct soc_camera_platform_info *p = soc_camera_platform_get_info(icd); + + if (p->power) + p->power(0); + return 0; } -- cgit v1.2.3 From 6c31b2fae9c989d653488d48bd1eb6ee9fbdf505 Mon Sep 17 00:00:00 2001 From: Magnus Damm Date: Fri, 17 Oct 2008 00:50:22 +0200 Subject: video: add sh_mobile_ceu comments This patch adds CEU hardware block comments to the sh_mobile_ceu driver. Signed-off-by: Magnus Damm Signed-off-by: Guennadi Liakhovetski --- linux/drivers/media/video/sh_mobile_ceu_camera.c | 79 ++++++++++++++++------------ 1 files changed, 46 insertions(+), 33 deletions(-) --- linux/drivers/media/video/sh_mobile_ceu_camera.c | 79 ++++++++++++++---------- 1 file changed, 46 insertions(+), 33 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/sh_mobile_ceu_camera.c b/linux/drivers/media/video/sh_mobile_ceu_camera.c index 76838091d..7a7268c43 100644 --- a/linux/drivers/media/video/sh_mobile_ceu_camera.c +++ b/linux/drivers/media/video/sh_mobile_ceu_camera.c @@ -40,39 +40,39 @@ /* register offsets for sh7722 / sh7723 */ -#define CAPSR 0x00 -#define CAPCR 0x04 -#define CAMCR 0x08 -#define CMCYR 0x0c -#define CAMOR 0x10 -#define CAPWR 0x14 -#define CAIFR 0x18 -#define CSTCR 0x20 /* not on sh7723 */ -#define CSECR 0x24 /* not on sh7723 */ -#define CRCNTR 0x28 -#define CRCMPR 0x2c -#define CFLCR 0x30 -#define CFSZR 0x34 -#define CDWDR 0x38 -#define CDAYR 0x3c -#define CDACR 0x40 -#define CDBYR 0x44 -#define CDBCR 0x48 -#define CBDSR 0x4c -#define CFWCR 0x5c -#define CLFCR 0x60 -#define CDOCR 0x64 -#define CDDCR 0x68 -#define CDDAR 0x6c -#define CEIER 0x70 -#define CETCR 0x74 -#define CSTSR 0x7c -#define CSRTR 0x80 -#define CDSSR 0x84 -#define CDAYR2 0x90 -#define CDACR2 0x94 -#define CDBYR2 0x98 -#define CDBCR2 0x9c +#define CAPSR 0x00 /* Capture start register */ +#define CAPCR 0x04 /* Capture control register */ +#define CAMCR 0x08 /* Capture interface control register */ +#define CMCYR 0x0c /* Capture interface cycle register */ +#define CAMOR 0x10 /* Capture interface offset register */ +#define CAPWR 0x14 /* Capture interface width register */ +#define CAIFR 0x18 /* Capture interface input format register */ +#define CSTCR 0x20 /* Camera strobe control register (<= sh7722) */ +#define CSECR 0x24 /* Camera strobe emission count register (<= sh7722) */ +#define CRCNTR 0x28 /* CEU register control register */ +#define CRCMPR 0x2c /* CEU register forcible control register */ +#define CFLCR 0x30 /* Capture filter control register */ +#define CFSZR 0x34 /* Capture filter size clip register */ +#define CDWDR 0x38 /* Capture destination width register */ +#define CDAYR 0x3c /* Capture data address Y register */ +#define CDACR 0x40 /* Capture data address C register */ +#define CDBYR 0x44 /* Capture data bottom-field address Y register */ +#define CDBCR 0x48 /* Capture data bottom-field address C register */ +#define CBDSR 0x4c /* Capture bundle destination size register */ +#define CFWCR 0x5c /* Firewall operation control register */ +#define CLFCR 0x60 /* Capture low-pass filter control register */ +#define CDOCR 0x64 /* Capture data output control register */ +#define CDDCR 0x68 /* Capture data complexity level register */ +#define CDDAR 0x6c /* Capture data complexity level address register */ +#define CEIER 0x70 /* Capture event interrupt enable register */ +#define CETCR 0x74 /* Capture event flag clear register */ +#define CSTSR 0x7c /* Capture status register */ +#define CSRTR 0x80 /* Capture software reset register */ +#define CDSSR 0x84 /* Capture data size register */ +#define CDAYR2 0x90 /* Capture data address Y register 2 */ +#define CDACR2 0x94 /* Capture data address C register 2 */ +#define CDBYR2 0x98 /* Capture data bottom-field address Y register 2 */ +#define CDBCR2 0x9c /* Capture data bottom-field address C register 2 */ static DEFINE_MUTEX(camera_lock); @@ -391,6 +391,19 @@ static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd, ceu_write(pcdev, CFLCR, 0); /* data fetch mode - no scaling */ ceu_write(pcdev, CFSZR, (icd->height << 16) | cfszr_width); ceu_write(pcdev, CLFCR, 0); /* data fetch mode - no lowpass filter */ + + /* A few words about byte order (observed in Big Endian mode) + * + * In data fetch mode bytes are received in chunks of 8 bytes. + * D0, D1, D2, D3, D4, D5, D6, D7 (D0 received first) + * + * The data is however by default written to memory in reverse order: + * D7, D6, D5, D4, D3, D2, D1, D0 (D7 written to lowest byte) + * + * The lowest three bits of CDOCR allows us to do swapping, + * right now we swap the data bytes to the following order: + * D1, D0, D3, D2, D5, D4, D7, D6 + */ ceu_write(pcdev, CDOCR, 0x00000016); ceu_write(pcdev, CDWDR, cdwdr_width); -- cgit v1.2.3 From 3b055603c92cdf22c74998fbe2c639d0b80fe22b Mon Sep 17 00:00:00 2001 From: Magnus Damm Date: Fri, 17 Oct 2008 00:50:56 +0200 Subject: video: add byte swap to sh_mobile_ceu driver Extend the sh_mobile_ceu driver to enable byte swap. This way bytes are stored in memory in incoming byte order. Signed-off-by: Magnus Damm Signed-off-by: Guennadi Liakhovetski --- linux/drivers/media/video/sh_mobile_ceu_camera.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) --- linux/drivers/media/video/sh_mobile_ceu_camera.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/sh_mobile_ceu_camera.c b/linux/drivers/media/video/sh_mobile_ceu_camera.c index 7a7268c43..fa88d382d 100644 --- a/linux/drivers/media/video/sh_mobile_ceu_camera.c +++ b/linux/drivers/media/video/sh_mobile_ceu_camera.c @@ -401,10 +401,10 @@ static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd, * D7, D6, D5, D4, D3, D2, D1, D0 (D7 written to lowest byte) * * The lowest three bits of CDOCR allows us to do swapping, - * right now we swap the data bytes to the following order: - * D1, D0, D3, D2, D5, D4, D7, D6 + * using 7 we swap the data bytes to match the incoming order: + * D0, D1, D2, D3, D4, D5, D6, D7 */ - ceu_write(pcdev, CDOCR, 0x00000016); + ceu_write(pcdev, CDOCR, 0x00000017); ceu_write(pcdev, CDWDR, cdwdr_width); ceu_write(pcdev, CFWCR, 0); /* keep "datafetch firewall" disabled */ -- cgit v1.2.3 From d4f6b3ae05b4eb79674f97cfd4abc5f352d7edec Mon Sep 17 00:00:00 2001 From: Magnus Damm Date: Fri, 17 Oct 2008 00:51:20 +0200 Subject: video: improve sh_mobile_ceu buffer handling This patch improves the buffer handling in the sh_mobile_ceu driver. Instead of marking all queued buffers as VIDEOBUF_ACTIVE the code now marks queued-but-not-active buffers as VIDEOBUF_QUEUED and buffers involved in dma as VIDEOBUF_ACTIVE. The code is also updated with code to cancel active buffers, thanks to Morimoto-san. Signed-off-by: Magnus Damm Tested-by: Kuninori Morimoto Signed-off-by: Guennadi Liakhovetski --- linux/drivers/media/video/sh_mobile_ceu_camera.c | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-) --- linux/drivers/media/video/sh_mobile_ceu_camera.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/sh_mobile_ceu_camera.c b/linux/drivers/media/video/sh_mobile_ceu_camera.c index fa88d382d..2407607f2 100644 --- a/linux/drivers/media/video/sh_mobile_ceu_camera.c +++ b/linux/drivers/media/video/sh_mobile_ceu_camera.c @@ -165,6 +165,7 @@ static void sh_mobile_ceu_capture(struct sh_mobile_ceu_dev *pcdev) ceu_write(pcdev, CETCR, 0x0317f313 ^ 0x10); if (pcdev->active) { + pcdev->active->state = VIDEOBUF_ACTIVE; ceu_write(pcdev, CDAYR, videobuf_to_dma_contig(pcdev->active)); ceu_write(pcdev, CAPSR, 0x1); /* start capture */ } @@ -236,7 +237,7 @@ static void sh_mobile_ceu_videobuf_queue(struct videobuf_queue *vq, dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %zd\n", __func__, vb, vb->baddr, vb->bsize); - vb->state = VIDEOBUF_ACTIVE; + vb->state = VIDEOBUF_QUEUED; spin_lock_irqsave(&pcdev->lock, flags); list_add_tail(&vb->queue, &pcdev->capture); @@ -323,12 +324,24 @@ static void sh_mobile_ceu_remove_device(struct soc_camera_device *icd) { struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct sh_mobile_ceu_dev *pcdev = ici->priv; + unsigned long flags; BUG_ON(icd != pcdev->icd); /* disable capture, disable interrupts */ ceu_write(pcdev, CEIER, 0); ceu_write(pcdev, CAPSR, 1 << 16); /* reset */ + + /* make sure active buffer is canceled */ + spin_lock_irqsave(&pcdev->lock, flags); + if (pcdev->active) { + list_del(&pcdev->active->queue); + pcdev->active->state = VIDEOBUF_ERROR; + wake_up_all(&pcdev->active->done); + pcdev->active = NULL; + } + spin_unlock_irqrestore(&pcdev->lock, flags); + icd->ops->release(icd); dev_info(&icd->dev, -- cgit v1.2.3 From ad720f84ff425b9c3fb75e03d1afa80f25a85c25 Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 16 Oct 2008 19:17:31 -0400 Subject: cx88: Convert __FUNCTION__ to __func__ From: Steven Toth cx88: Convert __FUNCTION__ to __func__ Priority: normal Signed-off-by: Steven Toth --- linux/drivers/media/video/cx88/cx88-alsa.c | 2 +- linux/drivers/media/video/cx88/cx88-dvb.c | 24 ++++++++++++------------ linux/drivers/media/video/cx88/cx88-mpeg.c | 6 +++--- 3 files changed, 16 insertions(+), 16 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/cx88/cx88-alsa.c b/linux/drivers/media/video/cx88/cx88-alsa.c index c675cbeae..3dd2f6629 100644 --- a/linux/drivers/media/video/cx88/cx88-alsa.c +++ b/linux/drivers/media/video/cx88/cx88-alsa.c @@ -60,7 +60,7 @@ #define timestamp() if(debug>=2) { u64 time; u32 rem; rdtscll(time); \ time = (time - chip->starttime)<<12; \ rem = do_div(time, INT); \ - dprintk(2, "%s - called at %u.%03u us\n", __FUNCTION__, \ + dprintk(2, "%s - called at %u.%03u us\n", __func__, \ (unsigned int)time, (rem << 9) / FRAC); } #endif /**************************************************************************** diff --git a/linux/drivers/media/video/cx88/cx88-dvb.c b/linux/drivers/media/video/cx88/cx88-dvb.c index 1a0f971c6..180c9ca11 100644 --- a/linux/drivers/media/video/cx88/cx88-dvb.c +++ b/linux/drivers/media/video/cx88/cx88-dvb.c @@ -121,7 +121,7 @@ static int cx88_dvb_bus_ctrl(struct dvb_frontend* fe, int acquire) fe_id = videobuf_dvb_find_frontend(&dev->frontends, fe); if (!fe_id) { - printk(KERN_ERR "%s() No frontend found\n", __FUNCTION__); + printk(KERN_ERR "%s() No frontend found\n", __func__); return -EINVAL; } @@ -662,10 +662,10 @@ static int dvb_register(struct cx8802_dev *dev) if (fe0->dvb.frontend) { if (!dvb_attach(isl6421_attach, fe0->dvb.frontend, &dev->core->i2c_adap, 0x08, ISL6421_DCL, 0x00)) { - dprintk( 1, "%s(): HVR3000 - DVB-S LNB Init: failed\n", __FUNCTION__); + dprintk( 1, "%s(): HVR3000 - DVB-S LNB Init: failed\n", __func__); } } else { - dprintk( 1, "%s(): HVR3000 - DVB-S Init: failed\n", __FUNCTION__); + dprintk( 1, "%s(): HVR3000 - DVB-S Init: failed\n", __func__); } /* DVB-T init */ fe1 = videobuf_dvb_get_frontend(&dev->frontends, 2); @@ -680,13 +680,13 @@ static int dvb_register(struct cx8802_dev *dev) if(!dvb_attach(simple_tuner_attach, fe1->dvb.frontend, &dev->core->i2c_adap, 0x61, TUNER_PHILIPS_FMD1216ME_MK3)) { - dprintk( 1, "%s(): HVR3000 - DVB-T misc Init: failed\n", __FUNCTION__); + dprintk( 1, "%s(): HVR3000 - DVB-T misc Init: failed\n", __func__); } } else { - dprintk( 1, "%s(): HVR3000 - DVB-T Init: failed\n", __FUNCTION__); + dprintk( 1, "%s(): HVR3000 - DVB-T Init: failed\n", __func__); } } else { - dprintk( 1, "%s(): HVR3000 - DVB-T Init: can't find frontend 2.\n", __FUNCTION__); + dprintk( 1, "%s(): HVR3000 - DVB-T Init: can't find frontend 2.\n", __func__); } break; case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS: @@ -1007,10 +1007,10 @@ static int dvb_register(struct cx8802_dev *dev) if (fe0->dvb.frontend) { if(!dvb_attach(isl6421_attach, fe0->dvb.frontend, &dev->core->i2c_adap, 0x08, ISL6421_DCL, 0x00)) { - dprintk( 1, "%s(): HVR4000 - DVB-S LNB Init: failed\n", __FUNCTION__); + dprintk( 1, "%s(): HVR4000 - DVB-S LNB Init: failed\n", __func__); } } else { - dprintk( 1, "%s(): HVR4000 - DVB-S Init: failed\n", __FUNCTION__); + dprintk( 1, "%s(): HVR4000 - DVB-S Init: failed\n", __func__); } /* DVB-T Init */ fe1 = videobuf_dvb_get_frontend(&dev->frontends, 2); @@ -1025,13 +1025,13 @@ static int dvb_register(struct cx8802_dev *dev) if(!dvb_attach(simple_tuner_attach, fe1->dvb.frontend, &dev->core->i2c_adap, 0x61, TUNER_PHILIPS_FMD1216ME_MK3)) { - dprintk( 1, "%s(): HVR4000 - DVB-T misc Init: failed\n", __FUNCTION__); + dprintk( 1, "%s(): HVR4000 - DVB-T misc Init: failed\n", __func__); } } else { - dprintk( 1, "%s(): HVR4000 - DVB-T Init: failed\n", __FUNCTION__); + dprintk( 1, "%s(): HVR4000 - DVB-T Init: failed\n", __func__); } } else { - dprintk( 1, "%s(): HVR4000 - DVB-T Init: can't find frontend 2.\n", __FUNCTION__); + dprintk( 1, "%s(): HVR4000 - DVB-T Init: can't find frontend 2.\n", __func__); } break; case CX88_BOARD_HAUPPAUGE_HVR4000LITE: @@ -1234,7 +1234,7 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv) for (i = 1; i <= core->board.num_frontends; i++) { fe = videobuf_dvb_get_frontend(&core->dvbdev->frontends, i); if (!fe) { - printk(KERN_ERR "%s() failed to get frontend(%d)\n", __FUNCTION__, i); + printk(KERN_ERR "%s() failed to get frontend(%d)\n", __func__, i); continue; } videobuf_queue_sg_init(&fe->dvb.dvbq, &dvb_qops, diff --git a/linux/drivers/media/video/cx88/cx88-mpeg.c b/linux/drivers/media/video/cx88/cx88-mpeg.c index 88c237790..819d7fbdf 100644 --- a/linux/drivers/media/video/cx88/cx88-mpeg.c +++ b/linux/drivers/media/video/cx88/cx88-mpeg.c @@ -823,7 +823,7 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, goto fail_core; if (!core->board.num_frontends) { - printk(KERN_ERR "%s() .num_frontends should be non-zero, err = %d\n", __FUNCTION__, err); + printk(KERN_ERR "%s() .num_frontends should be non-zero, err = %d\n", __func__, err); goto fail_core; } @@ -844,12 +844,12 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, mutex_init(&dev->frontends.lock); INIT_LIST_HEAD(&dev->frontends.frontend.felist); - printk(KERN_INFO "%s() allocating %d frontend(s)\n", __FUNCTION__, core->board.num_frontends); + printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__, core->board.num_frontends); for (i = 1; i <= core->board.num_frontends; i++) { demod = videobuf_dvb_alloc_frontend(dev, &dev->frontends, i); if(demod == NULL) { - printk(KERN_ERR "%s() failed to alloc\n", __FUNCTION__); + printk(KERN_ERR "%s() failed to alloc\n", __func__); err = -ENOMEM; goto fail_free; } -- cgit v1.2.3 From 89d97d79f9487a932b1c3e675e6cb131db84129e Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 16 Oct 2008 19:18:44 -0400 Subject: cx23885: Checkpatch compliance From: Steven Toth cx23885: Checkpatch compliance Priority: normal Signed-off-by: Steven Toth --- linux/drivers/media/video/cx23885/cx23885-cards.c | 152 +++++++----- linux/drivers/media/video/cx23885/cx23885-core.c | 269 ++++++++++++---------- linux/drivers/media/video/cx23885/cx23885-dvb.c | 36 +-- linux/drivers/media/video/cx23885/cx23885-i2c.c | 47 ++-- linux/drivers/media/video/cx23885/cx23885-video.c | 25 +- linux/drivers/media/video/cx23885/cx23885.h | 21 +- 6 files changed, 298 insertions(+), 252 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/cx23885/cx23885-cards.c b/linux/drivers/media/video/cx23885/cx23885-cards.c index 2b497b28b..dc3f79638 100644 --- a/linux/drivers/media/video/cx23885/cx23885-cards.c +++ b/linux/drivers/media/video/cx23885/cx23885-cards.c @@ -40,16 +40,16 @@ struct cx23885_board cx23885_boards[] = { .input = {{ .type = CX23885_VMUX_COMPOSITE1, .vmux = 0, - },{ + }, { .type = CX23885_VMUX_COMPOSITE2, .vmux = 1, - },{ + }, { .type = CX23885_VMUX_COMPOSITE3, .vmux = 2, - },{ + }, { .type = CX23885_VMUX_COMPOSITE4, .vmux = 3, - }}, + } }, }, [CX23885_BOARD_HAUPPAUGE_HVR1800lp] = { .name = "Hauppauge WinTV-HVR1800lp", @@ -58,19 +58,19 @@ struct cx23885_board cx23885_boards[] = { .type = CX23885_VMUX_TELEVISION, .vmux = 0, .gpio0 = 0xff00, - },{ + }, { .type = CX23885_VMUX_DEBUG, .vmux = 0, .gpio0 = 0xff01, - },{ + }, { .type = CX23885_VMUX_COMPOSITE1, .vmux = 1, .gpio0 = 0xff02, - },{ + }, { .type = CX23885_VMUX_SVIDEO, .vmux = 2, .gpio0 = 0xff02, - }}, + } }, }, [CX23885_BOARD_HAUPPAUGE_HVR1800] = { .name = "Hauppauge WinTV-HVR1800", @@ -85,20 +85,20 @@ struct cx23885_board cx23885_boards[] = { CX25840_VIN5_CH2 | CX25840_VIN2_CH1, .gpio0 = 0, - },{ + }, { .type = CX23885_VMUX_COMPOSITE1, .vmux = CX25840_VIN7_CH3 | CX25840_VIN4_CH2 | CX25840_VIN6_CH1, .gpio0 = 0, - },{ + }, { .type = CX23885_VMUX_SVIDEO, .vmux = CX25840_VIN7_CH3 | CX25840_VIN4_CH2 | CX25840_VIN8_CH1 | CX25840_SVIDEO_ON, .gpio0 = 0, - }}, + } }, }, [CX23885_BOARD_HAUPPAUGE_HVR1250] = { .name = "Hauppauge WinTV-HVR1250", @@ -107,19 +107,19 @@ struct cx23885_board cx23885_boards[] = { .type = CX23885_VMUX_TELEVISION, .vmux = 0, .gpio0 = 0xff00, - },{ + }, { .type = CX23885_VMUX_DEBUG, .vmux = 0, .gpio0 = 0xff01, - },{ + }, { .type = CX23885_VMUX_COMPOSITE1, .vmux = 1, .gpio0 = 0xff02, - },{ + }, { .type = CX23885_VMUX_SVIDEO, .vmux = 2, .gpio0 = 0xff02, - }}, + } }, }, [CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP] = { .name = "DViCO FusionHDTV5 Express", @@ -170,43 +170,43 @@ struct cx23885_subid cx23885_subids[] = { .subvendor = 0x0070, .subdevice = 0x3400, .card = CX23885_BOARD_UNKNOWN, - },{ + }, { .subvendor = 0x0070, .subdevice = 0x7600, .card = CX23885_BOARD_HAUPPAUGE_HVR1800lp, - },{ + }, { .subvendor = 0x0070, .subdevice = 0x7800, .card = CX23885_BOARD_HAUPPAUGE_HVR1800, - },{ + }, { .subvendor = 0x0070, .subdevice = 0x7801, .card = CX23885_BOARD_HAUPPAUGE_HVR1800, - },{ + }, { .subvendor = 0x0070, .subdevice = 0x7809, .card = CX23885_BOARD_HAUPPAUGE_HVR1800, - },{ + }, { .subvendor = 0x0070, .subdevice = 0x7911, .card = CX23885_BOARD_HAUPPAUGE_HVR1250, - },{ + }, { .subvendor = 0x18ac, .subdevice = 0xd500, .card = CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP, - },{ + }, { .subvendor = 0x0070, .subdevice = 0x7790, .card = CX23885_BOARD_HAUPPAUGE_HVR1500Q, - },{ + }, { .subvendor = 0x0070, .subdevice = 0x7797, .card = CX23885_BOARD_HAUPPAUGE_HVR1500Q, - },{ + }, { .subvendor = 0x0070, .subdevice = 0x7710, .card = CX23885_BOARD_HAUPPAUGE_HVR1500, - },{ + }, { .subvendor = 0x0070, .subdevice = 0x7717, .card = CX23885_BOARD_HAUPPAUGE_HVR1500, @@ -226,11 +226,11 @@ struct cx23885_subid cx23885_subids[] = { .subvendor = 0x0070, .subdevice = 0x8010, .card = CX23885_BOARD_HAUPPAUGE_HVR1400, - },{ + }, { .subvendor = 0x18ac, .subdevice = 0xd618, .card = CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP, - },{ + }, { .subvendor = 0x18ac, .subdevice = 0xdb78, .card = CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP, @@ -248,23 +248,25 @@ void cx23885_card_list(struct cx23885_dev *dev) if (0 == dev->pci->subsystem_vendor && 0 == dev->pci->subsystem_device) { - printk("%s: Your board has no valid PCIe Subsystem ID and thus can't\n" - "%s: be autodetected. Please pass card= insmod option to\n" - "%s: workaround that. Redirect complaints to the vendor of\n" - "%s: the TV card. Best regards,\n" + printk(KERN_INFO + "%s: Board has no valid PCIe Subsystem ID and can't\n" + "%s: be autodetected. Pass card= insmod option\n" + "%s: to workaround that. Redirect complaints to the\n" + "%s: vendor of the TV card. Best regards,\n" "%s: -- tux\n", dev->name, dev->name, dev->name, dev->name, dev->name); } else { - printk("%s: Your board isn't known (yet) to the driver. You can\n" - "%s: try to pick one of the existing card configs via\n" + printk(KERN_INFO + "%s: Your board isn't known (yet) to the driver.\n" + "%s: Try to pick one of the existing card configs via\n" "%s: card= insmod option. Updating to the latest\n" "%s: version might help as well.\n", dev->name, dev->name, dev->name, dev->name); } - printk("%s: Here is a list of valid choices for the card= insmod option:\n", + printk(KERN_INFO "%s: Here is a list of valid choices for the card= insmod option:\n", dev->name); for (i = 0; i < cx23885_bcount; i++) - printk("%s: card=%d -> %s\n", + printk(KERN_INFO "%s: card=%d -> %s\n", dev->name, i, cx23885_boards[i].name); } @@ -272,11 +274,11 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data) { struct tveeprom tv; - tveeprom_hauppauge_analog(&dev->i2c_bus[0].i2c_client, &tv, eeprom_data); + tveeprom_hauppauge_analog(&dev->i2c_bus[0].i2c_client, &tv, + eeprom_data); /* Make sure we support the board model */ - switch (tv.model) - { + switch (tv.model) { case 71009: /* WinTV-HVR1200 (PCIe, Retail, full height) * DVB-T and basic analog */ @@ -304,21 +306,51 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data) case 71999: /* WinTV-HVR1200 (PCIe, OEM, full height) * DVB-T and basic analog */ - case 76601: /* WinTV-HVR1800lp (PCIe, Retail, No IR, Dual channel ATSC and MPEG2 HW Encoder */ - case 77001: /* WinTV-HVR1500 (Express Card, OEM, No IR, ATSC and Basic analog */ - case 77011: /* WinTV-HVR1500 (Express Card, Retail, No IR, ATSC and Basic analog */ - case 77041: /* WinTV-HVR1500Q (Express Card, OEM, No IR, ATSC/QAM and Basic analog */ - case 77051: /* WinTV-HVR1500Q (Express Card, Retail, No IR, ATSC/QAM and Basic analog */ - case 78011: /* WinTV-HVR1800 (PCIe, Retail, 3.5mm in, IR, No FM, Dual channel ATSC and MPEG2 HW Encoder */ - case 78501: /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM, Dual channel ATSC and MPEG2 HW Encoder */ - case 78521: /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM, Dual channel ATSC and MPEG2 HW Encoder */ - case 78531: /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, No FM, Dual channel ATSC and MPEG2 HW Encoder */ - case 78631: /* WinTV-HVR1800 (PCIe, OEM, No IR, No FM, Dual channel ATSC and MPEG2 HW Encoder */ - case 79001: /* WinTV-HVR1250 (PCIe, Retail, IR, full height, ATSC and Basic analog */ - case 79101: /* WinTV-HVR1250 (PCIe, Retail, IR, half height, ATSC and Basic analog */ - case 79561: /* WinTV-HVR1250 (PCIe, OEM, No IR, half height, ATSC and Basic analog */ - case 79571: /* WinTV-HVR1250 (PCIe, OEM, No IR, full height, ATSC and Basic analog */ - case 79671: /* WinTV-HVR1250 (PCIe, OEM, No IR, half height, ATSC and Basic analog */ + case 76601: + /* WinTV-HVR1800lp (PCIe, Retail, No IR, Dual + channel ATSC and MPEG2 HW Encoder */ + case 77001: + /* WinTV-HVR1500 (Express Card, OEM, No IR, ATSC + and Basic analog */ + case 77011: + /* WinTV-HVR1500 (Express Card, Retail, No IR, ATSC + and Basic analog */ + case 77041: + /* WinTV-HVR1500Q (Express Card, OEM, No IR, ATSC/QAM + and Basic analog */ + case 77051: + /* WinTV-HVR1500Q (Express Card, Retail, No IR, ATSC/QAM + and Basic analog */ + case 78011: + /* WinTV-HVR1800 (PCIe, Retail, 3.5mm in, IR, No FM, + Dual channel ATSC and MPEG2 HW Encoder */ + case 78501: + /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM, + Dual channel ATSC and MPEG2 HW Encoder */ + case 78521: + /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM, + Dual channel ATSC and MPEG2 HW Encoder */ + case 78531: + /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, No FM, + Dual channel ATSC and MPEG2 HW Encoder */ + case 78631: + /* WinTV-HVR1800 (PCIe, OEM, No IR, No FM, + Dual channel ATSC and MPEG2 HW Encoder */ + case 79001: + /* WinTV-HVR1250 (PCIe, Retail, IR, full height, + ATSC and Basic analog */ + case 79101: + /* WinTV-HVR1250 (PCIe, Retail, IR, half height, + ATSC and Basic analog */ + case 79561: + /* WinTV-HVR1250 (PCIe, OEM, No IR, half height, + ATSC and Basic analog */ + case 79571: + /* WinTV-HVR1250 (PCIe, OEM, No IR, full height, + ATSC and Basic analog */ + case 79671: + /* WinTV-HVR1250 (PCIe, OEM, No IR, half height, + ATSC and Basic analog */ case 80019: /* WinTV-HVR1400 (Express Card, Retail, IR, * DVB-T and Basic analog */ @@ -330,7 +362,8 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data) * DVB-T and MPEG2 HW Encoder */ break; default: - printk("%s: warning: unknown hauppauge model #%d\n", dev->name, tv.model); + printk(KERN_WARNING "%s: warning: unknown hauppauge model #%d\n", + dev->name, tv.model); break; } @@ -353,7 +386,7 @@ int cx23885_tuner_callback(void *priv, int component, int command, int arg) return -EINVAL; } - switch(dev->board) { + switch (dev->board) { case CX23885_BOARD_HAUPPAUGE_HVR1400: case CX23885_BOARD_HAUPPAUGE_HVR1500: case CX23885_BOARD_HAUPPAUGE_HVR1500Q: @@ -384,7 +417,7 @@ int cx23885_tuner_callback(void *priv, int component, int command, int arg) void cx23885_gpio_setup(struct cx23885_dev *dev) { - switch(dev->board) { + switch (dev->board) { case CX23885_BOARD_HAUPPAUGE_HVR1250: /* GPIO-0 cx24227 demodulator reset */ cx_set(GP0_IO, 0x00010001); /* Bring the part out of reset */ @@ -618,10 +651,3 @@ void cx23885_card_setup(struct cx23885_dev *dev) } /* ------------------------------------------------------------------ */ - -/* - * Local variables: - * c-basic-offset: 8 - * End: - * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off - */ diff --git a/linux/drivers/media/video/cx23885/cx23885-core.c b/linux/drivers/media/video/cx23885/cx23885-core.c index 6fc69988a..009e5cb01 100644 --- a/linux/drivers/media/video/cx23885/cx23885-core.c +++ b/linux/drivers/media/video/cx23885/cx23885-core.c @@ -38,12 +38,12 @@ MODULE_AUTHOR("Steven Toth "); MODULE_LICENSE("GPL"); static unsigned int debug; -module_param(debug,int,0644); -MODULE_PARM_DESC(debug,"enable debug messages"); +module_param(debug, int, 0644); +MODULE_PARM_DESC(debug, "enable debug messages"); static unsigned int card[] = {[0 ... (CX23885_MAXBOARDS - 1)] = UNSET }; module_param_array(card, int, NULL, 0444); -MODULE_PARM_DESC(card,"card type"); +MODULE_PARM_DESC(card, "card type"); #define dprintk(level, fmt, arg...)\ do { if (debug >= level)\ @@ -365,13 +365,12 @@ void cx23885_wakeup(struct cx23885_tsport *port, list_del(&buf->vb.queue); wake_up(&buf->vb.done); } - if (list_empty(&q->active)) { + if (list_empty(&q->active)) del_timer(&q->timeout); - } else { + else mod_timer(&q->timeout, jiffies + BUFFER_TIMEOUT); - } if (bc != 1) - printk("%s: %d buffers handled (should be 1)\n", + printk(KERN_WARNING "%s: %d buffers handled (should be 1)\n", __func__, bc); } @@ -382,8 +381,7 @@ int cx23885_sram_channel_setup(struct cx23885_dev *dev, unsigned int i, lines; u32 cdt; - if (ch->cmds_start == 0) - { + if (ch->cmds_start == 0) { dprintk(1, "%s() Erasing channel [%s]\n", __func__, ch->name); cx_write(ch->ptr1_reg, 0); @@ -419,15 +417,15 @@ int cx23885_sram_channel_setup(struct cx23885_dev *dev, /* write CMDS */ if (ch->jumponly) - cx_write(ch->cmds_start + 0, 8); + cx_write(ch->cmds_start + 0, 8); else - cx_write(ch->cmds_start + 0, risc); + cx_write(ch->cmds_start + 0, risc); cx_write(ch->cmds_start + 4, 0); /* 64 bits 63-32 */ cx_write(ch->cmds_start + 8, cdt); cx_write(ch->cmds_start + 12, (lines*16) >> 3); cx_write(ch->cmds_start + 16, ch->ctrl_start); if (ch->jumponly) - cx_write(ch->cmds_start + 20, 0x80000000 | (64 >> 2) ); + cx_write(ch->cmds_start + 20, 0x80000000 | (64 >> 2)); else cx_write(ch->cmds_start + 20, 64 >> 2); for (i = 24; i < 80; i += 4) @@ -437,9 +435,9 @@ int cx23885_sram_channel_setup(struct cx23885_dev *dev, cx_write(ch->ptr1_reg, ch->fifo_start); cx_write(ch->ptr2_reg, cdt); cx_write(ch->cnt2_reg, (lines*16) >> 3); - cx_write(ch->cnt1_reg, (bpl >> 3) -1); + cx_write(ch->cnt1_reg, (bpl >> 3) - 1); - dprintk(2,"[bridge %d] sram setup %s: bpl=%d lines=%d\n", + dprintk(2, "[bridge %d] sram setup %s: bpl=%d lines=%d\n", dev->bridge, ch->name, bpl, @@ -470,43 +468,43 @@ void cx23885_sram_channel_dump(struct cx23885_dev *dev, u32 risc; unsigned int i, j, n; - printk("%s: %s - dma channel status dump\n", + printk(KERN_WARNING "%s: %s - dma channel status dump\n", dev->name, ch->name); for (i = 0; i < ARRAY_SIZE(name); i++) - printk("%s: cmds: %-15s: 0x%08x\n", + printk(KERN_WARNING "%s: cmds: %-15s: 0x%08x\n", dev->name, name[i], cx_read(ch->cmds_start + 4*i)); for (i = 0; i < 4; i++) { risc = cx_read(ch->cmds_start + 4 * (i + 14)); - printk("%s: risc%d: ", dev->name, i); + printk(KERN_WARNING "%s: risc%d: ", dev->name, i); cx23885_risc_decode(risc); } for (i = 0; i < (64 >> 2); i += n) { risc = cx_read(ch->ctrl_start + 4 * i); /* No consideration for bits 63-32 */ - printk("%s: (0x%08x) iq %x: ", dev->name, + printk(KERN_WARNING "%s: (0x%08x) iq %x: ", dev->name, ch->ctrl_start + 4 * i, i); n = cx23885_risc_decode(risc); for (j = 1; j < n; j++) { risc = cx_read(ch->ctrl_start + 4 * (i + j)); - printk("%s: iq %x: 0x%08x [ arg #%d ]\n", + printk(KERN_WARNING "%s: iq %x: 0x%08x [ arg #%d ]\n", dev->name, i+j, risc, j); } } - printk("%s: fifo: 0x%08x -> 0x%x\n", + printk(KERN_WARNING "%s: fifo: 0x%08x -> 0x%x\n", dev->name, ch->fifo_start, ch->fifo_start+ch->fifo_size); - printk("%s: ctrl: 0x%08x -> 0x%x\n", + printk(KERN_WARNING "%s: ctrl: 0x%08x -> 0x%x\n", dev->name, ch->ctrl_start, ch->ctrl_start + 6*16); - printk("%s: ptr1_reg: 0x%08x\n", + printk(KERN_WARNING "%s: ptr1_reg: 0x%08x\n", dev->name, cx_read(ch->ptr1_reg)); - printk("%s: ptr2_reg: 0x%08x\n", + printk(KERN_WARNING "%s: ptr2_reg: 0x%08x\n", dev->name, cx_read(ch->ptr2_reg)); - printk("%s: cnt1_reg: 0x%08x\n", + printk(KERN_WARNING "%s: cnt1_reg: 0x%08x\n", dev->name, cx_read(ch->cnt1_reg)); - printk("%s: cnt2_reg: 0x%08x\n", + printk(KERN_WARNING "%s: cnt2_reg: 0x%08x\n", dev->name, cx_read(ch->cnt2_reg)); } @@ -516,13 +514,13 @@ static void cx23885_risc_disasm(struct cx23885_tsport *port, struct cx23885_dev *dev = port->dev; unsigned int i, j, n; - printk("%s: risc disasm: %p [dma=0x%08lx]\n", + printk(KERN_INFO "%s: risc disasm: %p [dma=0x%08lx]\n", dev->name, risc->cpu, (unsigned long)risc->dma); for (i = 0; i < (risc->size >> 2); i += n) { - printk("%s: %04d: ", dev->name, i); + printk(KERN_INFO "%s: %04d: ", dev->name, i); n = cx23885_risc_decode(le32_to_cpu(risc->cpu[i])); for (j = 1; j < n; j++) - printk("%s: %04d: 0x%08x [ arg #%d ]\n", + printk(KERN_INFO "%s: %04d: 0x%08x [ arg #%d ]\n", dev->name, i + j, risc->cpu[i + j], j); if (risc->cpu[i] == cpu_to_le32(RISC_JUMP)) break; @@ -601,7 +599,7 @@ static int cx23885_pci_quirks(struct cx23885_dev *dev) * when DMA begins if RDR_TLCTL0 bit4 is not cleared. It does not * occur on the cx23887 bridge. */ - if(dev->bridge == CX23885_BRIDGE_885) + if (dev->bridge == CX23885_BRIDGE_885) cx_clear(RDR_TLCTL0, 1 << 4); return 0; @@ -609,13 +607,13 @@ static int cx23885_pci_quirks(struct cx23885_dev *dev) static int get_resources(struct cx23885_dev *dev) { - if (request_mem_region(pci_resource_start(dev->pci,0), - pci_resource_len(dev->pci,0), + if (request_mem_region(pci_resource_start(dev->pci, 0), + pci_resource_len(dev->pci, 0), dev->name)) return 0; printk(KERN_ERR "%s: can't get MMIO memory @ 0x%llx\n", - dev->name, (unsigned long long)pci_resource_start(dev->pci,0)); + dev->name, (unsigned long long)pci_resource_start(dev->pci, 0)); return -EBUSY; } @@ -624,7 +622,8 @@ static void cx23885_timeout(unsigned long data); int cx23885_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, u32 reg, u32 mask, u32 value); -static int cx23885_init_tsport(struct cx23885_dev *dev, struct cx23885_tsport *port, int portno) +static int cx23885_init_tsport(struct cx23885_dev *dev, + struct cx23885_tsport *port, int portno) { dprintk(1, "%s(portno=%d)\n", __func__, portno); @@ -652,10 +651,10 @@ static int cx23885_init_tsport(struct cx23885_dev *dev, struct cx23885_tsport *p * attachment to this tsport, keeping the -dvb.c * code clean and safe. */ - if(!port->num_frontends) + if (!port->num_frontends) port->num_frontends = 1; - switch(portno) { + switch (portno) { case 1: port->reg_gpcnt = VID_B_GPCNT; port->reg_gpcnt_ctl = VID_B_GPCNT_CTL; @@ -756,13 +755,13 @@ static int cx23885_dev_setup(struct cx23885_dev *dev) mutex_unlock(&devlist); /* Configure the internal memory */ - if(dev->pci->device == 0x8880) { + if (dev->pci->device == 0x8880) { dev->bridge = CX23885_BRIDGE_887; /* Apply a sensible clock frequency for the PCIe bridge */ dev->clk_freq = 25000000; dev->sram_channels = cx23887_sram_channels; } else - if(dev->pci->device == 0x8852) { + if (dev->pci->device == 0x8852) { dev->bridge = CX23885_BRIDGE_885; /* Apply a sensible clock frequency for the PCIe bridge */ dev->clk_freq = 28000000; @@ -843,8 +842,8 @@ static int cx23885_dev_setup(struct cx23885_dev *dev) } /* PCIe stuff */ - dev->lmmio = ioremap(pci_resource_start(dev->pci,0), - pci_resource_len(dev->pci,0)); + dev->lmmio = ioremap(pci_resource_start(dev->pci, 0), + pci_resource_len(dev->pci, 0)); dev->bmmio = (u8 __iomem *)dev->lmmio; @@ -874,7 +873,7 @@ static int cx23885_dev_setup(struct cx23885_dev *dev) cx23885_i2c_register(&dev->i2c_bus[1]); cx23885_i2c_register(&dev->i2c_bus[2]); cx23885_card_setup(dev); - cx23885_call_i2c_clients (&dev->i2c_bus[0], TUNER_SET_STANDBY, NULL); + cx23885_call_i2c_clients(&dev->i2c_bus[0], TUNER_SET_STANDBY, NULL); cx23885_ir_init(dev); if (cx23885_boards[dev->board].porta == CX23885_ANALOG_VIDEO) { @@ -920,8 +919,8 @@ static int cx23885_dev_setup(struct cx23885_dev *dev) static void cx23885_dev_unregister(struct cx23885_dev *dev) { - release_mem_region(pci_resource_start(dev->pci,0), - pci_resource_len(dev->pci,0)); + release_mem_region(pci_resource_start(dev->pci, 0), + pci_resource_len(dev->pci, 0)); if (!atomic_dec_and_test(&dev->refcount)) return; @@ -948,7 +947,7 @@ static void cx23885_dev_unregister(struct cx23885_dev *dev) iounmap(dev->lmmio); } -static __le32* cx23885_risc_field(__le32 *rp, struct scatterlist *sglist, +static __le32 *cx23885_risc_field(__le32 *rp, struct scatterlist *sglist, unsigned int offset, u32 sync_line, unsigned int bpl, unsigned int padding, unsigned int lines) @@ -969,31 +968,31 @@ static __le32* cx23885_risc_field(__le32 *rp, struct scatterlist *sglist, } if (bpl <= sg_dma_len(sg)-offset) { /* fits into current chunk */ - *(rp++)=cpu_to_le32(RISC_WRITE|RISC_SOL|RISC_EOL|bpl); - *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset); - *(rp++)=cpu_to_le32(0); /* bits 63-32 */ - offset+=bpl; + *(rp++) = cpu_to_le32(RISC_WRITE|RISC_SOL|RISC_EOL|bpl); + *(rp++) = cpu_to_le32(sg_dma_address(sg)+offset); + *(rp++) = cpu_to_le32(0); /* bits 63-32 */ + offset += bpl; } else { /* scanline needs to be split */ todo = bpl; - *(rp++)=cpu_to_le32(RISC_WRITE|RISC_SOL| + *(rp++) = cpu_to_le32(RISC_WRITE|RISC_SOL| (sg_dma_len(sg)-offset)); - *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset); - *(rp++)=cpu_to_le32(0); /* bits 63-32 */ + *(rp++) = cpu_to_le32(sg_dma_address(sg)+offset); + *(rp++) = cpu_to_le32(0); /* bits 63-32 */ todo -= (sg_dma_len(sg)-offset); offset = 0; sg++; while (todo > sg_dma_len(sg)) { - *(rp++)=cpu_to_le32(RISC_WRITE| + *(rp++) = cpu_to_le32(RISC_WRITE| sg_dma_len(sg)); - *(rp++)=cpu_to_le32(sg_dma_address(sg)); - *(rp++)=cpu_to_le32(0); /* bits 63-32 */ + *(rp++) = cpu_to_le32(sg_dma_address(sg)); + *(rp++) = cpu_to_le32(0); /* bits 63-32 */ todo -= sg_dma_len(sg); sg++; } - *(rp++)=cpu_to_le32(RISC_WRITE|RISC_EOL|todo); - *(rp++)=cpu_to_le32(sg_dma_address(sg)); - *(rp++)=cpu_to_le32(0); /* bits 63-32 */ + *(rp++) = cpu_to_le32(RISC_WRITE|RISC_EOL|todo); + *(rp++) = cpu_to_le32(sg_dma_address(sg)); + *(rp++) = cpu_to_le32(0); /* bits 63-32 */ offset += todo; } offset += padding; @@ -1022,9 +1021,11 @@ int cx23885_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc, can cause next bpl to start close to a page border. First DMA region may be smaller than PAGE_SIZE */ /* write and jump need and extra dword */ - instructions = fields * (1 + ((bpl + padding) * lines) / PAGE_SIZE + lines); + instructions = fields * (1 + ((bpl + padding) * lines) + / PAGE_SIZE + lines); instructions += 2; - if ((rc = btcx_riscmem_alloc(pci,risc,instructions*12)) < 0) + rc = btcx_riscmem_alloc(pci, risc, instructions*12); + if (rc < 0) return rc; /* write risc instructions */ @@ -1038,7 +1039,7 @@ int cx23885_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc, /* save pointer to jmp instruction address */ risc->jmp = rp; - BUG_ON((risc->jmp - risc->cpu + 2) * sizeof (*risc->cpu) > risc->size); + BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size); return 0; } @@ -1060,7 +1061,8 @@ static int cx23885_risc_databuffer(struct pci_dev *pci, instructions = 1 + (bpl * lines) / PAGE_SIZE + lines; instructions += 1; - if ((rc = btcx_riscmem_alloc(pci,risc,instructions*12)) < 0) + rc = btcx_riscmem_alloc(pci, risc, instructions*12); + if (rc < 0) return rc; /* write risc instructions */ @@ -1069,7 +1071,7 @@ static int cx23885_risc_databuffer(struct pci_dev *pci, /* save pointer to jmp instruction address */ risc->jmp = rp; - BUG_ON((risc->jmp - risc->cpu + 2) * sizeof (*risc->cpu) > risc->size); + BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size); return 0; } @@ -1079,7 +1081,8 @@ int cx23885_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, __le32 *rp; int rc; - if ((rc = btcx_riscmem_alloc(pci, risc, 4*16)) < 0) + rc = btcx_riscmem_alloc(pci, risc, 4*16); + if (rc < 0) return rc; /* write risc instructions */ @@ -1173,22 +1176,23 @@ static int cx23885_start_dma(struct cx23885_tsport *port, /* setup fifo + format */ cx23885_sram_channel_setup(dev, - &dev->sram_channels[ port->sram_chno ], + &dev->sram_channels[port->sram_chno], port->ts_packet_size, buf->risc.dma); - if(debug > 5) { - cx23885_sram_channel_dump(dev, &dev->sram_channels[ port->sram_chno ] ); + if (debug > 5) { + cx23885_sram_channel_dump(dev, + &dev->sram_channels[port->sram_chno]); cx23885_risc_disasm(port, &buf->risc); } /* write TS length to chip */ cx_write(port->reg_lngth, buf->vb.width); - if ( (!(cx23885_boards[dev->board].portb & CX23885_MPEG_DVB)) && - (!(cx23885_boards[dev->board].portc & CX23885_MPEG_DVB)) ) { - printk( "%s() Failed. Unsupported value in .portb/c (0x%08x)/(0x%08x)\n", + if ((!(cx23885_boards[dev->board].portb & CX23885_MPEG_DVB)) && + (!(cx23885_boards[dev->board].portc & CX23885_MPEG_DVB))) { + printk("%s() Unsupported .portb/c (0x%08x)/(0x%08x)\n", __func__, cx23885_boards[dev->board].portb, - cx23885_boards[dev->board].portc ); + cx23885_boards[dev->board].portc); return -EINVAL; } @@ -1198,7 +1202,7 @@ static int cx23885_start_dma(struct cx23885_tsport *port, udelay(100); /* If the port supports SRC SELECT, configure it */ - if(port->reg_src_sel) + if (port->reg_src_sel) cx_write(port->reg_src_sel, port->src_sel_val); cx_write(port->reg_hw_sop_ctrl, port->hw_sop_ctrl_val); @@ -1207,7 +1211,7 @@ static int cx23885_start_dma(struct cx23885_tsport *port, cx_write(port->reg_gen_ctrl, port->gen_ctrl_val); udelay(100); - // NOTE: this is 2 (reserved) for portb, does it matter? + /* NOTE: this is 2 (reserved) for portb, does it matter? */ /* reset counter to zero */ cx_write(port->reg_gpcnt_ctl, 3); q->count = 1; @@ -1241,11 +1245,11 @@ static int cx23885_start_dma(struct cx23885_tsport *port, cx_write(ALT_PIN_OUT_SEL, 0x10100045); } - switch(dev->bridge) { + switch (dev->bridge) { case CX23885_BRIDGE_885: case CX23885_BRIDGE_887: /* enable irqs */ - dprintk(1, "%s() enabling TS int's and DMA\n", __func__ ); + dprintk(1, "%s() enabling TS int's and DMA\n", __func__); cx_set(port->reg_ts_int_msk, port->ts_int_msk_val); cx_set(port->reg_dma_ctl, port->dma_ctl_val); cx_set(PCI_INT_MSK, dev->pci_irqmask | port->pci_irqmask); @@ -1310,8 +1314,7 @@ int cx23885_restart_queue(struct cx23885_tsport *port, struct cx23885_buffer *buf; dprintk(5, "%s()\n", __func__); - if (list_empty(&q->active)) - { + if (list_empty(&q->active)) { struct cx23885_buffer *prev; prev = NULL; @@ -1329,7 +1332,7 @@ int cx23885_restart_queue(struct cx23885_tsport *port, buf->vb.state = VIDEOBUF_ACTIVE; buf->count = q->count++; mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); - dprintk(5, "[%p/%d] restart_queue - first active\n", + dprintk(5, "[%p/%d] restart_queue - f/active\n", buf, buf->vb.i); } else if (prev->vb.width == buf->vb.width && @@ -1340,8 +1343,9 @@ int cx23885_restart_queue(struct cx23885_tsport *port, buf->vb.state = VIDEOBUF_ACTIVE; buf->count = q->count++; prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); - prev->risc.jmp[2] = cpu_to_le32(0); /* 64 bit bits 63-32 */ - dprintk(5,"[%p/%d] restart_queue - move to active\n", + /* 64 bit bits 63-32 */ + prev->risc.jmp[2] = cpu_to_le32(0); + dprintk(5, "[%p/%d] restart_queue - m/active\n", buf, buf->vb.i); } else { return 0; @@ -1380,7 +1384,8 @@ int cx23885_buf_prepare(struct videobuf_queue *q, struct cx23885_tsport *port, buf->vb.size = size; buf->vb.field = field /*V4L2_FIELD_TOP*/; - if (0 != (rc = videobuf_iolock(q, &buf->vb, NULL))) + rc = videobuf_iolock(q, &buf->vb, NULL); + if (0 != rc) goto fail; cx23885_risc_databuffer(dev->pci, &buf->risc, videobuf_to_dma(&buf->vb)->sglist, @@ -1406,7 +1411,7 @@ void cx23885_buf_queue(struct cx23885_tsport *port, struct cx23885_buffer *buf) buf->risc.jmp[2] = cpu_to_le32(0); /* bits 63-32 */ if (list_empty(&cx88q->active)) { - dprintk( 1, "queue is empty - first active\n" ); + dprintk(1, "queue is empty - first active\n"); list_add_tail(&buf->vb.queue, &cx88q->active); cx23885_start_dma(port, cx88q, buf); buf->vb.state = VIDEOBUF_ACTIVE; @@ -1415,7 +1420,7 @@ void cx23885_buf_queue(struct cx23885_tsport *port, struct cx23885_buffer *buf) dprintk(1, "[%p/%d] %s - first active\n", buf, buf->vb.i, __func__); } else { - dprintk( 1, "queue is not empty - append to active\n" ); + dprintk(1, "queue is not empty - append to active\n"); prev = list_entry(cx88q->active.prev, struct cx23885_buffer, vb.queue); list_add_tail(&buf->vb.queue, &cx88q->active); @@ -1423,7 +1428,7 @@ void cx23885_buf_queue(struct cx23885_tsport *port, struct cx23885_buffer *buf) buf->count = cx88q->count++; prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); prev->risc.jmp[2] = cpu_to_le32(0); /* 64 bit bits 63-32 */ - dprintk( 1, "[%p/%d] %s - append to active\n", + dprintk(1, "[%p/%d] %s - append to active\n", buf, buf->vb.i, __func__); } } @@ -1449,7 +1454,7 @@ static void do_cancel_buffers(struct cx23885_tsport *port, char *reason, buf, buf->vb.i, reason, (unsigned long)buf->risc.dma); } if (restart) { - dprintk(1, "restarting queue\n" ); + dprintk(1, "restarting queue\n"); cx23885_restart_queue(port, q); } spin_unlock_irqrestore(&port->slock, flags); @@ -1471,10 +1476,11 @@ static void cx23885_timeout(unsigned long data) struct cx23885_tsport *port = (struct cx23885_tsport *)data; struct cx23885_dev *dev = port->dev; - dprintk(1, "%s()\n",__func__); + dprintk(1, "%s()\n", __func__); if (debug > 5) - cx23885_sram_channel_dump(dev, &dev->sram_channels[ port->sram_chno ]); + cx23885_sram_channel_dump(dev, + &dev->sram_channels[port->sram_chno]); cx23885_stop_dma(port); do_cancel_buffers(port, "timeout", 1); @@ -1550,16 +1556,23 @@ static int cx23885_irq_ts(struct cx23885_tsport *port, u32 status) if ((status & VID_BC_MSK_OPC_ERR) || (status & VID_BC_MSK_BAD_PKT) || (status & VID_BC_MSK_SYNC) || - (status & VID_BC_MSK_OF)) - { + (status & VID_BC_MSK_OF)) { + if (status & VID_BC_MSK_OPC_ERR) - dprintk(7, " (VID_BC_MSK_OPC_ERR 0x%08x)\n", VID_BC_MSK_OPC_ERR); + dprintk(7, " (VID_BC_MSK_OPC_ERR 0x%08x)\n", + VID_BC_MSK_OPC_ERR); + if (status & VID_BC_MSK_BAD_PKT) - dprintk(7, " (VID_BC_MSK_BAD_PKT 0x%08x)\n", VID_BC_MSK_BAD_PKT); + dprintk(7, " (VID_BC_MSK_BAD_PKT 0x%08x)\n", + VID_BC_MSK_BAD_PKT); + if (status & VID_BC_MSK_SYNC) - dprintk(7, " (VID_BC_MSK_SYNC 0x%08x)\n", VID_BC_MSK_SYNC); + dprintk(7, " (VID_BC_MSK_SYNC 0x%08x)\n", + VID_BC_MSK_SYNC); + if (status & VID_BC_MSK_OF) - dprintk(7, " (VID_BC_MSK_OF 0x%08x)\n", VID_BC_MSK_OF); + dprintk(7, " (VID_BC_MSK_OF 0x%08x)\n", + VID_BC_MSK_OF); printk(KERN_ERR "%s: mpeg risc op code error\n", dev->name); @@ -1593,7 +1606,7 @@ static int cx23885_irq_ts(struct cx23885_tsport *port, u32 status) return handled; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) static irqreturn_t cx23885_irq(int irq, void *dev_id, struct pt_regs *regs) #else static irqreturn_t cx23885_irq(int irq, void *dev_id) @@ -1617,7 +1630,7 @@ static irqreturn_t cx23885_irq(int irq, void *dev_id) ts2_status = cx_read(VID_C_INT_STAT); ts2_mask = cx_read(VID_C_INT_MSK); - if ( (pci_status == 0) && (ts2_status == 0) && (ts1_status == 0) ) + if ((pci_status == 0) && (ts2_status == 0) && (ts1_status == 0)) goto out; vida_count = cx_read(VID_A_GPCNT); @@ -1632,38 +1645,56 @@ static irqreturn_t cx23885_irq(int irq, void *dev_id) dprintk(7, "ts2_status: 0x%08x ts2_mask: 0x%08x count: 0x%x\n", ts2_status, ts2_mask, ts2_count); - if ( (pci_status & PCI_MSK_RISC_RD) || - (pci_status & PCI_MSK_RISC_WR) || - (pci_status & PCI_MSK_AL_RD) || - (pci_status & PCI_MSK_AL_WR) || - (pci_status & PCI_MSK_APB_DMA) || - (pci_status & PCI_MSK_VID_C) || - (pci_status & PCI_MSK_VID_B) || - (pci_status & PCI_MSK_VID_A) || - (pci_status & PCI_MSK_AUD_INT) || - (pci_status & PCI_MSK_AUD_EXT) ) - { + if ((pci_status & PCI_MSK_RISC_RD) || + (pci_status & PCI_MSK_RISC_WR) || + (pci_status & PCI_MSK_AL_RD) || + (pci_status & PCI_MSK_AL_WR) || + (pci_status & PCI_MSK_APB_DMA) || + (pci_status & PCI_MSK_VID_C) || + (pci_status & PCI_MSK_VID_B) || + (pci_status & PCI_MSK_VID_A) || + (pci_status & PCI_MSK_AUD_INT) || + (pci_status & PCI_MSK_AUD_EXT)) { if (pci_status & PCI_MSK_RISC_RD) - dprintk(7, " (PCI_MSK_RISC_RD 0x%08x)\n", PCI_MSK_RISC_RD); + dprintk(7, " (PCI_MSK_RISC_RD 0x%08x)\n", + PCI_MSK_RISC_RD); + if (pci_status & PCI_MSK_RISC_WR) - dprintk(7, " (PCI_MSK_RISC_WR 0x%08x)\n", PCI_MSK_RISC_WR); + dprintk(7, " (PCI_MSK_RISC_WR 0x%08x)\n", + PCI_MSK_RISC_WR); + if (pci_status & PCI_MSK_AL_RD) - dprintk(7, " (PCI_MSK_AL_RD 0x%08x)\n", PCI_MSK_AL_RD); + dprintk(7, " (PCI_MSK_AL_RD 0x%08x)\n", + PCI_MSK_AL_RD); + if (pci_status & PCI_MSK_AL_WR) - dprintk(7, " (PCI_MSK_AL_WR 0x%08x)\n", PCI_MSK_AL_WR); + dprintk(7, " (PCI_MSK_AL_WR 0x%08x)\n", + PCI_MSK_AL_WR); + if (pci_status & PCI_MSK_APB_DMA) - dprintk(7, " (PCI_MSK_APB_DMA 0x%08x)\n", PCI_MSK_APB_DMA); + dprintk(7, " (PCI_MSK_APB_DMA 0x%08x)\n", + PCI_MSK_APB_DMA); + if (pci_status & PCI_MSK_VID_C) - dprintk(7, " (PCI_MSK_VID_C 0x%08x)\n", PCI_MSK_VID_C); + dprintk(7, " (PCI_MSK_VID_C 0x%08x)\n", + PCI_MSK_VID_C); + if (pci_status & PCI_MSK_VID_B) - dprintk(7, " (PCI_MSK_VID_B 0x%08x)\n", PCI_MSK_VID_B); + dprintk(7, " (PCI_MSK_VID_B 0x%08x)\n", + PCI_MSK_VID_B); + if (pci_status & PCI_MSK_VID_A) - dprintk(7, " (PCI_MSK_VID_A 0x%08x)\n", PCI_MSK_VID_A); + dprintk(7, " (PCI_MSK_VID_A 0x%08x)\n", + PCI_MSK_VID_A); + if (pci_status & PCI_MSK_AUD_INT) - dprintk(7, " (PCI_MSK_AUD_INT 0x%08x)\n", PCI_MSK_AUD_INT); + dprintk(7, " (PCI_MSK_AUD_INT 0x%08x)\n", + PCI_MSK_AUD_INT); + if (pci_status & PCI_MSK_AUD_EXT) - dprintk(7, " (PCI_MSK_AUD_EXT 0x%08x)\n", PCI_MSK_AUD_EXT); + dprintk(7, " (PCI_MSK_AUD_EXT 0x%08x)\n", + PCI_MSK_AUD_EXT); } @@ -1775,13 +1806,13 @@ static struct pci_device_id cx23885_pci_tbl[] = { .device = 0x8852, .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, - },{ + }, { /* CX23887 Rev 2 */ .vendor = 0x14f1, .device = 0x8880, .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, - },{ + }, { /* --- end of list --- */ } }; @@ -1819,9 +1850,3 @@ module_init(cx23885_init); module_exit(cx23885_fini); /* ----------------------------------------------------------- */ -/* - * Local variables: - * c-basic-offset: 8 - * End: - * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off - */ diff --git a/linux/drivers/media/video/cx23885/cx23885-dvb.c b/linux/drivers/media/video/cx23885/cx23885-dvb.c index 9b96b0600..43baf5aea 100644 --- a/linux/drivers/media/video/cx23885/cx23885-dvb.c +++ b/linux/drivers/media/video/cx23885/cx23885-dvb.c @@ -79,19 +79,19 @@ static int dvb_buf_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, enum v4l2_field field) { struct cx23885_tsport *port = q->priv_data; - return cx23885_buf_prepare(q, port, (struct cx23885_buffer*)vb, field); + return cx23885_buf_prepare(q, port, (struct cx23885_buffer *)vb, field); } static void dvb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) { struct cx23885_tsport *port = q->priv_data; - cx23885_buf_queue(port, (struct cx23885_buffer*)vb); + cx23885_buf_queue(port, (struct cx23885_buffer *)vb); } static void dvb_buf_release(struct videobuf_queue *q, struct videobuf_buffer *vb) { - cx23885_free_buffer(q, (struct cx23885_buffer*)vb); + cx23885_free_buffer(q, (struct cx23885_buffer *)vb); } static struct videobuf_queue_ops dvb_qops = { @@ -451,7 +451,8 @@ static int dvb_register(struct cx23885_tsport *port) .fname = XC3028L_DEFAULT_FIRMWARE, .max_len = 64, .demod = 5000, - /* This is true for all demods with v36 firmware? */ + /* This is true for all demods with + v36 firmware? */ .type = XC2028_D2633, }; @@ -526,12 +527,14 @@ static int dvb_register(struct cx23885_tsport *port) } break; default: - printk("%s: The frontend of your DVB/ATSC card isn't supported yet\n", + printk(KERN_INFO "%s: The frontend of your DVB/ATSC card " + " isn't supported yet\n", dev->name); break; } if (NULL == fe0->dvb.frontend) { - printk("%s: frontend initialization failed\n", dev->name); + printk(KERN_ERR "%s: frontend initialization failed\n", + dev->name); return -1; } /* define general-purpose callback pointer */ @@ -569,7 +572,8 @@ int cx23885_dvb_register(struct cx23885_tsport *port) port->num_frontends); for (i = 1; i <= port->num_frontends; i++) { - if (videobuf_dvb_alloc_frontend(dev, &port->frontends, i) == NULL) { + if (videobuf_dvb_alloc_frontend(dev, + &port->frontends, i) == NULL) { printk(KERN_ERR "%s() failed to alloc\n", __func__); return -ENOMEM; } @@ -579,7 +583,7 @@ int cx23885_dvb_register(struct cx23885_tsport *port) err = -EINVAL; dprintk(1, "%s\n", __func__); - dprintk(1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n", + dprintk(1, " ->probed by Card=%d Name=%s, PCI %02x:%02x\n", dev->board, dev->name, dev->pci_bus, @@ -589,14 +593,16 @@ int cx23885_dvb_register(struct cx23885_tsport *port) /* dvb stuff */ /* We have to init the queue for each frontend on a port. */ - printk("%s: cx23885 based dvb card\n", dev->name); - videobuf_queue_sg_init(&fe0->dvb.dvbq, &dvb_qops, &dev->pci->dev, &port->slock, + printk(KERN_INFO "%s: cx23885 based dvb card\n", dev->name); + videobuf_queue_sg_init(&fe0->dvb.dvbq, &dvb_qops, + &dev->pci->dev, &port->slock, V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_TOP, sizeof(struct cx23885_buffer), port); } err = dvb_register(port); if (err != 0) - printk("%s() dvb_register failed err = %d\n", __func__, err); + printk(KERN_ERR "%s() dvb_register failed err = %d\n", + __func__, err); return err; } @@ -613,15 +619,9 @@ int cx23885_dvb_unregister(struct cx23885_tsport *port) * implement MFE support. */ fe0 = videobuf_dvb_get_frontend(&port->frontends, 1); - if(fe0->dvb.frontend) + if (fe0->dvb.frontend) videobuf_dvb_unregister_bus(&port->frontends); return 0; } -/* - * Local variables: - * c-basic-offset: 8 - * End: - * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off -*/ diff --git a/linux/drivers/media/video/cx23885/cx23885-i2c.c b/linux/drivers/media/video/cx23885/cx23885-i2c.c index 6f3a43607..ced5648d8 100644 --- a/linux/drivers/media/video/cx23885/cx23885-i2c.c +++ b/linux/drivers/media/video/cx23885/cx23885-i2c.c @@ -132,7 +132,7 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap, printk(" >\n"); } - for (cnt = 1; cnt < msg->len; cnt++ ) { + for (cnt = 1; cnt < msg->len; cnt++) { /* following bytes */ wdata = msg->buf[cnt]; ctrl = bus->i2c_period | (1 << 12) | (1 << 2); @@ -152,9 +152,9 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap, if (retval == 0) goto eio; if (i2c_debug) { - printk(" %02x", msg->buf[cnt]); + dprintk(1, " %02x", msg->buf[cnt]); if (!(ctrl & I2C_NOSTOP)) - printk(" >\n"); + dprintk(1, " >\n"); } } return msg->len; @@ -163,7 +163,7 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap, retval = -EIO; err: if (i2c_debug) - printk(" ERR: %d\n", retval); + printk(KERN_ERR " ERR: %d\n", retval); return retval; } @@ -195,12 +195,12 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap, if (i2c_debug) { if (joined) - printk(" R"); + dprintk(1, " R"); else - printk(" addr << 1) + 1); + dprintk(1, " addr << 1) + 1); } - for(cnt = 0; cnt < msg->len; cnt++) { + for (cnt = 0; cnt < msg->len; cnt++) { ctrl = bus->i2c_period | (1 << 12) | (1 << 2) | 1; @@ -217,9 +217,9 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap, goto eio; msg->buf[cnt] = cx_read(bus->reg_rdata) & 0xff; if (i2c_debug) { - printk(" %02x", msg->buf[cnt]); + dprintk(1, " %02x", msg->buf[cnt]); if (!(ctrl & I2C_NOSTOP)) - printk(" >\n"); + dprintk(1, " >\n"); } } return msg->len; @@ -228,7 +228,7 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap, retval = -EIO; err: if (i2c_debug) - printk(" ERR: %d\n", retval); + printk(KERN_ERR " ERR: %d\n", retval); return retval; } @@ -372,17 +372,17 @@ static struct i2c_client cx23885_i2c_client_template = { }; static char *i2c_devs[128] = { - [0x10 >> 1] = "tda10048", - [0x12 >> 1] = "dib7000pc", - [ 0x1c >> 1 ] = "lgdt3303", - [ 0x86 >> 1 ] = "tda9887", - [ 0x32 >> 1 ] = "cx24227", - [ 0x88 >> 1 ] = "cx25837", - [ 0x84 >> 1 ] = "tda8295", - [ 0xa0 >> 1 ] = "eeprom", - [ 0xc0 >> 1 ] = "tuner/mt2131/tda8275", + [0x10 >> 1] = "tda10048", + [0x12 >> 1] = "dib7000pc", + [0x1c >> 1] = "lgdt3303", + [0x86 >> 1] = "tda9887", + [0x32 >> 1] = "cx24227", + [0x88 >> 1] = "cx25837", + [0x84 >> 1] = "tda8295", + [0xa0 >> 1] = "eeprom", + [0xc0 >> 1] = "tuner/mt2131/tda8275", [0xc2 >> 1] = "tuner/mt2131/tda8275/xc5000/xc3028", - [0xc8 >> 1] = "tuner/xc3028L", + [0xc8 >> 1] = "tuner/xc3028L", }; static void do_i2c_scan(char *name, struct i2c_client *c) @@ -395,7 +395,7 @@ static void do_i2c_scan(char *name, struct i2c_client *c) rc = i2c_master_recv(c, &buf, 0); if (rc < 0) continue; - printk("%s: i2c scan: found device @ 0x%x [%s]\n", + printk(KERN_INFO "%s: i2c scan: found device @ 0x%x [%s]\n", name, i << 1, i2c_devs[i] ? i2c_devs[i] : "???"); } } @@ -427,11 +427,12 @@ int cx23885_i2c_register(struct cx23885_i2c *bus) bus->i2c_client.adapter = &bus->i2c_adap; if (0 == bus->i2c_rc) { - printk("%s: i2c bus %d registered\n", dev->name, bus->nr); + dprintk(1, "%s: i2c bus %d registered\n", dev->name, bus->nr); if (i2c_scan) do_i2c_scan(dev->name, &bus->i2c_client); } else - printk("%s: i2c bus %d register FAILED\n", dev->name, bus->nr); + printk(KERN_WARNING "%s: i2c bus %d register FAILED\n", + dev->name, bus->nr); return bus->i2c_rc; } diff --git a/linux/drivers/media/video/cx23885/cx23885-video.c b/linux/drivers/media/video/cx23885/cx23885-video.c index 70333ee2b..bac79fff4 100644 --- a/linux/drivers/media/video/cx23885/cx23885-video.c +++ b/linux/drivers/media/video/cx23885/cx23885-video.c @@ -320,11 +320,10 @@ static void cx23885_video_wakeup(struct cx23885_dev *dev, list_del(&buf->vb.queue); wake_up(&buf->vb.done); } - if (list_empty(&q->active)) { + if (list_empty(&q->active)) del_timer(&q->timeout); - } else { + else mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); - } if (bc != 1) printk(KERN_ERR "%s: %d buffers handled (should be 1)\n", __func__, bc); @@ -414,12 +413,12 @@ static int res_get(struct cx23885_dev *dev, struct cx23885_fh *fh, static int res_check(struct cx23885_fh *fh, unsigned int bit) { - return (fh->resources & bit); + return fh->resources & bit; } static int res_locked(struct cx23885_dev *dev, unsigned int bit) { - return (dev->resources & bit); + return dev->resources & bit; } static void res_free(struct cx23885_dev *dev, struct cx23885_fh *fh, @@ -964,14 +963,16 @@ static int video_mmap(struct file *file, struct vm_area_struct *vma) /* ------------------------------------------------------------------ */ /* VIDEO CTRL IOCTLS */ -static int cx23885_get_control(struct cx23885_dev *dev, struct v4l2_control *ctl) +static int cx23885_get_control(struct cx23885_dev *dev, + struct v4l2_control *ctl) { dprintk(1, "%s() calling cx25840(VIDIOC_G_CTRL)\n", __func__); cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_G_CTRL, ctl); return 0; } -static int cx23885_set_control(struct cx23885_dev *dev, struct v4l2_control *ctl) +static int cx23885_set_control(struct cx23885_dev *dev, + struct v4l2_control *ctl) { dprintk(1, "%s() calling cx25840(VIDIOC_S_CTRL)" " (disabled - no action)\n", __func__); @@ -1156,29 +1157,29 @@ static int vidioc_reqbufs(struct file *file, void *priv, struct v4l2_requestbuffers *p) { struct cx23885_fh *fh = priv; - return (videobuf_reqbufs(get_queue(fh), p)); + return videobuf_reqbufs(get_queue(fh), p); } static int vidioc_querybuf(struct file *file, void *priv, struct v4l2_buffer *p) { struct cx23885_fh *fh = priv; - return (videobuf_querybuf(get_queue(fh), p)); + return videobuf_querybuf(get_queue(fh), p); } static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *p) { struct cx23885_fh *fh = priv; - return (videobuf_qbuf(get_queue(fh), p)); + return videobuf_qbuf(get_queue(fh), p); } static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p) { struct cx23885_fh *fh = priv; - return (videobuf_dqbuf(get_queue(fh), p, - file->f_flags & O_NONBLOCK)); + return videobuf_dqbuf(get_queue(fh), p, + file->f_flags & O_NONBLOCK); } static int vidioc_streamon(struct file *file, void *priv, diff --git a/linux/drivers/media/video/cx23885/cx23885.h b/linux/drivers/media/video/cx23885/cx23885.h index 2dde9e01a..26f755354 100644 --- a/linux/drivers/media/video/cx23885/cx23885.h +++ b/linux/drivers/media/video/cx23885/cx23885.h @@ -38,7 +38,7 @@ #include #include -#define CX23885_VERSION_CODE KERNEL_VERSION(0,0,1) +#define CX23885_VERSION_CODE KERNEL_VERSION(0, 0, 1) #define UNSET (-1U) @@ -371,14 +371,14 @@ struct sram_channel { /* ----------------------------------------------------------- */ #define cx_read(reg) readl(dev->lmmio + ((reg)>>2)) -#define cx_write(reg,value) writel((value), dev->lmmio + ((reg)>>2)) +#define cx_write(reg, value) writel((value), dev->lmmio + ((reg)>>2)) -#define cx_andor(reg,mask,value) \ +#define cx_andor(reg, mask, value) \ writel((readl(dev->lmmio+((reg)>>2)) & ~(mask)) |\ ((value) & (mask)), dev->lmmio+((reg)>>2)) -#define cx_set(reg,bit) cx_andor((reg),(bit),(bit)) -#define cx_clear(reg,bit) cx_andor((reg),(bit),0) +#define cx_set(reg, bit) cx_andor((reg), (bit), (bit)) +#define cx_clear(reg, bit) cx_andor((reg), (bit), 0) /* ----------------------------------------------------------- */ /* cx23885-core.c */ @@ -415,7 +415,8 @@ extern const unsigned int cx23885_bcount; extern struct cx23885_subid cx23885_subids[]; extern const unsigned int cx23885_idcount; -extern int cx23885_tuner_callback(void *priv, int component, int command, int arg); +extern int cx23885_tuner_callback(void *priv, int component, + int command, int arg); extern void cx23885_card_list(struct cx23885_dev *dev); extern int cx23885_ir_init(struct cx23885_dev *dev); extern void cx23885_gpio_setup(struct cx23885_dev *dev); @@ -483,11 +484,3 @@ static inline unsigned int norm_swidth(v4l2_std_id norm) { return (norm & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 754 : 922; } - - -/* - * Local variables: - * c-basic-offset: 8 - * End: - * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off - */ -- cgit v1.2.3 From 2f40c03684f4c9466f00964195e2d0a6bbd9fea9 Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 16 Oct 2008 19:19:41 -0400 Subject: au0828: Checkpatch compliance From: Steven Toth au0828: Checkpatch compliance Priority: normal Signed-off-by: Steven Toth --- linux/drivers/media/video/au0828/au0828-cards.c | 2 +- linux/drivers/media/video/au0828/au0828-core.c | 3 ++- linux/drivers/media/video/au0828/au0828-dvb.c | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/au0828/au0828-cards.c b/linux/drivers/media/video/au0828/au0828-cards.c index 66e0edd58..d60123b41 100644 --- a/linux/drivers/media/video/au0828/au0828-cards.c +++ b/linux/drivers/media/video/au0828/au0828-cards.c @@ -186,7 +186,7 @@ void au0828_gpio_setup(struct au0828_dev *dev) } /* table of devices that work with this driver */ -struct usb_device_id au0828_usb_id_table [] = { +struct usb_device_id au0828_usb_id_table[] = { { USB_DEVICE(0x2040, 0x7200), .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q }, { USB_DEVICE(0x2040, 0x7240), diff --git a/linux/drivers/media/video/au0828/au0828-core.c b/linux/drivers/media/video/au0828/au0828-core.c index 59dcb3255..05e38f41c 100644 --- a/linux/drivers/media/video/au0828/au0828-core.c +++ b/linux/drivers/media/video/au0828/au0828-core.c @@ -92,7 +92,8 @@ static int send_control_msg(struct au0828_dev *dev, u16 request, u32 value, status = usb_control_msg(dev->usbdev, usb_sndctrlpipe(dev->usbdev, 0), request, - USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + USB_DIR_OUT | USB_TYPE_VENDOR | + USB_RECIP_DEVICE, value, index, cp, size, 1000); diff --git a/linux/drivers/media/video/au0828/au0828-dvb.c b/linux/drivers/media/video/au0828/au0828-dvb.c index bc76e4079..9966f83d5 100644 --- a/linux/drivers/media/video/au0828/au0828-dvb.c +++ b/linux/drivers/media/video/au0828/au0828-dvb.c @@ -178,7 +178,8 @@ static int start_urb_transfer(struct au0828_dev *dev) purb->status = -EINPROGRESS; usb_fill_bulk_urb(purb, dev->usbdev, - usb_rcvbulkpipe(dev->usbdev, _AU0828_BULKPIPE), + usb_rcvbulkpipe(dev->usbdev, + _AU0828_BULKPIPE), purb->transfer_buffer, URB_BUFSIZE, urb_completion, -- cgit v1.2.3 From 605e4905bc77658905f5647c576c05a1592ffbd7 Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 16 Oct 2008 19:20:51 -0400 Subject: cx24116: Checkpatch compliance From: Steven Toth cx24116: Checkpatch compliance Priority: normal Signed-off-by: Steven Toth --- linux/drivers/media/dvb/frontends/cx24116.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/frontends/cx24116.h b/linux/drivers/media/dvb/frontends/cx24116.h index 8dbcec268..2b09e1087 100644 --- a/linux/drivers/media/dvb/frontends/cx24116.h +++ b/linux/drivers/media/dvb/frontends/cx24116.h @@ -45,7 +45,7 @@ extern struct dvb_frontend* cx24116_attach(const struct cx24116_config* config, static inline struct dvb_frontend* cx24116_attach(const struct cx24116_config* config, struct i2c_adapter* i2c) { - printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); + printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); return NULL; } #endif // CONFIG_DVB_CX24116 -- cgit v1.2.3 From a57fcf425f1711f9980d65e5bae15e72855e80ff Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 16 Oct 2008 19:22:01 -0400 Subject: cx24116: Checkpatch compliance #2 From: Steven Toth cx24116: Checkpatch compliance #2 Priority: normal Signed-off-by: Steven Toth --- linux/drivers/media/dvb/frontends/cx24116.c | 497 +++++++++++++++------------- linux/drivers/media/dvb/frontends/cx24116.h | 19 +- 2 files changed, 268 insertions(+), 248 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/frontends/cx24116.c b/linux/drivers/media/dvb/frontends/cx24116.c index 3c58b9f57..36a1401ed 100644 --- a/linux/drivers/media/dvb/frontends/cx24116.c +++ b/linux/drivers/media/dvb/frontends/cx24116.c @@ -41,10 +41,14 @@ #include "dvb_frontend.h" #include "cx24116.h" -static int debug = 0; +static int debug; +module_param(debug, int, 0644); +MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)"); + #define dprintk(args...) \ do { \ - if (debug) printk ("cx24116: " args); \ + if (debug) \ + printk("cx24116: " args); \ } while (0) #define CX24116_DEFAULT_FIRMWARE "dvb-fe-cx24116.fw" @@ -116,12 +120,15 @@ static int debug = 0; /* DiSEqC tone burst */ static int toneburst = 1; +module_param(toneburst, int, 0644); +MODULE_PARM_DESC(toneburst, "DiSEqC toneburst 0=OFF, 1=TONE CACHE, 2=MESSAGE CACHE (default:1)"); /* SNR measurements */ -static int esno_snr = 0; +static int esno_snr; +module_param(esno_snr, int, 0644); +MODULE_PARM_DESC(debug, "SNR return units, 0=PERCENTAGE 0-100, 1=ESNO(db * 10) (default:0)"); -enum cmds -{ +enum cmds { CMD_SET_VCO = 0x10, CMD_TUNEREQUEST = 0x11, CMD_MPEGCONFIG = 0x13, @@ -138,8 +145,7 @@ enum cmds }; /* The Demod/Tuner can't easily provide these, we cache them */ -struct cx24116_tuning -{ +struct cx24116_tuning { u32 frequency; u32 symbol_rate; fe_spectral_inversion_t inversion; @@ -158,16 +164,14 @@ struct cx24116_tuning }; /* Basic commands that are sent to the firmware */ -struct cx24116_cmd -{ +struct cx24116_cmd { u8 len; u8 args[CX24116_ARGLEN]; }; -struct cx24116_state -{ - struct i2c_adapter* i2c; - const struct cx24116_config* config; +struct cx24116_state { + struct i2c_adapter *i2c; + const struct cx24116_config *config; struct dvb_frontend frontend; @@ -179,18 +183,19 @@ struct cx24116_state struct cx24116_cmd dsec_cmd; }; -static int cx24116_writereg(struct cx24116_state* state, int reg, int data) +static int cx24116_writereg(struct cx24116_state *state, int reg, int data) { u8 buf[] = { reg, data }; struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 }; int err; - if (debug>1) + if (debug > 1) printk("cx24116: %s: write reg 0x%02x, value 0x%02x\n", - __func__,reg, data); + __func__, reg, data); - if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { + err = i2c_transfer(state->i2c, &msg, 1); + if (err != 1) { printk("%s: writereg error(err == %i, reg == 0x%02x," " value == 0x%02x)\n", __func__, err, reg, data); return -EREMOTEIO; @@ -200,7 +205,8 @@ static int cx24116_writereg(struct cx24116_state* state, int reg, int data) } /* Bulk byte writes to a single I2C address, for 32k firmware load */ -static int cx24116_writeregN(struct cx24116_state* state, int reg, u8 *data, u16 len) +static int cx24116_writeregN(struct cx24116_state *state, int reg, + u8 *data, u16 len) { int ret = -EREMOTEIO; struct i2c_msg msg; @@ -221,11 +227,12 @@ static int cx24116_writeregN(struct cx24116_state* state, int reg, u8 *data, u16 msg.buf = buf; msg.len = len + 1; - if (debug>1) + if (debug > 1) printk("cx24116: %s: write regN 0x%02x, len = %d\n", - __func__,reg, len); + __func__, reg, len); - if ((ret = i2c_transfer(state->i2c, &msg, 1)) != 1) { + ret = i2c_transfer(state->i2c, &msg, 1); + if (ret != 1) { printk("%s: writereg error(err == %i, reg == 0x%02x\n", __func__, ret, reg); ret = -EREMOTEIO; @@ -237,14 +244,16 @@ error: return ret; } -static int cx24116_readreg(struct cx24116_state* state, u8 reg) +static int cx24116_readreg(struct cx24116_state *state, u8 reg) { int ret; u8 b0[] = { reg }; u8 b1[] = { 0 }; struct i2c_msg msg[] = { - { .addr = state->config->demod_address, .flags = 0, .buf = b0, .len = 1 }, - { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 } + { .addr = state->config->demod_address, .flags = 0, + .buf = b0, .len = 1 }, + { .addr = state->config->demod_address, .flags = I2C_M_RD, + .buf = b1, .len = 1 } }; ret = i2c_transfer(state->i2c, msg, 2); @@ -254,13 +263,14 @@ static int cx24116_readreg(struct cx24116_state* state, u8 reg) return ret; } - if (debug>1) - printk("cx24116: read reg 0x%02x, value 0x%02x\n",reg, b1[0]); + if (debug > 1) + printk("cx24116: read reg 0x%02x, value 0x%02x\n", + reg, b1[0]); return b1[0]; } -static int cx24116_set_inversion(struct cx24116_state* state, fe_spectral_inversion_t inversion) +static int cx24116_set_inversion(struct cx24116_state *state, fe_spectral_inversion_t inversion) { dprintk("%s(%d)\n", __func__, inversion); @@ -389,18 +399,16 @@ struct cx24116_modfec { */ }; -static int cx24116_lookup_fecmod(struct cx24116_state* state, +static int cx24116_lookup_fecmod(struct cx24116_state *state, fe_modulation_t m, fe_code_rate_t f) { int i, ret = -EOPNOTSUPP; dprintk("%s(0x%02x,0x%02x)\n", __func__, m, f); - for(i=0 ; i < sizeof(CX24116_MODFEC_MODES) / sizeof(struct cx24116_modfec) ; i++) - { - if( (m == CX24116_MODFEC_MODES[i].modulation) && - (f == CX24116_MODFEC_MODES[i].fec) ) - { + for (i = 0; i < ARRAY_SIZE(CX24116_MODFEC_MODES); i++) { + if ((m == CX24116_MODFEC_MODES[i].modulation) && + (f == CX24116_MODFEC_MODES[i].fec)) { ret = i; break; } @@ -409,7 +417,7 @@ static int cx24116_lookup_fecmod(struct cx24116_state* state, return ret; } -static int cx24116_set_fec(struct cx24116_state* state, fe_modulation_t mod, fe_code_rate_t fec) +static int cx24116_set_fec(struct cx24116_state *state, fe_modulation_t mod, fe_code_rate_t fec) { int ret = 0; @@ -417,7 +425,7 @@ static int cx24116_set_fec(struct cx24116_state* state, fe_modulation_t mod, fe_ ret = cx24116_lookup_fecmod(state, mod, fec); - if(ret < 0) + if (ret < 0) return ret; state->dnxt.fec = fec; @@ -429,7 +437,7 @@ static int cx24116_set_fec(struct cx24116_state* state, fe_modulation_t mod, fe_ return 0; } -static int cx24116_set_symbolrate(struct cx24116_state* state, u32 rate) +static int cx24116_set_symbolrate(struct cx24116_state *state, u32 rate) { dprintk("%s(%d)\n", __func__, rate); @@ -446,18 +454,18 @@ static int cx24116_set_symbolrate(struct cx24116_state* state, u32 rate) return 0; } -static int cx24116_load_firmware (struct dvb_frontend* fe, const struct firmware *fw); +static int cx24116_load_firmware(struct dvb_frontend *fe, + const struct firmware *fw); -static int cx24116_firmware_ondemand(struct dvb_frontend* fe) +static int cx24116_firmware_ondemand(struct dvb_frontend *fe) { struct cx24116_state *state = fe->demodulator_priv; const struct firmware *fw; int ret = 0; - dprintk("%s()\n",__func__); + dprintk("%s()\n", __func__); - if (cx24116_readreg(state, 0x20) > 0) - { + if (cx24116_readreg(state, 0x20) > 0) { if (state->skip_fw_load) return 0; @@ -491,7 +499,7 @@ static int cx24116_firmware_ondemand(struct dvb_frontend* fe) } /* Take a basic firmware command structure, format it and forward it for processing */ -static int cx24116_cmd_execute(struct dvb_frontend* fe, struct cx24116_cmd *cmd) +static int cx24116_cmd_execute(struct dvb_frontend *fe, struct cx24116_cmd *cmd) { struct cx24116_state *state = fe->demodulator_priv; int i, ret; @@ -499,26 +507,23 @@ static int cx24116_cmd_execute(struct dvb_frontend* fe, struct cx24116_cmd *cmd) dprintk("%s()\n", __func__); /* Load the firmware if required */ - if ( (ret = cx24116_firmware_ondemand(fe)) != 0) - { + ret = cx24116_firmware_ondemand(fe); + if (ret != 0) { printk("%s(): Unable initialise the firmware\n", __func__); return ret; } /* Write the command */ - for(i = 0; i < cmd->len ; i++) - { + for (i = 0; i < cmd->len ; i++) { dprintk("%s: 0x%02x == 0x%02x\n", __func__, i, cmd->args[i]); cx24116_writereg(state, i, cmd->args[i]); } /* Start execution and wait for cmd to terminate */ cx24116_writereg(state, CX24116_REG_EXECUTE, 0x01); - while( cx24116_readreg(state, CX24116_REG_EXECUTE) ) - { + while (cx24116_readreg(state, CX24116_REG_EXECUTE)) { msleep(10); - if(i++ > 64) - { + if (i++ > 64) { /* Avoid looping forever if the firmware does no respond */ printk("%s() Firmware not responding\n", __func__); return -EREMOTEIO; @@ -527,21 +532,21 @@ static int cx24116_cmd_execute(struct dvb_frontend* fe, struct cx24116_cmd *cmd) return 0; } -static int cx24116_load_firmware (struct dvb_frontend* fe, const struct firmware *fw) +static int cx24116_load_firmware(struct dvb_frontend *fe, + const struct firmware *fw) { - struct cx24116_state* state = fe->demodulator_priv; + struct cx24116_state *state = fe->demodulator_priv; struct cx24116_cmd cmd; int i, ret; unsigned char vers[4]; dprintk("%s\n", __func__); - dprintk("Firmware is %zu bytes (%02x %02x .. %02x %02x)\n" - ,fw->size - ,fw->data[0] - ,fw->data[1] - ,fw->data[ fw->size-2 ] - ,fw->data[ fw->size-1 ] - ); + dprintk("Firmware is %zu bytes (%02x %02x .. %02x %02x)\n", + fw->size, + fw->data[0], + fw->data[1], + fw->data[fw->size-2], + fw->data[fw->size-1]); /* Toggle 88x SRST pin to reset demod */ if (state->config->reset_device) @@ -587,7 +592,7 @@ static int cx24116_load_firmware (struct dvb_frontend* fe, const struct firmware cmd.args[0x07] = 0x9d; cmd.args[0x08] = 0xfc; cmd.args[0x09] = 0x06; - cmd.len= 0x0a; + cmd.len = 0x0a; ret = cx24116_cmd_execute(fe, &cmd); if (ret != 0) return ret; @@ -598,7 +603,7 @@ static int cx24116_load_firmware (struct dvb_frontend* fe, const struct firmware cmd.args[0x00] = CMD_TUNERINIT; cmd.args[0x01] = 0x00; cmd.args[0x02] = 0x00; - cmd.len= 0x03; + cmd.len = 0x03; ret = cx24116_cmd_execute(fe, &cmd); if (ret != 0) return ret; @@ -615,20 +620,20 @@ static int cx24116_load_firmware (struct dvb_frontend* fe, const struct firmware else cmd.args[0x04] = 0x02; cmd.args[0x05] = 0x00; - cmd.len= 0x06; + cmd.len = 0x06; ret = cx24116_cmd_execute(fe, &cmd); if (ret != 0) return ret; /* Firmware CMD 35: Get firmware version */ cmd.args[0x00] = CMD_UPDFWVERS; - cmd.len= 0x02; - for(i=0; i<4; i++) { + cmd.len = 0x02; + for (i = 0; i < 4; i++) { cmd.args[0x01] = i; ret = cx24116_cmd_execute(fe, &cmd); if (ret != 0) return ret; - vers[i]= cx24116_readreg(state, CX24116_REG_MAILBOX); + vers[i] = cx24116_readreg(state, CX24116_REG_MAILBOX); } printk("%s: FW version %i.%i.%i.%i\n", __func__, vers[0], vers[1], vers[2], vers[3]); @@ -636,15 +641,17 @@ static int cx24116_load_firmware (struct dvb_frontend* fe, const struct firmware return 0; } -static int cx24116_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage) +static int cx24116_set_voltage(struct dvb_frontend *fe, + fe_sec_voltage_t voltage) { /* The isl6421 module will override this function in the fops. */ - dprintk("%s() This should never appear if the isl6421 module is loaded correctly\n",__func__); + dprintk("%s() This should never appear if the isl6421 module " + "is loaded correctly\n", __func__); return -EOPNOTSUPP; } -static int cx24116_read_status(struct dvb_frontend* fe, fe_status_t* status) +static int cx24116_read_status(struct dvb_frontend *fe, fe_status_t *status) { struct cx24116_state *state = fe->demodulator_priv; @@ -666,22 +673,23 @@ static int cx24116_read_status(struct dvb_frontend* fe, fe_status_t* status) return 0; } -static int cx24116_read_ber(struct dvb_frontend* fe, u32* ber) +static int cx24116_read_ber(struct dvb_frontend *fe, u32 *ber) { struct cx24116_state *state = fe->demodulator_priv; dprintk("%s()\n", __func__); - *ber = ( cx24116_readreg(state, CX24116_REG_BER24) << 24 ) | - ( cx24116_readreg(state, CX24116_REG_BER16) << 16 ) | - ( cx24116_readreg(state, CX24116_REG_BER8 ) << 8 ) | - cx24116_readreg(state, CX24116_REG_BER0 ); + *ber = (cx24116_readreg(state, CX24116_REG_BER24) << 24) | + (cx24116_readreg(state, CX24116_REG_BER16) << 16) | + (cx24116_readreg(state, CX24116_REG_BER8) << 8) | + cx24116_readreg(state, CX24116_REG_BER0); return 0; } /* TODO Determine function and scale appropriately */ -static int cx24116_read_signal_strength(struct dvb_frontend* fe, u16* signal_strength) +static int cx24116_read_signal_strength(struct dvb_frontend *fe, + u16 *signal_strength) { struct cx24116_state *state = fe->demodulator_priv; struct cx24116_cmd cmd; @@ -692,39 +700,43 @@ static int cx24116_read_signal_strength(struct dvb_frontend* fe, u16* signal_str /* Firmware CMD 19: Get AGC */ cmd.args[0x00] = CMD_GETAGC; - cmd.len= 0x01; + cmd.len = 0x01; ret = cx24116_cmd_execute(fe, &cmd); if (ret != 0) return ret; - sig_reading = ( cx24116_readreg(state, CX24116_REG_SSTATUS) & CX24116_SIGNAL_MASK ) | - ( cx24116_readreg(state, CX24116_REG_SIGNAL) << 6 ); - *signal_strength= 0 - sig_reading; + sig_reading = + (cx24116_readreg(state, + CX24116_REG_SSTATUS) & CX24116_SIGNAL_MASK) | + (cx24116_readreg(state, CX24116_REG_SIGNAL) << 6); + *signal_strength = 0 - sig_reading; - dprintk("%s: raw / cooked = 0x%04x / 0x%04x\n", __func__, sig_reading, *signal_strength); + dprintk("%s: raw / cooked = 0x%04x / 0x%04x\n", + __func__, sig_reading, *signal_strength); return 0; } /* SNR (0..100)% = (sig & 0xf0) * 10 + (sig & 0x0f) * 10 / 16 */ -static int cx24116_read_snr_pct(struct dvb_frontend* fe, u16* snr) +static int cx24116_read_snr_pct(struct dvb_frontend *fe, u16 *snr) { struct cx24116_state *state = fe->demodulator_priv; u8 snr_reading; static const u32 snr_tab[] = { /* 10 x Table (rounded up) */ - 0x00000,0x0199A,0x03333,0x04ccD,0x06667, - 0x08000,0x0999A,0x0b333,0x0cccD,0x0e667, - 0x10000,0x1199A,0x13333,0x14ccD,0x16667,0x18000 }; + 0x00000, 0x0199A, 0x03333, 0x04ccD, 0x06667, + 0x08000, 0x0999A, 0x0b333, 0x0cccD, 0x0e667, + 0x10000, 0x1199A, 0x13333, 0x14ccD, 0x16667, + 0x18000 }; dprintk("%s()\n", __func__); snr_reading = cx24116_readreg(state, CX24116_REG_QUALITY0); - if(snr_reading >= 0xa0 /* 100% */) + if (snr_reading >= 0xa0 /* 100% */) *snr = 0xffff; else - *snr = snr_tab [ ( snr_reading & 0xf0 ) >> 4 ] + - ( snr_tab [ ( snr_reading & 0x0f ) ] >> 4 ); + *snr = snr_tab[(snr_reading & 0xf0) >> 4] + + (snr_tab[(snr_reading & 0x0f)] >> 4); dprintk("%s: raw / cooked = 0x%02x / 0x%04x\n", __func__, snr_reading, *snr); @@ -736,7 +748,7 @@ static int cx24116_read_snr_pct(struct dvb_frontend* fe, u16* snr) * ESNO, from 0->30db (values 0->300). We provide this value by * default. */ -static int cx24116_read_snr_esno(struct dvb_frontend* fe, u16* snr) +static int cx24116_read_snr_esno(struct dvb_frontend *fe, u16 *snr) { struct cx24116_state *state = fe->demodulator_priv; @@ -750,7 +762,7 @@ static int cx24116_read_snr_esno(struct dvb_frontend* fe, u16* snr) return 0; } -static int cx24116_read_snr(struct dvb_frontend* fe, u16* snr) +static int cx24116_read_snr(struct dvb_frontend *fe, u16 *snr) { if (esno_snr == 1) return cx24116_read_snr_esno(fe, snr); @@ -758,27 +770,27 @@ static int cx24116_read_snr(struct dvb_frontend* fe, u16* snr) return cx24116_read_snr_pct(fe, snr); } -static int cx24116_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) +static int cx24116_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) { struct cx24116_state *state = fe->demodulator_priv; dprintk("%s()\n", __func__); - *ucblocks = ( cx24116_readreg(state, CX24116_REG_UCB8) << 8 ) | + *ucblocks = (cx24116_readreg(state, CX24116_REG_UCB8) << 8) | cx24116_readreg(state, CX24116_REG_UCB0); return 0; } /* Overwrite the current tuning params, we are about to tune */ -static void cx24116_clone_params(struct dvb_frontend* fe) +static void cx24116_clone_params(struct dvb_frontend *fe) { struct cx24116_state *state = fe->demodulator_priv; memcpy(&state->dcur, &state->dnxt, sizeof(state->dcur)); } /* Wait for LNB */ -static int cx24116_wait_for_lnb(struct dvb_frontend* fe) +static int cx24116_wait_for_lnb(struct dvb_frontend *fe) { struct cx24116_state *state = fe->demodulator_priv; int i; @@ -787,7 +799,7 @@ static int cx24116_wait_for_lnb(struct dvb_frontend* fe) cx24116_readreg(state, CX24116_REG_QSTATUS)); /* Wait for up to 300 ms */ - for(i = 0; i < 30 ; i++) { + for (i = 0; i < 30 ; i++) { if (cx24116_readreg(state, CX24116_REG_QSTATUS) & 0x20) return 0; msleep(10); @@ -798,20 +810,21 @@ static int cx24116_wait_for_lnb(struct dvb_frontend* fe) return -ETIMEDOUT; /* -EBUSY ? */ } -static int cx24116_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) +static int cx24116_set_tone(struct dvb_frontend *fe, + fe_sec_tone_mode_t tone) { struct cx24116_cmd cmd; int ret; dprintk("%s(%d)\n", __func__, tone); - if ( (tone != SEC_TONE_ON) && (tone != SEC_TONE_OFF) ) { + if ((tone != SEC_TONE_ON) && (tone != SEC_TONE_OFF)) { printk("%s: Invalid, tone=%d\n", __func__, tone); return -EINVAL; } /* Wait for LNB ready */ ret = cx24116_wait_for_lnb(fe); - if(ret != 0) + if (ret != 0) return ret; /* Min delay time after DiSEqC send */ @@ -820,7 +833,7 @@ static int cx24116_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) /* This is always done before the tone is set */ cmd.args[0x00] = CMD_SET_TONEPRE; cmd.args[0x01] = 0x00; - cmd.len= 0x02; + cmd.len = 0x02; ret = cx24116_cmd_execute(fe, &cmd); if (ret != 0) return ret; @@ -836,11 +849,11 @@ static int cx24116_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) cmd.args[0x03] = 0x01; break; case SEC_TONE_OFF: - dprintk("%s: setting tone off\n",__func__); + dprintk("%s: setting tone off\n", __func__); cmd.args[0x03] = 0x00; break; } - cmd.len= 0x04; + cmd.len = 0x04; /* Min delay time before DiSEqC send */ msleep(15); /* XXX determine is FW does this, see send_diseqc/burst */ @@ -849,7 +862,7 @@ static int cx24116_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) } /* Initialise DiSEqC */ -static int cx24116_diseqc_init(struct dvb_frontend* fe) +static int cx24116_diseqc_init(struct dvb_frontend *fe) { struct cx24116_state *state = fe->demodulator_priv; struct cx24116_cmd cmd; @@ -864,7 +877,7 @@ static int cx24116_diseqc_init(struct dvb_frontend* fe) cmd.args[0x05] = 0x28; cmd.args[0x06] = (toneburst == CX24116_DISEQC_TONEOFF) ? 0x00 : 0x01; cmd.args[0x07] = 0x01; - cmd.len= 0x08; + cmd.len = 0x08; ret = cx24116_cmd_execute(fe, &cmd); if (ret != 0) return ret; @@ -884,13 +897,14 @@ static int cx24116_diseqc_init(struct dvb_frontend* fe) state->dsec_cmd.args[CX24116_DISEQC_MSGLEN] = 0x00; /* Command length */ - state->dsec_cmd.len= CX24116_DISEQC_MSGOFS; + state->dsec_cmd.len = CX24116_DISEQC_MSGOFS; return 0; } /* Send DiSEqC message with derived burst (hack) || previous burst */ -static int cx24116_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd *d) +static int cx24116_send_diseqc_msg(struct dvb_frontend *fe, + struct dvb_diseqc_master_cmd *d) { struct cx24116_state *state = fe->demodulator_priv; int i, ret; @@ -898,16 +912,16 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_ma /* Dump DiSEqC message */ if (debug) { printk("cx24116: %s(", __func__); - for(i = 0 ; i < d->msg_len ;) { + for (i = 0 ; i < d->msg_len ;) { printk("0x%02x", d->msg[i]); - if(++i < d->msg_len) + if (++i < d->msg_len) printk(", "); - } + } printk(") toneburst=%d\n", toneburst); } /* Validate length */ - if(d->msg_len > (CX24116_ARGLEN - CX24116_DISEQC_MSGOFS)) + if (d->msg_len > (CX24116_ARGLEN - CX24116_DISEQC_MSGOFS)) return -EINVAL; /* DiSEqC message */ @@ -918,18 +932,19 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_ma state->dsec_cmd.args[CX24116_DISEQC_MSGLEN] = d->msg_len; /* Command length */ - state->dsec_cmd.len= CX24116_DISEQC_MSGOFS + state->dsec_cmd.args[CX24116_DISEQC_MSGLEN]; + state->dsec_cmd.len = CX24116_DISEQC_MSGOFS + + state->dsec_cmd.args[CX24116_DISEQC_MSGLEN]; /* DiSEqC toneburst */ - if(toneburst == CX24116_DISEQC_MESGCACHE) + if (toneburst == CX24116_DISEQC_MESGCACHE) /* Message is cached */ return 0; - else if(toneburst == CX24116_DISEQC_TONEOFF) + else if (toneburst == CX24116_DISEQC_TONEOFF) /* Message is sent without burst */ state->dsec_cmd.args[CX24116_DISEQC_BURST] = 0; - else if(toneburst == CX24116_DISEQC_TONECACHE) { + else if (toneburst == CX24116_DISEQC_TONECACHE) { /* * Message is sent with derived else cached burst * @@ -948,15 +963,17 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_ma * Y = VOLTAGE (0=13V, 1=18V) * Z = BAND (0=LOW, 1=HIGH(22K)) */ - if(d->msg_len >= 4 && d->msg[2] == 0x38) - state->dsec_cmd.args[CX24116_DISEQC_BURST] = ((d->msg[3] & 4) >> 2); - if(debug) - dprintk("%s burst=%d\n", __func__, state->dsec_cmd.args[CX24116_DISEQC_BURST]); + if (d->msg_len >= 4 && d->msg[2] == 0x38) + state->dsec_cmd.args[CX24116_DISEQC_BURST] = + ((d->msg[3] & 4) >> 2); + if (debug) + dprintk("%s burst=%d\n", __func__, + state->dsec_cmd.args[CX24116_DISEQC_BURST]); } /* Wait for LNB ready */ ret = cx24116_wait_for_lnb(fe); - if(ret != 0) + if (ret != 0) return ret; /* Wait for voltage/min repeat delay */ @@ -964,7 +981,7 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_ma /* Command */ ret = cx24116_cmd_execute(fe, &state->dsec_cmd); - if(ret != 0) + if (ret != 0) return ret; /* * Wait for send @@ -976,29 +993,33 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_ma * 12.5ms burst + * >15ms delay (XXX determine if FW does this, see set_tone) */ - msleep( (state->dsec_cmd.args[CX24116_DISEQC_MSGLEN] << 4) + ((toneburst == CX24116_DISEQC_TONEOFF) ? 30 : 60) ); + msleep((state->dsec_cmd.args[CX24116_DISEQC_MSGLEN] << 4) + + ((toneburst == CX24116_DISEQC_TONEOFF) ? 30 : 60)); return 0; } /* Send DiSEqC burst */ -static int cx24116_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t burst) +static int cx24116_diseqc_send_burst(struct dvb_frontend *fe, + fe_sec_mini_cmd_t burst) { struct cx24116_state *state = fe->demodulator_priv; int ret; - dprintk("%s(%d) toneburst=%d\n",__func__, burst, toneburst); + dprintk("%s(%d) toneburst=%d\n", __func__, burst, toneburst); /* DiSEqC burst */ if (burst == SEC_MINI_A) - state->dsec_cmd.args[CX24116_DISEQC_BURST] = CX24116_DISEQC_MINI_A; - else if(burst == SEC_MINI_B) - state->dsec_cmd.args[CX24116_DISEQC_BURST] = CX24116_DISEQC_MINI_B; + state->dsec_cmd.args[CX24116_DISEQC_BURST] = + CX24116_DISEQC_MINI_A; + else if (burst == SEC_MINI_B) + state->dsec_cmd.args[CX24116_DISEQC_BURST] = + CX24116_DISEQC_MINI_B; else return -EINVAL; /* DiSEqC toneburst */ - if(toneburst != CX24116_DISEQC_MESGCACHE) + if (toneburst != CX24116_DISEQC_MESGCACHE) /* Burst is cached */ return 0; @@ -1006,7 +1027,7 @@ static int cx24116_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t /* Wait for LNB ready */ ret = cx24116_wait_for_lnb(fe); - if(ret != 0) + if (ret != 0) return ret; /* Wait for voltage/min repeat delay */ @@ -1014,7 +1035,7 @@ static int cx24116_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t /* Command */ ret = cx24116_cmd_execute(fe, &state->dsec_cmd); - if(ret != 0) + if (ret != 0) return ret; /* @@ -1027,27 +1048,27 @@ static int cx24116_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t * 12.5ms burst + * >15ms delay (XXX determine if FW does this, see set_tone) */ - msleep( (state->dsec_cmd.args[CX24116_DISEQC_MSGLEN] << 4) + 60 ); + msleep((state->dsec_cmd.args[CX24116_DISEQC_MSGLEN] << 4) + 60); return 0; } -static void cx24116_release(struct dvb_frontend* fe) +static void cx24116_release(struct dvb_frontend *fe) { - struct cx24116_state* state = fe->demodulator_priv; - dprintk("%s\n",__func__); + struct cx24116_state *state = fe->demodulator_priv; + dprintk("%s\n", __func__); kfree(state); } static struct dvb_frontend_ops cx24116_ops; -struct dvb_frontend* cx24116_attach(const struct cx24116_config* config, - struct i2c_adapter* i2c) +struct dvb_frontend *cx24116_attach(const struct cx24116_config *config, + struct i2c_adapter *i2c) { - struct cx24116_state* state = NULL; + struct cx24116_state *state = NULL; int ret; - dprintk("%s\n",__func__); + dprintk("%s\n", __func__); /* allocate memory for the internal state */ state = kmalloc(sizeof(struct cx24116_state), GFP_KERNEL); @@ -1077,13 +1098,15 @@ struct dvb_frontend* cx24116_attach(const struct cx24116_config* config, error2: kfree(state); error1: return NULL; } +EXPORT_SYMBOL(cx24116_attach); + #if 0 -static int cx24116_get_params(struct dvb_frontend* fe) +static int cx24116_get_params(struct dvb_frontend *fe) { struct cx24116_state *state = fe->demodulator_priv; struct dtv_frontend_properties *cache = &fe->dtv_property_cache; - dprintk("%s()\n",__func__); + dprintk("%s()\n", __func__); cache->frequency = state->dcur.frequency; cache->inversion = state->dcur.inversion; @@ -1099,13 +1122,13 @@ static int cx24116_get_params(struct dvb_frontend* fe) * * Power config will reset and load initial firmware if required */ -static int cx24116_initfe(struct dvb_frontend* fe) +static int cx24116_initfe(struct dvb_frontend *fe) { - struct cx24116_state* state = fe->demodulator_priv; + struct cx24116_state *state = fe->demodulator_priv; struct cx24116_cmd cmd; int ret; - dprintk("%s()\n",__func__); + dprintk("%s()\n", __func__); /* Power on */ cx24116_writereg(state, 0xe0, 0); @@ -1115,9 +1138,9 @@ static int cx24116_initfe(struct dvb_frontend* fe) /* Firmware CMD 36: Power config */ cmd.args[0x00] = CMD_TUNERSLEEP; cmd.args[0x01] = 0; - cmd.len= 0x02; + cmd.len = 0x02; ret = cx24116_cmd_execute(fe, &cmd); - if(ret != 0) + if (ret != 0) return ret; return cx24116_diseqc_init(fe); @@ -1126,20 +1149,20 @@ static int cx24116_initfe(struct dvb_frontend* fe) /* * Put device to sleep */ -static int cx24116_sleep(struct dvb_frontend* fe) +static int cx24116_sleep(struct dvb_frontend *fe) { - struct cx24116_state* state = fe->demodulator_priv; + struct cx24116_state *state = fe->demodulator_priv; struct cx24116_cmd cmd; int ret; - dprintk("%s()\n",__func__); + dprintk("%s()\n", __func__); /* Firmware CMD 36: Power config */ cmd.args[0x00] = CMD_TUNERSLEEP; cmd.args[0x01] = 1; - cmd.len= 0x02; + cmd.len = 0x02; ret = cx24116_cmd_execute(fe, &cmd); - if(ret != 0) + if (ret != 0) return ret; /* Power off (Shutdown clocks) */ @@ -1150,13 +1173,15 @@ static int cx24116_sleep(struct dvb_frontend* fe) return 0; } -static int cx24116_set_property(struct dvb_frontend *fe, struct dtv_property* tvp) +static int cx24116_set_property(struct dvb_frontend *fe, + struct dtv_property *tvp) { dprintk("%s(..)\n", __func__); return 0; } -static int cx24116_get_property(struct dvb_frontend *fe, struct dtv_property* tvp) +static int cx24116_get_property(struct dvb_frontend *fe, + struct dtv_property *tvp) { dprintk("%s(..)\n", __func__); return 0; @@ -1165,7 +1190,8 @@ static int cx24116_get_property(struct dvb_frontend *fe, struct dtv_property* tv /* dvb-core told us to tune, the tv property cache will be complete, * it's safe for is to pull values and use them for tuning purposes. */ -static int cx24116_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) +static int cx24116_set_frontend(struct dvb_frontend *fe, + struct dvb_frontend_parameters *p) { struct cx24116_state *state = fe->demodulator_priv; struct dtv_frontend_properties *c = &fe->dtv_property_cache; @@ -1173,96 +1199,99 @@ static int cx24116_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par fe_status_t tunerstat; int i, status, ret, retune; - dprintk("%s()\n",__func__); + dprintk("%s()\n", __func__); - switch(c->delivery_system) { - case SYS_DVBS: - dprintk("%s: DVB-S delivery system selected\n",__func__); + switch (c->delivery_system) { + case SYS_DVBS: + dprintk("%s: DVB-S delivery system selected\n", __func__); - /* Only QPSK is supported for DVB-S */ - if(c->modulation != QPSK) { - dprintk("%s: unsupported modulation selected (%d)\n", - __func__, c->modulation); - return -EOPNOTSUPP; - } + /* Only QPSK is supported for DVB-S */ + if (c->modulation != QPSK) { + dprintk("%s: unsupported modulation selected (%d)\n", + __func__, c->modulation); + return -EOPNOTSUPP; + } - /* Pilot doesn't exist in DVB-S, turn bit off */ - state->dnxt.pilot_val = CX24116_PILOT_OFF; - retune = 1; + /* Pilot doesn't exist in DVB-S, turn bit off */ + state->dnxt.pilot_val = CX24116_PILOT_OFF; + retune = 1; - /* DVB-S only supports 0.35 */ - if(c->rolloff != ROLLOFF_35) { - dprintk("%s: unsupported rolloff selected (%d)\n", - __func__, c->rolloff); - return -EOPNOTSUPP; - } - state->dnxt.rolloff_val = CX24116_ROLLOFF_035; - break; + /* DVB-S only supports 0.35 */ + if (c->rolloff != ROLLOFF_35) { + dprintk("%s: unsupported rolloff selected (%d)\n", + __func__, c->rolloff); + return -EOPNOTSUPP; + } + state->dnxt.rolloff_val = CX24116_ROLLOFF_035; + break; - case SYS_DVBS2: - dprintk("%s: DVB-S2 delivery system selected\n",__func__); - - /* - * NBC 8PSK/QPSK with DVB-S is supported for DVB-S2, - * but not hardware auto detection - */ - if(c->modulation != PSK_8 && c->modulation != QPSK) { - dprintk("%s: unsupported modulation selected (%d)\n", - __func__, c->modulation); - return -EOPNOTSUPP; - } + case SYS_DVBS2: + dprintk("%s: DVB-S2 delivery system selected\n", __func__); - switch(c->pilot) { - case PILOT_AUTO: /* Not supported but emulated */ - retune = 2; /* Fall-through */ - case PILOT_OFF: - state->dnxt.pilot_val = CX24116_PILOT_OFF; - break; - case PILOT_ON: - state->dnxt.pilot_val = CX24116_PILOT_ON; - break; - default: - dprintk("%s: unsupported pilot mode selected (%d)\n", - __func__, c->pilot); - return -EOPNOTSUPP; - } + /* + * NBC 8PSK/QPSK with DVB-S is supported for DVB-S2, + * but not hardware auto detection + */ + if (c->modulation != PSK_8 && c->modulation != QPSK) { + dprintk("%s: unsupported modulation selected (%d)\n", + __func__, c->modulation); + return -EOPNOTSUPP; + } - switch(c->rolloff) { - case ROLLOFF_20: - state->dnxt.rolloff_val= CX24116_ROLLOFF_020; - break; - case ROLLOFF_25: - state->dnxt.rolloff_val= CX24116_ROLLOFF_025; - break; - case ROLLOFF_35: - state->dnxt.rolloff_val= CX24116_ROLLOFF_035; - break; - case ROLLOFF_AUTO: /* Rolloff must be explicit */ - default: - dprintk("%s: unsupported rolloff selected (%d)\n", - __func__, c->rolloff); - return -EOPNOTSUPP; - } + switch (c->pilot) { + case PILOT_AUTO: /* Not supported but emulated */ + retune = 2; /* Fall-through */ + case PILOT_OFF: + state->dnxt.pilot_val = CX24116_PILOT_OFF; break; + case PILOT_ON: + state->dnxt.pilot_val = CX24116_PILOT_ON; + break; + default: + dprintk("%s: unsupported pilot mode selected (%d)\n", + __func__, c->pilot); + return -EOPNOTSUPP; + } + switch (c->rolloff) { + case ROLLOFF_20: + state->dnxt.rolloff_val = CX24116_ROLLOFF_020; + break; + case ROLLOFF_25: + state->dnxt.rolloff_val = CX24116_ROLLOFF_025; + break; + case ROLLOFF_35: + state->dnxt.rolloff_val = CX24116_ROLLOFF_035; + break; + case ROLLOFF_AUTO: /* Rolloff must be explicit */ default: - dprintk("%s: unsupported delivery system selected (%d)\n", - __func__, c->delivery_system); + dprintk("%s: unsupported rolloff selected (%d)\n", + __func__, c->rolloff); return -EOPNOTSUPP; + } + break; + + default: + dprintk("%s: unsupported delivery system selected (%d)\n", + __func__, c->delivery_system); + return -EOPNOTSUPP; } state->dnxt.modulation = c->modulation; state->dnxt.frequency = c->frequency; state->dnxt.pilot = c->pilot; state->dnxt.rolloff = c->rolloff; - if ((ret = cx24116_set_inversion(state, c->inversion)) != 0) + ret = cx24116_set_inversion(state, c->inversion); + if (ret != 0) return ret; /* FEC_NONE/AUTO for DVB-S2 is not supported and detected here */ - if ((ret = cx24116_set_fec(state, c->modulation, c->fec_inner)) != 0) + ret = cx24116_set_fec(state, c->modulation, c->fec_inner); + if (ret != 0) return ret; - if ((ret = cx24116_set_symbolrate(state, c->symbol_rate)) != 0) + ret = cx24116_set_symbolrate(state, c->symbol_rate); + if (ret != 0) return ret; /* discard the 'current' tuning parameters and prepare to tune */ @@ -1288,7 +1317,7 @@ static int cx24116_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par /* Set/Reset B/W */ cmd.args[0x00] = CMD_BANDWIDTH; cmd.args[0x01] = 0x01; - cmd.len= 0x02; + cmd.len = 0x02; ret = cx24116_cmd_execute(fe, &cmd); if (ret != 0) return ret; @@ -1336,7 +1365,7 @@ static int cx24116_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par cx24116_writereg(state, CX24116_REG_RATEDIV, 0x00); } - cmd.len= 0x13; + cmd.len = 0x13; /* We need to support pilot and non-pilot tuning in the * driver automatically. This is a workaround for because @@ -1344,12 +1373,13 @@ static int cx24116_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par */ do { /* Reset status register */ - status = cx24116_readreg(state, CX24116_REG_SSTATUS) & CX24116_SIGNAL_MASK; + status = cx24116_readreg(state, CX24116_REG_SSTATUS) + & CX24116_SIGNAL_MASK; cx24116_writereg(state, CX24116_REG_SSTATUS, status); /* Tune */ ret = cx24116_cmd_execute(fe, &cmd); - if( ret != 0 ) + if (ret != 0) break; /* @@ -1358,28 +1388,27 @@ static int cx24116_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par * If we are able to tune then generally it occurs within 100ms. * If it takes longer, try a different toneburst setting. */ - for(i = 0; i < 50 ; i++) { + for (i = 0; i < 50 ; i++) { cx24116_read_status(fe, &tunerstat); status = tunerstat & (FE_HAS_SIGNAL | FE_HAS_SYNC); - if(status == (FE_HAS_SIGNAL | FE_HAS_SYNC)) { - dprintk("%s: Tuned\n",__func__); + if (status == (FE_HAS_SIGNAL | FE_HAS_SYNC)) { + dprintk("%s: Tuned\n", __func__); goto tuned; } msleep(10); } - dprintk("%s: Not tuned\n",__func__); + dprintk("%s: Not tuned\n", __func__); /* Toggle pilot bit when in auto-pilot */ - if(state->dcur.pilot == PILOT_AUTO) + if (state->dcur.pilot == PILOT_AUTO) cmd.args[0x07] ^= CX24116_PILOT_ON; - } - while(--retune); + } while (--retune); tuned: /* Set/Reset B/W */ cmd.args[0x00] = CMD_BANDWIDTH; cmd.args[0x01] = 0x00; - cmd.len= 0x02; + cmd.len = 0x02; ret = cx24116_cmd_execute(fe, &cmd); if (ret != 0) return ret; @@ -1424,17 +1453,7 @@ static struct dvb_frontend_ops cx24116_ops = { .set_frontend = cx24116_set_frontend, }; -module_param(debug, int, 0644); -MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)"); - -module_param(toneburst, int, 0644); -MODULE_PARM_DESC(toneburst, "DiSEqC toneburst 0=OFF, 1=TONE CACHE, 2=MESSAGE CACHE (default:1)"); - -module_param(esno_snr, int, 0644); -MODULE_PARM_DESC(debug, "SNR return units, 0=PERCENTAGE 0-100, 1=ESNO(db * 10) (default:0)"); - MODULE_DESCRIPTION("DVB Frontend module for Conexant cx24116/cx24118 hardware"); MODULE_AUTHOR("Steven Toth"); MODULE_LICENSE("GPL"); -EXPORT_SYMBOL(cx24116_attach); diff --git a/linux/drivers/media/dvb/frontends/cx24116.h b/linux/drivers/media/dvb/frontends/cx24116.h index 2b09e1087..4cb3ddd6c 100644 --- a/linux/drivers/media/dvb/frontends/cx24116.h +++ b/linux/drivers/media/dvb/frontends/cx24116.h @@ -23,31 +23,32 @@ #include -struct cx24116_config -{ +struct cx24116_config { /* the demodulator's i2c address */ u8 demod_address; /* Need to set device param for start_dma */ - int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured); + int (*set_ts_params)(struct dvb_frontend *fe, int is_punctured); /* Need to reset device during firmware loading */ - int (*reset_device)(struct dvb_frontend* fe); + int (*reset_device)(struct dvb_frontend *fe); /* Need to set MPEG parameters */ u8 mpg_clk_pos_pol:0x02; }; #if defined(CONFIG_DVB_CX24116) || defined(CONFIG_DVB_CX24116_MODULE) -extern struct dvb_frontend* cx24116_attach(const struct cx24116_config* config, - struct i2c_adapter* i2c); +extern struct dvb_frontend *cx24116_attach( + const struct cx24116_config *config, + struct i2c_adapter *i2c); #else -static inline struct dvb_frontend* cx24116_attach(const struct cx24116_config* config, - struct i2c_adapter* i2c) +static inline struct dvb_frontend *cx24116_attach( + const struct cx24116_config *config, + struct i2c_adapter *i2c) { printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); return NULL; } -#endif // CONFIG_DVB_CX24116 +#endif #endif /* CX24116_H */ -- cgit v1.2.3 From ccf25f2125357dd914990341dbac871c6de1de50 Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 16 Oct 2008 19:22:57 -0400 Subject: tda10048: Checkpatch compliance From: Steven Toth tda10048: Checkpatch compliance Priority: normal Signed-off-by: Steven Toth --- linux/drivers/media/dvb/frontends/tda10048.c | 100 +++++++++++++++++++-------- 1 file changed, 73 insertions(+), 27 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/frontends/tda10048.c b/linux/drivers/media/dvb/frontends/tda10048.c index 7a882faf5..cb5b1efd8 100644 --- a/linux/drivers/media/dvb/frontends/tda10048.c +++ b/linux/drivers/media/dvb/frontends/tda10048.c @@ -195,7 +195,7 @@ static struct init_tab { static int tda10048_writereg(struct tda10048_state *state, u8 reg, u8 data) { int ret; - u8 buf [] = { reg, data }; + u8 buf[] = { reg, data }; struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 }; @@ -213,9 +213,9 @@ static int tda10048_writereg(struct tda10048_state *state, u8 reg, u8 data) static u8 tda10048_readreg(struct tda10048_state *state, u8 reg) { int ret; - u8 b0 [] = { reg }; - u8 b1 [] = { 0 }; - struct i2c_msg msg [] = { + u8 b0[] = { reg }; + u8 b1[] = { 0 }; + struct i2c_msg msg[] = { { .addr = state->config->demod_address, .flags = 0, .buf = b0, .len = 1 }, { .addr = state->config->demod_address, @@ -393,43 +393,89 @@ static int tda10048_get_tps(struct tda10048_state *state, val = tda10048_readreg(state, TDA10048_OUT_CONF2); switch ((val & 0x60) >> 5) { - case 0: p->constellation = QPSK; break; - case 1: p->constellation = QAM_16; break; - case 2: p->constellation = QAM_64; break; + case 0: + p->constellation = QPSK; + break; + case 1: + p->constellation = QAM_16; + break; + case 2: + p->constellation = QAM_64; + break; } switch ((val & 0x18) >> 3) { - case 0: p->hierarchy_information = HIERARCHY_NONE; break; - case 1: p->hierarchy_information = HIERARCHY_1; break; - case 2: p->hierarchy_information = HIERARCHY_2; break; - case 3: p->hierarchy_information = HIERARCHY_4; break; + case 0: + p->hierarchy_information = HIERARCHY_NONE; + break; + case 1: + p->hierarchy_information = HIERARCHY_1; + break; + case 2: + p->hierarchy_information = HIERARCHY_2; + break; + case 3: + p->hierarchy_information = HIERARCHY_4; + break; } switch (val & 0x07) { - case 0: p->code_rate_HP = FEC_1_2; break; - case 1: p->code_rate_HP = FEC_2_3; break; - case 2: p->code_rate_HP = FEC_3_4; break; - case 3: p->code_rate_HP = FEC_5_6; break; - case 4: p->code_rate_HP = FEC_7_8; break; + case 0: + p->code_rate_HP = FEC_1_2; + break; + case 1: + p->code_rate_HP = FEC_2_3; + break; + case 2: + p->code_rate_HP = FEC_3_4; + break; + case 3: + p->code_rate_HP = FEC_5_6; + break; + case 4: + p->code_rate_HP = FEC_7_8; + break; } val = tda10048_readreg(state, TDA10048_OUT_CONF3); switch (val & 0x07) { - case 0: p->code_rate_LP = FEC_1_2; break; - case 1: p->code_rate_LP = FEC_2_3; break; - case 2: p->code_rate_LP = FEC_3_4; break; - case 3: p->code_rate_LP = FEC_5_6; break; - case 4: p->code_rate_LP = FEC_7_8; break; + case 0: + p->code_rate_LP = FEC_1_2; + break; + case 1: + p->code_rate_LP = FEC_2_3; + break; + case 2: + p->code_rate_LP = FEC_3_4; + break; + case 3: + p->code_rate_LP = FEC_5_6; + break; + case 4: + p->code_rate_LP = FEC_7_8; + break; } val = tda10048_readreg(state, TDA10048_OUT_CONF1); switch ((val & 0x0c) >> 2) { - case 0: p->guard_interval = GUARD_INTERVAL_1_32; break; - case 1: p->guard_interval = GUARD_INTERVAL_1_16; break; - case 2: p->guard_interval = GUARD_INTERVAL_1_8; break; - case 3: p->guard_interval = GUARD_INTERVAL_1_4; break; + case 0: + p->guard_interval = GUARD_INTERVAL_1_32; + break; + case 1: + p->guard_interval = GUARD_INTERVAL_1_16; + break; + case 2: + p->guard_interval = GUARD_INTERVAL_1_8; + break; + case 3: + p->guard_interval = GUARD_INTERVAL_1_4; + break; } switch (val & 0x02) { - case 0: p->transmission_mode = TRANSMISSION_MODE_2K; break; - case 1: p->transmission_mode = TRANSMISSION_MODE_8K; break; + case 0: + p->transmission_mode = TRANSMISSION_MODE_2K; + break; + case 1: + p->transmission_mode = TRANSMISSION_MODE_8K; + break; } return 0; -- cgit v1.2.3 From bd3b1362a8711cb684c2e3a32a3b51a31997f381 Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 16 Oct 2008 19:23:45 -0400 Subject: cx22702: Checkpatch compliance From: Steven Toth cx22702: Checkpatch compliance Priority: normal Signed-off-by: Steven Toth --- linux/drivers/media/dvb/frontends/cx22702.c | 506 +++++++++++++++++----------- linux/drivers/media/dvb/frontends/cx22702.h | 20 +- 2 files changed, 317 insertions(+), 209 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/frontends/cx22702.c b/linux/drivers/media/dvb/frontends/cx22702.c index 9430e03db..5d1abe34b 100644 --- a/linux/drivers/media/dvb/frontends/cx22702.c +++ b/linux/drivers/media/dvb/frontends/cx22702.c @@ -34,13 +34,12 @@ #include "dvb_frontend.h" #include "cx22702.h" - struct cx22702_state { - struct i2c_adapter* i2c; + struct i2c_adapter *i2c; /* configuration settings */ - const struct cx22702_config* config; + const struct cx22702_config *config; struct dvb_frontend frontend; @@ -49,10 +48,13 @@ struct cx22702_state { }; static int debug; +module_param(debug, int, 0644); +MODULE_PARM_DESC(debug, "Enable verbose debug messages"); + #define dprintk if (debug) printk /* Register values to initialise the demod */ -static u8 init_tab [] = { +static u8 init_tab[] = { 0x00, 0x00, /* Stop aquisition */ 0x0B, 0x06, 0x09, 0x01, @@ -80,65 +82,67 @@ static u8 init_tab [] = { 0xfd, 0x00, }; -static int cx22702_writereg (struct cx22702_state* state, u8 reg, u8 data) +static int cx22702_writereg(struct cx22702_state *state, u8 reg, u8 data) { int ret; - u8 buf [] = { reg, data }; - struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 }; + u8 buf[] = { reg, data }; + struct i2c_msg msg = { + .addr = state->config->demod_address, .flags = 0, + .buf = buf, .len = 2 }; ret = i2c_transfer(state->i2c, &msg, 1); if (ret != 1) - printk("%s: writereg error (reg == 0x%02x, val == 0x%02x, ret == %i)\n", + printk(KERN_ERR + "%s: error (reg == 0x%02x, val == 0x%02x, ret == %i)\n", __func__, reg, data, ret); return (ret != 1) ? -1 : 0; } -static u8 cx22702_readreg (struct cx22702_state* state, u8 reg) +static u8 cx22702_readreg(struct cx22702_state *state, u8 reg) { int ret; - u8 b0 [] = { reg }; - u8 b1 [] = { 0 }; + u8 b0[] = { reg }; + u8 b1[] = { 0 }; - struct i2c_msg msg [] = { - { .addr = state->config->demod_address, .flags = 0, .buf = b0, .len = 1 }, - { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 } }; + struct i2c_msg msg[] = { + { .addr = state->config->demod_address, .flags = 0, + .buf = b0, .len = 1 }, + { .addr = state->config->demod_address, .flags = I2C_M_RD, + .buf = b1, .len = 1 } }; ret = i2c_transfer(state->i2c, msg, 2); if (ret != 2) - printk("%s: readreg error (ret == %i)\n", __func__, ret); + printk(KERN_ERR "%s: readreg error (ret == %i)\n", + __func__, ret); return b1[0]; } -static int cx22702_set_inversion (struct cx22702_state *state, int inversion) +static int cx22702_set_inversion(struct cx22702_state *state, int inversion) { u8 val; switch (inversion) { - - case INVERSION_AUTO: - return -EOPNOTSUPP; - - case INVERSION_ON: - val = cx22702_readreg (state, 0x0C); - return cx22702_writereg (state, 0x0C, val | 0x01); - - case INVERSION_OFF: - val = cx22702_readreg (state, 0x0C); - return cx22702_writereg (state, 0x0C, val & 0xfe); - - default: - return -EINVAL; - + case INVERSION_AUTO: + return -EOPNOTSUPP; + case INVERSION_ON: + val = cx22702_readreg(state, 0x0C); + return cx22702_writereg(state, 0x0C, val | 0x01); + case INVERSION_OFF: + val = cx22702_readreg(state, 0x0C); + return cx22702_writereg(state, 0x0C, val & 0xfe); + default: + return -EINVAL; } } /* Retrieve the demod settings */ -static int cx22702_get_tps (struct cx22702_state *state, struct dvb_ofdm_parameters *p) +static int cx22702_get_tps(struct cx22702_state *state, + struct dvb_ofdm_parameters *p) { u8 val; @@ -146,180 +150,281 @@ static int cx22702_get_tps (struct cx22702_state *state, struct dvb_ofdm_paramet if (!(cx22702_readreg(state, 0x0A) & 0x20)) return -EAGAIN; - val = cx22702_readreg (state, 0x01); - switch( (val&0x18)>>3) { - case 0: p->constellation = QPSK; break; - case 1: p->constellation = QAM_16; break; - case 2: p->constellation = QAM_64; break; + val = cx22702_readreg(state, 0x01); + switch ((val & 0x18) >> 3) { + case 0: + p->constellation = QPSK; + break; + case 1: + p->constellation = QAM_16; + break; + case 2: + p->constellation = QAM_64; + break; } - switch( val&0x07 ) { - case 0: p->hierarchy_information = HIERARCHY_NONE; break; - case 1: p->hierarchy_information = HIERARCHY_1; break; - case 2: p->hierarchy_information = HIERARCHY_2; break; - case 3: p->hierarchy_information = HIERARCHY_4; break; + switch (val & 0x07) { + case 0: + p->hierarchy_information = HIERARCHY_NONE; + break; + case 1: + p->hierarchy_information = HIERARCHY_1; + break; + case 2: + p->hierarchy_information = HIERARCHY_2; + break; + case 3: + p->hierarchy_information = HIERARCHY_4; + break; } - val = cx22702_readreg (state, 0x02); - switch( (val&0x38)>>3 ) { - case 0: p->code_rate_HP = FEC_1_2; break; - case 1: p->code_rate_HP = FEC_2_3; break; - case 2: p->code_rate_HP = FEC_3_4; break; - case 3: p->code_rate_HP = FEC_5_6; break; - case 4: p->code_rate_HP = FEC_7_8; break; + val = cx22702_readreg(state, 0x02); + switch ((val & 0x38) >> 3) { + case 0: + p->code_rate_HP = FEC_1_2; + break; + case 1: + p->code_rate_HP = FEC_2_3; + break; + case 2: + p->code_rate_HP = FEC_3_4; + break; + case 3: + p->code_rate_HP = FEC_5_6; + break; + case 4: + p->code_rate_HP = FEC_7_8; + break; } - switch( val&0x07 ) { - case 0: p->code_rate_LP = FEC_1_2; break; - case 1: p->code_rate_LP = FEC_2_3; break; - case 2: p->code_rate_LP = FEC_3_4; break; - case 3: p->code_rate_LP = FEC_5_6; break; - case 4: p->code_rate_LP = FEC_7_8; break; + switch (val & 0x07) { + case 0: + p->code_rate_LP = FEC_1_2; + break; + case 1: + p->code_rate_LP = FEC_2_3; + break; + case 2: + p->code_rate_LP = FEC_3_4; + break; + case 3: + p->code_rate_LP = FEC_5_6; + break; + case 4: + p->code_rate_LP = FEC_7_8; + break; } - - val = cx22702_readreg (state, 0x03); - switch( (val&0x0c)>>2 ) { - case 0: p->guard_interval = GUARD_INTERVAL_1_32; break; - case 1: p->guard_interval = GUARD_INTERVAL_1_16; break; - case 2: p->guard_interval = GUARD_INTERVAL_1_8; break; - case 3: p->guard_interval = GUARD_INTERVAL_1_4; break; + val = cx22702_readreg(state, 0x03); + switch ((val & 0x0c) >> 2) { + case 0: + p->guard_interval = GUARD_INTERVAL_1_32; + break; + case 1: + p->guard_interval = GUARD_INTERVAL_1_16; + break; + case 2: + p->guard_interval = GUARD_INTERVAL_1_8; + break; + case 3: + p->guard_interval = GUARD_INTERVAL_1_4; + break; } - switch( val&0x03 ) { - case 0: p->transmission_mode = TRANSMISSION_MODE_2K; break; - case 1: p->transmission_mode = TRANSMISSION_MODE_8K; break; + switch (val & 0x03) { + case 0: + p->transmission_mode = TRANSMISSION_MODE_2K; + break; + case 1: + p->transmission_mode = TRANSMISSION_MODE_8K; + break; } return 0; } -static int cx22702_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) +static int cx22702_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) { - struct cx22702_state* state = fe->demodulator_priv; - dprintk ("%s(%d)\n", __func__, enable); + struct cx22702_state *state = fe->demodulator_priv; + dprintk("%s(%d)\n", __func__, enable); if (enable) - return cx22702_writereg (state, 0x0D, cx22702_readreg(state, 0x0D) & 0xfe); + return cx22702_writereg(state, 0x0D, + cx22702_readreg(state, 0x0D) & 0xfe); else - return cx22702_writereg (state, 0x0D, cx22702_readreg(state, 0x0D) | 1); + return cx22702_writereg(state, 0x0D, + cx22702_readreg(state, 0x0D) | 1); } /* Talk to the demod, set the FEC, GUARD, QAM settings etc */ -static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_parameters *p) +static int cx22702_set_tps(struct dvb_frontend *fe, + struct dvb_frontend_parameters *p) { u8 val; - struct cx22702_state* state = fe->demodulator_priv; + struct cx22702_state *state = fe->demodulator_priv; if (fe->ops.tuner_ops.set_params) { fe->ops.tuner_ops.set_params(fe, p); - if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 0); } /* set inversion */ - cx22702_set_inversion (state, p->inversion); + cx22702_set_inversion(state, p->inversion); /* set bandwidth */ - switch(p->u.ofdm.bandwidth) { + switch (p->u.ofdm.bandwidth) { case BANDWIDTH_6_MHZ: - cx22702_writereg(state, 0x0C, (cx22702_readreg(state, 0x0C) & 0xcf) | 0x20 ); + cx22702_writereg(state, 0x0C, + (cx22702_readreg(state, 0x0C) & 0xcf) | 0x20); break; case BANDWIDTH_7_MHZ: - cx22702_writereg(state, 0x0C, (cx22702_readreg(state, 0x0C) & 0xcf) | 0x10 ); + cx22702_writereg(state, 0x0C, + (cx22702_readreg(state, 0x0C) & 0xcf) | 0x10); break; case BANDWIDTH_8_MHZ: - cx22702_writereg(state, 0x0C, cx22702_readreg(state, 0x0C) &0xcf ); + cx22702_writereg(state, 0x0C, + cx22702_readreg(state, 0x0C) & 0xcf); break; default: - dprintk ("%s: invalid bandwidth\n",__func__); + dprintk("%s: invalid bandwidth\n", __func__); return -EINVAL; } - - p->u.ofdm.code_rate_LP = FEC_AUTO; //temp hack as manual not working + p->u.ofdm.code_rate_LP = FEC_AUTO; /* temp hack as manual not working */ /* use auto configuration? */ - if((p->u.ofdm.hierarchy_information==HIERARCHY_AUTO) || - (p->u.ofdm.constellation==QAM_AUTO) || - (p->u.ofdm.code_rate_HP==FEC_AUTO) || - (p->u.ofdm.code_rate_LP==FEC_AUTO) || - (p->u.ofdm.guard_interval==GUARD_INTERVAL_AUTO) || - (p->u.ofdm.transmission_mode==TRANSMISSION_MODE_AUTO) ) { + if ((p->u.ofdm.hierarchy_information == HIERARCHY_AUTO) || + (p->u.ofdm.constellation == QAM_AUTO) || + (p->u.ofdm.code_rate_HP == FEC_AUTO) || + (p->u.ofdm.code_rate_LP == FEC_AUTO) || + (p->u.ofdm.guard_interval == GUARD_INTERVAL_AUTO) || + (p->u.ofdm.transmission_mode == TRANSMISSION_MODE_AUTO)) { /* TPS Source - use hardware driven values */ cx22702_writereg(state, 0x06, 0x10); cx22702_writereg(state, 0x07, 0x9); cx22702_writereg(state, 0x08, 0xC1); - cx22702_writereg(state, 0x0B, cx22702_readreg(state, 0x0B) & 0xfc ); - cx22702_writereg(state, 0x0C, (cx22702_readreg(state, 0x0C) & 0xBF) | 0x40 ); + cx22702_writereg(state, 0x0B, cx22702_readreg(state, 0x0B) + & 0xfc); + cx22702_writereg(state, 0x0C, + (cx22702_readreg(state, 0x0C) & 0xBF) | 0x40); cx22702_writereg(state, 0x00, 0x01); /* Begin aquisition */ - dprintk("%s: Autodetecting\n",__func__); + dprintk("%s: Autodetecting\n", __func__); return 0; } /* manually programmed values */ - val=0; - switch(p->u.ofdm.constellation) { - case QPSK: val = (val&0xe7); break; - case QAM_16: val = (val&0xe7)|0x08; break; - case QAM_64: val = (val&0xe7)|0x10; break; - default: - dprintk ("%s: invalid constellation\n",__func__); - return -EINVAL; + val = 0; + switch (p->u.ofdm.constellation) { + case QPSK: + val = (val & 0xe7); + break; + case QAM_16: + val = (val & 0xe7) | 0x08; + break; + case QAM_64: + val = (val & 0xe7) | 0x10; + break; + default: + dprintk("%s: invalid constellation\n", __func__); + return -EINVAL; } - switch(p->u.ofdm.hierarchy_information) { - case HIERARCHY_NONE: val = (val&0xf8); break; - case HIERARCHY_1: val = (val&0xf8)|1; break; - case HIERARCHY_2: val = (val&0xf8)|2; break; - case HIERARCHY_4: val = (val&0xf8)|3; break; - default: - dprintk ("%s: invalid hierarchy\n",__func__); - return -EINVAL; + switch (p->u.ofdm.hierarchy_information) { + case HIERARCHY_NONE: + val = (val & 0xf8); + break; + case HIERARCHY_1: + val = (val & 0xf8) | 1; + break; + case HIERARCHY_2: + val = (val & 0xf8) | 2; + break; + case HIERARCHY_4: + val = (val & 0xf8) | 3; + break; + default: + dprintk("%s: invalid hierarchy\n", __func__); + return -EINVAL; } - cx22702_writereg (state, 0x06, val); - - val=0; - switch(p->u.ofdm.code_rate_HP) { - case FEC_NONE: - case FEC_1_2: val = (val&0xc7); break; - case FEC_2_3: val = (val&0xc7)|0x08; break; - case FEC_3_4: val = (val&0xc7)|0x10; break; - case FEC_5_6: val = (val&0xc7)|0x18; break; - case FEC_7_8: val = (val&0xc7)|0x20; break; - default: - dprintk ("%s: invalid code_rate_HP\n",__func__); - return -EINVAL; + cx22702_writereg(state, 0x06, val); + + val = 0; + switch (p->u.ofdm.code_rate_HP) { + case FEC_NONE: + case FEC_1_2: + val = (val & 0xc7); + break; + case FEC_2_3: + val = (val & 0xc7) | 0x08; + break; + case FEC_3_4: + val = (val & 0xc7) | 0x10; + break; + case FEC_5_6: + val = (val & 0xc7) | 0x18; + break; + case FEC_7_8: + val = (val & 0xc7) | 0x20; + break; + default: + dprintk("%s: invalid code_rate_HP\n", __func__); + return -EINVAL; } - switch(p->u.ofdm.code_rate_LP) { - case FEC_NONE: - case FEC_1_2: val = (val&0xf8); break; - case FEC_2_3: val = (val&0xf8)|1; break; - case FEC_3_4: val = (val&0xf8)|2; break; - case FEC_5_6: val = (val&0xf8)|3; break; - case FEC_7_8: val = (val&0xf8)|4; break; - default: - dprintk ("%s: invalid code_rate_LP\n",__func__); - return -EINVAL; + switch (p->u.ofdm.code_rate_LP) { + case FEC_NONE: + case FEC_1_2: + val = (val & 0xf8); + break; + case FEC_2_3: + val = (val & 0xf8) | 1; + break; + case FEC_3_4: + val = (val & 0xf8) | 2; + break; + case FEC_5_6: + val = (val & 0xf8) | 3; + break; + case FEC_7_8: + val = (val & 0xf8) | 4; + break; + default: + dprintk("%s: invalid code_rate_LP\n", __func__); + return -EINVAL; } - cx22702_writereg (state, 0x07, val); - - val=0; - switch(p->u.ofdm.guard_interval) { - case GUARD_INTERVAL_1_32: val = (val&0xf3); break; - case GUARD_INTERVAL_1_16: val = (val&0xf3)|0x04; break; - case GUARD_INTERVAL_1_8: val = (val&0xf3)|0x08; break; - case GUARD_INTERVAL_1_4: val = (val&0xf3)|0x0c; break; - default: - dprintk ("%s: invalid guard_interval\n",__func__); - return -EINVAL; + cx22702_writereg(state, 0x07, val); + + val = 0; + switch (p->u.ofdm.guard_interval) { + case GUARD_INTERVAL_1_32: + val = (val & 0xf3); + break; + case GUARD_INTERVAL_1_16: + val = (val & 0xf3) | 0x04; + break; + case GUARD_INTERVAL_1_8: + val = (val & 0xf3) | 0x08; + break; + case GUARD_INTERVAL_1_4: + val = (val & 0xf3) | 0x0c; + break; + default: + dprintk("%s: invalid guard_interval\n", __func__); + return -EINVAL; } - switch(p->u.ofdm.transmission_mode) { - case TRANSMISSION_MODE_2K: val = (val&0xfc); break; - case TRANSMISSION_MODE_8K: val = (val&0xfc)|1; break; - default: - dprintk ("%s: invalid transmission_mode\n",__func__); - return -EINVAL; + switch (p->u.ofdm.transmission_mode) { + case TRANSMISSION_MODE_2K: + val = (val & 0xfc); + break; + case TRANSMISSION_MODE_8K: + val = (val & 0xfc) | 1; + break; + default: + dprintk("%s: invalid transmission_mode\n", __func__); + return -EINVAL; } cx22702_writereg(state, 0x08, val); - cx22702_writereg(state, 0x0B, (cx22702_readreg(state, 0x0B) & 0xfc) | 0x02 ); - cx22702_writereg(state, 0x0C, (cx22702_readreg(state, 0x0C) & 0xBF) | 0x40 ); + cx22702_writereg(state, 0x0B, + (cx22702_readreg(state, 0x0B) & 0xfc) | 0x02); + cx22702_writereg(state, 0x0C, + (cx22702_readreg(state, 0x0C) & 0xBF) | 0x40); /* Begin channel aquisition */ cx22702_writereg(state, 0x00, 0x01); @@ -329,109 +434,111 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet /* Reset the demod hardware and reset all of the configuration registers to a default state. */ -static int cx22702_init (struct dvb_frontend* fe) +static int cx22702_init(struct dvb_frontend *fe) { int i; - struct cx22702_state* state = fe->demodulator_priv; + struct cx22702_state *state = fe->demodulator_priv; - cx22702_writereg (state, 0x00, 0x02); + cx22702_writereg(state, 0x00, 0x02); msleep(10); - for (i=0; iconfig->output_mode << 1) & 0x02); + cx22702_writereg(state, 0xf8, (state->config->output_mode << 1) + & 0x02); cx22702_i2c_gate_ctrl(fe, 0); return 0; } -static int cx22702_read_status(struct dvb_frontend* fe, fe_status_t* status) +static int cx22702_read_status(struct dvb_frontend *fe, fe_status_t *status) { - struct cx22702_state* state = fe->demodulator_priv; + struct cx22702_state *state = fe->demodulator_priv; u8 reg0A; u8 reg23; *status = 0; - reg0A = cx22702_readreg (state, 0x0A); - reg23 = cx22702_readreg (state, 0x23); + reg0A = cx22702_readreg(state, 0x0A); + reg23 = cx22702_readreg(state, 0x23); - dprintk ("%s: status demod=0x%02x agc=0x%02x\n" - ,__func__,reg0A,reg23); + dprintk("%s: status demod=0x%02x agc=0x%02x\n" + , __func__, reg0A, reg23); - if(reg0A & 0x10) { + if (reg0A & 0x10) { *status |= FE_HAS_LOCK; *status |= FE_HAS_VITERBI; *status |= FE_HAS_SYNC; } - if(reg0A & 0x20) + if (reg0A & 0x20) *status |= FE_HAS_CARRIER; - if(reg23 < 0xf0) + if (reg23 < 0xf0) *status |= FE_HAS_SIGNAL; return 0; } -static int cx22702_read_ber(struct dvb_frontend* fe, u32* ber) +static int cx22702_read_ber(struct dvb_frontend *fe, u32 *ber) { - struct cx22702_state* state = fe->demodulator_priv; + struct cx22702_state *state = fe->demodulator_priv; - if(cx22702_readreg (state, 0xE4) & 0x02) { + if (cx22702_readreg(state, 0xE4) & 0x02) { /* Realtime statistics */ - *ber = (cx22702_readreg (state, 0xDE) & 0x7F) << 7 - | (cx22702_readreg (state, 0xDF)&0x7F); + *ber = (cx22702_readreg(state, 0xDE) & 0x7F) << 7 + | (cx22702_readreg(state, 0xDF) & 0x7F); } else { /* Averagtine statistics */ - *ber = (cx22702_readreg (state, 0xDE) & 0x7F) << 7 - | cx22702_readreg (state, 0xDF); + *ber = (cx22702_readreg(state, 0xDE) & 0x7F) << 7 + | cx22702_readreg(state, 0xDF); } return 0; } -static int cx22702_read_signal_strength(struct dvb_frontend* fe, u16* signal_strength) +static int cx22702_read_signal_strength(struct dvb_frontend *fe, + u16 *signal_strength) { - struct cx22702_state* state = fe->demodulator_priv; + struct cx22702_state *state = fe->demodulator_priv; u16 rs_ber = 0; - rs_ber = cx22702_readreg (state, 0x23); + rs_ber = cx22702_readreg(state, 0x23); *signal_strength = (rs_ber << 8) | rs_ber; return 0; } -static int cx22702_read_snr(struct dvb_frontend* fe, u16* snr) +static int cx22702_read_snr(struct dvb_frontend *fe, u16 *snr) { - struct cx22702_state* state = fe->demodulator_priv; + struct cx22702_state *state = fe->demodulator_priv; - u16 rs_ber=0; - if(cx22702_readreg (state, 0xE4) & 0x02) { + u16 rs_ber = 0; + if (cx22702_readreg(state, 0xE4) & 0x02) { /* Realtime statistics */ - rs_ber = (cx22702_readreg (state, 0xDE) & 0x7F) << 7 - | (cx22702_readreg (state, 0xDF)& 0x7F); + rs_ber = (cx22702_readreg(state, 0xDE) & 0x7F) << 7 + | (cx22702_readreg(state, 0xDF) & 0x7F); } else { /* Averagine statistics */ - rs_ber = (cx22702_readreg (state, 0xDE) & 0x7F) << 8 - | cx22702_readreg (state, 0xDF); + rs_ber = (cx22702_readreg(state, 0xDE) & 0x7F) << 8 + | cx22702_readreg(state, 0xDF); } *snr = ~rs_ber; return 0; } -static int cx22702_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) +static int cx22702_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) { - struct cx22702_state* state = fe->demodulator_priv; + struct cx22702_state *state = fe->demodulator_priv; u8 _ucblocks; /* RS Uncorrectable Packet Count then reset */ - _ucblocks = cx22702_readreg (state, 0xE3); + _ucblocks = cx22702_readreg(state, 0xE3); if (state->prevUCBlocks < _ucblocks) *ucblocks = (_ucblocks - state->prevUCBlocks); else @@ -441,34 +548,36 @@ static int cx22702_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) return 0; } -static int cx22702_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) +static int cx22702_get_frontend(struct dvb_frontend *fe, + struct dvb_frontend_parameters *p) { - struct cx22702_state* state = fe->demodulator_priv; + struct cx22702_state *state = fe->demodulator_priv; - u8 reg0C = cx22702_readreg (state, 0x0C); + u8 reg0C = cx22702_readreg(state, 0x0C); p->inversion = reg0C & 0x1 ? INVERSION_ON : INVERSION_OFF; - return cx22702_get_tps (state, &p->u.ofdm); + return cx22702_get_tps(state, &p->u.ofdm); } -static int cx22702_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune) +static int cx22702_get_tune_settings(struct dvb_frontend *fe, + struct dvb_frontend_tune_settings *tune) { tune->min_delay_ms = 1000; return 0; } -static void cx22702_release(struct dvb_frontend* fe) +static void cx22702_release(struct dvb_frontend *fe) { - struct cx22702_state* state = fe->demodulator_priv; + struct cx22702_state *state = fe->demodulator_priv; kfree(state); } static struct dvb_frontend_ops cx22702_ops; -struct dvb_frontend* cx22702_attach(const struct cx22702_config* config, - struct i2c_adapter* i2c) +struct dvb_frontend *cx22702_attach(const struct cx22702_config *config, + struct i2c_adapter *i2c) { - struct cx22702_state* state = NULL; + struct cx22702_state *state = NULL; /* allocate memory for the internal state */ state = kmalloc(sizeof(struct cx22702_state), GFP_KERNEL); @@ -485,7 +594,8 @@ struct dvb_frontend* cx22702_attach(const struct cx22702_config* config, goto error; /* create dvb_frontend */ - memcpy(&state->frontend.ops, &cx22702_ops, sizeof(struct dvb_frontend_ops)); + memcpy(&state->frontend.ops, &cx22702_ops, + sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; @@ -493,6 +603,7 @@ error: kfree(state); return NULL; } +EXPORT_SYMBOL(cx22702_attach); static struct dvb_frontend_ops cx22702_ops = { @@ -525,11 +636,6 @@ static struct dvb_frontend_ops cx22702_ops = { .read_ucblocks = cx22702_read_ucblocks, }; -module_param(debug, int, 0644); -MODULE_PARM_DESC(debug, "Enable verbose debug messages"); - MODULE_DESCRIPTION("Conexant CX22702 DVB-T Demodulator driver"); MODULE_AUTHOR("Steven Toth"); MODULE_LICENSE("GPL"); - -EXPORT_SYMBOL(cx22702_attach); diff --git a/linux/drivers/media/dvb/frontends/cx22702.h b/linux/drivers/media/dvb/frontends/cx22702.h index b1e465c6c..f154e1f42 100644 --- a/linux/drivers/media/dvb/frontends/cx22702.h +++ b/linux/drivers/media/dvb/frontends/cx22702.h @@ -30,8 +30,7 @@ #include -struct cx22702_config -{ +struct cx22702_config { /* the demodulator's i2c address */ u8 demod_address; @@ -41,16 +40,19 @@ struct cx22702_config u8 output_mode; }; -#if defined(CONFIG_DVB_CX22702) || (defined(CONFIG_DVB_CX22702_MODULE) && defined(MODULE)) -extern struct dvb_frontend* cx22702_attach(const struct cx22702_config* config, - struct i2c_adapter* i2c); +#if defined(CONFIG_DVB_CX22702) || (defined(CONFIG_DVB_CX22702_MODULE) \ + && defined(MODULE)) +extern struct dvb_frontend *cx22702_attach( + const struct cx22702_config *config, + struct i2c_adapter *i2c); #else -static inline struct dvb_frontend* cx22702_attach(const struct cx22702_config* config, - struct i2c_adapter* i2c) +static inline struct dvb_frontend *cx22702_attach( + const struct cx22702_config *config, + struct i2c_adapter *i2c) { printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); return NULL; } -#endif // CONFIG_DVB_CX22702 +#endif -#endif // CX22702_H +#endif -- cgit v1.2.3 From 2fe27721043a50a0210b9d7201efe5a5bd9a3d9f Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 16 Oct 2008 19:24:42 -0400 Subject: cx24116: Checkpatch compliance #3 From: Steven Toth cx24116: Checkpatch compliance #3 Priority: normal Signed-off-by: Steven Toth --- linux/drivers/media/dvb/frontends/cx24116.c | 105 +++++++++++++++++----------- 1 file changed, 65 insertions(+), 40 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/frontends/cx24116.c b/linux/drivers/media/dvb/frontends/cx24116.c index 36a1401ed..fa6dc1843 100644 --- a/linux/drivers/media/dvb/frontends/cx24116.c +++ b/linux/drivers/media/dvb/frontends/cx24116.c @@ -48,7 +48,7 @@ MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)"); #define dprintk(args...) \ do { \ if (debug) \ - printk("cx24116: " args); \ + printk(KERN_INFO "cx24116: " args); \ } while (0) #define CX24116_DEFAULT_FIRMWARE "dvb-fe-cx24116.fw" @@ -72,13 +72,20 @@ MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)"); #define CX24116_REG_UCB8 (0xca) #define CX24116_REG_CLKDIV (0xf3) #define CX24116_REG_RATEDIV (0xf9) -#define CX24116_REG_FECSTATUS (0x9c) /* configured fec (not tuned) or actual FEC (tuned) 1=1/2 2=2/3 etc */ + +/* configured fec (not tuned) or actual FEC (tuned) 1=1/2 2=2/3 etc */ +#define CX24116_REG_FECSTATUS (0x9c) /* FECSTATUS bits */ -#define CX24116_FEC_FECMASK (0x1f) /* mask to determine configured fec (not tuned) or actual fec (tuned) */ -#define CX24116_FEC_DVBS (0x20) /* Select DVB-S demodulator, else DVB-S2 */ +/* mask to determine configured fec (not tuned) or actual fec (tuned) */ +#define CX24116_FEC_FECMASK (0x1f) + +/* Select DVB-S demodulator, else DVB-S2 */ +#define CX24116_FEC_DVBS (0x20) #define CX24116_FEC_UNKNOWN (0x40) /* Unknown/unused */ -#define CX24116_FEC_PILOT (0x80) /* Pilot mode requested when tuning else always reset when tuned */ + +/* Pilot mode requested when tuning else always reset when tuned */ +#define CX24116_FEC_PILOT (0x80) /* arg buffer size */ #define CX24116_ARGLEN (0x1e) @@ -121,12 +128,14 @@ MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)"); /* DiSEqC tone burst */ static int toneburst = 1; module_param(toneburst, int, 0644); -MODULE_PARM_DESC(toneburst, "DiSEqC toneburst 0=OFF, 1=TONE CACHE, 2=MESSAGE CACHE (default:1)"); +MODULE_PARM_DESC(toneburst, "DiSEqC toneburst 0=OFF, 1=TONE CACHE, "\ + "2=MESSAGE CACHE (default:1)"); /* SNR measurements */ static int esno_snr; module_param(esno_snr, int, 0644); -MODULE_PARM_DESC(debug, "SNR return units, 0=PERCENTAGE 0-100, 1=ESNO(db * 10) (default:0)"); +MODULE_PARM_DESC(debug, "SNR return units, 0=PERCENTAGE 0-100, "\ + "1=ESNO(db * 10) (default:0)"); enum cmds { CMD_SET_VCO = 0x10, @@ -196,7 +205,7 @@ static int cx24116_writereg(struct cx24116_state *state, int reg, int data) err = i2c_transfer(state->i2c, &msg, 1); if (err != 1) { - printk("%s: writereg error(err == %i, reg == 0x%02x," + printk(KERN_ERR "%s: writereg error(err == %i, reg == 0x%02x," " value == 0x%02x)\n", __func__, err, reg, data); return -EREMOTEIO; } @@ -228,12 +237,12 @@ static int cx24116_writeregN(struct cx24116_state *state, int reg, msg.len = len + 1; if (debug > 1) - printk("cx24116: %s: write regN 0x%02x, len = %d\n", + printk(KERN_INFO "cx24116: %s: write regN 0x%02x, len = %d\n", __func__, reg, len); ret = i2c_transfer(state->i2c, &msg, 1); if (ret != 1) { - printk("%s: writereg error(err == %i, reg == 0x%02x\n", + printk(KERN_ERR "%s: writereg error(err == %i, reg == 0x%02x\n", __func__, ret, reg); ret = -EREMOTEIO; } @@ -259,18 +268,20 @@ static int cx24116_readreg(struct cx24116_state *state, u8 reg) ret = i2c_transfer(state->i2c, msg, 2); if (ret != 2) { - printk("%s: reg=0x%x (error=%d)\n", __func__, reg, ret); + printk(KERN_ERR "%s: reg=0x%x (error=%d)\n", + __func__, reg, ret); return ret; } if (debug > 1) - printk("cx24116: read reg 0x%02x, value 0x%02x\n", + printk(KERN_INFO "cx24116: read reg 0x%02x, value 0x%02x\n", reg, b1[0]); return b1[0]; } -static int cx24116_set_inversion(struct cx24116_state *state, fe_spectral_inversion_t inversion) +static int cx24116_set_inversion(struct cx24116_state *state, + fe_spectral_inversion_t inversion) { dprintk("%s(%d)\n", __func__, inversion); @@ -318,10 +329,10 @@ static int cx24116_set_inversion(struct cx24116_state *state, fe_spectral_invers * Eg.(2/3) szap "Zone Horror" * * mask/val = 0x04, 0x20 - * status 1f | signal c3c0 | snr a333 | ber 00000098 | unc 00000000 | FE_HAS_LOCK + * status 1f | signal c3c0 | snr a333 | ber 00000098 | unc 0 | FE_HAS_LOCK * * mask/val = 0x04, 0x30 - * status 1f | signal c3c0 | snr a333 | ber 00000000 | unc 00000000 | FE_HAS_LOCK + * status 1f | signal c3c0 | snr a333 | ber 00000000 | unc 0 | FE_HAS_LOCK * * After tuning FECSTATUS contains actual FEC * in use numbered 1 through to 8 for 1/2 .. 2/3 etc @@ -417,7 +428,8 @@ static int cx24116_lookup_fecmod(struct cx24116_state *state, return ret; } -static int cx24116_set_fec(struct cx24116_state *state, fe_modulation_t mod, fe_code_rate_t fec) +static int cx24116_set_fec(struct cx24116_state *state, + fe_modulation_t mod, fe_code_rate_t fec) { int ret = 0; @@ -471,25 +483,32 @@ static int cx24116_firmware_ondemand(struct dvb_frontend *fe) return 0; /* Load firmware */ - /* request the firmware, this will block until someone uploads it */ - printk("%s: Waiting for firmware upload (%s)...\n", __func__, CX24116_DEFAULT_FIRMWARE); - ret = request_firmware(&fw, CX24116_DEFAULT_FIRMWARE, &state->i2c->dev); - printk("%s: Waiting for firmware upload(2)...\n", __func__); + /* request the firmware, this will block until loaded */ + printk(KERN_INFO "%s: Waiting for firmware upload (%s)...\n", + __func__, CX24116_DEFAULT_FIRMWARE); + ret = request_firmware(&fw, CX24116_DEFAULT_FIRMWARE, + &state->i2c->dev); + printk(KERN_INFO "%s: Waiting for firmware upload(2)...\n", + __func__); if (ret) { - printk("%s: No firmware uploaded (timeout or file not found?)\n", __func__); + printk(KERN_ERR "%s: No firmware uploaded " + "(timeout or file not found?)\n", __func__); return ret; } - /* Make sure we don't recurse back through here during loading */ + /* Make sure we don't recurse back through here + * during loading */ state->skip_fw_load = 1; ret = cx24116_load_firmware(fe, fw); if (ret) - printk("%s: Writing firmware to device failed\n", __func__); + printk(KERN_ERR "%s: Writing firmware to device failed\n", + __func__); release_firmware(fw); - printk("%s: Firmware upload %s\n", __func__, ret == 0 ? "complete" : "failed"); + printk(KERN_INFO "%s: Firmware upload %s\n", __func__, + ret == 0 ? "complete" : "failed"); /* Ensure firmware is always loaded if required */ state->skip_fw_load = 0; @@ -498,7 +517,9 @@ static int cx24116_firmware_ondemand(struct dvb_frontend *fe) return ret; } -/* Take a basic firmware command structure, format it and forward it for processing */ +/* Take a basic firmware command structure, format it + * and forward it for processing + */ static int cx24116_cmd_execute(struct dvb_frontend *fe, struct cx24116_cmd *cmd) { struct cx24116_state *state = fe->demodulator_priv; @@ -509,7 +530,8 @@ static int cx24116_cmd_execute(struct dvb_frontend *fe, struct cx24116_cmd *cmd) /* Load the firmware if required */ ret = cx24116_firmware_ondemand(fe); if (ret != 0) { - printk("%s(): Unable initialise the firmware\n", __func__); + printk(KERN_ERR "%s(): Unable initialise the firmware\n", + __func__); return ret; } @@ -524,8 +546,10 @@ static int cx24116_cmd_execute(struct dvb_frontend *fe, struct cx24116_cmd *cmd) while (cx24116_readreg(state, CX24116_REG_EXECUTE)) { msleep(10); if (i++ > 64) { - /* Avoid looping forever if the firmware does no respond */ - printk("%s() Firmware not responding\n", __func__); + /* Avoid looping forever if the firmware does + not respond */ + printk(KERN_WARNING "%s() Firmware not responding\n", + __func__); return -EREMOTEIO; } } @@ -635,7 +659,7 @@ static int cx24116_load_firmware(struct dvb_frontend *fe, return ret; vers[i] = cx24116_readreg(state, CX24116_REG_MAILBOX); } - printk("%s: FW version %i.%i.%i.%i\n", __func__, + printk(KERN_INFO "%s: FW version %i.%i.%i.%i\n", __func__, vers[0], vers[1], vers[2], vers[3]); return 0; @@ -818,7 +842,7 @@ static int cx24116_set_tone(struct dvb_frontend *fe, dprintk("%s(%d)\n", __func__, tone); if ((tone != SEC_TONE_ON) && (tone != SEC_TONE_OFF)) { - printk("%s: Invalid, tone=%d\n", __func__, tone); + printk(KERN_ERR "%s: Invalid, tone=%d\n", __func__, tone); return -EINVAL; } @@ -891,7 +915,8 @@ static int cx24116_diseqc_init(struct dvb_frontend *fe) /* Unknown */ state->dsec_cmd.args[CX24116_DISEQC_ARG2_2] = 0x02; state->dsec_cmd.args[CX24116_DISEQC_ARG3_0] = 0x00; - state->dsec_cmd.args[CX24116_DISEQC_ARG4_0] = 0x00; /* Continuation flag? */ + /* Continuation flag? */ + state->dsec_cmd.args[CX24116_DISEQC_ARG4_0] = 0x00; /* DiSEqC message length */ state->dsec_cmd.args[CX24116_DISEQC_MSGLEN] = 0x00; @@ -911,11 +936,11 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend *fe, /* Dump DiSEqC message */ if (debug) { - printk("cx24116: %s(", __func__); + printk(KERN_INFO "cx24116: %s(", __func__); for (i = 0 ; i < d->msg_len ;) { - printk("0x%02x", d->msg[i]); + printk(KERN_INFO "0x%02x", d->msg[i]); if (++i < d->msg_len) - printk(", "); + printk(KERN_INFO ", "); } printk(") toneburst=%d\n", toneburst); } @@ -1072,10 +1097,8 @@ struct dvb_frontend *cx24116_attach(const struct cx24116_config *config, /* allocate memory for the internal state */ state = kmalloc(sizeof(struct cx24116_state), GFP_KERNEL); - if (state == NULL) { - printk("Unable to kmalloc\n"); + if (state == NULL) goto error1; - } /* setup the state */ memset(state, 0, sizeof(struct cx24116_state)); @@ -1084,14 +1107,16 @@ struct dvb_frontend *cx24116_attach(const struct cx24116_config *config, state->i2c = i2c; /* check if the demod is present */ - ret = (cx24116_readreg(state, 0xFF) << 8) | cx24116_readreg(state, 0xFE); + ret = (cx24116_readreg(state, 0xFF) << 8) | + cx24116_readreg(state, 0xFE); if (ret != 0x0501) { - printk("Invalid probe, probably not a CX24116 device\n"); + printk(KERN_INFO "Invalid probe, probably not a CX24116 device\n"); goto error2; } /* create dvb_frontend */ - memcpy(&state->frontend.ops, &cx24116_ops, sizeof(struct dvb_frontend_ops)); + memcpy(&state->frontend.ops, &cx24116_ops, + sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; -- cgit v1.2.3 From d9699f388cfb4f3032032250b640ad958f71338a Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 16 Oct 2008 19:27:11 -0400 Subject: s5h1409: Checkpatch compliance From: Steven Toth s5h1409: Checkpatch compliance Priority: normal Signed-off-by: Steven Toth --- linux/drivers/media/dvb/frontends/s5h1409.c | 138 ++++++++++++++-------------- linux/drivers/media/dvb/frontends/s5h1409.h | 15 +-- 2 files changed, 78 insertions(+), 75 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/frontends/s5h1409.c b/linux/drivers/media/dvb/frontends/s5h1409.c index 7500a1c53..cf4d8936b 100644 --- a/linux/drivers/media/dvb/frontends/s5h1409.c +++ b/linux/drivers/media/dvb/frontends/s5h1409.c @@ -30,10 +30,10 @@ struct s5h1409_state { - struct i2c_adapter* i2c; + struct i2c_adapter *i2c; /* configuration settings */ - const struct s5h1409_config* config; + const struct s5h1409_config *config; struct dvb_frontend frontend; @@ -48,6 +48,9 @@ struct s5h1409_state { }; static int debug; +module_param(debug, int, 0644); +MODULE_PARM_DESC(debug, "Enable verbose debug messages"); + #define dprintk if (debug) printk /* Register values to initialise the demod, this will set VSB by default */ @@ -299,10 +302,10 @@ static struct qam256_snr_tab { }; /* 8 bit registers, 16 bit values */ -static int s5h1409_writereg(struct s5h1409_state* state, u8 reg, u16 data) +static int s5h1409_writereg(struct s5h1409_state *state, u8 reg, u16 data) { int ret; - u8 buf [] = { reg, data >> 8, data & 0xff }; + u8 buf[] = { reg, data >> 8, data & 0xff }; struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 3 }; @@ -310,19 +313,19 @@ static int s5h1409_writereg(struct s5h1409_state* state, u8 reg, u16 data) ret = i2c_transfer(state->i2c, &msg, 1); if (ret != 1) - printk("%s: writereg error (reg == 0x%02x, val == 0x%04x, " + printk(KERN_ERR "%s: error (reg == 0x%02x, val == 0x%04x, " "ret == %i)\n", __func__, reg, data, ret); return (ret != 1) ? -1 : 0; } -static u16 s5h1409_readreg(struct s5h1409_state* state, u8 reg) +static u16 s5h1409_readreg(struct s5h1409_state *state, u8 reg) { int ret; - u8 b0 [] = { reg }; - u8 b1 [] = { 0, 0 }; + u8 b0[] = { reg }; + u8 b1[] = { 0, 0 }; - struct i2c_msg msg [] = { + struct i2c_msg msg[] = { { .addr = state->config->demod_address, .flags = 0, .buf = b0, .len = 1 }, { .addr = state->config->demod_address, .flags = I2C_M_RD, @@ -335,9 +338,9 @@ static u16 s5h1409_readreg(struct s5h1409_state* state, u8 reg) return (b1[0] << 8) | b1[1]; } -static int s5h1409_softreset(struct dvb_frontend* fe) +static int s5h1409_softreset(struct dvb_frontend *fe) { - struct s5h1409_state* state = fe->demodulator_priv; + struct s5h1409_state *state = fe->demodulator_priv; dprintk("%s()\n", __func__); @@ -349,11 +352,11 @@ static int s5h1409_softreset(struct dvb_frontend* fe) } #define S5H1409_VSB_IF_FREQ 5380 -#define S5H1409_QAM_IF_FREQ state->config->qam_if +#define S5H1409_QAM_IF_FREQ (state->config->qam_if) -static int s5h1409_set_if_freq(struct dvb_frontend* fe, int KHz) +static int s5h1409_set_if_freq(struct dvb_frontend *fe, int KHz) { - struct s5h1409_state* state = fe->demodulator_priv; + struct s5h1409_state *state = fe->demodulator_priv; dprintk("%s(%d KHz)\n", __func__, KHz); @@ -376,26 +379,26 @@ static int s5h1409_set_if_freq(struct dvb_frontend* fe, int KHz) return 0; } -static int s5h1409_set_spectralinversion(struct dvb_frontend* fe, int inverted) +static int s5h1409_set_spectralinversion(struct dvb_frontend *fe, int inverted) { - struct s5h1409_state* state = fe->demodulator_priv; + struct s5h1409_state *state = fe->demodulator_priv; dprintk("%s(%d)\n", __func__, inverted); - if(inverted == 1) + if (inverted == 1) return s5h1409_writereg(state, 0x1b, 0x1101); /* Inverted */ else return s5h1409_writereg(state, 0x1b, 0x0110); /* Normal */ } -static int s5h1409_enable_modulation(struct dvb_frontend* fe, +static int s5h1409_enable_modulation(struct dvb_frontend *fe, fe_modulation_t m) { - struct s5h1409_state* state = fe->demodulator_priv; + struct s5h1409_state *state = fe->demodulator_priv; dprintk("%s(0x%08x)\n", __func__, m); - switch(m) { + switch (m) { case VSB_8: dprintk("%s() VSB_8\n", __func__); if (state->if_freq != S5H1409_VSB_IF_FREQ) @@ -422,9 +425,9 @@ static int s5h1409_enable_modulation(struct dvb_frontend* fe, return 0; } -static int s5h1409_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) +static int s5h1409_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) { - struct s5h1409_state* state = fe->demodulator_priv; + struct s5h1409_state *state = fe->demodulator_priv; dprintk("%s(%d)\n", __func__, enable); @@ -434,9 +437,9 @@ static int s5h1409_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) return s5h1409_writereg(state, 0xf3, 0); } -static int s5h1409_set_gpio(struct dvb_frontend* fe, int enable) +static int s5h1409_set_gpio(struct dvb_frontend *fe, int enable) { - struct s5h1409_state* state = fe->demodulator_priv; + struct s5h1409_state *state = fe->demodulator_priv; dprintk("%s(%d)\n", __func__, enable); @@ -448,18 +451,18 @@ static int s5h1409_set_gpio(struct dvb_frontend* fe, int enable) s5h1409_readreg(state, 0xe3) & 0xfeff); } -static int s5h1409_sleep(struct dvb_frontend* fe, int enable) +static int s5h1409_sleep(struct dvb_frontend *fe, int enable) { - struct s5h1409_state* state = fe->demodulator_priv; + struct s5h1409_state *state = fe->demodulator_priv; dprintk("%s(%d)\n", __func__, enable); return s5h1409_writereg(state, 0xf2, enable); } -static int s5h1409_register_reset(struct dvb_frontend* fe) +static int s5h1409_register_reset(struct dvb_frontend *fe) { - struct s5h1409_state* state = fe->demodulator_priv; + struct s5h1409_state *state = fe->demodulator_priv; dprintk("%s()\n", __func__); @@ -483,7 +486,7 @@ static void s5h1409_set_qam_amhum_mode(struct dvb_frontend *fe) reg &= 0xff; s5h1409_writereg(state, 0x96, 0x00c); - if ((reg < 0x38) || (reg > 0x68) ) { + if ((reg < 0x38) || (reg > 0x68)) { s5h1409_writereg(state, 0x93, 0x3332); s5h1409_writereg(state, 0x9e, 0x2c37); } else { @@ -514,7 +517,7 @@ static void s5h1409_set_qam_interleave_mode(struct dvb_frontend *fe) s5h1409_writereg(state, 0x96, 0x20); s5h1409_writereg(state, 0xad, - ( ((reg1 & 0xf000) >> 4) | (reg2 & 0xf0ff)) ); + (((reg1 & 0xf000) >> 4) | (reg2 & 0xf0ff))); s5h1409_writereg(state, 0xab, s5h1409_readreg(state, 0xab) & 0xeffe); } @@ -529,10 +532,10 @@ static void s5h1409_set_qam_interleave_mode(struct dvb_frontend *fe) } /* Talk to the demod, set the FEC, GUARD, QAM settings etc */ -static int s5h1409_set_frontend (struct dvb_frontend* fe, +static int s5h1409_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *p) { - struct s5h1409_state* state = fe->demodulator_priv; + struct s5h1409_state *state = fe->demodulator_priv; dprintk("%s(frequency=%d)\n", __func__, p->frequency); @@ -546,9 +549,11 @@ static int s5h1409_set_frontend (struct dvb_frontend* fe, msleep(100); if (fe->ops.tuner_ops.set_params) { - if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); fe->ops.tuner_ops.set_params(fe, p); - if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 0); } /* Optimize the demod for QAM */ @@ -592,17 +597,17 @@ static int s5h1409_set_mpeg_timing(struct dvb_frontend *fe, int mode) /* Reset the demod hardware and reset all of the configuration registers to a default state. */ -static int s5h1409_init (struct dvb_frontend* fe) +static int s5h1409_init(struct dvb_frontend *fe) { int i; - struct s5h1409_state* state = fe->demodulator_priv; + struct s5h1409_state *state = fe->demodulator_priv; dprintk("%s()\n", __func__); s5h1409_sleep(fe, 0); s5h1409_register_reset(fe); - for (i=0; i < ARRAY_SIZE(init_tab); i++) + for (i = 0; i < ARRAY_SIZE(init_tab); i++) s5h1409_writereg(state, init_tab[i].reg, init_tab[i].data); /* The datasheet says that after initialisation, VSB is default */ @@ -627,9 +632,9 @@ static int s5h1409_init (struct dvb_frontend* fe) return 0; } -static int s5h1409_read_status(struct dvb_frontend* fe, fe_status_t* status) +static int s5h1409_read_status(struct dvb_frontend *fe, fe_status_t *status) { - struct s5h1409_state* state = fe->demodulator_priv; + struct s5h1409_state *state = fe->demodulator_priv; u16 reg; u32 tuner_status = 0; @@ -637,12 +642,12 @@ static int s5h1409_read_status(struct dvb_frontend* fe, fe_status_t* status) /* Get the demodulator status */ reg = s5h1409_readreg(state, 0xf1); - if(reg & 0x1000) + if (reg & 0x1000) *status |= FE_HAS_VITERBI; - if(reg & 0x8000) + if (reg & 0x8000) *status |= FE_HAS_LOCK | FE_HAS_SYNC; - switch(state->config->status_mode) { + switch (state->config->status_mode) { case S5H1409_DEMODLOCKING: if (*status & FE_HAS_VITERBI) *status |= FE_HAS_CARRIER | FE_HAS_SIGNAL; @@ -668,12 +673,12 @@ static int s5h1409_read_status(struct dvb_frontend* fe, fe_status_t* status) return 0; } -static int s5h1409_qam256_lookup_snr(struct dvb_frontend* fe, u16* snr, u16 v) +static int s5h1409_qam256_lookup_snr(struct dvb_frontend *fe, u16 *snr, u16 v) { int i, ret = -EINVAL; dprintk("%s()\n", __func__); - for (i=0; i < ARRAY_SIZE(qam256_snr_tab); i++) { + for (i = 0; i < ARRAY_SIZE(qam256_snr_tab); i++) { if (v < qam256_snr_tab[i].val) { *snr = qam256_snr_tab[i].data; ret = 0; @@ -683,12 +688,12 @@ static int s5h1409_qam256_lookup_snr(struct dvb_frontend* fe, u16* snr, u16 v) return ret; } -static int s5h1409_qam64_lookup_snr(struct dvb_frontend* fe, u16* snr, u16 v) +static int s5h1409_qam64_lookup_snr(struct dvb_frontend *fe, u16 *snr, u16 v) { int i, ret = -EINVAL; dprintk("%s()\n", __func__); - for (i=0; i < ARRAY_SIZE(qam64_snr_tab); i++) { + for (i = 0; i < ARRAY_SIZE(qam64_snr_tab); i++) { if (v < qam64_snr_tab[i].val) { *snr = qam64_snr_tab[i].data; ret = 0; @@ -698,12 +703,12 @@ static int s5h1409_qam64_lookup_snr(struct dvb_frontend* fe, u16* snr, u16 v) return ret; } -static int s5h1409_vsb_lookup_snr(struct dvb_frontend* fe, u16* snr, u16 v) +static int s5h1409_vsb_lookup_snr(struct dvb_frontend *fe, u16 *snr, u16 v) { int i, ret = -EINVAL; dprintk("%s()\n", __func__); - for (i=0; i < ARRAY_SIZE(vsb_snr_tab); i++) { + for (i = 0; i < ARRAY_SIZE(vsb_snr_tab); i++) { if (v > vsb_snr_tab[i].val) { *snr = vsb_snr_tab[i].data; ret = 0; @@ -714,13 +719,13 @@ static int s5h1409_vsb_lookup_snr(struct dvb_frontend* fe, u16* snr, u16 v) return ret; } -static int s5h1409_read_snr(struct dvb_frontend* fe, u16* snr) +static int s5h1409_read_snr(struct dvb_frontend *fe, u16 *snr) { - struct s5h1409_state* state = fe->demodulator_priv; + struct s5h1409_state *state = fe->demodulator_priv; u16 reg; dprintk("%s()\n", __func__); - switch(state->current_modulation) { + switch (state->current_modulation) { case QAM_64: reg = s5h1409_readreg(state, 0xf0) & 0xff; return s5h1409_qam64_lookup_snr(fe, snr, reg); @@ -737,30 +742,30 @@ static int s5h1409_read_snr(struct dvb_frontend* fe, u16* snr) return -EINVAL; } -static int s5h1409_read_signal_strength(struct dvb_frontend* fe, - u16* signal_strength) +static int s5h1409_read_signal_strength(struct dvb_frontend *fe, + u16 *signal_strength) { return s5h1409_read_snr(fe, signal_strength); } -static int s5h1409_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) +static int s5h1409_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) { - struct s5h1409_state* state = fe->demodulator_priv; + struct s5h1409_state *state = fe->demodulator_priv; *ucblocks = s5h1409_readreg(state, 0xb5); return 0; } -static int s5h1409_read_ber(struct dvb_frontend* fe, u32* ber) +static int s5h1409_read_ber(struct dvb_frontend *fe, u32 *ber) { return s5h1409_read_ucblocks(fe, ber); } -static int s5h1409_get_frontend(struct dvb_frontend* fe, +static int s5h1409_get_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *p) { - struct s5h1409_state* state = fe->demodulator_priv; + struct s5h1409_state *state = fe->demodulator_priv; p->frequency = state->current_frequency; p->u.vsb.modulation = state->current_modulation; @@ -768,25 +773,25 @@ static int s5h1409_get_frontend(struct dvb_frontend* fe, return 0; } -static int s5h1409_get_tune_settings(struct dvb_frontend* fe, +static int s5h1409_get_tune_settings(struct dvb_frontend *fe, struct dvb_frontend_tune_settings *tune) { tune->min_delay_ms = 1000; return 0; } -static void s5h1409_release(struct dvb_frontend* fe) +static void s5h1409_release(struct dvb_frontend *fe) { - struct s5h1409_state* state = fe->demodulator_priv; + struct s5h1409_state *state = fe->demodulator_priv; kfree(state); } static struct dvb_frontend_ops s5h1409_ops; -struct dvb_frontend* s5h1409_attach(const struct s5h1409_config* config, - struct i2c_adapter* i2c) +struct dvb_frontend *s5h1409_attach(const struct s5h1409_config *config, + struct i2c_adapter *i2c) { - struct s5h1409_state* state = NULL; + struct s5h1409_state *state = NULL; u16 reg; /* allocate memory for the internal state */ @@ -825,6 +830,7 @@ error: kfree(state); return NULL; } +EXPORT_SYMBOL(s5h1409_attach); static struct dvb_frontend_ops s5h1409_ops = { @@ -850,14 +856,10 @@ static struct dvb_frontend_ops s5h1409_ops = { .release = s5h1409_release, }; -module_param(debug, int, 0644); -MODULE_PARM_DESC(debug, "Enable verbose debug messages"); - MODULE_DESCRIPTION("Samsung S5H1409 QAM-B/ATSC Demodulator driver"); MODULE_AUTHOR("Steven Toth"); MODULE_LICENSE("GPL"); -EXPORT_SYMBOL(s5h1409_attach); /* * Local variables: diff --git a/linux/drivers/media/dvb/frontends/s5h1409.h b/linux/drivers/media/dvb/frontends/s5h1409.h index d1a1d2eb8..070d9743e 100644 --- a/linux/drivers/media/dvb/frontends/s5h1409.h +++ b/linux/drivers/media/dvb/frontends/s5h1409.h @@ -24,8 +24,7 @@ #include -struct s5h1409_config -{ +struct s5h1409_config { /* the demodulator's i2c address */ u8 demod_address; @@ -60,12 +59,14 @@ struct s5h1409_config u16 mpeg_timing; }; -#if defined(CONFIG_DVB_S5H1409) || (defined(CONFIG_DVB_S5H1409_MODULE) && defined(MODULE)) -extern struct dvb_frontend* s5h1409_attach(const struct s5h1409_config* config, - struct i2c_adapter* i2c); +#if defined(CONFIG_DVB_S5H1409) || (defined(CONFIG_DVB_S5H1409_MODULE) \ + && defined(MODULE)) +extern struct dvb_frontend *s5h1409_attach(const struct s5h1409_config *config, + struct i2c_adapter *i2c); #else -static inline struct dvb_frontend* s5h1409_attach(const struct s5h1409_config* config, - struct i2c_adapter* i2c) +static inline struct dvb_frontend *s5h1409_attach( + const struct s5h1409_config *config, + struct i2c_adapter *i2c) { printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); return NULL; -- cgit v1.2.3 From 17a73a58eed801cec5db170cccb2ef4ad0a80ddb Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 16 Oct 2008 19:27:48 -0400 Subject: s5h1411: Checkpatch compliance From: Steven Toth s5h1411: Checkpatch compliance Priority: normal Signed-off-by: Steven Toth --- linux/drivers/media/dvb/frontends/s5h1411.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/frontends/s5h1411.c b/linux/drivers/media/dvb/frontends/s5h1411.c index 2da1a3763..2febfb5a8 100644 --- a/linux/drivers/media/dvb/frontends/s5h1411.c +++ b/linux/drivers/media/dvb/frontends/s5h1411.c @@ -343,7 +343,7 @@ static int s5h1411_writereg(struct s5h1411_state *state, u8 addr, u8 reg, u16 data) { int ret; - u8 buf [] = { reg, data >> 8, data & 0xff }; + u8 buf[] = { reg, data >> 8, data & 0xff }; struct i2c_msg msg = { .addr = addr, .flags = 0, .buf = buf, .len = 3 }; @@ -359,10 +359,10 @@ static int s5h1411_writereg(struct s5h1411_state *state, static u16 s5h1411_readreg(struct s5h1411_state *state, u8 addr, u8 reg) { int ret; - u8 b0 [] = { reg }; - u8 b1 [] = { 0, 0 }; + u8 b0[] = { reg }; + u8 b1[] = { 0, 0 }; - struct i2c_msg msg [] = { + struct i2c_msg msg[] = { { .addr = addr, .flags = 0, .buf = b0, .len = 1 }, { .addr = addr, .flags = I2C_M_RD, .buf = b1, .len = 2 } }; -- cgit v1.2.3 From 05d518ccb1abb44ad9d465dc0d94aa9648b86d76 Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 16 Oct 2008 19:28:32 -0400 Subject: cx24123: Checkpatch compliance From: Steven Toth cx24123: Checkpatch compliance Priority: normal Signed-off-by: Steven Toth --- linux/drivers/media/dvb/frontends/cx24123.c | 228 ++++++++++++++++------------ linux/drivers/media/dvb/frontends/cx24123.h | 10 +- 2 files changed, 133 insertions(+), 105 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/frontends/cx24123.c b/linux/drivers/media/dvb/frontends/cx24123.c index 970e4df08..fb559369e 100644 --- a/linux/drivers/media/dvb/frontends/cx24123.c +++ b/linux/drivers/media/dvb/frontends/cx24123.c @@ -33,7 +33,13 @@ #define XTAL 10111000 static int force_band; +module_param(force_band, int, 0644); +MODULE_PARM_DESC(force_band, "Force a specific band select "\ + "(1-9, default:off)."); + static int debug; +module_param(debug, int, 0644); +MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)"); #define info(args...) do { printk(KERN_INFO "CX24123: " args); } while (0) #define err(args...) do { printk(KERN_ERR "CX24123: " args); } while (0) @@ -46,10 +52,9 @@ static int debug; } \ } while (0) -struct cx24123_state -{ - struct i2c_adapter* i2c; - const struct cx24123_config* config; +struct cx24123_state { + struct i2c_adapter *i2c; + const struct cx24123_config *config; struct dvb_frontend frontend; @@ -70,8 +75,7 @@ struct cx24123_state }; /* Various tuner defaults need to be established for a given symbol rate Sps */ -static struct -{ +static struct cx24123_AGC_val { u32 symbolrate_low; u32 symbolrate_high; u32 VCAprogdata; @@ -109,8 +113,7 @@ static struct * fixme: The bounds on the bands do not match the doc in real life. * fixme: Some of them have been moved, other might need adjustment. */ -static struct -{ +static struct cx24123_bandselect_val { u32 freq_low; u32 freq_high; u32 VCOdivider; @@ -260,7 +263,8 @@ static int cx24123_i2c_writereg(struct cx24123_state *state, /* printk(KERN_DEBUG "wr(%02x): %02x %02x\n", i2c_addr, reg, data); */ - if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { + err = i2c_transfer(state->i2c, &msg, 1); + if (err != 1) { printk("%s: writereg error(err == %i, reg == 0x%02x," " data == 0x%02x)\n", __func__, err, reg, data); return err; @@ -295,7 +299,8 @@ static int cx24123_i2c_readreg(struct cx24123_state *state, u8 i2c_addr, u8 reg) #define cx24123_writereg(state, reg, val) \ cx24123_i2c_writereg(state, state->config->demod_address, reg, val) -static int cx24123_set_inversion(struct cx24123_state* state, fe_spectral_inversion_t inversion) +static int cx24123_set_inversion(struct cx24123_state *state, + fe_spectral_inversion_t inversion) { u8 nom_reg = cx24123_readreg(state, 0x0e); u8 auto_reg = cx24123_readreg(state, 0x10); @@ -322,7 +327,8 @@ static int cx24123_set_inversion(struct cx24123_state* state, fe_spectral_invers return 0; } -static int cx24123_get_inversion(struct cx24123_state* state, fe_spectral_inversion_t *inversion) +static int cx24123_get_inversion(struct cx24123_state *state, + fe_spectral_inversion_t *inversion) { u8 val; @@ -339,18 +345,20 @@ static int cx24123_get_inversion(struct cx24123_state* state, fe_spectral_invers return 0; } -static int cx24123_set_fec(struct cx24123_state* state, fe_code_rate_t fec) +static int cx24123_set_fec(struct cx24123_state *state, fe_code_rate_t fec) { u8 nom_reg = cx24123_readreg(state, 0x0e) & ~0x07; - if ( (fec < FEC_NONE) || (fec > FEC_AUTO) ) + if ((fec < FEC_NONE) || (fec > FEC_AUTO)) fec = FEC_AUTO; /* Set the soft decision threshold */ - if(fec == FEC_1_2) - cx24123_writereg(state, 0x43, cx24123_readreg(state, 0x43) | 0x01); + if (fec == FEC_1_2) + cx24123_writereg(state, 0x43, + cx24123_readreg(state, 0x43) | 0x01); else - cx24123_writereg(state, 0x43, cx24123_readreg(state, 0x43) & ~0x01); + cx24123_writereg(state, 0x43, + cx24123_readreg(state, 0x43) & ~0x01); switch (fec) { case FEC_1_2: @@ -399,11 +407,11 @@ static int cx24123_set_fec(struct cx24123_state* state, fe_code_rate_t fec) return 0; } -static int cx24123_get_fec(struct cx24123_state* state, fe_code_rate_t *fec) +static int cx24123_get_fec(struct cx24123_state *state, fe_code_rate_t *fec) { int ret; - ret = cx24123_readreg (state, 0x1b); + ret = cx24123_readreg(state, 0x1b); if (ret < 0) return ret; ret = ret & 0x07; @@ -444,16 +452,16 @@ static u32 cx24123_int_log2(u32 a, u32 b) { u32 exp, nearest = 0; u32 div = a / b; - if(a % b >= b / 2) ++div; - if(div < (1 << 31)) - { - for(exp = 1; div > exp; nearest++) + if (a % b >= b / 2) + ++div; + if (div < (1 << 31)) { + for (exp = 1; div > exp; nearest++) exp += exp; } return nearest; } -static int cx24123_set_symbolrate(struct cx24123_state* state, u32 srate) +static int cx24123_set_symbolrate(struct cx24123_state *state, u32 srate) { u32 tmp, sample_rate, ratio, sample_gain; u8 pll_mult; @@ -509,9 +517,9 @@ static int cx24123_set_symbolrate(struct cx24123_state* state, u32 srate) cx24123_writereg(state, 0x01, pll_mult * 6); - cx24123_writereg(state, 0x08, (ratio >> 16) & 0x3f ); - cx24123_writereg(state, 0x09, (ratio >> 8) & 0xff ); - cx24123_writereg(state, 0x0a, (ratio ) & 0xff ); + cx24123_writereg(state, 0x08, (ratio >> 16) & 0x3f); + cx24123_writereg(state, 0x09, (ratio >> 8) & 0xff); + cx24123_writereg(state, 0x0a, ratio & 0xff); /* also set the demodulator sample gain */ sample_gain = cx24123_int_log2(sample_rate, srate); @@ -525,10 +533,12 @@ static int cx24123_set_symbolrate(struct cx24123_state* state, u32 srate) } /* - * Based on the required frequency and symbolrate, the tuner AGC has to be configured - * and the correct band selected. Calculate those values + * Based on the required frequency and symbolrate, the tuner AGC has + * to be configured and the correct band selected. + * Calculate those values. */ -static int cx24123_pll_calculate(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) +static int cx24123_pll_calculate(struct dvb_frontend *fe, + struct dvb_frontend_parameters *p) { struct cx24123_state *state = fe->demodulator_priv; u32 ndiv = 0, adiv = 0, vco_div = 0; @@ -536,6 +546,8 @@ static int cx24123_pll_calculate(struct dvb_frontend* fe, struct dvb_frontend_pa int pump = 2; int band = 0; int num_bands = ARRAY_SIZE(cx24123_bandselect_vals); + struct cx24123_bandselect_val *bsv = NULL; + struct cx24123_AGC_val *agcv = NULL; /* Defaults for low freq, low rate */ state->VCAarg = cx24123_AGC_vals[0].VCAprogdata; @@ -543,58 +555,65 @@ static int cx24123_pll_calculate(struct dvb_frontend* fe, struct dvb_frontend_pa state->bandselectarg = cx24123_bandselect_vals[0].progdata; vco_div = cx24123_bandselect_vals[0].VCOdivider; - /* For the given symbol rate, determine the VCA, VGA and FILTUNE programming bits */ - for (i = 0; i < ARRAY_SIZE(cx24123_AGC_vals); i++) - { - if ((cx24123_AGC_vals[i].symbolrate_low <= p->u.qpsk.symbol_rate) && - (cx24123_AGC_vals[i].symbolrate_high >= p->u.qpsk.symbol_rate) ) { - state->VCAarg = cx24123_AGC_vals[i].VCAprogdata; - state->VGAarg = cx24123_AGC_vals[i].VGAprogdata; - state->FILTune = cx24123_AGC_vals[i].FILTune; + /* For the given symbol rate, determine the VCA, VGA and + * FILTUNE programming bits */ + for (i = 0; i < ARRAY_SIZE(cx24123_AGC_vals); i++) { + agcv = &cx24123_AGC_vals[i]; + if ((agcv->symbolrate_low <= p->u.qpsk.symbol_rate) && + (agcv->symbolrate_high >= p->u.qpsk.symbol_rate)) { + state->VCAarg = agcv->VCAprogdata; + state->VGAarg = agcv->VGAprogdata; + state->FILTune = agcv->FILTune; } } /* determine the band to use */ - if(force_band < 1 || force_band > num_bands) - { - for (i = 0; i < num_bands; i++) - { - if ((cx24123_bandselect_vals[i].freq_low <= p->frequency) && - (cx24123_bandselect_vals[i].freq_high >= p->frequency) ) + if (force_band < 1 || force_band > num_bands) { + for (i = 0; i < num_bands; i++) { + bsv = &cx24123_bandselect_vals[i]; + if ((bsv->freq_low <= p->frequency) && + (bsv->freq_high >= p->frequency)) band = i; } - } - else + } else band = force_band - 1; state->bandselectarg = cx24123_bandselect_vals[band].progdata; vco_div = cx24123_bandselect_vals[band].VCOdivider; /* determine the charge pump current */ - if ( p->frequency < (cx24123_bandselect_vals[band].freq_low + cx24123_bandselect_vals[band].freq_high)/2 ) + if (p->frequency < (cx24123_bandselect_vals[band].freq_low + + cx24123_bandselect_vals[band].freq_high) / 2) pump = 0x01; else pump = 0x02; /* Determine the N/A dividers for the requested lband freq (in kHz). */ - /* Note: the reference divider R=10, frequency is in KHz, XTAL is in Hz */ - ndiv = ( ((p->frequency * vco_div * 10) / (2 * XTAL / 1000)) / 32) & 0x1ff; - adiv = ( ((p->frequency * vco_div * 10) / (2 * XTAL / 1000)) % 32) & 0x1f; + /* Note: the reference divider R=10, frequency is in KHz, + * XTAL is in Hz */ + ndiv = (((p->frequency * vco_div * 10) / + (2 * XTAL / 1000)) / 32) & 0x1ff; + adiv = (((p->frequency * vco_div * 10) / + (2 * XTAL / 1000)) % 32) & 0x1f; if (adiv == 0 && ndiv > 0) ndiv--; - /* control bits 11, refdiv 11, charge pump polarity 1, charge pump current, ndiv, adiv */ - state->pllarg = (3 << 19) | (3 << 17) | (1 << 16) | (pump << 14) | (ndiv << 5) | adiv; + /* control bits 11, refdiv 11, charge pump polarity 1, + * charge pump current, ndiv, adiv */ + state->pllarg = (3 << 19) | (3 << 17) | (1 << 16) | + (pump << 14) | (ndiv << 5) | adiv; return 0; } /* * Tuner data is 21 bits long, must be left-aligned in data. - * Tuner cx24109 is written through a dedicated 3wire interface on the demod chip. + * Tuner cx24109 is written through a dedicated 3wire interface + * on the demod chip. */ -static int cx24123_pll_writereg(struct dvb_frontend* fe, struct dvb_frontend_parameters *p, u32 data) +static int cx24123_pll_writereg(struct dvb_frontend *fe, + struct dvb_frontend_parameters *p, u32 data) { struct cx24123_state *state = fe->demodulator_priv; unsigned long timeout; @@ -621,7 +640,7 @@ static int cx24123_pll_writereg(struct dvb_frontend* fe, struct dvb_frontend_par /* send another 8 bytes, wait for the send to be completed */ timeout = jiffies + msecs_to_jiffies(40); - cx24123_writereg(state, 0x22, (data>>8) & 0xff ); + cx24123_writereg(state, 0x22, (data >> 8) & 0xff); while ((cx24123_readreg(state, 0x20) & 0x40) == 0) { if (time_after(jiffies, timeout)) { err("%s: demodulator is not responding, "\ @@ -631,9 +650,10 @@ static int cx24123_pll_writereg(struct dvb_frontend* fe, struct dvb_frontend_par msleep(10); } - /* send the lower 5 bits of this byte, padded with 3 LBB, wait for the send to be completed */ + /* send the lower 5 bits of this byte, padded with 3 LBB, + * wait for the send to be completed */ timeout = jiffies + msecs_to_jiffies(40); - cx24123_writereg(state, 0x22, (data) & 0xff ); + cx24123_writereg(state, 0x22, (data) & 0xff); while ((cx24123_readreg(state, 0x20) & 0x80)) { if (time_after(jiffies, timeout)) { err("%s: demodulator is not responding," \ @@ -650,7 +670,8 @@ static int cx24123_pll_writereg(struct dvb_frontend* fe, struct dvb_frontend_par return 0; } -static int cx24123_pll_tune(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) +static int cx24123_pll_tune(struct dvb_frontend *fe, + struct dvb_frontend_parameters *p) { struct cx24123_state *state = fe->demodulator_priv; u8 val; @@ -701,7 +722,7 @@ static int cx24123_repeater_mode(struct cx24123_state *state, u8 mode, u8 start) return cx24123_writereg(state, 0x23, r); } -static int cx24123_initfe(struct dvb_frontend* fe) +static int cx24123_initfe(struct dvb_frontend *fe) { struct cx24123_state *state = fe->demodulator_priv; int i; @@ -710,19 +731,22 @@ static int cx24123_initfe(struct dvb_frontend* fe) /* Configure the demod to a good set of defaults */ for (i = 0; i < ARRAY_SIZE(cx24123_regdata); i++) - cx24123_writereg(state, cx24123_regdata[i].reg, cx24123_regdata[i].data); + cx24123_writereg(state, cx24123_regdata[i].reg, + cx24123_regdata[i].data); /* Set the LNB polarity */ - if(state->config->lnb_polarity) - cx24123_writereg(state, 0x32, cx24123_readreg(state, 0x32) | 0x02); + if (state->config->lnb_polarity) + cx24123_writereg(state, 0x32, + cx24123_readreg(state, 0x32) | 0x02); if (state->config->dont_use_pll) - cx24123_repeater_mode(state, 1, 0); + cx24123_repeater_mode(state, 1, 0); return 0; } -static int cx24123_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage) +static int cx24123_set_voltage(struct dvb_frontend *fe, + fe_sec_voltage_t voltage) { struct cx24123_state *state = fe->demodulator_priv; u8 val; @@ -751,7 +775,7 @@ static void cx24123_wait_for_diseqc(struct cx24123_state *state) { unsigned long timeout = jiffies + msecs_to_jiffies(200); while (!(cx24123_readreg(state, 0x29) & 0x40)) { - if(time_after(jiffies, timeout)) { + if (time_after(jiffies, timeout)) { err("%s: diseqc queue not ready, " \ "command may be lost.\n", __func__); break; @@ -760,7 +784,8 @@ static void cx24123_wait_for_diseqc(struct cx24123_state *state) } } -static int cx24123_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd *cmd) +static int cx24123_send_diseqc_msg(struct dvb_frontend *fe, + struct dvb_diseqc_master_cmd *cmd) { struct cx24123_state *state = fe->demodulator_priv; int i, val, tone; @@ -782,20 +807,21 @@ static int cx24123_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_ma cx24123_writereg(state, 0x2C + i, cmd->msg[i]); val = cx24123_readreg(state, 0x29); - cx24123_writereg(state, 0x29, ((val & 0x90) | 0x40) | ((cmd->msg_len-3) & 3)); + cx24123_writereg(state, 0x29, ((val & 0x90) | 0x40) | + ((cmd->msg_len-3) & 3)); /* wait for diseqc message to finish sending */ cx24123_wait_for_diseqc(state); /* restart continuous tone if enabled */ - if (tone & 0x10) { + if (tone & 0x10) cx24123_writereg(state, 0x29, tone & ~0x40); - } return 0; } -static int cx24123_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t burst) +static int cx24123_diseqc_send_burst(struct dvb_frontend *fe, + fe_sec_mini_cmd_t burst) { struct cx24123_state *state = fe->demodulator_priv; int val, tone; @@ -825,13 +851,13 @@ static int cx24123_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t cx24123_writereg(state, 0x2a, cx24123_readreg(state, 0x2a) & 0xfb); /* restart continuous tone if enabled */ - if (tone & 0x10) { + if (tone & 0x10) cx24123_writereg(state, 0x29, tone & ~0x40); - } + return 0; } -static int cx24123_read_status(struct dvb_frontend* fe, fe_status_t* status) +static int cx24123_read_status(struct dvb_frontend *fe, fe_status_t *status) { struct cx24123_state *state = fe->demodulator_priv; int sync = cx24123_readreg(state, 0x14); @@ -864,8 +890,9 @@ static int cx24123_read_status(struct dvb_frontend* fe, fe_status_t* status) } /* - * Configured to return the measurement of errors in blocks, because no UCBLOCKS value - * is available, so this value doubles up to satisfy both measurements + * Configured to return the measurement of errors in blocks, + * because no UCBLOCKS value is available, so this value doubles up + * to satisfy both measurements. */ static int cx24123_read_ber(struct dvb_frontend *fe, u32 *ber) { @@ -887,7 +914,8 @@ static int cx24123_read_signal_strength(struct dvb_frontend *fe, { struct cx24123_state *state = fe->demodulator_priv; - *signal_strength = cx24123_readreg(state, 0x3b) << 8; /* larger = better */ + /* larger = better */ + *signal_strength = cx24123_readreg(state, 0x3b) << 8; dprintk("Signal strength = %d\n", *signal_strength); @@ -918,7 +946,7 @@ static int cx24123_set_frontend(struct dvb_frontend *fe, if (state->config->set_ts_params) state->config->set_ts_params(fe, 0); - state->currentfreq=p->frequency; + state->currentfreq = p->frequency; state->currentsymbolrate = p->u.qpsk.symbol_rate; cx24123_set_inversion(state, p->inversion); @@ -943,7 +971,8 @@ static int cx24123_set_frontend(struct dvb_frontend *fe, return 0; } -static int cx24123_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) +static int cx24123_get_frontend(struct dvb_frontend *fe, + struct dvb_frontend_parameters *p) { struct cx24123_state *state = fe->demodulator_priv; @@ -963,7 +992,7 @@ static int cx24123_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_par return 0; } -static int cx24123_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) +static int cx24123_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone) { struct cx24123_state *state = fe->demodulator_priv; u8 val; @@ -988,8 +1017,8 @@ static int cx24123_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) return 0; } -static int cx24123_tune(struct dvb_frontend* fe, - struct dvb_frontend_parameters* params, +static int cx24123_tune(struct dvb_frontend *fe, + struct dvb_frontend_parameters *params, unsigned int mode_flags, unsigned int *delay, fe_status_t *status) @@ -1008,12 +1037,12 @@ static int cx24123_tune(struct dvb_frontend* fe, static int cx24123_get_algo(struct dvb_frontend *fe) { - return 1; //FE_ALGO_HW + return 1; /* FE_ALGO_HW */ } -static void cx24123_release(struct dvb_frontend* fe) +static void cx24123_release(struct dvb_frontend *fe) { - struct cx24123_state* state = fe->demodulator_priv; + struct cx24123_state *state = fe->demodulator_priv; dprintk("\n"); i2c_del_adapter(&state->tuner_i2c_adapter); kfree(state); @@ -1024,7 +1053,7 @@ static int cx24123_tuner_i2c_tuner_xfer(struct i2c_adapter *i2c_adap, { struct cx24123_state *state = i2c_get_adapdata(i2c_adap); /* this repeater closes after the first stop */ - cx24123_repeater_mode(state, 1, 1); + cx24123_repeater_mode(state, 1, 1); return i2c_transfer(state->i2c, msg, num); } @@ -1048,8 +1077,8 @@ EXPORT_SYMBOL(cx24123_get_tuner_i2c_adapter); static struct dvb_frontend_ops cx24123_ops; -struct dvb_frontend* cx24123_attach(const struct cx24123_config* config, - struct i2c_adapter* i2c) +struct dvb_frontend *cx24123_attach(const struct cx24123_config *config, + struct i2c_adapter *i2c) { struct cx24123_state *state = kzalloc(sizeof(struct cx24123_state), GFP_KERNEL); @@ -1068,20 +1097,25 @@ struct dvb_frontend* cx24123_attach(const struct cx24123_config* config, /* check if the demod is there */ state->demod_rev = cx24123_readreg(state, 0x00); switch (state->demod_rev) { - case 0xe1: info("detected CX24123C\n"); break; - case 0xd1: info("detected CX24123\n"); break; + case 0xe1: + info("detected CX24123C\n"); + break; + case 0xd1: + info("detected CX24123\n"); + break; default: err("wrong demod revision: %x\n", state->demod_rev); goto error; } /* create dvb_frontend */ - memcpy(&state->frontend.ops, &cx24123_ops, sizeof(struct dvb_frontend_ops)); + memcpy(&state->frontend.ops, &cx24123_ops, + sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; - /* create tuner i2c adapter */ - if (config->dont_use_pll) - cx24123_repeater_mode(state, 1, 0); + /* create tuner i2c adapter */ + if (config->dont_use_pll) + cx24123_repeater_mode(state, 1, 0); strlcpy(state->tuner_i2c_adapter.name, "CX24123 tuner I2C bus", sizeof(state->tuner_i2c_adapter.name)); @@ -1090,7 +1124,7 @@ struct dvb_frontend* cx24123_attach(const struct cx24123_config* config, state->tuner_i2c_adapter.algo_data = NULL; i2c_set_adapdata(&state->tuner_i2c_adapter, state); if (i2c_add_adapter(&state->tuner_i2c_adapter) < 0) { - err("tuner i2c bus could not be initialized\n"); + err("tuner i2c bus could not be initialized\n"); goto error; } @@ -1101,6 +1135,7 @@ error: return NULL; } +EXPORT_SYMBOL(cx24123_attach); static struct dvb_frontend_ops cx24123_ops = { @@ -1137,15 +1172,8 @@ static struct dvb_frontend_ops cx24123_ops = { .get_frontend_algo = cx24123_get_algo, }; -module_param(debug, int, 0644); -MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)"); - -module_param(force_band, int, 0644); -MODULE_PARM_DESC(force_band, "Force a specific band select (1-9, default:off)."); - MODULE_DESCRIPTION("DVB Frontend module for Conexant " \ "CX24123/CX24109/CX24113 hardware"); MODULE_AUTHOR("Steven Toth"); MODULE_LICENSE("GPL"); -EXPORT_SYMBOL(cx24123_attach); diff --git a/linux/drivers/media/dvb/frontends/cx24123.h b/linux/drivers/media/dvb/frontends/cx24123.h index cc6b411d6..51ae866e9 100644 --- a/linux/drivers/media/dvb/frontends/cx24123.h +++ b/linux/drivers/media/dvb/frontends/cx24123.h @@ -23,13 +23,12 @@ #include -struct cx24123_config -{ +struct cx24123_config { /* the demodulator's i2c address */ u8 demod_address; /* Need to set device param for start_dma */ - int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured); + int (*set_ts_params)(struct dvb_frontend *fe, int is_punctured); /* 0 = LNB voltage normal, 1 = LNB voltage inverted */ int lnb_polarity; @@ -39,7 +38,8 @@ struct cx24123_config void (*agc_callback) (struct dvb_frontend *); }; -#if defined(CONFIG_DVB_CX24123) || (defined(CONFIG_DVB_CX24123_MODULE) && defined(MODULE)) +#if defined(CONFIG_DVB_CX24123) || (defined(CONFIG_DVB_CX24123_MODULE) \ + && defined(MODULE)) extern struct dvb_frontend *cx24123_attach(const struct cx24123_config *config, struct i2c_adapter *i2c); extern struct i2c_adapter *cx24123_get_tuner_i2c_adapter(struct dvb_frontend *); @@ -56,6 +56,6 @@ static struct i2c_adapter * printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); return NULL; } -#endif // CONFIG_DVB_CX24123 +#endif #endif /* CX24123_H */ -- cgit v1.2.3 From b414249d852c548811ee1152bbb6305d6d5af689 Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 16 Oct 2008 19:29:38 -0400 Subject: xc5000: Checkpatch compliance From: Steven Toth xc5000: Checkpatch compliance Priority: normal Signed-off-by: Steven Toth --- linux/drivers/media/common/tuners/xc5000.c | 73 +++++++++++++++--------------- linux/drivers/media/common/tuners/xc5000.h | 8 ++-- 2 files changed, 41 insertions(+), 40 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/common/tuners/xc5000.c b/linux/drivers/media/common/tuners/xc5000.c index f3a3c47fe..8cfac7002 100644 --- a/linux/drivers/media/common/tuners/xc5000.c +++ b/linux/drivers/media/common/tuners/xc5000.c @@ -43,7 +43,7 @@ MODULE_PARM_DESC(init_fw, "Load firmware during driver initialization."); static DEFINE_MUTEX(xc5000_list_mutex); static LIST_HEAD(hybrid_tuner_instance_list); -#define dprintk(level,fmt, arg...) if (debug >= level) \ +#define dprintk(level, fmt, arg...) if (debug >= level) \ printk(KERN_INFO "%s: " fmt, "xc5000", ## arg) #define XC5000_DEFAULT_FIRMWARE "dvb-fe-xc5000-1.1.fw" @@ -138,11 +138,11 @@ struct xc5000_priv { immediately the length of the following transaction. */ -typedef struct { +struct XC_TV_STANDARD { char *Name; u16 AudioMode; u16 VideoMode; -} XC_TV_STANDARD; +}; /* Tuner standards */ #define MN_NTSC_PAL_BTSC 0 @@ -169,7 +169,7 @@ typedef struct { #define FM_Radio_INPUT2 21 #define FM_Radio_INPUT1 22 -static XC_TV_STANDARD XC5000_Standard[MAX_TV_STANDARD] = { +static struct XC_TV_STANDARD XC5000_Standard[MAX_TV_STANDARD] = { {"M/N-NTSC/PAL-BTSC", 0x0400, 0x8020}, {"M/N-NTSC/PAL-A2", 0x0600, 0x8020}, {"M/N-NTSC/PAL-EIAJ", 0x0440, 0x8020}, @@ -183,7 +183,7 @@ static XC_TV_STANDARD XC5000_Standard[MAX_TV_STANDARD] = { {"D/K-PAL-NICAM", 0x0E80, 0x8009}, {"D/K-PAL-MONO", 0x1478, 0x8009}, {"D/K-SECAM-A2 DK1", 0x1200, 0x8009}, - {"D/K-SECAM-A2 L/DK3",0x0E00, 0x8009}, + {"D/K-SECAM-A2 L/DK3", 0x0E00, 0x8009}, {"D/K-SECAM-A2 MONO", 0x1478, 0x8009}, {"L-SECAM-NICAM", 0x8E82, 0x0009}, {"L'-SECAM-NICAM", 0x8E82, 0x4009}, @@ -307,9 +307,10 @@ static int xc_load_i2c_sequence(struct dvb_frontend *fe, const u8 *i2c_sequence) unsigned int len, pos, index; u8 buf[XC_MAX_I2C_WRITE_LENGTH]; - index=0; - while ((i2c_sequence[index]!=0xFF) || (i2c_sequence[index+1]!=0xFF)) { - len = i2c_sequence[index]* 256 + i2c_sequence[index+1]; + index = 0; + while ((i2c_sequence[index] != 0xFF) || + (i2c_sequence[index + 1] != 0xFF)) { + len = i2c_sequence[index] * 256 + i2c_sequence[index+1]; if (len == 0x0000) { /* RESET command */ result = xc_reset(fe); @@ -329,15 +330,17 @@ static int xc_load_i2c_sequence(struct dvb_frontend *fe, const u8 *i2c_sequence) buf[1] = i2c_sequence[index + 1]; pos = 2; while (pos < len) { - if ((len - pos) > XC_MAX_I2C_WRITE_LENGTH - 2) { - nbytes_to_send = XC_MAX_I2C_WRITE_LENGTH; - } else { + if ((len - pos) > XC_MAX_I2C_WRITE_LENGTH - 2) + nbytes_to_send = + XC_MAX_I2C_WRITE_LENGTH; + else nbytes_to_send = (len - pos + 2); + for (i = 2; i < nbytes_to_send; i++) { + buf[i] = i2c_sequence[index + pos + + i - 2]; } - for (i=2; ii2c_props.adap, &msg, 1) != 1) { - printk(KERN_ERR "xc5000 I2C read failed (len=%i)\n",(int)len); + printk(KERN_ERR "xc5000 I2C read failed (len=%i)\n", (int)len); return -EREMOTEIO; } return 0; } -static int xc5000_fwupload(struct dvb_frontend* fe) +static int xc5000_fwupload(struct dvb_frontend *fe) { struct xc5000_priv *priv = fe->tuner_priv; const struct firmware *fw; @@ -595,7 +597,8 @@ static int xc5000_fwupload(struct dvb_frontend* fe) printk(KERN_INFO "xc5000: waiting for firmware upload (%s)...\n", XC5000_DEFAULT_FIRMWARE); - ret = request_firmware(&fw, XC5000_DEFAULT_FIRMWARE, &priv->i2c_props.adap->dev); + ret = request_firmware(&fw, XC5000_DEFAULT_FIRMWARE, + &priv->i2c_props.adap->dev); if (ret) { printk(KERN_ERR "xc5000: Upload failed. (file not found?)\n"); ret = XC_RESULT_RESET_FAILURE; @@ -611,7 +614,7 @@ static int xc5000_fwupload(struct dvb_frontend* fe) ret = XC_RESULT_RESET_FAILURE; } else { printk(KERN_INFO "xc5000: firmware upload\n"); - ret = xc_load_i2c_sequence(fe, fw->data ); + ret = xc_load_i2c_sequence(fe, fw->data); } out: @@ -670,7 +673,7 @@ static int xc5000_set_params(struct dvb_frontend *fe, dprintk(1, "%s() frequency=%d (Hz)\n", __func__, params->frequency); - switch(params->u.vsb.modulation) { + switch (params->u.vsb.modulation) { case VSB_8: case VSB_16: dprintk(1, "%s() VSB modulation\n", __func__); @@ -767,42 +770,42 @@ static int xc5000_set_analog_params(struct dvb_frontend *fe, /* FIX ME: Some video standards may have several possible audio standards. We simply default to one of them here. */ - if(params->std & V4L2_STD_MN) { + if (params->std & V4L2_STD_MN) { /* default to BTSC audio standard */ priv->video_standard = MN_NTSC_PAL_BTSC; goto tune_channel; } - if(params->std & V4L2_STD_PAL_BG) { + if (params->std & V4L2_STD_PAL_BG) { /* default to NICAM audio standard */ priv->video_standard = BG_PAL_NICAM; goto tune_channel; } - if(params->std & V4L2_STD_PAL_I) { + if (params->std & V4L2_STD_PAL_I) { /* default to NICAM audio standard */ priv->video_standard = I_PAL_NICAM; goto tune_channel; } - if(params->std & V4L2_STD_PAL_DK) { + if (params->std & V4L2_STD_PAL_DK) { /* default to NICAM audio standard */ priv->video_standard = DK_PAL_NICAM; goto tune_channel; } - if(params->std & V4L2_STD_SECAM_DK) { + if (params->std & V4L2_STD_SECAM_DK) { /* default to A2 DK1 audio standard */ priv->video_standard = DK_SECAM_A2DK1; goto tune_channel; } - if(params->std & V4L2_STD_SECAM_L) { + if (params->std & V4L2_STD_SECAM_L) { priv->video_standard = L_SECAM_NICAM; goto tune_channel; } - if(params->std & V4L2_STD_SECAM_LC) { + if (params->std & V4L2_STD_SECAM_LC) { priv->video_standard = LC_SECAM_NICAM; goto tune_channel; } @@ -810,7 +813,7 @@ static int xc5000_set_analog_params(struct dvb_frontend *fe, tune_channel: ret = xc_SetSignalSource(priv, priv->rf_mode); if (ret != XC_RESULT_SUCCESS) { - printk(KERN_ERR + printk(KERN_ERR "xc5000: xc_SetSignalSource(%d) failed\n", priv->rf_mode); return -EREMOTEIO; @@ -882,7 +885,7 @@ static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe) * I2C transactions until calibration is complete. This way we * don't have to rely on clock stretching working. */ - xc_wait( 100 ); + xc_wait(100); /* Default to "CABLE" mode */ ret |= xc_write_reg(priv, XREG_SIGNALSOURCE, XC_RF_MODE_CABLE); @@ -904,15 +907,13 @@ static int xc5000_sleep(struct dvb_frontend *fe) */ ret = xc_shutdown(priv); - if(ret != XC_RESULT_SUCCESS) { + if (ret != XC_RESULT_SUCCESS) { printk(KERN_ERR "xc5000: %s() unable to shutdown tuner\n", __func__); return -EREMOTEIO; - } - else { + } else return XC_RESULT_SUCCESS; - } } static int xc5000_init(struct dvb_frontend *fe) @@ -1008,7 +1009,7 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe, if (xc5000_readreg(priv, XREG_PRODUCT_ID, &id) != 0) goto fail; - switch(id) { + switch (id) { case XC_PRODUCT_ID_FW_LOADED: printk(KERN_INFO "xc5000: Successfully identified at address 0x%02x\n", diff --git a/linux/drivers/media/common/tuners/xc5000.h b/linux/drivers/media/common/tuners/xc5000.h index cf1a558e0..f4c146698 100644 --- a/linux/drivers/media/common/tuners/xc5000.h +++ b/linux/drivers/media/common/tuners/xc5000.h @@ -45,17 +45,17 @@ struct xc5000_config { #if defined(CONFIG_MEDIA_TUNER_XC5000) || \ (defined(CONFIG_MEDIA_TUNER_XC5000_MODULE) && defined(MODULE)) -extern struct dvb_frontend* xc5000_attach(struct dvb_frontend *fe, +extern struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct xc5000_config *cfg); #else -static inline struct dvb_frontend* xc5000_attach(struct dvb_frontend *fe, +static inline struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct xc5000_config *cfg) { printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); return NULL; } -#endif // CONFIG_MEDIA_TUNER_XC5000 +#endif -#endif // __XC5000_H__ +#endif -- cgit v1.2.3 From c68f8a1e41810d2f39e380717f2289deb7dde7c8 Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 16 Oct 2008 19:30:45 -0400 Subject: cx88: Change spurious buffer message into a debug only message From: Steven Toth A number of users have complained that their syslog often shows this messages but it doesn't impact performance. I'm changing this to a debug message, so developers will still see the message during testing and users will no longer be bothered by this. Priority: normal Signed-off-by: Steven Toth --- linux/drivers/media/video/cx88/cx88-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/cx88/cx88-core.c b/linux/drivers/media/video/cx88/cx88-core.c index 4ce5f7589..b2f6dc5c3 100644 --- a/linux/drivers/media/video/cx88/cx88-core.c +++ b/linux/drivers/media/video/cx88/cx88-core.c @@ -574,7 +574,8 @@ void cx88_wakeup(struct cx88_core *core, mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); } if (bc != 1) - printk("%s: %d buffers handled (should be 1)\n",__func__,bc); + dprintk(2, "%s: %d buffers handled (should be 1)\n", + __func__, bc); } void cx88_shutdown(struct cx88_core *core) -- cgit v1.2.3 From e6236e8ddedbbd6189021eac4c7071fda656bcfd Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 16 Oct 2008 19:31:56 -0400 Subject: mxl5005s: Checkpatch compliance From: Steven Toth mxl5005s: Checkpatch compliance Priority: normal Signed-off-by: Steven Toth --- linux/drivers/media/common/tuners/mxl5005s.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/common/tuners/mxl5005s.c b/linux/drivers/media/common/tuners/mxl5005s.c index 20405506a..4cdca9f88 100644 --- a/linux/drivers/media/common/tuners/mxl5005s.c +++ b/linux/drivers/media/common/tuners/mxl5005s.c @@ -3483,7 +3483,9 @@ static u16 MXL_ControlWrite_Group(struct dvb_frontend *fe, u16 controlNum, } ctrlVal = 0; for (k = 0; k < state->MXL_Ctrl[i].size; k++) - ctrlVal += state->MXL_Ctrl[i].val[k] * (1 << k); + ctrlVal += state-> + MXL_Ctrl[i].val[k] * + (1 << k); } else return -1; } @@ -3583,7 +3585,7 @@ static void MXL_RegWriteBit(struct dvb_frontend *fe, u8 address, u8 bit, static u32 MXL_Ceiling(u32 value, u32 resolution) { - return (value/resolution + (value % resolution > 0 ? 1 : 0)); + return value / resolution + (value % resolution > 0 ? 1 : 0); } /* Retrieve the Initialzation Registers */ -- cgit v1.2.3 From 78057bdf11c9ba36c64c6c081eeb6bae29cd72c4 Mon Sep 17 00:00:00 2001 From: "darron@kewl.org" Date: Wed, 15 Oct 2008 17:37:59 +0100 Subject: MFE: bugfix: multi-frontend mutual exclusion parallel open From: Darron Broad When moving from one frontend to another an application could spawn multiple threads opening the same new frontend and in some circumstances all of these could become delayed waiting for the previous frontend readers or previous frontend writer thread to complete. In this scenario the first thread will succeed on open to bring the new frontend online but any others will return EBUSY. This is a fault. If the first succeeds and all others are on the same frontend then they should succeed also. Priority: normal Signed-off-by: Darron Broad Signed-off-by: Steven Toth --- linux/drivers/media/dvb/dvb-core/dvb_frontend.c | 49 ++++++++++++++----------- 1 file changed, 28 insertions(+), 21 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c index 51fb82edc..4fb5e671f 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -1825,39 +1825,46 @@ static int dvb_frontend_open(struct inode *inode, struct file *file) struct dvb_frontend *fe = dvbdev->priv; struct dvb_frontend_private *fepriv = fe->frontend_priv; struct dvb_adapter *adapter = fe->dvb; - struct dvb_device *mfedev; - struct dvb_frontend *mfe; - struct dvb_frontend_private *mfepriv; - int mferetry; int ret; dprintk ("%s\n", __func__); if (adapter->mfe_shared) { mutex_lock (&adapter->mfe_lock); - if (adapter->mfe_dvbdev != dvbdev) { - if (adapter->mfe_dvbdev) { - mfedev = adapter->mfe_dvbdev; - mfe = mfedev->priv; - mfepriv = mfe->frontend_priv; - mutex_unlock (&adapter->mfe_lock); - mferetry = (dvb_mfe_wait_time << 1); - while (mferetry-- && (mfedev->users != -1 || mfepriv->thread != NULL)) { - if(msleep_interruptible(500)) { - if(signal_pending(current)) - return -EINTR; - } + + if (adapter->mfe_dvbdev == NULL) + adapter->mfe_dvbdev = dvbdev; + + else if (adapter->mfe_dvbdev != dvbdev) { + struct dvb_device + *mfedev = adapter->mfe_dvbdev; + struct dvb_frontend + *mfe = mfedev->priv; + struct dvb_frontend_private + *mfepriv = mfe->frontend_priv; + int mferetry = (dvb_mfe_wait_time << 1); + + mutex_unlock (&adapter->mfe_lock); + while (mferetry-- && (mfedev->users != -1 || + mfepriv->thread != NULL)) { + if(msleep_interruptible(500)) { + if(signal_pending(current)) + return -EINTR; } - mutex_lock (&adapter->mfe_lock); + } + + mutex_lock (&adapter->mfe_lock); + if(adapter->mfe_dvbdev != dvbdev) { mfedev = adapter->mfe_dvbdev; mfe = mfedev->priv; mfepriv = mfe->frontend_priv; - if (mfedev->users != -1 || mfepriv->thread != NULL) { - ret = -EBUSY; - goto err0; + if (mfedev->users != -1 || + mfepriv->thread != NULL) { + mutex_unlock (&adapter->mfe_lock); + return -EBUSY; } + adapter->mfe_dvbdev = dvbdev; } - adapter->mfe_dvbdev = dvbdev; } } -- cgit v1.2.3 From c8efc47aefa864b92537ab1470b913b20e8dcacd Mon Sep 17 00:00:00 2001 From: "darron@kewl.org" Date: Wed, 15 Oct 2008 17:43:41 +0100 Subject: videobuf: data storage optimisation From: Darron Broad To optimise data storage redundant vars are removed. Priority: normal Signed-off-by: Darron Broad Signed-off-by: Steven Toth --- linux/drivers/media/video/cx23885/cx23885-core.c | 2 +- linux/drivers/media/video/cx88/cx88-mpeg.c | 2 +- linux/drivers/media/video/saa7134/saa7134-dvb.c | 2 +- linux/drivers/media/video/videobuf-dvb.c | 11 +++++------ 4 files changed, 8 insertions(+), 9 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/cx23885/cx23885-core.c b/linux/drivers/media/video/cx23885/cx23885-core.c index 009e5cb01..4f68156d2 100644 --- a/linux/drivers/media/video/cx23885/cx23885-core.c +++ b/linux/drivers/media/video/cx23885/cx23885-core.c @@ -644,7 +644,7 @@ static int cx23885_init_tsport(struct cx23885_dev *dev, init_timer(&port->mpegq.timeout); mutex_init(&port->frontends.lock); - INIT_LIST_HEAD(&port->frontends.frontend.felist); + INIT_LIST_HEAD(&port->frontends.felist); port->frontends.active_fe_id = 0; /* This should be hardcoded allow a single frontend diff --git a/linux/drivers/media/video/cx88/cx88-mpeg.c b/linux/drivers/media/video/cx88/cx88-mpeg.c index 819d7fbdf..8df19ae43 100644 --- a/linux/drivers/media/video/cx88/cx88-mpeg.c +++ b/linux/drivers/media/video/cx88/cx88-mpeg.c @@ -842,7 +842,7 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, list_add_tail(&dev->devlist,&cx8802_devlist); mutex_init(&dev->frontends.lock); - INIT_LIST_HEAD(&dev->frontends.frontend.felist); + INIT_LIST_HEAD(&dev->frontends.felist); printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__, core->board.num_frontends); diff --git a/linux/drivers/media/video/saa7134/saa7134-dvb.c b/linux/drivers/media/video/saa7134/saa7134-dvb.c index 11a7c76bc..63f76afac 100644 --- a/linux/drivers/media/video/saa7134/saa7134-dvb.c +++ b/linux/drivers/media/video/saa7134/saa7134-dvb.c @@ -953,7 +953,7 @@ static int dvb_init(struct saa7134_dev *dev) /* FIXME: add support for multi-frontend */ mutex_init(&dev->frontends.lock); - INIT_LIST_HEAD(&dev->frontends.frontend.felist); + INIT_LIST_HEAD(&dev->frontends.felist); dev->frontends.active_fe_id = 0; printk(KERN_INFO "%s() allocating 1 frontend\n", __func__); diff --git a/linux/drivers/media/video/videobuf-dvb.c b/linux/drivers/media/video/videobuf-dvb.c index 33e2f2b2b..2b7c10674 100644 --- a/linux/drivers/media/video/videobuf-dvb.c +++ b/linux/drivers/media/video/videobuf-dvb.c @@ -167,9 +167,8 @@ int videobuf_dvb_register_bus(struct videobuf_dvb_frontends *f, /* Attach all of the frontends to the adapter */ mutex_lock(&f->lock); - list_for_each_safe(list, q, &f->frontend.felist) { + list_for_each_safe(list, q, &f->felist) { fe = list_entry(list, struct videobuf_dvb_frontend, felist); - res = videobuf_dvb_register_frontend(&f->adapter, &fe->dvb); if (res < 0) { printk(KERN_WARNING "%s: videobuf_dvb_register_frontend failed (errno = %d)\n", @@ -295,7 +294,7 @@ void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f) struct videobuf_dvb_frontend *fe; mutex_lock(&f->lock); - list_for_each_safe(list, q, &f->frontend.felist) { + list_for_each_safe(list, q, &f->felist) { fe = list_entry(list, struct videobuf_dvb_frontend, felist); dvb_net_release(&fe->dvb.net); @@ -321,7 +320,7 @@ struct videobuf_dvb_frontend * videobuf_dvb_get_frontend(struct videobuf_dvb_fro mutex_lock(&f->lock); - list_for_each_safe(list, q, &f->frontend.felist) { + list_for_each_safe(list, q, &f->felist) { fe = list_entry(list, struct videobuf_dvb_frontend, felist); if (fe->id == id) { ret = fe; @@ -342,7 +341,7 @@ int videobuf_dvb_find_frontend(struct videobuf_dvb_frontends *f, struct dvb_fron mutex_lock(&f->lock); - list_for_each_safe(list, q, &f->frontend.felist) { + list_for_each_safe(list, q, &f->felist) { fe = list_entry(list, struct videobuf_dvb_frontend, felist); if (fe->dvb.frontend == p) { ret = fe->id; @@ -368,7 +367,7 @@ struct videobuf_dvb_frontend * videobuf_dvb_alloc_frontend(void *private, struct mutex_init(&fe->dvb.lock); mutex_lock(&f->lock); - list_add_tail(&fe->felist,&f->frontend.felist); + list_add_tail(&fe->felist,&f->felist); mutex_unlock(&f->lock); fail_alloc: -- cgit v1.2.3 From 41f0a49d3fd3134bcf676eadc63bef5c832b2b8a Mon Sep 17 00:00:00 2001 From: "darron@kewl.org" Date: Wed, 15 Oct 2008 17:48:43 +0100 Subject: videobuf: properly handle attachment failure From: Darron Broad This fixes attachment failure where we now unwind attachment and skip non-attached nodes where necessary so we can survive a fault situation correctly. Priority: normal Signed-off-by: Darron Broad Signed-off-by: Steven Toth --- linux/drivers/media/video/videobuf-dvb.c | 37 +++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 13 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/videobuf-dvb.c b/linux/drivers/media/video/videobuf-dvb.c index 2b7c10674..12dcd486a 100644 --- a/linux/drivers/media/video/videobuf-dvb.c +++ b/linux/drivers/media/video/videobuf-dvb.c @@ -150,19 +150,19 @@ int videobuf_dvb_register_bus(struct videobuf_dvb_frontends *f, { struct list_head *list, *q; struct videobuf_dvb_frontend *fe; - int res = -EINVAL; + int res; fe = videobuf_dvb_get_frontend(f, 1); if (!fe) { printk(KERN_WARNING "Unable to register the adapter which has no frontends\n"); - goto err; + return -EINVAL; } /* Bring up the adapter */ res = videobuf_dvb_register_adapter(f, module, adapter_priv, device, fe->dvb.name, adapter_nr, mfe_shared); if (res < 0) { printk(KERN_WARNING "videobuf_dvb_register_adapter failed (errno = %d)\n", res); - goto err; + return res; } /* Attach all of the frontends to the adapter */ @@ -173,11 +173,15 @@ int videobuf_dvb_register_bus(struct videobuf_dvb_frontends *f, if (res < 0) { printk(KERN_WARNING "%s: videobuf_dvb_register_frontend failed (errno = %d)\n", fe->dvb.name, res); + goto err; } } mutex_unlock(&f->lock); + return 0; err: + mutex_unlock(&f->lock); + videobuf_dvb_unregister_bus(f); return res; } @@ -269,6 +273,10 @@ int videobuf_dvb_register_frontend(struct dvb_adapter *adapter, struct videobuf_ /* register network adapter */ dvb_net_init(adapter, &dvb->net, &dvb->demux.dmx); + if (dvb->net.dvbdev == NULL) { + result = -ENOMEM; + goto fail_fe_conn; + } return 0; fail_fe_conn: @@ -283,7 +291,7 @@ fail_dmx: dvb_unregister_frontend(dvb->frontend); fail_frontend: dvb_frontend_detach(dvb->frontend); - dvb_unregister_adapter(adapter); + dvb->frontend = NULL; return result; } @@ -296,15 +304,18 @@ void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f) mutex_lock(&f->lock); list_for_each_safe(list, q, &f->felist) { fe = list_entry(list, struct videobuf_dvb_frontend, felist); - - dvb_net_release(&fe->dvb.net); - fe->dvb.demux.dmx.remove_frontend(&fe->dvb.demux.dmx, &fe->dvb.fe_mem); - fe->dvb.demux.dmx.remove_frontend(&fe->dvb.demux.dmx, &fe->dvb.fe_hw); - dvb_dmxdev_release(&fe->dvb.dmxdev); - dvb_dmx_release(&fe->dvb.demux); - dvb_unregister_frontend(fe->dvb.frontend); - dvb_frontend_detach(fe->dvb.frontend); - + if(fe->dvb.net.dvbdev) { + dvb_net_release(&fe->dvb.net); + fe->dvb.demux.dmx.remove_frontend(&fe->dvb.demux.dmx, &fe->dvb.fe_mem); + fe->dvb.demux.dmx.remove_frontend(&fe->dvb.demux.dmx, &fe->dvb.fe_hw); + dvb_dmxdev_release(&fe->dvb.dmxdev); + dvb_dmx_release(&fe->dvb.demux); + dvb_unregister_frontend(fe->dvb.frontend); + } + if(fe->dvb.frontend) { /* always allocated, may have been reset */ + dvb_frontend_detach(fe->dvb.frontend); + fe->dvb.frontend = NULL; + } list_del(list); kfree(fe); } -- cgit v1.2.3 From 76830c89b3ecf9304920933243a3a5e996f37ce8 Mon Sep 17 00:00:00 2001 From: "darron@kewl.org" Date: Wed, 15 Oct 2008 18:12:30 +0100 Subject: cx88: Update of audio routing config for FM radio This adds audio routing for the hvr-1300/3000/4000 cards enabling FM audio for the I2S ADC method of the cx88. At this time only the HVR-4000 has been tested. It is assumed the HVR-3000/1300 are the same. Priority: normal Signed-off-by: Darron Broad Signed-off-by: Steven Toth --- linux/drivers/media/video/cx88/cx88-cards.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/cx88/cx88-cards.c b/linux/drivers/media/video/cx88/cx88-cards.c index eac3508d6..1a79387c0 100644 --- a/linux/drivers/media/video/cx88/cx88-cards.c +++ b/linux/drivers/media/video/cx88/cx88-cards.c @@ -1314,22 +1314,26 @@ static const struct cx88_board cx88_boards[] = { .type = CX88_VMUX_TELEVISION, .vmux = 0, .gpio0 = 0x84bf, + /* 1: TV Audio / FM Mono */ .audioroute = 1, },{ .type = CX88_VMUX_COMPOSITE1, .vmux = 1, .gpio0 = 0x84bf, + /* 2: Line-In */ .audioroute = 2, },{ .type = CX88_VMUX_SVIDEO, .vmux = 2, .gpio0 = 0x84bf, + /* 2: Line-In */ .audioroute = 2, }}, - /* FIXME Radio tunes but only noise is heard */ .radio = { .type = CX88_RADIO, .gpio0 = 0x84bf, + /* 4: FM Stereo (untested) */ + .audioroute = 8, }, .mpeg = CX88_MPEG_DVB, .num_frontends = 2, @@ -1398,23 +1402,27 @@ static const struct cx88_board cx88_boards[] = { .type = CX88_VMUX_TELEVISION, .vmux = 0, .gpio0 = 0xef88, + /* 1: TV Audio / FM Mono */ .audioroute = 1, },{ .type = CX88_VMUX_COMPOSITE1, .vmux = 1, .gpio0 = 0xef88, + /* 2: Line-In */ .audioroute = 2, },{ .type = CX88_VMUX_SVIDEO, .vmux = 2, .gpio0 = 0xef88, + /* 2: Line-In */ .audioroute = 2, }}, - /* fixme: Add radio support */ .mpeg = CX88_MPEG_DVB | CX88_MPEG_BLACKBIRD, .radio = { .type = CX88_RADIO, .gpio0 = 0xef88, + /* 4: FM Stereo (untested) */ + .audioroute = 8, }, }, [CX88_BOARD_ADSTECH_PTV_390] = { @@ -1788,27 +1796,38 @@ static const struct cx88_board cx88_boards[] = { * d 0 I * e 1 O * f 1 O + * + * WM8775 ADC + * + * 1: TV Audio / FM Mono + * 2: Line-In + * 3: Line-In Expansion + * 4: FM Stereo */ .input = {{ .type = CX88_VMUX_TELEVISION, .vmux = 0, .gpio0 = 0xc4bf, + /* 1: TV Audio / FM Mono */ .audioroute = 1, }, { .type = CX88_VMUX_COMPOSITE1, .vmux = 1, .gpio0 = 0xc4bf, + /* 2: Line-In */ .audioroute = 2, }, { .type = CX88_VMUX_SVIDEO, .vmux = 2, .gpio0 = 0xc4bf, + /* 2: Line-In */ .audioroute = 2, } }, - /* FIXME Radio tunes but only noise is heard */ .radio = { .type = CX88_RADIO, .gpio0 = 0xc4bf, + /* 4: FM Stereo */ + .audioroute = 8, }, .mpeg = CX88_MPEG_DVB, .num_frontends = 2, -- cgit v1.2.3 From cebcc9b2ede5e03540724cf09e8f9a39aeb99f8c Mon Sep 17 00:00:00 2001 From: "darron@kewl.org" Date: Wed, 15 Oct 2008 18:14:30 +0100 Subject: tuner: add FMD1216MEX tuner From: Darron Broad This tuner was already supported by proxy as an FMD1216ME, however, the MEX uses a different FM Radio IF so this addition is now required. Priority: normal Signed-off-by: Darron Broad Signed-off-by: Steven Toth --- linux/drivers/media/common/tuners/tuner-simple.c | 2 ++ linux/drivers/media/common/tuners/tuner-types.c | 33 +++++++++++++++++++++++- linux/drivers/media/video/tveeprom.c | 2 +- 3 files changed, 35 insertions(+), 2 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/common/tuners/tuner-simple.c b/linux/drivers/media/common/tuners/tuner-simple.c index 036504510..0d9fc1bb2 100644 --- a/linux/drivers/media/common/tuners/tuner-simple.c +++ b/linux/drivers/media/common/tuners/tuner-simple.c @@ -513,6 +513,7 @@ static int simple_radio_bandswitch(struct dvb_frontend *fe, u8 *buffer) case TUNER_PHILIPS_FM1216ME_MK3: case TUNER_PHILIPS_FM1236_MK3: case TUNER_PHILIPS_FMD1216ME_MK3: + case TUNER_PHILIPS_FMD1216MEX_MK3: case TUNER_LG_NTSC_TAPE: case TUNER_PHILIPS_FM1256_IH3: case TUNER_TCL_MF02GIP_5N: @@ -787,6 +788,7 @@ static void simple_set_dvb(struct dvb_frontend *fe, u8 *buf, switch (priv->type) { case TUNER_PHILIPS_FMD1216ME_MK3: + case TUNER_PHILIPS_FMD1216MEX_MK3: if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ && params->frequency >= 158870000) buf[3] |= 0x08; diff --git a/linux/drivers/media/common/tuners/tuner-types.c b/linux/drivers/media/common/tuners/tuner-types.c index 861d23872..d83df3604 100644 --- a/linux/drivers/media/common/tuners/tuner-types.c +++ b/linux/drivers/media/common/tuners/tuner-types.c @@ -947,7 +947,7 @@ static struct tuner_params tuner_tena_9533_di_params[] = { }, }; -/* ------------ TUNER_PHILIPS_FMD1216ME_MK3 - Philips PAL ------------ */ +/* ------------ TUNER_PHILIPS_FMD1216ME(X)_MK3 - Philips PAL ------------ */ static struct tuner_range tuner_philips_fmd1216me_mk3_pal_ranges[] = { { 16 * 160.00 /*MHz*/, 0x86, 0x51, }, @@ -985,6 +985,27 @@ static struct tuner_params tuner_philips_fmd1216me_mk3_params[] = { }, }; +static struct tuner_params tuner_philips_fmd1216mex_mk3_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_philips_fmd1216me_mk3_pal_ranges, + .count = ARRAY_SIZE(tuner_philips_fmd1216me_mk3_pal_ranges), + .has_tda9887 = 1, + .port1_active = 1, + .port2_active = 1, + .port2_fm_high_sensitivity = 1, + .port2_invert_for_secam_lc = 1, + .port1_set_for_fm_mono = 1, + .radio_if = 1, + .fm_gain_normal = 1, + }, + { + .type = TUNER_PARAM_TYPE_DIGITAL, + .ranges = tuner_philips_fmd1216me_mk3_dvb_ranges, + .count = ARRAY_SIZE(tuner_philips_fmd1216me_mk3_dvb_ranges), + .iffreq = 16 * 36.125, /*MHz*/ + }, +}; /* ------ TUNER_LG_TDVS_H06XF - LG INNOTEK / INFINEON ATSC ----- */ @@ -1664,6 +1685,16 @@ struct tunertype tuners[] = { .params = tuner_tcl_mf02gip_5n_params, .count = ARRAY_SIZE(tuner_tcl_mf02gip_5n_params), }, + [TUNER_PHILIPS_FMD1216MEX_MK3] = { /* Philips PAL */ + .name = "Philips FMD1216MEX MK3 Hybrid Tuner", + .params = tuner_philips_fmd1216mex_mk3_params, + .count = ARRAY_SIZE(tuner_philips_fmd1216mex_mk3_params), + .min = 16 * 50.87, + .max = 16 * 858.00, + .stepsize = 166667, + .initdata = tua603x_agc112, + .sleepdata = (u8[]){ 4, 0x9c, 0x60, 0x85, 0x54 }, + }, }; EXPORT_SYMBOL(tuners); diff --git a/linux/drivers/media/video/tveeprom.c b/linux/drivers/media/video/tveeprom.c index 5f088e669..c1809a56b 100644 --- a/linux/drivers/media/video/tveeprom.c +++ b/linux/drivers/media/video/tveeprom.c @@ -243,7 +243,7 @@ hauppauge_tuner[] = { TUNER_ABSENT, "TCL M2523_3DBH_E"}, { TUNER_ABSENT, "TCL M2523_3DIH_E"}, { TUNER_ABSENT, "TCL MFPE05_2_U"}, - { TUNER_PHILIPS_FMD1216ME_MK3, "Philips FMD1216MEX"}, + { TUNER_PHILIPS_FMD1216MEX_MK3, "Philips FMD1216MEX"}, { TUNER_ABSENT, "Philips FRH2036B"}, { TUNER_ABSENT, "Panasonic ENGF75_01GF"}, { TUNER_ABSENT, "MaxLinear MXL5005"}, -- cgit v1.2.3 From 2082ad419513b9aa806e180da67b925b514df28d Mon Sep 17 00:00:00 2001 From: "darron@kewl.org" Date: Wed, 15 Oct 2008 18:18:42 +0100 Subject: cx88: add I2S-ADC tvaudio method From: Darron Broad This adds I2S-ADC tvaudio mode as a formal method of audio delivery. This fixes one bug and adds fm audio via I2S-ADC on cards that support it. The bug occured before when I2S-ADC mode was initiated on composite/s-video open but was then reset within 500ms by the audio thread which used any previous audio tuning details. Priority: normal Signed-off-by: Darron Broad Signed-off-by: Steven Toth --- linux/drivers/media/video/cx88/cx88-tvaudio.c | 11 ++++++ linux/drivers/media/video/cx88/cx88-video.c | 52 +++++++++++++++------------ linux/drivers/media/video/cx88/cx88.h | 1 + 3 files changed, 42 insertions(+), 22 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/cx88/cx88-tvaudio.c b/linux/drivers/media/video/cx88/cx88-tvaudio.c index 5eb95dbbe..0039354cf 100644 --- a/linux/drivers/media/video/cx88/cx88-tvaudio.c +++ b/linux/drivers/media/video/cx88/cx88-tvaudio.c @@ -771,6 +771,14 @@ void cx88_set_tvaudio(struct cx88_core *core) case WW_FM: set_audio_standard_FM(core, radio_deemphasis); break; + case WW_I2SADC: + set_audio_start(core, 0x01); + /* Slave/Philips/Autobaud */ + cx_write(AUD_I2SINPUTCNTL, 0); + /* Switch to "I2S ADC mode" */ + cx_write(AUD_I2SCNTL, 0x1); + set_audio_finish(core, EN_I2SIN_ENABLE); + break; case WW_NONE: default: printk("%s/0: unknown tv audio mode [%d]\n", @@ -948,6 +956,9 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual) break; } break; + case WW_I2SADC: + /* DO NOTHING */ + break; } if (UNSET != ctl) { diff --git a/linux/drivers/media/video/cx88/cx88-video.c b/linux/drivers/media/video/cx88/cx88-video.c index c4fdb6da2..79b6b0b6d 100644 --- a/linux/drivers/media/video/cx88/cx88-video.c +++ b/linux/drivers/media/video/cx88/cx88-video.c @@ -427,24 +427,7 @@ int cx88_video_mux(struct cx88_core *core, unsigned int input) /* if there are audioroutes defined, we have an external ADC to deal with audio */ - if (INPUT(input).audioroute) { - - /* cx2388's C-ADC is connected to the tuner only. - When used with S-Video, that ADC is busy dealing with - chroma, so an external must be used for baseband audio */ - - if (INPUT(input).type != CX88_VMUX_TELEVISION && - INPUT(input).type != CX88_RADIO) { - /* "ADC mode" */ - cx_write(AUD_I2SCNTL, 0x1); - cx_set(AUD_CTL, EN_I2SIN_ENABLE); - } else { - /* Normal mode */ - cx_write(AUD_I2SCNTL, 0x0); - cx_clear(AUD_CTL, EN_I2SIN_ENABLE); - } - /* The wm8775 module has the "2" route hardwired into the initialization. Some boards may use different routes for different inputs. HVR-1300 surely does */ @@ -455,9 +438,19 @@ int cx88_video_mux(struct cx88_core *core, unsigned int input) route.input = INPUT(input).audioroute; cx88_call_i2c_clients(core, VIDIOC_INT_S_AUDIO_ROUTING, &route); - } - + /* cx2388's C-ADC is connected to the tuner only. + When used with S-Video, that ADC is busy dealing with + chroma, so an external must be used for baseband audio */ + if (INPUT(input).type != CX88_VMUX_TELEVISION ) { + /* "I2S ADC mode" */ + core->tvaudio = WW_I2SADC; + cx88_set_tvaudio(core); + } else { + /* Normal mode */ + cx_write(AUD_I2SCNTL, 0x0); + cx_clear(AUD_CTL, EN_I2SIN_ENABLE); + } } return 0; @@ -1058,9 +1051,24 @@ static int video_open(struct inode *inode, struct file *file) cx_write(MO_GP0_IO, core->board.radio.gpio0); cx_write(MO_GP1_IO, core->board.radio.gpio1); cx_write(MO_GP2_IO, core->board.radio.gpio2); - core->tvaudio = WW_FM; - cx88_set_tvaudio(core); - cx88_set_stereo(core,V4L2_TUNER_MODE_STEREO,1); + if (core->board.radio.audioroute) { + if(core->board.audio_chip && + core->board.audio_chip == V4L2_IDENT_WM8775) { + struct v4l2_routing route; + + route.input = core->board.radio.audioroute; + cx88_call_i2c_clients(core, + VIDIOC_INT_S_AUDIO_ROUTING, &route); + } + /* "I2S ADC mode" */ + core->tvaudio = WW_I2SADC; + cx88_set_tvaudio(core); + } else { + /* FM Mode */ + core->tvaudio = WW_FM; + cx88_set_tvaudio(core); + cx88_set_stereo(core,V4L2_TUNER_MODE_STEREO,1); + } cx88_call_i2c_clients(core,AUDC_SET_RADIO,NULL); } unlock_kernel(); diff --git a/linux/drivers/media/video/cx88/cx88.h b/linux/drivers/media/video/cx88/cx88.h index 774c0b9b1..0fc7c91f7 100644 --- a/linux/drivers/media/video/cx88/cx88.h +++ b/linux/drivers/media/video/cx88/cx88.h @@ -651,6 +651,7 @@ extern void cx88_setup_xc3028(struct cx88_core *core, struct xc2028_ctrl *ctl); #define WW_EIAJ 7 #define WW_I2SPT 8 #define WW_FM 9 +#define WW_I2SADC 10 void cx88_set_tvaudio(struct cx88_core *core); void cx88_newstation(struct cx88_core *core); -- cgit v1.2.3 From 88ad9b4d994c8b8e301d0097ae3d6e27bf717683 Mon Sep 17 00:00:00 2001 From: "darron@kewl.org" Date: Thu, 16 Oct 2008 00:01:32 +0100 Subject: cx24116: optimise emulated auto-pilot From: Christophe Thommeret Christophe divulged the following: "Since 8PSK (and higher mod) signals are very likely to have pilot symbols, pilot_auto should start with pilot_on for 8PSK. And since QPSK signals are unlikely to have pilot, pilot_auto should start with pilot_off for QPSK. Without the patch: QPSK tuning delay: ~100ms 8PSK tuning delay: ~900ms with patch: QPSK tuning delay: ~100ms 8PSK tuning delay: ~100ms " This patch does as Cristophe asks. In emulated auto-pilot we choose pilot-on for tuning PSK_8 and pilot-off for tuning QPSK. Priority: normal Signed-off-by: Darron Broad Signed-off-by: Steven Toth --- linux/drivers/media/dvb/frontends/cx24116.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/frontends/cx24116.c b/linux/drivers/media/dvb/frontends/cx24116.c index fa6dc1843..955e8cfe3 100644 --- a/linux/drivers/media/dvb/frontends/cx24116.c +++ b/linux/drivers/media/dvb/frontends/cx24116.c @@ -1265,7 +1265,10 @@ static int cx24116_set_frontend(struct dvb_frontend *fe, switch (c->pilot) { case PILOT_AUTO: /* Not supported but emulated */ - retune = 2; /* Fall-through */ + state->dnxt.pilot_val = (c->modulation == QPSK) + ? CX24116_PILOT_OFF : CX24116_PILOT_ON; + retune = 2; + break; case PILOT_OFF: state->dnxt.pilot_val = CX24116_PILOT_OFF; break; -- cgit v1.2.3 From a02327e81915e000e69a6db7297d68d578b8df97 Mon Sep 17 00:00:00 2001 From: "darron@kewl.org" Date: Thu, 16 Oct 2008 00:26:34 +0100 Subject: videobuf: data storage optimisation (2) From: Darron Broad To optimise data storage even further one other redundant var has been removed. This also removes a redundant assignment. Priority: normal Signed-off-by: Darron Broad iSigned-off-by: Steven Toth --- linux/drivers/media/video/cx23885/cx23885-dvb.c | 2 +- linux/drivers/media/video/cx88/cx88-mpeg.c | 2 +- linux/drivers/media/video/saa7134/saa7134-dvb.c | 2 +- linux/drivers/media/video/videobuf-dvb.c | 7 ++----- 4 files changed, 5 insertions(+), 8 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/cx23885/cx23885-dvb.c b/linux/drivers/media/video/cx23885/cx23885-dvb.c index 43baf5aea..a11fdbfb5 100644 --- a/linux/drivers/media/video/cx23885/cx23885-dvb.c +++ b/linux/drivers/media/video/cx23885/cx23885-dvb.c @@ -572,7 +572,7 @@ int cx23885_dvb_register(struct cx23885_tsport *port) port->num_frontends); for (i = 1; i <= port->num_frontends; i++) { - if (videobuf_dvb_alloc_frontend(dev, + if (videobuf_dvb_alloc_frontend( &port->frontends, i) == NULL) { printk(KERN_ERR "%s() failed to alloc\n", __func__); return -ENOMEM; diff --git a/linux/drivers/media/video/cx88/cx88-mpeg.c b/linux/drivers/media/video/cx88/cx88-mpeg.c index 8df19ae43..bad3680b9 100644 --- a/linux/drivers/media/video/cx88/cx88-mpeg.c +++ b/linux/drivers/media/video/cx88/cx88-mpeg.c @@ -847,7 +847,7 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__, core->board.num_frontends); for (i = 1; i <= core->board.num_frontends; i++) { - demod = videobuf_dvb_alloc_frontend(dev, &dev->frontends, i); + demod = videobuf_dvb_alloc_frontend(&dev->frontends, i); if(demod == NULL) { printk(KERN_ERR "%s() failed to alloc\n", __func__); err = -ENOMEM; diff --git a/linux/drivers/media/video/saa7134/saa7134-dvb.c b/linux/drivers/media/video/saa7134/saa7134-dvb.c index 63f76afac..099761046 100644 --- a/linux/drivers/media/video/saa7134/saa7134-dvb.c +++ b/linux/drivers/media/video/saa7134/saa7134-dvb.c @@ -958,7 +958,7 @@ static int dvb_init(struct saa7134_dev *dev) printk(KERN_INFO "%s() allocating 1 frontend\n", __func__); - if (videobuf_dvb_alloc_frontend(dev, &dev->frontends, 1) == NULL) { + if (videobuf_dvb_alloc_frontend(&dev->frontends, 1) == NULL) { printk(KERN_ERR "%s() failed to alloc\n", __func__); return -ENOMEM; } diff --git a/linux/drivers/media/video/videobuf-dvb.c b/linux/drivers/media/video/videobuf-dvb.c index 12dcd486a..67cee5ea9 100644 --- a/linux/drivers/media/video/videobuf-dvb.c +++ b/linux/drivers/media/video/videobuf-dvb.c @@ -312,10 +312,8 @@ void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f) dvb_dmx_release(&fe->dvb.demux); dvb_unregister_frontend(fe->dvb.frontend); } - if(fe->dvb.frontend) { /* always allocated, may have been reset */ + if(fe->dvb.frontend) /* always allocated, may have been reset */ dvb_frontend_detach(fe->dvb.frontend); - fe->dvb.frontend = NULL; - } list_del(list); kfree(fe); } @@ -365,7 +363,7 @@ int videobuf_dvb_find_frontend(struct videobuf_dvb_frontends *f, struct dvb_fron return ret; } -struct videobuf_dvb_frontend * videobuf_dvb_alloc_frontend(void *private, struct videobuf_dvb_frontends *f, int id) +struct videobuf_dvb_frontend * videobuf_dvb_alloc_frontend(struct videobuf_dvb_frontends *f, int id) { struct videobuf_dvb_frontend *fe; @@ -373,7 +371,6 @@ struct videobuf_dvb_frontend * videobuf_dvb_alloc_frontend(void *private, struct if (fe == NULL) goto fail_alloc; - fe->dev = private; fe->id = id; mutex_init(&fe->dvb.lock); -- cgit v1.2.3 From fbca1ee9b4a37576b9c0cb36817733f2eae1f8bb Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Mon, 13 Oct 2008 17:23:49 -0400 Subject: mxl5005s: Bug fix stopped DVB-T from working the second time around. From: Jose Alberto Reguero Jose reported: I am using a Avermedia Volar X with af9015 driver(DVB-T). The first time you use the card, first call reconfigure with MXL_QAM, and when tune DVB-T it calls reconfigure with MXL_DVBT. But if you close the frontend and open again, it calls reconfigure with MXL_QAM, but not call reconfigure with MXL_DVBT because state->current_mode don't change(is MXL_DVBT). Priority: normal Signed-off-by: Jose Alberto Reguero Signed-off-by: Steven Toth --- linux/drivers/media/common/tuners/mxl5005s.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/common/tuners/mxl5005s.c b/linux/drivers/media/common/tuners/mxl5005s.c index 4cdca9f88..3ed0d45cd 100644 --- a/linux/drivers/media/common/tuners/mxl5005s.c +++ b/linux/drivers/media/common/tuners/mxl5005s.c @@ -3914,7 +3914,10 @@ static int mxl5005s_writeregs(struct dvb_frontend *fe, u8 *addrtable, static int mxl5005s_init(struct dvb_frontend *fe) { + struct mxl5005s_state *state = fe->tuner_priv; + dprintk(1, "%s()\n", __func__); + state->current_mode = MXL_QAM; return mxl5005s_reconfigure(fe, MXL_QAM, MXL5005S_BANDWIDTH_6MHZ); } @@ -4096,7 +4099,6 @@ struct dvb_frontend *mxl5005s_attach(struct dvb_frontend *fe, state->frontend = fe; state->config = config; state->i2c = i2c; - state->current_mode = MXL_QAM; printk(KERN_INFO "MXL5005S: Attached at address 0x%02x\n", config->i2c_address); -- cgit v1.2.3 From 3bfa1b6975d80f0f6728e13de028100a3e48aa49 Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 16 Oct 2008 20:42:10 -0400 Subject: MFE: videobuf-dvb.c checkpatch cleanup as part of MFE merge From: Steven Toth MFE: videobuf-dvb.c checkpatch cleanup as part of MFE merge Priority: normal Signed-off-by: Steven Toth --- linux/drivers/media/video/videobuf-dvb.c | 43 +++++++++++++++++++------------- 1 file changed, 25 insertions(+), 18 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/videobuf-dvb.c b/linux/drivers/media/video/videobuf-dvb.c index 67cee5ea9..77b7a42d9 100644 --- a/linux/drivers/media/video/videobuf-dvb.c +++ b/linux/drivers/media/video/videobuf-dvb.c @@ -131,7 +131,6 @@ static int videobuf_dvb_stop_feed(struct dvb_demux_feed *feed) mutex_lock(&dvb->lock); dvb->nfeeds--; if (0 == dvb->nfeeds && NULL != dvb->thread) { - // FIXME: cx8802_cancel_buffers(dev); err = kthread_stop(dvb->thread); dvb->thread = NULL; } @@ -159,7 +158,8 @@ int videobuf_dvb_register_bus(struct videobuf_dvb_frontends *f, } /* Bring up the adapter */ - res = videobuf_dvb_register_adapter(f, module, adapter_priv, device, fe->dvb.name, adapter_nr, mfe_shared); + res = videobuf_dvb_register_adapter(f, module, adapter_priv, device, + fe->dvb.name, adapter_nr, mfe_shared); if (res < 0) { printk(KERN_WARNING "videobuf_dvb_register_adapter failed (errno = %d)\n", res); return res; @@ -184,6 +184,7 @@ err: videobuf_dvb_unregister_bus(f); return res; } +EXPORT_SYMBOL(videobuf_dvb_register_bus); int videobuf_dvb_register_adapter(struct videobuf_dvb_frontends *fe, struct module *module, @@ -198,7 +199,8 @@ int videobuf_dvb_register_adapter(struct videobuf_dvb_frontends *fe, mutex_init(&fe->lock); /* register adapter */ - result = dvb_register_adapter(&fe->adapter, adapter_name, module, device, adapter_nr); + result = dvb_register_adapter(&fe->adapter, adapter_name, module, + device, adapter_nr); if (result < 0) { printk(KERN_WARNING "%s: dvb_register_adapter failed (errno = %d)\n", adapter_name, result); @@ -209,7 +211,8 @@ int videobuf_dvb_register_adapter(struct videobuf_dvb_frontends *fe, return result; } -int videobuf_dvb_register_frontend(struct dvb_adapter *adapter, struct videobuf_dvb *dvb) +int videobuf_dvb_register_frontend(struct dvb_adapter *adapter, + struct videobuf_dvb *dvb) { int result; @@ -304,15 +307,18 @@ void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f) mutex_lock(&f->lock); list_for_each_safe(list, q, &f->felist) { fe = list_entry(list, struct videobuf_dvb_frontend, felist); - if(fe->dvb.net.dvbdev) { + if (fe->dvb.net.dvbdev) { dvb_net_release(&fe->dvb.net); - fe->dvb.demux.dmx.remove_frontend(&fe->dvb.demux.dmx, &fe->dvb.fe_mem); - fe->dvb.demux.dmx.remove_frontend(&fe->dvb.demux.dmx, &fe->dvb.fe_hw); + fe->dvb.demux.dmx.remove_frontend(&fe->dvb.demux.dmx, + &fe->dvb.fe_mem); + fe->dvb.demux.dmx.remove_frontend(&fe->dvb.demux.dmx, + &fe->dvb.fe_hw); dvb_dmxdev_release(&fe->dvb.dmxdev); dvb_dmx_release(&fe->dvb.demux); dvb_unregister_frontend(fe->dvb.frontend); } - if(fe->dvb.frontend) /* always allocated, may have been reset */ + if (fe->dvb.frontend) + /* always allocated, may have been reset */ dvb_frontend_detach(fe->dvb.frontend); list_del(list); kfree(fe); @@ -321,8 +327,10 @@ void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f) dvb_unregister_adapter(&f->adapter); } +EXPORT_SYMBOL(videobuf_dvb_unregister_bus); -struct videobuf_dvb_frontend * videobuf_dvb_get_frontend(struct videobuf_dvb_frontends *f, int id) +struct videobuf_dvb_frontend *videobuf_dvb_get_frontend( + struct videobuf_dvb_frontends *f, int id) { struct list_head *list, *q; struct videobuf_dvb_frontend *fe, *ret = NULL; @@ -341,8 +349,10 @@ struct videobuf_dvb_frontend * videobuf_dvb_get_frontend(struct videobuf_dvb_fro return ret; } +EXPORT_SYMBOL(videobuf_dvb_get_frontend); -int videobuf_dvb_find_frontend(struct videobuf_dvb_frontends *f, struct dvb_frontend *p) +int videobuf_dvb_find_frontend(struct videobuf_dvb_frontends *f, + struct dvb_frontend *p) { struct list_head *list, *q; struct videobuf_dvb_frontend *fe = NULL; @@ -362,12 +372,14 @@ int videobuf_dvb_find_frontend(struct videobuf_dvb_frontends *f, struct dvb_fron return ret; } +EXPORT_SYMBOL(videobuf_dvb_find_frontend); -struct videobuf_dvb_frontend * videobuf_dvb_alloc_frontend(struct videobuf_dvb_frontends *f, int id) +struct videobuf_dvb_frontend *videobuf_dvb_alloc_frontend( + struct videobuf_dvb_frontends *f, int id) { struct videobuf_dvb_frontend *fe; - fe = kzalloc(sizeof(struct videobuf_dvb_frontend),GFP_KERNEL); + fe = kzalloc(sizeof(struct videobuf_dvb_frontend), GFP_KERNEL); if (fe == NULL) goto fail_alloc; @@ -375,18 +387,13 @@ struct videobuf_dvb_frontend * videobuf_dvb_alloc_frontend(struct videobuf_dvb_f mutex_init(&fe->dvb.lock); mutex_lock(&f->lock); - list_add_tail(&fe->felist,&f->felist); + list_add_tail(&fe->felist, &f->felist); mutex_unlock(&f->lock); fail_alloc: return fe; } - -EXPORT_SYMBOL(videobuf_dvb_register_bus); -EXPORT_SYMBOL(videobuf_dvb_unregister_bus); EXPORT_SYMBOL(videobuf_dvb_alloc_frontend); -EXPORT_SYMBOL(videobuf_dvb_get_frontend); -EXPORT_SYMBOL(videobuf_dvb_find_frontend); /* ------------------------------------------------------------------ */ /* -- cgit v1.2.3 From c678cad76b9695b4817bdb236137016b5c30236c Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 16 Oct 2008 23:20:19 -0400 Subject: Remove spurious messages and turn into debug. From: Steven Toth Remove spurious messages and turn into debug. Priority: normal Signed-off-by: Steven Toth --- linux/drivers/media/dvb/dvb-core/dvb_frontend.c | 59 +++++++++---------------- 1 file changed, 22 insertions(+), 37 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c index 4fb5e671f..ec1b0901d 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -973,30 +973,30 @@ void dtv_property_dump(struct dtv_property *tvp) int i; if (tvp->cmd <= 0 || tvp->cmd > DTV_MAX_COMMAND) { - printk("%s: tvp.cmd = 0x%08x (undefined/unknown/invalid)\n", + printk(KERN_WARNING "%s: tvp.cmd = 0x%08x undefined\n", __func__, tvp->cmd); return; } - printk("%s() tvp.cmd = 0x%08x (%s)\n" - ,__FUNCTION__ + dprintk("%s() tvp.cmd = 0x%08x (%s)\n" + ,__func__ ,tvp->cmd ,dtv_cmds[ tvp->cmd ].name); if(dtv_cmds[ tvp->cmd ].buffer) { - printk("%s() tvp.u.buffer.len = 0x%02x\n" - ,__FUNCTION__ + dprintk("%s() tvp.u.buffer.len = 0x%02x\n" + ,__func__ ,tvp->u.buffer.len); for(i = 0; i < tvp->u.buffer.len; i++) - printk("%s() tvp.u.buffer.data[0x%02x] = 0x%02x\n" - ,__FUNCTION__ + dprintk("%s() tvp.u.buffer.data[0x%02x] = 0x%02x\n" + ,__func__ ,i ,tvp->u.buffer.data[i]); } else - printk("%s() tvp.u.data = 0x%08x\n", __FUNCTION__, tvp->u.data); + dprintk("%s() tvp.u.data = 0x%08x\n", __func__, tvp->u.data); } int is_legacy_delivery_system(fe_delivery_system_t s) @@ -1016,8 +1016,6 @@ void dtv_property_cache_sync(struct dvb_frontend *fe, struct dvb_frontend_parame { struct dtv_frontend_properties *c = &fe->dtv_property_cache; - printk("%s()\n", __FUNCTION__); - c->frequency = p->frequency; c->inversion = p->inversion; @@ -1072,27 +1070,25 @@ void dtv_property_legacy_params_sync(struct dvb_frontend *fe) struct dvb_frontend_private *fepriv = fe->frontend_priv; struct dvb_frontend_parameters *p = &fepriv->parameters; - printk("%s()\n", __FUNCTION__); - p->frequency = c->frequency; p->inversion = c->inversion; switch (fe->ops.info.type) { case FE_QPSK: - printk("%s() Preparing QPSK req\n", __FUNCTION__); + dprintk("%s() Preparing QPSK req\n", __func__); p->u.qpsk.symbol_rate = c->symbol_rate; p->u.qpsk.fec_inner = c->fec_inner; c->delivery_system = SYS_DVBS; break; case FE_QAM: - printk("%s() Preparing QAM req\n", __FUNCTION__); + dprintk("%s() Preparing QAM req\n", __func__); p->u.qam.symbol_rate = c->symbol_rate; p->u.qam.fec_inner = c->fec_inner; p->u.qam.modulation = c->modulation; c->delivery_system = SYS_DVBC_ANNEX_AC; break; case FE_OFDM: - printk("%s() Preparing OFDM req\n", __FUNCTION__); + dprintk("%s() Preparing OFDM req\n", __func__); if (c->bandwidth_hz == 6000000) p->u.ofdm.bandwidth = BANDWIDTH_6_MHZ; else if (c->bandwidth_hz == 7000000) @@ -1110,7 +1106,7 @@ void dtv_property_legacy_params_sync(struct dvb_frontend *fe) c->delivery_system = SYS_DVBT; break; case FE_ATSC: - printk("%s() Preparing VSB req\n", __FUNCTION__); + dprintk("%s() Preparing VSB req\n", __func__); p->u.vsb.modulation = c->modulation; if ((c->modulation == VSB_8) || (c->modulation == VSB_16)) c->delivery_system = SYS_ATSC; @@ -1129,8 +1125,6 @@ void dtv_property_adv_params_sync(struct dvb_frontend *fe) struct dvb_frontend_private *fepriv = fe->frontend_priv; struct dvb_frontend_parameters *p = &fepriv->parameters; - printk("%s()\n", __FUNCTION__); - p->frequency = c->frequency; p->inversion = c->inversion; @@ -1164,19 +1158,17 @@ void dtv_property_cache_submit(struct dvb_frontend *fe) { struct dtv_frontend_properties *c = &fe->dtv_property_cache; - printk("%s()\n", __FUNCTION__); - /* For legacy delivery systems we don't need the delivery_system to * be specified, but we populate the older structures from the cache * so we can call set_frontend on older drivers. */ if(is_legacy_delivery_system(c->delivery_system)) { - printk("%s() legacy, modulation = %d\n", __FUNCTION__, c->modulation); + dprintk("%s() legacy, modulation = %d\n", __func__, c->modulation); dtv_property_legacy_params_sync(fe); } else { - printk("%s() adv, modulation = %d\n", __FUNCTION__, c->modulation); + dprintk("%s() adv, modulation = %d\n", __func__, c->modulation); /* For advanced delivery systems / modulation types ... * we seed the lecacy dvb_frontend_parameters structure @@ -1198,8 +1190,6 @@ int dtv_property_process_get(struct dvb_frontend *fe, struct dtv_property *tvp, { int r = 0; - printk("%s()\n", __FUNCTION__); - dtv_property_dump(tvp); /* Allow the frontend to validate incoming properties */ @@ -1309,7 +1299,6 @@ int dtv_property_process_set(struct dvb_frontend *fe, struct dtv_property *tvp, { int r = 0; struct dvb_frontend_private *fepriv = fe->frontend_priv; - printk("%s()\n", __FUNCTION__); dtv_property_dump(tvp); /* Allow the frontend to validate incoming properties */ @@ -1324,7 +1313,7 @@ int dtv_property_process_set(struct dvb_frontend *fe, struct dtv_property *tvp, /* Reset a cache of data specific to the frontend here. This does * not effect hardware. */ - printk("%s() Flushing property cache\n", __FUNCTION__); + dprintk("%s() Flushing property cache\n", __func__); memset(&fe->dtv_property_cache, 0, sizeof(struct dtv_frontend_properties)); fe->dtv_property_cache.state = tvp->cmd; fe->dtv_property_cache.delivery_system = SYS_UNDEFINED; @@ -1335,7 +1324,7 @@ int dtv_property_process_set(struct dvb_frontend *fe, struct dtv_property *tvp, * ioctl. */ fe->dtv_property_cache.state = tvp->cmd; - printk("%s() Finalised property cache\n", __FUNCTION__); + dprintk("%s() Finalised property cache\n", __func__); dtv_property_cache_submit(fe); r |= dvb_frontend_ioctl_legacy(inode, file, FE_SET_FRONTEND, @@ -1455,12 +1444,10 @@ static int dvb_frontend_ioctl_properties(struct inode *inode, struct file *file, dprintk("%s\n", __func__); if(cmd == FE_SET_PROPERTY) { - printk("%s() FE_SET_PROPERTY\n", __FUNCTION__); - tvps = (struct dtv_properties __user *)parg; - printk("%s() properties.num = %d\n", __FUNCTION__, tvps->num); - printk("%s() properties.props = %p\n", __FUNCTION__, tvps->props); + dprintk("%s() properties.num = %d\n", __func__, tvps->num); + dprintk("%s() properties.props = %p\n", __func__, tvps->props); /* Put an arbitrary limit on the number of messages that can * be sent at once */ @@ -1484,18 +1471,16 @@ static int dvb_frontend_ioctl_properties(struct inode *inode, struct file *file, err |= (tvp + i)->result; } - if(fe->dtv_property_cache.state == DTV_TUNE) { - printk("%s() Property cache is full, tuning\n", __FUNCTION__); - } + if(fe->dtv_property_cache.state == DTV_TUNE) + dprintk("%s() Property cache is full, tuning\n", __func__); } else if(cmd == FE_GET_PROPERTY) { - printk("%s() FE_GET_PROPERTY\n", __FUNCTION__); tvps = (struct dtv_properties __user *)parg; - printk("%s() properties.num = %d\n", __FUNCTION__, tvps->num); - printk("%s() properties.props = %p\n", __FUNCTION__, tvps->props); + dprintk("%s() properties.num = %d\n", __func__, tvps->num); + dprintk("%s() properties.props = %p\n", __func__, tvps->props); /* Put an arbitrary limit on the number of messages that can * be sent at once */ -- cgit v1.2.3 From babdc1f6b72967dbf9b17337d496caa877a5a8dd Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 17 Oct 2008 00:04:35 +0000 Subject: dvb: input data pointer of cx24116_writeregN() should be const From: Geert Uytterhoeven | drivers/media/dvb/frontends/cx24116.c:573: warning: passing argument 3 of 'cx24116_writeregN' discards qualifiers from pointer target type Make the `data' input pointer parameter of cx24116_writeregN() const to kill the warning. Signed-off-by: Geert Uytterhoeven Signed-off-by: Andrew Morton Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/dvb/frontends/cx24116.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/frontends/cx24116.c b/linux/drivers/media/dvb/frontends/cx24116.c index 955e8cfe3..497ea635e 100644 --- a/linux/drivers/media/dvb/frontends/cx24116.c +++ b/linux/drivers/media/dvb/frontends/cx24116.c @@ -215,7 +215,7 @@ static int cx24116_writereg(struct cx24116_state *state, int reg, int data) /* Bulk byte writes to a single I2C address, for 32k firmware load */ static int cx24116_writeregN(struct cx24116_state *state, int reg, - u8 *data, u16 len) + const u8 *data, u16 len) { int ret = -EREMOTEIO; struct i2c_msg msg; -- cgit v1.2.3 From dbf01b0d5f7a9f80a76840c00b032527cf0f5c09 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 17 Oct 2008 13:02:47 -0300 Subject: videobuf-dvb: two functions are now static From: Mauro Carvalho Chehab This patch marks those two functions as static: static int videobuf_dvb_register_adapter(struct videobuf_dvb_frontends *fe, static int videobuf_dvb_register_frontend(struct dvb_adapter *adapter, Since MFE patches changed their calls by videobuf_dvb_register_bus. To avoid having to declare the prototypes, the patch moves videobuf_dvb_register_bus() to be after the declaration of the above functions used there. Priority: normal CC: Steven Toth Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/videobuf-dvb.c | 108 ++++++++++++++----------------- 1 file changed, 50 insertions(+), 58 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/videobuf-dvb.c b/linux/drivers/media/video/videobuf-dvb.c index 77b7a42d9..b1fd7e91e 100644 --- a/linux/drivers/media/video/videobuf-dvb.c +++ b/linux/drivers/media/video/videobuf-dvb.c @@ -138,55 +138,7 @@ static int videobuf_dvb_stop_feed(struct dvb_demux_feed *feed) return err; } -/* ------------------------------------------------------------------ */ -/* Register a single adapter and one or more frontends */ -int videobuf_dvb_register_bus(struct videobuf_dvb_frontends *f, - struct module *module, - void *adapter_priv, - struct device *device, - short *adapter_nr, - int mfe_shared) -{ - struct list_head *list, *q; - struct videobuf_dvb_frontend *fe; - int res; - - fe = videobuf_dvb_get_frontend(f, 1); - if (!fe) { - printk(KERN_WARNING "Unable to register the adapter which has no frontends\n"); - return -EINVAL; - } - - /* Bring up the adapter */ - res = videobuf_dvb_register_adapter(f, module, adapter_priv, device, - fe->dvb.name, adapter_nr, mfe_shared); - if (res < 0) { - printk(KERN_WARNING "videobuf_dvb_register_adapter failed (errno = %d)\n", res); - return res; - } - - /* Attach all of the frontends to the adapter */ - mutex_lock(&f->lock); - list_for_each_safe(list, q, &f->felist) { - fe = list_entry(list, struct videobuf_dvb_frontend, felist); - res = videobuf_dvb_register_frontend(&f->adapter, &fe->dvb); - if (res < 0) { - printk(KERN_WARNING "%s: videobuf_dvb_register_frontend failed (errno = %d)\n", - fe->dvb.name, res); - goto err; - } - } - mutex_unlock(&f->lock); - return 0; - -err: - mutex_unlock(&f->lock); - videobuf_dvb_unregister_bus(f); - return res; -} -EXPORT_SYMBOL(videobuf_dvb_register_bus); - -int videobuf_dvb_register_adapter(struct videobuf_dvb_frontends *fe, +static int videobuf_dvb_register_adapter(struct videobuf_dvb_frontends *fe, struct module *module, void *adapter_priv, struct device *device, @@ -211,7 +163,7 @@ int videobuf_dvb_register_adapter(struct videobuf_dvb_frontends *fe, return result; } -int videobuf_dvb_register_frontend(struct dvb_adapter *adapter, +static int videobuf_dvb_register_frontend(struct dvb_adapter *adapter, struct videobuf_dvb *dvb) { int result; @@ -299,6 +251,54 @@ fail_frontend: return result; } +/* ------------------------------------------------------------------ */ +/* Register a single adapter and one or more frontends */ +int videobuf_dvb_register_bus(struct videobuf_dvb_frontends *f, + struct module *module, + void *adapter_priv, + struct device *device, + short *adapter_nr, + int mfe_shared) +{ + struct list_head *list, *q; + struct videobuf_dvb_frontend *fe; + int res; + + fe = videobuf_dvb_get_frontend(f, 1); + if (!fe) { + printk(KERN_WARNING "Unable to register the adapter which has no frontends\n"); + return -EINVAL; + } + + /* Bring up the adapter */ + res = videobuf_dvb_register_adapter(f, module, adapter_priv, device, + fe->dvb.name, adapter_nr, mfe_shared); + if (res < 0) { + printk(KERN_WARNING "videobuf_dvb_register_adapter failed (errno = %d)\n", res); + return res; + } + + /* Attach all of the frontends to the adapter */ + mutex_lock(&f->lock); + list_for_each_safe(list, q, &f->felist) { + fe = list_entry(list, struct videobuf_dvb_frontend, felist); + res = videobuf_dvb_register_frontend(&f->adapter, &fe->dvb); + if (res < 0) { + printk(KERN_WARNING "%s: videobuf_dvb_register_frontend failed (errno = %d)\n", + fe->dvb.name, res); + goto err; + } + } + mutex_unlock(&f->lock); + return 0; + +err: + mutex_unlock(&f->lock); + videobuf_dvb_unregister_bus(f); + return res; +} +EXPORT_SYMBOL(videobuf_dvb_register_bus); + void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f) { struct list_head *list, *q; @@ -394,11 +394,3 @@ fail_alloc: return fe; } EXPORT_SYMBOL(videobuf_dvb_alloc_frontend); - -/* ------------------------------------------------------------------ */ -/* - * Local variables: - * c-basic-offset: 8 - * compile-command: "make DVB=1" - * End: - */ -- cgit v1.2.3 From 3beaddc560d35b83ba5793dcbe8c3a49ac58cdc7 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 17 Oct 2008 19:45:55 +0300 Subject: Patch to remove warning message during cx88-dvb compilation From: Igor M. Liplianin Remove warning message during cx88-dvb compilation. Also fixes double underline in function and struct names. Signed-off-by: Igor M. Liplianin Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/dvb/dm1105/dm1105.c | 12 ++++++++++++ linux/drivers/media/dvb/dvb-usb/dw2102.c | 12 ++++++++++++ linux/drivers/media/dvb/frontends/z0194a.h | 16 ++-------------- linux/drivers/media/video/cx88/cx88-dvb.c | 4 ++-- 4 files changed, 28 insertions(+), 16 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/dm1105/dm1105.c b/linux/drivers/media/dvb/dm1105/dm1105.c index 07ebe639f..d9d1e0a12 100644 --- a/linux/drivers/media/dvb/dm1105/dm1105.c +++ b/linux/drivers/media/dvb/dm1105/dm1105.c @@ -603,6 +603,18 @@ static void dm1105dvb_hw_exit(struct dm1105dvb *dm1105dvb) dm1105dvb_dma_unmap(dm1105dvb); } +static struct stv0299_config sharp_z0194a_config = { + .demod_address = 0x68, + .inittab = sharp_z0194a_inittab, + .mclk = 88000000UL, + .invert = 1, + .skip_reinit = 0, + .lock_output = STV0299_LOCKOUTPUT_1, + .volt13_op0_op1 = STV0299_VOLT13_OP1, + .min_delay_ms = 100, + .set_symbol_rate = sharp_z0194a_set_symbol_rate, +}; + static struct stv0288_config earda_config = { .demod_address = 0x68, .min_delay_ms = 100, diff --git a/linux/drivers/media/dvb/dvb-usb/dw2102.c b/linux/drivers/media/dvb/dvb-usb/dw2102.c index ca53df61c..6286fbbe7 100644 --- a/linux/drivers/media/dvb/dvb-usb/dw2102.c +++ b/linux/drivers/media/dvb/dvb-usb/dw2102.c @@ -422,6 +422,18 @@ static int dw210x_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) return 0; } +static struct stv0299_config sharp_z0194a_config = { + .demod_address = 0x68, + .inittab = sharp_z0194a_inittab, + .mclk = 88000000UL, + .invert = 1, + .skip_reinit = 0, + .lock_output = STV0299_LOCKOUTPUT_1, + .volt13_op0_op1 = STV0299_VOLT13_OP1, + .min_delay_ms = 100, + .set_symbol_rate = sharp_z0194a_set_symbol_rate, +}; + static struct cx24116_config dw2104_config = { .demod_address = 0x55, .mpg_clk_pos_pol = 0x01, diff --git a/linux/drivers/media/dvb/frontends/z0194a.h b/linux/drivers/media/dvb/frontends/z0194a.h index d2876d2e1..07f3fc099 100644 --- a/linux/drivers/media/dvb/frontends/z0194a.h +++ b/linux/drivers/media/dvb/frontends/z0194a.h @@ -12,7 +12,7 @@ #ifndef Z0194A #define Z0194A -static int sharp_z0194a__set_symbol_rate(struct dvb_frontend *fe, +static int sharp_z0194a_set_symbol_rate(struct dvb_frontend *fe, u32 srate, u32 ratio) { u8 aclk = 0; @@ -40,7 +40,7 @@ static int sharp_z0194a__set_symbol_rate(struct dvb_frontend *fe, return 0; } -static u8 sharp_z0194a__inittab[] = { +static u8 sharp_z0194a_inittab[] = { 0x01, 0x15, 0x02, 0x00, 0x03, 0x00, @@ -82,16 +82,4 @@ static u8 sharp_z0194a__inittab[] = { 0xff, 0xff }; -static struct stv0299_config sharp_z0194a_config = { - .demod_address = 0x68, - .inittab = sharp_z0194a__inittab, - .mclk = 88000000UL, - .invert = 1, - .skip_reinit = 0, - .lock_output = STV0299_LOCKOUTPUT_1, - .volt13_op0_op1 = STV0299_VOLT13_OP1, - .min_delay_ms = 100, - .set_symbol_rate = sharp_z0194a__set_symbol_rate, -}; - #endif diff --git a/linux/drivers/media/video/cx88/cx88-dvb.c b/linux/drivers/media/video/cx88/cx88-dvb.c index 180c9ca11..2ae6bf129 100644 --- a/linux/drivers/media/video/cx88/cx88-dvb.c +++ b/linux/drivers/media/video/cx88/cx88-dvb.c @@ -582,14 +582,14 @@ static struct cx24116_config tevii_s460_config = { static struct stv0299_config tevii_tuner_sharp_config = { .demod_address = 0x68, - .inittab = sharp_z0194a__inittab, + .inittab = sharp_z0194a_inittab, .mclk = 88000000UL, .invert = 1, .skip_reinit = 0, .lock_output = 1, .volt13_op0_op1 = STV0299_VOLT13_OP1, .min_delay_ms = 100, - .set_symbol_rate = sharp_z0194a__set_symbol_rate, + .set_symbol_rate = sharp_z0194a_set_symbol_rate, .set_ts_params = cx24116_set_ts_param, }; -- cgit v1.2.3 From 95c0daf114659d2869c4fd90c735d5393e276f7d Mon Sep 17 00:00:00 2001 From: Manu Abraham Date: Tue, 14 Oct 2008 23:34:07 +0400 Subject: DVB-Core update From: Manu Abraham Signed-off-by: Manu Abraham --- linux/drivers/media/dvb/dvb-core/dvb_frontend.c | 66 ++++++++++-- linux/drivers/media/dvb/dvb-core/dvb_frontend.h | 134 +++++++++++++++++++++++- 2 files changed, 192 insertions(+), 8 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c index ec1b0901d..ed28a061e 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -133,6 +133,7 @@ struct dvb_frontend_private { unsigned int step_size; int quality; unsigned int check_wrapped; + enum dvbfe_search algo_status; }; static void dvb_frontend_wakeup(struct dvb_frontend *fe); @@ -519,6 +520,8 @@ static int dvb_frontend_thread(void *data) struct dvb_frontend_private *fepriv = fe->frontend_priv; unsigned long timeout; fe_status_t s; + enum dvbfe_algo algo; + struct dvb_frontend_parameters *params; dprintk("%s\n", __func__); @@ -571,23 +574,72 @@ restart: /* do an iteration of the tuning loop */ if (fe->ops.get_frontend_algo) { - if (fe->ops.get_frontend_algo(fe) == FE_ALGO_HW) { - /* have we been asked to retune? */ - params = NULL; + algo = fe->ops.get_frontend_algo(fe); + switch (algo) { + case DVBFE_ALGO_HW: + dprintk("%s: Frontend ALGO = DVBFE_ALGO_HW\n", __func__); + params = NULL; /* have we been asked to RETUNE ? */ + if (fepriv->state & FESTATE_RETUNE) { - params = &fepriv->parameters; + dprintk("%s: Retune requested, FESTATE_RETUNE\n", __func__); fepriv->state = FESTATE_TUNED; } - fe->ops.tune(fe, params, fepriv->tune_mode_flags, &fepriv->delay, &s); + if (fe->ops.tune) + fe->ops.tune(fe, params, fepriv->tune_mode_flags, &fepriv->delay, &s); + if (s != fepriv->status) { + dprintk("%s: state changed, adding current state\n", __func__); dvb_frontend_add_event(fe, s); fepriv->status = s; } - } else + break; + case DVBFE_ALGO_SW: + dprintk("%s: Frontend ALGO = DVBFE_ALGO_SW\n", __func__); dvb_frontend_swzigzag(fe); - } else + break; + case DVBFE_ALGO_CUSTOM: + params = NULL; /* have we been asked to RETUNE ? */ + dprintk("%s: Frontend ALGO = DVBFE_ALGO_CUSTOM, state=%d\n", __func__, fepriv->state); + if (fepriv->state & FESTATE_RETUNE) { + dprintk("%s: Retune requested, FESTAT_RETUNE\n", __func__); + fepriv->state = FESTATE_TUNED; + } + /* Case where we are going to search for a carrier + * User asked us to retune again for some reason, possibly + * requesting a search with a new set of parameters + */ + if (fepriv->algo_status & DVBFE_ALGO_SEARCH_AGAIN) { + if (fe->ops.search) + fepriv->algo_status = fe->ops.search(fe, &fepriv->parameters); + /* We did do a search as was requested, the flags are + * now unset as well and has the flags wrt to search. + */ + + fepriv->algo_status &= ~DVBFE_ALGO_SEARCH_AGAIN; + } + /* Track the carrier if the search was successful */ + if (fepriv->algo_status == DVBFE_ALGO_SEARCH_SUCCESS) { + if (fepriv->algo_status & DVBFE_ALGO_SEARCH_SUCCESS) + dprintk("%s: status = DVBFE_ALGO_SEARCH_SUCCESS\n", __func__); + if (fepriv->algo_status & DVBFE_ALGO_SEARCH_FAILED) + fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN; + + fe->ops.read_status(fe, &s); + dvb_frontend_add_event(fe, s); /* update event list */ + fepriv->status = s; + if (fe->ops.track) + fe->ops.track(fe, &fepriv->parameters); + + } + break; + default: + dprintk("%s: UNDEFINED ALGO !\n", __func__); + break; + } + } else { dvb_frontend_swzigzag(fe); + } } if (dvb_powerdown_on_sleep) { diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.h b/linux/drivers/media/dvb/dvb-core/dvb_frontend.h index 569b72a96..cff26dd66 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.h +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.h @@ -69,6 +69,125 @@ struct analog_parameters { u64 std; }; +enum dvbfe_modcod { + DVBFE_MODCOD_DUMMY_PLFRAME = 0, + DVBFE_MODCOD_QPSK_1_4, + DVBFE_MODCOD_QPSK_1_3, + DVBFE_MODCOD_QPSK_2_5, + DVBFE_MODCOD_QPSK_1_2, + DVBFE_MODCOD_QPSK_3_5, + DVBFE_MODCOD_QPSK_2_3, + DVBFE_MODCOD_QPSK_3_4, + DVBFE_MODCOD_QPSK_4_5, + DVBFE_MODCOD_QPSK_5_6, + DVBFE_MODCOD_QPSK_8_9, + DVBFE_MODCOD_QPSK_9_10, + DVBFE_MODCOD_8PSK_3_5, + DVBFE_MODCOD_8PSK_2_3, + DVBFE_MODCOD_8PSK_3_4, + DVBFE_MODCOD_8PSK_5_6, + DVBFE_MODCOD_8PSK_8_9, + DVBFE_MODCOD_8PSK_9_10, + DVBFE_MODCOD_16APSK_2_3, + DVBFE_MODCOD_16APSK_3_4, + DVBFE_MODCOD_16APSK_4_5, + DVBFE_MODCOD_16APSK_5_6, + DVBFE_MODCOD_16APSK_8_9, + DVBFE_MODCOD_16APSK_9_10, + DVBFE_MODCOD_32APSK_3_4, + DVBFE_MODCOD_32APSK_4_5, + DVBFE_MODCOD_32APSK_5_6, + DVBFE_MODCOD_32APSK_8_9, + DVBFE_MODCOD_32APSK_9_10, + DVBFE_MODCOD_RESERVED_1, + DVBFE_MODCOD_BPSK_1_3, + DVBFE_MODCOD_BPSK_1_4, + DVBFE_MODCOD_RESERVED_2 +}; + +enum tuner_param { + DVBFE_TUNER_FREQUENCY = (1 << 0), + DVBFE_TUNER_TUNERSTEP = (1 << 1), + DVBFE_TUNER_IFFREQ = (1 << 2), + DVBFE_TUNER_BANDWIDTH = (1 << 3), + DVBFE_TUNER_REFCLOCK = (1 << 4), + DVBFE_TUNER_IQSENSE = (1 << 5), + DVBFE_TUNER_DUMMY = (1 << 31) +}; + +/* + * ALGO_HW: (Hardware Algorithm) + * ---------------------------------------------------------------- + * Devices that support this algorithm do everything in hardware + * and no software support is needed to handle them. + * Requesting these devices to LOCK is the only thing required, + * device is supposed to do everything in the hardware. + * + * ALGO_SW: (Software Algorithm) + * ---------------------------------------------------------------- + * These are dumb devices, that require software to do everything + * + * ALGO_CUSTOM: (Customizable Agorithm) + * ---------------------------------------------------------------- + * Devices having this algorithm can be customized to have specific + * algorithms in the frontend driver, rather than simply doing a + * software zig-zag. In this case the zigzag maybe hardware assisted + * or it maybe completely done in hardware. In all cases, usage of + * this algorithm, in conjunction with the search and track + * callbacks, utilizes the driver specific algorithm. + * + * ALGO_RECOVERY: (Recovery Algorithm) + * ---------------------------------------------------------------- + * These devices have AUTO recovery capabilities from LOCK failure + */ +enum dvbfe_algo { + DVBFE_ALGO_HW = (1 << 0), + DVBFE_ALGO_SW = (1 << 1), + DVBFE_ALGO_CUSTOM = (1 << 2), + DVBFE_ALGO_RECOVERY = (1 << 31) +}; + +struct tuner_state { + u32 frequency; + u32 tunerstep; + u32 ifreq; + u32 bandwidth; + u32 iqsense; + u32 refclock; +}; + +/* + * search callback possible return status + * + * DVBFE_ALGO_SEARCH_SUCCESS + * The frontend search algorithm completed and returned succesfully + * + * DVBFE_ALGO_SEARCH_ASLEEP + * The frontend search algorithm is sleeping + * + * DVBFE_ALGO_SEARCH_FAILED + * The frontend search for a signal failed + * + * DVBFE_ALGO_SEARCH_INVALID + * The frontend search algorith was probably supplied with invalid + * parameters and the search is an invalid one + * + * DVBFE_ALGO_SEARCH_ERROR + * The frontend search algorithm failed due to some error + * + * DVBFE_ALGO_SEARCH_AGAIN + * The frontend search algorithm was requested to search again + */ +enum dvbfe_search { + DVBFE_ALGO_SEARCH_SUCCESS = (1 << 0), + DVBFE_ALGO_SEARCH_ASLEEP = (1 << 1), + DVBFE_ALGO_SEARCH_FAILED = (1 << 2), + DVBFE_ALGO_SEARCH_INVALID = (1 << 3), + DVBFE_ALGO_SEARCH_AGAIN = (1 << 4), + DVBFE_ALGO_SEARCH_ERROR = (1 << 31), +}; + + struct dvb_tuner_ops { struct dvb_tuner_info info; @@ -99,6 +218,13 @@ struct dvb_tuner_ops { * tuners which require sophisticated tuning loops, controlling each parameter seperately. */ int (*set_frequency)(struct dvb_frontend *fe, u32 frequency); int (*set_bandwidth)(struct dvb_frontend *fe, u32 bandwidth); + + /* + * These are provided seperately from set_params in order to facilitate silicon + * tuners which require sophisticated tuning loops, controlling each parameter seperately. + */ + int (*set_state)(struct dvb_frontend *fe, enum tuner_param param, struct tuner_state *state); + int (*get_state)(struct dvb_frontend *fe, enum tuner_param param, struct tuner_state *state); }; struct analog_demod_info { @@ -142,7 +268,7 @@ struct dvb_frontend_ops { unsigned int *delay, fe_status_t *status); /* get frontend tuning algorithm from the module */ - int (*get_frontend_algo)(struct dvb_frontend *fe); + enum dvbfe_algo (*get_frontend_algo)(struct dvb_frontend *fe); /* these two are only used for the swzigzag code */ int (*set_frontend)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); @@ -167,6 +293,12 @@ struct dvb_frontend_ops { int (*i2c_gate_ctrl)(struct dvb_frontend* fe, int enable); int (*ts_bus_ctrl)(struct dvb_frontend* fe, int acquire); + /* These callbacks are for devices that implement their own + * tuning algorithms, rather than a simple swzigzag + */ + enum dvbfe_search (*search)(struct dvb_frontend *fe, struct dvb_frontend_parameters *p); + int (*track)(struct dvb_frontend *fe, struct dvb_frontend_parameters *p); + struct dvb_tuner_ops tuner_ops; struct analog_demod_ops analog_ops; -- cgit v1.2.3 From 5af7b1c77d823a240dc19f0d61549a5ab9e244e5 Mon Sep 17 00:00:00 2001 From: Manu Abraham Date: Mon, 20 Oct 2008 13:05:21 +0400 Subject: Add event with changed status only From: Arvo Jarve Signed-off-by: Arvo Jarve Signed-off-by: Manu Abraham --- linux/drivers/media/dvb/dvb-core/dvb_frontend.c | 30 +++++++++++++++---------- 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c index ed28a061e..17097cdcb 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -610,27 +610,33 @@ restart: * requesting a search with a new set of parameters */ if (fepriv->algo_status & DVBFE_ALGO_SEARCH_AGAIN) { - if (fe->ops.search) + if (fe->ops.search) { fepriv->algo_status = fe->ops.search(fe, &fepriv->parameters); /* We did do a search as was requested, the flags are * now unset as well and has the flags wrt to search. */ - - fepriv->algo_status &= ~DVBFE_ALGO_SEARCH_AGAIN; + } else { + fepriv->algo_status &= ~DVBFE_ALGO_SEARCH_AGAIN; + } } /* Track the carrier if the search was successful */ if (fepriv->algo_status == DVBFE_ALGO_SEARCH_SUCCESS) { - if (fepriv->algo_status & DVBFE_ALGO_SEARCH_SUCCESS) - dprintk("%s: status = DVBFE_ALGO_SEARCH_SUCCESS\n", __func__); - if (fepriv->algo_status & DVBFE_ALGO_SEARCH_FAILED) - fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN; - - fe->ops.read_status(fe, &s); - dvb_frontend_add_event(fe, s); /* update event list */ - fepriv->status = s; if (fe->ops.track) fe->ops.track(fe, &fepriv->parameters); - + } else { + fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN; + fepriv->delay = HZ / 2; + } + fe->ops.read_status(fe, &s); + if (s != fepriv->status) { + dvb_frontend_add_event(fe, s); /* update event list */ + fepriv->status = s; + if (!(s & FE_HAS_LOCK)) { + fepriv->delay = HZ / 10; + fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN; + } else { + fepriv->delay = 60 * HZ; + } } break; default: -- cgit v1.2.3 From 723dbc0b30db9de883635895dd341fbeb6f388fe Mon Sep 17 00:00:00 2001 From: Manu Abraham Date: Tue, 21 Oct 2008 01:14:14 +0400 Subject: Optimization: Enable gate in a symmetric/disciplined way, rather than implementing different ways leading to confusion. This allows multiple gate_enable/disable's in the tuner_read/write functions, thereby lesser number of I/O operations throughout, eventually leading to better results. As a side effect demods that detect the STOP bit for auto closing of the gate can be avoided, thereby a very minimal gain in disabling the auto detect feature as well. Improves readability on the device control. From: Manu Abraham Signed-off-by: Manu Abraham --- linux/drivers/media/dvb/dvb-core/dvb_frontend.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c index 17097cdcb..56f99bb63 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -229,6 +229,8 @@ static void dvb_frontend_init(struct dvb_frontend *fe) if (fe->ops.init) fe->ops.init(fe); if (fe->ops.tuner_ops.init) { + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); fe->ops.tuner_ops.init(fe); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); -- cgit v1.2.3 From 11b96fd5258d1fc31edec9e1e61326ca1ff4c827 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 21 Oct 2008 16:47:22 -0200 Subject: backport commit a65e5d782f9db2a61a914dc01a329e0c2dcf92a1 From: Mauro Carvalho Chehab Author: Johannes Berg remove CONFIG_KMOD from drivers Straight forward conversions to CONFIG_MODULE; many drivers include conditionally and then don't have any other conditional code so remove it from those. kernel-sync: Priority: normal Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/cpia.c | 4 ---- linux/drivers/media/video/usbvision/usbvision-core.c | 4 ---- linux/drivers/media/video/usbvision/usbvision-video.c | 4 ---- linux/drivers/media/video/v4l1-compat.c | 4 ---- linux/drivers/media/video/v4l2-common.c | 4 ---- linux/drivers/media/video/vino.c | 5 +---- linux/drivers/media/video/w9968cf.c | 4 ++-- 7 files changed, 3 insertions(+), 26 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/cpia.c b/linux/drivers/media/video/cpia.c index 84034183d..5873614eb 100644 --- a/linux/drivers/media/video/cpia.c +++ b/linux/drivers/media/video/cpia.c @@ -39,10 +39,6 @@ #include #include -#ifdef CONFIG_KMOD -#include -#endif - #include "cpia.h" #include "compat.h" diff --git a/linux/drivers/media/video/usbvision/usbvision-core.c b/linux/drivers/media/video/usbvision/usbvision-core.c index d66cce1a5..33f37ac46 100644 --- a/linux/drivers/media/video/usbvision/usbvision-core.c +++ b/linux/drivers/media/video/usbvision/usbvision-core.c @@ -45,10 +45,6 @@ #include -#ifdef CONFIG_KMOD -#include -#endif - #include "usbvision.h" static unsigned int core_debug; diff --git a/linux/drivers/media/video/usbvision/usbvision-video.c b/linux/drivers/media/video/usbvision/usbvision-video.c index 732496327..d185b57fd 100644 --- a/linux/drivers/media/video/usbvision/usbvision-video.c +++ b/linux/drivers/media/video/usbvision/usbvision-video.c @@ -69,10 +69,6 @@ #include -#ifdef CONFIG_KMOD -#include -#endif - #include "usbvision.h" #include "usbvision-cards.h" diff --git a/linux/drivers/media/video/v4l1-compat.c b/linux/drivers/media/video/v4l1-compat.c index c2fadee58..ff1d3eb68 100644 --- a/linux/drivers/media/video/v4l1-compat.c +++ b/linux/drivers/media/video/v4l1-compat.c @@ -35,10 +35,6 @@ #include #include #include - -#ifdef CONFIG_KMOD -#include -#endif #include "compat.h" static unsigned int debug; diff --git a/linux/drivers/media/video/v4l2-common.c b/linux/drivers/media/video/v4l2-common.c index b5baf8f7e..de46c29a4 100644 --- a/linux/drivers/media/video/v4l2-common.c +++ b/linux/drivers/media/video/v4l2-common.c @@ -60,10 +60,6 @@ #include #include -#ifdef CONFIG_KMOD -#include -#endif - #include #include "compat.h" diff --git a/linux/drivers/media/video/vino.c b/linux/drivers/media/video/vino.c index 08eb57818..ae1bcf24a 100644 --- a/linux/drivers/media/video/vino.c +++ b/linux/drivers/media/video/vino.c @@ -30,10 +30,7 @@ #include #include #include - -#ifdef CONFIG_KMOD #include -#endif #include #include @@ -4638,7 +4635,7 @@ static int __init vino_module_init(void) } vino_init_stage++; -#if defined(CONFIG_KMOD) && defined(MODULE) +#ifdef MODULE request_module("saa7191"); request_module("indycam"); #endif diff --git a/linux/drivers/media/video/w9968cf.c b/linux/drivers/media/video/w9968cf.c index 23e14bc64..ab3c054c4 100644 --- a/linux/drivers/media/video/w9968cf.c +++ b/linux/drivers/media/video/w9968cf.c @@ -111,7 +111,7 @@ static int specific_debug = W9968CF_SPECIFIC_DEBUG; static unsigned int param_nv[24]; /* number of values per parameter */ -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES module_param(ovmod_load, bool, 0644); #endif module_param(simcams, ushort, 0644); @@ -144,7 +144,7 @@ module_param(debug, ushort, 0644); module_param(specific_debug, bool, 0644); #endif -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES MODULE_PARM_DESC(ovmod_load, "\n<0|1> Automatic 'ovcamchip' module loading." "\n0 disabled, 1 enabled." -- cgit v1.2.3 From f3c998568a8cdbfd9855773918fcbbea15a62599 Mon Sep 17 00:00:00 2001 From: Antoine Jacquet Date: Tue, 21 Oct 2008 22:54:51 +0200 Subject: dtv5100: add dependency on zl10353 From: Antoine Jacquet Update Kconfig to add missing dependency on zl10353 for dtv5100 driver. Priority: high Signed-off-by: Antoine Jacquet --- linux/drivers/media/dvb/dvb-usb/Kconfig | 1 + 1 file changed, 1 insertion(+) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/dvb-usb/Kconfig b/linux/drivers/media/dvb/dvb-usb/Kconfig index 3c13bcfa6..47488a97a 100644 --- a/linux/drivers/media/dvb/dvb-usb/Kconfig +++ b/linux/drivers/media/dvb/dvb-usb/Kconfig @@ -283,6 +283,7 @@ config DVB_USB_ANYSEE config DVB_USB_DTV5100 tristate "AME DTV-5100 USB2.0 DVB-T support" depends on DVB_USB + select DVB_ZL10353 if !DVB_FE_CUSTOMISE select MEDIA_TUNER_QT1010 if !DVB_FE_CUSTOMISE help Say Y here to support the AME DTV-5100 USB2.0 DVB-T receiver. -- cgit v1.2.3