platform/x86: intel_bxtwc_tmu: Move to intel sub-directory
authorKate Hsuan <hpa@redhat.com>
Fri, 20 Aug 2021 11:04:40 +0000 (14:04 +0300)
committerHans de Goede <hdegoede@redhat.com>
Fri, 20 Aug 2021 18:00:02 +0000 (20:00 +0200)
Move Intel Broxton Whiskey Cove TMU driver to intel sub-directory
to improve readability.

While at it, spell BXT fully in the Kconfig and switch to select REGMAP.

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-3-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/bxtwc_tmu.c [new file with mode: 0644]
drivers/platform/x86/intel_bxtwc_tmu.c [deleted file]

index 9868e26..084167d 100644 (file)
@@ -1159,16 +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_BXTWC_PMIC_TMU
-       tristate "Intel BXT Whiskey Cove TMU Driver"
-       depends on REGMAP
-       depends on MFD_INTEL_PMC_BXT
-       depends on INTEL_SOC_PMIC_BXTWC
-       help
-         Select this driver to use Intel BXT Whiskey Cove PMIC TMU feature.
-         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
index 03a1fc2..bcdd75a 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_BXTWC_PMIC_TMU)     += intel_bxtwc_tmu.o
 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
index 4dd1fd4..46db129 100644 (file)
@@ -21,4 +21,14 @@ source "drivers/platform/x86/intel/int33fe/Kconfig"
 source "drivers/platform/x86/intel/int3472/Kconfig"
 source "drivers/platform/x86/intel/pmt/Kconfig"
 
+config INTEL_BXTWC_PMIC_TMU
+       tristate "Intel Broxton Whiskey Cove TMU Driver"
+       depends on INTEL_SOC_PMIC_BXTWC
+       depends on MFD_INTEL_PMC_BXT
+       select REGMAP
+       help
+         Select this driver to use Intel Broxton Whiskey Cove PMIC TMU feature.
+         This driver enables the alarm wakeup functionality in the TMU unit of
+         Whiskey Cove PMIC.
+
 endif # X86_PLATFORM_DRIVERS_INTEL
index dc6baf4..dbdf487 100644 (file)
@@ -8,3 +8,7 @@ obj-$(CONFIG_INTEL_SAR_INT1092)         += int1092/
 obj-$(CONFIG_INTEL_CHT_INT33FE)                += int33fe/
 obj-$(CONFIG_INTEL_SKL_INT3472)                += int3472/
 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
diff --git a/drivers/platform/x86/intel/bxtwc_tmu.c b/drivers/platform/x86/intel/bxtwc_tmu.c
new file mode 100644 (file)
index 0000000..7ccf583
--- /dev/null
@@ -0,0 +1,147 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Intel BXT Whiskey Cove PMIC TMU driver
+ *
+ * Copyright (C) 2016 Intel Corporation. All rights reserved.
+ *
+ * This driver adds TMU (Time Management Unit) support for Intel BXT platform.
+ * It enables the alarm wake-up functionality in the TMU unit of Whiskey Cove
+ * PMIC.
+ */
+
+#include <linux/module.h>
+#include <linux/mod_devicetable.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/mfd/intel_soc_pmic.h>
+
+#define BXTWC_TMUIRQ           0x4fb6
+#define BXTWC_MIRQLVL1         0x4e0e
+#define BXTWC_MTMUIRQ_REG      0x4fb7
+#define BXTWC_MIRQLVL1_MTMU    BIT(1)
+#define BXTWC_TMU_WK_ALRM      BIT(1)
+#define BXTWC_TMU_SYS_ALRM     BIT(2)
+#define BXTWC_TMU_ALRM_MASK    (BXTWC_TMU_WK_ALRM | BXTWC_TMU_SYS_ALRM)
+#define BXTWC_TMU_ALRM_IRQ     (BXTWC_TMU_WK_ALRM | BXTWC_TMU_SYS_ALRM)
+
+struct wcove_tmu {
+       int irq;
+       struct device *dev;
+       struct regmap *regmap;
+};
+
+static irqreturn_t bxt_wcove_tmu_irq_handler(int irq, void *data)
+{
+       struct wcove_tmu *wctmu = data;
+       unsigned int tmu_irq;
+
+       /* Read TMU interrupt reg */
+       regmap_read(wctmu->regmap, BXTWC_TMUIRQ, &tmu_irq);
+       if (tmu_irq & BXTWC_TMU_ALRM_IRQ) {
+               /* clear TMU irq */
+               regmap_write(wctmu->regmap, BXTWC_TMUIRQ, tmu_irq);
+               return IRQ_HANDLED;
+       }
+       return IRQ_NONE;
+}
+
+static int bxt_wcove_tmu_probe(struct platform_device *pdev)
+{
+       struct intel_soc_pmic *pmic = dev_get_drvdata(pdev->dev.parent);
+       struct regmap_irq_chip_data *regmap_irq_chip;
+       struct wcove_tmu *wctmu;
+       int ret, virq, irq;
+
+       wctmu = devm_kzalloc(&pdev->dev, sizeof(*wctmu), GFP_KERNEL);
+       if (!wctmu)
+               return -ENOMEM;
+
+       wctmu->dev = &pdev->dev;
+       wctmu->regmap = pmic->regmap;
+
+       irq = platform_get_irq(pdev, 0);
+       if (irq < 0)
+               return irq;
+
+       regmap_irq_chip = pmic->irq_chip_data_tmu;
+       virq = regmap_irq_get_virq(regmap_irq_chip, irq);
+       if (virq < 0) {
+               dev_err(&pdev->dev,
+                       "failed to get virtual interrupt=%d\n", irq);
+               return virq;
+       }
+
+       ret = devm_request_threaded_irq(&pdev->dev, virq,
+                                       NULL, bxt_wcove_tmu_irq_handler,
+                                       IRQF_ONESHOT, "bxt_wcove_tmu", wctmu);
+       if (ret) {
+               dev_err(&pdev->dev, "request irq failed: %d,virq: %d\n",
+                                                       ret, virq);
+               return ret;
+       }
+       wctmu->irq = virq;
+
+       /* Unmask TMU second level Wake & System alarm */
+       regmap_update_bits(wctmu->regmap, BXTWC_MTMUIRQ_REG,
+                                 BXTWC_TMU_ALRM_MASK, 0);
+
+       platform_set_drvdata(pdev, wctmu);
+       return 0;
+}
+
+static int bxt_wcove_tmu_remove(struct platform_device *pdev)
+{
+       struct wcove_tmu *wctmu = platform_get_drvdata(pdev);
+       unsigned int val;
+
+       /* Mask TMU interrupts */
+       regmap_read(wctmu->regmap, BXTWC_MIRQLVL1, &val);
+       regmap_write(wctmu->regmap, BXTWC_MIRQLVL1,
+                       val | BXTWC_MIRQLVL1_MTMU);
+       regmap_read(wctmu->regmap, BXTWC_MTMUIRQ_REG, &val);
+       regmap_write(wctmu->regmap, BXTWC_MTMUIRQ_REG,
+                       val | BXTWC_TMU_ALRM_MASK);
+       return 0;
+}
+
+#ifdef CONFIG_PM_SLEEP
+static int bxtwc_tmu_suspend(struct device *dev)
+{
+       struct wcove_tmu *wctmu = dev_get_drvdata(dev);
+
+       enable_irq_wake(wctmu->irq);
+       return 0;
+}
+
+static int bxtwc_tmu_resume(struct device *dev)
+{
+       struct wcove_tmu *wctmu = dev_get_drvdata(dev);
+
+       disable_irq_wake(wctmu->irq);
+       return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(bxtwc_tmu_pm_ops, bxtwc_tmu_suspend, bxtwc_tmu_resume);
+
+static const struct platform_device_id bxt_wcove_tmu_id_table[] = {
+       { .name = "bxt_wcove_tmu" },
+       {},
+};
+MODULE_DEVICE_TABLE(platform, bxt_wcove_tmu_id_table);
+
+static struct platform_driver bxt_wcove_tmu_driver = {
+       .probe = bxt_wcove_tmu_probe,
+       .remove = bxt_wcove_tmu_remove,
+       .driver = {
+               .name = "bxt_wcove_tmu",
+               .pm     = &bxtwc_tmu_pm_ops,
+       },
+       .id_table = bxt_wcove_tmu_id_table,
+};
+
+module_platform_driver(bxt_wcove_tmu_driver);
+
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR("Nilesh Bacchewar <nilesh.bacchewar@intel.com>");
+MODULE_DESCRIPTION("BXT Whiskey Cove TMU Driver");
diff --git a/drivers/platform/x86/intel_bxtwc_tmu.c b/drivers/platform/x86/intel_bxtwc_tmu.c
deleted file mode 100644 (file)
index 7ccf583..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Intel BXT Whiskey Cove PMIC TMU driver
- *
- * Copyright (C) 2016 Intel Corporation. All rights reserved.
- *
- * This driver adds TMU (Time Management Unit) support for Intel BXT platform.
- * It enables the alarm wake-up functionality in the TMU unit of Whiskey Cove
- * PMIC.
- */
-
-#include <linux/module.h>
-#include <linux/mod_devicetable.h>
-#include <linux/interrupt.h>
-#include <linux/platform_device.h>
-#include <linux/mfd/intel_soc_pmic.h>
-
-#define BXTWC_TMUIRQ           0x4fb6
-#define BXTWC_MIRQLVL1         0x4e0e
-#define BXTWC_MTMUIRQ_REG      0x4fb7
-#define BXTWC_MIRQLVL1_MTMU    BIT(1)
-#define BXTWC_TMU_WK_ALRM      BIT(1)
-#define BXTWC_TMU_SYS_ALRM     BIT(2)
-#define BXTWC_TMU_ALRM_MASK    (BXTWC_TMU_WK_ALRM | BXTWC_TMU_SYS_ALRM)
-#define BXTWC_TMU_ALRM_IRQ     (BXTWC_TMU_WK_ALRM | BXTWC_TMU_SYS_ALRM)
-
-struct wcove_tmu {
-       int irq;
-       struct device *dev;
-       struct regmap *regmap;
-};
-
-static irqreturn_t bxt_wcove_tmu_irq_handler(int irq, void *data)
-{
-       struct wcove_tmu *wctmu = data;
-       unsigned int tmu_irq;
-
-       /* Read TMU interrupt reg */
-       regmap_read(wctmu->regmap, BXTWC_TMUIRQ, &tmu_irq);
-       if (tmu_irq & BXTWC_TMU_ALRM_IRQ) {
-               /* clear TMU irq */
-               regmap_write(wctmu->regmap, BXTWC_TMUIRQ, tmu_irq);
-               return IRQ_HANDLED;
-       }
-       return IRQ_NONE;
-}
-
-static int bxt_wcove_tmu_probe(struct platform_device *pdev)
-{
-       struct intel_soc_pmic *pmic = dev_get_drvdata(pdev->dev.parent);
-       struct regmap_irq_chip_data *regmap_irq_chip;
-       struct wcove_tmu *wctmu;
-       int ret, virq, irq;
-
-       wctmu = devm_kzalloc(&pdev->dev, sizeof(*wctmu), GFP_KERNEL);
-       if (!wctmu)
-               return -ENOMEM;
-
-       wctmu->dev = &pdev->dev;
-       wctmu->regmap = pmic->regmap;
-
-       irq = platform_get_irq(pdev, 0);
-       if (irq < 0)
-               return irq;
-
-       regmap_irq_chip = pmic->irq_chip_data_tmu;
-       virq = regmap_irq_get_virq(regmap_irq_chip, irq);
-       if (virq < 0) {
-               dev_err(&pdev->dev,
-                       "failed to get virtual interrupt=%d\n", irq);
-               return virq;
-       }
-
-       ret = devm_request_threaded_irq(&pdev->dev, virq,
-                                       NULL, bxt_wcove_tmu_irq_handler,
-                                       IRQF_ONESHOT, "bxt_wcove_tmu", wctmu);
-       if (ret) {
-               dev_err(&pdev->dev, "request irq failed: %d,virq: %d\n",
-                                                       ret, virq);
-               return ret;
-       }
-       wctmu->irq = virq;
-
-       /* Unmask TMU second level Wake & System alarm */
-       regmap_update_bits(wctmu->regmap, BXTWC_MTMUIRQ_REG,
-                                 BXTWC_TMU_ALRM_MASK, 0);
-
-       platform_set_drvdata(pdev, wctmu);
-       return 0;
-}
-
-static int bxt_wcove_tmu_remove(struct platform_device *pdev)
-{
-       struct wcove_tmu *wctmu = platform_get_drvdata(pdev);
-       unsigned int val;
-
-       /* Mask TMU interrupts */
-       regmap_read(wctmu->regmap, BXTWC_MIRQLVL1, &val);
-       regmap_write(wctmu->regmap, BXTWC_MIRQLVL1,
-                       val | BXTWC_MIRQLVL1_MTMU);
-       regmap_read(wctmu->regmap, BXTWC_MTMUIRQ_REG, &val);
-       regmap_write(wctmu->regmap, BXTWC_MTMUIRQ_REG,
-                       val | BXTWC_TMU_ALRM_MASK);
-       return 0;
-}
-
-#ifdef CONFIG_PM_SLEEP
-static int bxtwc_tmu_suspend(struct device *dev)
-{
-       struct wcove_tmu *wctmu = dev_get_drvdata(dev);
-
-       enable_irq_wake(wctmu->irq);
-       return 0;
-}
-
-static int bxtwc_tmu_resume(struct device *dev)
-{
-       struct wcove_tmu *wctmu = dev_get_drvdata(dev);
-
-       disable_irq_wake(wctmu->irq);
-       return 0;
-}
-#endif
-
-static SIMPLE_DEV_PM_OPS(bxtwc_tmu_pm_ops, bxtwc_tmu_suspend, bxtwc_tmu_resume);
-
-static const struct platform_device_id bxt_wcove_tmu_id_table[] = {
-       { .name = "bxt_wcove_tmu" },
-       {},
-};
-MODULE_DEVICE_TABLE(platform, bxt_wcove_tmu_id_table);
-
-static struct platform_driver bxt_wcove_tmu_driver = {
-       .probe = bxt_wcove_tmu_probe,
-       .remove = bxt_wcove_tmu_remove,
-       .driver = {
-               .name = "bxt_wcove_tmu",
-               .pm     = &bxtwc_tmu_pm_ops,
-       },
-       .id_table = bxt_wcove_tmu_id_table,
-};
-
-module_platform_driver(bxt_wcove_tmu_driver);
-
-MODULE_LICENSE("GPL v2");
-MODULE_AUTHOR("Nilesh Bacchewar <nilesh.bacchewar@intel.com>");
-MODULE_DESCRIPTION("BXT Whiskey Cove TMU Driver");