Lines Matching +full:vccio +full:- +full:supply
1 // SPDX-License-Identifier: GPL-2.0-only
26 * - If the voltage on a rail is above the "1.8" voltage (1.98V) we'll tell the
28 * - If the voltage on a rail is above the "3.3" voltage (3.6V) we'll consider
79 static int rockchip_iodomain_write(struct rockchip_iodomain_supply *supply, in rockchip_iodomain_write() argument
82 struct rockchip_iodomain *iod = supply->iod; in rockchip_iodomain_write()
88 val <<= supply->idx; in rockchip_iodomain_write()
90 /* apply hiword-mask */ in rockchip_iodomain_write()
91 val |= (BIT(supply->idx) << 16); in rockchip_iodomain_write()
93 ret = regmap_write(iod->grf, iod->soc_data->grf_offset, val); in rockchip_iodomain_write()
95 dev_err(iod->dev, "Couldn't write to GRF\n"); in rockchip_iodomain_write()
104 struct rockchip_iodomain_supply *supply = in rockchip_iodomain_notify() local
125 uV = max_t(unsigned long, pvc_data->old_uV, pvc_data->max_uV); in rockchip_iodomain_notify()
133 dev_dbg(supply->iod->dev, "Setting to %d\n", uV); in rockchip_iodomain_notify()
136 dev_err(supply->iod->dev, "Voltage too high: %d\n", uV); in rockchip_iodomain_notify()
142 ret = rockchip_iodomain_write(supply, uV); in rockchip_iodomain_notify()
146 dev_dbg(supply->iod->dev, "Setting to %d done\n", uV); in rockchip_iodomain_notify()
155 /* if no VCCIO6 supply we should leave things alone */ in px30_iodomain_init()
156 if (!iod->supplies[PX30_IO_VSEL_VCCIO6_SUPPLY_NUM].reg) in px30_iodomain_init()
164 ret = regmap_write(iod->grf, PX30_IO_VSEL, val); in px30_iodomain_init()
166 dev_warn(iod->dev, "couldn't update vccio6 ctrl\n"); in px30_iodomain_init()
174 /* if no flash supply we should leave things alone */ in rk3288_iodomain_init()
175 if (!iod->supplies[RK3288_SOC_FLASH_SUPPLY_NUM].reg) in rk3288_iodomain_init()
183 ret = regmap_write(iod->grf, RK3288_SOC_CON2, val); in rk3288_iodomain_init()
185 dev_warn(iod->dev, "couldn't update flash0 ctrl\n"); in rk3288_iodomain_init()
193 /* if no vccio2 supply we should leave things alone */ in rk3328_iodomain_init()
194 if (!iod->supplies[RK3328_SOC_VCCIO2_SUPPLY_NUM].reg) in rk3328_iodomain_init()
202 ret = regmap_write(iod->grf, RK3328_SOC_CON4, val); in rk3328_iodomain_init()
204 dev_warn(iod->dev, "couldn't update vccio2 vsel ctrl\n"); in rk3328_iodomain_init()
212 /* if no flash supply we should leave things alone */ in rk3368_iodomain_init()
213 if (!iod->supplies[RK3368_SOC_FLASH_SUPPLY_NUM].reg) in rk3368_iodomain_init()
221 ret = regmap_write(iod->grf, RK3368_SOC_CON15, val); in rk3368_iodomain_init()
223 dev_warn(iod->dev, "couldn't update flash0 ctrl\n"); in rk3368_iodomain_init()
231 /* if no pmu io supply we should leave things alone */ in rk3399_pmu_iodomain_init()
232 if (!iod->supplies[RK3399_PMUGRF_VSEL_SUPPLY_NUM].reg) in rk3399_pmu_iodomain_init()
240 ret = regmap_write(iod->grf, RK3399_PMUGRF_CON0, val); in rk3399_pmu_iodomain_init()
242 dev_warn(iod->dev, "couldn't update pmu io iodomain ctrl\n"); in rk3399_pmu_iodomain_init()
255 "vccio-oscgpi",
283 * On the rk3188 the io-domains are handled by a shared register with the
284 * lower 8 bits being still being continuing drive-strength settings.
436 .compatible = "rockchip,px30-io-voltage-domain",
440 .compatible = "rockchip,px30-pmu-io-voltage-domain",
444 .compatible = "rockchip,rk3188-io-voltage-domain",
448 .compatible = "rockchip,rk3228-io-voltage-domain",
452 .compatible = "rockchip,rk3288-io-voltage-domain",
456 .compatible = "rockchip,rk3328-io-voltage-domain",
460 .compatible = "rockchip,rk3368-io-voltage-domain",
464 .compatible = "rockchip,rk3368-pmu-io-voltage-domain",
468 .compatible = "rockchip,rk3399-io-voltage-domain",
472 .compatible = "rockchip,rk3399-pmu-io-voltage-domain",
476 .compatible = "rockchip,rv1108-io-voltage-domain",
480 .compatible = "rockchip,rv1108-pmu-io-voltage-domain",
489 struct device_node *np = pdev->dev.of_node; in rockchip_iodomain_probe()
496 return -ENODEV; in rockchip_iodomain_probe()
498 iod = devm_kzalloc(&pdev->dev, sizeof(*iod), GFP_KERNEL); in rockchip_iodomain_probe()
500 return -ENOMEM; in rockchip_iodomain_probe()
502 iod->dev = &pdev->dev; in rockchip_iodomain_probe()
506 iod->soc_data = match->data; in rockchip_iodomain_probe()
508 parent = pdev->dev.parent; in rockchip_iodomain_probe()
509 if (parent && parent->of_node) { in rockchip_iodomain_probe()
510 iod->grf = syscon_node_to_regmap(parent->of_node); in rockchip_iodomain_probe()
512 dev_dbg(&pdev->dev, "falling back to old binding\n"); in rockchip_iodomain_probe()
513 iod->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf"); in rockchip_iodomain_probe()
516 if (IS_ERR(iod->grf)) { in rockchip_iodomain_probe()
517 dev_err(&pdev->dev, "couldn't find grf regmap\n"); in rockchip_iodomain_probe()
518 return PTR_ERR(iod->grf); in rockchip_iodomain_probe()
522 const char *supply_name = iod->soc_data->supply_names[i]; in rockchip_iodomain_probe()
523 struct rockchip_iodomain_supply *supply = &iod->supplies[i]; in rockchip_iodomain_probe() local
530 reg = devm_regulator_get_optional(iod->dev, supply_name); in rockchip_iodomain_probe()
534 /* If a supply wasn't specified, that's OK */ in rockchip_iodomain_probe()
535 if (ret == -ENODEV) in rockchip_iodomain_probe()
537 else if (ret != -EPROBE_DEFER) in rockchip_iodomain_probe()
538 dev_err(iod->dev, "couldn't get regulator %s\n", in rockchip_iodomain_probe()
548 dev_err(iod->dev, "Can't determine voltage: %s\n", in rockchip_iodomain_probe()
554 dev_crit(iod->dev, in rockchip_iodomain_probe()
557 ret = -EINVAL; in rockchip_iodomain_probe()
561 /* setup our supply */ in rockchip_iodomain_probe()
562 supply->idx = i; in rockchip_iodomain_probe()
563 supply->iod = iod; in rockchip_iodomain_probe()
564 supply->reg = reg; in rockchip_iodomain_probe()
565 supply->nb.notifier_call = rockchip_iodomain_notify; in rockchip_iodomain_probe()
567 ret = rockchip_iodomain_write(supply, uV); in rockchip_iodomain_probe()
569 supply->reg = NULL; in rockchip_iodomain_probe()
574 ret = regulator_register_notifier(reg, &supply->nb); in rockchip_iodomain_probe()
576 dev_err(&pdev->dev, in rockchip_iodomain_probe()
578 supply->reg = NULL; in rockchip_iodomain_probe()
583 if (iod->soc_data->init) in rockchip_iodomain_probe()
584 iod->soc_data->init(iod); in rockchip_iodomain_probe()
589 for (i = MAX_SUPPLIES - 1; i >= 0; i--) { in rockchip_iodomain_probe()
590 struct rockchip_iodomain_supply *io_supply = &iod->supplies[i]; in rockchip_iodomain_probe()
592 if (io_supply->reg) in rockchip_iodomain_probe()
593 regulator_unregister_notifier(io_supply->reg, in rockchip_iodomain_probe()
594 &io_supply->nb); in rockchip_iodomain_probe()
605 for (i = MAX_SUPPLIES - 1; i >= 0; i--) { in rockchip_iodomain_remove()
606 struct rockchip_iodomain_supply *io_supply = &iod->supplies[i]; in rockchip_iodomain_remove()
608 if (io_supply->reg) in rockchip_iodomain_remove()
609 regulator_unregister_notifier(io_supply->reg, in rockchip_iodomain_remove()
610 &io_supply->nb); in rockchip_iodomain_remove()
620 .name = "rockchip-iodomain",
627 MODULE_DESCRIPTION("Rockchip IO-domain driver");