From patchwork Thu Apr 23 21:11:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olli Salonen X-Patchwork-Id: 6265351 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A1A21BF4A7 for ; Thu, 23 Apr 2015 21:12:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C29F6203AD for ; Thu, 23 Apr 2015 21:12:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F1FC1201C8 for ; Thu, 23 Apr 2015 21:11:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031274AbbDWVL4 (ORCPT ); Thu, 23 Apr 2015 17:11:56 -0400 Received: from mail-lb0-f178.google.com ([209.85.217.178]:36715 "EHLO mail-lb0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031261AbbDWVLp (ORCPT ); Thu, 23 Apr 2015 17:11:45 -0400 Received: by lbbqq2 with SMTP id qq2so22761666lbb.3 for ; Thu, 23 Apr 2015 14:11:44 -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=lbaI+Rz9XNCUr/izdPdLNFUBd62XOT4pPF8ipfaNVw/PrYeTXmHXJLjIpFv50gmgAW tDPO2aIyWROmMRIwt8l8b3sJUdoucmgZCuUTzkvy1ewQCiLhZUhgYOzffCf2tZqei8Kd WK5mb1WE+t1HxWkNwh+ow70Rr/iisF9LOB7G9eUGH8ErW3JsEK1tKdLoxiaWM5uIQetN Ey2XO0+8La/e0Tp0Y5t9eEUbhBbvXQSClDWpQapxkEUVjwJGrBX6Su9tMrao5pqR2sre pjXs/V5E2DAqs/Yon4MARMafikK3aP4npD/Ceu0i4k7Q1iO4xOjXqpwZUW8amzD8kbH5 J+yw== X-Gm-Message-State: ALoCoQmiwKnr41i33Wy6wd5qhFOL5UhBxMhhiIlKY4G882lSqqrvJ7FE/UQd9ZMQP90cVEozmhUc X-Received: by 10.112.42.233 with SMTP id r9mr2672215lbl.58.1429823504470; Thu, 23 Apr 2015 14:11:44 -0700 (PDT) Received: from dl160.lan (188-67-88-189.bb.dnainternet.fi. [188.67.88.189]) by mx.google.com with ESMTPSA id i3sm2121712lbs.21.2015.04.23.14.11.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 23 Apr 2015 14:11:43 -0700 (PDT) From: Olli Salonen To: linux-media@vger.kernel.org Cc: Olli Salonen Subject: [PATCH 11/12] rtl28xxu: add I2C read without write Date: Fri, 24 Apr 2015 00:11:10 +0300 Message-Id: <1429823471-21835-11-git-send-email-olli.salonen@iki.fi> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1429823471-21835-1-git-send-email-olli.salonen@iki.fi> References: <1429823471-21835-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=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 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: