All of lore.kernel.org
 help / color / mirror / Atom feed
From: Enric Balletbo i Serra <enric.balletbo@collabora.com>
To: Akshu Agrawal <akshu.agrawal@amd.com>
Cc: cychiang@chromium.org, rrangel@chromium.org,
	Benson Leung <bleung@chromium.org>,
	Guenter Roeck <groeck@chromium.org>,
	Wolfram Sang <wsa@the-dreams.de>, Mark Brown <broonie@kernel.org>,
	Neil Armstrong <narmstrong@baylibre.com>,
	"open list:I2C SUBSYSTEM HOST DRIVERS"
	<linux-i2c@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] i2c: i2c-cros-ec-tunnel: Make the device acpi compatible
Date: Mon, 11 Nov 2019 18:18:16 +0100	[thread overview]
Message-ID: <a5f6a3a9-8eb7-58fd-a624-718374c2437f@collabora.com> (raw)
In-Reply-To: <20191111161431.26293-1-akshu.agrawal@amd.com>

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 <akshu.agrawal@amd.com>
> ---
>  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 <linux/acpi.h>
>  #include <linux/module.h>
>  #include <linux/i2c.h>
>  #include <linux/platform_data/cros_ec_commands.h>
> @@ -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 <enric.balletbo@collabora.com>

Question: Is this supported on older firmwares or is only expected to work on
newer ACPI-based devices?

Thanks,
 Enric

  parent reply	other threads:[~2019-11-11 17:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-11 16:14 [PATCH] i2c: i2c-cros-ec-tunnel: Make the device acpi compatible Akshu Agrawal
2019-11-11 16:14 ` Akshu Agrawal
2019-11-11 16:19 ` Raul Rangel
2019-11-11 17:18 ` Enric Balletbo i Serra [this message]
2019-11-12  6:51   ` Agrawal, Akshu
2019-11-11 20:02 ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a5f6a3a9-8eb7-58fd-a624-718374c2437f@collabora.com \
    --to=enric.balletbo@collabora.com \
    --cc=akshu.agrawal@amd.com \
    --cc=bleung@chromium.org \
    --cc=broonie@kernel.org \
    --cc=cychiang@chromium.org \
    --cc=groeck@chromium.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=narmstrong@baylibre.com \
    --cc=rrangel@chromium.org \
    --cc=wsa@the-dreams.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.