linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mfd: cros_ec_dev: Load lightbar module only present
@ 2021-05-26  3:45 Gwendal Grignou
  2021-05-26 12:19 ` Enric Balletbo i Serra
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Gwendal Grignou @ 2021-05-26  3:45 UTC (permalink / raw)
  To: lee.jones, bleung, enric.balletbo, groeck, swboyd
  Cc: linux-kernel, Gwendal Grignou

The pixel lightbar is only present on chromebook pixel (link), pixel 2
and pixel C. For the latter two, the EC reports its presence.
Instead of always loading the lightbar driver on all chromebook, only
load it when reported by the EC or Link device.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
---
 drivers/mfd/cros_ec_dev.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
index d07b43d7c761a..a9700436e5e51 100644
--- a/drivers/mfd/cros_ec_dev.c
+++ b/drivers/mfd/cros_ec_dev.c
@@ -5,6 +5,7 @@
  * Copyright (C) 2014 Google, Inc.
  */
 
+#include <linux/dmi.h>
 #include <linux/kconfig.h>
 #include <linux/mfd/core.h>
 #include <linux/module.h>
@@ -112,10 +113,13 @@ static const struct cros_feature_to_cells cros_subdevices[] = {
 static const struct mfd_cell cros_ec_platform_cells[] = {
 	{ .name = "cros-ec-chardev", },
 	{ .name = "cros-ec-debugfs", },
-	{ .name = "cros-ec-lightbar", },
 	{ .name = "cros-ec-sysfs", },
 };
 
+static const struct mfd_cell cros_ec_lightbar_cells[] = {
+	{ .name = "cros-ec-lightbar", }
+};
+
 static const struct mfd_cell cros_ec_vbc_cells[] = {
 	{ .name = "cros-ec-vbc", }
 };
@@ -206,6 +210,20 @@ static int ec_device_probe(struct platform_device *pdev)
 		}
 	}
 
+	/*
+	 * Lightbar is a special case. Newer devices support autodetection,
+	 * but older ones do not.
+	 */
+	if (cros_ec_check_features(ec, EC_FEATURE_LIGHTBAR) ||
+	    dmi_match(DMI_PRODUCT_NAME, "Link")) {
+		retval = mfd_add_hotplug_devices(ec->dev,
+					cros_ec_lightbar_cells,
+					ARRAY_SIZE(cros_ec_lightbar_cells));
+		if (retval)
+			dev_warn(ec->dev, "failed to add lightbar: %d\n",
+				 retval);
+	}
+
 	/*
 	 * The PD notifier driver cell is separate since it only needs to be
 	 * explicitly added on platforms that don't have the PD notifier ACPI
-- 
2.32.0.rc0.204.g9fa02ecfa5-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mfd: cros_ec_dev: Load lightbar module only present
  2021-05-26  3:45 [PATCH] mfd: cros_ec_dev: Load lightbar module only present Gwendal Grignou
@ 2021-05-26 12:19 ` Enric Balletbo i Serra
  2021-05-26 20:26 ` Stephen Boyd
  2021-06-01 15:30 ` Lee Jones
  2 siblings, 0 replies; 4+ messages in thread
From: Enric Balletbo i Serra @ 2021-05-26 12:19 UTC (permalink / raw)
  To: Gwendal Grignou, lee.jones, bleung, groeck, swboyd; +Cc: linux-kernel

Hi Gwendal,

Thank you for your patch.

On 26/5/21 5:45, Gwendal Grignou wrote:
> The pixel lightbar is only present on chromebook pixel (link), pixel 2
> and pixel C. For the latter two, the EC reports its presence.
> Instead of always loading the lightbar driver on all chromebook, only
> load it when reported by the EC or Link device.
> 
> Signed-off-by: Gwendal Grignou <gwendal@chromium.org>

Acked-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>

> ---
>  drivers/mfd/cros_ec_dev.c | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
> index d07b43d7c761a..a9700436e5e51 100644
> --- a/drivers/mfd/cros_ec_dev.c
> +++ b/drivers/mfd/cros_ec_dev.c
> @@ -5,6 +5,7 @@
>   * Copyright (C) 2014 Google, Inc.
>   */
>  
> +#include <linux/dmi.h>
>  #include <linux/kconfig.h>
>  #include <linux/mfd/core.h>
>  #include <linux/module.h>
> @@ -112,10 +113,13 @@ static const struct cros_feature_to_cells cros_subdevices[] = {
>  static const struct mfd_cell cros_ec_platform_cells[] = {
>  	{ .name = "cros-ec-chardev", },
>  	{ .name = "cros-ec-debugfs", },
> -	{ .name = "cros-ec-lightbar", },
>  	{ .name = "cros-ec-sysfs", },
>  };
>  
> +static const struct mfd_cell cros_ec_lightbar_cells[] = {
> +	{ .name = "cros-ec-lightbar", }
> +};
> +
>  static const struct mfd_cell cros_ec_vbc_cells[] = {
>  	{ .name = "cros-ec-vbc", }
>  };
> @@ -206,6 +210,20 @@ static int ec_device_probe(struct platform_device *pdev)
>  		}
>  	}
>  
> +	/*
> +	 * Lightbar is a special case. Newer devices support autodetection,
> +	 * but older ones do not.
> +	 */
> +	if (cros_ec_check_features(ec, EC_FEATURE_LIGHTBAR) ||
> +	    dmi_match(DMI_PRODUCT_NAME, "Link")) {
> +		retval = mfd_add_hotplug_devices(ec->dev,
> +					cros_ec_lightbar_cells,
> +					ARRAY_SIZE(cros_ec_lightbar_cells));
> +		if (retval)
> +			dev_warn(ec->dev, "failed to add lightbar: %d\n",
> +				 retval);
> +	}
> +
>  	/*
>  	 * The PD notifier driver cell is separate since it only needs to be
>  	 * explicitly added on platforms that don't have the PD notifier ACPI
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mfd: cros_ec_dev: Load lightbar module only present
  2021-05-26  3:45 [PATCH] mfd: cros_ec_dev: Load lightbar module only present Gwendal Grignou
  2021-05-26 12:19 ` Enric Balletbo i Serra
@ 2021-05-26 20:26 ` Stephen Boyd
  2021-06-01 15:30 ` Lee Jones
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2021-05-26 20:26 UTC (permalink / raw)
  To: Gwendal Grignou, bleung, enric.balletbo, groeck, lee.jones; +Cc: linux-kernel

Quoting Gwendal Grignou (2021-05-25 20:45:00)
> The pixel lightbar is only present on chromebook pixel (link), pixel 2
> and pixel C. For the latter two, the EC reports its presence.
> Instead of always loading the lightbar driver on all chromebook, only
> load it when reported by the EC or Link device.
>
> Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
> ---

Tested-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mfd: cros_ec_dev: Load lightbar module only present
  2021-05-26  3:45 [PATCH] mfd: cros_ec_dev: Load lightbar module only present Gwendal Grignou
  2021-05-26 12:19 ` Enric Balletbo i Serra
  2021-05-26 20:26 ` Stephen Boyd
@ 2021-06-01 15:30 ` Lee Jones
  2 siblings, 0 replies; 4+ messages in thread
From: Lee Jones @ 2021-06-01 15:30 UTC (permalink / raw)
  To: Gwendal Grignou; +Cc: bleung, enric.balletbo, groeck, swboyd, linux-kernel

On Tue, 25 May 2021, Gwendal Grignou wrote:

> The pixel lightbar is only present on chromebook pixel (link), pixel 2
> and pixel C. For the latter two, the EC reports its presence.
> Instead of always loading the lightbar driver on all chromebook, only
> load it when reported by the EC or Link device.
> 
> Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
> ---
>  drivers/mfd/cros_ec_dev.c | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-01 15:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-26  3:45 [PATCH] mfd: cros_ec_dev: Load lightbar module only present Gwendal Grignou
2021-05-26 12:19 ` Enric Balletbo i Serra
2021-05-26 20:26 ` Stephen Boyd
2021-06-01 15:30 ` Lee Jones

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).