From: jic23@kernel.org (Jonathan Cameron)
To: linus-amlogic@lists.infradead.org
Subject: [PATCH 3/5] iio: adc: meson-saradc: Meson8 and Meson8b do not have REG11 and REG13
Date: Sun, 19 Nov 2017 15:46:43 +0000 [thread overview]
Message-ID: <20171119154643.78826fd4@archlinux> (raw)
In-Reply-To: <20171031200147.14660-4-martin.blumenstingl@googlemail.com>
On Tue, 31 Oct 2017 21:01:45 +0100
Martin Blumenstingl <martin.blumenstingl@googlemail.com> wrote:
> The Meson GXBB and newer SoCs have a few more registers than the older
> Meson8 and Meson8b SoCs.
> Use a separate regmap config to limit the older SoCs to the DELTA_10
> register.
>
> Fixes: 6c76ed31cd05 ("iio: adc: meson-saradc: add Meson8b SoC compatibility")
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
While this may not have any obvious symptoms, I think it is better to make sure
it is fixed in stable so it doesn't bite us in unexpected ways later.
Applied to the fixes-togreg branch of iio.git and marked for stable.
> ---
> drivers/iio/adc/meson_saradc.c | 17 +++++++++++++++--
> 1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
> index abe9df879b2a..7dc7d297a0fc 100644
> --- a/drivers/iio/adc/meson_saradc.c
> +++ b/drivers/iio/adc/meson_saradc.c
> @@ -224,6 +224,7 @@ struct meson_sar_adc_data {
> u32 bandgap_reg;
> unsigned int resolution;
> const char *name;
> + const struct regmap_config *regmap_config;
> };
>
> struct meson_sar_adc_priv {
> @@ -243,13 +244,20 @@ struct meson_sar_adc_priv {
> int calibscale;
> };
>
> -static const struct regmap_config meson_sar_adc_regmap_config = {
> +static const struct regmap_config meson_sar_adc_regmap_config_gxbb = {
> .reg_bits = 8,
> .val_bits = 32,
> .reg_stride = 4,
> .max_register = MESON_SAR_ADC_REG13,
> };
>
> +static const struct regmap_config meson_sar_adc_regmap_config_meson8 = {
> + .reg_bits = 8,
> + .val_bits = 32,
> + .reg_stride = 4,
> + .max_register = MESON_SAR_ADC_DELTA_10,
> +};
> +
> static unsigned int meson_sar_adc_get_fifo_count(struct iio_dev *indio_dev)
> {
> struct meson_sar_adc_priv *priv = iio_priv(indio_dev);
> @@ -860,6 +868,7 @@ static const struct iio_info meson_sar_adc_iio_info = {
> static const struct meson_sar_adc_data meson_sar_adc_meson8_data = {
> .has_bl30_integration = false,
> .bandgap_reg = MESON_SAR_ADC_DELTA_10,
> + .regmap_config = &meson_sar_adc_regmap_config_meson8,
> .resolution = 10,
> .name = "meson-meson8-saradc",
> };
> @@ -867,6 +876,7 @@ static const struct meson_sar_adc_data meson_sar_adc_meson8_data = {
> static const struct meson_sar_adc_data meson_sar_adc_meson8b_data = {
> .has_bl30_integration = false,
> .bandgap_reg = MESON_SAR_ADC_DELTA_10,
> + .regmap_config = &meson_sar_adc_regmap_config_meson8,
> .resolution = 10,
> .name = "meson-meson8b-saradc",
> };
> @@ -874,6 +884,7 @@ static const struct meson_sar_adc_data meson_sar_adc_meson8b_data = {
> static const struct meson_sar_adc_data meson_sar_adc_gxbb_data = {
> .has_bl30_integration = true,
> .bandgap_reg = MESON_SAR_ADC_REG11,
> + .regmap_config = &meson_sar_adc_regmap_config_gxbb,
> .resolution = 10,
> .name = "meson-gxbb-saradc",
> };
> @@ -881,6 +892,7 @@ static const struct meson_sar_adc_data meson_sar_adc_gxbb_data = {
> static const struct meson_sar_adc_data meson_sar_adc_gxl_data = {
> .has_bl30_integration = true,
> .bandgap_reg = MESON_SAR_ADC_REG11,
> + .regmap_config = &meson_sar_adc_regmap_config_gxbb,
> .resolution = 12,
> .name = "meson-gxl-saradc",
> };
> @@ -888,6 +900,7 @@ static const struct meson_sar_adc_data meson_sar_adc_gxl_data = {
> static const struct meson_sar_adc_data meson_sar_adc_gxm_data = {
> .has_bl30_integration = true,
> .bandgap_reg = MESON_SAR_ADC_REG11,
> + .regmap_config = &meson_sar_adc_regmap_config_gxbb,
> .resolution = 12,
> .name = "meson-gxm-saradc",
> };
> @@ -965,7 +978,7 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
> return ret;
>
> priv->regmap = devm_regmap_init_mmio(&pdev->dev, base,
> - &meson_sar_adc_regmap_config);
> + priv->data->regmap_config);
> if (IS_ERR(priv->regmap))
> return PTR_ERR(priv->regmap);
>
next prev parent reply other threads:[~2017-11-19 15:46 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-31 20:01 [PATCH 0/5] meson_saradc fixes and minor improvements Martin Blumenstingl
2017-10-31 20:01 ` [PATCH 1/5] iio: adc: meson-saradc: fix the bit_idx of the adc_en clock Martin Blumenstingl
2017-11-19 15:43 ` Jonathan Cameron
2017-10-31 20:01 ` [PATCH 2/5] iio: adc: meson-saradc: initialize the bandgap correctly on older SoCs Martin Blumenstingl
2017-11-19 15:44 ` Jonathan Cameron
2017-10-31 20:01 ` [PATCH 3/5] iio: adc: meson-saradc: Meson8 and Meson8b do not have REG11 and REG13 Martin Blumenstingl
2017-11-19 15:46 ` Jonathan Cameron [this message]
2017-10-31 20:01 ` [PATCH 4/5] iio: adc: meson-saradc: fix the clock frequency on Meson8 and Meson8b Martin Blumenstingl
2017-11-19 15:55 ` Jonathan Cameron
2017-12-10 19:47 ` Jonathan Cameron
2017-10-31 20:01 ` [PATCH 5/5] iio: adc: meson-saradc: program the channel muxes during initialization Martin Blumenstingl
2017-11-19 15:57 ` Jonathan Cameron
2017-12-10 19:49 ` Jonathan Cameron
2017-11-02 15:05 ` [PATCH 0/5] meson_saradc fixes and minor improvements Jonathan Cameron
2017-11-27 23:47 ` Kevin Hilman
2017-12-02 11:30 ` Jonathan Cameron
2017-12-10 17:48 ` Martin Blumenstingl
2017-12-10 19:50 ` Jonathan Cameron
2017-12-10 22:27 ` Martin Blumenstingl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171119154643.78826fd4@archlinux \
--to=jic23@kernel.org \
--cc=linus-amlogic@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).