From patchwork Fri Mar 27 11:57:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olli Salonen X-Patchwork-Id: 6106331 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 CF7409F399 for ; Fri, 27 Mar 2015 11:57:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E80D22042B for ; Fri, 27 Mar 2015 11:57:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 06D6A203A0 for ; Fri, 27 Mar 2015 11:57:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752581AbbC0L5d (ORCPT ); Fri, 27 Mar 2015 07:57:33 -0400 Received: from mail-la0-f49.google.com ([209.85.215.49]:34203 "EHLO mail-la0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752353AbbC0L5d (ORCPT ); Fri, 27 Mar 2015 07:57:33 -0400 Received: by lagg8 with SMTP id g8so68396817lag.1 for ; Fri, 27 Mar 2015 04:57:31 -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; bh=c+aVhLia0pwujyx6ZCP5mtZNBS2fLBxs8zmExvZ1iP0=; b=R36JKZHlf1TOttKqjxYcfpEu7XfRLtUciBPx3/6ZpaoVGtUrUGE8OdWBhp47WZDsOk 3LMyNOFCmoftM+YndzvEHerKpPTJvsH/rLnnIIvmzTRga5Z2/GkyURwFbUeBUctKvjcF NAWvYvlE+VDcajiLCms8Vbfr27zbVasjTs6/NDkFlMyuYOx7yCxrHGhajCtHIela47iT VNWDNPTTrSVriNMp0ldYtGkO2sEHYakQfXLlhx8BMACcha+N+7srQPDM1NPtJ8d32wJl o3O550SXOIjSn+E9/HJoZ1mJ7+GbqMT7mbTosTzah2lMOCnAvdtO/zkkkWkSCOL0TDx8 RFFg== X-Gm-Message-State: ALoCoQm/M5BQo7354eJPqvOL35XKlOtX6atjnpZ2y7T+kZ8/HH3MXG0zBbaQkpmZGA8uIUMF5lgf X-Received: by 10.152.8.69 with SMTP id p5mr13645821laa.113.1427457451420; Fri, 27 Mar 2015 04:57:31 -0700 (PDT) Received: from dl160.lan (37-33-50-203.bb.dnainternet.fi. [37.33.50.203]) by mx.google.com with ESMTPSA id y8sm300615lad.46.2015.03.27.04.57.29 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Mar 2015 04:57:30 -0700 (PDT) From: Olli Salonen To: linux-media@vger.kernel.org Cc: Olli Salonen Subject: [PATCH 1/5] saa7164: add support for i2c read Date: Fri, 27 Mar 2015 13:57:15 +0200 Message-Id: <1427457439-1493-1-git-send-email-olli.salonen@iki.fi> X-Mailer: git-send-email 1.9.1 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 pure I2C reads. Needed by si2157 tuner driver. Signed-off-by: Olli Salonen --- drivers/media/pci/saa7164/saa7164-i2c.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/media/pci/saa7164/saa7164-i2c.c b/drivers/media/pci/saa7164/saa7164-i2c.c index 4f7e3b4..e30e206 100644 --- a/drivers/media/pci/saa7164/saa7164-i2c.c +++ b/drivers/media/pci/saa7164/saa7164-i2c.c @@ -39,9 +39,12 @@ static int i2c_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, int num) dprintk(DBGLVL_I2C, "%s(num = %d) addr = 0x%02x len = 0x%x\n", __func__, num, msgs[i].addr, msgs[i].len); if (msgs[i].flags & I2C_M_RD) { - /* Unsupported - Yet*/ - printk(KERN_ERR "%s() Unsupported - Yet\n", __func__); - continue; + /* dummy write before read */ + retval = saa7164_api_i2c_read(bus, msgs[i].addr, + 0, NULL, msgs[i].len, msgs[i].buf); + + if (retval < 0) + goto err; } else if (i + 1 < num && (msgs[i + 1].flags & I2C_M_RD) && msgs[i].addr == msgs[i + 1].addr) { /* write then read from same address */