diff options
author | Simon Glass <sjg@chromium.org> | 2017-05-18 20:09:37 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2017-06-01 07:03:13 -0600 |
commit | 53d788d868d50238345adcfb0ab2eb74e96dc09f (patch) | |
tree | b6f570bcc3bc8fd56a09eb983ef8388e056238d4 /drivers/adc | |
parent | 66e0ed5c17810887aa1246a54b80a0d9c1a5a31e (diff) | |
download | u-boot-53d788d868d50238345adcfb0ab2eb74e96dc09f.tar.gz u-boot-53d788d868d50238345adcfb0ab2eb74e96dc09f.tar.bz2 u-boot-53d788d868d50238345adcfb0ab2eb74e96dc09f.zip |
dm: adc: Convert uclass to livetree
Update the adc uclass to support a live device tree.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/adc')
-rw-r--r-- | drivers/adc/adc-uclass.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/adc/adc-uclass.c b/drivers/adc/adc-uclass.c index 3e28a5600b..a5ef722d21 100644 --- a/drivers/adc/adc-uclass.c +++ b/drivers/adc/adc-uclass.c @@ -345,12 +345,11 @@ nodev: static int adc_vdd_platdata_set(struct udevice *dev) { struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev); - int ret, offset = dev_of_offset(dev); - const void *fdt = gd->fdt_blob; + int ret; char *prop; prop = "vdd-polarity-negative"; - uc_pdata->vdd_polarity_negative = fdtdec_get_bool(fdt, offset, prop); + uc_pdata->vdd_polarity_negative = dev_read_bool(dev, prop); ret = adc_vdd_platdata_update(dev); if (ret != -ENOENT) @@ -358,7 +357,7 @@ static int adc_vdd_platdata_set(struct udevice *dev) /* No vdd-supply phandle. */ prop = "vdd-microvolts"; - uc_pdata->vdd_microvolts = fdtdec_get_int(fdt, offset, prop, -ENODATA); + uc_pdata->vdd_microvolts = dev_read_u32_default(dev, prop, -ENODATA); return 0; } @@ -366,12 +365,11 @@ static int adc_vdd_platdata_set(struct udevice *dev) static int adc_vss_platdata_set(struct udevice *dev) { struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev); - int ret, offset = dev_of_offset(dev); - const void *fdt = gd->fdt_blob; + int ret; char *prop; prop = "vss-polarity-negative"; - uc_pdata->vss_polarity_negative = fdtdec_get_bool(fdt, offset, prop); + uc_pdata->vss_polarity_negative = dev_read_bool(dev, prop); ret = adc_vss_platdata_update(dev); if (ret != -ENOENT) @@ -379,7 +377,7 @@ static int adc_vss_platdata_set(struct udevice *dev) /* No vss-supply phandle. */ prop = "vss-microvolts"; - uc_pdata->vss_microvolts = fdtdec_get_int(fdt, offset, prop, -ENODATA); + uc_pdata->vss_microvolts = dev_read_u32_default(dev, prop, -ENODATA); return 0; } |