From patchwork Sat Feb 5 18:20:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 534231 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p15ILPQ7007614 for ; Sat, 5 Feb 2011 18:21:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753271Ab1BESVA (ORCPT ); Sat, 5 Feb 2011 13:21:00 -0500 Received: from mail.pripojeni.net ([217.66.174.14]:52685 "EHLO smtp.pripojeni.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752761Ab1BESU7 (ORCPT ); Sat, 5 Feb 2011 13:20:59 -0500 Received: from anemoi.localdomain ([217.66.174.142]) by smtp.pripojeni.net (Kerio Connect 7.1.1); Sat, 5 Feb 2011 19:20:48 +0100 From: Jiri Slaby To: mchehab@infradead.org Cc: jirislaby@gmail.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 1/1] DVB-USB: dib0700, fix oops with non-dib7000pc devices Date: Sat, 5 Feb 2011 19:20:47 +0100 Message-Id: <1296930047-22689-1-git-send-email-jslaby@suse.cz> X-Mailer: git-send-email 1.7.3.2 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 05 Feb 2011 18:21:25 +0000 (UTC) diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index c6022af..23fe0c3 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c @@ -80,6 +80,9 @@ static struct dib3000mc_config bristol_dib3000mc_config[2] = { } }; +static int stk70x0m_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff); +static int stk70x0m_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff); + static int bristol_frontend_attach(struct dvb_usb_adapter *adap) { struct dib0700_state *st = adap->dev->priv; @@ -686,8 +689,11 @@ static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap) if (dib7000pc_detection(&adap->dev->i2c_adap)) { adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config); st->is_dib7000pc = 1; - } else + } else { adap->fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config); + adap->props.pid_filter = stk70x0m_pid_filter; + adap->props.pid_filter_ctrl = stk70x0m_pid_filter_ctrl; + } return adap->fe == NULL ? -ENODEV : 0; } @@ -882,6 +888,16 @@ static int stk70x0p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff) return dib7000p_pid_filter_ctrl(adapter->fe, onoff); } +static int stk70x0m_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff) +{ + return dib7000m_pid_filter(adapter->fe, index, pid, onoff); +} + +static int stk70x0m_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff) +{ + return dib7000m_pid_filter_ctrl(adapter->fe, onoff); +} + static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = { 60000, 15000, 1, 20, 3, 1, 0, diff --git a/drivers/media/dvb/frontends/dib7000m.c b/drivers/media/dvb/frontends/dib7000m.c index c7f5ccf..90d9411 100644 --- a/drivers/media/dvb/frontends/dib7000m.c +++ b/drivers/media/dvb/frontends/dib7000m.c @@ -1372,6 +1372,25 @@ error: } EXPORT_SYMBOL(dib7000m_attach); +int dib7000m_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff) +{ + struct dib7000m_state *state = fe->demodulator_priv; + u16 val = dib7000m_read_word(state, 235) & 0xffef; + val |= (onoff & 0x1) << 4; + dprintk("PID filter enabled %d", onoff); + return dib7000m_write_word(state, 235, val); +} +EXPORT_SYMBOL(dib7000m_pid_filter_ctrl); + +int dib7000m_pid_filter(struct dvb_frontend *fe, u8 id, u16 pid, u8 onoff) +{ + struct dib7000m_state *state = fe->demodulator_priv; + dprintk("PID filter: index %x, PID %d, OnOff %d", id, pid, onoff); + return dib7000m_write_word(state, 241 + id, + onoff ? (1 << 13) | pid : 0); +} +EXPORT_SYMBOL(dib7000m_pid_filter); + static struct dvb_frontend_ops dib7000m_ops = { .info = { .name = "DiBcom 7000MA/MB/PA/PB/MC", diff --git a/drivers/media/dvb/frontends/dib7000m.h b/drivers/media/dvb/frontends/dib7000m.h index 113819c..3353f5a 100644 --- a/drivers/media/dvb/frontends/dib7000m.h +++ b/drivers/media/dvb/frontends/dib7000m.h @@ -46,6 +46,8 @@ extern struct dvb_frontend *dib7000m_attach(struct i2c_adapter *i2c_adap, extern struct i2c_adapter *dib7000m_get_i2c_master(struct dvb_frontend *, enum dibx000_i2c_interface, int); +extern int dib7000m_pid_filter(struct dvb_frontend *, u8 id, u16 pid, u8 onoff); +extern int dib7000m_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff); #else static inline struct dvb_frontend *dib7000m_attach(struct i2c_adapter *i2c_adap, @@ -63,6 +65,20 @@ struct i2c_adapter *dib7000m_get_i2c_master(struct dvb_frontend *demod, printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); return NULL; } + +static inline int dib7000m_pid_filter(struct dvb_frontend *fe, u8 id, u16 pid, + u8 onoff) +{ + printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); + return -ENODEV; +} + +static inline int dib7000m_pid_filter_ctrl(struct dvb_frontend *fe, + uint8_t onoff) +{ + printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); + return -ENODEV; +} #endif /* TODO