tps65910
struct tps65910 *tps65910, int chip_ngpio)
struct tps65910 *tps65910 = dev_get_drvdata(pdev->dev.parent);
struct tps65910_board *pdata = dev_get_platdata(tps65910->dev);
tps65910_gpio->tps65910 = tps65910;
tps65910_gpio->gpio_chip.label = tps65910->i2c_client->name;
switch (tps65910_chip_id(tps65910)) {
if (!pdata && tps65910->dev->of_node)
pdata = tps65910_parse_dt_for_gpio(&pdev->dev, tps65910,
ret = regmap_set_bits(tps65910->regmap,
dev_warn(tps65910->dev,
struct tps65910 *tps65910;
struct tps65910 *tps65910 = tps65910_gpio->tps65910;
regmap_read(tps65910->regmap, TPS65910_GPIO0 + offset, &val);
struct tps65910 *tps65910 = tps65910_gpio->tps65910;
return regmap_set_bits(tps65910->regmap,
return regmap_clear_bits(tps65910->regmap, TPS65910_GPIO0 + offset,
struct tps65910 *tps65910 = tps65910_gpio->tps65910;
return regmap_set_bits(tps65910->regmap, TPS65910_GPIO0 + offset,
struct tps65910 *tps65910 = tps65910_gpio->tps65910;
return regmap_clear_bits(tps65910->regmap, TPS65910_GPIO0 + offset,
struct tps65910 *tps65910, int chip_ngpio)
struct tps65910_board *tps65910_board = tps65910->of_plat_data;
ret = of_property_read_u32_array(tps65910->dev->of_node,
static int tps65910_irq_init(struct tps65910 *tps65910, int irq,
dev_warn(tps65910->dev, "No interrupt support, no core IRQ\n");
dev_warn(tps65910->dev, "No interrupt support, no pdata\n");
switch (tps65910_chip_id(tps65910)) {
tps65910->chip_irq = irq;
ret = devm_regmap_add_irq_chip(tps65910->dev, tps65910->regmap,
tps65910->chip_irq,
tps6591x_irqs_chip, &tps65910->irq_data);
dev_warn(tps65910->dev, "Failed to add irq_chip %d\n", ret);
tps65910->chip_irq = 0;
struct tps65910 *tps65910 = dev_get_drvdata(dev);
if (tps65910_chip_id(tps65910) == TPS65910)
static int tps65910_ck32k_init(struct tps65910 *tps65910,
ret = regmap_clear_bits(tps65910->regmap, TPS65910_DEVCTRL,
dev_err(tps65910->dev, "clear ck32k_ctrl failed: %d\n", ret);
static int tps65910_sleepinit(struct tps65910 *tps65910,
dev = tps65910->dev;
ret = regmap_set_bits(tps65910->regmap, TPS65910_DEVCTRL,
ret = regmap_set_bits(tps65910->regmap,
ret = regmap_set_bits(tps65910->regmap,
ret = regmap_set_bits(tps65910->regmap,
regmap_clear_bits(tps65910->regmap, TPS65910_DEVCTRL,
struct tps65910 *tps65910;
tps65910 = dev_get_drvdata(&tps65910_i2c_client->dev);
regmap_update_bits(tps65910->regmap, TPS65910_DEVCTRL,
struct tps65910 *tps65910;
tps65910 = devm_kzalloc(&i2c->dev, sizeof(*tps65910), GFP_KERNEL);
if (tps65910 == NULL)
tps65910->of_plat_data = of_pmic_plat_data;
i2c_set_clientdata(i2c, tps65910);
tps65910->dev = &i2c->dev;
tps65910->i2c_client = i2c;
tps65910->id = chip_id;
tps65910->regmap = devm_regmap_init_i2c(i2c, &tps65910_regmap_config);
if (IS_ERR(tps65910->regmap)) {
ret = PTR_ERR(tps65910->regmap);
tps65910_irq_init(tps65910, init_data->irq, init_data);
tps65910_ck32k_init(tps65910, pmic_plat_data);
tps65910_sleepinit(tps65910, pmic_plat_data);
ret = regmap_set_bits(tps65910->regmap, TPS65910_DEVCTRL,
ret = devm_mfd_add_devices(tps65910->dev, -1,
regmap_irq_get_domain(tps65910->irq_data));
uVolt = comp_threshold_get(tps65910, id);
struct tps65910 *tps65910 = dev_get_drvdata(pdev->dev.parent);
struct tps65910_board *pdata = dev_get_platdata(tps65910->dev);
ret = comp_threshold_set(tps65910, COMP1, pdata->vmbch_threshold);
ret = comp_threshold_set(tps65910, COMP2, pdata->vmbch2_threshold);
struct tps65910 *tps65910;
tps65910 = dev_get_drvdata(pdev->dev.parent);
static int comp_threshold_set(struct tps65910 *tps65910, int id, int voltage)
ret = regmap_write(tps65910->regmap, tps_comp.reg, val);
static int comp_threshold_get(struct tps65910 *tps65910, int id)
ret = regmap_read(tps65910->regmap, tps_comp.reg, &val);
struct tps65910 *tps65910 = dev_get_drvdata(dev->parent);
struct tps65910 *tps65910 = dev_get_drvdata(pdev->dev.parent);
switch (tps65910_chip_id(tps65910)) {
struct tps65910 *tps65910 = dev_get_drvdata(pdev->dev.parent);
pmic_plat_data = dev_get_platdata(tps65910->dev);
if (!pmic_plat_data && tps65910->dev->of_node)
pmic->mfd = tps65910;
switch (tps65910_chip_id(tps65910)) {
if (tps65910_chip_id(tps65910) == TPS65910) {
tps65910_chip_id(tps65910) == TPS65910) {
if (tps65910_chip_id(tps65910) == TPS65910) {
dev_warn(tps65910->dev,
config.dev = tps65910->dev;
config.regmap = tps65910->regmap;
return dev_err_probe(tps65910->dev, PTR_ERR(rdev),
struct tps65910 *mfd;
struct tps65910 *mfd = pmic->mfd;
struct tps65910 *tps = dev_get_drvdata(dev->parent);
struct tps65910 *tps = dev_get_drvdata(dev->parent);
struct tps65910 *tps = dev_get_drvdata(dev->parent);
struct tps65910 *tps = dev_get_drvdata(dev->parent);
struct tps65910 *tps = dev_get_drvdata(dev->parent);
struct tps65910 *tps = dev_get_drvdata(dev->parent);
struct tps65910 *tps65910 = NULL;
tps65910 = dev_get_drvdata(pdev->dev.parent);
ret = regmap_read(tps65910->regmap, TPS65910_RTC_STATUS, &rtc_reg);
ret = regmap_write(tps65910->regmap, TPS65910_RTC_STATUS, rtc_reg);
ret = regmap_update_bits(tps65910->regmap, TPS65910_DEVCTRL,
ret = regmap_write(tps65910->regmap, TPS65910_RTC_CTRL, rtc_reg);
if (device_property_present(tps65910->dev, "wakeup-source"))
struct tps65910 *tps = dev_get_drvdata(dev->parent);
struct tps65910 *tps = dev_get_drvdata(dev->parent);
static inline int tps65910_chip_id(struct tps65910 *tps65910)
return tps65910->id;