2021-07-17 23:38:57

by Martin Blumenstingl

[permalink] [raw]
Subject: [PATCH 0/3] iio: adc: meson-saradc: Three small improvements

Hello,

the first patch from this series saves a few CPU cycles on G12A, G12B
and SM1 SoCs. The other two patches are small whitespace cleanups.

In my opinion none of these patches are any real bugfix, which is why
I omitted the "Fixes" tag.


Martin Blumenstingl (3):
iio: adc: meson-saradc: Disable BL30 integration on G12A and newer
SoCs
iio: adc: meson-saradc: Add missing space between if and parenthesis
iio: adc: meson-saradc: Fix indentation of arguments after a
line-break

drivers/iio/adc/meson_saradc.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)

--
2.32.0


2021-07-17 23:39:03

by Martin Blumenstingl

[permalink] [raw]
Subject: [PATCH 3/3] iio: adc: meson-saradc: Fix indentation of arguments after a line-break

Align the function arguments after a line-break with the opening
parenthesis on the previous line. No functional changes intended.

Signed-off-by: Martin Blumenstingl <[email protected]>
---
drivers/iio/adc/meson_saradc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
index b4e16f2e957f..705d5e11a54b 100644
--- a/drivers/iio/adc/meson_saradc.c
+++ b/drivers/iio/adc/meson_saradc.c
@@ -497,8 +497,8 @@ static int meson_sar_adc_lock(struct iio_dev *indio_dev)
if (priv->param->has_bl30_integration) {
/* prevent BL30 from using the SAR ADC while we are using it */
regmap_update_bits(priv->regmap, MESON_SAR_ADC_DELAY,
- MESON_SAR_ADC_DELAY_KERNEL_BUSY,
- MESON_SAR_ADC_DELAY_KERNEL_BUSY);
+ MESON_SAR_ADC_DELAY_KERNEL_BUSY,
+ MESON_SAR_ADC_DELAY_KERNEL_BUSY);

/*
* wait until BL30 releases it's lock (so we can use the SAR
@@ -525,7 +525,7 @@ static void meson_sar_adc_unlock(struct iio_dev *indio_dev)
if (priv->param->has_bl30_integration)
/* allow BL30 to use the SAR ADC again */
regmap_update_bits(priv->regmap, MESON_SAR_ADC_DELAY,
- MESON_SAR_ADC_DELAY_KERNEL_BUSY, 0);
+ MESON_SAR_ADC_DELAY_KERNEL_BUSY, 0);

mutex_unlock(&indio_dev->mlock);
}
@@ -791,7 +791,7 @@ static int meson_sar_adc_init(struct iio_dev *indio_dev)
* on the vendor driver), which we don't support at the moment.
*/
regmap_update_bits(priv->regmap, MESON_SAR_ADC_REG0,
- MESON_SAR_ADC_REG0_ADC_TEMP_SEN_SEL, 0);
+ MESON_SAR_ADC_REG0_ADC_TEMP_SEN_SEL, 0);

/* disable all channels by default */
regmap_write(priv->regmap, MESON_SAR_ADC_CHAN_LIST, 0x0);
--
2.32.0

2021-07-17 23:39:06

by Martin Blumenstingl

[permalink] [raw]
Subject: [PATCH 1/3] iio: adc: meson-saradc: Disable BL30 integration on G12A and newer SoCs

G12A and newer don't use the SAR ADC to read the SoC temperature from
within the firmware. Instead there's now a dedicated thermal sensor.
Disable the BL30 integration for G12A and newer SoCs to save a few CPU
cycles when reading samples.
Adding a separate struct meson_sar_adc_data is a good idea anyways
because starting with G12A there's some extra registers to read the
samples in a simplified way.

Signed-off-by: Martin Blumenstingl <[email protected]>
---
drivers/iio/adc/meson_saradc.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
index 66dc452d643a..e140db3e4016 100644
--- a/drivers/iio/adc/meson_saradc.c
+++ b/drivers/iio/adc/meson_saradc.c
@@ -1104,6 +1104,14 @@ static const struct meson_sar_adc_param meson_sar_adc_gxl_param = {
.resolution = 12,
};

+static const struct meson_sar_adc_param meson_sar_adc_g12a_param = {
+ .has_bl30_integration = false,
+ .clock_rate = 1200000,
+ .bandgap_reg = MESON_SAR_ADC_REG11,
+ .regmap_config = &meson_sar_adc_regmap_config_gxbb,
+ .resolution = 12,
+};
+
static const struct meson_sar_adc_data meson_sar_adc_meson8_data = {
.param = &meson_sar_adc_meson8_param,
.name = "meson-meson8-saradc",
@@ -1140,7 +1148,7 @@ static const struct meson_sar_adc_data meson_sar_adc_axg_data = {
};

static const struct meson_sar_adc_data meson_sar_adc_g12a_data = {
- .param = &meson_sar_adc_gxl_param,
+ .param = &meson_sar_adc_g12a_param,
.name = "meson-g12a-saradc",
};

--
2.32.0

2021-07-17 23:39:31

by Martin Blumenstingl

[permalink] [raw]
Subject: [PATCH 2/3] iio: adc: meson-saradc: Add missing space between if and parenthesis

Add a missing space between if and the opening parenthesis to make the
coding style consistent across the whole driver. No functional changes
intended.

Signed-off-by: Martin Blumenstingl <[email protected]>
---
drivers/iio/adc/meson_saradc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
index e140db3e4016..b4e16f2e957f 100644
--- a/drivers/iio/adc/meson_saradc.c
+++ b/drivers/iio/adc/meson_saradc.c
@@ -347,7 +347,7 @@ static int meson_sar_adc_read_raw_sample(struct iio_dev *indio_dev,
struct meson_sar_adc_priv *priv = iio_priv(indio_dev);
int regval, fifo_chan, fifo_val, count;

- if(!wait_for_completion_timeout(&priv->done,
+ if (!wait_for_completion_timeout(&priv->done,
msecs_to_jiffies(MESON_SAR_ADC_TIMEOUT)))
return -ETIMEDOUT;

--
2.32.0

2021-07-25 14:57:39

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH 0/3] iio: adc: meson-saradc: Three small improvements

On Sun, 18 Jul 2021 01:37:15 +0200
Martin Blumenstingl <[email protected]> wrote:

> Hello,
>
> the first patch from this series saves a few CPU cycles on G12A, G12B
> and SM1 SoCs. The other two patches are small whitespace cleanups.
>
> In my opinion none of these patches are any real bugfix, which is why
> I omitted the "Fixes" tag.
>
Series applied to the togreg branch of iio.git and pushed out as testing
to let 0-day poke at it in ways I can't be bothered to ;)

Jonathan

>
> Martin Blumenstingl (3):
> iio: adc: meson-saradc: Disable BL30 integration on G12A and newer
> SoCs
> iio: adc: meson-saradc: Add missing space between if and parenthesis
> iio: adc: meson-saradc: Fix indentation of arguments after a
> line-break
>
> drivers/iio/adc/meson_saradc.c | 20 ++++++++++++++------
> 1 file changed, 14 insertions(+), 6 deletions(-)
>