{
struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev);
struct rockchip_saradc_priv *priv = dev_get_priv(dev);
- struct udevice *vref;
+ struct udevice *vref = NULL;
struct clk clk;
int vref_uv;
int ret;
priv->active_channel = -1;
ret = device_get_supply_regulator(dev, "vref-supply", &vref);
- if (ret) {
+ if (ret && uc_pdata->vdd_microvolts <= 0) {
printf("can't get vref-supply: %d\n", ret);
return ret;
}
if (priv->reset)
rockchip_saradc_reset_controller(priv->reset);
- vref_uv = regulator_get_value(vref);
+ if (vref)
+ vref_uv = regulator_get_value(vref);
+ else
+ vref_uv = uc_pdata->vdd_microvolts;
if (vref_uv < 0) {
printf("can't get vref-supply value: %d\n", vref_uv);
return vref_uv;