Commit d1adcaf7 authored by George Stark's avatar George Stark Committed by Jonathan Cameron

iio: adc: meson: init internal continuous ring counter

Disable internal continuous ring counter at init stage. Disable value
depends on SoC family: gxl and later SoCs write 1, others write 0.
This bit are inited in vendor boot code (bl2, bl33) already so do it
in the driver to not depend on other code.
Signed-off-by: default avatarGeorge Stark <gnstark@sberdevices.ru>
Link: https://lore.kernel.org/r/20230715110654.6035-3-gnstark@sberdevices.ruSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 6ad9f01c
...@@ -313,6 +313,7 @@ struct meson_sar_adc_param { ...@@ -313,6 +313,7 @@ struct meson_sar_adc_param {
u8 temperature_trimming_bits; u8 temperature_trimming_bits;
unsigned int temperature_multiplier; unsigned int temperature_multiplier;
unsigned int temperature_divider; unsigned int temperature_divider;
u8 disable_ring_counter;
}; };
struct meson_sar_adc_data { struct meson_sar_adc_data {
...@@ -967,6 +968,12 @@ static int meson_sar_adc_init(struct iio_dev *indio_dev) ...@@ -967,6 +968,12 @@ static int meson_sar_adc_init(struct iio_dev *indio_dev)
MESON_SAR_ADC_DELTA_10_TS_REVE0, 0); MESON_SAR_ADC_DELTA_10_TS_REVE0, 0);
} }
regval = FIELD_PREP(MESON_SAR_ADC_REG3_CTRL_CONT_RING_COUNTER_EN,
priv->param->disable_ring_counter);
regmap_update_bits(priv->regmap, MESON_SAR_ADC_REG3,
MESON_SAR_ADC_REG3_CTRL_CONT_RING_COUNTER_EN,
regval);
ret = clk_set_parent(priv->adc_sel_clk, priv->clkin); ret = clk_set_parent(priv->adc_sel_clk, priv->clkin);
if (ret) if (ret)
return dev_err_probe(dev, ret, "failed to set adc parent to clkin\n"); return dev_err_probe(dev, ret, "failed to set adc parent to clkin\n");
...@@ -1196,6 +1203,7 @@ static const struct meson_sar_adc_param meson_sar_adc_gxl_param = { ...@@ -1196,6 +1203,7 @@ static const struct meson_sar_adc_param meson_sar_adc_gxl_param = {
.bandgap_reg = MESON_SAR_ADC_REG11, .bandgap_reg = MESON_SAR_ADC_REG11,
.regmap_config = &meson_sar_adc_regmap_config_gxbb, .regmap_config = &meson_sar_adc_regmap_config_gxbb,
.resolution = 12, .resolution = 12,
.disable_ring_counter = 1,
}; };
static const struct meson_sar_adc_param meson_sar_adc_g12a_param = { static const struct meson_sar_adc_param meson_sar_adc_g12a_param = {
...@@ -1204,6 +1212,7 @@ static const struct meson_sar_adc_param meson_sar_adc_g12a_param = { ...@@ -1204,6 +1212,7 @@ static const struct meson_sar_adc_param meson_sar_adc_g12a_param = {
.bandgap_reg = MESON_SAR_ADC_REG11, .bandgap_reg = MESON_SAR_ADC_REG11,
.regmap_config = &meson_sar_adc_regmap_config_gxbb, .regmap_config = &meson_sar_adc_regmap_config_gxbb,
.resolution = 12, .resolution = 12,
.disable_ring_counter = 1,
}; };
static const struct meson_sar_adc_data meson_sar_adc_meson8_data = { static const struct meson_sar_adc_data meson_sar_adc_meson8_data = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment