Lines Matching +full:buck +full:- +full:ovp +full:- +full:disable
1 // SPDX-License-Identifier: GPL-2.0-only
58 ret = regmap_read(rdev->regmap, 0x12 + id, ®val); in lp8755_buck_enable_time()
60 dev_err(&rdev->dev, "i2c access error %s\n", __func__); in lp8755_buck_enable_time()
80 ret = regmap_update_bits(rdev->regmap, 0x08 + id, 0x20, 0x00); in lp8755_buck_set_mode()
86 ret = regmap_update_bits(rdev->regmap, 0x08 + id, 0x20, 0x20); in lp8755_buck_set_mode()
90 ret = regmap_update_bits(rdev->regmap, 0x10, 0x01, 0x01); in lp8755_buck_set_mode()
95 dev_err(pchip->dev, "Not supported buck mode %s\n", __func__); in lp8755_buck_set_mode()
100 ret = regmap_update_bits(rdev->regmap, 0x06, 0x01 << id, regbval); in lp8755_buck_set_mode()
105 dev_err(&rdev->dev, "i2c access error %s\n", __func__); in lp8755_buck_set_mode()
115 ret = regmap_read(rdev->regmap, 0x06, ®val); in lp8755_buck_get_mode()
123 ret = regmap_read(rdev->regmap, 0x08 + id, ®val); in lp8755_buck_get_mode()
135 dev_err(&rdev->dev, "i2c access error %s\n", __func__); in lp8755_buck_get_mode()
149 .disable = regulator_disable_regmap,
195 struct lp8755_platform_data *pdata = pchip->pdata; in lp8755_init_data()
197 /* read back muti-phase configuration */ in lp8755_init_data()
198 ret = regmap_read(pchip->regmap, 0x3D, ®val); in lp8755_init_data()
201 pchip->mphase = regval & 0x0F; in lp8755_init_data()
203 /* set default data based on multi-phase config */ in lp8755_init_data()
204 for (icnt = 0; icnt < mphase_buck[pchip->mphase].nreg; icnt++) { in lp8755_init_data()
205 buck_num = mphase_buck[pchip->mphase].buck_num[icnt]; in lp8755_init_data()
206 pdata->buck_data[buck_num] = &lp8755_reg_default[buck_num]; in lp8755_init_data()
211 dev_err(pchip->dev, "i2c access error %s\n", __func__); in lp8755_init_data()
247 struct lp8755_platform_data *pdata = pchip->pdata; in lp8755_regulator_init()
250 rconfig.regmap = pchip->regmap; in lp8755_regulator_init()
251 rconfig.dev = pchip->dev; in lp8755_regulator_init()
254 for (icnt = 0; icnt < mphase_buck[pchip->mphase].nreg; icnt++) { in lp8755_regulator_init()
255 buck_num = mphase_buck[pchip->mphase].buck_num[icnt]; in lp8755_regulator_init()
256 rconfig.init_data = pdata->buck_data[buck_num]; in lp8755_regulator_init()
257 rconfig.of_node = pchip->dev->of_node; in lp8755_regulator_init()
258 pchip->rdev[buck_num] = in lp8755_regulator_init()
259 devm_regulator_register(pchip->dev, in lp8755_regulator_init()
261 if (IS_ERR(pchip->rdev[buck_num])) { in lp8755_regulator_init()
262 ret = PTR_ERR(pchip->rdev[buck_num]); in lp8755_regulator_init()
263 pchip->rdev[buck_num] = NULL; in lp8755_regulator_init()
264 dev_err(pchip->dev, "regulator init failed: buck %d\n", in lp8755_regulator_init()
280 ret = regmap_read(pchip->regmap, 0x0D, &flag0); in lp8755_irq_handler()
284 ret = regmap_write(pchip->regmap, 0x0D, 0x00); in lp8755_irq_handler()
291 && (pchip->irqmask & (0x04 << icnt)) in lp8755_irq_handler()
292 && (pchip->rdev[icnt] != NULL)) { in lp8755_irq_handler()
293 regulator_notifier_call_chain(pchip->rdev[icnt], in lp8755_irq_handler()
299 ret = regmap_read(pchip->regmap, 0x0E, &flag1); in lp8755_irq_handler()
303 ret = regmap_write(pchip->regmap, 0x0E, 0x00); in lp8755_irq_handler()
308 if ((flag1 & 0x01) && (pchip->irqmask & 0x01)) in lp8755_irq_handler()
310 if (pchip->rdev[icnt] != NULL) { in lp8755_irq_handler()
311 regulator_notifier_call_chain(pchip->rdev[icnt], in lp8755_irq_handler()
316 /* send OVP event to all regulator devices */ in lp8755_irq_handler()
317 if ((flag1 & 0x02) && (pchip->irqmask & 0x02)) in lp8755_irq_handler()
319 if (pchip->rdev[icnt] != NULL) { in lp8755_irq_handler()
320 regulator_notifier_call_chain(pchip->rdev[icnt], in lp8755_irq_handler()
327 dev_err(pchip->dev, "i2c access error %s\n", __func__); in lp8755_irq_handler()
336 if (pchip->irq == 0) { in lp8755_int_config()
337 dev_warn(pchip->dev, "not use interrupt : %s\n", __func__); in lp8755_int_config()
341 ret = regmap_read(pchip->regmap, 0x0F, ®val); in lp8755_int_config()
343 dev_err(pchip->dev, "i2c access error %s\n", __func__); in lp8755_int_config()
347 pchip->irqmask = regval; in lp8755_int_config()
348 return devm_request_threaded_irq(pchip->dev, pchip->irq, NULL, in lp8755_int_config()
351 "lp8755-irq", pchip); in lp8755_int_config()
365 struct lp8755_platform_data *pdata = dev_get_platdata(&client->dev); in lp8755_probe()
367 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { in lp8755_probe()
368 dev_err(&client->dev, "i2c functionality check fail.\n"); in lp8755_probe()
369 return -EOPNOTSUPP; in lp8755_probe()
372 pchip = devm_kzalloc(&client->dev, in lp8755_probe()
375 return -ENOMEM; in lp8755_probe()
377 pchip->dev = &client->dev; in lp8755_probe()
378 pchip->regmap = devm_regmap_init_i2c(client, &lp8755_regmap); in lp8755_probe()
379 if (IS_ERR(pchip->regmap)) { in lp8755_probe()
380 ret = PTR_ERR(pchip->regmap); in lp8755_probe()
381 dev_err(&client->dev, "fail to allocate regmap %d\n", ret); in lp8755_probe()
387 pchip->pdata = pdata; in lp8755_probe()
388 pchip->mphase = pdata->mphase; in lp8755_probe()
390 pchip->pdata = devm_kzalloc(pchip->dev, in lp8755_probe()
393 if (!pchip->pdata) in lp8755_probe()
394 return -ENOMEM; in lp8755_probe()
397 dev_err(&client->dev, "fail to initialize chip\n"); in lp8755_probe()
404 dev_err(&client->dev, "fail to initialize regulators\n"); in lp8755_probe()
408 pchip->irq = client->irq; in lp8755_probe()
411 dev_err(&client->dev, "fail to irq config\n"); in lp8755_probe()
418 /* output disable */ in lp8755_probe()
420 regmap_write(pchip->regmap, icnt, 0x00); in lp8755_probe()
431 regmap_write(pchip->regmap, icnt, 0x00); in lp8755_remove()