Merge tag 's390-5.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
[linux-2.6-microblaze.git] / drivers / mfd / cros_ec_dev.c
index d07b43d..8c08d1c 100644 (file)
@@ -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,8 +113,12 @@ 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", },
+       { .name = "cros-ec-pchg", },
+};
+
+static const struct mfd_cell cros_ec_lightbar_cells[] = {
+       { .name = "cros-ec-lightbar", }
 };
 
 static const struct mfd_cell cros_ec_vbc_cells[] = {
@@ -206,6 +211,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