From patchwork Tue Nov 12 15:59:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Alves X-Patchwork-Id: 3173591 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CFA9BC045B for ; Tue, 12 Nov 2013 15:59:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 24F18205B1 for ; Tue, 12 Nov 2013 15:59:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8355F205AD for ; Tue, 12 Nov 2013 15:59:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753098Ab3KLP7q (ORCPT ); Tue, 12 Nov 2013 10:59:46 -0500 Received: from mail-wg0-f44.google.com ([74.125.82.44]:62089 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752556Ab3KLP7q (ORCPT ); Tue, 12 Nov 2013 10:59:46 -0500 Received: by mail-wg0-f44.google.com with SMTP id k14so4458199wgh.11 for ; Tue, 12 Nov 2013 07:59:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=kF1skXmJsxmo3L0Q5Phno51EVeGRJ66RAYlrd74xXUE=; b=R6L1WF5kGGdG5e+HC1Dazdju2JCNkb6lpVZXYmPc2GShDfkd6RXtqlin6p1u9CWE1s IT5Ia5+/mdR9Y0QVIp6nWgGDTXP85od3NVrUIQ1I8zfjrLJc2VJ8ROhouXWwbdN99XAF Id0htssB9eLl27y7HWwWuxOokI6EcgYT8yTcKUpWESHpyWXp8PxtameOwM/WbPu+JGUS A/bbmE/HuGIbTVJiN0x75/M8wIDggIArZ0jrUZXj9R8Xh7TaTpv92KUL2TXIlNkTJoUL Bnex/1tzRzFCEhZsPwdp9KXwC0hEhDNd0/m3P8rqrmWgaBYUo0Bqp3PlV/28pOOasGVs 0gbA== X-Received: by 10.180.39.140 with SMTP id p12mr16873675wik.12.1384271985073; Tue, 12 Nov 2013 07:59:45 -0800 (PST) Received: from localhost.localdomain (a89-152-209-152.cpe.netcabo.pt. [89.152.209.152]) by mx.google.com with ESMTPSA id gm2sm12149588wib.4.2013.11.12.07.59.43 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 12 Nov 2013 07:59:44 -0800 (PST) From: Luis Alves To: linux-media@vger.kernel.org Cc: mkrufky@linuxtv.org, mchehab@infradead.org, pboettcher@kernellabs.com, ljalvs@gmail.com Subject: [PATCH 2/2] cx24117: Fix LNB set_voltage function. Date: Tue, 12 Nov 2013 15:59:40 +0000 Message-Id: <1384271980-23867-1-git-send-email-ljalvs@gmail.com> X-Mailer: git-send-email 1.8.3.2 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, This patch should fix/enhance the set_voltage function for the cx24117 demod. Regards, Luis Signed-off-by: Luis Alves --- drivers/media/dvb-frontends/cx24117.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/drivers/media/dvb-frontends/cx24117.c b/drivers/media/dvb-frontends/cx24117.c index a6fe1af..68f768a 100644 --- a/drivers/media/dvb-frontends/cx24117.c +++ b/drivers/media/dvb-frontends/cx24117.c @@ -917,22 +917,15 @@ static int cx24117_set_voltage(struct dvb_frontend *fe, voltage == SEC_VOLTAGE_18 ? "SEC_VOLTAGE_18" : "SEC_VOLTAGE_OFF"); - /* Set GPIO direction */ - cmd.args[0] = CMD_SET_GPIODIR; - cmd.args[1] = reg; - cmd.args[2] = reg; + /* Prepare a set GPIO logic level CMD */ + cmd.args[0] = CMD_SET_GPIOOUT; + cmd.args[2] = reg; /* mask */ cmd.len = 3; - ret = cx24117_cmd_execute(fe, &cmd); - if (ret) - return ret; if ((voltage == SEC_VOLTAGE_13) || (voltage == SEC_VOLTAGE_18)) { - /* Set GPIO logic level */ - cmd.args[0] = CMD_SET_GPIOOUT; + /* power on LNB */ cmd.args[1] = reg; - cmd.args[2] = reg; - cmd.len = 3; ret = cx24117_cmd_execute(fe, &cmd); if (ret != 0) return ret; @@ -949,17 +942,17 @@ static int cx24117_set_voltage(struct dvb_frontend *fe, cmd.args[1] = state->demod ? 0 : 1; cmd.args[2] = (voltage == SEC_VOLTAGE_18 ? 0x01 : 0x00); cmd.len = 3; + ret = cx24117_cmd_execute(fe, &cmd); /* Min delay time before DiSEqC send */ msleep(20); } else { - cmd.args[0] = CMD_SET_GPIOOUT; + /* power off LNB */ cmd.args[1] = 0x00; - cmd.args[2] = reg; - cmd.len = 3; + ret = cx24117_cmd_execute(fe, &cmd); } - return cx24117_cmd_execute(fe, &cmd); + return ret; } static int cx24117_set_tone(struct dvb_frontend *fe, @@ -1277,6 +1270,16 @@ static int cx24117_initfe(struct dvb_frontend *fe) cmd.args[2] = CX24117_OCC; cmd.len = 3; ret = cx24117_cmd_execute_nolock(fe, &cmd); + if (ret != 0) + goto exit; + + /* Set GPIO direction */ + /* Set as output - controls LNB power on/off */ + cmd.args[0] = CMD_SET_GPIODIR; + cmd.args[1] = 0x30; + cmd.args[2] = 0x30; + cmd.len = 3; + ret = cx24117_cmd_execute_nolock(fe, &cmd); exit: mutex_unlock(&state->priv->fe_lock);