Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright (c) 2020 Rockchip Electronics Co. Ltd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Author: Guochun Huang <hero.huang@rock-chips.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/err.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/gpio/consumer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/i2c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/regmap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/regulator/driver.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/regulator/machine.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #define DIO5632_REG_VPOS		0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #define DIO5632_REG_VNEG		0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #define DIO5632_REG_APPS_DISP_DISN	0x03
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #define DIO5632_REG_CONTROL		0x0FF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #define DIO5632_VOUT_MASK		0x1F
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #define DIO5632_VOUT_N_VOLTAGE		0x15
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #define DIO5632_VOUT_VMIN		4000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #define DIO5632_VOUT_VMAX		6000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #define DIO5632_VOUT_STEP		100000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #define DIO5632_REG_DIS_VPOS		BIT(1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #define DIO5632_REG_DIS_VNEG		BIT(0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #define DIO5632_REGULATOR_ID_VPOS	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #define DIO5632_REGULATOR_ID_VNEG	1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #define DIO5632_MAX_REGULATORS		2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #define DIO5632_ACT_DIS_TIME_SLACK		1000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) struct DIO5632_reg_pdata {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	struct gpio_desc *en_gpiod;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	int ena_gpio_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) struct DIO5632_regulator {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	struct device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	struct DIO5632_reg_pdata reg_pdata[DIO5632_MAX_REGULATORS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) static int DIO5632_regulator_enable(struct regulator_dev *rdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	struct DIO5632_regulator *dio = rdev_get_drvdata(rdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	int id = rdev_get_id(rdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	struct DIO5632_reg_pdata *rpdata = &dio->reg_pdata[id];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	if (!IS_ERR(rpdata->en_gpiod)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 		gpiod_set_value_cansleep(rpdata->en_gpiod, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 		rpdata->ena_gpio_state = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	/* Hardware automatically enable discharge bit in enable */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	if (rdev->constraints->active_discharge ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 			REGULATOR_ACTIVE_DISCHARGE_DISABLE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 		ret = regulator_set_active_discharge_regmap(rdev, false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 		if (ret < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 			dev_err(dio->dev, "Failed to disable active discharge: %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 				ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 			return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) static int DIO5632_regulator_disable(struct regulator_dev *rdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	struct DIO5632_regulator *dio = rdev_get_drvdata(rdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	int id = rdev_get_id(rdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	struct DIO5632_reg_pdata *rpdata = &dio->reg_pdata[id];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	if (!IS_ERR(rpdata->en_gpiod)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 		gpiod_set_value_cansleep(rpdata->en_gpiod, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 		rpdata->ena_gpio_state = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) static int DIO5632_regulator_is_enabled(struct regulator_dev *rdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	struct DIO5632_regulator *dio = rdev_get_drvdata(rdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	int id = rdev_get_id(rdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	struct DIO5632_reg_pdata *rpdata = &dio->reg_pdata[id];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	if (!IS_ERR(rpdata->en_gpiod))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 		return rpdata->ena_gpio_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) static const struct regulator_ops DIO5632_regulator_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	.enable = DIO5632_regulator_enable,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	.disable = DIO5632_regulator_disable,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	.is_enabled = DIO5632_regulator_is_enabled,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	.list_voltage = regulator_list_voltage_linear,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	.map_voltage = regulator_map_voltage_linear,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	.get_voltage_sel = regulator_get_voltage_sel_regmap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	.set_voltage_sel = regulator_set_voltage_sel_regmap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	.set_active_discharge = regulator_set_active_discharge_regmap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) static int DIO5632_of_parse_cb(struct device_node *np,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 				const struct regulator_desc *desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 				struct regulator_config *config)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	struct DIO5632_regulator *dio = config->driver_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	struct DIO5632_reg_pdata *rpdata = &dio->reg_pdata[desc->id];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	rpdata->en_gpiod = devm_fwnode_get_index_gpiod_from_child(dio->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 					"enable", 0, &np->fwnode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 					GPIOD_OUT_HIGH, "enable");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	if (IS_ERR_OR_NULL(rpdata->en_gpiod)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 		ret = PTR_ERR(rpdata->en_gpiod);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 		/* Ignore the error other than probe defer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 		if (ret == -EPROBE_DEFER)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 			return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) #define DIO5632_REGULATOR_DESC(_id, _name)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	[DIO5632_REGULATOR_ID_##_id] = {		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 		.name = "DIO5632-"#_name,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 		.supply_name = "vin",			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 		.id = DIO5632_REGULATOR_ID_##_id,	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 		.of_match = of_match_ptr(#_name),	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 		.of_parse_cb	= DIO5632_of_parse_cb,	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 		.ops = &DIO5632_regulator_ops,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 		.n_voltages = DIO5632_VOUT_N_VOLTAGE,	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 		.min_uV = DIO5632_VOUT_VMIN,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 		.uV_step = DIO5632_VOUT_STEP,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 		.enable_time = 500,			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 		.vsel_mask = DIO5632_VOUT_MASK,	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 		.vsel_reg = DIO5632_REG_##_id,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 		.active_discharge_off = 0,			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 		.active_discharge_on = DIO5632_REG_DIS_##_id, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 		.active_discharge_mask = DIO5632_REG_DIS_##_id, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 		.active_discharge_reg = DIO5632_REG_APPS_DISP_DISN, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 		.type = REGULATOR_VOLTAGE,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 		.owner = THIS_MODULE,			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) static const struct regulator_desc dio_regs_desc[DIO5632_MAX_REGULATORS] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	DIO5632_REGULATOR_DESC(VPOS, outp),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	DIO5632_REGULATOR_DESC(VNEG, outn),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) static const struct regmap_range DIO5632_no_reg_ranges[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	regmap_reg_range(DIO5632_REG_APPS_DISP_DISN + 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 			 DIO5632_REG_CONTROL - 1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) static const struct regmap_access_table DIO5632_no_reg_table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	.no_ranges = DIO5632_no_reg_ranges,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	.n_no_ranges = ARRAY_SIZE(DIO5632_no_reg_ranges),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) static const struct regmap_config DIO5632_regmap_config = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	.reg_bits	= 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	.val_bits	= 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	.max_register	= DIO5632_REG_CONTROL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	.cache_type	= REGCACHE_NONE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	.rd_table	= &DIO5632_no_reg_table,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	.wr_table	= &DIO5632_no_reg_table,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) static int DIO5632_probe(struct i2c_client *client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 			  const struct i2c_device_id *client_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	struct device *dev = &client->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	struct DIO5632_regulator *dio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	struct regulator_dev *rdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	struct regmap *rmap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	struct regulator_config config = { };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	int id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	dio = devm_kzalloc(dev, sizeof(*dio), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	if (!dio)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	rmap = devm_regmap_init_i2c(client, &DIO5632_regmap_config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	if (IS_ERR(rmap)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 		ret = PTR_ERR(rmap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 		dev_err(dev, "regmap init failed: %d\n", ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	i2c_set_clientdata(client, dio);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	dio->dev = dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	for (id = 0; id < DIO5632_MAX_REGULATORS; ++id) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 		config.regmap = rmap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 		config.dev = dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 		config.driver_data = dio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 		rdev = devm_regulator_register(dev, &dio_regs_desc[id],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 					       &config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 		if (IS_ERR(rdev)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 			ret = PTR_ERR(rdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 			dev_err(dev, "regulator %s register failed: %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 				dio_regs_desc[id].name, ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 			return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) static const struct i2c_device_id DIO5632_id[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	{.name = "DIO5632",},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	{},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) MODULE_DEVICE_TABLE(i2c, DIO5632_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) static struct i2c_driver DIO5632_i2c_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	.driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 		.name = "DIO5632",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	.probe = DIO5632_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	.id_table = DIO5632_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) module_i2c_driver(DIO5632_i2c_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) MODULE_DESCRIPTION("DIO5632 regulator driver");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) MODULE_AUTHOR("Guochun Huang <hero.huang@rockchips.com>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) MODULE_LICENSE("GPL v2");