xref: /linux/drivers/regulator/max77693-regulator.c (revision cea8aa3a93d1734816e1e3f7b118e1dddf3f4aaa)
186cf635aSJavier Martinez Canillas /*
286cf635aSJavier Martinez Canillas  * max77693.c - Regulator driver for the Maxim 77693 and 77843
386cf635aSJavier Martinez Canillas  *
486cf635aSJavier Martinez Canillas  * Copyright (C) 2013-2015 Samsung Electronics
586cf635aSJavier Martinez Canillas  * Jonghwa Lee <jonghwa3.lee@samsung.com>
6*cea8aa3aSKrzysztof Kozlowski  * Krzysztof Kozlowski <krzk@kernel.org>
786cf635aSJavier Martinez Canillas  *
886cf635aSJavier Martinez Canillas  * This program is free software; you can redistribute it and/or modify
986cf635aSJavier Martinez Canillas  * it under the terms of the GNU General Public License as published by
1086cf635aSJavier Martinez Canillas  * the Free Software Foundation; either version 2 of the License, or
1186cf635aSJavier Martinez Canillas  * (at your option) any later version.
1286cf635aSJavier Martinez Canillas  *
1386cf635aSJavier Martinez Canillas  * This program is distributed in the hope that it will be useful,
1486cf635aSJavier Martinez Canillas  * but WITHOUT ANY WARRANTY; without even the implied warranty of
1586cf635aSJavier Martinez Canillas  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1686cf635aSJavier Martinez Canillas  * GNU General Public License for more details.
1786cf635aSJavier Martinez Canillas  *
1886cf635aSJavier Martinez Canillas  * You should have received a copy of the GNU General Public License
1986cf635aSJavier Martinez Canillas  * along with this program; if not, write to the Free Software
2086cf635aSJavier Martinez Canillas  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
2186cf635aSJavier Martinez Canillas  *
2286cf635aSJavier Martinez Canillas  * This driver is based on max77686.c
2386cf635aSJavier Martinez Canillas  */
2486cf635aSJavier Martinez Canillas 
2586cf635aSJavier Martinez Canillas #include <linux/err.h>
2686cf635aSJavier Martinez Canillas #include <linux/slab.h>
2786cf635aSJavier Martinez Canillas #include <linux/platform_device.h>
2886cf635aSJavier Martinez Canillas #include <linux/module.h>
2986cf635aSJavier Martinez Canillas #include <linux/export.h>
3086cf635aSJavier Martinez Canillas #include <linux/regulator/driver.h>
3186cf635aSJavier Martinez Canillas #include <linux/regulator/machine.h>
3286cf635aSJavier Martinez Canillas #include <linux/mfd/max77693.h>
3386cf635aSJavier Martinez Canillas #include <linux/mfd/max77693-common.h>
3486cf635aSJavier Martinez Canillas #include <linux/mfd/max77693-private.h>
3586cf635aSJavier Martinez Canillas #include <linux/mfd/max77843-private.h>
3686cf635aSJavier Martinez Canillas #include <linux/regulator/of_regulator.h>
3786cf635aSJavier Martinez Canillas #include <linux/regmap.h>
3886cf635aSJavier Martinez Canillas 
3986cf635aSJavier Martinez Canillas /*
4086cf635aSJavier Martinez Canillas  * ID for MAX77843 regulators.
4186cf635aSJavier Martinez Canillas  * There is no need for such for MAX77693.
4286cf635aSJavier Martinez Canillas  */
4386cf635aSJavier Martinez Canillas enum max77843_regulator_type {
4486cf635aSJavier Martinez Canillas 	MAX77843_SAFEOUT1 = 0,
4586cf635aSJavier Martinez Canillas 	MAX77843_SAFEOUT2,
4686cf635aSJavier Martinez Canillas 	MAX77843_CHARGER,
4786cf635aSJavier Martinez Canillas 
4886cf635aSJavier Martinez Canillas 	MAX77843_NUM,
4986cf635aSJavier Martinez Canillas };
5086cf635aSJavier Martinez Canillas 
5186cf635aSJavier Martinez Canillas /* Register differences between chargers: MAX77693 and MAX77843 */
5286cf635aSJavier Martinez Canillas struct chg_reg_data {
5386cf635aSJavier Martinez Canillas 	unsigned int linear_reg;
5486cf635aSJavier Martinez Canillas 	unsigned int linear_mask;
5586cf635aSJavier Martinez Canillas 	unsigned int uA_step;
5686cf635aSJavier Martinez Canillas 	unsigned int min_sel;
5786cf635aSJavier Martinez Canillas };
5886cf635aSJavier Martinez Canillas 
5986cf635aSJavier Martinez Canillas /*
6086cf635aSJavier Martinez Canillas  * MAX77693 CHARGER regulator - Min : 20mA, Max : 2580mA, step : 20mA
6186cf635aSJavier Martinez Canillas  * 0x00, 0x01, 0x2, 0x03	= 60 mA
6286cf635aSJavier Martinez Canillas  * 0x04 ~ 0x7E			= (60 + (X - 3) * 20) mA
6386cf635aSJavier Martinez Canillas  * Actually for MAX77693 the driver manipulates the maximum input current,
6486cf635aSJavier Martinez Canillas  * not the fast charge current (output). This should be fixed.
6586cf635aSJavier Martinez Canillas  *
6686cf635aSJavier Martinez Canillas  * On MAX77843 the calculation formula is the same (except values).
6786cf635aSJavier Martinez Canillas  * Fortunately it properly manipulates the fast charge current.
6886cf635aSJavier Martinez Canillas  */
6986cf635aSJavier Martinez Canillas static int max77693_chg_get_current_limit(struct regulator_dev *rdev)
7086cf635aSJavier Martinez Canillas {
7186cf635aSJavier Martinez Canillas 	const struct chg_reg_data *reg_data = rdev_get_drvdata(rdev);
7286cf635aSJavier Martinez Canillas 	unsigned int chg_min_uA = rdev->constraints->min_uA;
7386cf635aSJavier Martinez Canillas 	unsigned int chg_max_uA = rdev->constraints->max_uA;
7486cf635aSJavier Martinez Canillas 	unsigned int reg, sel;
7586cf635aSJavier Martinez Canillas 	unsigned int val;
7686cf635aSJavier Martinez Canillas 	int ret;
7786cf635aSJavier Martinez Canillas 
7886cf635aSJavier Martinez Canillas 	ret = regmap_read(rdev->regmap, reg_data->linear_reg, &reg);
7986cf635aSJavier Martinez Canillas 	if (ret < 0)
8086cf635aSJavier Martinez Canillas 		return ret;
8186cf635aSJavier Martinez Canillas 
8286cf635aSJavier Martinez Canillas 	sel = reg & reg_data->linear_mask;
8386cf635aSJavier Martinez Canillas 
8486cf635aSJavier Martinez Canillas 	/* the first four codes for charger current are all 60mA */
8586cf635aSJavier Martinez Canillas 	if (sel <= reg_data->min_sel)
8686cf635aSJavier Martinez Canillas 		sel = 0;
8786cf635aSJavier Martinez Canillas 	else
8886cf635aSJavier Martinez Canillas 		sel -= reg_data->min_sel;
8986cf635aSJavier Martinez Canillas 
9086cf635aSJavier Martinez Canillas 	val = chg_min_uA + reg_data->uA_step * sel;
9186cf635aSJavier Martinez Canillas 	if (val > chg_max_uA)
9286cf635aSJavier Martinez Canillas 		return -EINVAL;
9386cf635aSJavier Martinez Canillas 
9486cf635aSJavier Martinez Canillas 	return val;
9586cf635aSJavier Martinez Canillas }
9686cf635aSJavier Martinez Canillas 
9786cf635aSJavier Martinez Canillas static int max77693_chg_set_current_limit(struct regulator_dev *rdev,
9886cf635aSJavier Martinez Canillas 						int min_uA, int max_uA)
9986cf635aSJavier Martinez Canillas {
10086cf635aSJavier Martinez Canillas 	const struct chg_reg_data *reg_data = rdev_get_drvdata(rdev);
10186cf635aSJavier Martinez Canillas 	unsigned int chg_min_uA = rdev->constraints->min_uA;
10286cf635aSJavier Martinez Canillas 	int sel = 0;
10386cf635aSJavier Martinez Canillas 
10486cf635aSJavier Martinez Canillas 	while (chg_min_uA + reg_data->uA_step * sel < min_uA)
10586cf635aSJavier Martinez Canillas 		sel++;
10686cf635aSJavier Martinez Canillas 
10786cf635aSJavier Martinez Canillas 	if (chg_min_uA + reg_data->uA_step * sel > max_uA)
10886cf635aSJavier Martinez Canillas 		return -EINVAL;
10986cf635aSJavier Martinez Canillas 
11086cf635aSJavier Martinez Canillas 	/* the first four codes for charger current are all 60mA */
11186cf635aSJavier Martinez Canillas 	sel += reg_data->min_sel;
11286cf635aSJavier Martinez Canillas 
11386cf635aSJavier Martinez Canillas 	return regmap_write(rdev->regmap, reg_data->linear_reg, sel);
11486cf635aSJavier Martinez Canillas }
11586cf635aSJavier Martinez Canillas /* end of CHARGER regulator ops */
11686cf635aSJavier Martinez Canillas 
11786cf635aSJavier Martinez Canillas /* Returns regmap suitable for given regulator on chosen device */
11886cf635aSJavier Martinez Canillas static struct regmap *max77693_get_regmap(enum max77693_types type,
11986cf635aSJavier Martinez Canillas 					  struct max77693_dev *max77693,
12086cf635aSJavier Martinez Canillas 					  int reg_id)
12186cf635aSJavier Martinez Canillas {
12286cf635aSJavier Martinez Canillas 	if (type == TYPE_MAX77693)
12386cf635aSJavier Martinez Canillas 		return max77693->regmap;
12486cf635aSJavier Martinez Canillas 
12586cf635aSJavier Martinez Canillas 	/* Else: TYPE_MAX77843 */
12686cf635aSJavier Martinez Canillas 	switch (reg_id) {
12786cf635aSJavier Martinez Canillas 	case MAX77843_SAFEOUT1:
12886cf635aSJavier Martinez Canillas 	case MAX77843_SAFEOUT2:
12986cf635aSJavier Martinez Canillas 		return max77693->regmap;
13086cf635aSJavier Martinez Canillas 	case MAX77843_CHARGER:
13186cf635aSJavier Martinez Canillas 		return max77693->regmap_chg;
13286cf635aSJavier Martinez Canillas 	default:
13386cf635aSJavier Martinez Canillas 		return max77693->regmap;
13486cf635aSJavier Martinez Canillas 	}
13586cf635aSJavier Martinez Canillas }
13686cf635aSJavier Martinez Canillas 
13786cf635aSJavier Martinez Canillas static const unsigned int max77693_safeout_table[] = {
13886cf635aSJavier Martinez Canillas 	4850000,
13986cf635aSJavier Martinez Canillas 	4900000,
14086cf635aSJavier Martinez Canillas 	4950000,
14186cf635aSJavier Martinez Canillas 	3300000,
14286cf635aSJavier Martinez Canillas };
14386cf635aSJavier Martinez Canillas 
14486cf635aSJavier Martinez Canillas static struct regulator_ops max77693_safeout_ops = {
14586cf635aSJavier Martinez Canillas 	.list_voltage		= regulator_list_voltage_table,
14686cf635aSJavier Martinez Canillas 	.is_enabled		= regulator_is_enabled_regmap,
14786cf635aSJavier Martinez Canillas 	.enable			= regulator_enable_regmap,
14886cf635aSJavier Martinez Canillas 	.disable		= regulator_disable_regmap,
14986cf635aSJavier Martinez Canillas 	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
15086cf635aSJavier Martinez Canillas 	.set_voltage_sel	= regulator_set_voltage_sel_regmap,
15186cf635aSJavier Martinez Canillas };
15286cf635aSJavier Martinez Canillas 
15386cf635aSJavier Martinez Canillas static struct regulator_ops max77693_charger_ops = {
15486cf635aSJavier Martinez Canillas 	.is_enabled		= regulator_is_enabled_regmap,
15586cf635aSJavier Martinez Canillas 	.enable			= regulator_enable_regmap,
15686cf635aSJavier Martinez Canillas 	.disable		= regulator_disable_regmap,
15786cf635aSJavier Martinez Canillas 	.get_current_limit	= max77693_chg_get_current_limit,
15886cf635aSJavier Martinez Canillas 	.set_current_limit	= max77693_chg_set_current_limit,
15986cf635aSJavier Martinez Canillas };
16086cf635aSJavier Martinez Canillas 
16186cf635aSJavier Martinez Canillas #define max77693_regulator_desc_esafeout(_num)	{		\
16286cf635aSJavier Martinez Canillas 	.name		= "ESAFEOUT"#_num,			\
16386cf635aSJavier Martinez Canillas 	.id		= MAX77693_ESAFEOUT##_num,		\
16486cf635aSJavier Martinez Canillas 	.of_match	= of_match_ptr("ESAFEOUT"#_num),	\
16586cf635aSJavier Martinez Canillas 	.regulators_node	= of_match_ptr("regulators"),	\
16686cf635aSJavier Martinez Canillas 	.n_voltages	= 4,					\
16786cf635aSJavier Martinez Canillas 	.ops		= &max77693_safeout_ops,		\
16886cf635aSJavier Martinez Canillas 	.type		= REGULATOR_VOLTAGE,			\
16986cf635aSJavier Martinez Canillas 	.owner		= THIS_MODULE,				\
17086cf635aSJavier Martinez Canillas 	.volt_table	= max77693_safeout_table,		\
17186cf635aSJavier Martinez Canillas 	.vsel_reg	= MAX77693_CHG_REG_SAFEOUT_CTRL,	\
17286cf635aSJavier Martinez Canillas 	.vsel_mask	= SAFEOUT_CTRL_SAFEOUT##_num##_MASK,	\
17386cf635aSJavier Martinez Canillas 	.enable_reg	= MAX77693_CHG_REG_SAFEOUT_CTRL,	\
17486cf635aSJavier Martinez Canillas 	.enable_mask	= SAFEOUT_CTRL_ENSAFEOUT##_num##_MASK ,	\
17586cf635aSJavier Martinez Canillas }
17686cf635aSJavier Martinez Canillas 
17786cf635aSJavier Martinez Canillas static const struct regulator_desc max77693_supported_regulators[] = {
17886cf635aSJavier Martinez Canillas 	max77693_regulator_desc_esafeout(1),
17986cf635aSJavier Martinez Canillas 	max77693_regulator_desc_esafeout(2),
18086cf635aSJavier Martinez Canillas 	{
18186cf635aSJavier Martinez Canillas 		.name = "CHARGER",
18286cf635aSJavier Martinez Canillas 		.id = MAX77693_CHARGER,
18386cf635aSJavier Martinez Canillas 		.of_match = of_match_ptr("CHARGER"),
18486cf635aSJavier Martinez Canillas 		.regulators_node = of_match_ptr("regulators"),
18586cf635aSJavier Martinez Canillas 		.ops = &max77693_charger_ops,
18686cf635aSJavier Martinez Canillas 		.type = REGULATOR_CURRENT,
18786cf635aSJavier Martinez Canillas 		.owner = THIS_MODULE,
18886cf635aSJavier Martinez Canillas 		.enable_reg = MAX77693_CHG_REG_CHG_CNFG_00,
18986cf635aSJavier Martinez Canillas 		.enable_mask = CHG_CNFG_00_CHG_MASK |
19086cf635aSJavier Martinez Canillas 				CHG_CNFG_00_BUCK_MASK,
19186cf635aSJavier Martinez Canillas 		.enable_val = CHG_CNFG_00_CHG_MASK | CHG_CNFG_00_BUCK_MASK,
19286cf635aSJavier Martinez Canillas 	},
19386cf635aSJavier Martinez Canillas };
19486cf635aSJavier Martinez Canillas 
19586cf635aSJavier Martinez Canillas static const struct chg_reg_data max77693_chg_reg_data = {
19686cf635aSJavier Martinez Canillas 	.linear_reg	= MAX77693_CHG_REG_CHG_CNFG_09,
19786cf635aSJavier Martinez Canillas 	.linear_mask	= CHG_CNFG_09_CHGIN_ILIM_MASK,
19886cf635aSJavier Martinez Canillas 	.uA_step	= 20000,
19986cf635aSJavier Martinez Canillas 	.min_sel	= 3,
20086cf635aSJavier Martinez Canillas };
20186cf635aSJavier Martinez Canillas 
20286cf635aSJavier Martinez Canillas #define	max77843_regulator_desc_esafeout(num)	{			\
20386cf635aSJavier Martinez Canillas 	.name		= "SAFEOUT" # num,				\
20486cf635aSJavier Martinez Canillas 	.id		= MAX77843_SAFEOUT ## num,			\
20586cf635aSJavier Martinez Canillas 	.ops		= &max77693_safeout_ops,			\
20686cf635aSJavier Martinez Canillas 	.of_match	= of_match_ptr("SAFEOUT" # num),		\
20786cf635aSJavier Martinez Canillas 	.regulators_node = of_match_ptr("regulators"),			\
20886cf635aSJavier Martinez Canillas 	.type		= REGULATOR_VOLTAGE,				\
20986cf635aSJavier Martinez Canillas 	.owner		= THIS_MODULE,					\
21086cf635aSJavier Martinez Canillas 	.n_voltages	= ARRAY_SIZE(max77693_safeout_table),		\
21186cf635aSJavier Martinez Canillas 	.volt_table	= max77693_safeout_table,			\
21286cf635aSJavier Martinez Canillas 	.enable_reg	= MAX77843_SYS_REG_SAFEOUTCTRL,			\
21386cf635aSJavier Martinez Canillas 	.enable_mask	= MAX77843_REG_SAFEOUTCTRL_ENSAFEOUT ## num,	\
21486cf635aSJavier Martinez Canillas 	.vsel_reg	= MAX77843_SYS_REG_SAFEOUTCTRL,			\
21586cf635aSJavier Martinez Canillas 	.vsel_mask	= MAX77843_REG_SAFEOUTCTRL_SAFEOUT ## num ## _MASK, \
21686cf635aSJavier Martinez Canillas }
21786cf635aSJavier Martinez Canillas 
21886cf635aSJavier Martinez Canillas static const struct regulator_desc max77843_supported_regulators[] = {
21986cf635aSJavier Martinez Canillas 	[MAX77843_SAFEOUT1] = max77843_regulator_desc_esafeout(1),
22086cf635aSJavier Martinez Canillas 	[MAX77843_SAFEOUT2] = max77843_regulator_desc_esafeout(2),
22186cf635aSJavier Martinez Canillas 	[MAX77843_CHARGER] = {
22286cf635aSJavier Martinez Canillas 		.name		= "CHARGER",
22386cf635aSJavier Martinez Canillas 		.id		= MAX77843_CHARGER,
22486cf635aSJavier Martinez Canillas 		.ops		= &max77693_charger_ops,
22586cf635aSJavier Martinez Canillas 		.of_match	= of_match_ptr("CHARGER"),
22686cf635aSJavier Martinez Canillas 		.regulators_node = of_match_ptr("regulators"),
22786cf635aSJavier Martinez Canillas 		.type		= REGULATOR_CURRENT,
22886cf635aSJavier Martinez Canillas 		.owner		= THIS_MODULE,
22986cf635aSJavier Martinez Canillas 		.enable_reg	= MAX77843_CHG_REG_CHG_CNFG_00,
23086cf635aSJavier Martinez Canillas 		.enable_mask	= MAX77843_CHG_MASK,
23186cf635aSJavier Martinez Canillas 		.enable_val	= MAX77843_CHG_MASK,
23286cf635aSJavier Martinez Canillas 	},
23386cf635aSJavier Martinez Canillas };
23486cf635aSJavier Martinez Canillas 
23586cf635aSJavier Martinez Canillas static const struct chg_reg_data max77843_chg_reg_data = {
23686cf635aSJavier Martinez Canillas 	.linear_reg	= MAX77843_CHG_REG_CHG_CNFG_02,
23786cf635aSJavier Martinez Canillas 	.linear_mask	= MAX77843_CHG_FAST_CHG_CURRENT_MASK,
23886cf635aSJavier Martinez Canillas 	.uA_step	= MAX77843_CHG_FAST_CHG_CURRENT_STEP,
23986cf635aSJavier Martinez Canillas 	.min_sel	= 2,
24086cf635aSJavier Martinez Canillas };
24186cf635aSJavier Martinez Canillas 
24286cf635aSJavier Martinez Canillas static int max77693_pmic_probe(struct platform_device *pdev)
24386cf635aSJavier Martinez Canillas {
24486cf635aSJavier Martinez Canillas 	enum max77693_types type = platform_get_device_id(pdev)->driver_data;
24586cf635aSJavier Martinez Canillas 	struct max77693_dev *iodev = dev_get_drvdata(pdev->dev.parent);
24686cf635aSJavier Martinez Canillas 	const struct regulator_desc *regulators;
24786cf635aSJavier Martinez Canillas 	unsigned int regulators_size;
24886cf635aSJavier Martinez Canillas 	int i;
24986cf635aSJavier Martinez Canillas 	struct regulator_config config = { };
25086cf635aSJavier Martinez Canillas 
25186cf635aSJavier Martinez Canillas 	config.dev = iodev->dev;
25286cf635aSJavier Martinez Canillas 
25386cf635aSJavier Martinez Canillas 	switch (type) {
25486cf635aSJavier Martinez Canillas 	case TYPE_MAX77693:
25586cf635aSJavier Martinez Canillas 		regulators = max77693_supported_regulators;
25686cf635aSJavier Martinez Canillas 		regulators_size = ARRAY_SIZE(max77693_supported_regulators);
25786cf635aSJavier Martinez Canillas 		config.driver_data = (void *)&max77693_chg_reg_data;
25886cf635aSJavier Martinez Canillas 		break;
25986cf635aSJavier Martinez Canillas 	case TYPE_MAX77843:
26086cf635aSJavier Martinez Canillas 		regulators = max77843_supported_regulators;
26186cf635aSJavier Martinez Canillas 		regulators_size = ARRAY_SIZE(max77843_supported_regulators);
26286cf635aSJavier Martinez Canillas 		config.driver_data = (void *)&max77843_chg_reg_data;
26386cf635aSJavier Martinez Canillas 		break;
26486cf635aSJavier Martinez Canillas 	default:
26586cf635aSJavier Martinez Canillas 		dev_err(&pdev->dev, "Unsupported device type: %u\n", type);
26686cf635aSJavier Martinez Canillas 		return -ENODEV;
26786cf635aSJavier Martinez Canillas 	}
26886cf635aSJavier Martinez Canillas 
26986cf635aSJavier Martinez Canillas 	for (i = 0; i < regulators_size; i++) {
27086cf635aSJavier Martinez Canillas 		struct regulator_dev *rdev;
27186cf635aSJavier Martinez Canillas 
27286cf635aSJavier Martinez Canillas 		config.regmap = max77693_get_regmap(type, iodev,
27386cf635aSJavier Martinez Canillas 						    regulators[i].id);
27486cf635aSJavier Martinez Canillas 
27586cf635aSJavier Martinez Canillas 		rdev = devm_regulator_register(&pdev->dev,
27686cf635aSJavier Martinez Canillas 						&regulators[i], &config);
27786cf635aSJavier Martinez Canillas 		if (IS_ERR(rdev)) {
27886cf635aSJavier Martinez Canillas 			dev_err(&pdev->dev,
27986cf635aSJavier Martinez Canillas 				"Failed to initialize regulator-%d\n", i);
28086cf635aSJavier Martinez Canillas 			return PTR_ERR(rdev);
28186cf635aSJavier Martinez Canillas 		}
28286cf635aSJavier Martinez Canillas 	}
28386cf635aSJavier Martinez Canillas 
28486cf635aSJavier Martinez Canillas 	return 0;
28586cf635aSJavier Martinez Canillas }
28686cf635aSJavier Martinez Canillas 
28786cf635aSJavier Martinez Canillas static const struct platform_device_id max77693_pmic_id[] = {
28886cf635aSJavier Martinez Canillas 	{ "max77693-pmic", TYPE_MAX77693 },
28986cf635aSJavier Martinez Canillas 	{ "max77843-regulator", TYPE_MAX77843 },
29086cf635aSJavier Martinez Canillas 	{},
29186cf635aSJavier Martinez Canillas };
29286cf635aSJavier Martinez Canillas 
29386cf635aSJavier Martinez Canillas MODULE_DEVICE_TABLE(platform, max77693_pmic_id);
29486cf635aSJavier Martinez Canillas 
29586cf635aSJavier Martinez Canillas static struct platform_driver max77693_pmic_driver = {
29686cf635aSJavier Martinez Canillas 	.driver = {
29786cf635aSJavier Martinez Canillas 		   .name = "max77693-pmic",
29886cf635aSJavier Martinez Canillas 		   },
29986cf635aSJavier Martinez Canillas 	.probe = max77693_pmic_probe,
30086cf635aSJavier Martinez Canillas 	.id_table = max77693_pmic_id,
30186cf635aSJavier Martinez Canillas };
30286cf635aSJavier Martinez Canillas 
30386cf635aSJavier Martinez Canillas static int __init max77693_pmic_init(void)
30486cf635aSJavier Martinez Canillas {
30586cf635aSJavier Martinez Canillas 	return platform_driver_register(&max77693_pmic_driver);
30686cf635aSJavier Martinez Canillas }
30786cf635aSJavier Martinez Canillas subsys_initcall(max77693_pmic_init);
30886cf635aSJavier Martinez Canillas 
30986cf635aSJavier Martinez Canillas static void __exit max77693_pmic_cleanup(void)
31086cf635aSJavier Martinez Canillas {
31186cf635aSJavier Martinez Canillas 	platform_driver_unregister(&max77693_pmic_driver);
31286cf635aSJavier Martinez Canillas }
31386cf635aSJavier Martinez Canillas module_exit(max77693_pmic_cleanup);
31486cf635aSJavier Martinez Canillas 
31586cf635aSJavier Martinez Canillas MODULE_DESCRIPTION("MAXIM 77693/77843 regulator driver");
31686cf635aSJavier Martinez Canillas MODULE_AUTHOR("Jonghwa Lee <jonghwa3.lee@samsung.com>");
317*cea8aa3aSKrzysztof Kozlowski MODULE_AUTHOR("Krzysztof Kozlowski <krzk@kernel.org>");
31886cf635aSJavier Martinez Canillas MODULE_LICENSE("GPL");
319