[PATCH 2/2] mfd: add regulator cell to Cherry Trail Whiskey Cove PMIC

From: Andrey Zhizhikin
Date: Thu Oct 24 2019 - 10:30:09 EST


Add a regulator mfd cell to Whiskey Cove PMIC driver, which is used to
supply various voltage rails.

In addition, make the initialization of this mfd driver early enough in
order to provide regulator cell to mmc sub-system when it is initialized.

Signed-off-by: Andrey Zhizhikin <andrey.zhizhikin@xxxxxxxxxxxxxxxxxxxx>
---
drivers/mfd/intel_soc_pmic_chtwc.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/intel_soc_pmic_chtwc.c b/drivers/mfd/intel_soc_pmic_chtwc.c
index be84bb2aa837..47c0d9994784 100644
--- a/drivers/mfd/intel_soc_pmic_chtwc.c
+++ b/drivers/mfd/intel_soc_pmic_chtwc.c
@@ -17,6 +17,7 @@
#include <linux/mfd/core.h>
#include <linux/mfd/intel_soc_pmic.h>
#include <linux/regmap.h>
+#include <linux/regulator/intel-cht-wc-regulator.h>

/* PMIC device registers */
#define REG_OFFSET_MASK GENMASK(7, 0)
@@ -58,6 +59,11 @@ static struct mfd_cell cht_wc_dev[] = {
.name = "cht_wcove_ext_chgr",
.num_resources = ARRAY_SIZE(cht_wc_ext_charger_resources),
.resources = cht_wc_ext_charger_resources,
+ }, {
+ .name = "cht_wcove_regulator",
+ .id = CHT_WC_REGULATOR_VSDIO + 1,
+ .num_resources = 0,
+ .resources = NULL,
},
{ .name = "cht_wcove_region", },
{ .name = "cht_wcove_leds", },
@@ -215,7 +221,7 @@ static const struct acpi_device_id cht_wc_acpi_ids[] = {
{ }
};

-static struct i2c_driver cht_wc_driver = {
+static struct i2c_driver cht_wc_i2c_driver = {
.driver = {
.name = "CHT Whiskey Cove PMIC",
.pm = &cht_wc_pm_ops,
@@ -225,4 +231,9 @@ static struct i2c_driver cht_wc_driver = {
.shutdown = cht_wc_shutdown,
.id_table = cht_wc_i2c_id,
};
-builtin_i2c_driver(cht_wc_driver);
+
+static int __init cht_wc_i2c_init(void)
+{
+ return i2c_add_driver(&cht_wc_i2c_driver);
+}
+subsys_initcall(cht_wc_i2c_init);
--
2.17.1