dm: adc: decoupling regulator from adc uclass

Regulator should be a option but not mandory for dm adc.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I5fdda2d76dd8ce75673732cc0563d7a18be211e2
This commit is contained in:
Joseph Chen 2020-04-17 10:45:25 +08:00 committed by Jianhong Chen
parent 1f452cbf59
commit 35ef9ac329
2 changed files with 19 additions and 0 deletions

View File

@ -11,6 +11,13 @@ config ADC
- support supply's phandle with auto-enable
- supply polarity setting in fdt
config ADC_REQ_REGULATOR
bool "Enable regulator control for ADC drivers"
depends on ADC
default n
help
ADC may depend on regulator power supply and require control.
config ADC_EXYNOS
bool "Enable Exynos 54xx ADC driver"
help

View File

@ -47,6 +47,7 @@ static int check_channel(struct udevice *dev, int value, bool number_or_mask,
return -EINVAL;
}
#ifdef CONFIG_ADC_REQ_REGULATOR
static int adc_supply_enable(struct udevice *dev)
{
struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev);
@ -68,6 +69,9 @@ static int adc_supply_enable(struct udevice *dev)
return ret;
}
#else
static inline int adc_supply_enable(struct udevice *dev) { return 0; }
#endif
int adc_data_mask(struct udevice *dev, unsigned int *data_mask)
{
@ -256,6 +260,7 @@ try_manual:
return _adc_channels_single_shot(dev, channel_mask, channels);
}
#ifdef CONFIG_ADC_REQ_REGULATOR
static int adc_vdd_platdata_update(struct udevice *dev)
{
struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev);
@ -280,7 +285,11 @@ static int adc_vdd_platdata_update(struct udevice *dev)
return 0;
}
#else
static inline int adc_vdd_platdata_update(struct udevice *dev) { return 0; }
#endif
#ifdef CONFIG_ADC_REQ_REGULATOR
static int adc_vss_platdata_update(struct udevice *dev)
{
struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev);
@ -299,6 +308,9 @@ static int adc_vss_platdata_update(struct udevice *dev)
return 0;
}
#else
static inline int adc_vss_platdata_update(struct udevice *dev) { return 0; }
#endif
int adc_vdd_value(struct udevice *dev, int *uV)
{