platform/x86: intel_chtdc_ti_pwrbtn: Move to intel sub-directory
authorKate Hsuan <hpa@redhat.com>
Fri, 20 Aug 2021 11:04:41 +0000 (14:04 +0300)
committerHans de Goede <hdegoede@redhat.com>
Fri, 20 Aug 2021 18:00:02 +0000 (20:00 +0200)
Move Intel Cherry Trail Dollar Cove TI power button driver
to intel sub-directory to improve readability.

Signed-off-by: Kate Hsuan <hpa@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20210820110458.73018-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/x86/Kconfig
drivers/platform/x86/Makefile
drivers/platform/x86/intel/Kconfig
drivers/platform/x86/intel/Makefile
drivers/platform/x86/intel/chtdc_ti_pwrbtn.c [new file with mode: 0644]
drivers/platform/x86/intel_chtdc_ti_pwrbtn.c [deleted file]

index 084167d70f1b26e00d7516c18a3fa57a634a2e18..ba0454450335a66974c32192927ebf365512e9e5 100644 (file)
@@ -1159,17 +1159,6 @@ config INTEL_UNCORE_FREQ_CONTROL
          To compile this driver as a module, choose M here: the module
          will be called intel-uncore-frequency.
 
-config INTEL_CHTDC_TI_PWRBTN
-       tristate "Intel Cherry Trail Dollar Cove TI power button driver"
-       depends on INTEL_SOC_PMIC_CHTDC_TI
-       depends on INPUT
-       help
-         This option adds a power button driver driver for Dollar Cove TI
-         PMIC on Intel Cherry Trail devices.
-
-         To compile this driver as a module, choose M here: the module
-         will be called intel_chtdc_ti_pwrbtn.
-
 config INTEL_MRFLD_PWRBTN
        tristate "Intel Merrifield Basin Cove power button driver"
        depends on INTEL_SOC_PMIC_MRFLD
index bcdd75a48a801ce28cef5a757f334573ebed23d3..bf94af0749f5d4db7cfe483ae8d73044411aeff5 100644 (file)
@@ -127,7 +127,6 @@ obj-$(CONFIG_INTEL_TURBO_MAX_3)                     += intel_turbo_max_3.o
 obj-$(CONFIG_INTEL_UNCORE_FREQ_CONTROL)                += intel-uncore-frequency.o
 
 # Intel PMIC / PMC / P-Unit devices
-obj-$(CONFIG_INTEL_CHTDC_TI_PWRBTN)    += intel_chtdc_ti_pwrbtn.o
 obj-$(CONFIG_INTEL_MRFLD_PWRBTN)       += intel_mrfld_pwrbtn.o
 obj-$(CONFIG_INTEL_PMC_CORE)           += intel_pmc_core.o intel_pmc_core_pltdrv.o
 obj-$(CONFIG_INTEL_PUNIT_IPC)          += intel_punit_ipc.o
index 46db129bee7fb4f6ce8935e32d92035b80f10c40..3792a5492a8a18d59bdd435c6abf2338f5a2cd1f 100644 (file)
@@ -31,4 +31,15 @@ config INTEL_BXTWC_PMIC_TMU
          This driver enables the alarm wakeup functionality in the TMU unit of
          Whiskey Cove PMIC.
 
+config INTEL_CHTDC_TI_PWRBTN
+       tristate "Intel Cherry Trail Dollar Cove TI power button driver"
+       depends on INTEL_SOC_PMIC_CHTDC_TI
+       depends on INPUT
+       help
+         This option adds a power button driver for Dollar Cove TI
+         PMIC on Intel Cherry Trail devices.
+
+         To compile this driver as a module, choose M here: the module
+         will be called intel_chtdc_ti_pwrbtn.
+
 endif # X86_PLATFORM_DRIVERS_INTEL
index dbdf4877ad108b7ae40bd18811260993f6217ee5..52d7bc0948f3e5d7058b1846884c519d9f417b60 100644 (file)
@@ -12,3 +12,5 @@ obj-$(CONFIG_INTEL_PMT_CLASS)         += pmt/
 # Intel PMIC / PMC / P-Unit drivers
 intel_bxtwc_tmu-y                      := bxtwc_tmu.o
 obj-$(CONFIG_INTEL_BXTWC_PMIC_TMU)     += intel_bxtwc_tmu.o
+intel_chtdc_ti_pwrbtn-y                        := chtdc_ti_pwrbtn.o
+obj-$(CONFIG_INTEL_CHTDC_TI_PWRBTN)    += intel_chtdc_ti_pwrbtn.o
diff --git a/drivers/platform/x86/intel/chtdc_ti_pwrbtn.c b/drivers/platform/x86/intel/chtdc_ti_pwrbtn.c
new file mode 100644 (file)
index 0000000..9606a99
--- /dev/null
@@ -0,0 +1,94 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Power-button driver for Dollar Cove TI PMIC
+ * Copyright (C) 2014 Intel Corp
+ * Copyright (c) 2017 Takashi Iwai <tiwai@suse.de>
+ */
+
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/device.h>
+#include <linux/mfd/intel_soc_pmic.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/pm_wakeirq.h>
+#include <linux/slab.h>
+
+#define CHTDC_TI_SIRQ_REG      0x3
+#define SIRQ_PWRBTN_REL                BIT(0)
+
+static irqreturn_t chtdc_ti_pwrbtn_interrupt(int irq, void *dev_id)
+{
+       struct input_dev *input = dev_id;
+       struct device *dev = input->dev.parent;
+       struct regmap *regmap = dev_get_drvdata(dev);
+       int state;
+
+       if (!regmap_read(regmap, CHTDC_TI_SIRQ_REG, &state)) {
+               dev_dbg(dev, "SIRQ_REG=0x%x\n", state);
+               input_report_key(input, KEY_POWER, !(state & SIRQ_PWRBTN_REL));
+               input_sync(input);
+       }
+
+       return IRQ_HANDLED;
+}
+
+static int chtdc_ti_pwrbtn_probe(struct platform_device *pdev)
+{
+       struct device *dev = &pdev->dev;
+       struct intel_soc_pmic *pmic = dev_get_drvdata(dev->parent);
+       struct input_dev *input;
+       int irq, err;
+
+       irq = platform_get_irq(pdev, 0);
+       if (irq < 0)
+               return irq;
+       input = devm_input_allocate_device(dev);
+       if (!input)
+               return -ENOMEM;
+       input->name = pdev->name;
+       input->phys = "power-button/input0";
+       input->id.bustype = BUS_HOST;
+       input_set_capability(input, EV_KEY, KEY_POWER);
+       err = input_register_device(input);
+       if (err)
+               return err;
+
+       dev_set_drvdata(dev, pmic->regmap);
+
+       err = devm_request_threaded_irq(dev, irq, NULL,
+                                       chtdc_ti_pwrbtn_interrupt,
+                                       IRQF_ONESHOT, KBUILD_MODNAME, input);
+       if (err)
+               return err;
+
+       device_init_wakeup(dev, true);
+       dev_pm_set_wake_irq(dev, irq);
+       return 0;
+}
+
+static int chtdc_ti_pwrbtn_remove(struct platform_device *pdev)
+{
+       dev_pm_clear_wake_irq(&pdev->dev);
+       device_init_wakeup(&pdev->dev, false);
+       return 0;
+}
+
+static const struct platform_device_id chtdc_ti_pwrbtn_id_table[] = {
+       { .name = "chtdc_ti_pwrbtn" },
+       {},
+};
+MODULE_DEVICE_TABLE(platform, chtdc_ti_pwrbtn_id_table);
+
+static struct platform_driver chtdc_ti_pwrbtn_driver = {
+       .driver = {
+               .name   = KBUILD_MODNAME,
+       },
+       .probe          = chtdc_ti_pwrbtn_probe,
+       .remove         = chtdc_ti_pwrbtn_remove,
+       .id_table       = chtdc_ti_pwrbtn_id_table,
+};
+module_platform_driver(chtdc_ti_pwrbtn_driver);
+
+MODULE_DESCRIPTION("Power-button driver for Dollar Cove TI PMIC");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/platform/x86/intel_chtdc_ti_pwrbtn.c b/drivers/platform/x86/intel_chtdc_ti_pwrbtn.c
deleted file mode 100644 (file)
index 9606a99..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Power-button driver for Dollar Cove TI PMIC
- * Copyright (C) 2014 Intel Corp
- * Copyright (c) 2017 Takashi Iwai <tiwai@suse.de>
- */
-
-#include <linux/input.h>
-#include <linux/interrupt.h>
-#include <linux/device.h>
-#include <linux/mfd/intel_soc_pmic.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/pm_wakeirq.h>
-#include <linux/slab.h>
-
-#define CHTDC_TI_SIRQ_REG      0x3
-#define SIRQ_PWRBTN_REL                BIT(0)
-
-static irqreturn_t chtdc_ti_pwrbtn_interrupt(int irq, void *dev_id)
-{
-       struct input_dev *input = dev_id;
-       struct device *dev = input->dev.parent;
-       struct regmap *regmap = dev_get_drvdata(dev);
-       int state;
-
-       if (!regmap_read(regmap, CHTDC_TI_SIRQ_REG, &state)) {
-               dev_dbg(dev, "SIRQ_REG=0x%x\n", state);
-               input_report_key(input, KEY_POWER, !(state & SIRQ_PWRBTN_REL));
-               input_sync(input);
-       }
-
-       return IRQ_HANDLED;
-}
-
-static int chtdc_ti_pwrbtn_probe(struct platform_device *pdev)
-{
-       struct device *dev = &pdev->dev;
-       struct intel_soc_pmic *pmic = dev_get_drvdata(dev->parent);
-       struct input_dev *input;
-       int irq, err;
-
-       irq = platform_get_irq(pdev, 0);
-       if (irq < 0)
-               return irq;
-       input = devm_input_allocate_device(dev);
-       if (!input)
-               return -ENOMEM;
-       input->name = pdev->name;
-       input->phys = "power-button/input0";
-       input->id.bustype = BUS_HOST;
-       input_set_capability(input, EV_KEY, KEY_POWER);
-       err = input_register_device(input);
-       if (err)
-               return err;
-
-       dev_set_drvdata(dev, pmic->regmap);
-
-       err = devm_request_threaded_irq(dev, irq, NULL,
-                                       chtdc_ti_pwrbtn_interrupt,
-                                       IRQF_ONESHOT, KBUILD_MODNAME, input);
-       if (err)
-               return err;
-
-       device_init_wakeup(dev, true);
-       dev_pm_set_wake_irq(dev, irq);
-       return 0;
-}
-
-static int chtdc_ti_pwrbtn_remove(struct platform_device *pdev)
-{
-       dev_pm_clear_wake_irq(&pdev->dev);
-       device_init_wakeup(&pdev->dev, false);
-       return 0;
-}
-
-static const struct platform_device_id chtdc_ti_pwrbtn_id_table[] = {
-       { .name = "chtdc_ti_pwrbtn" },
-       {},
-};
-MODULE_DEVICE_TABLE(platform, chtdc_ti_pwrbtn_id_table);
-
-static struct platform_driver chtdc_ti_pwrbtn_driver = {
-       .driver = {
-               .name   = KBUILD_MODNAME,
-       },
-       .probe          = chtdc_ti_pwrbtn_probe,
-       .remove         = chtdc_ti_pwrbtn_remove,
-       .id_table       = chtdc_ti_pwrbtn_id_table,
-};
-module_platform_driver(chtdc_ti_pwrbtn_driver);
-
-MODULE_DESCRIPTION("Power-button driver for Dollar Cove TI PMIC");
-MODULE_LICENSE("GPL v2");