From patchwork Tue May 5 16:54:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olli Salonen X-Patchwork-Id: 6339921 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 D31AF9F1C2 for ; Tue, 5 May 2015 16:55:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1E189201F4 for ; Tue, 5 May 2015 16:55:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3CB0B201F2 for ; Tue, 5 May 2015 16:55:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030646AbbEEQyy (ORCPT ); Tue, 5 May 2015 12:54:54 -0400 Received: from mail-la0-f53.google.com ([209.85.215.53]:35483 "EHLO mail-la0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030483AbbEEQyv (ORCPT ); Tue, 5 May 2015 12:54:51 -0400 Received: by labbd9 with SMTP id bd9so132577170lab.2 for ; Tue, 05 May 2015 09:54:48 -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=welaYX6dITXoT7H7uh8GRnYeACR2JFP1FUxZKP+YCj0=; b=EVLpRaDCLVyMUGK7uWs5W41YKZZIsudwylMptPk0xabhIuBTfagiZUnkA2Yobzeh/t ZAuvVtYgVEDv5fqKGc9Je8v4ys5Bw3sXDTJXO7LwI2meMRMEwqshk21fL1O1Z6hXFpKn PiCpVC3VHDWKBqq1xZV8AJqar4QgvzOpCl1h0eT0aWDOUuxDCmSUoLghNMENVqa3jnVz eGmOgWNEUe6JHDCvngpYNlkJPNUKlfloJsK/hMTO365Su9pP3lOtYciIzyw34nh3md8e tvBGweFiwhDafwvgJCuVi9PUXdXDcgAWhCKIOxUV7WonIWreLUPncJEz+f+hBHI9MWch oz3w== X-Gm-Message-State: ALoCoQksCkYwsWzC17HK6oEsOan2snNSlP9Bcsv890yOV3DMVMor4+j9YnGQxR6NzymEF6GYYwWz X-Received: by 10.112.188.194 with SMTP id gc2mr19758394lbc.25.1430844888512; Tue, 05 May 2015 09:54:48 -0700 (PDT) Received: from dl160.lan (188-67-118-178.bb.dnainternet.fi. [188.67.118.178]) by mx.google.com with ESMTPSA id z1sm4177919laz.48.2015.05.05.09.54.46 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 May 2015 09:54:47 -0700 (PDT) From: Olli Salonen To: linux-media@vger.kernel.org Cc: Olli Salonen Subject: [PATCH v4 5/6] rtl28xxu: add I2C read without write Date: Tue, 5 May 2015 19:54:18 +0300 Message-Id: <1430844859-24947-6-git-send-email-olli.salonen@iki.fi> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1430844859-24947-1-git-send-email-olli.salonen@iki.fi> References: <1430844859-24947-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 895441f..54cb109 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: