^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) * Regulator driver for mp8865
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * This program is free software; you can redistribute it and/or modify it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * under the terms and conditions of the GNU General Public License,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * version 2, as published by the Free Software Foundation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * This program is distributed in the hope it will be useful, but WITHOUT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/i2c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/of_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/regmap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/regulator/driver.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/regulator/of_regulator.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #define MP8865_MAX_VSEL 0x7f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define VOL_MIN_IDX 0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #define VOL_MAX_IDX 0x7f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #define MP8865_ENABLE_TIME 150
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) /* Register definitions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #define MP8865_VOUT_REG 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define MP8865_SYSCNTL_REG 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define MP8865_ID_REG 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #define MP8865_STATUS_REG 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #define MP8865_MAX_REG 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #define MP8865_VOUT_MASK 0x7f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define MP8865_VBOOT_MASK 0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #define MP8865_ENABLE 0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #define MP8865_GO_BIT 0x40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define MP8865_SLEW_RATE_MASK 0x38
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #define MP8865_SWITCH_FRE_MASK 0x06
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #define MP8865_PFM_MODE 0X01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) /* mp8865 chip information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) struct mp8865_chip {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) struct device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) struct regulator_desc desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) struct regulator_dev *rdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) struct regmap *regmap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) struct mp8865_platform_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) struct regulator_init_data *mp8865_init_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) struct device_node *of_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) static const struct linear_range mp8865_voltage_ranges[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) REGULATOR_LINEAR_RANGE(600000, VOL_MIN_IDX, VOL_MAX_IDX, 10000),
^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) static int mp8865_set_voltage(struct regulator_dev *rdev, unsigned sel)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) ret = regmap_update_bits(rdev->regmap, MP8865_SYSCNTL_REG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) MP8865_GO_BIT, MP8865_GO_BIT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) if (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) sel <<= ffs(rdev->desc->vsel_mask) - 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) return regmap_write(rdev->regmap, MP8865_VOUT_REG, sel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) static bool is_write_reg(struct device *dev, unsigned int reg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) return (reg < MP8865_ID_REG) ? true : false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) static bool is_volatile_reg(struct device *dev, unsigned int reg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) return (reg == MP8865_STATUS_REG) ? true : false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) static const struct regmap_config mp8865_regmap_config = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) .reg_bits = 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) .val_bits = 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) .writeable_reg = is_write_reg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) .volatile_reg = is_volatile_reg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) .max_register = MP8865_MAX_REG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) .cache_type = REGCACHE_RBTREE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) static struct regulator_ops mp8865_dcdc_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) .list_voltage = regulator_list_voltage_linear_range,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) .map_voltage = regulator_map_voltage_linear_range,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) .get_voltage_sel = regulator_get_voltage_sel_regmap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) .set_voltage_sel = mp8865_set_voltage,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) .set_voltage_time_sel = regulator_set_voltage_time_sel,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) .enable = regulator_enable_regmap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) .disable = regulator_disable_regmap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) .is_enabled = regulator_is_enabled_regmap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) static const struct of_device_id mp8865_of_match[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) {.compatible = "mps,mp8865", .data = (void *)0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) {},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) MODULE_DEVICE_TABLE(of, mp8865_of_match);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) static struct of_regulator_match mp8865_matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) .name = "mp8865_dcdc1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) .driver_data = (void *)0,
^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) static struct mp8865_platform_data *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) mp8865_parse_dt(struct i2c_client *client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) struct of_regulator_match **mp8865_reg_matches)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) struct mp8865_platform_data *pdata;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) struct device_node *np, *regulators;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) pdata = devm_kzalloc(&client->dev, sizeof(struct mp8865_platform_data),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) if (!pdata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) np = of_node_get(client->dev.of_node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) regulators = of_find_node_by_name(np, "regulators");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) if (!regulators) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) dev_err(&client->dev, "regulator node not found\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) return NULL;
^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) ret = of_regulator_match(&client->dev, regulators, &mp8865_matches, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) if (ret < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) dev_err(&client->dev, "Error parsing regulators init data\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) *mp8865_reg_matches = &mp8865_matches;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) of_node_put(regulators);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) pdata->mp8865_init_data = mp8865_matches.init_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) pdata->of_node = mp8865_matches.of_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) return pdata;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) static int mp8865_probe(struct i2c_client *client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) const struct i2c_device_id *id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) struct mp8865_chip *mp8865;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) struct mp8865_platform_data *pdata;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) struct of_regulator_match *mp8865_reg_matches = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) struct regulator_dev *sy_rdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) struct regulator_config config;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) struct regulator_desc *rdesc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) mp8865 = devm_kzalloc(&client->dev, sizeof(struct mp8865_chip),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) if (!mp8865)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) pdata = dev_get_platdata(&client->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) if (!pdata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) pdata = mp8865_parse_dt(client, &mp8865_reg_matches);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) if (!pdata || !pdata->mp8865_init_data) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) dev_err(&client->dev, "Platform data not found!\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) mp8865->dev = &client->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) mp8865->regmap = devm_regmap_init_i2c(client, &mp8865_regmap_config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) if (IS_ERR(mp8865->regmap)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) dev_err(&client->dev, "Failed to allocate regmap!\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) return PTR_ERR(mp8865->regmap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) i2c_set_clientdata(client, mp8865);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) config.dev = mp8865->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) config.driver_data = mp8865;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) config.init_data = pdata->mp8865_init_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) config.of_node = pdata->of_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) config.regmap = mp8865->regmap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) rdesc = &mp8865->desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) rdesc->name = "mp8865_dcdc1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) rdesc->id = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) rdesc->ops = &mp8865_dcdc_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) rdesc->n_voltages = MP8865_MAX_VSEL + 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) rdesc->linear_ranges = mp8865_voltage_ranges,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) rdesc->n_linear_ranges = ARRAY_SIZE(mp8865_voltage_ranges),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) rdesc->vsel_reg = MP8865_VOUT_REG;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) rdesc->vsel_mask = MP8865_VOUT_MASK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) rdesc->enable_reg = MP8865_SYSCNTL_REG;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) rdesc->enable_mask = MP8865_ENABLE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) rdesc->enable_time = MP8865_ENABLE_TIME;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) rdesc->type = REGULATOR_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) rdesc->owner = THIS_MODULE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) /* set slew_rate 16mV/uS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) ret = regmap_update_bits(mp8865->regmap, MP8865_SYSCNTL_REG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) MP8865_SLEW_RATE_MASK, 0x10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) dev_err(mp8865->dev, "failed to set slew_rate\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) return ret;
^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) /* set switch_frequency 1.1MHz */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) ret = regmap_update_bits(mp8865->regmap, MP8865_SYSCNTL_REG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) MP8865_SWITCH_FRE_MASK, 0x40);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) dev_err(mp8865->dev, "failed to set switch_frequency\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) sy_rdev = devm_regulator_register(mp8865->dev, &mp8865->desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) &config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) if (IS_ERR(sy_rdev)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) dev_err(mp8865->dev, "failed to register regulator\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) return PTR_ERR(sy_rdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) dev_info(mp8865->dev, "mp8865 register successful\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) static const struct i2c_device_id mp8865_id[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) { .name = "mps,mp8865", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) { },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) MODULE_DEVICE_TABLE(i2c, mp8865_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) static struct i2c_driver mp8865_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) .driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) .name = "mp8865",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) .of_match_table = of_match_ptr(mp8865_of_match),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) .probe = mp8865_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) .id_table = mp8865_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) module_i2c_driver(mp8865_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) MODULE_AUTHOR("Zain Wang <zain.wang@rock-chips.com>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) MODULE_DESCRIPTION("mp8865 voltage regulator driver");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) MODULE_LICENSE("GPL v2");