mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
iio: adc: ad7380: add missing supplies
vcc and vlogic are required but are not retrieved and enabled in the probe. Add them. In order to prepare support for additional parts requiring different supplies, add vcc and vlogic to the platform specific structures Reviewed-by: Nuno Sa <nuno.sa@analog.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Julien Stephan <jstephan@baylibre.com> Link: https://patch.msgid.link/20241022-ad7380-fix-supplies-v3-3-f0cefe1b7fa6@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
2ac6b2e823
commit
7ddbc27287
@ -75,6 +75,7 @@
|
||||
#define T_CONVERT_NS 190 /* conversion time */
|
||||
#define T_CONVERT_0_NS 10 /* 1st conversion start time (oversampling) */
|
||||
#define T_CONVERT_X_NS 500 /* xth conversion start time (oversampling) */
|
||||
#define T_POWERUP_US 5000 /* Power up */
|
||||
|
||||
struct ad7380_timing_specs {
|
||||
const unsigned int t_csh_ns; /* CS minimum high time */
|
||||
@ -86,6 +87,8 @@ struct ad7380_chip_info {
|
||||
unsigned int num_channels;
|
||||
unsigned int num_simult_channels;
|
||||
bool has_mux;
|
||||
const char * const *supplies;
|
||||
unsigned int num_supplies;
|
||||
const char * const *vcm_supplies;
|
||||
unsigned int num_vcm_supplies;
|
||||
const unsigned long *available_scan_masks;
|
||||
@ -243,6 +246,10 @@ DEFINE_AD7380_8_CHANNEL(ad7386_4_channels, 16, 0, u);
|
||||
DEFINE_AD7380_8_CHANNEL(ad7387_4_channels, 14, 0, u);
|
||||
DEFINE_AD7380_8_CHANNEL(ad7388_4_channels, 12, 0, u);
|
||||
|
||||
static const char * const ad7380_supplies[] = {
|
||||
"vcc", "vlogic",
|
||||
};
|
||||
|
||||
static const char * const ad7380_2_channel_vcm_supplies[] = {
|
||||
"aina", "ainb",
|
||||
};
|
||||
@ -338,6 +345,8 @@ static const struct ad7380_chip_info ad7380_chip_info = {
|
||||
.channels = ad7380_channels,
|
||||
.num_channels = ARRAY_SIZE(ad7380_channels),
|
||||
.num_simult_channels = 2,
|
||||
.supplies = ad7380_supplies,
|
||||
.num_supplies = ARRAY_SIZE(ad7380_supplies),
|
||||
.available_scan_masks = ad7380_2_channel_scan_masks,
|
||||
.timing_specs = &ad7380_timing,
|
||||
};
|
||||
@ -347,6 +356,8 @@ static const struct ad7380_chip_info ad7381_chip_info = {
|
||||
.channels = ad7381_channels,
|
||||
.num_channels = ARRAY_SIZE(ad7381_channels),
|
||||
.num_simult_channels = 2,
|
||||
.supplies = ad7380_supplies,
|
||||
.num_supplies = ARRAY_SIZE(ad7380_supplies),
|
||||
.available_scan_masks = ad7380_2_channel_scan_masks,
|
||||
.timing_specs = &ad7380_timing,
|
||||
};
|
||||
@ -356,6 +367,8 @@ static const struct ad7380_chip_info ad7383_chip_info = {
|
||||
.channels = ad7383_channels,
|
||||
.num_channels = ARRAY_SIZE(ad7383_channels),
|
||||
.num_simult_channels = 2,
|
||||
.supplies = ad7380_supplies,
|
||||
.num_supplies = ARRAY_SIZE(ad7380_supplies),
|
||||
.vcm_supplies = ad7380_2_channel_vcm_supplies,
|
||||
.num_vcm_supplies = ARRAY_SIZE(ad7380_2_channel_vcm_supplies),
|
||||
.available_scan_masks = ad7380_2_channel_scan_masks,
|
||||
@ -367,6 +380,8 @@ static const struct ad7380_chip_info ad7384_chip_info = {
|
||||
.channels = ad7384_channels,
|
||||
.num_channels = ARRAY_SIZE(ad7384_channels),
|
||||
.num_simult_channels = 2,
|
||||
.supplies = ad7380_supplies,
|
||||
.num_supplies = ARRAY_SIZE(ad7380_supplies),
|
||||
.vcm_supplies = ad7380_2_channel_vcm_supplies,
|
||||
.num_vcm_supplies = ARRAY_SIZE(ad7380_2_channel_vcm_supplies),
|
||||
.available_scan_masks = ad7380_2_channel_scan_masks,
|
||||
@ -378,6 +393,8 @@ static const struct ad7380_chip_info ad7386_chip_info = {
|
||||
.channels = ad7386_channels,
|
||||
.num_channels = ARRAY_SIZE(ad7386_channels),
|
||||
.num_simult_channels = 2,
|
||||
.supplies = ad7380_supplies,
|
||||
.num_supplies = ARRAY_SIZE(ad7380_supplies),
|
||||
.has_mux = true,
|
||||
.available_scan_masks = ad7380_2x2_channel_scan_masks,
|
||||
.timing_specs = &ad7380_timing,
|
||||
@ -388,6 +405,8 @@ static const struct ad7380_chip_info ad7387_chip_info = {
|
||||
.channels = ad7387_channels,
|
||||
.num_channels = ARRAY_SIZE(ad7387_channels),
|
||||
.num_simult_channels = 2,
|
||||
.supplies = ad7380_supplies,
|
||||
.num_supplies = ARRAY_SIZE(ad7380_supplies),
|
||||
.has_mux = true,
|
||||
.available_scan_masks = ad7380_2x2_channel_scan_masks,
|
||||
.timing_specs = &ad7380_timing,
|
||||
@ -398,6 +417,8 @@ static const struct ad7380_chip_info ad7388_chip_info = {
|
||||
.channels = ad7388_channels,
|
||||
.num_channels = ARRAY_SIZE(ad7388_channels),
|
||||
.num_simult_channels = 2,
|
||||
.supplies = ad7380_supplies,
|
||||
.num_supplies = ARRAY_SIZE(ad7380_supplies),
|
||||
.has_mux = true,
|
||||
.available_scan_masks = ad7380_2x2_channel_scan_masks,
|
||||
.timing_specs = &ad7380_timing,
|
||||
@ -408,6 +429,8 @@ static const struct ad7380_chip_info ad7380_4_chip_info = {
|
||||
.channels = ad7380_4_channels,
|
||||
.num_channels = ARRAY_SIZE(ad7380_4_channels),
|
||||
.num_simult_channels = 4,
|
||||
.supplies = ad7380_supplies,
|
||||
.num_supplies = ARRAY_SIZE(ad7380_supplies),
|
||||
.available_scan_masks = ad7380_4_channel_scan_masks,
|
||||
.timing_specs = &ad7380_4_timing,
|
||||
};
|
||||
@ -417,6 +440,8 @@ static const struct ad7380_chip_info ad7381_4_chip_info = {
|
||||
.channels = ad7381_4_channels,
|
||||
.num_channels = ARRAY_SIZE(ad7381_4_channels),
|
||||
.num_simult_channels = 4,
|
||||
.supplies = ad7380_supplies,
|
||||
.num_supplies = ARRAY_SIZE(ad7380_supplies),
|
||||
.available_scan_masks = ad7380_4_channel_scan_masks,
|
||||
.timing_specs = &ad7380_4_timing,
|
||||
};
|
||||
@ -426,6 +451,8 @@ static const struct ad7380_chip_info ad7383_4_chip_info = {
|
||||
.channels = ad7383_4_channels,
|
||||
.num_channels = ARRAY_SIZE(ad7383_4_channels),
|
||||
.num_simult_channels = 4,
|
||||
.supplies = ad7380_supplies,
|
||||
.num_supplies = ARRAY_SIZE(ad7380_supplies),
|
||||
.vcm_supplies = ad7380_4_channel_vcm_supplies,
|
||||
.num_vcm_supplies = ARRAY_SIZE(ad7380_4_channel_vcm_supplies),
|
||||
.available_scan_masks = ad7380_4_channel_scan_masks,
|
||||
@ -437,6 +464,8 @@ static const struct ad7380_chip_info ad7384_4_chip_info = {
|
||||
.channels = ad7384_4_channels,
|
||||
.num_channels = ARRAY_SIZE(ad7384_4_channels),
|
||||
.num_simult_channels = 4,
|
||||
.supplies = ad7380_supplies,
|
||||
.num_supplies = ARRAY_SIZE(ad7380_supplies),
|
||||
.vcm_supplies = ad7380_4_channel_vcm_supplies,
|
||||
.num_vcm_supplies = ARRAY_SIZE(ad7380_4_channel_vcm_supplies),
|
||||
.available_scan_masks = ad7380_4_channel_scan_masks,
|
||||
@ -448,6 +477,8 @@ static const struct ad7380_chip_info ad7386_4_chip_info = {
|
||||
.channels = ad7386_4_channels,
|
||||
.num_channels = ARRAY_SIZE(ad7386_4_channels),
|
||||
.num_simult_channels = 4,
|
||||
.supplies = ad7380_supplies,
|
||||
.num_supplies = ARRAY_SIZE(ad7380_supplies),
|
||||
.has_mux = true,
|
||||
.available_scan_masks = ad7380_2x4_channel_scan_masks,
|
||||
.timing_specs = &ad7380_4_timing,
|
||||
@ -458,6 +489,8 @@ static const struct ad7380_chip_info ad7387_4_chip_info = {
|
||||
.channels = ad7387_4_channels,
|
||||
.num_channels = ARRAY_SIZE(ad7387_4_channels),
|
||||
.num_simult_channels = 4,
|
||||
.supplies = ad7380_supplies,
|
||||
.num_supplies = ARRAY_SIZE(ad7380_supplies),
|
||||
.has_mux = true,
|
||||
.available_scan_masks = ad7380_2x4_channel_scan_masks,
|
||||
.timing_specs = &ad7380_4_timing,
|
||||
@ -468,6 +501,8 @@ static const struct ad7380_chip_info ad7388_4_chip_info = {
|
||||
.channels = ad7388_4_channels,
|
||||
.num_channels = ARRAY_SIZE(ad7388_4_channels),
|
||||
.num_simult_channels = 4,
|
||||
.supplies = ad7380_supplies,
|
||||
.num_supplies = ARRAY_SIZE(ad7380_supplies),
|
||||
.has_mux = true,
|
||||
.available_scan_masks = ad7380_2x4_channel_scan_masks,
|
||||
.timing_specs = &ad7380_4_timing,
|
||||
@ -1004,6 +1039,14 @@ static int ad7380_probe(struct spi_device *spi)
|
||||
if (!st->chip_info)
|
||||
return dev_err_probe(&spi->dev, -EINVAL, "missing match data\n");
|
||||
|
||||
ret = devm_regulator_bulk_get_enable(&spi->dev, st->chip_info->num_supplies,
|
||||
st->chip_info->supplies);
|
||||
|
||||
if (ret)
|
||||
return dev_err_probe(&spi->dev, ret,
|
||||
"Failed to enable power supplies\n");
|
||||
fsleep(T_POWERUP_US);
|
||||
|
||||
/*
|
||||
* If there is no REFIO supply, then it means that we are using
|
||||
* the internal 2.5V reference, otherwise REFIO is reference voltage.
|
||||
|
Loading…
Reference in New Issue
Block a user