Lines Matching +full:tcs +full:- +full:config

1 // SPDX-License-Identifier: GPL-2.0
158 if (di->sleep_vol_cache == uV) in fan53555_set_suspend_voltage()
163 ret = regmap_update_bits(rdev->regmap, di->sleep_reg, in fan53555_set_suspend_voltage()
164 di->desc.vsel_mask, ret); in fan53555_set_suspend_voltage()
169 di->sleep_vol_cache = uV; in fan53555_set_suspend_voltage()
178 return regmap_update_bits(rdev->regmap, di->sleep_en_reg, in fan53555_set_suspend_enable()
186 return regmap_update_bits(rdev->regmap, di->sleep_en_reg, in fan53555_set_suspend_disable()
196 regmap_update_bits(rdev->regmap, di->mode_reg, in fan53555_set_mode()
197 di->mode_mask, di->mode_mask); in fan53555_set_mode()
200 regmap_update_bits(rdev->regmap, di->vol_reg, di->mode_mask, 0); in fan53555_set_mode()
203 return -EINVAL; in fan53555_set_mode()
214 ret = regmap_read(rdev->regmap, di->mode_reg, &val); in fan53555_get_mode()
217 if (val & di->mode_mask) in fan53555_get_mode()
261 switch (di->chip_id) { in fan53526_voltages_setup_fairchild()
263 switch (di->chip_rev) { in fan53526_voltages_setup_fairchild()
265 di->vsel_min = 600000; in fan53526_voltages_setup_fairchild()
266 di->vsel_step = 6250; in fan53526_voltages_setup_fairchild()
269 dev_err(di->dev, in fan53526_voltages_setup_fairchild()
271 di->chip_id, di->chip_rev); in fan53526_voltages_setup_fairchild()
272 return -EINVAL; in fan53526_voltages_setup_fairchild()
276 dev_err(di->dev, in fan53526_voltages_setup_fairchild()
277 "Chip ID %d not supported!\n", di->chip_id); in fan53526_voltages_setup_fairchild()
278 return -EINVAL; in fan53526_voltages_setup_fairchild()
281 di->slew_reg = FAN53555_CONTROL; in fan53526_voltages_setup_fairchild()
282 di->slew_mask = CTL_SLEW_MASK; in fan53526_voltages_setup_fairchild()
283 di->ramp_delay_table = slew_rates; in fan53526_voltages_setup_fairchild()
284 di->n_ramp_values = ARRAY_SIZE(slew_rates); in fan53526_voltages_setup_fairchild()
285 di->vsel_count = FAN53526_NVOLTAGES; in fan53526_voltages_setup_fairchild()
293 switch (di->chip_id) { in fan53555_voltages_setup_fairchild()
295 switch (di->chip_rev) { in fan53555_voltages_setup_fairchild()
297 di->vsel_min = 600000; in fan53555_voltages_setup_fairchild()
298 di->vsel_step = 10000; in fan53555_voltages_setup_fairchild()
301 di->vsel_min = 800000; in fan53555_voltages_setup_fairchild()
302 di->vsel_step = 10000; in fan53555_voltages_setup_fairchild()
305 dev_err(di->dev, in fan53555_voltages_setup_fairchild()
307 di->chip_id, di->chip_rev); in fan53555_voltages_setup_fairchild()
308 return -EINVAL; in fan53555_voltages_setup_fairchild()
315 di->vsel_min = 600000; in fan53555_voltages_setup_fairchild()
316 di->vsel_step = 10000; in fan53555_voltages_setup_fairchild()
319 di->vsel_min = 603000; in fan53555_voltages_setup_fairchild()
320 di->vsel_step = 12826; in fan53555_voltages_setup_fairchild()
323 dev_err(di->dev, in fan53555_voltages_setup_fairchild()
324 "Chip ID %d not supported!\n", di->chip_id); in fan53555_voltages_setup_fairchild()
325 return -EINVAL; in fan53555_voltages_setup_fairchild()
327 di->slew_reg = FAN53555_CONTROL; in fan53555_voltages_setup_fairchild()
328 di->slew_mask = CTL_SLEW_MASK; in fan53555_voltages_setup_fairchild()
329 di->ramp_delay_table = slew_rates; in fan53555_voltages_setup_fairchild()
330 di->n_ramp_values = ARRAY_SIZE(slew_rates); in fan53555_voltages_setup_fairchild()
331 di->vsel_count = FAN53555_NVOLTAGES; in fan53555_voltages_setup_fairchild()
339 switch (di->chip_id) { in fan53555_voltages_setup_rockchip()
341 di->vsel_min = 712500; in fan53555_voltages_setup_rockchip()
342 di->vsel_step = 12500; in fan53555_voltages_setup_rockchip()
345 dev_err(di->dev, in fan53555_voltages_setup_rockchip()
346 "Chip ID %d not supported!\n", di->chip_id); in fan53555_voltages_setup_rockchip()
347 return -EINVAL; in fan53555_voltages_setup_rockchip()
349 di->slew_reg = FAN53555_CONTROL; in fan53555_voltages_setup_rockchip()
350 di->slew_mask = CTL_SLEW_MASK; in fan53555_voltages_setup_rockchip()
351 di->ramp_delay_table = slew_rates; in fan53555_voltages_setup_rockchip()
352 di->n_ramp_values = ARRAY_SIZE(slew_rates); in fan53555_voltages_setup_rockchip()
353 di->vsel_count = FAN53555_NVOLTAGES; in fan53555_voltages_setup_rockchip()
361 switch (di->chip_id) { in rk8602_voltages_setup_rockchip()
363 di->vsel_min = 500000; in rk8602_voltages_setup_rockchip()
364 di->vsel_step = 6250; in rk8602_voltages_setup_rockchip()
367 dev_err(di->dev, in rk8602_voltages_setup_rockchip()
368 "Chip ID %d not supported!\n", di->chip_id); in rk8602_voltages_setup_rockchip()
369 return -EINVAL; in rk8602_voltages_setup_rockchip()
371 di->slew_reg = FAN53555_CONTROL; in rk8602_voltages_setup_rockchip()
372 di->slew_mask = CTL_SLEW_MASK; in rk8602_voltages_setup_rockchip()
373 di->ramp_delay_table = slew_rates; in rk8602_voltages_setup_rockchip()
374 di->n_ramp_values = ARRAY_SIZE(slew_rates); in rk8602_voltages_setup_rockchip()
375 di->vsel_count = RK8602_NVOLTAGES; in rk8602_voltages_setup_rockchip()
383 switch (di->chip_id) { in fan53555_voltages_setup_silergy()
386 di->vsel_min = 712500; in fan53555_voltages_setup_silergy()
387 di->vsel_step = 12500; in fan53555_voltages_setup_silergy()
390 dev_err(di->dev, in fan53555_voltages_setup_silergy()
391 "Chip ID %d not supported!\n", di->chip_id); in fan53555_voltages_setup_silergy()
392 return -EINVAL; in fan53555_voltages_setup_silergy()
394 di->slew_reg = FAN53555_CONTROL; in fan53555_voltages_setup_silergy()
395 di->slew_mask = CTL_SLEW_MASK; in fan53555_voltages_setup_silergy()
396 di->ramp_delay_table = slew_rates; in fan53555_voltages_setup_silergy()
397 di->n_ramp_values = ARRAY_SIZE(slew_rates); in fan53555_voltages_setup_silergy()
398 di->vsel_count = FAN53555_NVOLTAGES; in fan53555_voltages_setup_silergy()
405 switch (di->chip_id) { in fan53526_voltages_setup_tcs()
408 di->slew_reg = TCS4525_TIME; in fan53526_voltages_setup_tcs()
409 di->slew_mask = TCS_SLEW_MASK; in fan53526_voltages_setup_tcs()
410 di->ramp_delay_table = tcs_slew_rates; in fan53526_voltages_setup_tcs()
411 di->n_ramp_values = ARRAY_SIZE(tcs_slew_rates); in fan53526_voltages_setup_tcs()
414 di->vsel_min = 600000; in fan53526_voltages_setup_tcs()
415 di->vsel_step = 6250; in fan53526_voltages_setup_tcs()
416 di->vsel_count = FAN53526_NVOLTAGES; in fan53526_voltages_setup_tcs()
419 dev_err(di->dev, "Chip ID %d not supported!\n", di->chip_id); in fan53526_voltages_setup_tcs()
420 return -EINVAL; in fan53526_voltages_setup_tcs()
437 switch (di->vendor) { in fan53555_device_setup()
442 switch (pdata->sleep_vsel_id) { in fan53555_device_setup()
444 di->sleep_reg = FAN53555_VSEL0; in fan53555_device_setup()
445 di->vol_reg = FAN53555_VSEL1; in fan53555_device_setup()
448 di->sleep_reg = FAN53555_VSEL1; in fan53555_device_setup()
449 di->vol_reg = FAN53555_VSEL0; in fan53555_device_setup()
452 dev_err(di->dev, "Invalid VSEL ID!\n"); in fan53555_device_setup()
453 return -EINVAL; in fan53555_device_setup()
455 di->sleep_en_reg = di->sleep_reg; in fan53555_device_setup()
456 di->en_reg = di->vol_reg; in fan53555_device_setup()
459 switch (pdata->sleep_vsel_id) { in fan53555_device_setup()
461 di->sleep_reg = RK8602_VSEL0; in fan53555_device_setup()
462 di->vol_reg = RK8602_VSEL1; in fan53555_device_setup()
463 di->sleep_en_reg = FAN53555_VSEL0; in fan53555_device_setup()
464 di->en_reg = FAN53555_VSEL1; in fan53555_device_setup()
467 di->sleep_reg = RK8602_VSEL1; in fan53555_device_setup()
468 di->vol_reg = RK8602_VSEL0; in fan53555_device_setup()
469 di->sleep_en_reg = FAN53555_VSEL1; in fan53555_device_setup()
470 di->en_reg = FAN53555_VSEL0; in fan53555_device_setup()
473 dev_err(di->dev, "Invalid VSEL ID!\n"); in fan53555_device_setup()
474 return -EINVAL; in fan53555_device_setup()
478 switch (pdata->sleep_vsel_id) { in fan53555_device_setup()
480 di->sleep_reg = TCS4525_VSEL0; in fan53555_device_setup()
481 di->vol_reg = TCS4525_VSEL1; in fan53555_device_setup()
484 di->sleep_reg = TCS4525_VSEL1; in fan53555_device_setup()
485 di->vol_reg = TCS4525_VSEL0; in fan53555_device_setup()
488 dev_err(di->dev, "Invalid VSEL ID!\n"); in fan53555_device_setup()
489 return -EINVAL; in fan53555_device_setup()
491 di->sleep_en_reg = di->sleep_reg; in fan53555_device_setup()
492 di->en_reg = di->vol_reg; in fan53555_device_setup()
495 dev_err(di->dev, "vendor %d not supported!\n", di->vendor); in fan53555_device_setup()
496 return -EINVAL; in fan53555_device_setup()
500 switch (di->vendor) { in fan53555_device_setup()
502 di->mode_reg = FAN53555_CONTROL; in fan53555_device_setup()
504 switch (pdata->sleep_vsel_id) { in fan53555_device_setup()
506 di->mode_mask = CTL_MODE_VSEL1_MODE; in fan53555_device_setup()
509 di->mode_mask = CTL_MODE_VSEL0_MODE; in fan53555_device_setup()
516 di->mode_reg = di->vol_reg; in fan53555_device_setup()
517 di->mode_mask = VSEL_MODE; in fan53555_device_setup()
520 di->mode_mask = VSEL_MODE; in fan53555_device_setup()
522 switch (pdata->sleep_vsel_id) { in fan53555_device_setup()
524 di->mode_reg = FAN53555_VSEL1; in fan53555_device_setup()
527 di->mode_reg = FAN53555_VSEL0; in fan53555_device_setup()
532 di->mode_reg = TCS4525_COMMAND; in fan53555_device_setup()
534 switch (pdata->sleep_vsel_id) { in fan53555_device_setup()
536 di->mode_mask = TCS_VSEL1_MODE; in fan53555_device_setup()
539 di->mode_mask = TCS_VSEL0_MODE; in fan53555_device_setup()
544 dev_err(di->dev, "vendor %d not supported!\n", di->vendor); in fan53555_device_setup()
545 return -EINVAL; in fan53555_device_setup()
549 switch (di->vendor) { in fan53555_device_setup()
569 dev_err(di->dev, "vendor %d not supported!\n", di->vendor); in fan53555_device_setup()
570 return -EINVAL; in fan53555_device_setup()
577 struct regulator_config *config) in fan53555_regulator_register() argument
579 struct regulator_desc *rdesc = &di->desc; in fan53555_regulator_register()
582 rdesc->name = "fan53555-reg"; in fan53555_regulator_register()
583 rdesc->supply_name = "vin"; in fan53555_regulator_register()
584 rdesc->ops = &fan53555_regulator_ops; in fan53555_regulator_register()
585 rdesc->type = REGULATOR_VOLTAGE; in fan53555_regulator_register()
586 rdesc->n_voltages = di->vsel_count; in fan53555_regulator_register()
587 rdesc->enable_reg = di->en_reg; in fan53555_regulator_register()
588 rdesc->enable_mask = VSEL_BUCK_EN; in fan53555_regulator_register()
589 rdesc->min_uV = di->vsel_min; in fan53555_regulator_register()
590 rdesc->uV_step = di->vsel_step; in fan53555_regulator_register()
591 rdesc->vsel_reg = di->vol_reg; in fan53555_regulator_register()
592 rdesc->vsel_mask = BIT(fls(di->vsel_count - 1)) - 1; in fan53555_regulator_register()
593 rdesc->ramp_reg = di->slew_reg; in fan53555_regulator_register()
594 rdesc->ramp_mask = di->slew_mask; in fan53555_regulator_register()
595 rdesc->ramp_delay_table = di->ramp_delay_table; in fan53555_regulator_register()
596 rdesc->n_ramp_values = di->n_ramp_values; in fan53555_regulator_register()
597 rdesc->owner = THIS_MODULE; in fan53555_regulator_register()
599 rdev = devm_regulator_register(di->dev, &di->desc, config); in fan53555_regulator_register()
620 pdata->regulator = of_get_regulator_init_data(dev, np, desc); in fan53555_parse_dt()
622 ret = of_property_read_u32(np, "fcs,suspend-voltage-selector", in fan53555_parse_dt()
625 pdata->sleep_vsel_id = tmp; in fan53555_parse_dt()
650 .compatible = "tcs,tcs4525",
653 .compatible = "tcs,tcs4526",
662 struct device_node *np = client->dev.of_node; in fan53555_regulator_probe()
665 struct regulator_config config = { }; in fan53555_regulator_probe() local
670 di = devm_kzalloc(&client->dev, sizeof(struct fan53555_device_info), in fan53555_regulator_probe()
673 return -ENOMEM; in fan53555_regulator_probe()
675 pdata = dev_get_platdata(&client->dev); in fan53555_regulator_probe()
677 pdata = fan53555_parse_dt(&client->dev, np, &di->desc); in fan53555_regulator_probe()
679 if (!pdata || !pdata->regulator) in fan53555_regulator_probe()
680 return dev_err_probe(&client->dev, -ENODEV, in fan53555_regulator_probe()
683 di->regulator = pdata->regulator; in fan53555_regulator_probe()
684 di->vendor = (uintptr_t)i2c_get_match_data(client); in fan53555_regulator_probe()
685 if (!dev_fwnode(&client->dev)) { in fan53555_regulator_probe()
687 if (!di->regulator->constraints.ramp_delay) { in fan53555_regulator_probe()
688 if (pdata->slew_rate >= ARRAY_SIZE(slew_rates)) in fan53555_regulator_probe()
689 return dev_err_probe(&client->dev, -EINVAL, in fan53555_regulator_probe()
692 di->regulator->constraints.ramp_delay in fan53555_regulator_probe()
693 = slew_rates[pdata->slew_rate]; in fan53555_regulator_probe()
699 return dev_err_probe(&client->dev, PTR_ERR(regmap), in fan53555_regulator_probe()
702 di->dev = &client->dev; in fan53555_regulator_probe()
707 return dev_err_probe(&client->dev, ret, "Failed to get chip ID!\n"); in fan53555_regulator_probe()
709 di->chip_id = val & DIE_ID; in fan53555_regulator_probe()
713 return dev_err_probe(&client->dev, ret, "Failed to get chip Rev!\n"); in fan53555_regulator_probe()
715 di->chip_rev = val & DIE_REV; in fan53555_regulator_probe()
716 dev_info(&client->dev, "FAN53555 Option[%d] Rev[%d] Detected!\n", in fan53555_regulator_probe()
717 di->chip_id, di->chip_rev); in fan53555_regulator_probe()
721 return dev_err_probe(&client->dev, ret, "Failed to setup device!\n"); in fan53555_regulator_probe()
724 config.dev = di->dev; in fan53555_regulator_probe()
725 config.init_data = di->regulator; in fan53555_regulator_probe()
726 config.regmap = regmap; in fan53555_regulator_probe()
727 config.driver_data = di; in fan53555_regulator_probe()
728 config.of_node = np; in fan53555_regulator_probe()
730 ret = fan53555_regulator_register(di, &config); in fan53555_regulator_probe()
732 dev_err_probe(&client->dev, ret, "Failed to register regulator!\n"); in fan53555_regulator_probe()
769 .name = "fan53555-regulator",