From patchwork Wed Apr 29 16:36:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olli Salonen X-Patchwork-Id: 6297091 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4D4209F32B for ; Wed, 29 Apr 2015 16:37:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 829D52015E for ; Wed, 29 Apr 2015 16:37:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 79492201C0 for ; Wed, 29 Apr 2015 16:37:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932892AbbD2Qh0 (ORCPT ); Wed, 29 Apr 2015 12:37:26 -0400 Received: from mail-lb0-f182.google.com ([209.85.217.182]:34766 "EHLO mail-lb0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753636AbbD2QhW (ORCPT ); Wed, 29 Apr 2015 12:37:22 -0400 Received: by lbcga7 with SMTP id ga7so24701194lbc.1 for ; Wed, 29 Apr 2015 09:37:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=YDsy1SixoDIbfWsBp9hd2eHJi9qBRz8wThnkXAxTJvs=; b=CI7z5pmHA/Va/DgWyAzZ6xutHRGnoOaIjLWvC3veGvmMYaxx6NI6RPAY6DrNk/EZnM JDzj95hYETLT/Z8/wYK3SH/dodxfTRk8XBVX1/Vn+ONmnZNdlYc1FA9+MBYsaCbnUw8W r4SWLvdEb2QVKC18OlPn4j2gqzdvAlNYHcm1rYgdH/kq4g55WhJnXS/SOaIvlV9oJBtW Huu8Prwgem0Vye+Pz7gg3qpvazS9tWzYyAqIxrq4/qL4cNwvZb55VVPp84YFbw76jBcH WWQ4Ol2lBap/nsLHMAP04v/AcmLLorZkx6D6Ti+i2CNkxR5C4dcoP9ZAsRjouAxhcYbw PE9w== X-Gm-Message-State: ALoCoQkxFB04QP/CuDBax3YW61iD6ioB24xGvwtQsKpAFANWnjpsISMpYiTI3BWqIN9MMzGcBCt3 X-Received: by 10.112.148.101 with SMTP id tr5mr20253389lbb.0.1430325441181; Wed, 29 Apr 2015 09:37:21 -0700 (PDT) Received: from dl160.lan (188-67-118-178.bb.dnainternet.fi. [188.67.118.178]) by mx.google.com with ESMTPSA id s5sm6484936lbr.18.2015.04.29.09.37.19 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Apr 2015 09:37:20 -0700 (PDT) From: Olli Salonen To: linux-media@vger.kernel.org Cc: Olli Salonen Subject: [PATCHv2 4/5] rtl28xxu: add I2C read without write Date: Wed, 29 Apr 2015 19:36:53 +0300 Message-Id: <1430325414-9977-4-git-send-email-olli.salonen@iki.fi> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1430325414-9977-1-git-send-email-olli.salonen@iki.fi> References: <1430325414-9977-1-git-send-email-olli.salonen@iki.fi> 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.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Add support for I2C read operation without a preceeding write. While here, change the error code to EOPNOTSUPP in case an unsupported I2C operation is attempted. Signed-off-by: Olli Salonen --- drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c index f1a7613..5e0c015 100644 --- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c @@ -232,8 +232,14 @@ static int rtl28xxu_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], req.data = msg[0].buf; ret = rtl28xxu_ctrl_msg(d, &req); } + } else if (num == 1 && (msg[0].flags & I2C_M_RD)) { + req.value = (msg[0].addr << 1); + req.index = CMD_I2C_DA_RD; + req.size = msg[0].len; + req.data = msg[0].buf; + ret = rtl28xxu_ctrl_msg(d, &req); } else { - ret = -EINVAL; + ret = -EOPNOTSUPP; } err_mutex_unlock: