18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci// Copyright (C) 2020 ROHM Semiconductors
38c2ecf20Sopenharmony_ci// ROHM BD9576MUF/BD9573MUF regulator driver
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/delay.h>
68c2ecf20Sopenharmony_ci#include <linux/err.h>
78c2ecf20Sopenharmony_ci#include <linux/gpio/consumer.h>
88c2ecf20Sopenharmony_ci#include <linux/interrupt.h>
98c2ecf20Sopenharmony_ci#include <linux/kernel.h>
108c2ecf20Sopenharmony_ci#include <linux/mfd/rohm-bd957x.h>
118c2ecf20Sopenharmony_ci#include <linux/mfd/rohm-generic.h>
128c2ecf20Sopenharmony_ci#include <linux/module.h>
138c2ecf20Sopenharmony_ci#include <linux/of.h>
148c2ecf20Sopenharmony_ci#include <linux/platform_device.h>
158c2ecf20Sopenharmony_ci#include <linux/regulator/driver.h>
168c2ecf20Sopenharmony_ci#include <linux/regulator/machine.h>
178c2ecf20Sopenharmony_ci#include <linux/regulator/of_regulator.h>
188c2ecf20Sopenharmony_ci#include <linux/slab.h>
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define BD957X_VOUTS1_VOLT	3300000
218c2ecf20Sopenharmony_ci#define BD957X_VOUTS4_BASE_VOLT	1030000
228c2ecf20Sopenharmony_ci#define BD957X_VOUTS34_NUM_VOLT	32
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_cistatic int vout1_volt_table[] = {5000000, 4900000, 4800000, 4700000, 4600000,
258c2ecf20Sopenharmony_ci				 4500000, 4500000, 4500000, 5000000, 5100000,
268c2ecf20Sopenharmony_ci				 5200000, 5300000, 5400000, 5500000, 5500000,
278c2ecf20Sopenharmony_ci				 5500000};
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_cistatic int vout2_volt_table[] = {1800000, 1780000, 1760000, 1740000, 1720000,
308c2ecf20Sopenharmony_ci				 1700000, 1680000, 1660000, 1800000, 1820000,
318c2ecf20Sopenharmony_ci				 1840000, 1860000, 1880000, 1900000, 1920000,
328c2ecf20Sopenharmony_ci				 1940000};
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_cistatic int voutl1_volt_table[] = {2500000, 2540000, 2580000, 2620000, 2660000,
358c2ecf20Sopenharmony_ci				  2700000, 2740000, 2780000, 2500000, 2460000,
368c2ecf20Sopenharmony_ci				  2420000, 2380000, 2340000, 2300000, 2260000,
378c2ecf20Sopenharmony_ci				  2220000};
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_cistruct bd957x_regulator_data {
408c2ecf20Sopenharmony_ci	struct regulator_desc desc;
418c2ecf20Sopenharmony_ci	int base_voltage;
428c2ecf20Sopenharmony_ci};
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_cistatic int bd957x_vout34_list_voltage(struct regulator_dev *rdev,
458c2ecf20Sopenharmony_ci				      unsigned int selector)
468c2ecf20Sopenharmony_ci{
478c2ecf20Sopenharmony_ci	const struct regulator_desc *desc = rdev->desc;
488c2ecf20Sopenharmony_ci	int multiplier = selector & desc->vsel_mask & 0x7f;
498c2ecf20Sopenharmony_ci	int tune;
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci	/* VOUT3 and 4 has 10mV step */
528c2ecf20Sopenharmony_ci	tune = multiplier * 10000;
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci	if (!(selector & 0x80))
558c2ecf20Sopenharmony_ci		return desc->fixed_uV - tune;
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci	return desc->fixed_uV + tune;
588c2ecf20Sopenharmony_ci}
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_cistatic int bd957x_list_voltage(struct regulator_dev *rdev,
618c2ecf20Sopenharmony_ci			       unsigned int selector)
628c2ecf20Sopenharmony_ci{
638c2ecf20Sopenharmony_ci	const struct regulator_desc *desc = rdev->desc;
648c2ecf20Sopenharmony_ci	int index = selector & desc->vsel_mask & 0x7f;
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci	if (!(selector & 0x80))
678c2ecf20Sopenharmony_ci		index += desc->n_voltages/2;
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci	if (index >= desc->n_voltages)
708c2ecf20Sopenharmony_ci		return -EINVAL;
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci	return desc->volt_table[index];
738c2ecf20Sopenharmony_ci}
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_cistatic const struct regulator_ops bd957x_vout34_ops = {
768c2ecf20Sopenharmony_ci	.is_enabled = regulator_is_enabled_regmap,
778c2ecf20Sopenharmony_ci	.list_voltage = bd957x_vout34_list_voltage,
788c2ecf20Sopenharmony_ci	.get_voltage_sel = regulator_get_voltage_sel_regmap,
798c2ecf20Sopenharmony_ci};
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_cistatic const struct regulator_ops bd957X_vouts1_regulator_ops = {
828c2ecf20Sopenharmony_ci	.is_enabled = regulator_is_enabled_regmap,
838c2ecf20Sopenharmony_ci};
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_cistatic const struct regulator_ops bd957x_ops = {
868c2ecf20Sopenharmony_ci	.is_enabled = regulator_is_enabled_regmap,
878c2ecf20Sopenharmony_ci	.list_voltage = bd957x_list_voltage,
888c2ecf20Sopenharmony_ci	.get_voltage_sel = regulator_get_voltage_sel_regmap,
898c2ecf20Sopenharmony_ci};
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_cistatic struct bd957x_regulator_data bd9576_regulators[] = {
928c2ecf20Sopenharmony_ci	{
938c2ecf20Sopenharmony_ci		.desc = {
948c2ecf20Sopenharmony_ci			.name = "VD50",
958c2ecf20Sopenharmony_ci			.of_match = of_match_ptr("regulator-vd50"),
968c2ecf20Sopenharmony_ci			.regulators_node = of_match_ptr("regulators"),
978c2ecf20Sopenharmony_ci			.id = BD957X_VD50,
988c2ecf20Sopenharmony_ci			.type = REGULATOR_VOLTAGE,
998c2ecf20Sopenharmony_ci			.ops = &bd957x_ops,
1008c2ecf20Sopenharmony_ci			.volt_table = &vout1_volt_table[0],
1018c2ecf20Sopenharmony_ci			.n_voltages = ARRAY_SIZE(vout1_volt_table),
1028c2ecf20Sopenharmony_ci			.vsel_reg = BD957X_REG_VOUT1_TUNE,
1038c2ecf20Sopenharmony_ci			.vsel_mask = BD957X_MASK_VOUT1_TUNE,
1048c2ecf20Sopenharmony_ci			.enable_reg = BD957X_REG_POW_TRIGGER1,
1058c2ecf20Sopenharmony_ci			.enable_mask = BD957X_REGULATOR_EN_MASK,
1068c2ecf20Sopenharmony_ci			.enable_val = BD957X_REGULATOR_DIS_VAL,
1078c2ecf20Sopenharmony_ci			.enable_is_inverted = true,
1088c2ecf20Sopenharmony_ci			.owner = THIS_MODULE,
1098c2ecf20Sopenharmony_ci		},
1108c2ecf20Sopenharmony_ci	},
1118c2ecf20Sopenharmony_ci	{
1128c2ecf20Sopenharmony_ci		.desc = {
1138c2ecf20Sopenharmony_ci			.name = "VD18",
1148c2ecf20Sopenharmony_ci			.of_match = of_match_ptr("regulator-vd18"),
1158c2ecf20Sopenharmony_ci			.regulators_node = of_match_ptr("regulators"),
1168c2ecf20Sopenharmony_ci			.id = BD957X_VD18,
1178c2ecf20Sopenharmony_ci			.type = REGULATOR_VOLTAGE,
1188c2ecf20Sopenharmony_ci			.ops = &bd957x_ops,
1198c2ecf20Sopenharmony_ci			.volt_table = &vout2_volt_table[0],
1208c2ecf20Sopenharmony_ci			.n_voltages = ARRAY_SIZE(vout2_volt_table),
1218c2ecf20Sopenharmony_ci			.vsel_reg = BD957X_REG_VOUT2_TUNE,
1228c2ecf20Sopenharmony_ci			.vsel_mask = BD957X_MASK_VOUT2_TUNE,
1238c2ecf20Sopenharmony_ci			.enable_reg = BD957X_REG_POW_TRIGGER2,
1248c2ecf20Sopenharmony_ci			.enable_mask = BD957X_REGULATOR_EN_MASK,
1258c2ecf20Sopenharmony_ci			.enable_val = BD957X_REGULATOR_DIS_VAL,
1268c2ecf20Sopenharmony_ci			.enable_is_inverted = true,
1278c2ecf20Sopenharmony_ci			.owner = THIS_MODULE,
1288c2ecf20Sopenharmony_ci		},
1298c2ecf20Sopenharmony_ci	},
1308c2ecf20Sopenharmony_ci	{
1318c2ecf20Sopenharmony_ci		.desc = {
1328c2ecf20Sopenharmony_ci			.name = "VDDDR",
1338c2ecf20Sopenharmony_ci			.of_match = of_match_ptr("regulator-vdddr"),
1348c2ecf20Sopenharmony_ci			.regulators_node = of_match_ptr("regulators"),
1358c2ecf20Sopenharmony_ci			.id = BD957X_VDDDR,
1368c2ecf20Sopenharmony_ci			.ops = &bd957x_vout34_ops,
1378c2ecf20Sopenharmony_ci			.type = REGULATOR_VOLTAGE,
1388c2ecf20Sopenharmony_ci			.n_voltages = BD957X_VOUTS34_NUM_VOLT,
1398c2ecf20Sopenharmony_ci			.vsel_reg = BD957X_REG_VOUT3_TUNE,
1408c2ecf20Sopenharmony_ci			.vsel_mask = BD957X_MASK_VOUT3_TUNE,
1418c2ecf20Sopenharmony_ci			.enable_reg = BD957X_REG_POW_TRIGGER3,
1428c2ecf20Sopenharmony_ci			.enable_mask = BD957X_REGULATOR_EN_MASK,
1438c2ecf20Sopenharmony_ci			.enable_val = BD957X_REGULATOR_DIS_VAL,
1448c2ecf20Sopenharmony_ci			.enable_is_inverted = true,
1458c2ecf20Sopenharmony_ci			.owner = THIS_MODULE,
1468c2ecf20Sopenharmony_ci		},
1478c2ecf20Sopenharmony_ci	},
1488c2ecf20Sopenharmony_ci	{
1498c2ecf20Sopenharmony_ci		.desc = {
1508c2ecf20Sopenharmony_ci			.name = "VD10",
1518c2ecf20Sopenharmony_ci			.of_match = of_match_ptr("regulator-vd10"),
1528c2ecf20Sopenharmony_ci			.regulators_node = of_match_ptr("regulators"),
1538c2ecf20Sopenharmony_ci			.id = BD957X_VD10,
1548c2ecf20Sopenharmony_ci			.ops = &bd957x_vout34_ops,
1558c2ecf20Sopenharmony_ci			.type = REGULATOR_VOLTAGE,
1568c2ecf20Sopenharmony_ci			.fixed_uV = BD957X_VOUTS4_BASE_VOLT,
1578c2ecf20Sopenharmony_ci			.n_voltages = BD957X_VOUTS34_NUM_VOLT,
1588c2ecf20Sopenharmony_ci			.vsel_reg = BD957X_REG_VOUT4_TUNE,
1598c2ecf20Sopenharmony_ci			.vsel_mask = BD957X_MASK_VOUT4_TUNE,
1608c2ecf20Sopenharmony_ci			.enable_reg = BD957X_REG_POW_TRIGGER4,
1618c2ecf20Sopenharmony_ci			.enable_mask = BD957X_REGULATOR_EN_MASK,
1628c2ecf20Sopenharmony_ci			.enable_val = BD957X_REGULATOR_DIS_VAL,
1638c2ecf20Sopenharmony_ci			.enable_is_inverted = true,
1648c2ecf20Sopenharmony_ci			.owner = THIS_MODULE,
1658c2ecf20Sopenharmony_ci		},
1668c2ecf20Sopenharmony_ci	},
1678c2ecf20Sopenharmony_ci	{
1688c2ecf20Sopenharmony_ci		.desc = {
1698c2ecf20Sopenharmony_ci			.name = "VOUTL1",
1708c2ecf20Sopenharmony_ci			.of_match = of_match_ptr("regulator-voutl1"),
1718c2ecf20Sopenharmony_ci			.regulators_node = of_match_ptr("regulators"),
1728c2ecf20Sopenharmony_ci			.id = BD957X_VOUTL1,
1738c2ecf20Sopenharmony_ci			.ops = &bd957x_ops,
1748c2ecf20Sopenharmony_ci			.type = REGULATOR_VOLTAGE,
1758c2ecf20Sopenharmony_ci			.volt_table = &voutl1_volt_table[0],
1768c2ecf20Sopenharmony_ci			.n_voltages = ARRAY_SIZE(voutl1_volt_table),
1778c2ecf20Sopenharmony_ci			.vsel_reg = BD957X_REG_VOUTL1_TUNE,
1788c2ecf20Sopenharmony_ci			.vsel_mask = BD957X_MASK_VOUTL1_TUNE,
1798c2ecf20Sopenharmony_ci			.enable_reg = BD957X_REG_POW_TRIGGERL1,
1808c2ecf20Sopenharmony_ci			.enable_mask = BD957X_REGULATOR_EN_MASK,
1818c2ecf20Sopenharmony_ci			.enable_val = BD957X_REGULATOR_DIS_VAL,
1828c2ecf20Sopenharmony_ci			.enable_is_inverted = true,
1838c2ecf20Sopenharmony_ci			.owner = THIS_MODULE,
1848c2ecf20Sopenharmony_ci		},
1858c2ecf20Sopenharmony_ci	},
1868c2ecf20Sopenharmony_ci	{
1878c2ecf20Sopenharmony_ci		.desc = {
1888c2ecf20Sopenharmony_ci			.name = "VOUTS1",
1898c2ecf20Sopenharmony_ci			.of_match = of_match_ptr("regulator-vouts1"),
1908c2ecf20Sopenharmony_ci			.regulators_node = of_match_ptr("regulators"),
1918c2ecf20Sopenharmony_ci			.id = BD957X_VOUTS1,
1928c2ecf20Sopenharmony_ci			.ops = &bd957X_vouts1_regulator_ops,
1938c2ecf20Sopenharmony_ci			.type = REGULATOR_VOLTAGE,
1948c2ecf20Sopenharmony_ci			.n_voltages = 1,
1958c2ecf20Sopenharmony_ci			.fixed_uV = BD957X_VOUTS1_VOLT,
1968c2ecf20Sopenharmony_ci			.enable_reg = BD957X_REG_POW_TRIGGERS1,
1978c2ecf20Sopenharmony_ci			.enable_mask = BD957X_REGULATOR_EN_MASK,
1988c2ecf20Sopenharmony_ci			.enable_val = BD957X_REGULATOR_DIS_VAL,
1998c2ecf20Sopenharmony_ci			.enable_is_inverted = true,
2008c2ecf20Sopenharmony_ci			.owner = THIS_MODULE,
2018c2ecf20Sopenharmony_ci		},
2028c2ecf20Sopenharmony_ci	},
2038c2ecf20Sopenharmony_ci};
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_cistatic int bd957x_probe(struct platform_device *pdev)
2068c2ecf20Sopenharmony_ci{
2078c2ecf20Sopenharmony_ci	struct regmap *regmap;
2088c2ecf20Sopenharmony_ci	struct regulator_config config = { 0 };
2098c2ecf20Sopenharmony_ci	int i;
2108c2ecf20Sopenharmony_ci	bool vout_mode, ddr_sel;
2118c2ecf20Sopenharmony_ci	const struct bd957x_regulator_data *reg_data = &bd9576_regulators[0];
2128c2ecf20Sopenharmony_ci	unsigned int num_reg_data = ARRAY_SIZE(bd9576_regulators);
2138c2ecf20Sopenharmony_ci	enum rohm_chip_type chip = platform_get_device_id(pdev)->driver_data;
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ci	regmap = dev_get_regmap(pdev->dev.parent, NULL);
2168c2ecf20Sopenharmony_ci	if (!regmap) {
2178c2ecf20Sopenharmony_ci		dev_err(&pdev->dev, "No regmap\n");
2188c2ecf20Sopenharmony_ci		return -EINVAL;
2198c2ecf20Sopenharmony_ci	}
2208c2ecf20Sopenharmony_ci	vout_mode = of_property_read_bool(pdev->dev.parent->of_node,
2218c2ecf20Sopenharmony_ci					 "rohm,vout1-en-low");
2228c2ecf20Sopenharmony_ci	if (vout_mode) {
2238c2ecf20Sopenharmony_ci		struct gpio_desc *en;
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_ci		dev_dbg(&pdev->dev, "GPIO controlled mode\n");
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ci		/* VOUT1 enable state judged by VOUT1_EN pin */
2288c2ecf20Sopenharmony_ci		/* See if we have GPIO defined */
2298c2ecf20Sopenharmony_ci		en = devm_gpiod_get_from_of_node(&pdev->dev,
2308c2ecf20Sopenharmony_ci						 pdev->dev.parent->of_node,
2318c2ecf20Sopenharmony_ci						 "rohm,vout1-en-gpios", 0,
2328c2ecf20Sopenharmony_ci						 GPIOD_OUT_LOW, "vout1-en");
2338c2ecf20Sopenharmony_ci		if (!IS_ERR(en)) {
2348c2ecf20Sopenharmony_ci			/* VOUT1_OPS gpio ctrl */
2358c2ecf20Sopenharmony_ci			/*
2368c2ecf20Sopenharmony_ci			 * Regulator core prioritizes the ena_gpio over
2378c2ecf20Sopenharmony_ci			 * enable/disable/is_enabled callbacks so no need to
2388c2ecf20Sopenharmony_ci			 * clear them. We can still use same ops
2398c2ecf20Sopenharmony_ci			 */
2408c2ecf20Sopenharmony_ci			config.ena_gpiod = en;
2418c2ecf20Sopenharmony_ci		} else {
2428c2ecf20Sopenharmony_ci			/*
2438c2ecf20Sopenharmony_ci			 * In theory it is possible someone wants to set
2448c2ecf20Sopenharmony_ci			 * vout1-en LOW during OTP loading and set VOUT1 to be
2458c2ecf20Sopenharmony_ci			 * controlled by GPIO - but control the GPIO from some
2468c2ecf20Sopenharmony_ci			 * where else than this driver. For that to work we
2478c2ecf20Sopenharmony_ci			 * should unset the is_enabled callback here.
2488c2ecf20Sopenharmony_ci			 *
2498c2ecf20Sopenharmony_ci			 * I believe such case where rohm,vout1-en-low is set
2508c2ecf20Sopenharmony_ci			 * and vout1-en-gpios is not is likely to be a
2518c2ecf20Sopenharmony_ci			 * misconfiguration. So let's just err out for now.
2528c2ecf20Sopenharmony_ci			 */
2538c2ecf20Sopenharmony_ci			dev_err(&pdev->dev,
2548c2ecf20Sopenharmony_ci				"Failed to get VOUT1 control GPIO\n");
2558c2ecf20Sopenharmony_ci			return PTR_ERR(en);
2568c2ecf20Sopenharmony_ci		}
2578c2ecf20Sopenharmony_ci	}
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_ci	/*
2608c2ecf20Sopenharmony_ci	 * If more than one PMIC needs to be controlled by same processor then
2618c2ecf20Sopenharmony_ci	 * allocate the regulator data array here and use bd9576_regulators as
2628c2ecf20Sopenharmony_ci	 * template. At the moment I see no such use-case so I spare some
2638c2ecf20Sopenharmony_ci	 * bytes and use bd9576_regulators directly for non-constant configs
2648c2ecf20Sopenharmony_ci	 * like DDR voltage selection.
2658c2ecf20Sopenharmony_ci	 */
2668c2ecf20Sopenharmony_ci	ddr_sel =  of_property_read_bool(pdev->dev.parent->of_node,
2678c2ecf20Sopenharmony_ci					 "rohm,ddr-sel-low");
2688c2ecf20Sopenharmony_ci	if (ddr_sel)
2698c2ecf20Sopenharmony_ci		bd9576_regulators[2].desc.fixed_uV = 1350000;
2708c2ecf20Sopenharmony_ci	else
2718c2ecf20Sopenharmony_ci		bd9576_regulators[2].desc.fixed_uV = 1500000;
2728c2ecf20Sopenharmony_ci
2738c2ecf20Sopenharmony_ci	switch (chip) {
2748c2ecf20Sopenharmony_ci	case ROHM_CHIP_TYPE_BD9576:
2758c2ecf20Sopenharmony_ci		dev_dbg(&pdev->dev, "Found BD9576MUF\n");
2768c2ecf20Sopenharmony_ci		break;
2778c2ecf20Sopenharmony_ci	case ROHM_CHIP_TYPE_BD9573:
2788c2ecf20Sopenharmony_ci		dev_dbg(&pdev->dev, "Found BD9573MUF\n");
2798c2ecf20Sopenharmony_ci		break;
2808c2ecf20Sopenharmony_ci	default:
2818c2ecf20Sopenharmony_ci		dev_err(&pdev->dev, "Unsupported chip type\n");
2828c2ecf20Sopenharmony_ci		return -EINVAL;
2838c2ecf20Sopenharmony_ci	}
2848c2ecf20Sopenharmony_ci
2858c2ecf20Sopenharmony_ci	config.dev = pdev->dev.parent;
2868c2ecf20Sopenharmony_ci	config.regmap = regmap;
2878c2ecf20Sopenharmony_ci
2888c2ecf20Sopenharmony_ci	for (i = 0; i < num_reg_data; i++) {
2898c2ecf20Sopenharmony_ci
2908c2ecf20Sopenharmony_ci		const struct regulator_desc *desc;
2918c2ecf20Sopenharmony_ci		struct regulator_dev *rdev;
2928c2ecf20Sopenharmony_ci		const struct bd957x_regulator_data *r;
2938c2ecf20Sopenharmony_ci
2948c2ecf20Sopenharmony_ci		r = &reg_data[i];
2958c2ecf20Sopenharmony_ci		desc = &r->desc;
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_ci		rdev = devm_regulator_register(&pdev->dev, desc, &config);
2988c2ecf20Sopenharmony_ci		if (IS_ERR(rdev)) {
2998c2ecf20Sopenharmony_ci			dev_err(&pdev->dev,
3008c2ecf20Sopenharmony_ci				"failed to register %s regulator\n",
3018c2ecf20Sopenharmony_ci				desc->name);
3028c2ecf20Sopenharmony_ci			return PTR_ERR(rdev);
3038c2ecf20Sopenharmony_ci		}
3048c2ecf20Sopenharmony_ci		/*
3058c2ecf20Sopenharmony_ci		 * Clear the VOUT1 GPIO setting - rest of the regulators do not
3068c2ecf20Sopenharmony_ci		 * support GPIO control
3078c2ecf20Sopenharmony_ci		 */
3088c2ecf20Sopenharmony_ci		config.ena_gpiod = NULL;
3098c2ecf20Sopenharmony_ci	}
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_ci	return 0;
3128c2ecf20Sopenharmony_ci}
3138c2ecf20Sopenharmony_ci
3148c2ecf20Sopenharmony_cistatic const struct platform_device_id bd957x_pmic_id[] = {
3158c2ecf20Sopenharmony_ci	{ "bd9573-pmic", ROHM_CHIP_TYPE_BD9573 },
3168c2ecf20Sopenharmony_ci	{ "bd9576-pmic", ROHM_CHIP_TYPE_BD9576 },
3178c2ecf20Sopenharmony_ci	{ },
3188c2ecf20Sopenharmony_ci};
3198c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(platform, bd957x_pmic_id);
3208c2ecf20Sopenharmony_ci
3218c2ecf20Sopenharmony_cistatic struct platform_driver bd957x_regulator = {
3228c2ecf20Sopenharmony_ci	.driver = {
3238c2ecf20Sopenharmony_ci		.name = "bd957x-pmic",
3248c2ecf20Sopenharmony_ci	},
3258c2ecf20Sopenharmony_ci	.probe = bd957x_probe,
3268c2ecf20Sopenharmony_ci	.id_table = bd957x_pmic_id,
3278c2ecf20Sopenharmony_ci};
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_cimodule_platform_driver(bd957x_regulator);
3308c2ecf20Sopenharmony_ci
3318c2ecf20Sopenharmony_ciMODULE_AUTHOR("Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>");
3328c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("ROHM BD9576/BD9573 voltage regulator driver");
3338c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL");
3348c2ecf20Sopenharmony_ciMODULE_ALIAS("platform:bd957x-pmic");
335