Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp6452410ybx; Mon, 11 Nov 2019 09:19:51 -0800 (PST) X-Google-Smtp-Source: APXvYqwc84ZJqI9k2JW201iHdXl5+7ob3ElFK9ToCn7uhThefWYOkztaQwAiPfoQsJIoFYMYRtsz X-Received: by 2002:a50:ff12:: with SMTP id a18mr27192943edu.200.1573492791328; Mon, 11 Nov 2019 09:19:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573492791; cv=none; d=google.com; s=arc-20160816; b=0l0gpJXOPt2QPRX3h/L52qEpIpVTqgIdZocjcKXSTBgFffZWAGNPv17Id45Yy2f7Pd anzH/T3KjMbsx03VvrZ9+2NrLf4MGSTSVEQEZsYXER+0MHsWKdJ5KPi42tY2i0ydttah iOKHm0gpCfc5WPoI0vskCFhjqzySbLZUvJNFTXfJSx3OKrbmefsvhjTDaplZCrViwP4e +RwRb0suhiRjMG1T/mg5LEE06kru644cpQhdCiNi/wm3hP7IA6kevRDFncbGHjuFLom2 GPJg1MOXgWFPvP8lIXMShGBmWkz+cSRdqy5D9FxJM4lsR3COkBR7CLE+tcsNVSIt0lEu 3gmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=hSv9VPHGRywAHoZ0YCilntXHrgrgZj2nAZ/def0UL7o=; b=L4V1G2Qe1Trf+k7Pt78EH65BLzUS3atz0nCw9IZuB6Mi4UtKoIdL5HXGB9BdkyQyIO wODtSvQcVf8ZDw3+5JA4+2EDTHZyBuJ+ymuW7LH9x+g7/opki95NaoRo7v67UxV6PWkx WFQcIP+RP2IaMOwmU3ivwP0z4uSkoL17INbRzuMGJ3Gpy6BdAODRyOkBjGS5olUkzdNG gJZWnLrM/EBygKxksD5pIpeMuVxAC8OumDtX3eKCCbx1t5Pg71ImhN/dIEZgHRz5NiB5 +GSaP7RTmrtyX05BlNeNOuchvLEyLxma/dJT5Li6VmHg3402PQdJJRhDnb4ZQI46se/u Tq+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d23si1669839ejd.165.2019.11.11.09.19.27; Mon, 11 Nov 2019 09:19:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726985AbfKKRSV (ORCPT + 99 others); Mon, 11 Nov 2019 12:18:21 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:37948 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726927AbfKKRSV (ORCPT ); Mon, 11 Nov 2019 12:18:21 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id E7CE328FCBA Subject: Re: [PATCH] i2c: i2c-cros-ec-tunnel: Make the device acpi compatible To: Akshu Agrawal Cc: cychiang@chromium.org, rrangel@chromium.org, Benson Leung , Guenter Roeck , Wolfram Sang , Mark Brown , Neil Armstrong , "open list:I2C SUBSYSTEM HOST DRIVERS" , open list References: <20191111161431.26293-1-akshu.agrawal@amd.com> From: Enric Balletbo i Serra Message-ID: Date: Mon, 11 Nov 2019 18:18:16 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191111161431.26293-1-akshu.agrawal@amd.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Akshu, Thanks for sending this upstream and improve CrOS EC On 11/11/19 17:14, Akshu Agrawal wrote: > Add ACPI entry and use device_property_read to get fw value > which is common to both dtsi and acpi. > > Signed-off-by: Akshu Agrawal > --- > drivers/i2c/busses/i2c-cros-ec-tunnel.c | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-cros-ec-tunnel.c b/drivers/i2c/busses/i2c-cros-ec-tunnel.c > index c551aa96a2e3..958161c71985 100644 > --- a/drivers/i2c/busses/i2c-cros-ec-tunnel.c > +++ b/drivers/i2c/busses/i2c-cros-ec-tunnel.c > @@ -3,6 +3,7 @@ > // > // Copyright (C) 2013 Google, Inc. > > +#include > #include > #include > #include > @@ -240,7 +241,6 @@ static const struct i2c_algorithm ec_i2c_algorithm = { > > static int ec_i2c_probe(struct platform_device *pdev) > { > - struct device_node *np = pdev->dev.of_node; > struct cros_ec_device *ec = dev_get_drvdata(pdev->dev.parent); > struct device *dev = &pdev->dev; > struct ec_i2c_device *bus = NULL; > @@ -256,7 +256,7 @@ static int ec_i2c_probe(struct platform_device *pdev) > if (bus == NULL) > return -ENOMEM; > > - err = of_property_read_u32(np, "google,remote-bus", &remote_bus); > + err = device_property_read_u32(dev, "google,remote-bus", &remote_bus); > if (err) { > dev_err(dev, "Couldn't read remote-bus property\n"); > return err; > @@ -271,7 +271,7 @@ static int ec_i2c_probe(struct platform_device *pdev) > bus->adap.algo = &ec_i2c_algorithm; > bus->adap.algo_data = bus; > bus->adap.dev.parent = &pdev->dev; > - bus->adap.dev.of_node = np; > + bus->adap.dev.of_node = pdev->dev.of_node; That change is not really needed/(related) but as np was only used here I'm fine with it. > bus->adap.retries = I2C_MAX_RETRIES; > > err = i2c_add_adapter(&bus->adap); > @@ -291,19 +291,24 @@ static int ec_i2c_remove(struct platform_device *dev) > return 0; > } > > -#ifdef CONFIG_OF > static const struct of_device_id cros_ec_i2c_of_match[] = { > { .compatible = "google,cros-ec-i2c-tunnel" }, > {}, > }; > MODULE_DEVICE_TABLE(of, cros_ec_i2c_of_match); > -#endif > + > +static const struct acpi_device_id cros_ec_i2c_tunnel_acpi_id[] = { > + { "GOOG001A", 0 }, > + { } > +}; > +MODULE_DEVICE_TABLE(acpi, cros_ec_i2c_tunnel_acpi_id); > > static struct platform_driver ec_i2c_tunnel_driver = { > .probe = ec_i2c_probe, > .remove = ec_i2c_remove, > .driver = { > .name = "cros-ec-i2c-tunnel", > + .acpi_match_table = ACPI_PTR(cros_ec_i2c_tunnel_acpi_id), > .of_match_table = of_match_ptr(cros_ec_i2c_of_match), > }, > }; > Reviewed-by: Enric Balletbo i Serra Question: Is this supported on older firmwares or is only expected to work on newer ACPI-based devices? Thanks, Enric