Skip to contentSkip to conversation

iio: adc: qcom-spmi-adc5: Add ADC5_AMUX_THM[24]_100K_PU to rev2 channel list

PATCH In review Matthias Kaehlcke 2 participants 4 messages Aug 10, 2018 – Aug 25, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: adc: qcom-spmi-adc5: Add ADC5_AMUX_THM[24]_100K_PU to rev2 channel list

Add ADC5_AMUX_THM2_100K_PU and ADC5_AMUX_THM4_100K_PU to the list of rev2 ADC channels.

---
 drivers/iio/adc/qcom-spmi-adc5.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/iio/adc/qcom-spmi-adc5.c +4 -0
index a4299417f3de..1f9298a5c83d 100644
@@ -491,8 +491,12 @@ static const struct adc5_channels adc5_chans_rev2[ADC5_MAX_CHANNEL] = {
 					SCALE_HW_CALIB_PMIC_THERM)
 	[ADC5_AMUX_THM1_100K_PU] = ADC5_CHAN_TEMP("amux_thm1_100k_pu", 1,
 					SCALE_HW_CALIB_THERM_100K_PULLUP)
+	[ADC5_AMUX_THM2_100K_PU] = ADC5_CHAN_TEMP("amux_thm2_100k_pu", 1,
+					SCALE_HW_CALIB_THERM_100K_PULLUP)
 	[ADC5_AMUX_THM3_100K_PU] = ADC5_CHAN_TEMP("amux_thm3_100k_pu", 1,
 					SCALE_HW_CALIB_THERM_100K_PULLUP)
+	[ADC5_AMUX_THM4_100K_PU] = ADC5_CHAN_TEMP("amux_thm4_100k_pu", 1,
+					SCALE_HW_CALIB_THERM_100K_PULLUP)
 	[ADC5_AMUX_THM5_100K_PU] = ADC5_CHAN_TEMP("amux_thm5_100k_pu", 1,
 					SCALE_HW_CALIB_THERM_100K_PULLUP)
 	[ADC5_XO_THERM_100K_PU]	= ADC5_CHAN_TEMP("xo_therm_100k_pu", 1,
Signature · 1 line
2.18.0.597.ga71716f1ad-goog
maintainer
#1 lore raw
Quoted 4 lines · On Fri, 10 Aug 2018 12:47:02 -0700 Matthias Kaehlcke <[email protected]> wrote:

Add ADC5_AMUX_THM2_100K_PU and ADC5_AMUX_THM4_100K_PU to the list of rev2 ADC channels.

This is fine and applied to the togreg branch of iio.git. Pushed out as testing to let the autobuilders play with it.

However, I took a quick look and can't immediately see what prevents us specifying channels in DT that don't have these definitions in the driver.

Should we have a check for that as at least superficially it seems like a bad idea!

Jonathan

Quoted 21 lines
---
 drivers/iio/adc/qcom-spmi-adc5.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/iio/adc/qcom-spmi-adc5.c +4 -0
index a4299417f3de..1f9298a5c83d 100644
@@ -491,8 +491,12 @@ static const struct adc5_channels adc5_chans_rev2[ADC5_MAX_CHANNEL] = {
 					SCALE_HW_CALIB_PMIC_THERM)
 	[ADC5_AMUX_THM1_100K_PU] = ADC5_CHAN_TEMP("amux_thm1_100k_pu", 1,
 					SCALE_HW_CALIB_THERM_100K_PULLUP)
+	[ADC5_AMUX_THM2_100K_PU] = ADC5_CHAN_TEMP("amux_thm2_100k_pu", 1,
+					SCALE_HW_CALIB_THERM_100K_PULLUP)
 	[ADC5_AMUX_THM3_100K_PU] = ADC5_CHAN_TEMP("amux_thm3_100k_pu", 1,
 					SCALE_HW_CALIB_THERM_100K_PULLUP)
+	[ADC5_AMUX_THM4_100K_PU] = ADC5_CHAN_TEMP("amux_thm4_100k_pu", 1,
+					SCALE_HW_CALIB_THERM_100K_PULLUP)
 	[ADC5_AMUX_THM5_100K_PU] = ADC5_CHAN_TEMP("amux_thm5_100k_pu", 1,
 					SCALE_HW_CALIB_THERM_100K_PULLUP)
 	[ADC5_XO_THERM_100K_PU]	= ADC5_CHAN_TEMP("xo_therm_100k_pu", 1,
#2 lore raw
Quoted 9 lines · Jonathan Cameron
Quoted 4 lines · On Fri, 10 Aug 2018 12:47:02 -0700 Matthias Kaehlcke <[email protected]> wrote:

Add ADC5_AMUX_THM2_100K_PU and ADC5_AMUX_THM4_100K_PU to the list of rev2 ADC channels.

This is fine and applied to the togreg branch of iio.git. Pushed out as testing to let the autobuilders play with it.

Thanks!

Quoted 2 lines

However, I took a quick look and can't immediately see what prevents us specifying channels in DT that don't have these definitions in the driver.

Indeed, the DT could just specify an arbitrary value.

Quoted 2 lines

Should we have a check for that as at least superficially it seems like a bad idea!

It seems there isn't a single contiguous range, but a very superficial check could at least verify that the value isn't larger than CHAN_MAX or check a few sub-ranges.

Quoted 22 lines
Quoted 21 lines
---
 drivers/iio/adc/qcom-spmi-adc5.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/iio/adc/qcom-spmi-adc5.c +4 -0
index a4299417f3de..1f9298a5c83d 100644
@@ -491,8 +491,12 @@ static const struct adc5_channels adc5_chans_rev2[ADC5_MAX_CHANNEL] = {
 					SCALE_HW_CALIB_PMIC_THERM)
 	[ADC5_AMUX_THM1_100K_PU] = ADC5_CHAN_TEMP("amux_thm1_100k_pu", 1,
 					SCALE_HW_CALIB_THERM_100K_PULLUP)
+	[ADC5_AMUX_THM2_100K_PU] = ADC5_CHAN_TEMP("amux_thm2_100k_pu", 1,
+					SCALE_HW_CALIB_THERM_100K_PULLUP)
 	[ADC5_AMUX_THM3_100K_PU] = ADC5_CHAN_TEMP("amux_thm3_100k_pu", 1,
 					SCALE_HW_CALIB_THERM_100K_PULLUP)
+	[ADC5_AMUX_THM4_100K_PU] = ADC5_CHAN_TEMP("amux_thm4_100k_pu", 1,
+					SCALE_HW_CALIB_THERM_100K_PULLUP)
 	[ADC5_AMUX_THM5_100K_PU] = ADC5_CHAN_TEMP("amux_thm5_100k_pu", 1,
 					SCALE_HW_CALIB_THERM_100K_PULLUP)
 	[ADC5_XO_THERM_100K_PU]	= ADC5_CHAN_TEMP("xo_therm_100k_pu", 1,
maintainer
#3 lore raw
Quoted 16 lines · On Fri, 24 Aug 2018 15:14:39 -0700 Matthias Kaehlcke <[email protected]> wrote:
Quoted 9 lines · Jonathan Cameron
Quoted 4 lines · On Fri, 10 Aug 2018 12:47:02 -0700 Matthias Kaehlcke <[email protected]> wrote:

Add ADC5_AMUX_THM2_100K_PU and ADC5_AMUX_THM4_100K_PU to the list of rev2 ADC channels.

This is fine and applied to the togreg branch of iio.git. Pushed out as testing to let the autobuilders play with it.

Thanks!

Quoted 2 lines

However, I took a quick look and can't immediately see what prevents us specifying channels in DT that don't have these definitions in the driver.

Quoted 8 lines

Indeed, the DT could just specify an arbitrary value.

Quoted 2 lines

Should we have a check for that as at least superficially it seems like a bad idea!

It seems there isn't a single contiguous range, but a very superficial check could at least verify that the value isn't larger than CHAN_MAX or check a few sub-ranges.

Given other entries will be zeroed, just check for something not being 0?

Quoted 23 lines
Quoted 23 lines
Quoted 22 lines
---
 drivers/iio/adc/qcom-spmi-adc5.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/iio/adc/qcom-spmi-adc5.c +4 -0
index a4299417f3de..1f9298a5c83d 100644
@@ -491,8 +491,12 @@ static const struct adc5_channels adc5_chans_rev2[ADC5_MAX_CHANNEL] = {
 					SCALE_HW_CALIB_PMIC_THERM)
 	[ADC5_AMUX_THM1_100K_PU] = ADC5_CHAN_TEMP("amux_thm1_100k_pu", 1,
 					SCALE_HW_CALIB_THERM_100K_PULLUP)
+	[ADC5_AMUX_THM2_100K_PU] = ADC5_CHAN_TEMP("amux_thm2_100k_pu", 1,
+					SCALE_HW_CALIB_THERM_100K_PULLUP)
 	[ADC5_AMUX_THM3_100K_PU] = ADC5_CHAN_TEMP("amux_thm3_100k_pu", 1,
 					SCALE_HW_CALIB_THERM_100K_PULLUP)
+	[ADC5_AMUX_THM4_100K_PU] = ADC5_CHAN_TEMP("amux_thm4_100k_pu", 1,
+					SCALE_HW_CALIB_THERM_100K_PULLUP)
 	[ADC5_AMUX_THM5_100K_PU] = ADC5_CHAN_TEMP("amux_thm5_100k_pu", 1,
 					SCALE_HW_CALIB_THERM_100K_PULLUP)
 	[ADC5_XO_THERM_100K_PU]	= ADC5_CHAN_TEMP("xo_therm_100k_pu", 1,