From 7f2c983cf5978186ee2c379fd63d04316158fc9b Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Wed, 17 Feb 2010 22:47:55 -0300 Subject: V4L/DVB: au8522: fix race condition in switching from digital to analog mode With applications like MythTV, switching inputs results in closing the digital side and then immediately opening the analog side. This exposes a race condition where the dvb_frontend kernel thread powers down the chip and closes the i2c gate even though we're in the middle of bringing up the analog part of the chip (since the shutdown of the dvb_frontend kernel thread occurs asychronously). Introduce a construct to keep track of what mode we're in, and drop requests to power down or management the gate if we've already switched to analog mode. Thanks to Zaphod Beeblebrox for reporting this issue. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/au8522_decoder.c | 2 ++ drivers/media/dvb/frontends/au8522_dig.c | 21 +++++++++++++++++++++ drivers/media/dvb/frontends/au8522_priv.h | 5 +++++ 3 files changed, 28 insertions(+) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/frontends/au8522_decoder.c b/drivers/media/dvb/frontends/au8522_decoder.c index 24268ef2753..ef5fd49363c 100644 --- a/drivers/media/dvb/frontends/au8522_decoder.c +++ b/drivers/media/dvb/frontends/au8522_decoder.c @@ -664,6 +664,8 @@ static int au8522_reset(struct v4l2_subdev *sd, u32 val) { struct au8522_state *state = to_state(sd); + state->operational_mode = AU8522_ANALOG_MODE; + au8522_writereg(state, 0xa4, 1 << 5); return 0; diff --git a/drivers/media/dvb/frontends/au8522_dig.c b/drivers/media/dvb/frontends/au8522_dig.c index a1fed0fa8ed..e2efb25d1a7 100644 --- a/drivers/media/dvb/frontends/au8522_dig.c +++ b/drivers/media/dvb/frontends/au8522_dig.c @@ -84,6 +84,14 @@ static int au8522_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) dprintk("%s(%d)\n", __func__, enable); + if (state->operational_mode == AU8522_ANALOG_MODE) { + /* We're being asked to manage the gate even though we're + not in digital mode. This can occur if we get switched + over to analog mode before the dvb_frontend kernel thread + has completely shutdown */ + return 0; + } + if (enable) return au8522_writereg(state, 0x106, 1); else @@ -608,6 +616,8 @@ int au8522_init(struct dvb_frontend *fe) struct au8522_state *state = fe->demodulator_priv; dprintk("%s()\n", __func__); + state->operational_mode = AU8522_DIGITAL_MODE; + au8522_writereg(state, 0xa4, 1 << 5); au8522_i2c_gate_ctrl(fe, 1); @@ -704,6 +714,15 @@ int au8522_sleep(struct dvb_frontend *fe) struct au8522_state *state = fe->demodulator_priv; dprintk("%s()\n", __func__); + /* Only power down if the digital side is currently using the chip */ + if (state->operational_mode == AU8522_ANALOG_MODE) { + /* We're not in one of the expected power modes, which means + that the DVB thread is probably telling us to go to sleep + even though the analog frontend has already started using + the chip. So ignore the request */ + return 0; + } + /* turn off led */ au8522_led_ctrl(state, 0); @@ -932,6 +951,8 @@ struct dvb_frontend *au8522_attach(const struct au8522_config *config, /* setup the state */ state->config = config; state->i2c = i2c; + state->operational_mode = AU8522_DIGITAL_MODE; + /* create dvb_frontend */ memcpy(&state->frontend.ops, &au8522_ops, sizeof(struct dvb_frontend_ops)); diff --git a/drivers/media/dvb/frontends/au8522_priv.h b/drivers/media/dvb/frontends/au8522_priv.h index c74c4e72fe9..609cf04bc31 100644 --- a/drivers/media/dvb/frontends/au8522_priv.h +++ b/drivers/media/dvb/frontends/au8522_priv.h @@ -34,10 +34,15 @@ #include "au8522.h" #include "tuner-i2c.h" +#define AU8522_ANALOG_MODE 0 +#define AU8522_DIGITAL_MODE 1 + struct au8522_state { struct i2c_client *c; struct i2c_adapter *i2c; + u8 operational_mode; + /* Used for sharing of the state between analog and digital mode */ struct tuner_i2c_props i2c_props; struct list_head hybrid_tuner_instance_list; -- cgit v1.2.3 From b628a2a3d4e97044cc9f6818bfb8330d8d0b021a Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Wed, 17 Feb 2010 22:51:46 -0300 Subject: V4L/DVB: au8522: fix case where we don't perform the first tune after going digital Address a problem found in MythTV where if we are in digital mode, switch to analog mode, and the switch back to digital mode, the first tuning request after switching back to digital mode gets dropped. This is because the au8522 maintains internal state, and would think the demod was already tuned to the target frequency. Thanks to Zaphod Beeblebrox for reporting this issue. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/au8522_decoder.c | 5 +++++ drivers/media/dvb/frontends/au8522_dig.c | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/frontends/au8522_decoder.c b/drivers/media/dvb/frontends/au8522_decoder.c index ef5fd49363c..68dba3a4b4d 100644 --- a/drivers/media/dvb/frontends/au8522_decoder.c +++ b/drivers/media/dvb/frontends/au8522_decoder.c @@ -666,6 +666,11 @@ static int au8522_reset(struct v4l2_subdev *sd, u32 val) state->operational_mode = AU8522_ANALOG_MODE; + /* Clear out any state associated with the digital side of the + chip, so that when it gets powered back up it won't think + that it is already tuned */ + state->current_frequency = 0; + au8522_writereg(state, 0xa4, 1 << 5); return 0; diff --git a/drivers/media/dvb/frontends/au8522_dig.c b/drivers/media/dvb/frontends/au8522_dig.c index e2efb25d1a7..65f6a36dfb2 100644 --- a/drivers/media/dvb/frontends/au8522_dig.c +++ b/drivers/media/dvb/frontends/au8522_dig.c @@ -618,6 +618,11 @@ int au8522_init(struct dvb_frontend *fe) state->operational_mode = AU8522_DIGITAL_MODE; + /* Clear out any state associated with the digital side of the + chip, so that when it gets powered back up it won't think + that it is already tuned */ + state->current_frequency = 0; + au8522_writereg(state, 0xa4, 1 << 5); au8522_i2c_gate_ctrl(fe, 1); -- cgit v1.2.3 From 7b1fc72c2fdeb91565f4969397757ee938cce67e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20N=C3=A9meth?= Date: Sun, 28 Feb 2010 11:34:35 -0300 Subject: V4L/DVB: nGene: use NULL when pointer is needed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use NULL when calling a function with pointer parameter, initializing a pointer and returning a pointer. This will remove the following sparse warning at different locations (see "make C=1"): * warning: Using plain integer as NULL pointer Signed-off-by: Márton Németh Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/ngene/ngene-core.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/ngene/ngene-core.c b/drivers/media/dvb/ngene/ngene-core.c index 645e8b8a713..52f60d448de 100644 --- a/drivers/media/dvb/ngene/ngene-core.c +++ b/drivers/media/dvb/ngene/ngene-core.c @@ -819,7 +819,7 @@ static int ngene_i2c_master_xfer(struct i2c_adapter *adapter, msg[0].buf, msg[0].len)) goto done; if (num == 1 && (msg[0].flags & I2C_M_RD)) - if (!ngene_command_i2c_read(dev, msg[0].addr, 0, 0, + if (!ngene_command_i2c_read(dev, msg[0].addr, NULL, 0, msg[0].buf, msg[0].len, 0)) goto done; @@ -882,7 +882,7 @@ static void *tsin_exchange(void *priv, void *buf, u32 len, u32 clock, u32 flags) if (chan->users > 0) #endif dvb_dmx_swfilter(&chan->demux, buf, len); - return 0; + return NULL; } u8 fill_ts[188] = { 0x47, 0x1f, 0xff, 0x10 }; @@ -970,7 +970,7 @@ static void set_transfer(struct ngene_channel *chan, int state) state); if (!state) { spin_lock_irq(&chan->state_lock); - chan->pBufferExchange = 0; + chan->pBufferExchange = NULL; dvb_ringbuffer_flush(&dev->tsout_rbuf); spin_unlock_irq(&chan->state_lock); } @@ -1020,7 +1020,7 @@ static int my_dvb_dmx_ts_card_init(struct dvb_demux *dvbdemux, char *id, dvbdemux->feednum = 256; dvbdemux->start_feed = start_feed; dvbdemux->stop_feed = stop_feed; - dvbdemux->write_to_decoder = 0; + dvbdemux->write_to_decoder = NULL; dvbdemux->dmx.capabilities = (DMX_TS_FILTERING | DMX_SECTION_FILTERING | DMX_MEMORY_BASED_FILTERING); @@ -1094,8 +1094,8 @@ static void free_idlebuffer(struct ngene *dev, return; free_ringbuffer(dev, rb); for (j = 0; j < tb->NumBuffers; j++, Cur = Cur->Next) { - Cur->Buffer2 = 0; - Cur->scList2 = 0; + Cur->Buffer2 = NULL; + Cur->scList2 = NULL; Cur->ngeneBuffer.Address_of_first_entry_2 = 0; Cur->ngeneBuffer.Number_of_entries_2 = 0; } @@ -1141,7 +1141,7 @@ static int create_ring_buffer(struct pci_dev *pci_dev, u64 PARingBufferNext; struct SBufferHeader *Cur, *Next; - descr->Head = 0; + descr->Head = NULL; descr->MemSize = 0; descr->PAHead = 0; descr->NumBuffers = 0; @@ -1719,7 +1719,7 @@ static void release_channel(struct ngene_channel *chan) if (chan->fe) { dvb_unregister_frontend(chan->fe); dvb_frontend_detach(chan->fe); - chan->fe = 0; + chan->fe = NULL; } dvbdemux->dmx.close(&dvbdemux->dmx); dvbdemux->dmx.remove_frontend(&dvbdemux->dmx, @@ -1820,7 +1820,7 @@ static void __devexit ngene_remove(struct pci_dev *pdev) release_channel(&dev->channel[i]); ngene_stop(dev); ngene_release_buffers(dev); - pci_set_drvdata(pdev, 0); + pci_set_drvdata(pdev, NULL); pci_disable_device(pdev); } @@ -1868,7 +1868,7 @@ fail1: ngene_release_buffers(dev); fail0: pci_disable_device(pci_dev); - pci_set_drvdata(pci_dev, 0); + pci_set_drvdata(pci_dev, NULL); return stat; } -- cgit v1.2.3 From 6120792baa00542b5113222b0e09f5e52b510444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20N=C3=A9meth?= Date: Mon, 1 Mar 2010 04:10:52 -0300 Subject: V4L/DVB: az6027: remove redundant condition check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The condition (msg[i].addr == 0xd0) is checked twice the second one is not necessary. This will remove the following compiler warning: az6027.c: In function 'az6027_i2c_xfer': az6027.c:942: warning: 'index' may be used uninitialized in this function az6027.c:943: warning: 'value' may be used uninitialized in this function az6027.c:944: warning: 'length' may be used uninitialized in this function az6027.c:945: warning: 'req' may be used uninitialized in this function Signed-off-by: Márton Németh Cc: Manu Abraham Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/az6027.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/dvb-usb/az6027.c b/drivers/media/dvb/dvb-usb/az6027.c index d7290b2c091..27acbfb6d33 100644 --- a/drivers/media/dvb/dvb-usb/az6027.c +++ b/drivers/media/dvb/dvb-usb/az6027.c @@ -976,17 +976,14 @@ static int az6027_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int n i++; } else { - if (msg[i].addr == 0xd0) { - /* demod 16bit addr */ - req = 0xBD; - index = (((msg[i].buf[0] << 8) & 0xff00) | (msg[i].buf[1] & 0x00ff)); - value = msg[i].addr + (2 << 8); - length = msg[i].len - 2; - len = msg[i].len - 2; - for (j = 0; j < len; j++) - data[j] = msg[i].buf[j + 2]; - - } + /* demod 16bit addr */ + req = 0xBD; + index = (((msg[i].buf[0] << 8) & 0xff00) | (msg[i].buf[1] & 0x00ff)); + value = msg[i].addr + (2 << 8); + length = msg[i].len - 2; + len = msg[i].len - 2; + for (j = 0; j < len; j++) + data[j] = msg[i].buf[j + 2]; az6027_usb_out_op(d, req, value, index, data, length); } } -- cgit v1.2.3 From ad5e9b9b7db760f36b2a51a8b5802355f2d95d47 Mon Sep 17 00:00:00 2001 From: Henrik Kurelid Date: Tue, 21 Jul 2009 13:45:50 -0300 Subject: V4L/DVB: firedtv: correct version number and current/next in CA_PMT The version number in the CA_PMT message sent to the hardware was alwaysed set to zero. This could cause problems if the PMT would change during decryption of a channel since the new CA_PMT would have the same version number as the old. The version number is now copied from the original PMT. Signed-off-by: Henrik Kurelid Signed-off-by: Stefan Richter Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/firewire/firedtv-avc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/firewire/firedtv-avc.c b/drivers/media/dvb/firewire/firedtv-avc.c index 1b31bebc27d..28294af752d 100644 --- a/drivers/media/dvb/firewire/firedtv-avc.c +++ b/drivers/media/dvb/firewire/firedtv-avc.c @@ -1096,7 +1096,7 @@ int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length) c->operand[15] = msg[1]; /* Program number */ c->operand[16] = msg[2]; - c->operand[17] = 0x01; /* Version number=0 + current/next=1 */ + c->operand[17] = msg[3]; /* Version number and current/next */ c->operand[18] = 0x00; /* Section number=0 */ c->operand[19] = 0x00; /* Last section number=0 */ c->operand[20] = 0x1f; /* PCR_PID=1FFF */ -- cgit v1.2.3 From ab6a21f363d830e96e5839b5b1ef67d76f679e59 Mon Sep 17 00:00:00 2001 From: Abylay Ospan Date: Sat, 6 Mar 2010 14:58:01 -0300 Subject: V4L/DVB: Allow to enable TS continuity and TEI check on loaded module Current dvb_demux_tscheck processing doesn't allow to enable check on loaded module. dvb_demux_tscheck can be enabled only when loading module ( dvb_dmx_init should be called to enable dvb_demux_tscheck ). This patch fix this issue. Signed-off-by: Abylay Ospan Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-core/dvb_demux.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/dvb-core/dvb_demux.c b/drivers/media/dvb/dvb-core/dvb_demux.c index 67f189b7aa1..977ddba3e23 100644 --- a/drivers/media/dvb/dvb-core/dvb_demux.c +++ b/drivers/media/dvb/dvb-core/dvb_demux.c @@ -426,7 +426,7 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf) }; }; - if (demux->cnt_storage) { + if (demux->cnt_storage && dvb_demux_tscheck) { /* check pkt counter */ if (pid < MAX_PID) { if (buf[1] & 0x80) @@ -1248,12 +1248,9 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux) dvbdemux->feed[i].index = i; } - if (dvb_demux_tscheck) { - dvbdemux->cnt_storage = vmalloc(MAX_PID + 1); - - if (!dvbdemux->cnt_storage) - printk(KERN_WARNING "Couldn't allocate memory for TS/TEI check. Disabling it\n"); - } + dvbdemux->cnt_storage = vmalloc(MAX_PID + 1); + if (!dvbdemux->cnt_storage) + printk(KERN_WARNING "Couldn't allocate memory for TS/TEI check. Disabling it\n"); INIT_LIST_HEAD(&dvbdemux->frontend_list); -- cgit v1.2.3 From ab9b4f2c11904c3c491b626915526049ecfe5ecf Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Mon, 1 Mar 2010 13:50:40 -0300 Subject: V4L/DVB: af9015: support for KWorld USB DVB-T Stick Mobile (UB383-T) Add USB ID 1b80:e383 for KWorld USB DVB-T Stick Mobile (UB383-T). Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/af9015.c | 9 ++++++++- drivers/media/dvb/dvb-usb/dvb-usb-ids.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/dvb-usb/af9015.c b/drivers/media/dvb/dvb-usb/af9015.c index 74d94e45324..7611af60b6b 100644 --- a/drivers/media/dvb/dvb-usb/af9015.c +++ b/drivers/media/dvb/dvb-usb/af9015.c @@ -1297,6 +1297,7 @@ static struct usb_device_id af9015_usb_table[] = { {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_SVEON_STV20)}, {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_TINYTWIN_2)}, {USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV2000DS)}, +/* 30 */{USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_UB383_T)}, {0}, }; MODULE_DEVICE_TABLE(usb, af9015_usb_table); @@ -1569,7 +1570,7 @@ static struct dvb_usb_device_properties af9015_properties[] = { .i2c_algo = &af9015_i2c_algo, - .num_device_descs = 7, /* max 9 */ + .num_device_descs = 8, /* max 9 */ .devices = { { .name = "AverMedia AVerTV Volar GPS 805 (A805)", @@ -1608,6 +1609,12 @@ static struct dvb_usb_device_properties af9015_properties[] = { .cold_ids = {&af9015_usb_table[29], NULL}, .warm_ids = {NULL}, }, + { + .name = "KWorld USB DVB-T Stick Mobile " \ + "(UB383-T)", + .cold_ids = {&af9015_usb_table[30], NULL}, + .warm_ids = {NULL}, + }, } }, }; diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index ae8b57acfe0..6568db52f4a 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h @@ -127,6 +127,7 @@ #define USB_PID_KWORLD_MC810 0xc810 #define USB_PID_KWORLD_PC160_2T 0xc160 #define USB_PID_KWORLD_PC160_T 0xc161 +#define USB_PID_KWORLD_UB383_T 0xe383 #define USB_PID_KWORLD_VSTREAM_COLD 0x17de #define USB_PID_KWORLD_VSTREAM_WARM 0x17df #define USB_PID_TERRATEC_CINERGY_T_USB_XE 0x0055 -- cgit v1.2.3 From 7fc8709e4d7230ab640a91b9aef8fbd0f7c1488b Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Mon, 1 Mar 2010 14:06:52 -0300 Subject: V4L/DVB: af9015: support for KWorld TV Stick II (395UR) Add USB ID 1b80:e39a for KWorld TV Stick II (395UR). Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/af9015.c | 4 +++- drivers/media/dvb/dvb-usb/dvb-usb-ids.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/dvb-usb/af9015.c b/drivers/media/dvb/dvb-usb/af9015.c index 7611af60b6b..d5ba1de8f07 100644 --- a/drivers/media/dvb/dvb-usb/af9015.c +++ b/drivers/media/dvb/dvb-usb/af9015.c @@ -1298,6 +1298,7 @@ static struct usb_device_id af9015_usb_table[] = { {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_TINYTWIN_2)}, {USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV2000DS)}, /* 30 */{USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_UB383_T)}, + {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_395U_4)}, {0}, }; MODULE_DEVICE_TABLE(usb, af9015_usb_table); @@ -1501,7 +1502,8 @@ static struct dvb_usb_device_properties af9015_properties[] = { "(VS-DVB-T 395U)", .cold_ids = {&af9015_usb_table[16], &af9015_usb_table[17], - &af9015_usb_table[18], NULL}, + &af9015_usb_table[18], + &af9015_usb_table[31], NULL}, .warm_ids = {NULL}, }, { diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index 6568db52f4a..b34ca80de43 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h @@ -124,6 +124,7 @@ #define USB_PID_KWORLD_395U 0xe396 #define USB_PID_KWORLD_395U_2 0xe39b #define USB_PID_KWORLD_395U_3 0xe395 +#define USB_PID_KWORLD_395U_4 0xe39a #define USB_PID_KWORLD_MC810 0xc810 #define USB_PID_KWORLD_PC160_2T 0xc160 #define USB_PID_KWORLD_PC160_T 0xc161 -- cgit v1.2.3 From 403c34f6bbc095f9c8b2e25becd65c9c3d159080 Mon Sep 17 00:00:00 2001 From: Abylay Ospan Date: Sat, 6 Mar 2010 15:05:26 -0300 Subject: V4L/DVB: get_frontend for STV0900 Signed-off-by: Abylay Ospan Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/stv0900_core.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/frontends/stv0900_core.c b/drivers/media/dvb/frontends/stv0900_core.c index 01f8f1f802f..a3cdca72463 100644 --- a/drivers/media/dvb/frontends/stv0900_core.c +++ b/drivers/media/dvb/frontends/stv0900_core.c @@ -1583,7 +1583,7 @@ static enum dvbfe_search stv0900_search(struct dvb_frontend *fe, struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct stv0900_search_params p_search; - struct stv0900_signal_info p_result; + struct stv0900_signal_info p_result = intp->result[demod]; enum fe_stv0900_error error = STV0900_NO_ERROR; @@ -1842,6 +1842,19 @@ static void stv0900_release(struct dvb_frontend *fe) kfree(state); } +static int stv0900_get_frontend(struct dvb_frontend *fe, + struct dvb_frontend_parameters *p) +{ + struct stv0900_state *state = fe->demodulator_priv; + struct stv0900_internal *intp = state->internal; + enum fe_stv0900_demod_num demod = state->demod; + struct stv0900_signal_info p_result = intp->result[demod]; + + p->frequency = p_result.locked ? p_result.frequency : 0; + p->u.qpsk.symbol_rate = p_result.locked ? p_result.symbol_rate : 0; + return 0; +} + static struct dvb_frontend_ops stv0900_ops = { .info = { @@ -1862,6 +1875,7 @@ static struct dvb_frontend_ops stv0900_ops = { }, .release = stv0900_release, .init = stv0900_init, + .get_frontend = stv0900_get_frontend, .get_frontend_algo = stv0900_frontend_algo, .i2c_gate_ctrl = stv0900_i2c_gate_ctrl, .diseqc_send_master_cmd = stv0900_send_master_cmd, -- cgit v1.2.3 From 823b63b49eb9a670fd9125b625e8f4b008fe3abc Mon Sep 17 00:00:00 2001 From: Oleg Roitburd Date: Thu, 25 Feb 2010 17:19:31 -0300 Subject: V4L/DVB: AZ6027: Add support for Technisat V1 device Signed-off-by: Oleg Roitburd Signed-off-by: Manu Abraham Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/az6027.c | 3 ++- drivers/media/dvb/dvb-usb/dvb-usb-ids.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/dvb-usb/az6027.c b/drivers/media/dvb/dvb-usb/az6027.c index 27acbfb6d33..7db7d3d94f7 100644 --- a/drivers/media/dvb/dvb-usb/az6027.c +++ b/drivers/media/dvb/dvb-usb/az6027.c @@ -1057,7 +1057,8 @@ int az6027_identify_state(struct usb_device *udev, static struct usb_device_id az6027_usb_table[] = { { USB_DEVICE(USB_VID_AZUREWAVE, USB_PID_AZUREWAVE_AZ6027) }, { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_DVBS2CI) }, - { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI) }, + { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI_V1) }, + { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI_V2) }, { }, }; diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index b34ca80de43..0573de50c09 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h @@ -299,5 +299,6 @@ #define USB_PID_SVEON_STV20 0xe39d #define USB_PID_AZUREWAVE_AZ6027 0x3275 #define USB_PID_TERRATEC_DVBS2CI 0x3275 -#define USB_PID_TECHNISAT_USB2_HDCI 0x0002 +#define USB_PID_TECHNISAT_USB2_HDCI_V1 0x0001 +#define USB_PID_TECHNISAT_USB2_HDCI_V2 0x0002 #endif -- cgit v1.2.3 From 20d2c56de8b3c462c40ef2eff42ff722905e28cf Mon Sep 17 00:00:00 2001 From: Oleg Roitburd Date: Fri, 26 Feb 2010 09:47:16 -0300 Subject: V4L/DVB: AZ6027: Fix initialization for some cards Also add in some more device ID's Signed-off-by: Oleg Roitburd Signed-off-by: Manu Abraham Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/az6027.c | 21 +++++++++++++++++++-- drivers/media/dvb/dvb-usb/dvb-usb-ids.h | 3 ++- 2 files changed, 21 insertions(+), 3 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/dvb-usb/az6027.c b/drivers/media/dvb/dvb-usb/az6027.c index 7db7d3d94f7..60787a28edb 100644 --- a/drivers/media/dvb/dvb-usb/az6027.c +++ b/drivers/media/dvb/dvb-usb/az6027.c @@ -1056,7 +1056,8 @@ int az6027_identify_state(struct usb_device *udev, static struct usb_device_id az6027_usb_table[] = { { USB_DEVICE(USB_VID_AZUREWAVE, USB_PID_AZUREWAVE_AZ6027) }, - { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_DVBS2CI) }, + { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_DVBS2CI_V1) }, + { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_DVBS2CI_V2) }, { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI_V1) }, { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI_V2) }, { }, @@ -1101,12 +1102,28 @@ static struct dvb_usb_device_properties az6027_properties = { .rc_query = az6027_rc_query, .i2c_algo = &az6027_i2c_algo, - .num_device_descs = 1, + .num_device_descs = 5, .devices = { { .name = "AZUREWAVE DVB-S/S2 USB2.0 (AZ6027)", .cold_ids = { &az6027_usb_table[0], NULL }, .warm_ids = { NULL }, + }, { + .name = "TERRATEC S7", + .cold_ids = { &az6027_usb_table[1], NULL }, + .warm_ids = { NULL }, + }, { + .name = "TERRATEC S7 MKII", + .cold_ids = { &az6027_usb_table[2], NULL }, + .warm_ids = { NULL }, + }, { + .name = "Technisat SkyStar USB 2 HD CI", + .cold_ids = { &az6027_usb_table[3], NULL }, + .warm_ids = { NULL }, + }, { + .name = "Technisat SkyStar USB 2 HD CI", + .cold_ids = { &az6027_usb_table[4], NULL }, + .warm_ids = { NULL }, }, { NULL }, } diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index 0573de50c09..de1f3af60d5 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h @@ -298,7 +298,8 @@ #define USB_PID_TVWAY_PLUS 0x0002 #define USB_PID_SVEON_STV20 0xe39d #define USB_PID_AZUREWAVE_AZ6027 0x3275 -#define USB_PID_TERRATEC_DVBS2CI 0x3275 +#define USB_PID_TERRATEC_DVBS2CI_V1 0x10a4 +#define USB_PID_TERRATEC_DVBS2CI_V2 0x10ac #define USB_PID_TECHNISAT_USB2_HDCI_V1 0x0001 #define USB_PID_TECHNISAT_USB2_HDCI_V2 0x0002 #endif -- cgit v1.2.3 From 19c4ee58325ac7c9d9595153fabb5d885dfe931e Mon Sep 17 00:00:00 2001 From: Manu Abraham Date: Fri, 22 Jan 2010 17:19:49 -0300 Subject: V4L/DVB: [STV090x] Code simplification - Remove a redundant exported gate control function Signed-off-by: Manu Abraham Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/stv090x.c | 57 +++++++++++++++++------------------ 1 file changed, 27 insertions(+), 30 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c index 96972804f4a..0af17083511 100644 --- a/drivers/media/dvb/frontends/stv090x.c +++ b/drivers/media/dvb/frontends/stv090x.c @@ -754,9 +754,8 @@ static int stv090x_write_reg(struct stv090x_state *state, unsigned int reg, u8 d return stv090x_write_regs(state, reg, &data, 1); } -static int stv090x_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) +static int stv090x_i2c_gate_ctrl(struct stv090x_state *state, int enable) { - struct stv090x_state *state = fe->demodulator_priv; u32 reg; if (enable) @@ -1778,7 +1777,7 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state) freq -= cur_step * car_step; /* Setup tuner */ - if (stv090x_i2c_gate_ctrl(fe, 1) < 0) + if (stv090x_i2c_gate_ctrl(state, 1) < 0) goto err; if (state->config->tuner_set_frequency) { @@ -1791,12 +1790,12 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state) goto err_gateoff; } - if (stv090x_i2c_gate_ctrl(fe, 0) < 0) + if (stv090x_i2c_gate_ctrl(state, 0) < 0) goto err; msleep(50); - if (stv090x_i2c_gate_ctrl(fe, 1) < 0) + if (stv090x_i2c_gate_ctrl(state, 1) < 0) goto err; if (state->config->tuner_get_status) { @@ -1809,7 +1808,7 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state) else dprintk(FE_DEBUG, 1, "Tuner unlocked"); - if (stv090x_i2c_gate_ctrl(fe, 0) < 0) + if (stv090x_i2c_gate_ctrl(state, 0) < 0) goto err; } @@ -1822,7 +1821,7 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state) return srate_coarse; err_gateoff: - stv090x_i2c_gate_ctrl(fe, 0); + stv090x_i2c_gate_ctrl(state, 0); err: dprintk(FE_ERROR, 1, "I/O error"); return -1; @@ -2167,7 +2166,7 @@ static int stv090x_get_coldlock(struct stv090x_state *state, s32 timeout_dmd) freq -= cur_step * car_step; /* Setup tuner */ - if (stv090x_i2c_gate_ctrl(fe, 1) < 0) + if (stv090x_i2c_gate_ctrl(state, 1) < 0) goto err; if (state->config->tuner_set_frequency) { @@ -2180,12 +2179,12 @@ static int stv090x_get_coldlock(struct stv090x_state *state, s32 timeout_dmd) goto err_gateoff; } - if (stv090x_i2c_gate_ctrl(fe, 0) < 0) + if (stv090x_i2c_gate_ctrl(state, 0) < 0) goto err; msleep(50); - if (stv090x_i2c_gate_ctrl(fe, 1) < 0) + if (stv090x_i2c_gate_ctrl(state, 1) < 0) goto err; if (state->config->tuner_get_status) { @@ -2198,7 +2197,7 @@ static int stv090x_get_coldlock(struct stv090x_state *state, s32 timeout_dmd) else dprintk(FE_DEBUG, 1, "Tuner unlocked"); - if (stv090x_i2c_gate_ctrl(fe, 0) < 0) + if (stv090x_i2c_gate_ctrl(state, 0) < 0) goto err; STV090x_WRITE_DEMOD(state, DMDISTATE, 0x1c); @@ -2222,7 +2221,7 @@ static int stv090x_get_coldlock(struct stv090x_state *state, s32 timeout_dmd) return lock; err_gateoff: - stv090x_i2c_gate_ctrl(fe, 0); + stv090x_i2c_gate_ctrl(state, 0); err: dprintk(FE_ERROR, 1, "I/O error"); return -1; @@ -2591,7 +2590,7 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st } state->delsys = stv090x_get_std(state); - if (stv090x_i2c_gate_ctrl(fe, 1) < 0) + if (stv090x_i2c_gate_ctrl(state, 1) < 0) goto err; if (state->config->tuner_get_frequency) { @@ -2599,7 +2598,7 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st goto err_gateoff; } - if (stv090x_i2c_gate_ctrl(fe, 0) < 0) + if (stv090x_i2c_gate_ctrl(state, 0) < 0) goto err; offst_freq = stv090x_get_car_freq(state, state->internal->mclk) / 1000; @@ -2619,7 +2618,7 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st if ((state->algo == STV090x_BLIND_SEARCH) || (state->srate < 10000000)) { - if (stv090x_i2c_gate_ctrl(fe, 1) < 0) + if (stv090x_i2c_gate_ctrl(state, 1) < 0) goto err; if (state->config->tuner_get_frequency) { @@ -2627,7 +2626,7 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st goto err_gateoff; } - if (stv090x_i2c_gate_ctrl(fe, 0) < 0) + if (stv090x_i2c_gate_ctrl(state, 0) < 0) goto err; if (abs(offst_freq) <= ((state->search_range / 2000) + 500)) @@ -2646,7 +2645,7 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st return STV090x_OUTOFRANGE; err_gateoff: - stv090x_i2c_gate_ctrl(fe, 0); + stv090x_i2c_gate_ctrl(state, 0); err: dprintk(FE_ERROR, 1, "I/O error"); return -1; @@ -3000,7 +2999,7 @@ static int stv090x_optimize_track(struct stv090x_state *state) if (state->algo != STV090x_WARM_SEARCH) { - if (stv090x_i2c_gate_ctrl(fe, 1) < 0) + if (stv090x_i2c_gate_ctrl(state, 1) < 0) goto err; if (state->config->tuner_set_bandwidth) { @@ -3008,7 +3007,7 @@ static int stv090x_optimize_track(struct stv090x_state *state) goto err_gateoff; } - if (stv090x_i2c_gate_ctrl(fe, 0) < 0) + if (stv090x_i2c_gate_ctrl(state, 0) < 0) goto err; } @@ -3059,7 +3058,7 @@ static int stv090x_optimize_track(struct stv090x_state *state) return 0; err_gateoff: - stv090x_i2c_gate_ctrl(fe, 0); + stv090x_i2c_gate_ctrl(state, 0); err: dprintk(FE_ERROR, 1, "I/O error"); return -1; @@ -3235,7 +3234,7 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state) } /* Setup tuner */ - if (stv090x_i2c_gate_ctrl(fe, 1) < 0) + if (stv090x_i2c_gate_ctrl(state, 1) < 0) goto err; if (state->config->tuner_set_bbgain) { @@ -3256,17 +3255,17 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state) goto err_gateoff; } - if (stv090x_i2c_gate_ctrl(fe, 0) < 0) + if (stv090x_i2c_gate_ctrl(state, 0) < 0) goto err; msleep(50); if (state->config->tuner_get_status) { - if (stv090x_i2c_gate_ctrl(fe, 1) < 0) + if (stv090x_i2c_gate_ctrl(state, 1) < 0) goto err; if (state->config->tuner_get_status(fe, ®) < 0) goto err_gateoff; - if (stv090x_i2c_gate_ctrl(fe, 0) < 0) + if (stv090x_i2c_gate_ctrl(state, 0) < 0) goto err; if (reg) @@ -3400,7 +3399,7 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state) return signal_state; err_gateoff: - stv090x_i2c_gate_ctrl(fe, 0); + stv090x_i2c_gate_ctrl(state, 0); err: dprintk(FE_ERROR, 1, "I/O error"); return -1; @@ -4336,7 +4335,7 @@ static int stv090x_init(struct dvb_frontend *fe) if (STV090x_WRITE_DEMOD(state, DEMOD, reg) < 0) goto err; - if (stv090x_i2c_gate_ctrl(fe, 1) < 0) + if (stv090x_i2c_gate_ctrl(state, 1) < 0) goto err; if (config->tuner_set_mode) { @@ -4349,7 +4348,7 @@ static int stv090x_init(struct dvb_frontend *fe) goto err_gateoff; } - if (stv090x_i2c_gate_ctrl(fe, 0) < 0) + if (stv090x_i2c_gate_ctrl(state, 0) < 0) goto err; if (stv090x_set_tspath(state) < 0) @@ -4358,7 +4357,7 @@ static int stv090x_init(struct dvb_frontend *fe) return 0; err_gateoff: - stv090x_i2c_gate_ctrl(fe, 0); + stv090x_i2c_gate_ctrl(state, 0); err: dprintk(FE_ERROR, 1, "I/O error"); return -1; @@ -4503,8 +4502,6 @@ static struct dvb_frontend_ops stv090x_ops = { .sleep = stv090x_sleep, .get_frontend_algo = stv090x_frontend_algo, - .i2c_gate_ctrl = stv090x_i2c_gate_ctrl, - .diseqc_send_master_cmd = stv090x_send_diseqc_msg, .diseqc_send_burst = stv090x_send_diseqc_burst, .diseqc_recv_slave_reply = stv090x_recv_slave_reply, -- cgit v1.2.3 From c5b74b0f5e81386ca1e9b1128de83502e92fa028 Mon Sep 17 00:00:00 2001 From: Manu Abraham Date: Sat, 23 Jan 2010 05:49:08 -0300 Subject: V4L/DVB: [STV090x, STV6110x] Use tuner sleep within the demodulator control Oliver Endriss pointed out: Imho not a good idea, as the frontend thread calls - fe->ops.tuner_ops.init - fe->ops.tuner_ops.sleep If you remove fe->ops.i2c_gate_ctrl, init and sleep will fail, because gate_ctrl was never called... -- Signed-off-by: Manu Abraham Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/stv090x.c | 8 ++++++++ drivers/media/dvb/frontends/stv090x.h | 1 + drivers/media/dvb/frontends/stv6110x.c | 4 +--- drivers/media/dvb/frontends/stv6110x.h | 1 + drivers/media/dvb/ttpci/budget.c | 2 ++ 5 files changed, 13 insertions(+), 3 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c index 0af17083511..a80a34bb9eb 100644 --- a/drivers/media/dvb/frontends/stv090x.c +++ b/drivers/media/dvb/frontends/stv090x.c @@ -3838,6 +3838,11 @@ static int stv090x_sleep(struct dvb_frontend *fe) struct stv090x_state *state = fe->demodulator_priv; u32 reg; + if (state->config->tuner_init) { + if (state->config->tuner_sleep(fe) < 0) + goto err_gateoff; + } + dprintk(FE_DEBUG, 1, "Set %s to sleep", state->device == STV0900 ? "STV0900" : "STV0903"); @@ -3852,6 +3857,9 @@ static int stv090x_sleep(struct dvb_frontend *fe) goto err; return 0; + +err_gateoff: + stv090x_i2c_gate_ctrl(state, 0); err: dprintk(FE_ERROR, 1, "I/O error"); return -1; diff --git a/drivers/media/dvb/frontends/stv090x.h b/drivers/media/dvb/frontends/stv090x.h index 30f01a6902a..dd1b93ae4e9 100644 --- a/drivers/media/dvb/frontends/stv090x.h +++ b/drivers/media/dvb/frontends/stv090x.h @@ -87,6 +87,7 @@ struct stv090x_config { bool diseqc_envelope_mode; int (*tuner_init) (struct dvb_frontend *fe); + int (*tuner_sleep) (struct dvb_frontend *fe); int (*tuner_set_mode) (struct dvb_frontend *fe, enum tuner_mode mode); int (*tuner_set_frequency) (struct dvb_frontend *fe, u32 frequency); int (*tuner_get_frequency) (struct dvb_frontend *fe, u32 *frequency); diff --git a/drivers/media/dvb/frontends/stv6110x.c b/drivers/media/dvb/frontends/stv6110x.c index dea4245f077..c1ddb83e634 100644 --- a/drivers/media/dvb/frontends/stv6110x.c +++ b/drivers/media/dvb/frontends/stv6110x.c @@ -338,14 +338,12 @@ static struct dvb_tuner_ops stv6110x_ops = { .frequency_max = 2150000, .frequency_step = 0, }, - - .init = stv6110x_init, - .sleep = stv6110x_sleep, .release = stv6110x_release }; static struct stv6110x_devctl stv6110x_ctl = { .tuner_init = stv6110x_init, + .tuner_sleep = stv6110x_sleep, .tuner_set_mode = stv6110x_set_mode, .tuner_set_frequency = stv6110x_set_frequency, .tuner_get_frequency = stv6110x_get_frequency, diff --git a/drivers/media/dvb/frontends/stv6110x.h b/drivers/media/dvb/frontends/stv6110x.h index 2429ae6d784..47516753929 100644 --- a/drivers/media/dvb/frontends/stv6110x.h +++ b/drivers/media/dvb/frontends/stv6110x.h @@ -40,6 +40,7 @@ enum tuner_status { struct stv6110x_devctl { int (*tuner_init) (struct dvb_frontend *fe); + int (*tuner_sleep) (struct dvb_frontend *fe); int (*tuner_set_mode) (struct dvb_frontend *fe, enum tuner_mode mode); int (*tuner_set_frequency) (struct dvb_frontend *fe, u32 frequency); int (*tuner_get_frequency) (struct dvb_frontend *fe, u32 *frequency); diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c index 1500210c06c..e5cb1022d9d 100644 --- a/drivers/media/dvb/ttpci/budget.c +++ b/drivers/media/dvb/ttpci/budget.c @@ -442,6 +442,7 @@ static struct stv090x_config tt1600_stv090x_config = { .repeater_level = STV090x_RPTLEVEL_16, .tuner_init = NULL, + .tuner_sleep = NULL, .tuner_set_mode = NULL, .tuner_set_frequency = NULL, .tuner_get_frequency = NULL, @@ -628,6 +629,7 @@ static void frontend_init(struct budget *budget) &budget->i2c_adap); tt1600_stv090x_config.tuner_init = ctl->tuner_init; + tt1600_stv090x_config.tuner_sleep = ctl->tuner_sleep; tt1600_stv090x_config.tuner_set_mode = ctl->tuner_set_mode; tt1600_stv090x_config.tuner_set_frequency = ctl->tuner_set_frequency; tt1600_stv090x_config.tuner_get_frequency = ctl->tuner_get_frequency; -- cgit v1.2.3 From 85532d1454dd3df7327d12bf6ca7ef5a00bb1282 Mon Sep 17 00:00:00 2001 From: Manu Abraham Date: Sat, 23 Jan 2010 06:05:37 -0300 Subject: V4L/DVB: [STV090x] Use gate control, while tuner is being accessed Signed-off-by: Manu Abraham Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/stv090x.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c index a80a34bb9eb..3cc1be28534 100644 --- a/drivers/media/dvb/frontends/stv090x.c +++ b/drivers/media/dvb/frontends/stv090x.c @@ -3838,11 +3838,17 @@ static int stv090x_sleep(struct dvb_frontend *fe) struct stv090x_state *state = fe->demodulator_priv; u32 reg; - if (state->config->tuner_init) { + if (stv090x_i2c_gate_ctrl(state, 1) < 0) + goto err; + + if (state->config->tuner_sleep) { if (state->config->tuner_sleep(fe) < 0) goto err_gateoff; } + if (stv090x_i2c_gate_ctrl(state, 0) < 0) + goto err; + dprintk(FE_DEBUG, 1, "Set %s to sleep", state->device == STV0900 ? "STV0900" : "STV0903"); -- cgit v1.2.3 From 5817ea0c83665dbc117cb7ca637202da0fb1abce Mon Sep 17 00:00:00 2001 From: Andreas Regel Date: Sat, 13 Feb 2010 16:48:07 -0300 Subject: V4L/DVB: Budget/STV090x/STV6110x: Initialize the demodulator immediately after the tuner is attached Signed-off-by: Andreas Regel Signed-off-by: Manu Abraham Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/stv090x.c | 14 ++++++++++++++ drivers/media/dvb/frontends/stv6110x.c | 20 -------------------- drivers/media/dvb/ttpci/budget.c | 6 ++++++ 3 files changed, 20 insertions(+), 20 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c index 3cc1be28534..a461fdff2c9 100644 --- a/drivers/media/dvb/frontends/stv090x.c +++ b/drivers/media/dvb/frontends/stv090x.c @@ -4324,6 +4324,20 @@ static int stv090x_init(struct dvb_frontend *fe) u32 reg; if (state->internal->mclk == 0) { + /* call tuner init to configure the tuner's clock output + divider directly before setting up the master clock of + the stv090x. */ + if (stv090x_i2c_gate_ctrl(state, 1) < 0) + goto err; + + if (config->tuner_init) { + if (config->tuner_init(fe) < 0) + goto err_gateoff; + } + + if (stv090x_i2c_gate_ctrl(state, 0) < 0) + goto err; + stv090x_set_mclk(state, 135000000, config->xtal); /* 135 Mhz */ msleep(5); if (stv090x_write_reg(state, STV090x_SYNTCTRL, diff --git a/drivers/media/dvb/frontends/stv6110x.c b/drivers/media/dvb/frontends/stv6110x.c index c1ddb83e634..2f9cd244134 100644 --- a/drivers/media/dvb/frontends/stv6110x.c +++ b/drivers/media/dvb/frontends/stv6110x.c @@ -361,7 +361,6 @@ struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe, { struct stv6110x_state *stv6110x; u8 default_regs[] = {0x07, 0x11, 0xdc, 0x85, 0x17, 0x01, 0xe6, 0x1e}; - int ret; stv6110x = kzalloc(sizeof (struct stv6110x_state), GFP_KERNEL); if (stv6110x == NULL) @@ -390,25 +389,6 @@ struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe, break; } - if (fe->ops.i2c_gate_ctrl) { - ret = fe->ops.i2c_gate_ctrl(fe, 1); - if (ret < 0) - goto error; - } - - ret = stv6110x_write_regs(stv6110x, 0, stv6110x->regs, - ARRAY_SIZE(stv6110x->regs)); - if (ret < 0) { - dprintk(FE_ERROR, 1, "Initialization failed"); - goto error; - } - - if (fe->ops.i2c_gate_ctrl) { - ret = fe->ops.i2c_gate_ctrl(fe, 0); - if (ret < 0) - goto error; - } - fe->tuner_priv = stv6110x; fe->ops.tuner_ops = stv6110x_ops; diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c index e5cb1022d9d..f5db13d8b99 100644 --- a/drivers/media/dvb/ttpci/budget.c +++ b/drivers/media/dvb/ttpci/budget.c @@ -640,6 +640,12 @@ static void frontend_init(struct budget *budget) tt1600_stv090x_config.tuner_set_refclk = ctl->tuner_set_refclk; tt1600_stv090x_config.tuner_get_status = ctl->tuner_get_status; + /* call the init function once to initialize + tuner's clock output divider and demod's + master clock */ + if (budget->dvb_frontend->ops.init) + budget->dvb_frontend->ops.init(budget->dvb_frontend); + dvb_attach(isl6423_attach, budget->dvb_frontend, &budget->i2c_adap, -- cgit v1.2.3 From c8382c8e3295a1c85975c1898410f4d103650e4a Mon Sep 17 00:00:00 2001 From: Manu Abraham Date: Sat, 13 Feb 2010 17:06:14 -0300 Subject: V4L/DVB: stv090x: Add some notes about the internal tuner I/O control Signed-off-by: Manu Abraham Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/stv090x.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c index a461fdff2c9..425e7a43ae1 100644 --- a/drivers/media/dvb/frontends/stv090x.c +++ b/drivers/media/dvb/frontends/stv090x.c @@ -758,6 +758,15 @@ static int stv090x_i2c_gate_ctrl(struct stv090x_state *state, int enable) { u32 reg; + /* + * NOTE! A lock is used as a FSM to control the state in which + * access is serialized between two tuners on the same demod. + * This has nothing to do with a lock to protect a critical section + * which may in some other cases be confused with protecting I/O + * access to the demodulator gate. + * In case of any error, the lock is unlocked and exit within the + * relevant operations themselves. + */ if (enable) mutex_lock(&state->internal->tuner_lock); -- cgit v1.2.3 From 5ce005002cd30a71f4355bd4fa8884154d6bd1ad Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Tue, 9 Mar 2010 18:13:49 -0300 Subject: V4L/DVB: drivers/media: drop redundant memset The region set by the call to memset is immediately overwritten by the subsequent call to memcpy. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression e1,e2,e3,e4; @@ - memset(e1,e2,e3); memcpy(e1,e4,e3); // Signed-off-by: Julia Lawall Cc: Manu Abraham Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/bt8xx/dst.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/bt8xx/dst.c b/drivers/media/dvb/bt8xx/dst.c index 8b0cde38984..248a2a9d841 100644 --- a/drivers/media/dvb/bt8xx/dst.c +++ b/drivers/media/dvb/bt8xx/dst.c @@ -930,7 +930,6 @@ static int dst_fw_ver(struct dst_state *state) dprintk(verbose, DST_INFO, 1, "Unsupported Command"); return -1; } - memset(&state->fw_version, '\0', 8); memcpy(&state->fw_version, &state->rxbuffer, 8); dprintk(verbose, DST_ERROR, 1, "Firmware Ver = %x.%x Build = %02x, on %x:%x, %x-%x-20%02x", state->fw_version[0] >> 4, state->fw_version[0] & 0x0f, @@ -1053,7 +1052,6 @@ static int dst_get_tuner_info(struct dst_state *state) goto force; } } - memset(&state->board_info, '\0', 8); memcpy(&state->board_info, &state->rxbuffer, 8); if (state->type_flags & DST_TYPE_HAS_MULTI_FE) { dprintk(verbose, DST_ERROR, 1, "DST type has TS=188"); -- cgit v1.2.3 From c4ea13b40bc962245a38148dc5e7633fd8428880 Mon Sep 17 00:00:00 2001 From: Oliver Endriss Date: Wed, 10 Mar 2010 12:46:46 -0300 Subject: V4L/DVB: ngene: Add support for cineS2 v5 and SaTiX-S2 Dual v2 Add support for - Linux4Media cineS2 DVB-S2 Twin Tuner (v5) - Mystique SaTiX-S2 Dual (v2) Signed-off-by: Oliver Endriss Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/ngene/ngene-core.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/ngene/ngene-core.c b/drivers/media/dvb/ngene/ngene-core.c index 52f60d448de..a45e53a6546 100644 --- a/drivers/media/dvb/ngene/ngene-core.c +++ b/drivers/media/dvb/ngene/ngene-core.c @@ -1920,7 +1920,7 @@ static struct ngene_info ngene_info_cineS2 = { .fw_version = 15, }; -static struct ngene_info ngene_info_satixs2 = { +static struct ngene_info ngene_info_satixS2 = { .type = NGENE_SIDEWINDER, .name = "Mystique SaTiX-S2 Dual", .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN}, @@ -1933,6 +1933,32 @@ static struct ngene_info ngene_info_satixs2 = { .fw_version = 15, }; +static struct ngene_info ngene_info_satixS2v2 = { + .type = NGENE_SIDEWINDER, + .name = "Mystique SaTiX-S2 Dual (v2)", + .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN}, + .demod_attach = {demod_attach_stv0900, demod_attach_stv0900}, + .tuner_attach = {tuner_attach_stv6110, tuner_attach_stv6110}, + .fe_config = {&fe_cineS2, &fe_cineS2}, + .tuner_config = {&tuner_cineS2_0, &tuner_cineS2_1}, + .lnb = {0x0a, 0x08}, + .tsf = {3, 3}, + .fw_version = 15, +}; + +static struct ngene_info ngene_info_cineS2v5 = { + .type = NGENE_SIDEWINDER, + .name = "Linux4Media cineS2 DVB-S2 Twin Tuner (v5)", + .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN}, + .demod_attach = {demod_attach_stv0900, demod_attach_stv0900}, + .tuner_attach = {tuner_attach_stv6110, tuner_attach_stv6110}, + .fe_config = {&fe_cineS2, &fe_cineS2}, + .tuner_config = {&tuner_cineS2_0, &tuner_cineS2_1}, + .lnb = {0x0a, 0x08}, + .tsf = {3, 3}, + .fw_version = 15, +}; + /****************************************************************************/ @@ -1951,7 +1977,9 @@ static struct ngene_info ngene_info_satixs2 = { static const struct pci_device_id ngene_id_tbl[] __devinitdata = { NGENE_ID(0x18c3, 0xabc3, ngene_info_cineS2), NGENE_ID(0x18c3, 0xabc4, ngene_info_cineS2), - NGENE_ID(0x18c3, 0xdb01, ngene_info_satixs2), + NGENE_ID(0x18c3, 0xdb01, ngene_info_satixS2), + NGENE_ID(0x18c3, 0xdb02, ngene_info_satixS2v2), + NGENE_ID(0x18c3, 0xdd00, ngene_info_cineS2v5), {0} }; MODULE_DEVICE_TABLE(pci, ngene_id_tbl); -- cgit v1.2.3 From 000f64efc7fe6693261a78a0164c0e805553631b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 11 Mar 2010 01:58:12 -0300 Subject: V4L/DVB: Fix bad whitespacing Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/az6027.c | 10 +++++----- drivers/media/dvb/frontends/atbm8830_priv.h | 2 +- drivers/media/dvb/mantis/mantis_vp1041.c | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/dvb-usb/az6027.c b/drivers/media/dvb/dvb-usb/az6027.c index 60787a28edb..30ea3eff1ef 100644 --- a/drivers/media/dvb/dvb-usb/az6027.c +++ b/drivers/media/dvb/dvb-usb/az6027.c @@ -125,12 +125,12 @@ static const struct stb0899_s1_reg az6027_stb0899_s1_init_3[] = { { STB0899_RCOMPC , 0xc9 }, { STB0899_AGC1CN , 0x01 }, { STB0899_AGC1REF , 0x10 }, - { STB0899_RTC , 0x23 }, + { STB0899_RTC , 0x23 }, { STB0899_TMGCFG , 0x4e }, { STB0899_AGC2REF , 0x34 }, { STB0899_TLSR , 0x84 }, { STB0899_CFD , 0xf7 }, - { STB0899_ACLC , 0x87 }, + { STB0899_ACLC , 0x87 }, { STB0899_BCLC , 0x94 }, { STB0899_EQON , 0x41 }, { STB0899_LDT , 0xf1 }, @@ -183,10 +183,10 @@ static const struct stb0899_s1_reg az6027_stb0899_s1_init_3[] = { { STB0899_ECNT3M , 0x0a }, { STB0899_ECNT3L , 0xad }, { STB0899_FECAUTO1 , 0x06 }, - { STB0899_FECM , 0x01 }, + { STB0899_FECM , 0x01 }, { STB0899_VTH12 , 0xb0 }, { STB0899_VTH23 , 0x7a }, - { STB0899_VTH34 , 0x58 }, + { STB0899_VTH34 , 0x58 }, { STB0899_VTH56 , 0x38 }, { STB0899_VTH67 , 0x34 }, { STB0899_VTH78 , 0x24 }, @@ -195,7 +195,7 @@ static const struct stb0899_s1_reg az6027_stb0899_s1_init_3[] = { { STB0899_RSULC , 0xb1 }, /* DVB = 0xb1, DSS = 0xa1 */ { STB0899_TSULC , 0x42 }, { STB0899_RSLLC , 0x41 }, - { STB0899_TSLPL , 0x12 }, + { STB0899_TSLPL , 0x12 }, { STB0899_TSCFGH , 0x0c }, { STB0899_TSCFGM , 0x00 }, { STB0899_TSCFGL , 0x00 }, diff --git a/drivers/media/dvb/frontends/atbm8830_priv.h b/drivers/media/dvb/frontends/atbm8830_priv.h index ce960f76092..d460058d497 100644 --- a/drivers/media/dvb/frontends/atbm8830_priv.h +++ b/drivers/media/dvb/frontends/atbm8830_priv.h @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - + #ifndef __ATBM8830_PRIV_H #define __ATBM8830_PRIV_H diff --git a/drivers/media/dvb/mantis/mantis_vp1041.c b/drivers/media/dvb/mantis/mantis_vp1041.c index 515346dd31d..d1aa2bc0c15 100644 --- a/drivers/media/dvb/mantis/mantis_vp1041.c +++ b/drivers/media/dvb/mantis/mantis_vp1041.c @@ -136,12 +136,12 @@ static const struct stb0899_s1_reg vp1041_stb0899_s1_init_3[] = { { STB0899_RCOMPC , 0xc9 }, { STB0899_AGC1CN , 0x01 }, { STB0899_AGC1REF , 0x10 }, - { STB0899_RTC , 0x23 }, + { STB0899_RTC , 0x23 }, { STB0899_TMGCFG , 0x4e }, { STB0899_AGC2REF , 0x34 }, { STB0899_TLSR , 0x84 }, { STB0899_CFD , 0xf7 }, - { STB0899_ACLC , 0x87 }, + { STB0899_ACLC , 0x87 }, { STB0899_BCLC , 0x94 }, { STB0899_EQON , 0x41 }, { STB0899_LDT , 0xf1 }, @@ -194,10 +194,10 @@ static const struct stb0899_s1_reg vp1041_stb0899_s1_init_3[] = { { STB0899_ECNT3M , 0x0a }, { STB0899_ECNT3L , 0xad }, { STB0899_FECAUTO1 , 0x06 }, - { STB0899_FECM , 0x01 }, + { STB0899_FECM , 0x01 }, { STB0899_VTH12 , 0xb0 }, { STB0899_VTH23 , 0x7a }, - { STB0899_VTH34 , 0x58 }, + { STB0899_VTH34 , 0x58 }, { STB0899_VTH56 , 0x38 }, { STB0899_VTH67 , 0x34 }, { STB0899_VTH78 , 0x24 }, @@ -206,7 +206,7 @@ static const struct stb0899_s1_reg vp1041_stb0899_s1_init_3[] = { { STB0899_RSULC , 0xb1 }, /* DVB = 0xb1, DSS = 0xa1 */ { STB0899_TSULC , 0x42 }, { STB0899_RSLLC , 0x41 }, - { STB0899_TSLPL , 0x12 }, + { STB0899_TSLPL , 0x12 }, { STB0899_TSCFGH , 0x0c }, { STB0899_TSCFGM , 0x00 }, { STB0899_TSCFGL , 0x00 }, -- cgit v1.2.3 From 727e625cc2c114e449a78f851b0c12edac897a83 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 12 Mar 2010 21:18:14 -0300 Subject: V4L/DVB: ir-core: export driver name used by IR via uevent Now, both driver and keytable names are exported to userspace. This will help userspace to decide when a table need to be replaced by another one. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dm1105/dm1105.c | 4 +++- drivers/media/dvb/mantis/mantis_input.c | 4 +++- drivers/media/dvb/ttpci/budget-ci.c | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/dm1105/dm1105.c b/drivers/media/dvb/dm1105/dm1105.c index b6d46961a99..3229ff325c5 100644 --- a/drivers/media/dvb/dm1105/dm1105.c +++ b/drivers/media/dvb/dm1105/dm1105.c @@ -46,6 +46,8 @@ #include "z0194a.h" #include "ds3000.h" +#define MODULE_NAME "dm1105" + #define UNSET (-1U) #define DM1105_BOARD_NOAUTO UNSET @@ -628,7 +630,7 @@ int __devinit dm1105_ir_init(struct dm1105_dev *dm1105) INIT_WORK(&dm1105->ir.work, dm1105_emit_key); - err = ir_input_register(input_dev, ir_codes, NULL); + err = ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); return err; } diff --git a/drivers/media/dvb/mantis/mantis_input.c b/drivers/media/dvb/mantis/mantis_input.c index 4675a3b53c7..6baf3022968 100644 --- a/drivers/media/dvb/mantis/mantis_input.c +++ b/drivers/media/dvb/mantis/mantis_input.c @@ -32,6 +32,8 @@ #include "mantis_reg.h" #include "mantis_uart.h" +#define MODULE_NAME "mantis_core" + static struct ir_scancode mantis_ir_table[] = { { 0x29, KEY_POWER }, { 0x28, KEY_FAVORITES }, @@ -126,7 +128,7 @@ int mantis_input_init(struct mantis_pci *mantis) rc->id.version = 1; rc->dev = mantis->pdev->dev; - err = ir_input_register(rc, &ir_mantis, NULL); + err = ir_input_register(rc, &ir_mantis, NULL, MODULE_NAME); if (err) { dprintk(MANTIS_ERROR, 1, "IR device registration failed, ret = %d", err); input_free_device(rc); diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index 49c2a817a06..ec89afd3891 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c @@ -54,6 +54,8 @@ #include "tda1002x.h" #include "tda827x.h" +#define MODULE_NAME "budget_ci" + /* * Regarding DEBIADDR_IR: * Some CI modules hang if random addresses are read. @@ -254,7 +256,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci) budget_ci->ir.timer_keyup.function = msp430_ir_keyup; budget_ci->ir.timer_keyup.data = (unsigned long) &budget_ci->ir; budget_ci->ir.last_raw = 0xffff; /* An impossible value */ - error = ir_input_register(input_dev, ir_codes, NULL); + error = ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); if (error) { printk(KERN_ERR "budget_ci: could not init driver for IR device (code %d)\n", error); return error; -- cgit v1.2.3 From 4605664bd94ed94ab65a00bc7c749704304cfd40 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 31 Jan 2010 21:06:10 -0300 Subject: V4L/DVB: dvb-usb: enable specifying a separate generic bulk ctrl response endpoint Some DVB USB devices use a separate endpoint for responses to control messages sent with bulk transfers via the generic_bulk_ctrl_endpoint. When generic_bulk_ctrl_endpoint_response is set, it will be used instead of the generic_bulk_ctrl_endpoint when reading usb responses in the dvb_usb_generic_rw helper function. Signed-off-by: Michael Krufky Reviewed-by: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/dvb-usb-urb.c | 2 ++ drivers/media/dvb/dvb-usb/dvb-usb.h | 7 +++++++ 2 files changed, 9 insertions(+) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-urb.c b/drivers/media/dvb/dvb-usb/dvb-usb-urb.c index 6fe71c6745e..bb46ba6a357 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-urb.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-urb.c @@ -42,6 +42,8 @@ int dvb_usb_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, u8 *rbuf, msleep(delay_ms); ret = usb_bulk_msg(d->udev,usb_rcvbulkpipe(d->udev, + d->props.generic_bulk_ctrl_endpoint_response ? + d->props.generic_bulk_ctrl_endpoint_response : d->props.generic_bulk_ctrl_endpoint),rbuf,rlen,&actlen, 2000); diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h index 0143aef19ec..4a9f676087b 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb.h @@ -198,6 +198,12 @@ struct dvb_usb_adapter_properties { * is non-zero, one can use dvb_usb_generic_rw and dvb_usb_generic_write- * helper functions. * + * @generic_bulk_ctrl_endpoint_response: some DVB USB devices use a separate + * endpoint for responses to control messages sent with bulk transfers via + * the generic_bulk_ctrl_endpoint. When this is non-zero, this will be used + * instead of the generic_bulk_ctrl_endpoint when reading usb responses in + * the dvb_usb_generic_rw helper function. + * * @num_device_descs: number of struct dvb_usb_device_description in @devices * @devices: array of struct dvb_usb_device_description compatibles with these * properties. @@ -239,6 +245,7 @@ struct dvb_usb_device_properties { struct i2c_algorithm *i2c_algo; int generic_bulk_ctrl_endpoint; + int generic_bulk_ctrl_endpoint_response; int num_device_descs; struct dvb_usb_device_description devices[12]; -- cgit v1.2.3 From a82437510256b83671e49a23774c9c5ce0d4ab00 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 24 Mar 2010 09:35:47 -0300 Subject: V4L/DVB: stv0900: Whitespace cleanup Fixes sync with -hg tree Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/stv0900_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/frontends/stv0900_core.c b/drivers/media/dvb/frontends/stv0900_core.c index a3cdca72463..4f5e7d3a0e6 100644 --- a/drivers/media/dvb/frontends/stv0900_core.c +++ b/drivers/media/dvb/frontends/stv0900_core.c @@ -1875,7 +1875,7 @@ static struct dvb_frontend_ops stv0900_ops = { }, .release = stv0900_release, .init = stv0900_init, - .get_frontend = stv0900_get_frontend, + .get_frontend = stv0900_get_frontend, .get_frontend_algo = stv0900_frontend_algo, .i2c_gate_ctrl = stv0900_i2c_gate_ctrl, .diseqc_send_master_cmd = stv0900_send_master_cmd, -- cgit v1.2.3 From d705d2ab7596b4661a2f13172f4f93ad11bd761f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 1 Apr 2010 21:27:04 -0300 Subject: V4L/DVB: ir: use IR_KEYTABLE where an IR table is needed Replaces most of the occurences of IR keytables on V4L drivers by a macro that evaluates to provide the name of the exported symbol. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dm1105/dm1105.c | 2 +- drivers/media/dvb/ttpci/budget-ci.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/dm1105/dm1105.c b/drivers/media/dvb/dm1105/dm1105.c index 3229ff325c5..ff62dc8633c 100644 --- a/drivers/media/dvb/dm1105/dm1105.c +++ b/drivers/media/dvb/dm1105/dm1105.c @@ -596,7 +596,7 @@ static irqreturn_t dm1105_irq(int irq, void *dev_id) int __devinit dm1105_ir_init(struct dm1105_dev *dm1105) { struct input_dev *input_dev; - struct ir_scancode_table *ir_codes = &ir_codes_dm1105_nec_table; + struct ir_scancode_table *ir_codes = &IR_KEYTABLE(dm1105_nec); u64 ir_type = IR_TYPE_OTHER; int err = -ENOMEM; diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index ec89afd3891..75c640e5966 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c @@ -232,7 +232,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci) case 0x1011: case 0x1012: /* The hauppauge keymap is a superset of these remotes */ - ir_codes = &ir_codes_hauppauge_new_table; + ir_codes = &IR_KEYTABLE(hauppauge_new); if (rc5_device < 0) budget_ci->ir.rc5_device = 0x1f; @@ -241,11 +241,11 @@ static int msp430_ir_init(struct budget_ci *budget_ci) case 0x1017: case 0x101a: /* for the Technotrend 1500 bundled remote */ - ir_codes = &ir_codes_tt_1500_table; + ir_codes = &IR_KEYTABLE(tt_1500); break; default: /* unknown remote */ - ir_codes = &ir_codes_budget_ci_old_table; + ir_codes = &IR_KEYTABLE(budget_ci_old); break; } -- cgit v1.2.3 From e27e971c69f87bd6c00c4cff973497de365229ef Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 1 Apr 2010 21:35:32 -0300 Subject: V4L/DVB: rename all *_rc_keys to ir_codes_*_nec_table Several DVB drivers use a different name convention. As we're moving the keytables, we need to use the same convention on all places. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/a800.c | 6 ++-- drivers/media/dvb/dvb-usb/af9005-remote.c | 16 ++++----- drivers/media/dvb/dvb-usb/af9005.c | 8 ++--- drivers/media/dvb/dvb-usb/af9005.h | 4 +-- drivers/media/dvb/dvb-usb/af9015.c | 30 ++++++++-------- drivers/media/dvb/dvb-usb/af9015.h | 18 +++++----- drivers/media/dvb/dvb-usb/anysee.c | 6 ++-- drivers/media/dvb/dvb-usb/az6027.c | 6 ++-- drivers/media/dvb/dvb-usb/cinergyT2-core.c | 6 ++-- drivers/media/dvb/dvb-usb/cxusb.c | 46 ++++++++++++------------ drivers/media/dvb/dvb-usb/dib0700_devices.c | 54 ++++++++++++++--------------- drivers/media/dvb/dvb-usb/dibusb-common.c | 4 +-- drivers/media/dvb/dvb-usb/dibusb-mb.c | 8 ++--- drivers/media/dvb/dvb-usb/dibusb-mc.c | 2 +- drivers/media/dvb/dvb-usb/dibusb.h | 2 +- drivers/media/dvb/dvb-usb/digitv.c | 6 ++-- drivers/media/dvb/dvb-usb/dtt200u.c | 18 +++++----- drivers/media/dvb/dvb-usb/dw2102.c | 44 +++++++++++------------ drivers/media/dvb/dvb-usb/m920x.c | 18 +++++----- drivers/media/dvb/dvb-usb/nova-t-usb2.c | 18 +++++----- drivers/media/dvb/dvb-usb/opera1.c | 16 ++++----- drivers/media/dvb/dvb-usb/vp702x.c | 12 +++---- drivers/media/dvb/dvb-usb/vp7045.c | 12 +++---- 23 files changed, 180 insertions(+), 180 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/dvb-usb/a800.c b/drivers/media/dvb/dvb-usb/a800.c index 6247239982e..b6cbb1dfc5f 100644 --- a/drivers/media/dvb/dvb-usb/a800.c +++ b/drivers/media/dvb/dvb-usb/a800.c @@ -37,7 +37,7 @@ static int a800_identify_state(struct usb_device *udev, struct dvb_usb_device_pr return 0; } -static struct dvb_usb_rc_key a800_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_a800_table[] = { { 0x0201, KEY_PROG1 }, /* SOURCE */ { 0x0200, KEY_POWER }, /* POWER */ { 0x0205, KEY_1 }, /* 1 */ @@ -147,8 +147,8 @@ static struct dvb_usb_device_properties a800_properties = { .identify_state = a800_identify_state, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = a800_rc_keys, - .rc_key_map_size = ARRAY_SIZE(a800_rc_keys), + .rc_key_map = ir_codes_a800_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_a800_table), .rc_query = a800_rc_query, .i2c_algo = &dibusb_i2c_algo, diff --git a/drivers/media/dvb/dvb-usb/af9005-remote.c b/drivers/media/dvb/dvb-usb/af9005-remote.c index f4379c650a1..b41fa873b04 100644 --- a/drivers/media/dvb/dvb-usb/af9005-remote.c +++ b/drivers/media/dvb/dvb-usb/af9005-remote.c @@ -33,7 +33,7 @@ MODULE_PARM_DESC(debug, #define deb_decode(args...) dprintk(dvb_usb_af9005_remote_debug,0x01,args) -struct dvb_usb_rc_key af9005_rc_keys[] = { +struct dvb_usb_rc_key ir_codes_af9005_table[] = { {0x01b7, KEY_POWER}, {0x01a7, KEY_VOLUMEUP}, @@ -74,7 +74,7 @@ struct dvb_usb_rc_key af9005_rc_keys[] = { {0x00d5, KEY_GOTO}, /* marked jump on the remote */ }; -int af9005_rc_keys_size = ARRAY_SIZE(af9005_rc_keys); +int ir_codes_af9005_table_size = ARRAY_SIZE(ir_codes_af9005_table); static int repeatable_keys[] = { KEY_VOLUMEUP, @@ -130,10 +130,10 @@ int af9005_rc_decode(struct dvb_usb_device *d, u8 * data, int len, u32 * event, deb_decode("code != inverted code\n"); return 0; } - for (i = 0; i < af9005_rc_keys_size; i++) { - if (rc5_custom(&af9005_rc_keys[i]) == cust - && rc5_data(&af9005_rc_keys[i]) == dat) { - *event = af9005_rc_keys[i].event; + for (i = 0; i < ir_codes_af9005_table_size; i++) { + if (rc5_custom(&ir_codes_af9005_table[i]) == cust + && rc5_data(&ir_codes_af9005_table[i]) == dat) { + *event = ir_codes_af9005_table[i].event; *state = REMOTE_KEY_PRESSED; deb_decode ("key pressed, event %x\n", *event); @@ -146,8 +146,8 @@ int af9005_rc_decode(struct dvb_usb_device *d, u8 * data, int len, u32 * event, return 0; } -EXPORT_SYMBOL(af9005_rc_keys); -EXPORT_SYMBOL(af9005_rc_keys_size); +EXPORT_SYMBOL(ir_codes_af9005_table); +EXPORT_SYMBOL(ir_codes_af9005_table_size); EXPORT_SYMBOL(af9005_rc_decode); MODULE_AUTHOR("Luca Olivetti "); diff --git a/drivers/media/dvb/dvb-usb/af9005.c b/drivers/media/dvb/dvb-usb/af9005.c index ca5a0a4d2a4..cfd6107d534 100644 --- a/drivers/media/dvb/dvb-usb/af9005.c +++ b/drivers/media/dvb/dvb-usb/af9005.c @@ -1109,8 +1109,8 @@ static int __init af9005_usb_module_init(void) return result; } rc_decode = symbol_request(af9005_rc_decode); - rc_keys = symbol_request(af9005_rc_keys); - rc_keys_size = symbol_request(af9005_rc_keys_size); + rc_keys = symbol_request(ir_codes_af9005_table); + rc_keys_size = symbol_request(ir_codes_af9005_table_size); if (rc_decode == NULL || rc_keys == NULL || rc_keys_size == NULL) { err("af9005_rc_decode function not found, disabling remote"); af9005_properties.rc_query = NULL; @@ -1128,9 +1128,9 @@ static void __exit af9005_usb_module_exit(void) if (rc_decode != NULL) symbol_put(af9005_rc_decode); if (rc_keys != NULL) - symbol_put(af9005_rc_keys); + symbol_put(ir_codes_af9005_table); if (rc_keys_size != NULL) - symbol_put(af9005_rc_keys_size); + symbol_put(ir_codes_af9005_table_size); /* deregister this driver from the USB subsystem */ usb_deregister(&af9005_usb_driver); } diff --git a/drivers/media/dvb/dvb-usb/af9005.h b/drivers/media/dvb/dvb-usb/af9005.h index 0bc48a01218..088e7083a39 100644 --- a/drivers/media/dvb/dvb-usb/af9005.h +++ b/drivers/media/dvb/dvb-usb/af9005.h @@ -3490,7 +3490,7 @@ extern u8 regmask[8]; /* remote control decoder */ extern int af9005_rc_decode(struct dvb_usb_device *d, u8 * data, int len, u32 * event, int *state); -extern struct dvb_usb_rc_key af9005_rc_keys[]; -extern int af9005_rc_keys_size; +extern struct dvb_usb_rc_key ir_codes_af9005_table[]; +extern int ir_codes_af9005_table_size; #endif diff --git a/drivers/media/dvb/dvb-usb/af9015.c b/drivers/media/dvb/dvb-usb/af9015.c index d5ba1de8f07..66c7c3ea799 100644 --- a/drivers/media/dvb/dvb-usb/af9015.c +++ b/drivers/media/dvb/dvb-usb/af9015.c @@ -752,19 +752,19 @@ static const struct af9015_setup *af9015_setup_match(unsigned int id, static const struct af9015_setup af9015_setup_modparam[] = { { AF9015_REMOTE_A_LINK_DTU_M, - af9015_rc_keys_a_link, ARRAY_SIZE(af9015_rc_keys_a_link), + ir_codes_af9015_table_a_link, ARRAY_SIZE(ir_codes_af9015_table_a_link), af9015_ir_table_a_link, ARRAY_SIZE(af9015_ir_table_a_link) }, { AF9015_REMOTE_MSI_DIGIVOX_MINI_II_V3, - af9015_rc_keys_msi, ARRAY_SIZE(af9015_rc_keys_msi), + ir_codes_af9015_table_msi, ARRAY_SIZE(ir_codes_af9015_table_msi), af9015_ir_table_msi, ARRAY_SIZE(af9015_ir_table_msi) }, { AF9015_REMOTE_MYGICTV_U718, - af9015_rc_keys_mygictv, ARRAY_SIZE(af9015_rc_keys_mygictv), + ir_codes_af9015_table_mygictv, ARRAY_SIZE(ir_codes_af9015_table_mygictv), af9015_ir_table_mygictv, ARRAY_SIZE(af9015_ir_table_mygictv) }, { AF9015_REMOTE_DIGITTRADE_DVB_T, - af9015_rc_keys_digittrade, ARRAY_SIZE(af9015_rc_keys_digittrade), + ir_codes_af9015_table_digittrade, ARRAY_SIZE(ir_codes_af9015_table_digittrade), af9015_ir_table_digittrade, ARRAY_SIZE(af9015_ir_table_digittrade) }, { AF9015_REMOTE_AVERMEDIA_KS, - af9015_rc_keys_avermedia, ARRAY_SIZE(af9015_rc_keys_avermedia), + ir_codes_af9015_table_avermedia, ARRAY_SIZE(ir_codes_af9015_table_avermedia), af9015_ir_table_avermedia_ks, ARRAY_SIZE(af9015_ir_table_avermedia_ks) }, { } }; @@ -772,32 +772,32 @@ static const struct af9015_setup af9015_setup_modparam[] = { /* don't add new entries here anymore, use hashes instead */ static const struct af9015_setup af9015_setup_usbids[] = { { USB_VID_LEADTEK, - af9015_rc_keys_leadtek, ARRAY_SIZE(af9015_rc_keys_leadtek), + ir_codes_af9015_table_leadtek, ARRAY_SIZE(ir_codes_af9015_table_leadtek), af9015_ir_table_leadtek, ARRAY_SIZE(af9015_ir_table_leadtek) }, { USB_VID_VISIONPLUS, - af9015_rc_keys_twinhan, ARRAY_SIZE(af9015_rc_keys_twinhan), + ir_codes_af9015_table_twinhan, ARRAY_SIZE(ir_codes_af9015_table_twinhan), af9015_ir_table_twinhan, ARRAY_SIZE(af9015_ir_table_twinhan) }, { USB_VID_KWORLD_2, /* TODO: use correct rc keys */ - af9015_rc_keys_twinhan, ARRAY_SIZE(af9015_rc_keys_twinhan), + ir_codes_af9015_table_twinhan, ARRAY_SIZE(ir_codes_af9015_table_twinhan), af9015_ir_table_kworld, ARRAY_SIZE(af9015_ir_table_kworld) }, { USB_VID_AVERMEDIA, - af9015_rc_keys_avermedia, ARRAY_SIZE(af9015_rc_keys_avermedia), + ir_codes_af9015_table_avermedia, ARRAY_SIZE(ir_codes_af9015_table_avermedia), af9015_ir_table_avermedia, ARRAY_SIZE(af9015_ir_table_avermedia) }, { USB_VID_MSI_2, - af9015_rc_keys_msi_digivox_iii, ARRAY_SIZE(af9015_rc_keys_msi_digivox_iii), + ir_codes_af9015_table_msi_digivox_iii, ARRAY_SIZE(ir_codes_af9015_table_msi_digivox_iii), af9015_ir_table_msi_digivox_iii, ARRAY_SIZE(af9015_ir_table_msi_digivox_iii) }, { } }; static const struct af9015_setup af9015_setup_hashes[] = { { 0xb8feb708, - af9015_rc_keys_msi, ARRAY_SIZE(af9015_rc_keys_msi), + ir_codes_af9015_table_msi, ARRAY_SIZE(ir_codes_af9015_table_msi), af9015_ir_table_msi, ARRAY_SIZE(af9015_ir_table_msi) }, { 0xa3703d00, - af9015_rc_keys_a_link, ARRAY_SIZE(af9015_rc_keys_a_link), + ir_codes_af9015_table_a_link, ARRAY_SIZE(ir_codes_af9015_table_a_link), af9015_ir_table_a_link, ARRAY_SIZE(af9015_ir_table_a_link) }, { 0x9b7dc64e, - af9015_rc_keys_mygictv, ARRAY_SIZE(af9015_rc_keys_mygictv), + ir_codes_af9015_table_mygictv, ARRAY_SIZE(ir_codes_af9015_table_mygictv), af9015_ir_table_mygictv, ARRAY_SIZE(af9015_ir_table_mygictv) }, { } }; @@ -836,8 +836,8 @@ static void af9015_set_remote_config(struct usb_device *udev, } else if (udev->descriptor.idProduct == cpu_to_le16(USB_PID_TREKSTOR_DVBT)) { table = &(const struct af9015_setup){ 0, - af9015_rc_keys_trekstor, - ARRAY_SIZE(af9015_rc_keys_trekstor), + ir_codes_af9015_table_trekstor, + ARRAY_SIZE(ir_codes_af9015_table_trekstor), af9015_ir_table_trekstor, ARRAY_SIZE(af9015_ir_table_trekstor) }; diff --git a/drivers/media/dvb/dvb-usb/af9015.h b/drivers/media/dvb/dvb-usb/af9015.h index ef36b183149..63b2a4907b7 100644 --- a/drivers/media/dvb/dvb-usb/af9015.h +++ b/drivers/media/dvb/dvb-usb/af9015.h @@ -123,7 +123,7 @@ enum af9015_remote { /* LeadTek - Y04G0051 */ /* Leadtek WinFast DTV Dongle Gold */ -static struct dvb_usb_rc_key af9015_rc_keys_leadtek[] = { +static struct dvb_usb_rc_key ir_codes_af9015_table_leadtek[] = { { 0x001e, KEY_1 }, { 0x001f, KEY_2 }, { 0x0020, KEY_3 }, @@ -227,7 +227,7 @@ static u8 af9015_ir_table_leadtek[] = { }; /* TwinHan AzureWave AD-TU700(704J) */ -static struct dvb_usb_rc_key af9015_rc_keys_twinhan[] = { +static struct dvb_usb_rc_key ir_codes_af9015_table_twinhan[] = { { 0x053f, KEY_POWER }, { 0x0019, KEY_FAVORITES }, /* Favorite List */ { 0x0004, KEY_TEXT }, /* Teletext */ @@ -338,7 +338,7 @@ static u8 af9015_ir_table_twinhan[] = { }; /* A-Link DTU(m) */ -static struct dvb_usb_rc_key af9015_rc_keys_a_link[] = { +static struct dvb_usb_rc_key ir_codes_af9015_table_a_link[] = { { 0x001e, KEY_1 }, { 0x001f, KEY_2 }, { 0x0020, KEY_3 }, @@ -381,7 +381,7 @@ static u8 af9015_ir_table_a_link[] = { }; /* MSI DIGIVOX mini II V3.0 */ -static struct dvb_usb_rc_key af9015_rc_keys_msi[] = { +static struct dvb_usb_rc_key ir_codes_af9015_table_msi[] = { { 0x001e, KEY_1 }, { 0x001f, KEY_2 }, { 0x0020, KEY_3 }, @@ -424,7 +424,7 @@ static u8 af9015_ir_table_msi[] = { }; /* MYGICTV U718 */ -static struct dvb_usb_rc_key af9015_rc_keys_mygictv[] = { +static struct dvb_usb_rc_key ir_codes_af9015_table_mygictv[] = { { 0x003d, KEY_SWITCHVIDEOMODE }, /* TV / AV */ { 0x0545, KEY_POWER }, @@ -550,7 +550,7 @@ static u8 af9015_ir_table_kworld[] = { }; /* AverMedia Volar X */ -static struct dvb_usb_rc_key af9015_rc_keys_avermedia[] = { +static struct dvb_usb_rc_key ir_codes_af9015_table_avermedia[] = { { 0x053d, KEY_PROG1 }, /* SOURCE */ { 0x0512, KEY_POWER }, /* POWER */ { 0x051e, KEY_1 }, /* 1 */ @@ -656,7 +656,7 @@ static u8 af9015_ir_table_avermedia_ks[] = { }; /* Digittrade DVB-T USB Stick */ -static struct dvb_usb_rc_key af9015_rc_keys_digittrade[] = { +static struct dvb_usb_rc_key ir_codes_af9015_table_digittrade[] = { { 0x010f, KEY_LAST }, /* RETURN */ { 0x0517, KEY_TEXT }, /* TELETEXT */ { 0x0108, KEY_EPG }, /* EPG */ @@ -719,7 +719,7 @@ static u8 af9015_ir_table_digittrade[] = { }; /* TREKSTOR DVB-T USB Stick */ -static struct dvb_usb_rc_key af9015_rc_keys_trekstor[] = { +static struct dvb_usb_rc_key ir_codes_af9015_table_trekstor[] = { { 0x0704, KEY_AGAIN }, /* Home */ { 0x0705, KEY_MUTE }, /* Mute */ { 0x0706, KEY_UP }, /* Up */ @@ -782,7 +782,7 @@ static u8 af9015_ir_table_trekstor[] = { }; /* MSI DIGIVOX mini III */ -static struct dvb_usb_rc_key af9015_rc_keys_msi_digivox_iii[] = { +static struct dvb_usb_rc_key ir_codes_af9015_table_msi_digivox_iii[] = { { 0x0713, KEY_POWER }, /* [red power button] */ { 0x073b, KEY_VIDEO }, /* Source */ { 0x073e, KEY_ZOOM }, /* Zoom */ diff --git a/drivers/media/dvb/dvb-usb/anysee.c b/drivers/media/dvb/dvb-usb/anysee.c index bb69f3719f9..faca1ad88a6 100644 --- a/drivers/media/dvb/dvb-usb/anysee.c +++ b/drivers/media/dvb/dvb-usb/anysee.c @@ -399,7 +399,7 @@ static int anysee_rc_query(struct dvb_usb_device *d, u32 *event, int *state) return 0; } -static struct dvb_usb_rc_key anysee_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_anysee_table[] = { { 0x0100, KEY_0 }, { 0x0101, KEY_1 }, { 0x0102, KEY_2 }, @@ -518,8 +518,8 @@ static struct dvb_usb_device_properties anysee_properties = { } }, - .rc_key_map = anysee_rc_keys, - .rc_key_map_size = ARRAY_SIZE(anysee_rc_keys), + .rc_key_map = ir_codes_anysee_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_anysee_table), .rc_query = anysee_rc_query, .rc_interval = 200, /* windows driver uses 500ms */ diff --git a/drivers/media/dvb/dvb-usb/az6027.c b/drivers/media/dvb/dvb-usb/az6027.c index 30ea3eff1ef..8934788bd83 100644 --- a/drivers/media/dvb/dvb-usb/az6027.c +++ b/drivers/media/dvb/dvb-usb/az6027.c @@ -386,7 +386,7 @@ static int az6027_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) } /* keys for the enclosed remote control */ -static struct dvb_usb_rc_key az6027_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_az6027_table[] = { { 0x01, KEY_1 }, { 0x02, KEY_2 }, }; @@ -1096,8 +1096,8 @@ static struct dvb_usb_device_properties az6027_properties = { .power_ctrl = az6027_power_ctrl, .read_mac_address = az6027_read_mac_addr, */ - .rc_key_map = az6027_rc_keys, - .rc_key_map_size = ARRAY_SIZE(az6027_rc_keys), + .rc_key_map = ir_codes_az6027_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_az6027_table), .rc_interval = 400, .rc_query = az6027_rc_query, .i2c_algo = &az6027_i2c_algo, diff --git a/drivers/media/dvb/dvb-usb/cinergyT2-core.c b/drivers/media/dvb/dvb-usb/cinergyT2-core.c index e37ac4d4860..5a9c14bdc98 100644 --- a/drivers/media/dvb/dvb-usb/cinergyT2-core.c +++ b/drivers/media/dvb/dvb-usb/cinergyT2-core.c @@ -84,7 +84,7 @@ static int cinergyt2_frontend_attach(struct dvb_usb_adapter *adap) return 0; } -static struct dvb_usb_rc_key cinergyt2_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_cinergyt2_table[] = { { 0x0401, KEY_POWER }, { 0x0402, KEY_1 }, { 0x0403, KEY_2 }, @@ -218,8 +218,8 @@ static struct dvb_usb_device_properties cinergyt2_properties = { .power_ctrl = cinergyt2_power_ctrl, .rc_interval = 50, - .rc_key_map = cinergyt2_rc_keys, - .rc_key_map_size = ARRAY_SIZE(cinergyt2_rc_keys), + .rc_key_map = ir_codes_cinergyt2_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_cinergyt2_table), .rc_query = cinergyt2_rc_query, .generic_bulk_ctrl_endpoint = 1, diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index 960376da7d5..33a83f93e7c 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c @@ -461,7 +461,7 @@ static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d, u32 *event, return 0; } -static struct dvb_usb_rc_key dvico_mce_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_dvico_mce_table[] = { { 0xfe02, KEY_TV }, { 0xfe0e, KEY_MP3 }, { 0xfe1a, KEY_DVD }, @@ -509,7 +509,7 @@ static struct dvb_usb_rc_key dvico_mce_rc_keys[] = { { 0xfe4e, KEY_POWER }, }; -static struct dvb_usb_rc_key dvico_portable_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_dvico_portable_table[] = { { 0xfc02, KEY_SETUP }, /* Profile */ { 0xfc43, KEY_POWER2 }, { 0xfc06, KEY_EPG }, @@ -548,7 +548,7 @@ static struct dvb_usb_rc_key dvico_portable_rc_keys[] = { { 0xfc00, KEY_UNKNOWN }, /* HD */ }; -static struct dvb_usb_rc_key d680_dmb_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_d680_dmb_table[] = { { 0x0038, KEY_UNKNOWN }, /* TV/AV */ { 0x080c, KEY_ZOOM }, { 0x0800, KEY_0 }, @@ -1449,8 +1449,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties = { .i2c_algo = &cxusb_i2c_algo, .rc_interval = 100, - .rc_key_map = dvico_portable_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys), + .rc_key_map = ir_codes_dvico_portable_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), .rc_query = cxusb_rc_query, .generic_bulk_ctrl_endpoint = 0x01, @@ -1500,8 +1500,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties = { .i2c_algo = &cxusb_i2c_algo, .rc_interval = 150, - .rc_key_map = dvico_mce_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dvico_mce_rc_keys), + .rc_key_map = ir_codes_dvico_mce_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_mce_table), .rc_query = cxusb_rc_query, .generic_bulk_ctrl_endpoint = 0x01, @@ -1559,8 +1559,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = { .i2c_algo = &cxusb_i2c_algo, .rc_interval = 100, - .rc_key_map = dvico_portable_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys), + .rc_key_map = ir_codes_dvico_portable_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), .rc_query = cxusb_rc_query, .generic_bulk_ctrl_endpoint = 0x01, @@ -1609,8 +1609,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = { .i2c_algo = &cxusb_i2c_algo, .rc_interval = 100, - .rc_key_map = dvico_portable_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys), + .rc_key_map = ir_codes_dvico_portable_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), .rc_query = cxusb_rc_query, .generic_bulk_ctrl_endpoint = 0x01, @@ -1658,8 +1658,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties = { .generic_bulk_ctrl_endpoint = 0x01, .rc_interval = 100, - .rc_key_map = dvico_mce_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dvico_mce_rc_keys), + .rc_key_map = ir_codes_dvico_mce_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_mce_table), .rc_query = cxusb_bluebird2_rc_query, .num_device_descs = 1, @@ -1706,8 +1706,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties = { .generic_bulk_ctrl_endpoint = 0x01, .rc_interval = 100, - .rc_key_map = dvico_portable_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys), + .rc_key_map = ir_codes_dvico_portable_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), .rc_query = cxusb_bluebird2_rc_query, .num_device_descs = 1, @@ -1756,8 +1756,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_prope .generic_bulk_ctrl_endpoint = 0x01, .rc_interval = 100, - .rc_key_map = dvico_portable_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys), + .rc_key_map = ir_codes_dvico_portable_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), .rc_query = cxusb_rc_query, .num_device_descs = 1, @@ -1847,8 +1847,8 @@ struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties = { .generic_bulk_ctrl_endpoint = 0x01, .rc_interval = 100, - .rc_key_map = dvico_mce_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dvico_mce_rc_keys), + .rc_key_map = ir_codes_dvico_mce_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_mce_table), .rc_query = cxusb_rc_query, .num_device_descs = 1, @@ -1895,8 +1895,8 @@ static struct dvb_usb_device_properties cxusb_d680_dmb_properties = { .generic_bulk_ctrl_endpoint = 0x01, .rc_interval = 100, - .rc_key_map = d680_dmb_rc_keys, - .rc_key_map_size = ARRAY_SIZE(d680_dmb_rc_keys), + .rc_key_map = ir_codes_d680_dmb_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_d680_dmb_table), .rc_query = cxusb_d680_dmb_rc_query, .num_device_descs = 1, @@ -1944,8 +1944,8 @@ static struct dvb_usb_device_properties cxusb_mygica_d689_properties = { .generic_bulk_ctrl_endpoint = 0x01, .rc_interval = 100, - .rc_key_map = d680_dmb_rc_keys, - .rc_key_map_size = ARRAY_SIZE(d680_dmb_rc_keys), + .rc_key_map = ir_codes_d680_dmb_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_d680_dmb_table), .rc_query = cxusb_d680_dmb_rc_query, .num_device_descs = 1, diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index 34eab05afc6..2deca210d5a 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c @@ -562,7 +562,7 @@ static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state) return 0; } -static struct dvb_usb_rc_key dib0700_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_dib0700_table[] = { /* Key codes for the tiny Pinnacle remote*/ { 0x0700, KEY_MUTE }, { 0x0701, KEY_MENU }, /* Pinnacle logo */ @@ -2131,8 +2131,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { }, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dib0700_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_key_map = ir_codes_dib0700_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), .rc_query = dib0700_rc_query }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2160,8 +2160,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { }, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dib0700_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_key_map = ir_codes_dib0700_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), .rc_query = dib0700_rc_query }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2214,8 +2214,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { }, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dib0700_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_key_map = ir_codes_dib0700_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), .rc_query = dib0700_rc_query }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2251,8 +2251,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { }, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dib0700_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_key_map = ir_codes_dib0700_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), .rc_query = dib0700_rc_query }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2321,8 +2321,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { }, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dib0700_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_key_map = ir_codes_dib0700_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), .rc_query = dib0700_rc_query }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2360,8 +2360,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { }, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dib0700_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_key_map = ir_codes_dib0700_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), .rc_query = dib0700_rc_query }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2422,8 +2422,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { } }, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dib0700_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_key_map = ir_codes_dib0700_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), .rc_query = dib0700_rc_query }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2484,8 +2484,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { }, }, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dib0700_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_key_map = ir_codes_dib0700_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), .rc_query = dib0700_rc_query }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, .num_adapters = 1, @@ -2513,8 +2513,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { }, }, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dib0700_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_key_map = ir_codes_dib0700_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), .rc_query = dib0700_rc_query }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, .num_adapters = 1, @@ -2574,8 +2574,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { }, }, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dib0700_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_key_map = ir_codes_dib0700_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), .rc_query = dib0700_rc_query }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, .num_adapters = 1, @@ -2612,8 +2612,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { }, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dib0700_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_key_map = ir_codes_dib0700_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), .rc_query = dib0700_rc_query }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2656,8 +2656,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { }, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dib0700_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_key_map = ir_codes_dib0700_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), .rc_query = dib0700_rc_query }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, .num_adapters = 1, @@ -2687,8 +2687,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { }, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dib0700_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_key_map = ir_codes_dib0700_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), .rc_query = dib0700_rc_query }, }; diff --git a/drivers/media/dvb/dvb-usb/dibusb-common.c b/drivers/media/dvb/dvb-usb/dibusb-common.c index 9143b5631e8..bc08bc0b723 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-common.c +++ b/drivers/media/dvb/dvb-usb/dibusb-common.c @@ -327,7 +327,7 @@ EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach); /* * common remote control stuff */ -struct dvb_usb_rc_key dibusb_rc_keys[] = { +struct dvb_usb_rc_key ir_codes_dibusb_table[] = { /* Key codes for the little Artec T1/Twinhan/HAMA/ remote. */ { 0x0016, KEY_POWER }, { 0x0010, KEY_MUTE }, @@ -456,7 +456,7 @@ struct dvb_usb_rc_key dibusb_rc_keys[] = { { 0x804e, KEY_ENTER }, { 0x804f, KEY_VOLUMEDOWN }, }; -EXPORT_SYMBOL(dibusb_rc_keys); +EXPORT_SYMBOL(ir_codes_dibusb_table); int dibusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) { diff --git a/drivers/media/dvb/dvb-usb/dibusb-mb.c b/drivers/media/dvb/dvb-usb/dibusb-mb.c index 5c0126dc1ff..eb2e6f050fb 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-mb.c +++ b/drivers/media/dvb/dvb-usb/dibusb-mb.c @@ -212,7 +212,7 @@ static struct dvb_usb_device_properties dibusb1_1_properties = { .power_ctrl = dibusb_power_ctrl, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dibusb_rc_keys, + .rc_key_map = ir_codes_dibusb_table, .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ .rc_query = dibusb_rc_query, @@ -296,7 +296,7 @@ static struct dvb_usb_device_properties dibusb1_1_an2235_properties = { .power_ctrl = dibusb_power_ctrl, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dibusb_rc_keys, + .rc_key_map = ir_codes_dibusb_table, .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ .rc_query = dibusb_rc_query, @@ -360,7 +360,7 @@ static struct dvb_usb_device_properties dibusb2_0b_properties = { .power_ctrl = dibusb2_0_power_ctrl, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dibusb_rc_keys, + .rc_key_map = ir_codes_dibusb_table, .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ .rc_query = dibusb_rc_query, @@ -417,7 +417,7 @@ static struct dvb_usb_device_properties artec_t1_usb2_properties = { .power_ctrl = dibusb2_0_power_ctrl, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dibusb_rc_keys, + .rc_key_map = ir_codes_dibusb_table, .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ .rc_query = dibusb_rc_query, diff --git a/drivers/media/dvb/dvb-usb/dibusb-mc.c b/drivers/media/dvb/dvb-usb/dibusb-mc.c index a05b9f87566..588308eb663 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-mc.c +++ b/drivers/media/dvb/dvb-usb/dibusb-mc.c @@ -82,7 +82,7 @@ static struct dvb_usb_device_properties dibusb_mc_properties = { .power_ctrl = dibusb2_0_power_ctrl, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dibusb_rc_keys, + .rc_key_map = ir_codes_dibusb_table, .rc_key_map_size = 111, /* FIXME */ .rc_query = dibusb_rc_query, diff --git a/drivers/media/dvb/dvb-usb/dibusb.h b/drivers/media/dvb/dvb-usb/dibusb.h index 8e847aa73ba..3d50ac59088 100644 --- a/drivers/media/dvb/dvb-usb/dibusb.h +++ b/drivers/media/dvb/dvb-usb/dibusb.h @@ -124,7 +124,7 @@ extern int dibusb2_0_power_ctrl(struct dvb_usb_device *, int); #define DEFAULT_RC_INTERVAL 150 //#define DEFAULT_RC_INTERVAL 100000 -extern struct dvb_usb_rc_key dibusb_rc_keys[]; +extern struct dvb_usb_rc_key ir_codes_dibusb_table[]; extern int dibusb_rc_query(struct dvb_usb_device *, u32 *, int *); extern int dibusb_read_eeprom_byte(struct dvb_usb_device *, u8, u8 *); diff --git a/drivers/media/dvb/dvb-usb/digitv.c b/drivers/media/dvb/dvb-usb/digitv.c index 955147d0075..e826077094f 100644 --- a/drivers/media/dvb/dvb-usb/digitv.c +++ b/drivers/media/dvb/dvb-usb/digitv.c @@ -161,7 +161,7 @@ static int digitv_tuner_attach(struct dvb_usb_adapter *adap) return 0; } -static struct dvb_usb_rc_key digitv_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_digitv_table[] = { { 0x5f55, KEY_0 }, { 0x6f55, KEY_1 }, { 0x9f55, KEY_2 }, @@ -311,8 +311,8 @@ static struct dvb_usb_device_properties digitv_properties = { .identify_state = digitv_identify_state, .rc_interval = 1000, - .rc_key_map = digitv_rc_keys, - .rc_key_map_size = ARRAY_SIZE(digitv_rc_keys), + .rc_key_map = ir_codes_digitv_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_digitv_table), .rc_query = digitv_rc_query, .i2c_algo = &digitv_i2c_algo, diff --git a/drivers/media/dvb/dvb-usb/dtt200u.c b/drivers/media/dvb/dvb-usb/dtt200u.c index a1b12b01cbe..f57e59044d4 100644 --- a/drivers/media/dvb/dvb-usb/dtt200u.c +++ b/drivers/media/dvb/dvb-usb/dtt200u.c @@ -57,7 +57,7 @@ static int dtt200u_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, /* remote control */ /* key list for the tiny remote control (Yakumo, don't know about the others) */ -static struct dvb_usb_rc_key dtt200u_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_dtt200u_table[] = { { 0x8001, KEY_MUTE }, { 0x8002, KEY_CHANNELDOWN }, { 0x8003, KEY_VOLUMEDOWN }, @@ -162,8 +162,8 @@ static struct dvb_usb_device_properties dtt200u_properties = { .power_ctrl = dtt200u_power_ctrl, .rc_interval = 300, - .rc_key_map = dtt200u_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys), + .rc_key_map = ir_codes_dtt200u_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dtt200u_table), .rc_query = dtt200u_rc_query, .generic_bulk_ctrl_endpoint = 0x01, @@ -207,8 +207,8 @@ static struct dvb_usb_device_properties wt220u_properties = { .power_ctrl = dtt200u_power_ctrl, .rc_interval = 300, - .rc_key_map = dtt200u_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys), + .rc_key_map = ir_codes_dtt200u_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dtt200u_table), .rc_query = dtt200u_rc_query, .generic_bulk_ctrl_endpoint = 0x01, @@ -252,8 +252,8 @@ static struct dvb_usb_device_properties wt220u_fc_properties = { .power_ctrl = dtt200u_power_ctrl, .rc_interval = 300, - .rc_key_map = dtt200u_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys), + .rc_key_map = ir_codes_dtt200u_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dtt200u_table), .rc_query = dtt200u_rc_query, .generic_bulk_ctrl_endpoint = 0x01, @@ -297,8 +297,8 @@ static struct dvb_usb_device_properties wt220u_zl0353_properties = { .power_ctrl = dtt200u_power_ctrl, .rc_interval = 300, - .rc_key_map = dtt200u_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys), + .rc_key_map = ir_codes_dtt200u_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dtt200u_table), .rc_query = dtt200u_rc_query, .generic_bulk_ctrl_endpoint = 0x01, diff --git a/drivers/media/dvb/dvb-usb/dw2102.c b/drivers/media/dvb/dvb-usb/dw2102.c index accc65509b0..e8fb8538067 100644 --- a/drivers/media/dvb/dvb-usb/dw2102.c +++ b/drivers/media/dvb/dvb-usb/dw2102.c @@ -73,7 +73,7 @@ "Please see linux/Documentation/dvb/ for more details " \ "on firmware-problems." -struct dvb_usb_rc_keys_table { +struct ir_codes_dvb_usb_table_table { struct dvb_usb_rc_key *rc_keys; int rc_keys_size; }; @@ -948,7 +948,7 @@ static int dw3101_tuner_attach(struct dvb_usb_adapter *adap) return 0; } -static struct dvb_usb_rc_key dw210x_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_dw210x_table[] = { { 0xf80a, KEY_Q }, /*power*/ { 0xf80c, KEY_M }, /*mute*/ { 0xf811, KEY_1 }, @@ -982,7 +982,7 @@ static struct dvb_usb_rc_key dw210x_rc_keys[] = { { 0xf81b, KEY_B }, /*recall*/ }; -static struct dvb_usb_rc_key tevii_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_tevii_table[] = { { 0xf80a, KEY_POWER }, { 0xf80c, KEY_MUTE }, { 0xf811, KEY_1 }, @@ -1032,7 +1032,7 @@ static struct dvb_usb_rc_key tevii_rc_keys[] = { { 0xf858, KEY_SWITCHVIDEOMODE }, }; -static struct dvb_usb_rc_key tbs_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_tbs_table[] = { { 0xf884, KEY_POWER }, { 0xf894, KEY_MUTE }, { 0xf887, KEY_1 }, @@ -1067,10 +1067,10 @@ static struct dvb_usb_rc_key tbs_rc_keys[] = { { 0xf89b, KEY_MODE } }; -static struct dvb_usb_rc_keys_table keys_tables[] = { - { dw210x_rc_keys, ARRAY_SIZE(dw210x_rc_keys) }, - { tevii_rc_keys, ARRAY_SIZE(tevii_rc_keys) }, - { tbs_rc_keys, ARRAY_SIZE(tbs_rc_keys) }, +static struct ir_codes_dvb_usb_table_table keys_tables[] = { + { ir_codes_dw210x_table, ARRAY_SIZE(ir_codes_dw210x_table) }, + { ir_codes_tevii_table, ARRAY_SIZE(ir_codes_tevii_table) }, + { ir_codes_tbs_table, ARRAY_SIZE(ir_codes_tbs_table) }, }; static int dw2102_rc_query(struct dvb_usb_device *d, u32 *event, int *state) @@ -1185,14 +1185,14 @@ static int dw2102_load_firmware(struct usb_device *dev, /* init registers */ switch (dev->descriptor.idProduct) { case USB_PID_PROF_1100: - s6x0_properties.rc_key_map = tbs_rc_keys; + s6x0_properties.rc_key_map = ir_codes_tbs_table; s6x0_properties.rc_key_map_size = - ARRAY_SIZE(tbs_rc_keys); + ARRAY_SIZE(ir_codes_tbs_table); break; case USB_PID_TEVII_S650: - dw2104_properties.rc_key_map = tevii_rc_keys; + dw2104_properties.rc_key_map = ir_codes_tevii_table; dw2104_properties.rc_key_map_size = - ARRAY_SIZE(tevii_rc_keys); + ARRAY_SIZE(ir_codes_tevii_table); case USB_PID_DW2104: reset = 1; dw210x_op_rw(dev, 0xc4, 0x0000, 0, &reset, 1, @@ -1255,8 +1255,8 @@ static struct dvb_usb_device_properties dw2102_properties = { .no_reconnect = 1, .i2c_algo = &dw2102_serit_i2c_algo, - .rc_key_map = dw210x_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dw210x_rc_keys), + .rc_key_map = ir_codes_dw210x_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dw210x_table), .rc_interval = 150, .rc_query = dw2102_rc_query, @@ -1306,8 +1306,8 @@ static struct dvb_usb_device_properties dw2104_properties = { .no_reconnect = 1, .i2c_algo = &dw2104_i2c_algo, - .rc_key_map = dw210x_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dw210x_rc_keys), + .rc_key_map = ir_codes_dw210x_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dw210x_table), .rc_interval = 150, .rc_query = dw2102_rc_query, @@ -1353,8 +1353,8 @@ static struct dvb_usb_device_properties dw3101_properties = { .no_reconnect = 1, .i2c_algo = &dw3101_i2c_algo, - .rc_key_map = dw210x_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dw210x_rc_keys), + .rc_key_map = ir_codes_dw210x_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dw210x_table), .rc_interval = 150, .rc_query = dw2102_rc_query, @@ -1396,8 +1396,8 @@ static struct dvb_usb_device_properties s6x0_properties = { .no_reconnect = 1, .i2c_algo = &s6x0_i2c_algo, - .rc_key_map = tevii_rc_keys, - .rc_key_map_size = ARRAY_SIZE(tevii_rc_keys), + .rc_key_map = ir_codes_tevii_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_tevii_table), .rc_interval = 150, .rc_query = dw2102_rc_query, @@ -1459,8 +1459,8 @@ static int dw2102_probe(struct usb_interface *intf, /* fill only different fields */ p7500->firmware = "dvb-usb-p7500.fw"; p7500->devices[0] = d7500; - p7500->rc_key_map = tbs_rc_keys; - p7500->rc_key_map_size = ARRAY_SIZE(tbs_rc_keys); + p7500->rc_key_map = ir_codes_tbs_table; + p7500->rc_key_map_size = ARRAY_SIZE(ir_codes_tbs_table); p7500->adapter->frontend_attach = prof_7500_frontend_attach; if (0 == dvb_usb_device_init(intf, &dw2102_properties, diff --git a/drivers/media/dvb/dvb-usb/m920x.c b/drivers/media/dvb/dvb-usb/m920x.c index 737ffa36ac9..c211fef45fc 100644 --- a/drivers/media/dvb/dvb-usb/m920x.c +++ b/drivers/media/dvb/dvb-usb/m920x.c @@ -589,7 +589,7 @@ static struct m920x_inits pinnacle310e_init[] = { }; /* ir keymaps */ -static struct dvb_usb_rc_key megasky_rc_keys [] = { +static struct dvb_usb_rc_key ir_codes_megasky_table [] = { { 0x0012, KEY_POWER }, { 0x001e, KEY_CYCLEWINDOWS }, /* min/max */ { 0x0002, KEY_CHANNELUP }, @@ -608,7 +608,7 @@ static struct dvb_usb_rc_key megasky_rc_keys [] = { { 0x000e, KEY_COFFEE }, /* "MTS" */ }; -static struct dvb_usb_rc_key tvwalkertwin_rc_keys [] = { +static struct dvb_usb_rc_key ir_codes_tvwalkertwin_table [] = { { 0x0001, KEY_ZOOM }, /* Full Screen */ { 0x0002, KEY_CAMERA }, /* snapshot */ { 0x0003, KEY_MUTE }, @@ -628,7 +628,7 @@ static struct dvb_usb_rc_key tvwalkertwin_rc_keys [] = { { 0x001e, KEY_VOLUMEUP }, }; -static struct dvb_usb_rc_key pinnacle310e_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_pinnacle310e_table[] = { { 0x16, KEY_POWER }, { 0x17, KEY_FAVORITES }, { 0x0f, KEY_TEXT }, @@ -785,8 +785,8 @@ static struct dvb_usb_device_properties megasky_properties = { .download_firmware = m920x_firmware_download, .rc_interval = 100, - .rc_key_map = megasky_rc_keys, - .rc_key_map_size = ARRAY_SIZE(megasky_rc_keys), + .rc_key_map = ir_codes_megasky_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_megasky_table), .rc_query = m920x_rc_query, .size_of_priv = sizeof(struct m920x_state), @@ -886,8 +886,8 @@ static struct dvb_usb_device_properties tvwalkertwin_properties = { .download_firmware = m920x_firmware_download, .rc_interval = 100, - .rc_key_map = tvwalkertwin_rc_keys, - .rc_key_map_size = ARRAY_SIZE(tvwalkertwin_rc_keys), + .rc_key_map = ir_codes_tvwalkertwin_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_tvwalkertwin_table), .rc_query = m920x_rc_query, .size_of_priv = sizeof(struct m920x_state), @@ -993,8 +993,8 @@ static struct dvb_usb_device_properties pinnacle_pctv310e_properties = { .download_firmware = NULL, .rc_interval = 100, - .rc_key_map = pinnacle310e_rc_keys, - .rc_key_map_size = ARRAY_SIZE(pinnacle310e_rc_keys), + .rc_key_map = ir_codes_pinnacle310e_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_pinnacle310e_table), .rc_query = m920x_rc_query, .size_of_priv = sizeof(struct m920x_state), diff --git a/drivers/media/dvb/dvb-usb/nova-t-usb2.c b/drivers/media/dvb/dvb-usb/nova-t-usb2.c index b41d66ef832..d195a587cc6 100644 --- a/drivers/media/dvb/dvb-usb/nova-t-usb2.c +++ b/drivers/media/dvb/dvb-usb/nova-t-usb2.c @@ -21,7 +21,7 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); #define deb_ee(args...) dprintk(debug,0x02,args) /* Hauppauge NOVA-T USB2 keys */ -static struct dvb_usb_rc_key haupp_rc_keys [] = { +static struct dvb_usb_rc_key ir_codes_haupp_table [] = { { 0x1e00, KEY_0 }, { 0x1e01, KEY_1 }, { 0x1e02, KEY_2 }, @@ -91,14 +91,14 @@ static int nova_t_rc_query(struct dvb_usb_device *d, u32 *event, int *state) deb_rc("raw key code 0x%02x, 0x%02x, 0x%02x to c: %02x d: %02x toggle: %d\n",key[1],key[2],key[3],custom,data,toggle); - for (i = 0; i < ARRAY_SIZE(haupp_rc_keys); i++) { - if (rc5_data(&haupp_rc_keys[i]) == data && - rc5_custom(&haupp_rc_keys[i]) == custom) { + for (i = 0; i < ARRAY_SIZE(ir_codes_haupp_table); i++) { + if (rc5_data(&ir_codes_haupp_table[i]) == data && + rc5_custom(&ir_codes_haupp_table[i]) == custom) { - deb_rc("c: %x, d: %x\n", rc5_data(&haupp_rc_keys[i]), - rc5_custom(&haupp_rc_keys[i])); + deb_rc("c: %x, d: %x\n", rc5_data(&ir_codes_haupp_table[i]), + rc5_custom(&ir_codes_haupp_table[i])); - *event = haupp_rc_keys[i].event; + *event = ir_codes_haupp_table[i].event; *state = REMOTE_KEY_PRESSED; if (st->old_toggle == toggle) { if (st->last_repeat_count++ < 2) @@ -196,8 +196,8 @@ static struct dvb_usb_device_properties nova_t_properties = { .read_mac_address = nova_t_read_mac_address, .rc_interval = 100, - .rc_key_map = haupp_rc_keys, - .rc_key_map_size = ARRAY_SIZE(haupp_rc_keys), + .rc_key_map = ir_codes_haupp_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_haupp_table), .rc_query = nova_t_rc_query, .i2c_algo = &dibusb_i2c_algo, diff --git a/drivers/media/dvb/dvb-usb/opera1.c b/drivers/media/dvb/dvb-usb/opera1.c index 830557696ae..dfb81ff1d9a 100644 --- a/drivers/media/dvb/dvb-usb/opera1.c +++ b/drivers/media/dvb/dvb-usb/opera1.c @@ -35,7 +35,7 @@ struct opera1_state { u32 last_key_pressed; }; -struct opera_rc_keys { +struct ir_codes_opera_table { u32 keycode; u32 event; }; @@ -331,7 +331,7 @@ static int opera1_pid_filter_control(struct dvb_usb_adapter *adap, int onoff) return 0; } -static struct dvb_usb_rc_key opera1_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_opera1_table[] = { {0x5fa0, KEY_1}, {0x51af, KEY_2}, {0x5da2, KEY_3}, @@ -404,12 +404,12 @@ static int opera1_rc_query(struct dvb_usb_device *dev, u32 * event, int *state) send_key = (send_key & 0xffff) | 0x0100; - for (i = 0; i < ARRAY_SIZE(opera1_rc_keys); i++) { - if (rc5_scan(&opera1_rc_keys[i]) == (send_key & 0xffff)) { + for (i = 0; i < ARRAY_SIZE(ir_codes_opera1_table); i++) { + if (rc5_scan(&ir_codes_opera1_table[i]) == (send_key & 0xffff)) { *state = REMOTE_KEY_PRESSED; - *event = opera1_rc_keys[i].event; + *event = ir_codes_opera1_table[i].event; opst->last_key_pressed = - opera1_rc_keys[i].event; + ir_codes_opera1_table[i].event; break; } opst->last_key_pressed = 0; @@ -498,8 +498,8 @@ static struct dvb_usb_device_properties opera1_properties = { .power_ctrl = opera1_power_ctrl, .i2c_algo = &opera1_i2c_algo, - .rc_key_map = opera1_rc_keys, - .rc_key_map_size = ARRAY_SIZE(opera1_rc_keys), + .rc_key_map = ir_codes_opera1_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_opera1_table), .rc_interval = 200, .rc_query = opera1_rc_query, .read_mac_address = opera1_read_mac_address, diff --git a/drivers/media/dvb/dvb-usb/vp702x.c b/drivers/media/dvb/dvb-usb/vp702x.c index ef4e37d9c5f..4d332451653 100644 --- a/drivers/media/dvb/dvb-usb/vp702x.c +++ b/drivers/media/dvb/dvb-usb/vp702x.c @@ -174,7 +174,7 @@ static int vp702x_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) } /* keys for the enclosed remote control */ -static struct dvb_usb_rc_key vp702x_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_vp702x_table[] = { { 0x0001, KEY_1 }, { 0x0002, KEY_2 }, }; @@ -197,10 +197,10 @@ static int vp702x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) return 0; } - for (i = 0; i < ARRAY_SIZE(vp702x_rc_keys); i++) - if (rc5_custom(&vp702x_rc_keys[i]) == key[1]) { + for (i = 0; i < ARRAY_SIZE(ir_codes_vp702x_table); i++) + if (rc5_custom(&ir_codes_vp702x_table[i]) == key[1]) { *state = REMOTE_KEY_PRESSED; - *event = vp702x_rc_keys[i].event; + *event = ir_codes_vp702x_table[i].event; break; } return 0; @@ -283,8 +283,8 @@ static struct dvb_usb_device_properties vp702x_properties = { }, .read_mac_address = vp702x_read_mac_addr, - .rc_key_map = vp702x_rc_keys, - .rc_key_map_size = ARRAY_SIZE(vp702x_rc_keys), + .rc_key_map = ir_codes_vp702x_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_vp702x_table), .rc_interval = 400, .rc_query = vp702x_rc_query, diff --git a/drivers/media/dvb/dvb-usb/vp7045.c b/drivers/media/dvb/dvb-usb/vp7045.c index a59faa27912..036893fa448 100644 --- a/drivers/media/dvb/dvb-usb/vp7045.c +++ b/drivers/media/dvb/dvb-usb/vp7045.c @@ -99,7 +99,7 @@ static int vp7045_power_ctrl(struct dvb_usb_device *d, int onoff) /* The keymapping struct. Somehow this should be loaded to the driver, but * currently it is hardcoded. */ -static struct dvb_usb_rc_key vp7045_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_vp7045_table[] = { { 0x0016, KEY_POWER }, { 0x0010, KEY_MUTE }, { 0x0003, KEY_1 }, @@ -165,10 +165,10 @@ static int vp7045_rc_query(struct dvb_usb_device *d, u32 *event, int *state) return 0; } - for (i = 0; i < ARRAY_SIZE(vp7045_rc_keys); i++) - if (rc5_data(&vp7045_rc_keys[i]) == key) { + for (i = 0; i < ARRAY_SIZE(ir_codes_vp7045_table); i++) + if (rc5_data(&ir_codes_vp7045_table[i]) == key) { *state = REMOTE_KEY_PRESSED; - *event = vp7045_rc_keys[i].event; + *event = ir_codes_vp7045_table[i].event; break; } return 0; @@ -260,8 +260,8 @@ static struct dvb_usb_device_properties vp7045_properties = { .read_mac_address = vp7045_read_mac_addr, .rc_interval = 400, - .rc_key_map = vp7045_rc_keys, - .rc_key_map_size = ARRAY_SIZE(vp7045_rc_keys), + .rc_key_map = ir_codes_vp7045_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_vp7045_table), .rc_query = vp7045_rc_query, .num_device_descs = 2, -- cgit v1.2.3 From b2245ba1644eb1eba400fd04c6e7bb3ab2d4a8fa Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 2 Apr 2010 13:18:42 -0300 Subject: V4L/DVB: ir: prepare IR code for a parameter change at register function A latter patch will reuse the ir_input_register with a different meaning. Before it, change all occurrences to a temporary name. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dm1105/dm1105.c | 2 +- drivers/media/dvb/mantis/mantis_input.c | 2 +- drivers/media/dvb/ttpci/budget-ci.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/dm1105/dm1105.c b/drivers/media/dvb/dm1105/dm1105.c index ff62dc8633c..416c29bf78d 100644 --- a/drivers/media/dvb/dm1105/dm1105.c +++ b/drivers/media/dvb/dm1105/dm1105.c @@ -630,7 +630,7 @@ int __devinit dm1105_ir_init(struct dm1105_dev *dm1105) INIT_WORK(&dm1105->ir.work, dm1105_emit_key); - err = ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); + err = __ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); return err; } diff --git a/drivers/media/dvb/mantis/mantis_input.c b/drivers/media/dvb/mantis/mantis_input.c index 6baf3022968..3d4e4663220 100644 --- a/drivers/media/dvb/mantis/mantis_input.c +++ b/drivers/media/dvb/mantis/mantis_input.c @@ -128,7 +128,7 @@ int mantis_input_init(struct mantis_pci *mantis) rc->id.version = 1; rc->dev = mantis->pdev->dev; - err = ir_input_register(rc, &ir_mantis, NULL, MODULE_NAME); + err = __ir_input_register(rc, &ir_mantis, NULL, MODULE_NAME); if (err) { dprintk(MANTIS_ERROR, 1, "IR device registration failed, ret = %d", err); input_free_device(rc); diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index 75c640e5966..ab7479ad592 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c @@ -256,7 +256,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci) budget_ci->ir.timer_keyup.function = msp430_ir_keyup; budget_ci->ir.timer_keyup.data = (unsigned long) &budget_ci->ir; budget_ci->ir.last_raw = 0xffff; /* An impossible value */ - error = ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); + error = __ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); if (error) { printk(KERN_ERR "budget_ci: could not init driver for IR device (code %d)\n", error); return error; -- cgit v1.2.3 From 02858eedcb78a664215b918d98cdb753ce432ce6 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 2 Apr 2010 20:01:00 -0300 Subject: V4L/DVB: ir-core: Make use of the new IR keymap modules Instead of using the ugly keymap sequences, use the new rc-*.ko keymap files. For now, it is still needed to have one keymap loaded, for the RC code to work. Later patches will remove this depenency. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dm1105/dm1105.c | 4 ++-- drivers/media/dvb/ttpci/budget-ci.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/dm1105/dm1105.c b/drivers/media/dvb/dm1105/dm1105.c index 416c29bf78d..9d389bdaca4 100644 --- a/drivers/media/dvb/dm1105/dm1105.c +++ b/drivers/media/dvb/dm1105/dm1105.c @@ -596,7 +596,7 @@ static irqreturn_t dm1105_irq(int irq, void *dev_id) int __devinit dm1105_ir_init(struct dm1105_dev *dm1105) { struct input_dev *input_dev; - struct ir_scancode_table *ir_codes = &IR_KEYTABLE(dm1105_nec); + char *ir_codes = NULL; u64 ir_type = IR_TYPE_OTHER; int err = -ENOMEM; @@ -630,7 +630,7 @@ int __devinit dm1105_ir_init(struct dm1105_dev *dm1105) INIT_WORK(&dm1105->ir.work, dm1105_emit_key); - err = __ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); + err = ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); return err; } diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index ab7479ad592..be2074995a0 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c @@ -192,7 +192,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci) struct saa7146_dev *saa = budget_ci->budget.dev; struct input_dev *input_dev = budget_ci->ir.dev; int error; - struct ir_scancode_table *ir_codes; + char *ir_codes = NULL; budget_ci->ir.dev = input_dev = input_allocate_device(); @@ -232,7 +232,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci) case 0x1011: case 0x1012: /* The hauppauge keymap is a superset of these remotes */ - ir_codes = &IR_KEYTABLE(hauppauge_new); + ir_codes = RC_MAP_HAUPPAUGE_NEW; if (rc5_device < 0) budget_ci->ir.rc5_device = 0x1f; @@ -241,11 +241,11 @@ static int msp430_ir_init(struct budget_ci *budget_ci) case 0x1017: case 0x101a: /* for the Technotrend 1500 bundled remote */ - ir_codes = &IR_KEYTABLE(tt_1500); + ir_codes = RC_MAP_TT_1500; break; default: /* unknown remote */ - ir_codes = &IR_KEYTABLE(budget_ci_old); + ir_codes = RC_MAP_BUDGET_CI_OLD; break; } @@ -256,7 +256,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci) budget_ci->ir.timer_keyup.function = msp430_ir_keyup; budget_ci->ir.timer_keyup.data = (unsigned long) &budget_ci->ir; budget_ci->ir.last_raw = 0xffff; /* An impossible value */ - error = __ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); + error = ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); if (error) { printk(KERN_ERR "budget_ci: could not init driver for IR device (code %d)\n", error); return error; -- cgit v1.2.3 From 13c24497086418010bf4f76378bcae241d7f59cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20H=C3=A4rdeman?= Date: Fri, 2 Apr 2010 15:58:30 -0300 Subject: V4L/DVB: Convert drivers/media/dvb/ttpci/budget-ci.c to use ir-core MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Converts drivers/media/dvb/ttpci/budget-ci.c to use ir-core rather than rolling its own keydown timeout handler and reporting keys via drivers/media/IR/ir-functions.c. [mchehab@redhat.com: Drop the call to ir_input_init() as it is no longer needed] Signed-off-by: David Härdeman Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/ttpci/budget-ci.c | 40 +++---------------------------------- 1 file changed, 3 insertions(+), 37 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index be2074995a0..46171439633 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include "budget.h" @@ -82,12 +82,6 @@ #define SLOTSTATUS_READY 8 #define SLOTSTATUS_OCCUPIED (SLOTSTATUS_PRESENT|SLOTSTATUS_RESET|SLOTSTATUS_READY) -/* - * Milliseconds during which a key is regarded as pressed. - * If an identical command arrives within this time, the timer will start over. - */ -#define IR_KEYPRESS_TIMEOUT 250 - /* RC5 device wildcard */ #define IR_DEVICE_ANY 255 @@ -104,12 +98,9 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); struct budget_ci_ir { struct input_dev *dev; struct tasklet_struct msp430_irq_tasklet; - struct timer_list timer_keyup; char name[72]; /* 40 + 32 for (struct saa7146_dev).name */ char phys[32]; - struct ir_input_state state; int rc5_device; - u32 last_raw; u32 ir_key; bool have_command; }; @@ -124,18 +115,11 @@ struct budget_ci { u8 tuner_pll_address; /* used for philips_tdm1316l configs */ }; -static void msp430_ir_keyup(unsigned long data) -{ - struct budget_ci_ir *ir = (struct budget_ci_ir *) data; - ir_input_nokey(ir->dev, &ir->state); -} - static void msp430_ir_interrupt(unsigned long data) { struct budget_ci *budget_ci = (struct budget_ci *) data; struct input_dev *dev = budget_ci->ir.dev; u32 command = ttpci_budget_debiread(&budget_ci->budget, DEBINOSWAP, DEBIADDR_IR, 2, 1, 0) >> 8; - u32 raw; /* * The msp430 chip can generate two different bytes, command and device @@ -171,20 +155,12 @@ static void msp430_ir_interrupt(unsigned long data) return; budget_ci->ir.have_command = false; + /* FIXME: We should generate complete scancodes with device info */ if (budget_ci->ir.rc5_device != IR_DEVICE_ANY && budget_ci->ir.rc5_device != (command & 0x1f)) return; - /* Is this a repeated key sequence? (same device, command, toggle) */ - raw = budget_ci->ir.ir_key | (command << 8); - if (budget_ci->ir.last_raw != raw || !timer_pending(&budget_ci->ir.timer_keyup)) { - ir_input_nokey(dev, &budget_ci->ir.state); - ir_input_keydown(dev, &budget_ci->ir.state, - budget_ci->ir.ir_key); - budget_ci->ir.last_raw = raw; - } - - mod_timer(&budget_ci->ir.timer_keyup, jiffies + msecs_to_jiffies(IR_KEYPRESS_TIMEOUT)); + ir_keydown(dev, budget_ci->ir.ir_key, (command & 0x20) ? 1 : 0); } static int msp430_ir_init(struct budget_ci *budget_ci) @@ -249,13 +225,6 @@ static int msp430_ir_init(struct budget_ci *budget_ci) break; } - ir_input_init(input_dev, &budget_ci->ir.state, IR_TYPE_RC5); - - /* initialise the key-up timeout handler */ - init_timer(&budget_ci->ir.timer_keyup); - budget_ci->ir.timer_keyup.function = msp430_ir_keyup; - budget_ci->ir.timer_keyup.data = (unsigned long) &budget_ci->ir; - budget_ci->ir.last_raw = 0xffff; /* An impossible value */ error = ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); if (error) { printk(KERN_ERR "budget_ci: could not init driver for IR device (code %d)\n", error); @@ -284,9 +253,6 @@ static void msp430_ir_deinit(struct budget_ci *budget_ci) saa7146_setgpio(saa, 3, SAA7146_GPIO_INPUT); tasklet_kill(&budget_ci->ir.msp430_irq_tasklet); - del_timer_sync(&dev->timer); - ir_input_nokey(dev, &budget_ci->ir.state); - ir_input_unregister(dev); } -- cgit v1.2.3 From d5978ed6b6d3de92dac14032bae0eea64d960f37 Mon Sep 17 00:00:00 2001 From: Huang Weiyi Date: Thu, 8 Apr 2010 08:50:17 -0300 Subject: V4L/DVB: DVB: ngene, remove unused #include Remove unused #include ('s) in drivers/media/dvb/ngene/ngene-core.c Signed-off-by: Huang Weiyi Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/ngene/ngene-core.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/ngene/ngene-core.c b/drivers/media/dvb/ngene/ngene-core.c index a45e53a6546..c8c997059c4 100644 --- a/drivers/media/dvb/ngene/ngene-core.c +++ b/drivers/media/dvb/ngene/ngene-core.c @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include -- cgit v1.2.3 From 2b0691cfc714a0f4dff582c913de1a3a68cb38a7 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Mon, 5 Apr 2010 01:14:26 -0300 Subject: V4L/DVB: dvb/dib8000: fix build warning In file included from drivers/media/dvb/dvb-usb/dib0700_devices.c:14: drivers/media/dvb/frontends/dib8000.h: In function 'dib8000_get_adc_power': drivers/media/dvb/frontends/dib8000.h:112: warning: no return statement in function returning non-void Fixed by adding a return to the dummy function. Signed-off-by: Wolfram Sang Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/dib8000.h | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/frontends/dib8000.h b/drivers/media/dvb/frontends/dib8000.h index b1ee2079963..e0a9ded11df 100644 --- a/drivers/media/dvb/frontends/dib8000.h +++ b/drivers/media/dvb/frontends/dib8000.h @@ -109,6 +109,7 @@ static inline void dib8000_pwm_agc_reset(struct dvb_frontend *fe) static inline s32 dib8000_get_adc_power(struct dvb_frontend *fe, u8 mode) { printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); + return 0; } #endif -- cgit v1.2.3 From 450df22286eee7431b34644410aeff18936c7afe Mon Sep 17 00:00:00 2001 From: Nicolas Noirbent Date: Mon, 22 Mar 2010 14:54:43 -0300 Subject: V4L/DVB: ds3000: fix divide-by-zero error in ds3000_read_snr() Fix a divide-by-zero error in ds3000's ds3000_read_snr(), when getting a very low signal reading (dvbs2_signal_reading >= 1). This prevents some nasty EIPs when running szap-s2 with a very low signal strength. Signed-off-by: Nicolas Noirbent Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/ds3000.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/frontends/ds3000.c b/drivers/media/dvb/frontends/ds3000.c index cff3535566f..78001e8bcdb 100644 --- a/drivers/media/dvb/frontends/ds3000.c +++ b/drivers/media/dvb/frontends/ds3000.c @@ -719,7 +719,7 @@ static int ds3000_read_snr(struct dvb_frontend *fe, u16 *snr) (ds3000_readreg(state, 0x8d) << 4); dvbs2_signal_reading = ds3000_readreg(state, 0x8e); tmp = dvbs2_signal_reading * dvbs2_signal_reading >> 1; - if (dvbs2_signal_reading == 0) { + if (tmp == 0) { *snr = 0x0000; return 0; } -- cgit v1.2.3 From dd0bbcc626d8baa6821c6cb9c45ecf3759ef8088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= Date: Wed, 24 Mar 2010 10:30:15 -0300 Subject: V4L/DVB: budget: Oops: "BUG: unable to handle kernel NULL pointer dereference" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Never call dvb_frontend_detach if we failed to attach a frontend. This fixes the following oops: [ 8.172997] DVB: registering new adapter (TT-Budget S2-1600 PCI) [ 8.209018] adapter has MAC addr = 00:d0:5c:cc:a7:29 [ 8.328665] Intel ICH 0000:00:1f.5: PCI INT B -> GSI 17 (level, low) -> IRQ 17 [ 8.328753] Intel ICH 0000:00:1f.5: setting latency timer to 64 [ 8.562047] DVB: Unable to find symbol stv090x_attach() [ 8.562117] BUG: unable to handle kernel NULL pointer dereference at 000000ac [ 8.562239] IP: [] dvb_frontend_detach+0x4/0x67 [dvb_core] Ref http://bugs.debian.org/575207 Also clean up if we are unable to register the tuner and LNB drivers [mchehab@redhat.com: add printk log level, to calm down chechpatch.pl] Signed-off-by: Bjørn Mork Reported-by: Fladischer Michael Acked-by: Oliver Endriss Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/ttpci/budget.c | 53 +++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 23 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c index f5db13d8b99..874a10a9d49 100644 --- a/drivers/media/dvb/ttpci/budget.c +++ b/drivers/media/dvb/ttpci/budget.c @@ -628,29 +628,36 @@ static void frontend_init(struct budget *budget) &tt1600_stv6110x_config, &budget->i2c_adap); - tt1600_stv090x_config.tuner_init = ctl->tuner_init; - tt1600_stv090x_config.tuner_sleep = ctl->tuner_sleep; - tt1600_stv090x_config.tuner_set_mode = ctl->tuner_set_mode; - tt1600_stv090x_config.tuner_set_frequency = ctl->tuner_set_frequency; - tt1600_stv090x_config.tuner_get_frequency = ctl->tuner_get_frequency; - tt1600_stv090x_config.tuner_set_bandwidth = ctl->tuner_set_bandwidth; - tt1600_stv090x_config.tuner_get_bandwidth = ctl->tuner_get_bandwidth; - tt1600_stv090x_config.tuner_set_bbgain = ctl->tuner_set_bbgain; - tt1600_stv090x_config.tuner_get_bbgain = ctl->tuner_get_bbgain; - tt1600_stv090x_config.tuner_set_refclk = ctl->tuner_set_refclk; - tt1600_stv090x_config.tuner_get_status = ctl->tuner_get_status; - - /* call the init function once to initialize - tuner's clock output divider and demod's - master clock */ - if (budget->dvb_frontend->ops.init) - budget->dvb_frontend->ops.init(budget->dvb_frontend); - - dvb_attach(isl6423_attach, - budget->dvb_frontend, - &budget->i2c_adap, - &tt1600_isl6423_config); - + if (ctl) { + tt1600_stv090x_config.tuner_init = ctl->tuner_init; + tt1600_stv090x_config.tuner_sleep = ctl->tuner_sleep; + tt1600_stv090x_config.tuner_set_mode = ctl->tuner_set_mode; + tt1600_stv090x_config.tuner_set_frequency = ctl->tuner_set_frequency; + tt1600_stv090x_config.tuner_get_frequency = ctl->tuner_get_frequency; + tt1600_stv090x_config.tuner_set_bandwidth = ctl->tuner_set_bandwidth; + tt1600_stv090x_config.tuner_get_bandwidth = ctl->tuner_get_bandwidth; + tt1600_stv090x_config.tuner_set_bbgain = ctl->tuner_set_bbgain; + tt1600_stv090x_config.tuner_get_bbgain = ctl->tuner_get_bbgain; + tt1600_stv090x_config.tuner_set_refclk = ctl->tuner_set_refclk; + tt1600_stv090x_config.tuner_get_status = ctl->tuner_get_status; + + /* call the init function once to initialize + tuner's clock output divider and demod's + master clock */ + if (budget->dvb_frontend->ops.init) + budget->dvb_frontend->ops.init(budget->dvb_frontend); + + if (dvb_attach(isl6423_attach, + budget->dvb_frontend, + &budget->i2c_adap, + &tt1600_isl6423_config) == NULL) { + printk(KERN_ERR "%s: No Intersil ISL6423 found!\n", __func__); + goto error_out; + } + } else { + printk(KERN_ERR "%s: No STV6110(A) Silicon Tuner found!\n", __func__); + goto error_out; + } } } break; -- cgit v1.2.3 From 4d1f413e820c7e1402475eea254e2bc82d98de35 Mon Sep 17 00:00:00 2001 From: HIRANO Takahito Date: Wed, 7 Apr 2010 11:48:48 -0300 Subject: V4L/DVB: pt1: Support Earthsoft PT2 Support Earthsoft PT2. Signed-off-by: HIRANO Takahito Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/pt1/pt1.c | 271 +++++++++++++++++++++++++++-------- drivers/media/dvb/pt1/va1j5jf8007s.c | 32 ++++- drivers/media/dvb/pt1/va1j5jf8007s.h | 8 +- drivers/media/dvb/pt1/va1j5jf8007t.c | 31 +++- drivers/media/dvb/pt1/va1j5jf8007t.h | 8 +- 5 files changed, 278 insertions(+), 72 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/pt1/pt1.c b/drivers/media/dvb/pt1/pt1.c index 6aded234aa6..69ad94934ec 100644 --- a/drivers/media/dvb/pt1/pt1.c +++ b/drivers/media/dvb/pt1/pt1.c @@ -1,5 +1,5 @@ /* - * driver for Earthsoft PT1 + * driver for Earthsoft PT1/PT2 * * Copyright (C) 2009 HIRANO Takahito * @@ -77,6 +77,10 @@ struct pt1 { struct pt1_adapter *adaps[PT1_NR_ADAPS]; struct pt1_table *tables; struct task_struct *kthread; + + struct mutex lock; + int power; + int reset; }; struct pt1_adapter { @@ -95,6 +99,11 @@ struct pt1_adapter { struct dvb_frontend *fe; int (*orig_set_voltage)(struct dvb_frontend *fe, fe_sec_voltage_t voltage); + int (*orig_sleep)(struct dvb_frontend *fe); + int (*orig_init)(struct dvb_frontend *fe); + + fe_sec_voltage_t voltage; + int sleep; }; #define pt1_printk(level, pt1, format, arg...) \ @@ -219,8 +228,10 @@ static int pt1_do_enable_ram(struct pt1 *pt1) static int pt1_enable_ram(struct pt1 *pt1) { int i, ret; + int phase; schedule_timeout_uninterruptible((HZ + 999) / 1000); - for (i = 0; i < 10; i++) { + phase = pt1->pdev->device == 0x211a ? 128 : 166; + for (i = 0; i < phase; i++) { ret = pt1_do_enable_ram(pt1); if (ret < 0) return ret; @@ -485,33 +496,47 @@ static int pt1_stop_feed(struct dvb_demux_feed *feed) } static void -pt1_set_power(struct pt1 *pt1, int power, int lnb, int reset) +pt1_update_power(struct pt1 *pt1) { - pt1_write_reg(pt1, 1, power | lnb << 1 | !reset << 3); + int bits; + int i; + struct pt1_adapter *adap; + static const int sleep_bits[] = { + 1 << 4, + 1 << 6 | 1 << 7, + 1 << 5, + 1 << 6 | 1 << 8, + }; + + bits = pt1->power | !pt1->reset << 3; + mutex_lock(&pt1->lock); + for (i = 0; i < PT1_NR_ADAPS; i++) { + adap = pt1->adaps[i]; + switch (adap->voltage) { + case SEC_VOLTAGE_13: /* actually 11V */ + bits |= 1 << 1; + break; + case SEC_VOLTAGE_18: /* actually 15V */ + bits |= 1 << 1 | 1 << 2; + break; + default: + break; + } + + /* XXX: The bits should be changed depending on adap->sleep. */ + bits |= sleep_bits[i]; + } + pt1_write_reg(pt1, 1, bits); + mutex_unlock(&pt1->lock); } static int pt1_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) { struct pt1_adapter *adap; - int lnb; adap = container_of(fe->dvb, struct pt1_adapter, adap); - - switch (voltage) { - case SEC_VOLTAGE_13: /* actually 11V */ - lnb = 2; - break; - case SEC_VOLTAGE_18: /* actually 15V */ - lnb = 3; - break; - case SEC_VOLTAGE_OFF: - lnb = 0; - break; - default: - return -EINVAL; - } - - pt1_set_power(adap->pt1, 1, lnb, 0); + adap->voltage = voltage; + pt1_update_power(adap->pt1); if (adap->orig_set_voltage) return adap->orig_set_voltage(fe, voltage); @@ -519,9 +544,37 @@ static int pt1_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) return 0; } +static int pt1_sleep(struct dvb_frontend *fe) +{ + struct pt1_adapter *adap; + + adap = container_of(fe->dvb, struct pt1_adapter, adap); + adap->sleep = 1; + pt1_update_power(adap->pt1); + + if (adap->orig_sleep) + return adap->orig_sleep(fe); + else + return 0; +} + +static int pt1_wakeup(struct dvb_frontend *fe) +{ + struct pt1_adapter *adap; + + adap = container_of(fe->dvb, struct pt1_adapter, adap); + adap->sleep = 0; + pt1_update_power(adap->pt1); + schedule_timeout_uninterruptible((HZ + 999) / 1000); + + if (adap->orig_init) + return adap->orig_init(fe); + else + return 0; +} + static void pt1_free_adapter(struct pt1_adapter *adap) { - dvb_unregister_frontend(adap->fe); dvb_net_release(&adap->net); adap->demux.dmx.close(&adap->demux.dmx); dvb_dmxdev_release(&adap->dmxdev); @@ -534,7 +587,7 @@ static void pt1_free_adapter(struct pt1_adapter *adap) DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); static struct pt1_adapter * -pt1_alloc_adapter(struct pt1 *pt1, struct dvb_frontend *fe) +pt1_alloc_adapter(struct pt1 *pt1) { struct pt1_adapter *adap; void *buf; @@ -551,8 +604,8 @@ pt1_alloc_adapter(struct pt1 *pt1, struct dvb_frontend *fe) adap->pt1 = pt1; - adap->orig_set_voltage = fe->ops.set_voltage; - fe->ops.set_voltage = pt1_set_voltage; + adap->voltage = SEC_VOLTAGE_OFF; + adap->sleep = 1; buf = (u8 *)__get_free_page(GFP_KERNEL); if (!buf) { @@ -593,17 +646,8 @@ pt1_alloc_adapter(struct pt1 *pt1, struct dvb_frontend *fe) dvb_net_init(dvb_adap, &adap->net, &demux->dmx); - ret = dvb_register_frontend(dvb_adap, fe); - if (ret < 0) - goto err_net_release; - adap->fe = fe; - return adap; -err_net_release: - dvb_net_release(&adap->net); - adap->demux.dmx.close(&adap->demux.dmx); - dvb_dmxdev_release(&adap->dmxdev); err_dmx_release: dvb_dmx_release(demux); err_unregister_adapter: @@ -623,6 +667,62 @@ static void pt1_cleanup_adapters(struct pt1 *pt1) pt1_free_adapter(pt1->adaps[i]); } +static int pt1_init_adapters(struct pt1 *pt1) +{ + int i; + struct pt1_adapter *adap; + int ret; + + for (i = 0; i < PT1_NR_ADAPS; i++) { + adap = pt1_alloc_adapter(pt1); + if (IS_ERR(adap)) { + ret = PTR_ERR(adap); + goto err; + } + + adap->index = i; + pt1->adaps[i] = adap; + } + return 0; + +err: + while (i--) + pt1_free_adapter(pt1->adaps[i]); + + return ret; +} + +static void pt1_cleanup_frontend(struct pt1_adapter *adap) +{ + dvb_unregister_frontend(adap->fe); +} + +static int pt1_init_frontend(struct pt1_adapter *adap, struct dvb_frontend *fe) +{ + int ret; + + adap->orig_set_voltage = fe->ops.set_voltage; + adap->orig_sleep = fe->ops.sleep; + adap->orig_init = fe->ops.init; + fe->ops.set_voltage = pt1_set_voltage; + fe->ops.sleep = pt1_sleep; + fe->ops.init = pt1_wakeup; + + ret = dvb_register_frontend(&adap->adap, fe); + if (ret < 0) + return ret; + + adap->fe = fe; + return 0; +} + +static void pt1_cleanup_frontends(struct pt1 *pt1) +{ + int i; + for (i = 0; i < PT1_NR_ADAPS; i++) + pt1_cleanup_frontend(pt1->adaps[i]); +} + struct pt1_config { struct va1j5jf8007s_config va1j5jf8007s_config; struct va1j5jf8007t_config va1j5jf8007t_config; @@ -630,29 +730,63 @@ struct pt1_config { static const struct pt1_config pt1_configs[2] = { { - { .demod_address = 0x1b }, - { .demod_address = 0x1a }, + { + .demod_address = 0x1b, + .frequency = VA1J5JF8007S_20MHZ, + }, + { + .demod_address = 0x1a, + .frequency = VA1J5JF8007T_20MHZ, + }, }, { - { .demod_address = 0x19 }, - { .demod_address = 0x18 }, + { + .demod_address = 0x19, + .frequency = VA1J5JF8007S_20MHZ, + }, + { + .demod_address = 0x18, + .frequency = VA1J5JF8007T_20MHZ, + }, }, }; -static int pt1_init_adapters(struct pt1 *pt1) +static const struct pt1_config pt2_configs[2] = { + { + { + .demod_address = 0x1b, + .frequency = VA1J5JF8007S_25MHZ, + }, + { + .demod_address = 0x1a, + .frequency = VA1J5JF8007T_25MHZ, + }, + }, { + { + .demod_address = 0x19, + .frequency = VA1J5JF8007S_25MHZ, + }, + { + .demod_address = 0x18, + .frequency = VA1J5JF8007T_25MHZ, + }, + }, +}; + +static int pt1_init_frontends(struct pt1 *pt1) { int i, j; struct i2c_adapter *i2c_adap; - const struct pt1_config *config; + const struct pt1_config *configs, *config; struct dvb_frontend *fe[4]; - struct pt1_adapter *adap; int ret; i = 0; j = 0; i2c_adap = &pt1->i2c_adap; + configs = pt1->pdev->device == 0x211a ? pt1_configs : pt2_configs; do { - config = &pt1_configs[i / 2]; + config = &configs[i / 2]; fe[i] = va1j5jf8007s_attach(&config->va1j5jf8007s_config, i2c_adap); @@ -681,11 +815,9 @@ static int pt1_init_adapters(struct pt1 *pt1) } while (i < 4); do { - adap = pt1_alloc_adapter(pt1, fe[j]); - if (IS_ERR(adap)) + ret = pt1_init_frontend(pt1->adaps[j], fe[j]); + if (ret < 0) goto err; - adap->index = j; - pt1->adaps[j] = adap; } while (++j < 4); return 0; @@ -695,7 +827,7 @@ err: fe[i]->ops.release(fe[i]); while (j--) - pt1_free_adapter(pt1->adaps[j]); + dvb_unregister_frontend(fe[j]); return ret; } @@ -890,9 +1022,12 @@ static void __devexit pt1_remove(struct pci_dev *pdev) kthread_stop(pt1->kthread); pt1_cleanup_tables(pt1); - pt1_cleanup_adapters(pt1); + pt1_cleanup_frontends(pt1); pt1_disable_ram(pt1); - pt1_set_power(pt1, 0, 0, 1); + pt1->power = 0; + pt1->reset = 1; + pt1_update_power(pt1); + pt1_cleanup_adapters(pt1); i2c_del_adapter(&pt1->i2c_adap); pci_set_drvdata(pdev, NULL); kfree(pt1); @@ -936,10 +1071,21 @@ pt1_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto err_pci_iounmap; } + mutex_init(&pt1->lock); pt1->pdev = pdev; pt1->regs = regs; pci_set_drvdata(pdev, pt1); + ret = pt1_init_adapters(pt1); + if (ret < 0) + goto err_kfree; + + mutex_init(&pt1->lock); + + pt1->power = 0; + pt1->reset = 1; + pt1_update_power(pt1); + i2c_adap = &pt1->i2c_adap; i2c_adap->class = I2C_CLASS_TV_DIGITAL; i2c_adap->algo = &pt1_i2c_algo; @@ -948,9 +1094,7 @@ pt1_probe(struct pci_dev *pdev, const struct pci_device_id *ent) i2c_set_adapdata(i2c_adap, pt1); ret = i2c_add_adapter(i2c_adap); if (ret < 0) - goto err_kfree; - - pt1_set_power(pt1, 0, 0, 1); + goto err_pt1_cleanup_adapters; pt1_i2c_init(pt1); pt1_i2c_wait(pt1); @@ -979,19 +1123,21 @@ pt1_probe(struct pci_dev *pdev, const struct pci_device_id *ent) pt1_init_streams(pt1); - pt1_set_power(pt1, 1, 0, 1); + pt1->power = 1; + pt1_update_power(pt1); schedule_timeout_uninterruptible((HZ + 49) / 50); - pt1_set_power(pt1, 1, 0, 0); + pt1->reset = 0; + pt1_update_power(pt1); schedule_timeout_uninterruptible((HZ + 999) / 1000); - ret = pt1_init_adapters(pt1); + ret = pt1_init_frontends(pt1); if (ret < 0) goto err_pt1_disable_ram; ret = pt1_init_tables(pt1); if (ret < 0) - goto err_pt1_cleanup_adapters; + goto err_pt1_cleanup_frontends; kthread = kthread_run(pt1_thread, pt1, "pt1"); if (IS_ERR(kthread)) { @@ -1004,11 +1150,15 @@ pt1_probe(struct pci_dev *pdev, const struct pci_device_id *ent) err_pt1_cleanup_tables: pt1_cleanup_tables(pt1); -err_pt1_cleanup_adapters: - pt1_cleanup_adapters(pt1); +err_pt1_cleanup_frontends: + pt1_cleanup_frontends(pt1); err_pt1_disable_ram: pt1_disable_ram(pt1); - pt1_set_power(pt1, 0, 0, 1); + pt1->power = 0; + pt1->reset = 1; + pt1_update_power(pt1); +err_pt1_cleanup_adapters: + pt1_cleanup_adapters(pt1); err_i2c_del_adapter: i2c_del_adapter(i2c_adap); err_kfree: @@ -1027,6 +1177,7 @@ err: static struct pci_device_id pt1_id_table[] = { { PCI_DEVICE(0x10ee, 0x211a) }, + { PCI_DEVICE(0x10ee, 0x222a) }, { }, }; MODULE_DEVICE_TABLE(pci, pt1_id_table); @@ -1054,5 +1205,5 @@ module_init(pt1_init); module_exit(pt1_cleanup); MODULE_AUTHOR("Takahito HIRANO "); -MODULE_DESCRIPTION("Earthsoft PT1 Driver"); +MODULE_DESCRIPTION("Earthsoft PT1/PT2 Driver"); MODULE_LICENSE("GPL"); diff --git a/drivers/media/dvb/pt1/va1j5jf8007s.c b/drivers/media/dvb/pt1/va1j5jf8007s.c index fc6594996e7..451641c0c1d 100644 --- a/drivers/media/dvb/pt1/va1j5jf8007s.c +++ b/drivers/media/dvb/pt1/va1j5jf8007s.c @@ -1,5 +1,5 @@ /* - * ISDB-S driver for VA1J5JF8007 + * ISDB-S driver for VA1J5JF8007/VA1J5JF8011 * * Copyright (C) 2009 HIRANO Takahito * @@ -580,7 +580,7 @@ static void va1j5jf8007s_release(struct dvb_frontend *fe) static struct dvb_frontend_ops va1j5jf8007s_ops = { .info = { - .name = "VA1J5JF8007 ISDB-S", + .name = "VA1J5JF8007/VA1J5JF8011 ISDB-S", .type = FE_QPSK, .frequency_min = 950000, .frequency_max = 2150000, @@ -628,28 +628,50 @@ static int va1j5jf8007s_prepare_1(struct va1j5jf8007s_state *state) return 0; } -static const u8 va1j5jf8007s_prepare_bufs[][2] = { +static const u8 va1j5jf8007s_20mhz_prepare_bufs[][2] = { {0x04, 0x02}, {0x0d, 0x55}, {0x11, 0x40}, {0x13, 0x80}, {0x17, 0x01}, {0x1c, 0x0a}, {0x1d, 0xaa}, {0x1e, 0x20}, {0x1f, 0x88}, {0x51, 0xb0}, {0x52, 0x89}, {0x53, 0xb3}, {0x5a, 0x2d}, {0x5b, 0xd3}, {0x85, 0x69}, {0x87, 0x04}, {0x8e, 0x02}, {0xa3, 0xf7}, {0xa5, 0xc0}, }; +static const u8 va1j5jf8007s_25mhz_prepare_bufs[][2] = { + {0x04, 0x02}, {0x11, 0x40}, {0x13, 0x80}, {0x17, 0x01}, {0x1c, 0x0a}, + {0x1d, 0xaa}, {0x1e, 0x20}, {0x1f, 0x88}, {0x51, 0xb0}, {0x52, 0x89}, + {0x53, 0xb3}, {0x5a, 0x2d}, {0x5b, 0xd3}, {0x85, 0x69}, {0x87, 0x04}, + {0x8e, 0x26}, {0xa3, 0xf7}, {0xa5, 0xc0}, +}; + static int va1j5jf8007s_prepare_2(struct va1j5jf8007s_state *state) { + const u8 (*bufs)[2]; + int size; u8 addr; u8 buf[2]; struct i2c_msg msg; int i; + switch (state->config->frequency) { + case VA1J5JF8007S_20MHZ: + bufs = va1j5jf8007s_20mhz_prepare_bufs; + size = ARRAY_SIZE(va1j5jf8007s_20mhz_prepare_bufs); + break; + case VA1J5JF8007S_25MHZ: + bufs = va1j5jf8007s_25mhz_prepare_bufs; + size = ARRAY_SIZE(va1j5jf8007s_25mhz_prepare_bufs); + break; + default: + return -EINVAL; + } + addr = state->config->demod_address; msg.addr = addr; msg.flags = 0; msg.len = 2; msg.buf = buf; - for (i = 0; i < ARRAY_SIZE(va1j5jf8007s_prepare_bufs); i++) { - memcpy(buf, va1j5jf8007s_prepare_bufs[i], sizeof(buf)); + for (i = 0; i < size; i++) { + memcpy(buf, bufs[i], sizeof(buf)); if (i2c_transfer(state->adap, &msg, 1) != 1) return -EREMOTEIO; } diff --git a/drivers/media/dvb/pt1/va1j5jf8007s.h b/drivers/media/dvb/pt1/va1j5jf8007s.h index aa228a81635..b7d6f05a0e0 100644 --- a/drivers/media/dvb/pt1/va1j5jf8007s.h +++ b/drivers/media/dvb/pt1/va1j5jf8007s.h @@ -1,5 +1,5 @@ /* - * ISDB-S driver for VA1J5JF8007 + * ISDB-S driver for VA1J5JF8007/VA1J5JF8011 * * Copyright (C) 2009 HIRANO Takahito * @@ -24,8 +24,14 @@ #ifndef VA1J5JF8007S_H #define VA1J5JF8007S_H +enum va1j5jf8007s_frequency { + VA1J5JF8007S_20MHZ, + VA1J5JF8007S_25MHZ, +}; + struct va1j5jf8007s_config { u8 demod_address; + enum va1j5jf8007s_frequency frequency; }; struct i2c_adapter; diff --git a/drivers/media/dvb/pt1/va1j5jf8007t.c b/drivers/media/dvb/pt1/va1j5jf8007t.c index 3db4f3e34e8..0f085c3e571 100644 --- a/drivers/media/dvb/pt1/va1j5jf8007t.c +++ b/drivers/media/dvb/pt1/va1j5jf8007t.c @@ -1,5 +1,5 @@ /* - * ISDB-T driver for VA1J5JF8007 + * ISDB-T driver for VA1J5JF8007/VA1J5JF8011 * * Copyright (C) 2009 HIRANO Takahito * @@ -429,7 +429,7 @@ static void va1j5jf8007t_release(struct dvb_frontend *fe) static struct dvb_frontend_ops va1j5jf8007t_ops = { .info = { - .name = "VA1J5JF8007 ISDB-T", + .name = "VA1J5JF8007/VA1J5JF8011 ISDB-T", .type = FE_OFDM, .frequency_min = 90000000, .frequency_max = 770000000, @@ -448,29 +448,50 @@ static struct dvb_frontend_ops va1j5jf8007t_ops = { .release = va1j5jf8007t_release, }; -static const u8 va1j5jf8007t_prepare_bufs[][2] = { +static const u8 va1j5jf8007t_20mhz_prepare_bufs[][2] = { {0x03, 0x90}, {0x14, 0x8f}, {0x1c, 0x2a}, {0x1d, 0xa8}, {0x1e, 0xa2}, {0x22, 0x83}, {0x31, 0x0d}, {0x32, 0xe0}, {0x39, 0xd3}, {0x3a, 0x00}, {0x5c, 0x40}, {0x5f, 0x80}, {0x75, 0x02}, {0x76, 0x4e}, {0x77, 0x03}, {0xef, 0x01} }; +static const u8 va1j5jf8007t_25mhz_prepare_bufs[][2] = { + {0x03, 0x90}, {0x1c, 0x2a}, {0x1d, 0xa8}, {0x1e, 0xa2}, {0x22, 0x83}, + {0x3a, 0x00}, {0x5c, 0x40}, {0x5f, 0x80}, {0x75, 0x0a}, {0x76, 0x4c}, + {0x77, 0x03}, {0xef, 0x01} +}; + int va1j5jf8007t_prepare(struct dvb_frontend *fe) { struct va1j5jf8007t_state *state; + const u8 (*bufs)[2]; + int size; u8 buf[2]; struct i2c_msg msg; int i; state = fe->demodulator_priv; + switch (state->config->frequency) { + case VA1J5JF8007T_20MHZ: + bufs = va1j5jf8007t_20mhz_prepare_bufs; + size = ARRAY_SIZE(va1j5jf8007t_20mhz_prepare_bufs); + break; + case VA1J5JF8007T_25MHZ: + bufs = va1j5jf8007t_25mhz_prepare_bufs; + size = ARRAY_SIZE(va1j5jf8007t_25mhz_prepare_bufs); + break; + default: + return -EINVAL; + } + msg.addr = state->config->demod_address; msg.flags = 0; msg.len = sizeof(buf); msg.buf = buf; - for (i = 0; i < ARRAY_SIZE(va1j5jf8007t_prepare_bufs); i++) { - memcpy(buf, va1j5jf8007t_prepare_bufs[i], sizeof(buf)); + for (i = 0; i < size; i++) { + memcpy(buf, bufs[i], sizeof(buf)); if (i2c_transfer(state->adap, &msg, 1) != 1) return -EREMOTEIO; } diff --git a/drivers/media/dvb/pt1/va1j5jf8007t.h b/drivers/media/dvb/pt1/va1j5jf8007t.h index ed49906f776..2903be519ef 100644 --- a/drivers/media/dvb/pt1/va1j5jf8007t.h +++ b/drivers/media/dvb/pt1/va1j5jf8007t.h @@ -1,5 +1,5 @@ /* - * ISDB-T driver for VA1J5JF8007 + * ISDB-T driver for VA1J5JF8007/VA1J5JF8011 * * Copyright (C) 2009 HIRANO Takahito * @@ -24,8 +24,14 @@ #ifndef VA1J5JF8007T_H #define VA1J5JF8007T_H +enum va1j5jf8007t_frequency { + VA1J5JF8007T_20MHZ, + VA1J5JF8007T_25MHZ, +}; + struct va1j5jf8007t_config { u8 demod_address; + enum va1j5jf8007t_frequency frequency; }; struct i2c_adapter; -- cgit v1.2.3 From 15100d891a53ffc717cec21d805f8c49db51fb65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20H=C3=A4rdeman?= Date: Thu, 15 Apr 2010 18:46:15 -0300 Subject: V4L/DVB: ir-core: remove ir-functions usage from dm1105 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Convert drivers/media/dvb/dm1105/dm1105.c to not rely on ir-functions.c. Signed-off-by: David Härdeman Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dm1105/dm1105.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/dm1105/dm1105.c b/drivers/media/dvb/dm1105/dm1105.c index 9d389bdaca4..b762e561a6d 100644 --- a/drivers/media/dvb/dm1105/dm1105.c +++ b/drivers/media/dvb/dm1105/dm1105.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include "demux.h" #include "dmxdev.h" @@ -267,7 +267,6 @@ static void dm1105_card_list(struct pci_dev *pci) /* infrared remote control */ struct infrared { struct input_dev *input_dev; - struct ir_input_state ir; char input_phys[32]; struct work_struct work; u32 ir_command; @@ -533,8 +532,7 @@ static void dm1105_emit_key(struct work_struct *work) data = (ircom >> 8) & 0x7f; - ir_input_keydown(ir->input_dev, &ir->ir, data); - ir_input_nokey(ir->input_dev, &ir->ir); + ir_keydown(ir->input_dev, data, 0); } /* work handler */ @@ -597,7 +595,6 @@ int __devinit dm1105_ir_init(struct dm1105_dev *dm1105) { struct input_dev *input_dev; char *ir_codes = NULL; - u64 ir_type = IR_TYPE_OTHER; int err = -ENOMEM; input_dev = input_allocate_device(); @@ -608,12 +605,6 @@ int __devinit dm1105_ir_init(struct dm1105_dev *dm1105) snprintf(dm1105->ir.input_phys, sizeof(dm1105->ir.input_phys), "pci-%s/ir0", pci_name(dm1105->pdev)); - err = ir_input_init(input_dev, &dm1105->ir.ir, ir_type); - if (err < 0) { - input_free_device(input_dev); - return err; - } - input_dev->name = "DVB on-card IR receiver"; input_dev->phys = dm1105->ir.input_phys; input_dev->id.bustype = BUS_PCI; @@ -631,8 +622,12 @@ int __devinit dm1105_ir_init(struct dm1105_dev *dm1105) INIT_WORK(&dm1105->ir.work, dm1105_emit_key); err = ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); + if (err < 0) { + input_free_device(input_dev); + return err; + } - return err; + return 0; } void __devexit dm1105_ir_exit(struct dm1105_dev *dm1105) -- cgit v1.2.3 From b187913c77adbd865194c6b8072764e3474d56ea Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 11 Apr 2010 06:12:52 -0300 Subject: V4L/DVB: Add FE_CAN_PSK_8 to allow apps to identify PSK_8 capable DVB devices The enum fe_caps provides flags that allow an application to detect whether a device is capable of handling various modulation types etc. A flag for detecting PSK_8, however, is missing. This patch adds the flag FE_CAN_PSK_8 to frontend.h and implements it for the gp8psk-fe.c and cx24116.c driver (apparently the only ones with PSK_8). Only the gp8psk-fe.c has been explicitly tested, though. Signed-off-by: Klaus Schmidinger Tested-by: Derek Kelly Acked-by: Manu Abraham Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/gp8psk-fe.c | 2 +- drivers/media/dvb/frontends/cx24116.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/dvb-usb/gp8psk-fe.c b/drivers/media/dvb/dvb-usb/gp8psk-fe.c index 7a7f1b2b681..39143805f3d 100644 --- a/drivers/media/dvb/dvb-usb/gp8psk-fe.c +++ b/drivers/media/dvb/dvb-usb/gp8psk-fe.c @@ -349,7 +349,7 @@ static struct dvb_frontend_ops gp8psk_fe_ops = { * FE_CAN_QAM_16 is for compatibility * (Myth incorrectly detects Turbo-QPSK as plain QAM-16) */ - FE_CAN_QPSK | FE_CAN_QAM_16 + FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_PSK_8 }, .release = gp8psk_fe_release, diff --git a/drivers/media/dvb/frontends/cx24116.c b/drivers/media/dvb/frontends/cx24116.c index 2410d8b59b6..13ae2c58d79 100644 --- a/drivers/media/dvb/frontends/cx24116.c +++ b/drivers/media/dvb/frontends/cx24116.c @@ -1479,7 +1479,7 @@ static struct dvb_frontend_ops cx24116_ops = { FE_CAN_FEC_4_5 | FE_CAN_FEC_5_6 | FE_CAN_FEC_6_7 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | FE_CAN_2G_MODULATION | - FE_CAN_QPSK | FE_CAN_RECOVER + FE_CAN_QPSK | FE_CAN_RECOVER | FE_CAN_PSK_8 }, .release = cx24116_release, -- cgit v1.2.3 From c683357236969c48f7b945fd718f141bf36e8ba2 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 21 Apr 2010 11:36:57 -0300 Subject: Revert "V4L/DVB: Add FE_CAN_PSK_8 to allow apps to identify PSK_8 capable DVB devices" Patch reverted per Andreas Oberritter request. It is basically not ready yet for upstream merge. This reverts commit 77b2ad374a82e3d740cb1780ff4caedc3e051b37. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/gp8psk-fe.c | 2 +- drivers/media/dvb/frontends/cx24116.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/dvb-usb/gp8psk-fe.c b/drivers/media/dvb/dvb-usb/gp8psk-fe.c index 39143805f3d..7a7f1b2b681 100644 --- a/drivers/media/dvb/dvb-usb/gp8psk-fe.c +++ b/drivers/media/dvb/dvb-usb/gp8psk-fe.c @@ -349,7 +349,7 @@ static struct dvb_frontend_ops gp8psk_fe_ops = { * FE_CAN_QAM_16 is for compatibility * (Myth incorrectly detects Turbo-QPSK as plain QAM-16) */ - FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_PSK_8 + FE_CAN_QPSK | FE_CAN_QAM_16 }, .release = gp8psk_fe_release, diff --git a/drivers/media/dvb/frontends/cx24116.c b/drivers/media/dvb/frontends/cx24116.c index 13ae2c58d79..2410d8b59b6 100644 --- a/drivers/media/dvb/frontends/cx24116.c +++ b/drivers/media/dvb/frontends/cx24116.c @@ -1479,7 +1479,7 @@ static struct dvb_frontend_ops cx24116_ops = { FE_CAN_FEC_4_5 | FE_CAN_FEC_5_6 | FE_CAN_FEC_6_7 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | FE_CAN_2G_MODULATION | - FE_CAN_QPSK | FE_CAN_RECOVER | FE_CAN_PSK_8 + FE_CAN_QPSK | FE_CAN_RECOVER }, .release = cx24116_release, -- cgit v1.2.3 From 84e2f037ce9672d0fb118e3e82cecfe6122ace3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Mon, 26 Apr 2010 22:18:57 -0300 Subject: V4L/DVB: Add Elgato EyeTV Diversity to dibcom driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch introduces support for DVB-T for the following dibcom based card: Elgato EyeTV Diversity (USB-ID: 0fd9:0011) Support for the Elgato silver IR remote is added too (set parameter dvb_usb_dib0700_ir_proto=0) [w.sang@pengutronix.de: rebased to current linuxtv-master] Signed-off-by: Michael Müller Signed-off-by: Wolfram Sang Signed-off-by: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/dib0700_devices.c | 46 +++++++++++++++++++++++++++-- drivers/media/dvb/dvb-usb/dvb-usb-ids.h | 1 + 2 files changed, 45 insertions(+), 2 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index 2deca210d5a..800800a9649 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c @@ -794,6 +794,43 @@ static struct dvb_usb_rc_key ir_codes_dib0700_table[] = { { 0x7a13, KEY_VOLUMEDOWN }, { 0x7a40, KEY_POWER }, { 0x7a41, KEY_MUTE }, + + /* Key codes for the Elgato EyeTV Diversity silver remote, + set dvb_usb_dib0700_ir_proto=0 */ + { 0x4501, KEY_POWER }, + { 0x4502, KEY_MUTE }, + { 0x4503, KEY_1 }, + { 0x4504, KEY_2 }, + { 0x4505, KEY_3 }, + { 0x4506, KEY_4 }, + { 0x4507, KEY_5 }, + { 0x4508, KEY_6 }, + { 0x4509, KEY_7 }, + { 0x450a, KEY_8 }, + { 0x450b, KEY_9 }, + { 0x450c, KEY_LAST }, + { 0x450d, KEY_0 }, + { 0x450e, KEY_ENTER }, + { 0x450f, KEY_RED }, + { 0x4510, KEY_CHANNELUP }, + { 0x4511, KEY_GREEN }, + { 0x4512, KEY_VOLUMEDOWN }, + { 0x4513, KEY_OK }, + { 0x4514, KEY_VOLUMEUP }, + { 0x4515, KEY_YELLOW }, + { 0x4516, KEY_CHANNELDOWN }, + { 0x4517, KEY_BLUE }, + { 0x4518, KEY_LEFT }, /* Skip backwards */ + { 0x4519, KEY_PLAYPAUSE }, + { 0x451a, KEY_RIGHT }, /* Skip forward */ + { 0x451b, KEY_REWIND }, + { 0x451c, KEY_L }, /* Live */ + { 0x451d, KEY_FASTFORWARD }, + { 0x451e, KEY_STOP }, /* 'Reveal' for Teletext */ + { 0x451f, KEY_MENU }, /* KEY_TEXT for Teletext */ + { 0x4540, KEY_RECORD }, /* Font 'Size' for Teletext */ + { 0x4541, KEY_SCREEN }, /* Full screen toggle, 'Hold' for Teletext */ + { 0x4542, KEY_SELECT }, /* Select video input, 'Select' for Teletext */ }; /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */ @@ -2049,6 +2086,7 @@ struct usb_device_id dib0700_usb_id_table[] = { /* 65 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) }, { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) }, { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK8096GP) }, + { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DIVERSITY) }, { 0 } /* Terminating entry */ }; MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table); @@ -2393,7 +2431,7 @@ struct dvb_usb_device_properties dib0700_devices[] = { } }, - .num_device_descs = 6, + .num_device_descs = 7, .devices = { { "DiBcom STK7070PD reference design", { &dib0700_usb_id_table[17], NULL }, @@ -2419,7 +2457,11 @@ struct dvb_usb_device_properties dib0700_devices[] = { { "Sony PlayTV", { &dib0700_usb_id_table[44], NULL }, { NULL }, - } + }, + { "Elgato EyeTV Diversity", + { &dib0700_usb_id_table[68], NULL }, + { NULL }, + }, }, .rc_interval = DEFAULT_RC_INTERVAL, .rc_key_map = ir_codes_dib0700_table, diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index de1f3af60d5..085c4e457e0 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h @@ -290,6 +290,7 @@ #define USB_PID_MSI_DIGI_VOX_MINI_III 0x8807 #define USB_PID_SONY_PLAYTV 0x0003 #define USB_PID_MYGICA_D689 0xd811 +#define USB_PID_ELGATO_EYETV_DIVERSITY 0x0011 #define USB_PID_ELGATO_EYETV_DTT 0x0021 #define USB_PID_ELGATO_EYETV_DTT_Dlx 0x0020 #define USB_PID_DVB_T_USB_STICK_HIGH_SPEED_COLD 0x5000 -- cgit v1.2.3 From 30d81bb086c84d54cde4dd4d0c75d9455224632b Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Mon, 8 Feb 2010 20:30:44 -0300 Subject: V4L/DVB: dib7000p: reduce large stack usage This patch reduces static stack usage of one of the 2 top offenders as listed by 'make checkstack': Building with CONFIG_FRAME_WARN=2048 produces: drivers/media/dvb/frontends/dib7000p.c:1367: warning: the frame size of 2320 bytes is larger than 2048 bytes and in 'make checkstack', the stack usage goes from: 0x00002409 dib7000p_i2c_enumeration [dib7000p]: 2328 to unlisted with this patch. Also change one caller of dib7000p_i2c_enumeration() to check its return value. I don't have the hardware that is needed to test this patch. Signed-off-by: Randy Dunlap Signed-off-by: Andrew Morton Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/cxusb.c | 5 +++-- drivers/media/dvb/frontends/dib7000p.c | 36 +++++++++++++++++++++------------- 2 files changed, 25 insertions(+), 16 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index 33a83f93e7c..0eb49088916 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c @@ -1025,8 +1025,9 @@ static int cxusb_dualdig4_rev2_frontend_attach(struct dvb_usb_adapter *adap) cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1); - dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, - &cxusb_dualdig4_rev2_config); + if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, + &cxusb_dualdig4_rev2_config) < 0) + return -ENODEV; adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &cxusb_dualdig4_rev2_config); diff --git a/drivers/media/dvb/frontends/dib7000p.c b/drivers/media/dvb/frontends/dib7000p.c index 85468a45c34..113fc1394d5 100644 --- a/drivers/media/dvb/frontends/dib7000p.c +++ b/drivers/media/dvb/frontends/dib7000p.c @@ -1324,46 +1324,54 @@ EXPORT_SYMBOL(dib7000p_pid_filter); int dib7000p_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, struct dib7000p_config cfg[]) { - struct dib7000p_state st = { .i2c_adap = i2c }; + struct dib7000p_state *dpst; int k = 0; u8 new_addr = 0; + dpst = kzalloc(sizeof(struct dib7000p_state), GFP_KERNEL); + if (!dpst) + return -ENODEV; + + dpst->i2c_adap = i2c; + for (k = no_of_demods-1; k >= 0; k--) { - st.cfg = cfg[k]; + dpst->cfg = cfg[k]; /* designated i2c address */ new_addr = (0x40 + k) << 1; - st.i2c_addr = new_addr; - dib7000p_write_word(&st, 1287, 0x0003); /* sram lead in, rdy */ - if (dib7000p_identify(&st) != 0) { - st.i2c_addr = default_addr; - dib7000p_write_word(&st, 1287, 0x0003); /* sram lead in, rdy */ - if (dib7000p_identify(&st) != 0) { + dpst->i2c_addr = new_addr; + dib7000p_write_word(dpst, 1287, 0x0003); /* sram lead in, rdy */ + if (dib7000p_identify(dpst) != 0) { + dpst->i2c_addr = default_addr; + dib7000p_write_word(dpst, 1287, 0x0003); /* sram lead in, rdy */ + if (dib7000p_identify(dpst) != 0) { dprintk("DiB7000P #%d: not identified\n", k); + kfree(dpst); return -EIO; } } /* start diversity to pull_down div_str - just for i2c-enumeration */ - dib7000p_set_output_mode(&st, OUTMODE_DIVERSITY); + dib7000p_set_output_mode(dpst, OUTMODE_DIVERSITY); /* set new i2c address and force divstart */ - dib7000p_write_word(&st, 1285, (new_addr << 2) | 0x2); + dib7000p_write_word(dpst, 1285, (new_addr << 2) | 0x2); dprintk("IC %d initialized (to i2c_address 0x%x)", k, new_addr); } for (k = 0; k < no_of_demods; k++) { - st.cfg = cfg[k]; - st.i2c_addr = (0x40 + k) << 1; + dpst->cfg = cfg[k]; + dpst->i2c_addr = (0x40 + k) << 1; // unforce divstr - dib7000p_write_word(&st, 1285, st.i2c_addr << 2); + dib7000p_write_word(dpst, 1285, dpst->i2c_addr << 2); /* deactivate div - it was just for i2c-enumeration */ - dib7000p_set_output_mode(&st, OUTMODE_HIGH_Z); + dib7000p_set_output_mode(dpst, OUTMODE_HIGH_Z); } + kfree(dpst); return 0; } EXPORT_SYMBOL(dib7000p_i2c_enumeration); -- cgit v1.2.3 From 0b42760a75afb852be6718fb5e6b54988123b40e Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 27 Apr 2010 19:09:45 -0300 Subject: V4L/DVB: dib7000p: reduce large stack usage fix Signed-off-by: Andrew Morton Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/dib7000p.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/frontends/dib7000p.c b/drivers/media/dvb/frontends/dib7000p.c index 113fc1394d5..2e28b973dfd 100644 --- a/drivers/media/dvb/frontends/dib7000p.c +++ b/drivers/media/dvb/frontends/dib7000p.c @@ -1330,7 +1330,7 @@ int dib7000p_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 defau dpst = kzalloc(sizeof(struct dib7000p_state), GFP_KERNEL); if (!dpst) - return -ENODEV; + return -ENOMEM; dpst->i2c_adap = i2c; -- cgit v1.2.3 From 0de8e3533e08745616a30bdb3fa5106c85083e51 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Mon, 8 Feb 2010 20:30:33 -0300 Subject: V4L/DVB: dib3000mc: reduce large stack usage This patch reduces static stack usage of one of the 2 top offenders as listed by 'make checkstack': Building with CONFIG_FRAME_WARN=2048 produces: drivers/media/dvb/frontends/dib3000mc.c:853: warning: the frame size of 2224 bytes is larger than 2048 bytes and in 'make checkstack', the stack usage goes from: 0x00000bbd dib3000mc_i2c_enumeration [dib3000mc]: 2232 to unlisted with this patch. I don't have the hardware that is needed to test this patch. Signed-off-by: Randy Dunlap Signed-off-by: Andrew Morton Acked-by: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/dib3000mc.c | 35 +++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/frontends/dib3000mc.c b/drivers/media/dvb/frontends/dib3000mc.c index 40a09981027..afad252abf4 100644 --- a/drivers/media/dvb/frontends/dib3000mc.c +++ b/drivers/media/dvb/frontends/dib3000mc.c @@ -814,42 +814,51 @@ EXPORT_SYMBOL(dib3000mc_set_config); int dib3000mc_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, struct dib3000mc_config cfg[]) { - struct dib3000mc_state st = { .i2c_adap = i2c }; + struct dib3000mc_state *dmcst; int k; u8 new_addr; static u8 DIB3000MC_I2C_ADDRESS[] = {20,22,24,26}; + dmcst = kzalloc(sizeof(struct dib3000mc_state), GFP_KERNEL); + if (dmcst == NULL) + return -ENODEV; + + dmcst->i2c_adap = i2c; + for (k = no_of_demods-1; k >= 0; k--) { - st.cfg = &cfg[k]; + dmcst->cfg = &cfg[k]; /* designated i2c address */ new_addr = DIB3000MC_I2C_ADDRESS[k]; - st.i2c_addr = new_addr; - if (dib3000mc_identify(&st) != 0) { - st.i2c_addr = default_addr; - if (dib3000mc_identify(&st) != 0) { + dmcst->i2c_addr = new_addr; + if (dib3000mc_identify(dmcst) != 0) { + dmcst->i2c_addr = default_addr; + if (dib3000mc_identify(dmcst) != 0) { dprintk("-E- DiB3000P/MC #%d: not identified\n", k); + kfree(dmcst); return -ENODEV; } } - dib3000mc_set_output_mode(&st, OUTMODE_MPEG2_PAR_CONT_CLK); + dib3000mc_set_output_mode(dmcst, OUTMODE_MPEG2_PAR_CONT_CLK); // set new i2c address and force divstr (Bit 1) to value 0 (Bit 0) - dib3000mc_write_word(&st, 1024, (new_addr << 3) | 0x1); - st.i2c_addr = new_addr; + dib3000mc_write_word(dmcst, 1024, (new_addr << 3) | 0x1); + dmcst->i2c_addr = new_addr; } for (k = 0; k < no_of_demods; k++) { - st.cfg = &cfg[k]; - st.i2c_addr = DIB3000MC_I2C_ADDRESS[k]; + dmcst->cfg = &cfg[k]; + dmcst->i2c_addr = DIB3000MC_I2C_ADDRESS[k]; - dib3000mc_write_word(&st, 1024, st.i2c_addr << 3); + dib3000mc_write_word(dmcst, 1024, dmcst->i2c_addr << 3); /* turn off data output */ - dib3000mc_set_output_mode(&st, OUTMODE_HIGH_Z); + dib3000mc_set_output_mode(dmcst, OUTMODE_HIGH_Z); } + + kfree(dmcst); return 0; } EXPORT_SYMBOL(dib3000mc_i2c_enumeration); -- cgit v1.2.3 From 205161ed03b53c467dd669a340ea704ce0fb6f9e Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Tue, 27 Apr 2010 18:11:20 -0300 Subject: V4L/DVB: dvb-usb: gp8psk, fix potential null derefernce Stanse found that in gp8psk_load_bcm4500fw there is missing a check for return value of kmalloc. Add one and bail out appropriatelly. Signed-off-by: Jiri Slaby Signed-off-by: Andrew Morton Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/gp8psk.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/dvb-usb/gp8psk.c b/drivers/media/dvb/dvb-usb/gp8psk.c index afb444db43a..45106ac4967 100644 --- a/drivers/media/dvb/dvb-usb/gp8psk.c +++ b/drivers/media/dvb/dvb-usb/gp8psk.c @@ -105,6 +105,10 @@ static int gp8psk_load_bcm4500fw(struct dvb_usb_device *d) ptr = fw->data; buf = kmalloc(64, GFP_KERNEL | GFP_DMA); + if (!buf) { + ret = -ENOMEM; + goto out_rel_fw; + } while (ptr[0] != 0xff) { u16 buflen = ptr[0] + 4; -- cgit v1.2.3 From 32ec4576c3fb37316b1d11a04b220527822f3f0d Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 4 May 2010 09:14:29 -0300 Subject: V4L/DVB: media/az6027: doing dma on the stack I changed the dma buffers to use allocated memory instead of stack memory. The reason for this is documented in Documentation/DMA-API-HOWTO.txt under the section: "What memory is DMA'able?" That document was only added a couple weeks ago and there are still lots of modules which haven't been corrected yet. Btw. Smatch includes a pretty good test to find places which use stack memory as a dma buffer. That's how I found these. (http://smatch.sf.net). Signed-off-by: Dan Carpenter Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/az6027.c | 50 +++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 9 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/dvb-usb/az6027.c b/drivers/media/dvb/dvb-usb/az6027.c index 8934788bd83..baaa301c576 100644 --- a/drivers/media/dvb/dvb-usb/az6027.c +++ b/drivers/media/dvb/dvb-usb/az6027.c @@ -417,11 +417,15 @@ static int az6027_ci_read_attribute_mem(struct dvb_ca_en50221 *ca, u16 value; u16 index; int blen; - u8 b[12]; + u8 *b; if (slot != 0) return -EINVAL; + b = kmalloc(12, GFP_KERNEL); + if (!b) + return -ENOMEM; + mutex_lock(&state->ca_mutex); req = 0xC1; @@ -438,6 +442,7 @@ static int az6027_ci_read_attribute_mem(struct dvb_ca_en50221 *ca, } mutex_unlock(&state->ca_mutex); + kfree(b); return ret; } @@ -485,11 +490,15 @@ static int az6027_ci_read_cam_control(struct dvb_ca_en50221 *ca, u16 value; u16 index; int blen; - u8 b[12]; + u8 *b; if (slot != 0) return -EINVAL; + b = kmalloc(12, GFP_KERNEL); + if (!b) + return -ENOMEM; + mutex_lock(&state->ca_mutex); req = 0xC3; @@ -510,6 +519,7 @@ static int az6027_ci_read_cam_control(struct dvb_ca_en50221 *ca, } mutex_unlock(&state->ca_mutex); + kfree(b); return ret; } @@ -556,7 +566,11 @@ static int CI_CamReady(struct dvb_ca_en50221 *ca, int slot) u16 value; u16 index; int blen; - u8 b[12]; + u8 *b; + + b = kmalloc(12, GFP_KERNEL); + if (!b) + return -ENOMEM; req = 0xC8; value = 0; @@ -570,6 +584,7 @@ static int CI_CamReady(struct dvb_ca_en50221 *ca, int slot) } else{ ret = b[0]; } + kfree(b); return ret; } @@ -667,8 +682,11 @@ static int az6027_ci_poll_slot_status(struct dvb_ca_en50221 *ca, int slot, int o u16 value; u16 index; int blen; - u8 b[12]; + u8 *b; + b = kmalloc(12, GFP_KERNEL); + if (!b) + return -ENOMEM; mutex_lock(&state->ca_mutex); req = 0xC5; @@ -692,6 +710,7 @@ static int az6027_ci_poll_slot_status(struct dvb_ca_en50221 *ca, int slot, int o } mutex_unlock(&state->ca_mutex); + kfree(b); return ret; } @@ -943,10 +962,16 @@ static int az6027_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int n u16 value; int length; u8 req; - u8 data[256]; + u8 *data; + + data = kmalloc(256, GFP_KERNEL); + if (!data) + return -ENOMEM; - if (mutex_lock_interruptible(&d->i2c_mutex) < 0) + if (mutex_lock_interruptible(&d->i2c_mutex) < 0) { + kfree(data); return -EAGAIN; + } if (num > 2) warn("more than 2 i2c messages at a time is not handled yet. TODO."); @@ -1016,6 +1041,7 @@ static int az6027_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int n } } mutex_unlock(&d->i2c_mutex); + kfree(data); return i; } @@ -1036,8 +1062,14 @@ int az6027_identify_state(struct usb_device *udev, struct dvb_usb_device_description **desc, int *cold) { - u8 b[16]; - s16 ret = usb_control_msg(udev, + u8 *b; + s16 ret; + + b = kmalloc(16, GFP_KERNEL); + if (!b) + return -ENOMEM; + + ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0xb7, USB_TYPE_VENDOR | USB_DIR_IN, @@ -1048,7 +1080,7 @@ int az6027_identify_state(struct usb_device *udev, USB_CTRL_GET_TIMEOUT); *cold = ret <= 0; - + kfree(b); deb_info("cold: %d\n", *cold); return 0; } -- cgit v1.2.3 From a18e659170b9c551749e1c8cb5a969ea8d73e378 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 4 May 2010 09:31:13 -0300 Subject: V4L/DVB: media/az6027: handle -EIO failure If the az6027_usb_in_op() returns a negative errno ret is -EIO and in that case the value of b[0] may be undefined. The original code assigned 0 to ret, but since it's already 0 now we can skip that. Signed-off-by: Dan Carpenter Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/az6027.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/dvb-usb/az6027.c b/drivers/media/dvb/dvb-usb/az6027.c index baaa301c576..6681ac1c56e 100644 --- a/drivers/media/dvb/dvb-usb/az6027.c +++ b/drivers/media/dvb/dvb-usb/az6027.c @@ -701,10 +701,7 @@ static int az6027_ci_poll_slot_status(struct dvb_ca_en50221 *ca, int slot, int o } else ret = 0; - if (b[0] == 0) { - ret = 0; - - } else if (b[0] == 1) { + if (!ret && b[0] == 1) { ret = DVB_CA_EN50221_POLL_CAM_PRESENT | DVB_CA_EN50221_POLL_CAM_READY; } -- cgit v1.2.3 From 668293a06e3866a3aaa60c523ba4f8f19bfddba1 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 May 2010 08:48:41 -0300 Subject: V4L-DVB: ngene: make sure that tuner headers are included Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/ngene/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/ngene/Makefile b/drivers/media/dvb/ngene/Makefile index 40435cad481..df2c593c995 100644 --- a/drivers/media/dvb/ngene/Makefile +++ b/drivers/media/dvb/ngene/Makefile @@ -8,4 +8,4 @@ obj-$(CONFIG_DVB_NGENE) += ngene.o EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ EXTRA_CFLAGS += -Idrivers/media/dvb/frontends/ - +EXTRA_CFLAGS += -Idrivers/media/common/tuners/ -- cgit v1.2.3 From fdafc96c9162bdc58192a400bad5b850e185977d Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Sat, 13 Mar 2010 16:40:46 -0300 Subject: V4L/DVB: ngene: properly support boards where channel 0 isn't a TS input The current code assumes that channel zero is always a TS input, which would result in an oops if the "one_adapter" modprobe option is 1 (which it is by default) and the board in question has something else on channel zero (which is the case for the Avermedia m780, which has it's analog input wired to UVI1) The code now explicitly tracks the first adapter created and ensures that other channels cannot accidentially be associated with a NULL adapter. Also, eliminate what appears to be a typo where all of the channel parameters are getting associated with stream zero's properties, which will work if you happen to have a dual stream board with the exact same configuration, but if they differ then the second stream is going to end up with the first stream's configuration. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/ngene/ngene-core.c | 7 +++++-- drivers/media/dvb/ngene/ngene.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/ngene/ngene-core.c b/drivers/media/dvb/ngene/ngene-core.c index c8c997059c4..34eaedf65ee 100644 --- a/drivers/media/dvb/ngene/ngene-core.c +++ b/drivers/media/dvb/ngene/ngene-core.c @@ -1750,7 +1750,7 @@ static int init_channel(struct ngene_channel *chan) if (io & (NGENE_IO_TSIN | NGENE_IO_TSOUT)) { if (nr >= STREAM_AUDIOIN1) chan->DataFormatFlags = DF_SWAP32; - if (nr == 0 || !one_adapter) { + if (nr == 0 || !one_adapter || dev->first_adapter == NULL) { adapter = &dev->adapter[nr]; ret = dvb_register_adapter(adapter, "nGene", THIS_MODULE, @@ -1758,8 +1758,10 @@ static int init_channel(struct ngene_channel *chan) adapter_nr); if (ret < 0) return ret; + if (dev->first_adapter == NULL) + dev->first_adapter = adapter; } else { - adapter = &dev->adapter[0]; + adapter = dev->first_adapter; } ret = my_dvb_dmx_ts_card_init(dvbdemux, "SW demux", @@ -1796,6 +1798,7 @@ static int init_channels(struct ngene *dev) int i, j; for (i = 0; i < MAX_STREAM; i++) { + dev->channel[i].number = i; if (init_channel(&dev->channel[i]) < 0) { for (j = i - 1; j >= 0; j--) release_channel(&dev->channel[j]); diff --git a/drivers/media/dvb/ngene/ngene.h b/drivers/media/dvb/ngene/ngene.h index a7eb2984631..ca3af5c6238 100644 --- a/drivers/media/dvb/ngene/ngene.h +++ b/drivers/media/dvb/ngene/ngene.h @@ -752,6 +752,7 @@ struct ngene { spinlock_t cmd_lock; struct dvb_adapter adapter[MAX_STREAM]; + struct dvb_adapter *first_adapter; /* "one_adapter" modprobe opt */ struct ngene_channel channel[MAX_STREAM]; struct ngene_info *card_info; -- cgit v1.2.3 From 0abf26291d95b09eda44453a0c0655a54b8d90f7 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Sat, 13 Mar 2010 16:43:18 -0300 Subject: V4L/DVB: ngene: add initial support for digital side of Avermedia m780 Add ATSC/QAM support for the Avermedia m780. Note that this patch does not include any analog support for the board, as the ngene bridge driver does not yet have analog implemented Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/ngene/ngene-core.c | 52 +++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/ngene/ngene-core.c b/drivers/media/dvb/ngene/ngene-core.c index 34eaedf65ee..ae1f6127f14 100644 --- a/drivers/media/dvb/ngene/ngene-core.c +++ b/drivers/media/dvb/ngene/ngene-core.c @@ -46,6 +46,8 @@ #include "stv6110x.h" #include "stv090x.h" #include "lnbh24.h" +#include "lgdt330x.h" +#include "mt2131.h" static int one_adapter = 1; module_param(one_adapter, int, 0444); @@ -513,11 +515,12 @@ static int ngene_command_gpio_set(struct ngene *dev, u8 select, u8 level) /****************************************************************************/ -static u8 TSFeatureDecoderSetup[8 * 4] = { +static u8 TSFeatureDecoderSetup[8 * 5] = { 0x42, 0x00, 0x00, 0x02, 0x02, 0xbc, 0x00, 0x00, 0x40, 0x06, 0x00, 0x02, 0x02, 0xbc, 0x00, 0x00, /* DRXH */ 0x71, 0x07, 0x00, 0x02, 0x02, 0xbc, 0x00, 0x00, /* DRXHser */ 0x72, 0x06, 0x00, 0x02, 0x02, 0xbc, 0x00, 0x00, /* S2ser */ + 0x40, 0x07, 0x00, 0x02, 0x02, 0xbc, 0x00, 0x00, /* LGDT3303 */ }; /* Set NGENE I2S Config to 16 bit packed */ @@ -1696,6 +1699,34 @@ static int demod_attach_stv0900(struct ngene_channel *chan) return 0; } +static struct lgdt330x_config aver_m780 = { + .demod_address = 0xb2 >> 1, + .demod_chip = LGDT3303, + .serial_mpeg = 0x00, /* PARALLEL */ + .clock_polarity_flip = 1, +}; + +static struct mt2131_config m780_tunerconfig = { + 0xc0 >> 1 +}; + +/* A single func to attach the demo and tuner, rather than + * use two sep funcs like the current design mandates. + */ +static int demod_attach_lg330x(struct ngene_channel *chan) +{ + chan->fe = dvb_attach(lgdt330x_attach, &aver_m780, &chan->i2c_adapter); + if (chan->fe == NULL) { + printk(KERN_ERR DEVICE_NAME ": No LGDT330x found!\n"); + return -ENODEV; + } + + dvb_attach(mt2131_attach, chan->fe, &chan->i2c_adapter, + &m780_tunerconfig, 0); + + return (chan->fe) ? 0 : -ENODEV; +} + /****************************************************************************/ /****************************************************************************/ /****************************************************************************/ @@ -1961,6 +1992,24 @@ static struct ngene_info ngene_info_cineS2v5 = { .fw_version = 15, }; +static struct ngene_info ngene_info_m780 = { + .type = NGENE_APP, + .name = "Aver M780 ATSC/QAM-B", + + /* Channel 0 is analog, which is currently unsupported */ + .io_type = { NGENE_IO_NONE, NGENE_IO_TSIN }, + .demod_attach = { NULL, demod_attach_lg330x }, + + /* Ensure these are NULL else the frame will call them (as funcs) */ + .tuner_attach = { 0, 0, 0, 0 }, + .fe_config = { NULL, &aver_m780 }, + .avf = { 0 }, + + /* A custom electrical interface config for the demod to bridge */ + .tsf = { 4, 4 }, + .fw_version = 15, +}; + /****************************************************************************/ @@ -1982,6 +2031,7 @@ static const struct pci_device_id ngene_id_tbl[] __devinitdata = { NGENE_ID(0x18c3, 0xdb01, ngene_info_satixS2), NGENE_ID(0x18c3, 0xdb02, ngene_info_satixS2v2), NGENE_ID(0x18c3, 0xdd00, ngene_info_cineS2v5), + NGENE_ID(0x1461, 0x062e, ngene_info_m780), {0} }; MODULE_DEVICE_TABLE(pci, ngene_id_tbl); -- cgit v1.2.3 From cb1c0f8e7099ef5ba20c046df3a3790b5683c573 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Sat, 13 Mar 2010 17:10:24 -0300 Subject: V4L/DVB: ngene: split out i2c code into a separate file Split out the i2c related code from the ngene-core.c into a new file called ngene-i2c.c. This is part of a larger refactoring of the driver in preparation for adding analog support. Note that this patch makes *no* functional change - all I did was cut/paste the code and add the function prototypes to ngene.h as needed. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/ngene/Makefile | 2 +- drivers/media/dvb/ngene/ngene-core.c | 137 +-------------------------- drivers/media/dvb/ngene/ngene-i2c.c | 179 +++++++++++++++++++++++++++++++++++ drivers/media/dvb/ngene/ngene.h | 7 ++ 4 files changed, 190 insertions(+), 135 deletions(-) create mode 100644 drivers/media/dvb/ngene/ngene-i2c.c (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/ngene/Makefile b/drivers/media/dvb/ngene/Makefile index df2c593c995..5e7d310c6ed 100644 --- a/drivers/media/dvb/ngene/Makefile +++ b/drivers/media/dvb/ngene/Makefile @@ -2,7 +2,7 @@ # Makefile for the nGene device driver # -ngene-objs := ngene-core.o +ngene-objs := ngene-core.o ngene-i2c.o obj-$(CONFIG_DVB_NGENE) += ngene.o diff --git a/drivers/media/dvb/ngene/ngene-core.c b/drivers/media/dvb/ngene/ngene-core.c index ae1f6127f14..fedd341eb01 100644 --- a/drivers/media/dvb/ngene/ngene-core.c +++ b/drivers/media/dvb/ngene/ngene-core.c @@ -353,7 +353,7 @@ static int ngene_command_mutex(struct ngene *dev, struct ngene_command *com) return 0; } -static int ngene_command(struct ngene *dev, struct ngene_command *com) +int ngene_command(struct ngene *dev, struct ngene_command *com) { int result; @@ -364,55 +364,6 @@ static int ngene_command(struct ngene *dev, struct ngene_command *com) } -static int ngene_command_i2c_read(struct ngene *dev, u8 adr, - u8 *out, u8 outlen, u8 *in, u8 inlen, int flag) -{ - struct ngene_command com; - - com.cmd.hdr.Opcode = CMD_I2C_READ; - com.cmd.hdr.Length = outlen + 3; - com.cmd.I2CRead.Device = adr << 1; - memcpy(com.cmd.I2CRead.Data, out, outlen); - com.cmd.I2CRead.Data[outlen] = inlen; - com.cmd.I2CRead.Data[outlen + 1] = 0; - com.in_len = outlen + 3; - com.out_len = inlen + 1; - - if (ngene_command(dev, &com) < 0) - return -EIO; - - if ((com.cmd.raw8[0] >> 1) != adr) - return -EIO; - - if (flag) - memcpy(in, com.cmd.raw8, inlen + 1); - else - memcpy(in, com.cmd.raw8 + 1, inlen); - return 0; -} - -static int ngene_command_i2c_write(struct ngene *dev, u8 adr, - u8 *out, u8 outlen) -{ - struct ngene_command com; - - - com.cmd.hdr.Opcode = CMD_I2C_WRITE; - com.cmd.hdr.Length = outlen + 1; - com.cmd.I2CRead.Device = adr << 1; - memcpy(com.cmd.I2CRead.Data, out, outlen); - com.in_len = outlen + 1; - com.out_len = 1; - - if (ngene_command(dev, &com) < 0) - return -EIO; - - if (com.cmd.raw8[0] == 1) - return -EIO; - - return 0; -} - static int ngene_command_load_firmware(struct ngene *dev, u8 *ngene_fw, u32 size) { @@ -478,7 +429,7 @@ static int ngene_command_config_free_buf(struct ngene *dev, u8 *config) return 0; } -static int ngene_command_gpio_set(struct ngene *dev, u8 select, u8 level) +int ngene_command_gpio_set(struct ngene *dev, u8 select, u8 level) { struct ngene_command com; @@ -776,91 +727,9 @@ static int ngene_command_stream_control(struct ngene *dev, u8 stream, /****************************************************************************/ -/* I2C **********************************************************************/ +/* EEPROM TAGS **************************************************************/ /****************************************************************************/ -static void ngene_i2c_set_bus(struct ngene *dev, int bus) -{ - if (!(dev->card_info->i2c_access & 2)) - return; - if (dev->i2c_current_bus == bus) - return; - - switch (bus) { - case 0: - ngene_command_gpio_set(dev, 3, 0); - ngene_command_gpio_set(dev, 2, 1); - break; - - case 1: - ngene_command_gpio_set(dev, 2, 0); - ngene_command_gpio_set(dev, 3, 1); - break; - } - dev->i2c_current_bus = bus; -} - -static int ngene_i2c_master_xfer(struct i2c_adapter *adapter, - struct i2c_msg msg[], int num) -{ - struct ngene_channel *chan = - (struct ngene_channel *)i2c_get_adapdata(adapter); - struct ngene *dev = chan->dev; - - down(&dev->i2c_switch_mutex); - ngene_i2c_set_bus(dev, chan->number); - - if (num == 2 && msg[1].flags & I2C_M_RD && !(msg[0].flags & I2C_M_RD)) - if (!ngene_command_i2c_read(dev, msg[0].addr, - msg[0].buf, msg[0].len, - msg[1].buf, msg[1].len, 0)) - goto done; - - if (num == 1 && !(msg[0].flags & I2C_M_RD)) - if (!ngene_command_i2c_write(dev, msg[0].addr, - msg[0].buf, msg[0].len)) - goto done; - if (num == 1 && (msg[0].flags & I2C_M_RD)) - if (!ngene_command_i2c_read(dev, msg[0].addr, NULL, 0, - msg[0].buf, msg[0].len, 0)) - goto done; - - up(&dev->i2c_switch_mutex); - return -EIO; - -done: - up(&dev->i2c_switch_mutex); - return num; -} - - -static u32 ngene_i2c_functionality(struct i2c_adapter *adap) -{ - return I2C_FUNC_SMBUS_EMUL; -} - -static struct i2c_algorithm ngene_i2c_algo = { - .master_xfer = ngene_i2c_master_xfer, - .functionality = ngene_i2c_functionality, -}; - -static int ngene_i2c_init(struct ngene *dev, int dev_nr) -{ - struct i2c_adapter *adap = &(dev->channel[dev_nr].i2c_adapter); - - i2c_set_adapdata(adap, &(dev->channel[dev_nr])); - adap->class = I2C_CLASS_TV_DIGITAL | I2C_CLASS_TV_ANALOG; - - strcpy(adap->name, "nGene"); - - adap->algo = &ngene_i2c_algo; - adap->algo_data = (void *)&(dev->channel[dev_nr]); - adap->dev.parent = &dev->pci_dev->dev; - - return i2c_add_adapter(adap); -} - - /****************************************************************************/ /* DVB functions and API interface ******************************************/ /****************************************************************************/ diff --git a/drivers/media/dvb/ngene/ngene-i2c.c b/drivers/media/dvb/ngene/ngene-i2c.c new file mode 100644 index 00000000000..2ef54ca6bad --- /dev/null +++ b/drivers/media/dvb/ngene/ngene-i2c.c @@ -0,0 +1,179 @@ +/* + * ngene-i2c.c: nGene PCIe bridge driver i2c functions + * + * Copyright (C) 2005-2007 Micronas + * + * Copyright (C) 2008-2009 Ralph Metzler + * Modifications for new nGene firmware, + * support for EEPROM-copying, + * support for new dual DVB-S2 card prototype + * + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 only, as published by the Free Software Foundation. + * + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA + * Or, point your browser to http://www.gnu.org/copyleft/gpl.html + */ + +/* FIXME - some of these can probably be removed */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ngene.h" + +/* Firmware command for i2c operations */ +static int ngene_command_i2c_read(struct ngene *dev, u8 adr, + u8 *out, u8 outlen, u8 *in, u8 inlen, int flag) +{ + struct ngene_command com; + + com.cmd.hdr.Opcode = CMD_I2C_READ; + com.cmd.hdr.Length = outlen + 3; + com.cmd.I2CRead.Device = adr << 1; + memcpy(com.cmd.I2CRead.Data, out, outlen); + com.cmd.I2CRead.Data[outlen] = inlen; + com.cmd.I2CRead.Data[outlen + 1] = 0; + com.in_len = outlen + 3; + com.out_len = inlen + 1; + + if (ngene_command(dev, &com) < 0) + return -EIO; + + if ((com.cmd.raw8[0] >> 1) != adr) + return -EIO; + + if (flag) + memcpy(in, com.cmd.raw8, inlen + 1); + else + memcpy(in, com.cmd.raw8 + 1, inlen); + return 0; +} + +static int ngene_command_i2c_write(struct ngene *dev, u8 adr, + u8 *out, u8 outlen) +{ + struct ngene_command com; + + + com.cmd.hdr.Opcode = CMD_I2C_WRITE; + com.cmd.hdr.Length = outlen + 1; + com.cmd.I2CRead.Device = adr << 1; + memcpy(com.cmd.I2CRead.Data, out, outlen); + com.in_len = outlen + 1; + com.out_len = 1; + + if (ngene_command(dev, &com) < 0) + return -EIO; + + if (com.cmd.raw8[0] == 1) + return -EIO; + + return 0; +} + +static void ngene_i2c_set_bus(struct ngene *dev, int bus) +{ + if (!(dev->card_info->i2c_access & 2)) + return; + if (dev->i2c_current_bus == bus) + return; + + switch (bus) { + case 0: + ngene_command_gpio_set(dev, 3, 0); + ngene_command_gpio_set(dev, 2, 1); + break; + + case 1: + ngene_command_gpio_set(dev, 2, 0); + ngene_command_gpio_set(dev, 3, 1); + break; + } + dev->i2c_current_bus = bus; +} + +static int ngene_i2c_master_xfer(struct i2c_adapter *adapter, + struct i2c_msg msg[], int num) +{ + struct ngene_channel *chan = + (struct ngene_channel *)i2c_get_adapdata(adapter); + struct ngene *dev = chan->dev; + + down(&dev->i2c_switch_mutex); + ngene_i2c_set_bus(dev, chan->number); + + if (num == 2 && msg[1].flags & I2C_M_RD && !(msg[0].flags & I2C_M_RD)) + if (!ngene_command_i2c_read(dev, msg[0].addr, + msg[0].buf, msg[0].len, + msg[1].buf, msg[1].len, 0)) + goto done; + + if (num == 1 && !(msg[0].flags & I2C_M_RD)) + if (!ngene_command_i2c_write(dev, msg[0].addr, + msg[0].buf, msg[0].len)) + goto done; + if (num == 1 && (msg[0].flags & I2C_M_RD)) + if (!ngene_command_i2c_read(dev, msg[0].addr, NULL, 0, + msg[0].buf, msg[0].len, 0)) + goto done; + + up(&dev->i2c_switch_mutex); + return -EIO; + +done: + up(&dev->i2c_switch_mutex); + return num; +} + + +static u32 ngene_i2c_functionality(struct i2c_adapter *adap) +{ + return I2C_FUNC_SMBUS_EMUL; +} + +static struct i2c_algorithm ngene_i2c_algo = { + .master_xfer = ngene_i2c_master_xfer, + .functionality = ngene_i2c_functionality, +}; + +int ngene_i2c_init(struct ngene *dev, int dev_nr) +{ + struct i2c_adapter *adap = &(dev->channel[dev_nr].i2c_adapter); + + i2c_set_adapdata(adap, &(dev->channel[dev_nr])); + adap->class = I2C_CLASS_TV_DIGITAL | I2C_CLASS_TV_ANALOG; + + strcpy(adap->name, "nGene"); + + adap->algo = &ngene_i2c_algo; + adap->algo_data = (void *)&(dev->channel[dev_nr]); + adap->dev.parent = &dev->pci_dev->dev; + + return i2c_add_adapter(adap); +} + diff --git a/drivers/media/dvb/ngene/ngene.h b/drivers/media/dvb/ngene/ngene.h index ca3af5c6238..0c2d5a7d183 100644 --- a/drivers/media/dvb/ngene/ngene.h +++ b/drivers/media/dvb/ngene/ngene.h @@ -854,6 +854,13 @@ struct ngene_buffer { #endif +/* Provided by ngene-core.c */ +int ngene_command(struct ngene *dev, struct ngene_command *com); +int ngene_command_gpio_set(struct ngene *dev, u8 select, u8 level); + +/* Provided by ngene-i2c.c */ +int ngene_i2c_init(struct ngene *dev, int dev_nr); + #endif /* LocalWords: Endif -- cgit v1.2.3 From cbddcba695563ba6c0cba35b647b6bf53ec54333 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Sat, 13 Mar 2010 17:53:58 -0300 Subject: V4L/DVB: ngene: split out card specific code into a separate file Split out the card profiles into a new file called ngene-cards.c. This is part of a larger refactoring of the driver in preparation for adding analog support. Note that this patch makes *no* functional change - all I did was cut/paste the code and add the function prototypes to ngene.h as needed. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/ngene/Makefile | 2 +- drivers/media/dvb/ngene/ngene-cards.c | 328 ++++++++++++++++++++++++++++++++++ drivers/media/dvb/ngene/ngene-core.c | 305 +------------------------------ drivers/media/dvb/ngene/ngene.h | 5 + 4 files changed, 337 insertions(+), 303 deletions(-) create mode 100644 drivers/media/dvb/ngene/ngene-cards.c (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/ngene/Makefile b/drivers/media/dvb/ngene/Makefile index 5e7d310c6ed..f01c4a1627d 100644 --- a/drivers/media/dvb/ngene/Makefile +++ b/drivers/media/dvb/ngene/Makefile @@ -2,7 +2,7 @@ # Makefile for the nGene device driver # -ngene-objs := ngene-core.o ngene-i2c.o +ngene-objs := ngene-core.o ngene-i2c.o ngene-cards.o obj-$(CONFIG_DVB_NGENE) += ngene.o diff --git a/drivers/media/dvb/ngene/ngene-cards.c b/drivers/media/dvb/ngene/ngene-cards.c new file mode 100644 index 00000000000..692c3e226e8 --- /dev/null +++ b/drivers/media/dvb/ngene/ngene-cards.c @@ -0,0 +1,328 @@ +/* + * ngene-cards.c: nGene PCIe bridge driver - card specific info + * + * Copyright (C) 2005-2007 Micronas + * + * Copyright (C) 2008-2009 Ralph Metzler + * Modifications for new nGene firmware, + * support for EEPROM-copying, + * support for new dual DVB-S2 card prototype + * + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 only, as published by the Free Software Foundation. + * + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA + * Or, point your browser to http://www.gnu.org/copyleft/gpl.html + */ + +#include +#include +#include +#include + +#include "ngene.h" + +/* demods/tuners */ +#include "stv6110x.h" +#include "stv090x.h" +#include "lnbh24.h" +#include "lgdt330x.h" +#include "mt2131.h" + + +/****************************************************************************/ +/* Demod/tuner attachment ***************************************************/ +/****************************************************************************/ + +static int tuner_attach_stv6110(struct ngene_channel *chan) +{ + struct stv090x_config *feconf = (struct stv090x_config *) + chan->dev->card_info->fe_config[chan->number]; + struct stv6110x_config *tunerconf = (struct stv6110x_config *) + chan->dev->card_info->tuner_config[chan->number]; + struct stv6110x_devctl *ctl; + + ctl = dvb_attach(stv6110x_attach, chan->fe, tunerconf, + &chan->i2c_adapter); + if (ctl == NULL) { + printk(KERN_ERR DEVICE_NAME ": No STV6110X found!\n"); + return -ENODEV; + } + + feconf->tuner_init = ctl->tuner_init; + feconf->tuner_set_mode = ctl->tuner_set_mode; + feconf->tuner_set_frequency = ctl->tuner_set_frequency; + feconf->tuner_get_frequency = ctl->tuner_get_frequency; + feconf->tuner_set_bandwidth = ctl->tuner_set_bandwidth; + feconf->tuner_get_bandwidth = ctl->tuner_get_bandwidth; + feconf->tuner_set_bbgain = ctl->tuner_set_bbgain; + feconf->tuner_get_bbgain = ctl->tuner_get_bbgain; + feconf->tuner_set_refclk = ctl->tuner_set_refclk; + feconf->tuner_get_status = ctl->tuner_get_status; + + return 0; +} + + +static int demod_attach_stv0900(struct ngene_channel *chan) +{ + struct stv090x_config *feconf = (struct stv090x_config *) + chan->dev->card_info->fe_config[chan->number]; + + chan->fe = dvb_attach(stv090x_attach, + feconf, + &chan->i2c_adapter, + chan->number == 0 ? STV090x_DEMODULATOR_0 : + STV090x_DEMODULATOR_1); + if (chan->fe == NULL) { + printk(KERN_ERR DEVICE_NAME ": No STV0900 found!\n"); + return -ENODEV; + } + + if (!dvb_attach(lnbh24_attach, chan->fe, &chan->i2c_adapter, 0, + 0, chan->dev->card_info->lnb[chan->number])) { + printk(KERN_ERR DEVICE_NAME ": No LNBH24 found!\n"); + dvb_frontend_detach(chan->fe); + return -ENODEV; + } + + return 0; +} + +static struct lgdt330x_config aver_m780 = { + .demod_address = 0xb2 >> 1, + .demod_chip = LGDT3303, + .serial_mpeg = 0x00, /* PARALLEL */ + .clock_polarity_flip = 1, +}; + +static struct mt2131_config m780_tunerconfig = { + 0xc0 >> 1 +}; + +/* A single func to attach the demo and tuner, rather than + * use two sep funcs like the current design mandates. + */ +static int demod_attach_lg330x(struct ngene_channel *chan) +{ + chan->fe = dvb_attach(lgdt330x_attach, &aver_m780, &chan->i2c_adapter); + if (chan->fe == NULL) { + printk(KERN_ERR DEVICE_NAME ": No LGDT330x found!\n"); + return -ENODEV; + } + + dvb_attach(mt2131_attach, chan->fe, &chan->i2c_adapter, + &m780_tunerconfig, 0); + + return (chan->fe) ? 0 : -ENODEV; +} + +/****************************************************************************/ +/* Switch control (I2C gates, etc.) *****************************************/ +/****************************************************************************/ + + +static struct stv090x_config fe_cineS2 = { + .device = STV0900, + .demod_mode = STV090x_DUAL, + .clk_mode = STV090x_CLK_EXT, + + .xtal = 27000000, + .address = 0x68, + + .ts1_mode = STV090x_TSMODE_SERIAL_PUNCTURED, + .ts2_mode = STV090x_TSMODE_SERIAL_PUNCTURED, + + .repeater_level = STV090x_RPTLEVEL_16, + + .adc1_range = STV090x_ADC_1Vpp, + .adc2_range = STV090x_ADC_1Vpp, + + .diseqc_envelope_mode = true, +}; + +static struct stv6110x_config tuner_cineS2_0 = { + .addr = 0x60, + .refclk = 27000000, + .clk_div = 1, +}; + +static struct stv6110x_config tuner_cineS2_1 = { + .addr = 0x63, + .refclk = 27000000, + .clk_div = 1, +}; + +static struct ngene_info ngene_info_cineS2 = { + .type = NGENE_SIDEWINDER, + .name = "Linux4Media cineS2 DVB-S2 Twin Tuner", + .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN}, + .demod_attach = {demod_attach_stv0900, demod_attach_stv0900}, + .tuner_attach = {tuner_attach_stv6110, tuner_attach_stv6110}, + .fe_config = {&fe_cineS2, &fe_cineS2}, + .tuner_config = {&tuner_cineS2_0, &tuner_cineS2_1}, + .lnb = {0x0b, 0x08}, + .tsf = {3, 3}, + .fw_version = 15, +}; + +static struct ngene_info ngene_info_satixS2 = { + .type = NGENE_SIDEWINDER, + .name = "Mystique SaTiX-S2 Dual", + .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN}, + .demod_attach = {demod_attach_stv0900, demod_attach_stv0900}, + .tuner_attach = {tuner_attach_stv6110, tuner_attach_stv6110}, + .fe_config = {&fe_cineS2, &fe_cineS2}, + .tuner_config = {&tuner_cineS2_0, &tuner_cineS2_1}, + .lnb = {0x0b, 0x08}, + .tsf = {3, 3}, + .fw_version = 15, +}; + +static struct ngene_info ngene_info_satixS2v2 = { + .type = NGENE_SIDEWINDER, + .name = "Mystique SaTiX-S2 Dual (v2)", + .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN}, + .demod_attach = {demod_attach_stv0900, demod_attach_stv0900}, + .tuner_attach = {tuner_attach_stv6110, tuner_attach_stv6110}, + .fe_config = {&fe_cineS2, &fe_cineS2}, + .tuner_config = {&tuner_cineS2_0, &tuner_cineS2_1}, + .lnb = {0x0a, 0x08}, + .tsf = {3, 3}, + .fw_version = 15, +}; + +static struct ngene_info ngene_info_cineS2v5 = { + .type = NGENE_SIDEWINDER, + .name = "Linux4Media cineS2 DVB-S2 Twin Tuner (v5)", + .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN}, + .demod_attach = {demod_attach_stv0900, demod_attach_stv0900}, + .tuner_attach = {tuner_attach_stv6110, tuner_attach_stv6110}, + .fe_config = {&fe_cineS2, &fe_cineS2}, + .tuner_config = {&tuner_cineS2_0, &tuner_cineS2_1}, + .lnb = {0x0a, 0x08}, + .tsf = {3, 3}, + .fw_version = 15, +}; + +static struct ngene_info ngene_info_m780 = { + .type = NGENE_APP, + .name = "Aver M780 ATSC/QAM-B", + + /* Channel 0 is analog, which is currently unsupported */ + .io_type = { NGENE_IO_NONE, NGENE_IO_TSIN }, + .demod_attach = { NULL, demod_attach_lg330x }, + + /* Ensure these are NULL else the frame will call them (as funcs) */ + .tuner_attach = { 0, 0, 0, 0 }, + .fe_config = { NULL, &aver_m780 }, + .avf = { 0 }, + + /* A custom electrical interface config for the demod to bridge */ + .tsf = { 4, 4 }, + .fw_version = 15, +}; + +/****************************************************************************/ + + + +/****************************************************************************/ +/* PCI Subsystem ID *********************************************************/ +/****************************************************************************/ + +#define NGENE_ID(_subvend, _subdev, _driverdata) { \ + .vendor = NGENE_VID, .device = NGENE_PID, \ + .subvendor = _subvend, .subdevice = _subdev, \ + .driver_data = (unsigned long) &_driverdata } + +/****************************************************************************/ + +static const struct pci_device_id ngene_id_tbl[] __devinitdata = { + NGENE_ID(0x18c3, 0xabc3, ngene_info_cineS2), + NGENE_ID(0x18c3, 0xabc4, ngene_info_cineS2), + NGENE_ID(0x18c3, 0xdb01, ngene_info_satixS2), + NGENE_ID(0x18c3, 0xdb02, ngene_info_satixS2v2), + NGENE_ID(0x18c3, 0xdd00, ngene_info_cineS2v5), + NGENE_ID(0x1461, 0x062e, ngene_info_m780), + {0} +}; +MODULE_DEVICE_TABLE(pci, ngene_id_tbl); + +/****************************************************************************/ +/* Init/Exit ****************************************************************/ +/****************************************************************************/ + +static pci_ers_result_t ngene_error_detected(struct pci_dev *dev, + enum pci_channel_state state) +{ + printk(KERN_ERR DEVICE_NAME ": PCI error\n"); + if (state == pci_channel_io_perm_failure) + return PCI_ERS_RESULT_DISCONNECT; + if (state == pci_channel_io_frozen) + return PCI_ERS_RESULT_NEED_RESET; + return PCI_ERS_RESULT_CAN_RECOVER; +} + +static pci_ers_result_t ngene_link_reset(struct pci_dev *dev) +{ + printk(KERN_INFO DEVICE_NAME ": link reset\n"); + return 0; +} + +static pci_ers_result_t ngene_slot_reset(struct pci_dev *dev) +{ + printk(KERN_INFO DEVICE_NAME ": slot reset\n"); + return 0; +} + +static void ngene_resume(struct pci_dev *dev) +{ + printk(KERN_INFO DEVICE_NAME ": resume\n"); +} + +static struct pci_error_handlers ngene_errors = { + .error_detected = ngene_error_detected, + .link_reset = ngene_link_reset, + .slot_reset = ngene_slot_reset, + .resume = ngene_resume, +}; + +static struct pci_driver ngene_pci_driver = { + .name = "ngene", + .id_table = ngene_id_tbl, + .probe = ngene_probe, + .remove = __devexit_p(ngene_remove), + .err_handler = &ngene_errors, +}; + +static __init int module_init_ngene(void) +{ + printk(KERN_INFO + "nGene PCIE bridge driver, Copyright (C) 2005-2007 Micronas\n"); + return pci_register_driver(&ngene_pci_driver); +} + +static __exit void module_exit_ngene(void) +{ + pci_unregister_driver(&ngene_pci_driver); +} + +module_init(module_init_ngene); +module_exit(module_exit_ngene); + +MODULE_DESCRIPTION("nGene"); +MODULE_AUTHOR("Micronas, Ralph Metzler, Manfred Voelkel"); +MODULE_LICENSE("GPL"); diff --git a/drivers/media/dvb/ngene/ngene-core.c b/drivers/media/dvb/ngene/ngene-core.c index fedd341eb01..8a64f644192 100644 --- a/drivers/media/dvb/ngene/ngene-core.c +++ b/drivers/media/dvb/ngene/ngene-core.c @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -43,12 +42,6 @@ #include "ngene.h" -#include "stv6110x.h" -#include "stv090x.h" -#include "lnbh24.h" -#include "lgdt330x.h" -#include "mt2131.h" - static int one_adapter = 1; module_param(one_adapter, int, 0444); MODULE_PARM_DESC(one_adapter, "Use only one adapter."); @@ -64,8 +57,6 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); #define dprintk if (debug) printk -#define DEVICE_NAME "ngene" - #define ngwriteb(dat, adr) writeb((dat), (char *)(dev->iomem + (adr))) #define ngwritel(dat, adr) writel((dat), (char *)(dev->iomem + (adr))) #define ngwriteb(dat, adr) writeb((dat), (char *)(dev->iomem + (adr))) @@ -878,8 +869,6 @@ static int ngene_stop_feed(struct dvb_demux_feed *dvbdmxfeed) return 0; } - - static int my_dvb_dmx_ts_card_init(struct dvb_demux *dvbdemux, char *id, int (*start_feed)(struct dvb_demux_feed *), int (*stop_feed)(struct dvb_demux_feed *), @@ -1504,97 +1493,6 @@ fail: -/****************************************************************************/ -/* Switch control (I2C gates, etc.) *****************************************/ -/****************************************************************************/ - - -/****************************************************************************/ -/* Demod/tuner attachment ***************************************************/ -/****************************************************************************/ - -static int tuner_attach_stv6110(struct ngene_channel *chan) -{ - struct stv090x_config *feconf = (struct stv090x_config *) - chan->dev->card_info->fe_config[chan->number]; - struct stv6110x_config *tunerconf = (struct stv6110x_config *) - chan->dev->card_info->tuner_config[chan->number]; - struct stv6110x_devctl *ctl; - - ctl = dvb_attach(stv6110x_attach, chan->fe, tunerconf, - &chan->i2c_adapter); - if (ctl == NULL) { - printk(KERN_ERR DEVICE_NAME ": No STV6110X found!\n"); - return -ENODEV; - } - - feconf->tuner_init = ctl->tuner_init; - feconf->tuner_set_mode = ctl->tuner_set_mode; - feconf->tuner_set_frequency = ctl->tuner_set_frequency; - feconf->tuner_get_frequency = ctl->tuner_get_frequency; - feconf->tuner_set_bandwidth = ctl->tuner_set_bandwidth; - feconf->tuner_get_bandwidth = ctl->tuner_get_bandwidth; - feconf->tuner_set_bbgain = ctl->tuner_set_bbgain; - feconf->tuner_get_bbgain = ctl->tuner_get_bbgain; - feconf->tuner_set_refclk = ctl->tuner_set_refclk; - feconf->tuner_get_status = ctl->tuner_get_status; - - return 0; -} - - -static int demod_attach_stv0900(struct ngene_channel *chan) -{ - struct stv090x_config *feconf = (struct stv090x_config *) - chan->dev->card_info->fe_config[chan->number]; - - chan->fe = dvb_attach(stv090x_attach, - feconf, - &chan->i2c_adapter, - chan->number == 0 ? STV090x_DEMODULATOR_0 : - STV090x_DEMODULATOR_1); - if (chan->fe == NULL) { - printk(KERN_ERR DEVICE_NAME ": No STV0900 found!\n"); - return -ENODEV; - } - - if (!dvb_attach(lnbh24_attach, chan->fe, &chan->i2c_adapter, 0, - 0, chan->dev->card_info->lnb[chan->number])) { - printk(KERN_ERR DEVICE_NAME ": No LNBH24 found!\n"); - dvb_frontend_detach(chan->fe); - return -ENODEV; - } - - return 0; -} - -static struct lgdt330x_config aver_m780 = { - .demod_address = 0xb2 >> 1, - .demod_chip = LGDT3303, - .serial_mpeg = 0x00, /* PARALLEL */ - .clock_polarity_flip = 1, -}; - -static struct mt2131_config m780_tunerconfig = { - 0xc0 >> 1 -}; - -/* A single func to attach the demo and tuner, rather than - * use two sep funcs like the current design mandates. - */ -static int demod_attach_lg330x(struct ngene_channel *chan) -{ - chan->fe = dvb_attach(lgdt330x_attach, &aver_m780, &chan->i2c_adapter); - if (chan->fe == NULL) { - printk(KERN_ERR DEVICE_NAME ": No LGDT330x found!\n"); - return -ENODEV; - } - - dvb_attach(mt2131_attach, chan->fe, &chan->i2c_adapter, - &m780_tunerconfig, 0); - - return (chan->fe) ? 0 : -ENODEV; -} /****************************************************************************/ /****************************************************************************/ @@ -1712,7 +1610,7 @@ static int init_channels(struct ngene *dev) /* device probe/remove calls ************************************************/ /****************************************************************************/ -static void __devexit ngene_remove(struct pci_dev *pdev) +void __devexit ngene_remove(struct pci_dev *pdev) { struct ngene *dev = (struct ngene *)pci_get_drvdata(pdev); int i; @@ -1726,8 +1624,8 @@ static void __devexit ngene_remove(struct pci_dev *pdev) pci_disable_device(pdev); } -static int __devinit ngene_probe(struct pci_dev *pci_dev, - const struct pci_device_id *id) +int __devinit ngene_probe(struct pci_dev *pci_dev, + const struct pci_device_id *id) { struct ngene *dev; int stat = 0; @@ -1773,200 +1671,3 @@ fail0: pci_set_drvdata(pci_dev, NULL); return stat; } - -/****************************************************************************/ -/* Card configs *************************************************************/ -/****************************************************************************/ - -static struct stv090x_config fe_cineS2 = { - .device = STV0900, - .demod_mode = STV090x_DUAL, - .clk_mode = STV090x_CLK_EXT, - - .xtal = 27000000, - .address = 0x68, - - .ts1_mode = STV090x_TSMODE_SERIAL_PUNCTURED, - .ts2_mode = STV090x_TSMODE_SERIAL_PUNCTURED, - - .repeater_level = STV090x_RPTLEVEL_16, - - .adc1_range = STV090x_ADC_1Vpp, - .adc2_range = STV090x_ADC_1Vpp, - - .diseqc_envelope_mode = true, -}; - -static struct stv6110x_config tuner_cineS2_0 = { - .addr = 0x60, - .refclk = 27000000, - .clk_div = 1, -}; - -static struct stv6110x_config tuner_cineS2_1 = { - .addr = 0x63, - .refclk = 27000000, - .clk_div = 1, -}; - -static struct ngene_info ngene_info_cineS2 = { - .type = NGENE_SIDEWINDER, - .name = "Linux4Media cineS2 DVB-S2 Twin Tuner", - .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN}, - .demod_attach = {demod_attach_stv0900, demod_attach_stv0900}, - .tuner_attach = {tuner_attach_stv6110, tuner_attach_stv6110}, - .fe_config = {&fe_cineS2, &fe_cineS2}, - .tuner_config = {&tuner_cineS2_0, &tuner_cineS2_1}, - .lnb = {0x0b, 0x08}, - .tsf = {3, 3}, - .fw_version = 15, -}; - -static struct ngene_info ngene_info_satixS2 = { - .type = NGENE_SIDEWINDER, - .name = "Mystique SaTiX-S2 Dual", - .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN}, - .demod_attach = {demod_attach_stv0900, demod_attach_stv0900}, - .tuner_attach = {tuner_attach_stv6110, tuner_attach_stv6110}, - .fe_config = {&fe_cineS2, &fe_cineS2}, - .tuner_config = {&tuner_cineS2_0, &tuner_cineS2_1}, - .lnb = {0x0b, 0x08}, - .tsf = {3, 3}, - .fw_version = 15, -}; - -static struct ngene_info ngene_info_satixS2v2 = { - .type = NGENE_SIDEWINDER, - .name = "Mystique SaTiX-S2 Dual (v2)", - .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN}, - .demod_attach = {demod_attach_stv0900, demod_attach_stv0900}, - .tuner_attach = {tuner_attach_stv6110, tuner_attach_stv6110}, - .fe_config = {&fe_cineS2, &fe_cineS2}, - .tuner_config = {&tuner_cineS2_0, &tuner_cineS2_1}, - .lnb = {0x0a, 0x08}, - .tsf = {3, 3}, - .fw_version = 15, -}; - -static struct ngene_info ngene_info_cineS2v5 = { - .type = NGENE_SIDEWINDER, - .name = "Linux4Media cineS2 DVB-S2 Twin Tuner (v5)", - .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN}, - .demod_attach = {demod_attach_stv0900, demod_attach_stv0900}, - .tuner_attach = {tuner_attach_stv6110, tuner_attach_stv6110}, - .fe_config = {&fe_cineS2, &fe_cineS2}, - .tuner_config = {&tuner_cineS2_0, &tuner_cineS2_1}, - .lnb = {0x0a, 0x08}, - .tsf = {3, 3}, - .fw_version = 15, -}; - -static struct ngene_info ngene_info_m780 = { - .type = NGENE_APP, - .name = "Aver M780 ATSC/QAM-B", - - /* Channel 0 is analog, which is currently unsupported */ - .io_type = { NGENE_IO_NONE, NGENE_IO_TSIN }, - .demod_attach = { NULL, demod_attach_lg330x }, - - /* Ensure these are NULL else the frame will call them (as funcs) */ - .tuner_attach = { 0, 0, 0, 0 }, - .fe_config = { NULL, &aver_m780 }, - .avf = { 0 }, - - /* A custom electrical interface config for the demod to bridge */ - .tsf = { 4, 4 }, - .fw_version = 15, -}; - -/****************************************************************************/ - - - -/****************************************************************************/ -/* PCI Subsystem ID *********************************************************/ -/****************************************************************************/ - -#define NGENE_ID(_subvend, _subdev, _driverdata) { \ - .vendor = NGENE_VID, .device = NGENE_PID, \ - .subvendor = _subvend, .subdevice = _subdev, \ - .driver_data = (unsigned long) &_driverdata } - -/****************************************************************************/ - -static const struct pci_device_id ngene_id_tbl[] __devinitdata = { - NGENE_ID(0x18c3, 0xabc3, ngene_info_cineS2), - NGENE_ID(0x18c3, 0xabc4, ngene_info_cineS2), - NGENE_ID(0x18c3, 0xdb01, ngene_info_satixS2), - NGENE_ID(0x18c3, 0xdb02, ngene_info_satixS2v2), - NGENE_ID(0x18c3, 0xdd00, ngene_info_cineS2v5), - NGENE_ID(0x1461, 0x062e, ngene_info_m780), - {0} -}; -MODULE_DEVICE_TABLE(pci, ngene_id_tbl); - -/****************************************************************************/ -/* Init/Exit ****************************************************************/ -/****************************************************************************/ - -static pci_ers_result_t ngene_error_detected(struct pci_dev *dev, - enum pci_channel_state state) -{ - printk(KERN_ERR DEVICE_NAME ": PCI error\n"); - if (state == pci_channel_io_perm_failure) - return PCI_ERS_RESULT_DISCONNECT; - if (state == pci_channel_io_frozen) - return PCI_ERS_RESULT_NEED_RESET; - return PCI_ERS_RESULT_CAN_RECOVER; -} - -static pci_ers_result_t ngene_link_reset(struct pci_dev *dev) -{ - printk(KERN_INFO DEVICE_NAME ": link reset\n"); - return 0; -} - -static pci_ers_result_t ngene_slot_reset(struct pci_dev *dev) -{ - printk(KERN_INFO DEVICE_NAME ": slot reset\n"); - return 0; -} - -static void ngene_resume(struct pci_dev *dev) -{ - printk(KERN_INFO DEVICE_NAME ": resume\n"); -} - -static struct pci_error_handlers ngene_errors = { - .error_detected = ngene_error_detected, - .link_reset = ngene_link_reset, - .slot_reset = ngene_slot_reset, - .resume = ngene_resume, -}; - -static struct pci_driver ngene_pci_driver = { - .name = "ngene", - .id_table = ngene_id_tbl, - .probe = ngene_probe, - .remove = __devexit_p(ngene_remove), - .err_handler = &ngene_errors, -}; - -static __init int module_init_ngene(void) -{ - printk(KERN_INFO - "nGene PCIE bridge driver, Copyright (C) 2005-2007 Micronas\n"); - return pci_register_driver(&ngene_pci_driver); -} - -static __exit void module_exit_ngene(void) -{ - pci_unregister_driver(&ngene_pci_driver); -} - -module_init(module_init_ngene); -module_exit(module_exit_ngene); - -MODULE_DESCRIPTION("nGene"); -MODULE_AUTHOR("Micronas, Ralph Metzler, Manfred Voelkel"); -MODULE_LICENSE("GPL"); diff --git a/drivers/media/dvb/ngene/ngene.h b/drivers/media/dvb/ngene/ngene.h index 0c2d5a7d183..c2dc8516cb2 100644 --- a/drivers/media/dvb/ngene/ngene.h +++ b/drivers/media/dvb/ngene/ngene.h @@ -39,6 +39,8 @@ #include "dvb_frontend.h" #include "dvb_ringbuffer.h" +#define DEVICE_NAME "ngene" + #define NGENE_VID 0x18c3 #define NGENE_PID 0x0720 @@ -855,6 +857,9 @@ struct ngene_buffer { /* Provided by ngene-core.c */ +int __devinit ngene_probe(struct pci_dev *pci_dev, + const struct pci_device_id *id); +void __devexit ngene_remove(struct pci_dev *pdev); int ngene_command(struct ngene *dev, struct ngene_command *com); int ngene_command_gpio_set(struct ngene *dev, u8 select, u8 level); -- cgit v1.2.3 From 1899e97c52b80c734ead7a98f54ed6fd6e1db96a Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Sat, 13 Mar 2010 23:10:13 -0300 Subject: V4L/DVB: ngene: start separating out DVB functions into separate file Start moving the dvb specific code to ngene-dvb.c. Note that there is still stuff in ngene-core.c which could potentially be moved out, but it will require considerable reworking of the logic in order to continue to properly support DVB while also being able to support transport streams coming from analog MPEG encoders. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/ngene/Makefile | 2 +- drivers/media/dvb/ngene/ngene-core.c | 130 +------------------------- drivers/media/dvb/ngene/ngene-dvb.c | 172 +++++++++++++++++++++++++++++++++++ drivers/media/dvb/ngene/ngene.h | 17 ++++ 4 files changed, 192 insertions(+), 129 deletions(-) create mode 100644 drivers/media/dvb/ngene/ngene-dvb.c (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/ngene/Makefile b/drivers/media/dvb/ngene/Makefile index f01c4a1627d..0608aabb14e 100644 --- a/drivers/media/dvb/ngene/Makefile +++ b/drivers/media/dvb/ngene/Makefile @@ -2,7 +2,7 @@ # Makefile for the nGene device driver # -ngene-objs := ngene-core.o ngene-i2c.o ngene-cards.o +ngene-objs := ngene-core.o ngene-i2c.o ngene-cards.o ngene-dvb.o obj-$(CONFIG_DVB_NGENE) += ngene.o diff --git a/drivers/media/dvb/ngene/ngene-core.c b/drivers/media/dvb/ngene/ngene-core.c index 8a64f644192..c8b4dfa0ab5 100644 --- a/drivers/media/dvb/ngene/ngene-core.c +++ b/drivers/media/dvb/ngene/ngene-core.c @@ -503,7 +503,7 @@ static u8 ITUFeatureDecoderSetup[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x04, 0x00 }; -static void FillTSBuffer(void *Buffer, int Length, u32 Flags) +void FillTSBuffer(void *Buffer, int Length, u32 Flags) { u32 *ptr = Buffer; @@ -716,62 +716,7 @@ static int ngene_command_stream_control(struct ngene *dev, u8 stream, return 0; } - -/****************************************************************************/ -/* EEPROM TAGS **************************************************************/ -/****************************************************************************/ - -/****************************************************************************/ -/* DVB functions and API interface ******************************************/ -/****************************************************************************/ - -static void swap_buffer(u32 *p, u32 len) -{ - while (len) { - *p = swab32(*p); - p++; - len -= 4; - } -} - - -static void *tsin_exchange(void *priv, void *buf, u32 len, u32 clock, u32 flags) -{ - struct ngene_channel *chan = priv; - - -#ifdef COMMAND_TIMEOUT_WORKAROUND - if (chan->users > 0) -#endif - dvb_dmx_swfilter(&chan->demux, buf, len); - return NULL; -} - -u8 fill_ts[188] = { 0x47, 0x1f, 0xff, 0x10 }; - -static void *tsout_exchange(void *priv, void *buf, u32 len, - u32 clock, u32 flags) -{ - struct ngene_channel *chan = priv; - struct ngene *dev = chan->dev; - u32 alen; - - alen = dvb_ringbuffer_avail(&dev->tsout_rbuf); - alen -= alen % 188; - - if (alen < len) - FillTSBuffer(buf + alen, len - alen, flags); - else - alen = len; - dvb_ringbuffer_read(&dev->tsout_rbuf, buf, alen); - if (flags & DF_SWAP32) - swap_buffer((u32 *)buf, alen); - wake_up_interruptible(&dev->tsout_rbuf.queue); - return buf; -} - - -static void set_transfer(struct ngene_channel *chan, int state) +void set_transfer(struct ngene_channel *chan, int state) { u8 control = 0, mode = 0, flags = 0; struct ngene *dev = chan->dev; @@ -838,77 +783,6 @@ static void set_transfer(struct ngene_channel *chan, int state) } } -static int ngene_start_feed(struct dvb_demux_feed *dvbdmxfeed) -{ - struct dvb_demux *dvbdmx = dvbdmxfeed->demux; - struct ngene_channel *chan = dvbdmx->priv; - - if (chan->users == 0) { -#ifdef COMMAND_TIMEOUT_WORKAROUND - if (!chan->running) -#endif - set_transfer(chan, 1); - /* msleep(10); */ - } - - return ++chan->users; -} - -static int ngene_stop_feed(struct dvb_demux_feed *dvbdmxfeed) -{ - struct dvb_demux *dvbdmx = dvbdmxfeed->demux; - struct ngene_channel *chan = dvbdmx->priv; - - if (--chan->users) - return chan->users; - -#ifndef COMMAND_TIMEOUT_WORKAROUND - set_transfer(chan, 0); -#endif - - return 0; -} - -static int my_dvb_dmx_ts_card_init(struct dvb_demux *dvbdemux, char *id, - int (*start_feed)(struct dvb_demux_feed *), - int (*stop_feed)(struct dvb_demux_feed *), - void *priv) -{ - dvbdemux->priv = priv; - - dvbdemux->filternum = 256; - dvbdemux->feednum = 256; - dvbdemux->start_feed = start_feed; - dvbdemux->stop_feed = stop_feed; - dvbdemux->write_to_decoder = NULL; - dvbdemux->dmx.capabilities = (DMX_TS_FILTERING | - DMX_SECTION_FILTERING | - DMX_MEMORY_BASED_FILTERING); - return dvb_dmx_init(dvbdemux); -} - -static int my_dvb_dmxdev_ts_card_init(struct dmxdev *dmxdev, - struct dvb_demux *dvbdemux, - struct dmx_frontend *hw_frontend, - struct dmx_frontend *mem_frontend, - struct dvb_adapter *dvb_adapter) -{ - int ret; - - dmxdev->filternum = 256; - dmxdev->demux = &dvbdemux->dmx; - dmxdev->capabilities = 0; - ret = dvb_dmxdev_init(dmxdev, dvb_adapter); - if (ret < 0) - return ret; - - hw_frontend->source = DMX_FRONTEND_0; - dvbdemux->dmx.add_frontend(&dvbdemux->dmx, hw_frontend); - mem_frontend->source = DMX_MEMORY_FE; - dvbdemux->dmx.add_frontend(&dvbdemux->dmx, mem_frontend); - return dvbdemux->dmx.connect_frontend(&dvbdemux->dmx, hw_frontend); -} - /****************************************************************************/ /* nGene hardware init and release functions ********************************/ diff --git a/drivers/media/dvb/ngene/ngene-dvb.c b/drivers/media/dvb/ngene/ngene-dvb.c new file mode 100644 index 00000000000..96013eb353c --- /dev/null +++ b/drivers/media/dvb/ngene/ngene-dvb.c @@ -0,0 +1,172 @@ +/* + * ngene-dvb.c: nGene PCIe bridge driver - DVB functions + * + * Copyright (C) 2005-2007 Micronas + * + * Copyright (C) 2008-2009 Ralph Metzler + * Modifications for new nGene firmware, + * support for EEPROM-copying, + * support for new dual DVB-S2 card prototype + * + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 only, as published by the Free Software Foundation. + * + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA + * Or, point your browser to http://www.gnu.org/copyleft/gpl.html + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ngene.h" + +#define COMMAND_TIMEOUT_WORKAROUND + + +/****************************************************************************/ +/* COMMAND API interface ****************************************************/ +/****************************************************************************/ + +/****************************************************************************/ +/* DVB functions and API interface ******************************************/ +/****************************************************************************/ + +static void swap_buffer(u32 *p, u32 len) +{ + while (len) { + *p = swab32(*p); + p++; + len -= 4; + } +} + +void *tsin_exchange(void *priv, void *buf, u32 len, u32 clock, u32 flags) +{ + struct ngene_channel *chan = priv; + + +#ifdef COMMAND_TIMEOUT_WORKAROUND + if (chan->users > 0) +#endif + dvb_dmx_swfilter(&chan->demux, buf, len); + return NULL; +} + +u8 fill_ts[188] = { 0x47, 0x1f, 0xff, 0x10 }; + +void *tsout_exchange(void *priv, void *buf, u32 len, u32 clock, u32 flags) +{ + struct ngene_channel *chan = priv; + struct ngene *dev = chan->dev; + u32 alen; + + alen = dvb_ringbuffer_avail(&dev->tsout_rbuf); + alen -= alen % 188; + + if (alen < len) + FillTSBuffer(buf + alen, len - alen, flags); + else + alen = len; + dvb_ringbuffer_read(&dev->tsout_rbuf, buf, alen); + if (flags & DF_SWAP32) + swap_buffer((u32 *)buf, alen); + wake_up_interruptible(&dev->tsout_rbuf.queue); + return buf; +} + + + +int ngene_start_feed(struct dvb_demux_feed *dvbdmxfeed) +{ + struct dvb_demux *dvbdmx = dvbdmxfeed->demux; + struct ngene_channel *chan = dvbdmx->priv; + + if (chan->users == 0) { +#ifdef COMMAND_TIMEOUT_WORKAROUND + if (!chan->running) +#endif + set_transfer(chan, 1); + /* msleep(10); */ + } + + return ++chan->users; +} + +int ngene_stop_feed(struct dvb_demux_feed *dvbdmxfeed) +{ + struct dvb_demux *dvbdmx = dvbdmxfeed->demux; + struct ngene_channel *chan = dvbdmx->priv; + + if (--chan->users) + return chan->users; + +#ifndef COMMAND_TIMEOUT_WORKAROUND + set_transfer(chan, 0); +#endif + + return 0; +} + +int my_dvb_dmx_ts_card_init(struct dvb_demux *dvbdemux, char *id, + int (*start_feed)(struct dvb_demux_feed *), + int (*stop_feed)(struct dvb_demux_feed *), + void *priv) +{ + dvbdemux->priv = priv; + + dvbdemux->filternum = 256; + dvbdemux->feednum = 256; + dvbdemux->start_feed = start_feed; + dvbdemux->stop_feed = stop_feed; + dvbdemux->write_to_decoder = NULL; + dvbdemux->dmx.capabilities = (DMX_TS_FILTERING | + DMX_SECTION_FILTERING | + DMX_MEMORY_BASED_FILTERING); + return dvb_dmx_init(dvbdemux); +} + +int my_dvb_dmxdev_ts_card_init(struct dmxdev *dmxdev, + struct dvb_demux *dvbdemux, + struct dmx_frontend *hw_frontend, + struct dmx_frontend *mem_frontend, + struct dvb_adapter *dvb_adapter) +{ + int ret; + + dmxdev->filternum = 256; + dmxdev->demux = &dvbdemux->dmx; + dmxdev->capabilities = 0; + ret = dvb_dmxdev_init(dmxdev, dvb_adapter); + if (ret < 0) + return ret; + + hw_frontend->source = DMX_FRONTEND_0; + dvbdemux->dmx.add_frontend(&dvbdemux->dmx, hw_frontend); + mem_frontend->source = DMX_MEMORY_FE; + dvbdemux->dmx.add_frontend(&dvbdemux->dmx, mem_frontend); + return dvbdemux->dmx.connect_frontend(&dvbdemux->dmx, hw_frontend); +} diff --git a/drivers/media/dvb/ngene/ngene.h b/drivers/media/dvb/ngene/ngene.h index c2dc8516cb2..676fcbb7902 100644 --- a/drivers/media/dvb/ngene/ngene.h +++ b/drivers/media/dvb/ngene/ngene.h @@ -862,10 +862,27 @@ int __devinit ngene_probe(struct pci_dev *pci_dev, void __devexit ngene_remove(struct pci_dev *pdev); int ngene_command(struct ngene *dev, struct ngene_command *com); int ngene_command_gpio_set(struct ngene *dev, u8 select, u8 level); +void set_transfer(struct ngene_channel *chan, int state); +void FillTSBuffer(void *Buffer, int Length, u32 Flags); /* Provided by ngene-i2c.c */ int ngene_i2c_init(struct ngene *dev, int dev_nr); +/* Provided by ngene-dvb.c */ +void *tsout_exchange(void *priv, void *buf, u32 len, u32 clock, u32 flags); +void *tsin_exchange(void *priv, void *buf, u32 len, u32 clock, u32 flags); +int ngene_start_feed(struct dvb_demux_feed *dvbdmxfeed); +int ngene_stop_feed(struct dvb_demux_feed *dvbdmxfeed); +int my_dvb_dmx_ts_card_init(struct dvb_demux *dvbdemux, char *id, + int (*start_feed)(struct dvb_demux_feed *), + int (*stop_feed)(struct dvb_demux_feed *), + void *priv); +int my_dvb_dmxdev_ts_card_init(struct dmxdev *dmxdev, + struct dvb_demux *dvbdemux, + struct dmx_frontend *hw_frontend, + struct dmx_frontend *mem_frontend, + struct dvb_adapter *dvb_adapter); + #endif /* LocalWords: Endif -- cgit v1.2.3 From 1a2f7178cbfeea7045b6cd226319d528f60891b8 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Sun, 21 Mar 2010 17:09:44 -0300 Subject: V4L/DVB: ngene: Add lgdt3303 and mt2131 deps to Kconfig Add the demod and tuner dependencies required for the Avermedia m780 to the Kconfig for the ngene driver. Thanks to Oliver Endriss for pointing this out. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/ngene/Kconfig | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/ngene/Kconfig b/drivers/media/dvb/ngene/Kconfig index 3ec8e6fcbb1..cec242b7c00 100644 --- a/drivers/media/dvb/ngene/Kconfig +++ b/drivers/media/dvb/ngene/Kconfig @@ -4,6 +4,8 @@ config DVB_NGENE select DVB_LNBP21 if !DVB_FE_CUSTOMISE select DVB_STV6110x if !DVB_FE_CUSTOMISE select DVB_STV090x if !DVB_FE_CUSTOMISE + select DVB_LGDT330X if !DVB_FE_CUSTOMISE + select MEDIA_TUNER_MT2131 if !MEDIA_TUNER_CUSTOMISE ---help--- Support for Micronas PCI express cards with nGene bridge. -- cgit v1.2.3 From 83b6601c880d1b908b07952e9a5fdbe5f5c76c96 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Wed, 5 May 2010 02:58:18 -0300 Subject: V4L/DVB: dvb/stv6110x: cleanup error handling The "stv6110x" is NULL so we can just return directly without calling kfree(). Also I changed the printk() to make checkpatch.pl happy. Signed-off-by: Dan Carpenter Reviewed-by: Manu Abraham Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/stv6110x.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/frontends/stv6110x.c b/drivers/media/dvb/frontends/stv6110x.c index 2f9cd244134..42591ce1aaa 100644 --- a/drivers/media/dvb/frontends/stv6110x.c +++ b/drivers/media/dvb/frontends/stv6110x.c @@ -363,8 +363,8 @@ struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe, u8 default_regs[] = {0x07, 0x11, 0xdc, 0x85, 0x17, 0x01, 0xe6, 0x1e}; stv6110x = kzalloc(sizeof (struct stv6110x_state), GFP_KERNEL); - if (stv6110x == NULL) - goto error; + if (!stv6110x) + return NULL; stv6110x->i2c = i2c; stv6110x->config = config; @@ -392,12 +392,8 @@ struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe, fe->tuner_priv = stv6110x; fe->ops.tuner_ops = stv6110x_ops; - printk("%s: Attaching STV6110x \n", __func__); + printk(KERN_INFO "%s: Attaching STV6110x\n", __func__); return stv6110x->devctl; - -error: - kfree(stv6110x); - return NULL; } EXPORT_SYMBOL(stv6110x_attach); -- cgit v1.2.3 From e36309f54a6196792fce74100356ebdeaecabd56 Mon Sep 17 00:00:00 2001 From: matthieu castet Date: Wed, 5 May 2010 15:59:20 -0300 Subject: V4L/DVB: fix dvb frontend lockup If my dvb device is removed while in use, I got the following oops: [ 4920.484084] Call Trace: [ 4920.484102] [] ? default_wake_function+0x0/0x8 [ 4920.484147] [] ? dvb_unregister_frontend+0x95/0xcc [dvb_core] [ 4920.484157] [] ? autoremove_wake_function+0x0/0x2d [ 4920.484168] [] ? dvb_usb_adapter_frontend_exit+0x12/0x21 [dvb_usb] [ 4920.484176] [] ? dvb_usb_exit+0x26/0x88 [dvb_usb] [ 4920.484184] [] ? dvb_usb_device_exit+0x3a/0x4a [dvb_usb] [ 4920.484217] [] ? usb_unbind_interface+0x3f/0xb4 [usbcore] [ 4920.484227] [] ? __device_release_driver+0x74/0xb7 [ 4920.484233] [] ? device_release_driver+0x15/0x1e [ 4920.484243] [] ? bus_remove_device+0x6e/0x87 [ 4920.484249] [] ? device_del+0xfa/0x152 [ 4920.484264] [] ? usb_disable_device+0x59/0xb9 [usbcore] [ 4920.484279] [] ? usb_disconnect+0x70/0xdc [usbcore] [ 4920.484294] [] ? hub_thread+0x521/0xe1d [usbcore] [ 4920.484301] [] ? autoremove_wake_function+0x0/0x2d [ 4920.484316] [] ? hub_thread+0x0/0xe1d [usbcore] [ 4920.484321] [] ? kthread+0x61/0x66 [ 4920.484327] [] ? kthread+0x0/0x66 [ 4920.484336] [] ? kernel_thread_helper+0x7/0x10 If there are users (for example users == -2) : - dvb_unregister_frontend : - stop kernel thread with dvb_frontend_stop : - fepriv->exit = 1; - thread loop catch stop event and break while loop - fepriv->thread = NULL; and fepriv->exit = 0; - dvb_unregister_frontend wait on "fepriv->dvbdev->wait_queue" that fepriv->dvbdev->users==-1. The user finish : - dvb_frontend_release - set users to -1 - don't wait wait_queue because fepriv->exit != 1 => dvb_unregister_frontend never exit the wait queue. Signed-off-by: Matthieu CASTET Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-core/dvb_frontend.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'drivers/media/dvb') diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 55ea260572b..6932def4d26 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -95,6 +95,10 @@ MODULE_PARM_DESC(dvb_mfe_wait_time, "Wait up to seconds on open( * FESTATE_LOSTLOCK. When the lock has been lost, and we're searching it again. */ +#define DVB_FE_NO_EXIT 0 +#define DVB_FE_NORMAL_EXIT 1 +#define DVB_FE_DEVICE_REMOVED 2 + static DEFINE_MUTEX(frontend_mutex); struct dvb_frontend_private { @@ -497,7 +501,7 @@ static int dvb_frontend_is_exiting(struct dvb_frontend *fe) { struct dvb_frontend_private *fepriv = fe->frontend_priv; - if (fepriv->exit) + if (fepriv->exit != DVB_FE_NO_EXIT) return 1; if (fepriv->dvbdev->writers == 1) @@ -559,7 +563,7 @@ restart: if (kthread_should_stop() || dvb_frontend_is_exiting(fe)) { /* got signal or quitting */ - fepriv->exit = 1; + fepriv->exit = DVB_FE_NORMAL_EXIT; break; } @@ -673,7 +677,10 @@ restart: } fepriv->thread = NULL; - fepriv->exit = 0; + if (kthread_should_stop()) + fepriv->exit = DVB_FE_DEVICE_REMOVED; + else + fepriv->exit = DVB_FE_NO_EXIT; mb(); dvb_frontend_wakeup(fe); @@ -686,7 +693,7 @@ static void dvb_frontend_stop(struct dvb_frontend *fe) dprintk ("%s\n", __func__); - fepriv->exit = 1; + fepriv->exit = DVB_FE_NORMAL_EXIT; mb(); if (!fepriv->thread) @@ -755,7 +762,7 @@ static int dvb_frontend_start(struct dvb_frontend *fe) dprintk ("%s\n", __func__); if (fepriv->thread) { - if (!fepriv->exit) + if (fepriv->exit == DVB_FE_NO_EXIT) return 0; else dvb_frontend_stop (fe); @@ -767,7 +774,7 @@ static int dvb_frontend_start(struct dvb_frontend *fe) return -EINTR; fepriv->state = FESTATE_IDLE; - fepriv->exit = 0; + fepriv->exit = DVB_FE_NO_EXIT; fepriv->thread = NULL; mb(); @@ -1490,7 +1497,7 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, dprintk("%s (%d)\n", __func__, _IOC_NR(cmd)); - if (fepriv->exit) + if (fepriv->exit != DVB_FE_NO_EXIT) return -ENODEV; if ((file->f_flags & O_ACCMODE) == O_RDONLY && @@ -1916,6 +1923,8 @@ static int dvb_frontend_open(struct inode *inode, struct file *file) int ret; dprintk ("%s\n", __func__); + if (fepriv->exit == DVB_FE_DEVICE_REMOVED) + return -ENODEV; if (adapter->mfe_shared) { mutex_lock (&adapter->mfe_lock); @@ -2008,7 +2017,7 @@ static int dvb_frontend_release(struct inode *inode, struct file *file) ret = dvb_generic_release (inode, file); if (dvbdev->users == -1) { - if (fepriv->exit == 1) { + if (fepriv->exit != DVB_FE_NO_EXIT) { fops_put(file->f_op); file->f_op = NULL; wake_up(&dvbdev->wait_queue); -- cgit v1.2.3