* [PATCH] i2c: i2c-cros-ec-tunnel: Make the device acpi compatible
@ 2019-11-11 16:14 Akshu Agrawal
2019-11-11 16:19 ` Raul Rangel
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Akshu Agrawal @ 2019-11-11 16:14 UTC (permalink / raw)
Cc: akshu.agrawal, cychiang, rrangel, Benson Leung,
Enric Balletbo i Serra, Guenter Roeck, Wolfram Sang, Mark Brown,
Neil Armstrong, open list:I2C SUBSYSTEM HOST DRIVERS, open list
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;
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),
},
};
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: i2c-cros-ec-tunnel: Make the device acpi compatible
2019-11-11 16:14 [PATCH] i2c: i2c-cros-ec-tunnel: Make the device acpi compatible Akshu Agrawal
@ 2019-11-11 16:19 ` Raul Rangel
2019-11-11 17:18 ` Enric Balletbo i Serra
2019-11-11 20:02 ` Wolfram Sang
2 siblings, 0 replies; 5+ messages in thread
From: Raul Rangel @ 2019-11-11 16:19 UTC (permalink / raw)
To: Akshu Agrawal
Cc: cychiang, Benson Leung, Enric Balletbo i Serra, Guenter Roeck,
Wolfram Sang, Mark Brown, Neil Armstrong,
open list:I2C SUBSYSTEM HOST DRIVERS, open list
On Mon, Nov 11, 2019 at 9:15 AM Akshu Agrawal <akshu.agrawal@amd.com> 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;
> 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),
> },
> };
> --
> 2.17.1
>
Acked-by: Raul E Rangel <rrangel@chromium.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: i2c-cros-ec-tunnel: Make the device acpi compatible
2019-11-11 16:14 [PATCH] i2c: i2c-cros-ec-tunnel: Make the device acpi compatible Akshu Agrawal
2019-11-11 16:19 ` Raul Rangel
@ 2019-11-11 17:18 ` Enric Balletbo i Serra
2019-11-12 6:51 ` Agrawal, Akshu
2019-11-11 20:02 ` Wolfram Sang
2 siblings, 1 reply; 5+ messages in thread
From: Enric Balletbo i Serra @ 2019-11-11 17:18 UTC (permalink / raw)
To: Akshu Agrawal
Cc: cychiang, rrangel, Benson Leung, Guenter Roeck, Wolfram Sang,
Mark Brown, Neil Armstrong, open list:I2C SUBSYSTEM HOST DRIVERS,
open list
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: i2c-cros-ec-tunnel: Make the device acpi compatible
2019-11-11 17:18 ` Enric Balletbo i Serra
@ 2019-11-12 6:51 ` Agrawal, Akshu
0 siblings, 0 replies; 5+ messages in thread
From: Agrawal, Akshu @ 2019-11-12 6:51 UTC (permalink / raw)
To: Enric Balletbo i Serra, Akshu Agrawal
Cc: cychiang, rrangel, Benson Leung, Guenter Roeck, Wolfram Sang,
Mark Brown, Neil Armstrong, open list:I2C SUBSYSTEM HOST DRIVERS,
open list
> 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?
This is for new devices and we are yet to push Coreboot patch populating the entry.
Thanks,
Akshu
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: i2c-cros-ec-tunnel: Make the device acpi compatible
2019-11-11 16:14 [PATCH] i2c: i2c-cros-ec-tunnel: Make the device acpi compatible Akshu Agrawal
2019-11-11 16:19 ` Raul Rangel
2019-11-11 17:18 ` Enric Balletbo i Serra
@ 2019-11-11 20:02 ` Wolfram Sang
2 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2019-11-11 20:02 UTC (permalink / raw)
To: Akshu Agrawal
Cc: cychiang, rrangel, Benson Leung, Enric Balletbo i Serra,
Guenter Roeck, Mark Brown, Neil Armstrong,
open list:I2C SUBSYSTEM HOST DRIVERS, open list
[-- Attachment #1: Type: text/plain, Size: 263 bytes --]
On Mon, Nov 11, 2019 at 09:44:28PM +0530, 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>
Applied to for-next, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-11-12 6:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-11 16:14 [PATCH] i2c: i2c-cros-ec-tunnel: Make the device acpi compatible Akshu Agrawal
2019-11-11 16:19 ` Raul Rangel
2019-11-11 17:18 ` Enric Balletbo i Serra
2019-11-12 6:51 ` Agrawal, Akshu
2019-11-11 20:02 ` Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).