From patchwork Mon Aug 13 02:27:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antti Palosaari X-Patchwork-Id: 1310801 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id E898ADF280 for ; Mon, 13 Aug 2012 02:28:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752719Ab2HMC17 (ORCPT ); Sun, 12 Aug 2012 22:27:59 -0400 Received: from mail.kapsi.fi ([217.30.184.167]:59524 "EHLO mail.kapsi.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752270Ab2HMC16 (ORCPT ); Sun, 12 Aug 2012 22:27:58 -0400 Received: from dyn3-82-128-186-179.psoas.suomi.net ([82.128.186.179] helo=localhost.localdomain) by mail.kapsi.fi with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1T0kNo-0006ML-T4; Mon, 13 Aug 2012 05:27:56 +0300 From: Antti Palosaari To: linux-media@vger.kernel.org Cc: Antti Palosaari Subject: [PATCH 2/2] rtl28xxu: generalize streaming control Date: Mon, 13 Aug 2012 05:27:08 +0300 Message-Id: <1344824828-2207-2-git-send-email-crope@iki.fi> X-Mailer: git-send-email 1.7.11.2 In-Reply-To: <1344824828-2207-1-git-send-email-crope@iki.fi> References: <1344824828-2207-1-git-send-email-crope@iki.fi> X-SA-Exim-Connect-IP: 82.128.186.179 X-SA-Exim-Mail-From: crope@iki.fi X-SA-Exim-Scanned: No (on mail.kapsi.fi); SAEximRunCond expanded to false Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Move rtl2831u LED from streaming control to power control. It changes LED behavior slightly but who cares :) After that same streaming control can be used for both rtl2831u and rtl2832u. Signed-off-by: Antti Palosaari --- drivers/media/dvb/dvb-usb-v2/rtl28xxu.c | 44 ++++----------------------------- 1 file changed, 5 insertions(+), 39 deletions(-) diff --git a/drivers/media/dvb/dvb-usb-v2/rtl28xxu.c b/drivers/media/dvb/dvb-usb-v2/rtl28xxu.c index 493d531..a2d1e5b 100644 --- a/drivers/media/dvb/dvb-usb-v2/rtl28xxu.c +++ b/drivers/media/dvb/dvb-usb-v2/rtl28xxu.c @@ -823,43 +823,7 @@ err: return ret; } -static int rtl2831u_streaming_ctrl(struct dvb_frontend *fe , int onoff) -{ - int ret; - u8 buf[2], gpio; - struct dvb_usb_device *d = fe_to_d(fe); - - dev_dbg(&d->udev->dev, "%s: onoff=%d\n", __func__, onoff); - - ret = rtl28xx_rd_reg(d, SYS_GPIO_OUT_VAL, &gpio); - if (ret) - goto err; - - if (onoff) { - buf[0] = 0x00; - buf[1] = 0x00; - gpio |= 0x04; /* LED on */ - } else { - buf[0] = 0x10; /* stall EPA */ - buf[1] = 0x02; /* reset EPA */ - gpio &= (~0x04); /* LED off */ - } - - ret = rtl28xx_wr_reg(d, SYS_GPIO_OUT_VAL, gpio); - if (ret) - goto err; - - ret = rtl28xx_wr_regs(d, USB_EPA_CTL, buf, 2); - if (ret) - goto err; - - return ret; -err: - dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret); - return ret; -} - -static int rtl2832u_streaming_ctrl(struct dvb_frontend *fe , int onoff) +static int rtl28xxu_streaming_ctrl(struct dvb_frontend *fe , int onoff) { int ret; u8 buf[2]; @@ -908,11 +872,13 @@ static int rtl2831u_power_ctrl(struct dvb_usb_device *d, int onoff) if (onoff) { gpio |= 0x01; /* GPIO0 = 1 */ gpio &= (~0x10); /* GPIO4 = 0 */ + gpio |= 0x04; /* GPIO2 = 1, LED on */ sys0 = sys0 & 0x0f; sys0 |= 0xe0; } else { gpio &= (~0x01); /* GPIO0 = 0 */ gpio |= 0x10; /* GPIO4 = 1 */ + gpio &= (~0x04); /* GPIO2 = 1, LED off */ sys0 = sys0 & (~0xc0); } @@ -1224,7 +1190,7 @@ static const struct dvb_usb_device_properties rtl2831u_props = { .tuner_attach = rtl2831u_tuner_attach, .init = rtl28xxu_init, .get_rc_config = rtl2831u_get_rc_config, - .streaming_ctrl = rtl2831u_streaming_ctrl, + .streaming_ctrl = rtl28xxu_streaming_ctrl, .num_adapters = 1, .adapter = { @@ -1246,7 +1212,7 @@ static const struct dvb_usb_device_properties rtl2832u_props = { .tuner_attach = rtl2832u_tuner_attach, .init = rtl28xxu_init, .get_rc_config = rtl2832u_get_rc_config, - .streaming_ctrl = rtl2832u_streaming_ctrl, + .streaming_ctrl = rtl28xxu_streaming_ctrl, .num_adapters = 1, .adapter = {