From patchwork Wed Mar 29 16:43:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 9651975 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9265D602C8 for ; Wed, 29 Mar 2017 16:43:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84FEF2845F for ; Wed, 29 Mar 2017 16:43:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79E4E28497; Wed, 29 Mar 2017 16:43:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 204022845F for ; Wed, 29 Mar 2017 16:43:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753422AbdC2Qnl (ORCPT ); Wed, 29 Mar 2017 12:43:41 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:36668 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932160AbdC2Qn2 (ORCPT ); Wed, 29 Mar 2017 12:43:28 -0400 Received: by mail-wr0-f195.google.com with SMTP id k6so3304060wre.3 for ; Wed, 29 Mar 2017 09:43:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=myhvs823Qcm4SVlAWp7JFJaUt9oUO+h0ByxXy+314bU=; b=XUpLloztYUFZeiZ04Z2WVvaxeaVrNfAd1fkafwoppn9SEExutb0jhMlea4GUYYIXCn IPKJ3FEpCqzkAQfcg9tzexMiSWG5TClADp+mmezYy9XZ0dMpkgsJtEsFpVl/y9+tcCam c6aAHXG3REu2V4Z63wuRCvuO3AXeUsgNSJc1mC+njzd6eliV7hyXM8Z/Xljt9lcZh6v5 JHUU+oak2xNIEeDB92BuyNsn374hPnakBAIa1wUTh8pei2E0RYH6Eg8VfHFjk8jnK2Ph qJCmrd5LqzIx/TwUOwXUHs5praZpM8+SxD7H/moXYXSQvhtIhg1N+2izeSEPS/Q/DniF 5Ppw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=myhvs823Qcm4SVlAWp7JFJaUt9oUO+h0ByxXy+314bU=; b=QmNaW+ov7chxFY/07mIWFE7SnzfLXoL4WCpP9VZ7CDVTwXrKnLDL2jw0D6O8Aluy1c 0Tsxli6YImRMdnHEgB0KZoeRkrVuLRV8slazOIK7Y/JvBkbLL9oxgdQ8hrnUg8GrrxS+ fmbQCRUGDQ1Tk1fWaLzC/0vtTb1m1S4f1vFahDbRCVEmsyXSe6PO2HG3O3GjRnbHMgix 6dFua5FHQ4Z8W7eqZ1dcdyTkVFnjkCceRMbAQzy7xptK4GcTRM4A9+ACRJeEXmvxnPoo 63xmSO/iia9YR72/kynqi7lrVbhT67X/gTW+ZTAmkCvGViEA7nxbAaWt03drWI57Sdaq 65Sg== X-Gm-Message-State: AFeK/H3hykv7gp2zcdQYLeleK8tlNPdHZ+7yV2DGFqrR72Jmxkl7qxzXGHgfLOGNkTaVtg== X-Received: by 10.28.172.7 with SMTP id v7mr2341438wme.78.1490805806201; Wed, 29 Mar 2017 09:43:26 -0700 (PDT) Received: from dvbdev.wuest.de (ip-37-24-178-151.hsi14.unitymediagroup.de. [37.24.178.151]) by smtp.gmail.com with ESMTPSA id x127sm8835277wmf.31.2017.03.29.09.43.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Mar 2017 09:43:25 -0700 (PDT) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org Cc: liplianin@netup.ru, rjkm@metzlerbros.de, crope@iki.fi Subject: [PATCH v3 12/13] [media] ddbridge: add i2c_read_regs() Date: Wed, 29 Mar 2017 18:43:12 +0200 Message-Id: <20170329164313.14636-13-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170329164313.14636-1-d.scheller.oss@gmail.com> References: <20170329164313.14636-1-d.scheller.oss@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Daniel Scheller Adds new i2c_read_regs() function and make i2c_read_reg() wrap into this with len=1. Required for the tuner_tda18212_ping() and XO2 handling functions (part of the Sony CXD28xx support patch series). Signed-off-by: Daniel Scheller --- drivers/media/pci/ddbridge/ddbridge-core.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index 340cff0..acb9cbe 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -54,15 +54,21 @@ static int i2c_read(struct i2c_adapter *adapter, u8 adr, u8 *val) return (i2c_transfer(adapter, msgs, 1) == 1) ? 0 : -1; } -static int i2c_read_reg(struct i2c_adapter *adapter, u8 adr, u8 reg, u8 *val) +static int i2c_read_regs(struct i2c_adapter *adapter, + u8 adr, u8 reg, u8 *val, u8 len) { struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0, .buf = ®, .len = 1 }, {.addr = adr, .flags = I2C_M_RD, - .buf = val, .len = 1 } }; + .buf = val, .len = len } }; return (i2c_transfer(adapter, msgs, 2) == 2) ? 0 : -1; } +static int i2c_read_reg(struct i2c_adapter *adapter, u8 adr, u8 reg, u8 *val) +{ + return i2c_read_regs(adapter, adr, reg, val, 1); +} + static int i2c_read_reg16(struct i2c_adapter *adapter, u8 adr, u16 reg, u8 *val) {