diff mbox series

[3/6] adc: meson-saradc: skip hardware init only if ADC is enabled

Message ID 20201214112437.18757-4-m.szyprowski@samsung.com
State Superseded
Headers show
Series VIM3: add support for checking 'Function' button state | expand

Commit Message

Marek Szyprowski Dec. 14, 2020, 11:24 a.m. UTC
The driver skips hardware initialization if it is already configured by
the earlier bootloader stage (BL30). Skip the initialization only if the
hardware is really initialized and enabled.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

Change-Id: I3e2e2d270ad3e7e7f38e2bc3ce2a924a47b164af
---
 drivers/adc/meson-saradc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

-- 
2.17.1

Comments

Neil Armstrong Dec. 14, 2020, 6:54 p.m. UTC | #1
On 14/12/2020 12:24, Marek Szyprowski wrote:
> The driver skips hardware initialization if it is already configured by

> the earlier bootloader stage (BL30). Skip the initialization only if the

> hardware is really initialized and enabled.

> 

> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

> Change-Id: I3e2e2d270ad3e7e7f38e2bc3ce2a924a47b164af


Ditto

> ---

>  drivers/adc/meson-saradc.c | 7 +++++--

>  1 file changed, 5 insertions(+), 2 deletions(-)

> 

> diff --git a/drivers/adc/meson-saradc.c b/drivers/adc/meson-saradc.c

> index 998cef24d88..ce7ae990ad0 100644

> --- a/drivers/adc/meson-saradc.c

> +++ b/drivers/adc/meson-saradc.c

> @@ -512,8 +512,11 @@ static int meson_saradc_init(struct meson_saradc_priv *priv)

>  	 * reading the temperature sensor.

>  	 */

>  	regmap_read(priv->regmap, MESON_SAR_ADC_REG3, &regval);

> -	if (regval & MESON_SAR_ADC_REG3_BL30_INITIALIZED)

> -		return 0;

> +	if (regval & MESON_SAR_ADC_REG3_BL30_INITIALIZED) {

> +		regmap_read(priv->regmap, MESON_SAR_ADC_REG3, &regval);

> +		if (regval & MESON_SAR_ADC_REG3_ADC_EN)

> +			return 0;

> +	}

>  

>  	meson_saradc_stop_sample_engine(priv);

>  

> 


Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Jaehoon Chung Dec. 14, 2020, 9:50 p.m. UTC | #2
On 12/15/20 3:54 AM, Neil Armstrong wrote:
> On 14/12/2020 12:24, Marek Szyprowski wrote:

>> The driver skips hardware initialization if it is already configured by

>> the earlier bootloader stage (BL30). Skip the initialization only if the

>> hardware is really initialized and enabled.

>>

>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

>> Change-Id: I3e2e2d270ad3e7e7f38e2bc3ce2a924a47b164af

> 

> Ditto

> 

>> ---

>>  drivers/adc/meson-saradc.c | 7 +++++--

>>  1 file changed, 5 insertions(+), 2 deletions(-)

>>

>> diff --git a/drivers/adc/meson-saradc.c b/drivers/adc/meson-saradc.c

>> index 998cef24d88..ce7ae990ad0 100644

>> --- a/drivers/adc/meson-saradc.c

>> +++ b/drivers/adc/meson-saradc.c

>> @@ -512,8 +512,11 @@ static int meson_saradc_init(struct meson_saradc_priv *priv)

>>  	 * reading the temperature sensor.

>>  	 */

>>  	regmap_read(priv->regmap, MESON_SAR_ADC_REG3, &regval);

>> -	if (regval & MESON_SAR_ADC_REG3_BL30_INITIALIZED)

>> -		return 0;

>> +	if (regval & MESON_SAR_ADC_REG3_BL30_INITIALIZED) {

>> +		regmap_read(priv->regmap, MESON_SAR_ADC_REG3, &regval);

>> +		if (regval & MESON_SAR_ADC_REG3_ADC_EN)

>> +			return 0;

>> +	}

>>  

>>  	meson_saradc_stop_sample_engine(priv);

>>  

>>

> 

> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>


Tested-by: Jaehoon Chung <jh80.chung@samsung.com>

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>


>
diff mbox series

Patch

diff --git a/drivers/adc/meson-saradc.c b/drivers/adc/meson-saradc.c
index 998cef24d88..ce7ae990ad0 100644
--- a/drivers/adc/meson-saradc.c
+++ b/drivers/adc/meson-saradc.c
@@ -512,8 +512,11 @@  static int meson_saradc_init(struct meson_saradc_priv *priv)
 	 * reading the temperature sensor.
 	 */
 	regmap_read(priv->regmap, MESON_SAR_ADC_REG3, &regval);
-	if (regval & MESON_SAR_ADC_REG3_BL30_INITIALIZED)
-		return 0;
+	if (regval & MESON_SAR_ADC_REG3_BL30_INITIALIZED) {
+		regmap_read(priv->regmap, MESON_SAR_ADC_REG3, &regval);
+		if (regval & MESON_SAR_ADC_REG3_ADC_EN)
+			return 0;
+	}
 
 	meson_saradc_stop_sample_engine(priv);