Lines Matching +full:ovp +full:- +full:enable
1 // SPDX-License-Identifier: GPL-2.0-only
57 ret = regmap_read(rdev->regmap, 0x12 + id, ®val); in lp8755_buck_enable_time()
59 dev_err(&rdev->dev, "i2c access error %s\n", __func__); in lp8755_buck_enable_time()
78 /* enable automatic pwm/pfm mode */ in lp8755_buck_set_mode()
79 ret = regmap_update_bits(rdev->regmap, 0x08 + id, 0x20, 0x00); in lp8755_buck_set_mode()
84 /* enable automatic pwm/pfm/lppfm mode */ in lp8755_buck_set_mode()
85 ret = regmap_update_bits(rdev->regmap, 0x08 + id, 0x20, 0x20); in lp8755_buck_set_mode()
89 ret = regmap_update_bits(rdev->regmap, 0x10, 0x01, 0x01); in lp8755_buck_set_mode()
94 dev_err(pchip->dev, "Not supported buck mode %s\n", __func__); in lp8755_buck_set_mode()
99 ret = regmap_update_bits(rdev->regmap, 0x06, 0x01 << id, regbval); in lp8755_buck_set_mode()
104 dev_err(&rdev->dev, "i2c access error %s\n", __func__); in lp8755_buck_set_mode()
114 ret = regmap_read(rdev->regmap, 0x06, ®val); in lp8755_buck_get_mode()
122 ret = regmap_read(rdev->regmap, 0x08 + id, ®val); in lp8755_buck_get_mode()
134 dev_err(&rdev->dev, "i2c access error %s\n", __func__); in lp8755_buck_get_mode()
147 .enable = regulator_enable_regmap,
194 struct lp8755_platform_data *pdata = pchip->pdata; in lp8755_init_data()
196 /* read back muti-phase configuration */ in lp8755_init_data()
197 ret = regmap_read(pchip->regmap, 0x3D, ®val); in lp8755_init_data()
200 pchip->mphase = regval & 0x0F; in lp8755_init_data()
202 /* set default data based on multi-phase config */ in lp8755_init_data()
203 for (icnt = 0; icnt < mphase_buck[pchip->mphase].nreg; icnt++) { in lp8755_init_data()
204 buck_num = mphase_buck[pchip->mphase].buck_num[icnt]; in lp8755_init_data()
205 pdata->buck_data[buck_num] = &lp8755_reg_default[buck_num]; in lp8755_init_data()
210 dev_err(pchip->dev, "i2c access error %s\n", __func__); in lp8755_init_data()
246 struct lp8755_platform_data *pdata = pchip->pdata; in lp8755_regulator_init()
249 rconfig.regmap = pchip->regmap; in lp8755_regulator_init()
250 rconfig.dev = pchip->dev; in lp8755_regulator_init()
253 for (icnt = 0; icnt < mphase_buck[pchip->mphase].nreg; icnt++) { in lp8755_regulator_init()
254 buck_num = mphase_buck[pchip->mphase].buck_num[icnt]; in lp8755_regulator_init()
255 rconfig.init_data = pdata->buck_data[buck_num]; in lp8755_regulator_init()
256 rconfig.of_node = pchip->dev->of_node; in lp8755_regulator_init()
257 pchip->rdev[buck_num] = in lp8755_regulator_init()
258 devm_regulator_register(pchip->dev, in lp8755_regulator_init()
260 if (IS_ERR(pchip->rdev[buck_num])) { in lp8755_regulator_init()
261 ret = PTR_ERR(pchip->rdev[buck_num]); in lp8755_regulator_init()
262 pchip->rdev[buck_num] = NULL; in lp8755_regulator_init()
263 dev_err(pchip->dev, "regulator init failed: buck %d\n", in lp8755_regulator_init()
279 ret = regmap_read(pchip->regmap, 0x0D, &flag0); in lp8755_irq_handler()
283 ret = regmap_write(pchip->regmap, 0x0D, 0x00); in lp8755_irq_handler()
290 && (pchip->irqmask & (0x04 << icnt)) in lp8755_irq_handler()
291 && (pchip->rdev[icnt] != NULL)) { in lp8755_irq_handler()
292 regulator_notifier_call_chain(pchip->rdev[icnt], in lp8755_irq_handler()
298 ret = regmap_read(pchip->regmap, 0x0E, &flag1); in lp8755_irq_handler()
302 ret = regmap_write(pchip->regmap, 0x0E, 0x00); in lp8755_irq_handler()
307 if ((flag1 & 0x01) && (pchip->irqmask & 0x01)) in lp8755_irq_handler()
309 if (pchip->rdev[icnt] != NULL) { in lp8755_irq_handler()
310 regulator_notifier_call_chain(pchip->rdev[icnt], in lp8755_irq_handler()
315 /* send OVP event to all regulator devices */ in lp8755_irq_handler()
316 if ((flag1 & 0x02) && (pchip->irqmask & 0x02)) in lp8755_irq_handler()
318 if (pchip->rdev[icnt] != NULL) { in lp8755_irq_handler()
319 regulator_notifier_call_chain(pchip->rdev[icnt], in lp8755_irq_handler()
326 dev_err(pchip->dev, "i2c access error %s\n", __func__); in lp8755_irq_handler()
335 if (pchip->irq == 0) { in lp8755_int_config()
336 dev_warn(pchip->dev, "not use interrupt : %s\n", __func__); in lp8755_int_config()
340 ret = regmap_read(pchip->regmap, 0x0F, ®val); in lp8755_int_config()
342 dev_err(pchip->dev, "i2c access error %s\n", __func__); in lp8755_int_config()
346 pchip->irqmask = regval; in lp8755_int_config()
347 return devm_request_threaded_irq(pchip->dev, pchip->irq, NULL, in lp8755_int_config()
350 "lp8755-irq", pchip); in lp8755_int_config()
363 struct lp8755_platform_data *pdata = dev_get_platdata(&client->dev); in lp8755_probe()
365 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { in lp8755_probe()
366 dev_err(&client->dev, "i2c functionality check fail.\n"); in lp8755_probe()
367 return -EOPNOTSUPP; in lp8755_probe()
370 pchip = devm_kzalloc(&client->dev, in lp8755_probe()
373 return -ENOMEM; in lp8755_probe()
375 pchip->dev = &client->dev; in lp8755_probe()
376 pchip->regmap = devm_regmap_init_i2c(client, &lp8755_regmap); in lp8755_probe()
377 if (IS_ERR(pchip->regmap)) { in lp8755_probe()
378 ret = PTR_ERR(pchip->regmap); in lp8755_probe()
379 dev_err(&client->dev, "fail to allocate regmap %d\n", ret); in lp8755_probe()
385 pchip->pdata = pdata; in lp8755_probe()
386 pchip->mphase = pdata->mphase; in lp8755_probe()
388 pchip->pdata = devm_kzalloc(pchip->dev, in lp8755_probe()
391 if (!pchip->pdata) in lp8755_probe()
392 return -ENOMEM; in lp8755_probe()
395 dev_err(&client->dev, "fail to initialize chip\n"); in lp8755_probe()
402 dev_err(&client->dev, "fail to initialize regulators\n"); in lp8755_probe()
406 pchip->irq = client->irq; in lp8755_probe()
409 dev_err(&client->dev, "fail to irq config\n"); in lp8755_probe()
418 regmap_write(pchip->regmap, icnt, 0x00); in lp8755_probe()
429 regmap_write(pchip->regmap, icnt, 0x00); in lp8755_remove()