2015-06-22 06:27:35

by Javier Martinez Canillas

[permalink] [raw]
Subject: [RESEND PATCH 0/3] platform/chrome: Changes for cros_ec_lpc and cros_ec_dev

Hello Olof,

This series contain a fix and a cleanup for the cros_ec_lpc driver and
a small fix for cros_ec_dev driver. Is a resend of a patch-set posted
posted more than one month ago [0] but most patches were already posted
as a part of a different series [1] that was split out so have been in
the list for months.

Can you please review them? The patches are really trivial.

Javier Martinez Canillas (3):
platform/chrome: cros_ec_lpc - Use existing function to check EC
result
platform/chrome: cros_ec_lpc - Add support for Google Pixel 2
platform/chrome: cros_ec_dev - Add a platform device ID table

drivers/platform/chrome/cros_ec_dev.c | 6 ++++++
drivers/platform/chrome/cros_ec_lpc.c | 21 +++++++++------------
2 files changed, 15 insertions(+), 12 deletions(-)

Best regards,
Javier

[0]: https://lkml.org/lkml/2015/5/20/184
[1]: https://lkml.org/lkml/2015/5/9/73


2015-06-22 06:28:15

by Javier Martinez Canillas

[permalink] [raw]
Subject: [RESEND PATCH 1/3] platform/chrome: cros_ec_lpc - Use existing function to check EC result

Commit 6db07b633658 ("mfd: cros_ec: Check result code from EC messages")
added a common cros_ec_check_result() function that can be used to check
the ec_msg->result for errors and warns about them.

Use the existing function instead of duplicating same check in the driver.

Signed-off-by: Javier Martinez Canillas <[email protected]>
Reviewed-by: Gwendal Grignou <[email protected]>
Tested-by: Gwendal Grignou <[email protected]>
---
drivers/platform/chrome/cros_ec_lpc.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c
index 8f9ac4d7bbd0..4fc4d6dfe67e 100644
--- a/drivers/platform/chrome/cros_ec_lpc.c
+++ b/drivers/platform/chrome/cros_ec_lpc.c
@@ -95,19 +95,9 @@ static int cros_ec_cmd_xfer_lpc(struct cros_ec_device *ec,

/* Check result */
msg->result = inb(EC_LPC_ADDR_HOST_DATA);
-
- switch (msg->result) {
- case EC_RES_SUCCESS:
- break;
- case EC_RES_IN_PROGRESS:
- ret = -EAGAIN;
- dev_dbg(ec->dev, "command 0x%02x in progress\n",
- msg->command);
+ ret = cros_ec_check_result(ec, msg);
+ if (ret)
goto done;
- default:
- dev_dbg(ec->dev, "command 0x%02x returned %d\n",
- msg->command, msg->result);
- }

/* Read back args */
args.flags = inb(EC_LPC_ADDR_HOST_ARGS);
--
2.1.4

2015-06-22 06:28:02

by Javier Martinez Canillas

[permalink] [raw]
Subject: [RESEND PATCH 2/3] platform/chrome: cros_ec_lpc - Add support for Google Pixel 2

Since the verion of ACPI in Google BIOS does not enumerate the devices
in the LPC bus, the cros_ec_lpc driver resorts to DMI data to check if
a system is supported by the driver and autoload if built as a module.

Add information about the Google Pixel 2 to the DMI device table.

Signed-off-by: Javier Martinez Canillas <[email protected]>
---
drivers/platform/chrome/cros_ec_lpc.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c
index 4fc4d6dfe67e..b4ca75b12b70 100644
--- a/drivers/platform/chrome/cros_ec_lpc.c
+++ b/drivers/platform/chrome/cros_ec_lpc.c
@@ -247,6 +247,13 @@ static struct dmi_system_id cros_ec_lpc_dmi_table[] __initdata = {
},
},
{
+ /* x86-samus, the Chromebook Pixel 2. */
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "Samus"),
+ },
+ },
+ {
/* x86-peppy, the Acer C720 Chromebook. */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
--
2.1.4

2015-06-22 06:27:49

by Javier Martinez Canillas

[permalink] [raw]
Subject: [RESEND PATCH 3/3] platform/chrome: cros_ec_dev - Add a platform device ID table

If the cros_ec_dev driver is built as a module, modalias information is
not filled so the module is not autoloaded. Add a platform device table
and use the MODULE_DEVICE_TABLE() macro to export that information in
the module so user-space can match the modalias uevent and autoload it.

Signed-off-by: Javier Martinez Canillas <[email protected]>
---
drivers/platform/chrome/cros_ec_dev.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/platform/chrome/cros_ec_dev.c b/drivers/platform/chrome/cros_ec_dev.c
index 6090d0b2826f..4232c8136939 100644
--- a/drivers/platform/chrome/cros_ec_dev.c
+++ b/drivers/platform/chrome/cros_ec_dev.c
@@ -216,6 +216,12 @@ static int ec_device_remove(struct platform_device *pdev)
return 0;
}

+static const struct platform_device_id cros_ec_id[] = {
+ { "cros-ec-ctl", 0 },
+ { /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(platform, cros_ec_id);
+
static struct platform_driver cros_ec_dev_driver = {
.driver = {
.name = "cros-ec-ctl",
--
2.1.4

2015-08-21 17:12:59

by Olof Johansson

[permalink] [raw]
Subject: Re: [RESEND PATCH 0/3] platform/chrome: Changes for cros_ec_lpc and cros_ec_dev

On Mon, Jun 22, 2015 at 08:27:17AM +0200, Javier Martinez Canillas wrote:
> Hello Olof,
>
> This series contain a fix and a cleanup for the cros_ec_lpc driver and
> a small fix for cros_ec_dev driver. Is a resend of a patch-set posted
> posted more than one month ago [0] but most patches were already posted
> as a part of a different series [1] that was split out so have been in
> the list for months.
>
> Can you please review them? The patches are really trivial.

Apologies for the delay. Applied now.


-Olof