Skip to contentSkip to conversation

iio: adc: meson: add separate config for axg SoC family

PATCH Superseded George Stark 3 participants 5 messages Nov 22, 2023 – Dec 2, 2023

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 iio: adc: meson: add separate config for axg SoC family

According to Amlogic custom kernels ADC of axg SoC family has vref_select and requires this setting to work nominally and thus needs a separate config.

---
 drivers/iio/adc/meson_saradc.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/iio/adc/meson_saradc.c +15 -1
index db280da9edbf..34555a85f131 100644
@@ -1242,6 +1242,20 @@ static const struct meson_sar_adc_param meson_sar_adc_gxl_param = {
 	.cmv_select = 1,
 };
 
+static const struct meson_sar_adc_param meson_sar_adc_axg_param = {
+	.has_bl30_integration = true,
+	.clock_rate = 1200000,
+	.bandgap_reg = MESON_SAR_ADC_REG11,
+	.regmap_config = &meson_sar_adc_regmap_config_gxbb,
+	.resolution = 12,
+	.disable_ring_counter = 1,
+	.has_reg11 = true,
+	.vref_volatge = 1,
+	.has_vref_select = true,
+	.vref_select = VREF_VDDA,
+	.cmv_select = 1,
+};
+
 static const struct meson_sar_adc_param meson_sar_adc_g12a_param = {
 	.has_bl30_integration = false,
 	.clock_rate = 1200000,
@@ -1286,7 +1300,7 @@ static const struct meson_sar_adc_data meson_sar_adc_gxm_data = {
 };
 
 static const struct meson_sar_adc_data meson_sar_adc_axg_data = {
-	.param = &meson_sar_adc_gxl_param,
+	.param = &meson_sar_adc_axg_param,
 	.name = "meson-axg-saradc",
 };
 
Signature · 1 line
2.38.4
maintainer
#1 lore raw
Quoted 6 lines · On Wed, 22 Nov 2023 10:47:41 +0300 George Stark <[email protected]>…

According to Amlogic custom kernels ADC of axg SoC family has vref_select and requires this setting to work nominally and thus needs a separate config.

Is this a fix? If so, please provide a fixes tag. Or is it aligning with the vendor kernels and we don't know if it's strictly necessary or not?

Quoted 38 lines
---
 drivers/iio/adc/meson_saradc.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/iio/adc/meson_saradc.c +15 -1
index db280da9edbf..34555a85f131 100644
@@ -1242,6 +1242,20 @@ static const struct meson_sar_adc_param meson_sar_adc_gxl_param = {
 	.cmv_select = 1,
 };
 
+static const struct meson_sar_adc_param meson_sar_adc_axg_param = {
+	.has_bl30_integration = true,
+	.clock_rate = 1200000,
+	.bandgap_reg = MESON_SAR_ADC_REG11,
+	.regmap_config = &meson_sar_adc_regmap_config_gxbb,
+	.resolution = 12,
+	.disable_ring_counter = 1,
+	.has_reg11 = true,
+	.vref_volatge = 1,
+	.has_vref_select = true,
+	.vref_select = VREF_VDDA,
+	.cmv_select = 1,
+};
+
 static const struct meson_sar_adc_param meson_sar_adc_g12a_param = {
 	.has_bl30_integration = false,
 	.clock_rate = 1200000,
@@ -1286,7 +1300,7 @@ static const struct meson_sar_adc_data meson_sar_adc_gxm_data = {
 };
 
 static const struct meson_sar_adc_data meson_sar_adc_axg_data = {
-	.param = &meson_sar_adc_gxl_param,
+	.param = &meson_sar_adc_axg_param,
 	.name = "meson-axg-saradc",
 };
 
#2 lore raw

Hello Jonathan

Thanks for the review.

Quoted 11 lines · Jonathan Cameron
Quoted 6 lines · On Wed, 22 Nov 2023 10:47:41 +0300 George Stark <[email protected]>…

According to Amlogic custom kernels ADC of axg SoC family has vref_select and requires this setting to work nominally and thus needs a separate config.

Is this a fix? If so, please provide a fixes tag.

Actually yes, these changes could be done in the patch that introduced new configuration parameters.

Quoted 2 lines

Or is it aligning with the vendor kernels and we don't know if it's strictly necessary or not?

I do know it's necessary if we want kernel driver to be independent from ADC initialization in vendor u-boot code. I have Amlogic a113x device (axg family) and can provide test results w and w/o this patch.

Quoted 40 lines
Quoted 39 lines
---
  drivers/iio/adc/meson_saradc.c | 16 +++++++++++++++-
  1 file changed, 15 insertions(+), 1 deletion(-)
drivers/iio/adc/meson_saradc.c +15 -1
index db280da9edbf..34555a85f131 100644
@@ -1242,6 +1242,20 @@ static const struct meson_sar_adc_param meson_sar_adc_gxl_param = {
  	.cmv_select = 1,
  };
 
+static const struct meson_sar_adc_param meson_sar_adc_axg_param = {
+	.has_bl30_integration = true,
+	.clock_rate = 1200000,
+	.bandgap_reg = MESON_SAR_ADC_REG11,
+	.regmap_config = &meson_sar_adc_regmap_config_gxbb,
+	.resolution = 12,
+	.disable_ring_counter = 1,
+	.has_reg11 = true,
+	.vref_volatge = 1,
+	.has_vref_select = true,
+	.vref_select = VREF_VDDA,
+	.cmv_select = 1,
+};
+
  static const struct meson_sar_adc_param meson_sar_adc_g12a_param = {
  	.has_bl30_integration = false,
  	.clock_rate = 1200000,
@@ -1286,7 +1300,7 @@ static const struct meson_sar_adc_data meson_sar_adc_gxm_data = {
  };
 
  static const struct meson_sar_adc_data meson_sar_adc_axg_data = {
-	.param = &meson_sar_adc_gxl_param,
+	.param = &meson_sar_adc_axg_param,
  	.name = "meson-axg-saradc",
  };
 
Signature · 2 lines
Best regards
George
#3 lore raw
Quoted 16 lines · On Mon, 27 Nov 2023 22:17:33 +0300 George Stark <[email protected]>…

Hello Jonathan

Thanks for the review.

Quoted 11 lines · Jonathan Cameron
Quoted 6 lines · On Wed, 22 Nov 2023 10:47:41 +0300 George Stark <[email protected]>…

According to Amlogic custom kernels ADC of axg SoC family has vref_select and requires this setting to work nominally and thus needs a separate config.

Is this a fix? If so, please provide a fixes tag.

Quoted 8 lines

Actually yes, these changes could be done in the patch that introduced new configuration parameters.

Quoted 2 lines

Or is it aligning with the vendor kernels and we don't know if it's strictly necessary or not?

I do know it's necessary if we want kernel driver to be independent from ADC initialization in vendor u-boot code. I have Amlogic a113x device (axg family) and can provide test results w and w/o this patch.

Definitely best to not rely on firmware.

So send a Fixes tag for this and I'll apply it as a fix (you get to figure out which patch it fixed :)

Jonathan

Quoted 42 lines
Quoted 41 lines
Quoted 40 lines
  
---
  drivers/iio/adc/meson_saradc.c | 16 +++++++++++++++-
  1 file changed, 15 insertions(+), 1 deletion(-)
drivers/iio/adc/meson_saradc.c +15 -1
index db280da9edbf..34555a85f131 100644
@@ -1242,6 +1242,20 @@ static const struct meson_sar_adc_param meson_sar_adc_gxl_param = {
  	.cmv_select = 1,
  };
 
+static const struct meson_sar_adc_param meson_sar_adc_axg_param = {
+	.has_bl30_integration = true,
+	.clock_rate = 1200000,
+	.bandgap_reg = MESON_SAR_ADC_REG11,
+	.regmap_config = &meson_sar_adc_regmap_config_gxbb,
+	.resolution = 12,
+	.disable_ring_counter = 1,
+	.has_reg11 = true,
+	.vref_volatge = 1,
+	.has_vref_select = true,
+	.vref_select = VREF_VDDA,
+	.cmv_select = 1,
+};
+
  static const struct meson_sar_adc_param meson_sar_adc_g12a_param = {
  	.has_bl30_integration = false,
  	.clock_rate = 1200000,
@@ -1286,7 +1300,7 @@ static const struct meson_sar_adc_data meson_sar_adc_gxm_data = {
  };
 
  static const struct meson_sar_adc_data meson_sar_adc_axg_data = {
-	.param = &meson_sar_adc_gxl_param,
+	.param = &meson_sar_adc_axg_param,
  	.name = "meson-axg-saradc",
  };
 
#4 lore raw

Hello Jonathan

Quoted 24 lines · Jonathan Cameron
Quoted 21 lines · On Mon, 27 Nov 2023 22:17:33 +0300 George Stark <[email protected]>…

Hello Jonathan

Thanks for the review.

Quoted 11 lines · Jonathan Cameron
Quoted 6 lines · On Wed, 22 Nov 2023 10:47:41 +0300 George Stark <[email protected]>…

According to Amlogic custom kernels ADC of axg SoC family has vref_select and requires this setting to work nominally and thus needs a separate config.

Is this a fix? If so, please provide a fixes tag.

Actually yes, these changes could be done in the patch that introduced new configuration parameters.

Quoted 2 lines

Or is it aligning with the vendor kernels and we don't know if it's strictly necessary or not?

Quoted 8 lines
Quoted 3 lines

I do know it's necessary if we want kernel driver to be independent from ADC initialization in vendor u-boot code. I have Amlogic a113x device (axg family) and can provide test results w and w/o this patch.

Definitely best to not rely on firmware.

So send a Fixes tag for this and I'll apply it as a fix (you get to figure out which patch it fixed :)

The patch is ready :)

https://lore.kernel.org/lkml/[email protected]/

Quoted 46 lines

Jonathan

Quoted 42 lines
Quoted 41 lines
Quoted 40 lines
   
---
   drivers/iio/adc/meson_saradc.c | 16 +++++++++++++++-
   1 file changed, 15 insertions(+), 1 deletion(-)
drivers/iio/adc/meson_saradc.c +15 -1
index db280da9edbf..34555a85f131 100644
@@ -1242,6 +1242,20 @@ static const struct meson_sar_adc_param meson_sar_adc_gxl_param = {
   	.cmv_select = 1,
   };
 
+static const struct meson_sar_adc_param meson_sar_adc_axg_param = {
+	.has_bl30_integration = true,
+	.clock_rate = 1200000,
+	.bandgap_reg = MESON_SAR_ADC_REG11,
+	.regmap_config = &meson_sar_adc_regmap_config_gxbb,
+	.resolution = 12,
+	.disable_ring_counter = 1,
+	.has_reg11 = true,
+	.vref_volatge = 1,
+	.has_vref_select = true,
+	.vref_select = VREF_VDDA,
+	.cmv_select = 1,
+};
+
   static const struct meson_sar_adc_param meson_sar_adc_g12a_param = {
   	.has_bl30_integration = false,
   	.clock_rate = 1200000,
@@ -1286,7 +1300,7 @@ static const struct meson_sar_adc_data meson_sar_adc_gxm_data = {
   };
 
   static const struct meson_sar_adc_data meson_sar_adc_axg_data = {
-	.param = &meson_sar_adc_gxl_param,
+	.param = &meson_sar_adc_axg_param,
   	.name = "meson-axg-saradc",
   };
 
Signature · 2 lines
Best regards
George