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) // da9210-regulator.c - Regulator device driver for DA9210
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) // Copyright (C) 2013  Dialog Semiconductor Ltd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #include <linux/err.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #include <linux/i2c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/regulator/driver.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/regulator/machine.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/of_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/regulator/of_regulator.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/regmap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include "da9210-regulator.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) struct da9210 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 	struct regulator_dev *rdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	struct regmap *regmap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) static const struct regmap_config da9210_regmap_config = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	.reg_bits = 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	.val_bits = 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) static const struct regulator_ops da9210_buck_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	.enable = regulator_enable_regmap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	.disable = regulator_disable_regmap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	.is_enabled = regulator_is_enabled_regmap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	.set_voltage_sel = regulator_set_voltage_sel_regmap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	.get_voltage_sel = regulator_get_voltage_sel_regmap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	.list_voltage = regulator_list_voltage_linear,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	.set_current_limit = regulator_set_current_limit_regmap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	.get_current_limit = regulator_get_current_limit_regmap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) /* Default limits measured in millivolts and milliamps */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #define DA9210_MIN_MV		300
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #define DA9210_MAX_MV		1570
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) #define DA9210_STEP_MV		10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) /* Current limits for buck (uA) indices corresponds with register values */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) static const unsigned int da9210_buck_limits[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	1600000, 1800000, 2000000, 2200000, 2400000, 2600000, 2800000, 3000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	3200000, 3400000, 3600000, 3800000, 4000000, 4200000, 4400000, 4600000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) static const struct regulator_desc da9210_reg = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	.name = "DA9210",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	.id = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	.ops = &da9210_buck_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	.type = REGULATOR_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	.n_voltages = ((DA9210_MAX_MV - DA9210_MIN_MV) / DA9210_STEP_MV) + 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	.min_uV = (DA9210_MIN_MV * 1000),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	.uV_step = (DA9210_STEP_MV * 1000),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	.vsel_reg = DA9210_REG_VBUCK_A,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	.vsel_mask = DA9210_VBUCK_MASK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	.enable_reg = DA9210_REG_BUCK_CONT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	.enable_mask = DA9210_BUCK_EN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	.owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	.curr_table = da9210_buck_limits,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	.n_current_limits = ARRAY_SIZE(da9210_buck_limits),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	.csel_reg = DA9210_REG_BUCK_ILIM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	.csel_mask = DA9210_BUCK_ILIM_MASK,
^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) static irqreturn_t da9210_irq_handler(int irq, void *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	struct da9210 *chip = data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	unsigned int val, handled = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	int error, ret = IRQ_NONE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	error = regmap_read(chip->regmap, DA9210_REG_EVENT_B, &val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	if (error < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 		goto error_i2c;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	if (val & DA9210_E_OVCURR) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 		regulator_notifier_call_chain(chip->rdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 					      REGULATOR_EVENT_OVER_CURRENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 					      NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 		handled |= DA9210_E_OVCURR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	if (val & DA9210_E_NPWRGOOD) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 		regulator_notifier_call_chain(chip->rdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 					      REGULATOR_EVENT_UNDER_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 					      NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 		handled |= DA9210_E_NPWRGOOD;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	if (val & (DA9210_E_TEMP_WARN | DA9210_E_TEMP_CRIT)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 		regulator_notifier_call_chain(chip->rdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 					      REGULATOR_EVENT_OVER_TEMP, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 		handled |= val & (DA9210_E_TEMP_WARN | DA9210_E_TEMP_CRIT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	if (val & DA9210_E_VMAX) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 		regulator_notifier_call_chain(chip->rdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 					      REGULATOR_EVENT_REGULATION_OUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 					      NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 		handled |= DA9210_E_VMAX;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	if (handled) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 		/* Clear handled events */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 		error = regmap_write(chip->regmap, DA9210_REG_EVENT_B, handled);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 		if (error < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 			goto error_i2c;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 		ret = IRQ_HANDLED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) error_i2c:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	dev_err(regmap_get_device(chip->regmap), "I2C error : %d\n", error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)  * I2C driver interface functions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) static const struct of_device_id __maybe_unused da9210_dt_ids[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	{ .compatible = "dlg,da9210", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	{ }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) MODULE_DEVICE_TABLE(of, da9210_dt_ids);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) static int da9210_i2c_probe(struct i2c_client *i2c)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	struct da9210 *chip;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	struct device *dev = &i2c->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	struct da9210_pdata *pdata = dev_get_platdata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	struct regulator_dev *rdev = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	struct regulator_config config = { };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	int error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	const struct of_device_id *match;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	if (i2c->dev.of_node && !pdata) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 		match = of_match_device(of_match_ptr(da9210_dt_ids),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 						&i2c->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 		if (!match) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 			dev_err(&i2c->dev, "Error: No device match found\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 			return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	chip = devm_kzalloc(&i2c->dev, sizeof(struct da9210), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	if (!chip)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	chip->regmap = devm_regmap_init_i2c(i2c, &da9210_regmap_config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	if (IS_ERR(chip->regmap)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 		error = PTR_ERR(chip->regmap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 		dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 			error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 		return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	config.dev = &i2c->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	config.init_data = pdata ? &pdata->da9210_constraints :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 		of_get_regulator_init_data(dev, dev->of_node, &da9210_reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	config.driver_data = chip;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	config.regmap = chip->regmap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	config.of_node = dev->of_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	/* Mask all interrupt sources to deassert interrupt line */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	error = regmap_write(chip->regmap, DA9210_REG_MASK_A, ~0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	if (!error)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 		error = regmap_write(chip->regmap, DA9210_REG_MASK_B, ~0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	if (error) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 		dev_err(&i2c->dev, "Failed to write to mask reg: %d\n", error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 		return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	rdev = devm_regulator_register(&i2c->dev, &da9210_reg, &config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	if (IS_ERR(rdev)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 		dev_err(&i2c->dev, "Failed to register DA9210 regulator\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 		return PTR_ERR(rdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	chip->rdev = rdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	if (i2c->irq) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 		error = devm_request_threaded_irq(&i2c->dev, i2c->irq, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 						  da9210_irq_handler,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 						  IRQF_TRIGGER_LOW |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 						  IRQF_ONESHOT | IRQF_SHARED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 						  "da9210", chip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 		if (error) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 			dev_err(&i2c->dev, "Failed to request IRQ%u: %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 				i2c->irq, error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 			return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 		error = regmap_update_bits(chip->regmap, DA9210_REG_MASK_B,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 					 DA9210_M_OVCURR | DA9210_M_NPWRGOOD |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 					 DA9210_M_TEMP_WARN |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 					 DA9210_M_TEMP_CRIT | DA9210_M_VMAX, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 		if (error < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 			dev_err(&i2c->dev, "Failed to update mask reg: %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 				error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 			return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 		dev_warn(&i2c->dev, "No IRQ configured\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	i2c_set_clientdata(i2c, chip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) static const struct i2c_device_id da9210_i2c_id[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	{"da9210", 0},
^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) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) MODULE_DEVICE_TABLE(i2c, da9210_i2c_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) static struct i2c_driver da9210_regulator_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	.driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 		.name = "da9210",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 		.of_match_table = of_match_ptr(da9210_dt_ids),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	.probe_new = da9210_i2c_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	.id_table = da9210_i2c_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) module_i2c_driver(da9210_regulator_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) MODULE_AUTHOR("S Twiss <stwiss.opensource@diasemi.com>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) MODULE_DESCRIPTION("Regulator device driver for Dialog DA9210");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) MODULE_LICENSE("GPL v2");