From patchwork Sat Apr 2 21:59:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Malcolm Priestley X-Patchwork-Id: 683921 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 p32Lxq8V012422 for ; Sat, 2 Apr 2011 21:59:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757214Ab1DBV7j (ORCPT ); Sat, 2 Apr 2011 17:59:39 -0400 Received: from mail-ww0-f44.google.com ([74.125.82.44]:58348 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757114Ab1DBV7j (ORCPT ); Sat, 2 Apr 2011 17:59:39 -0400 Received: by wwa36 with SMTP id 36so5252405wwa.1 for ; Sat, 02 Apr 2011 14:59:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:subject:from:to:content-type:date:message-id :mime-version:x-mailer:content-transfer-encoding; bh=ET7HztX4f7nVBBM34cdU0xngdGdxUPrix4bxuLtiWBc=; b=rUwK3arAVVgPx8WM7MBFSjAuJcGWuxmttfg68HGEuYR8693RMbitFmuSDJjPIIpO2g MMWaqvX/zJX7kOAtimTSvKYQ365kUVyUD7QWt9LYHeiaQr03dNrwe4hqyuZUOMNaj0Uj mRaKT/1D2XRUjSnD9MWpzeEopH/gNfZ3Bm5H0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; b=PMo+QjJz9MD+qGVeazc+GR9YZAXCLKJiVAlV4U5kPQjhUDxG9KneNH0gdEGjE6C1fi NvCP4Oy+xH1rDnnTmyEOFTWj9fbV+LyEo79scTZJH5k77Te47TJk4Mz1u5FSIVc7EDDQ hIflrVriRIae30namYmlib3HGn8/UwNDe1N00= Received: by 10.216.145.221 with SMTP id p71mr2540476wej.9.1301781577589; Sat, 02 Apr 2011 14:59:37 -0700 (PDT) Received: from [10.64.64.65] (92.41.251.231.threembb.co.uk [92.41.251.231]) by mx.google.com with ESMTPS id bs4sm2040662wbb.1.2011.04.02.14.59.35 (version=SSLv3 cipher=OTHER); Sat, 02 Apr 2011 14:59:36 -0700 (PDT) Subject: [PATCH] DM04/QQBOX v1.84 added PID filter From: Malcolm Priestley To: linux-media@vger.kernel.org Date: Sat, 02 Apr 2011 22:59:29 +0100 Message-ID: <1301781569.10763.3.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.32.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, 02 Apr 2011 21:59:52 +0000 (UTC) A greatly simplified version of the PID Filter now added back to the Driver. The driver allows for the PID filter to be turned off. applied after patch 683781. Signed-off-by: Malcolm Priestley --- drivers/media/dvb/dvb-usb/lmedm04.c | 87 +++++++++++++++++++++++++++++++++- drivers/media/dvb/dvb-usb/lmedm04.h | 1 + 2 files changed, 85 insertions(+), 3 deletions(-) diff --git a/drivers/media/dvb/dvb-usb/lmedm04.c b/drivers/media/dvb/dvb-usb/lmedm04.c index ec0f5a7..4e5c521 100644 --- a/drivers/media/dvb/dvb-usb/lmedm04.c +++ b/drivers/media/dvb/dvb-usb/lmedm04.c @@ -62,8 +62,6 @@ * LME2510: SHARP:BS2F7HZ0194(MV0194) cannot cold reset and share system * with other tuners. After a cold reset streaming will not start. * - * PID functions have been removed from this driver version due to - * problems with different firmware and application versions. */ #define DVB_USB_LOG_PREFIX "LME2510(C)" #include @@ -104,6 +102,10 @@ static int dvb_usb_lme2510_firmware; module_param_named(firmware, dvb_usb_lme2510_firmware, int, 0644); MODULE_PARM_DESC(firmware, "set default firmware 0=Sharp7395 1=LG"); +static int pid_filter; +module_param_named(pid, pid_filter, int, 0644); +MODULE_PARM_DESC(pid, "set default 0=on 1=off"); + DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); @@ -216,6 +218,38 @@ static int lme2510_remote_keypress(struct dvb_usb_adapter *adap, u32 keypress) return 0; } +static int lme2510_enable_pid(struct dvb_usb_device *d, u8 index, u16 pid_out) +{ + struct lme2510_state *st = d->priv; + static u8 pid_buff[] = LME_ZERO_PID; + static u8 rbuf[1]; + u8 pid_no = index * 2; + int ret = 0; + deb_info(1, "PID Setting Pid %04x", pid_out); + + pid_buff[2] = pid_no; + pid_buff[3] = (u8)pid_out & 0xff; + pid_buff[4] = pid_no + 1; + pid_buff[5] = (u8)(pid_out >> 8); + + /* wait for i2c mutex */ + ret = mutex_lock_interruptible(&d->i2c_mutex); + if (ret < 0) { + ret = -EAGAIN; + return ret; + } + + ret |= lme2510_usb_talk(d, pid_buff , + sizeof(pid_buff) , rbuf, sizeof(rbuf)); + + if (st->stream_on & 1) + ret |= lme2510_stream_restart(d); + + mutex_unlock(&d->i2c_mutex); + + return ret; +} + static void lme2510_int_response(struct urb *lme_urb) { struct dvb_usb_adapter *adap = lme_urb->context; @@ -326,6 +360,41 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap) return 0; } +static int lme2510_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff) +{ + static u8 clear_pid_reg[] = LME_CLEAR_PID; + static u8 rbuf[1]; + int ret = 0; + + deb_info(1, "PID Clearing Filter"); + + ret = mutex_lock_interruptible(&adap->dev->i2c_mutex); + + if (!onoff) + ret |= lme2510_usb_talk(adap->dev, clear_pid_reg, + sizeof(clear_pid_reg), rbuf, sizeof(rbuf)); + + mutex_unlock(&adap->dev->i2c_mutex); + + return 0; +} + +static int lme2510_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, + int onoff) +{ + int ret = 0; + + deb_info(3, "%s PID=%04x Index=%04x onoff=%02x", __func__, + pid, index, onoff); + + if (onoff) + if (!pid_filter) + ret = lme2510_enable_pid(adap->dev, index, pid); + + return ret; +} + + static int lme2510_return_status(struct usb_device *dev) { int ret = 0; @@ -1088,7 +1157,13 @@ static struct dvb_usb_device_properties lme2510_properties = { .num_adapters = 1, .adapter = { { + .caps = DVB_USB_ADAP_HAS_PID_FILTER| + DVB_USB_ADAP_NEED_PID_FILTERING| + DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, .streaming_ctrl = lme2510_streaming_ctrl, + .pid_filter_count = 15, + .pid_filter = lme2510_pid_filter, + .pid_filter_ctrl = lme2510_pid_filter_ctrl, .frontend_attach = dm04_lme2510_frontend_attach, .tuner_attach = dm04_lme2510_tuner, /* parameter for the MPEG2-data transfer */ @@ -1124,7 +1199,13 @@ static struct dvb_usb_device_properties lme2510c_properties = { .num_adapters = 1, .adapter = { { + .caps = DVB_USB_ADAP_HAS_PID_FILTER| + DVB_USB_ADAP_NEED_PID_FILTERING| + DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, .streaming_ctrl = lme2510_streaming_ctrl, + .pid_filter_count = 15, + .pid_filter = lme2510_pid_filter, + .pid_filter_ctrl = lme2510_pid_filter_ctrl, .frontend_attach = dm04_lme2510_frontend_attach, .tuner_attach = dm04_lme2510_tuner, /* parameter for the MPEG2-data transfer */ @@ -1222,5 +1303,5 @@ module_exit(lme2510_module_exit); MODULE_AUTHOR("Malcolm Priestley "); MODULE_DESCRIPTION("LME2510(C) DVB-S USB2.0"); -MODULE_VERSION("1.81"); +MODULE_VERSION("1.84"); MODULE_LICENSE("GPL"); diff --git a/drivers/media/dvb/dvb-usb/lmedm04.h b/drivers/media/dvb/dvb-usb/lmedm04.h index 3a30ab1..ab21e2e 100644 --- a/drivers/media/dvb/dvb-usb/lmedm04.h +++ b/drivers/media/dvb/dvb-usb/lmedm04.h @@ -40,6 +40,7 @@ */ #define LME_ST_ON_W {0x06, 0x00} #define LME_CLEAR_PID {0x03, 0x02, 0x20, 0xa0} +#define LME_ZERO_PID {0x03, 0x06, 0x00, 0x00, 0x01, 0x00, 0x20, 0x9c} /* LNB Voltage * 07 XX XX