2014-02-25 13:28:43

by Florian Vaussard

[permalink] [raw]
Subject: [PATCH 0/2] mfd: twl6040: Small clean-ups

Hi,

Here is two cleanups patches for the TWL6040 audio codec. The first
one checks for an error when reading the revision register (first read
in the probe path). The second removes a duplicate I2C writes.

Regards,
Florian

Florian Vaussard (2):
mfd: twl6040: Check for error when reading revision register
mfd: twl6040: Remove duplicate register write

drivers/mfd/twl6040.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

--
1.8.1.2


2014-02-25 13:28:54

by Florian Vaussard

[permalink] [raw]
Subject: [PATCH 2/2] mfd: twl6040: Remove duplicate register write

When probing, regmap_register_patch() will bypass the cache and perform
i2c writes for the given patches. It is thus unnecessary to manually set
the TWL6040_REG_ACCCTL register just before, as it will be done when
registering the twl6040_patch.

Signed-off-by: Florian Vaussard <[email protected]>
---
drivers/mfd/twl6040.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c
index 67e524e..0bd5a18 100644
--- a/drivers/mfd/twl6040.c
+++ b/drivers/mfd/twl6040.c
@@ -710,7 +710,6 @@ static int twl6040_probe(struct i2c_client *client,
}

/* dual-access registers controlled by I2C only */
- twl6040_set_bits(twl6040, TWL6040_REG_ACCCTL, TWL6040_I2CSEL);
regmap_register_patch(twl6040->regmap, twl6040_patch,
ARRAY_SIZE(twl6040_patch));

--
1.8.1.2

2014-02-25 13:29:32

by Florian Vaussard

[permalink] [raw]
Subject: [PATCH 1/2] mfd: twl6040: Check for error when reading revision register

We may have an error when reading the revision register, so check for
the returned value.

Signed-off-by: Florian Vaussard <[email protected]>
---
drivers/mfd/twl6040.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c
index 32ce1ae..67e524e 100644
--- a/drivers/mfd/twl6040.c
+++ b/drivers/mfd/twl6040.c
@@ -661,6 +661,11 @@ static int twl6040_probe(struct i2c_client *client,
init_completion(&twl6040->ready);

twl6040->rev = twl6040_reg_read(twl6040, TWL6040_REG_ASICREV);
+ if (twl6040->rev < 0) {
+ dev_err(&client->dev, "Failed to read revision register: %d\n",
+ twl6040->rev);
+ goto gpio_err;
+ }

/* ERRATA: Automatic power-up is not possible in ES1.0 */
if (twl6040_get_revid(twl6040) > TWL6040_REV_ES1_0)
--
1.8.1.2

2014-02-25 14:20:53

by Peter Ujfalusi

[permalink] [raw]
Subject: Re: [PATCH 0/2] mfd: twl6040: Small clean-ups

On 02/25/2014 03:28 PM, Florian Vaussard wrote:
> Hi,
>
> Here is two cleanups patches for the TWL6040 audio codec. The first
> one checks for an error when reading the revision register (first read
> in the probe path). The second removes a duplicate I2C writes.
>
> Regards,
> Florian

To both:
Acked-by: Peter Ujfalusi <[email protected]>

>
> Florian Vaussard (2):
> mfd: twl6040: Check for error when reading revision register
> mfd: twl6040: Remove duplicate register write
>
> drivers/mfd/twl6040.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>


--
P?ter

2014-02-25 14:22:33

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 1/2] mfd: twl6040: Check for error when reading revision register

> We may have an error when reading the revision register, so check for
> the returned value.
>
> Signed-off-by: Florian Vaussard <[email protected]>
> ---
> drivers/mfd/twl6040.c | 5 +++++
> 1 file changed, 5 insertions(+)

Applied, thanks.

--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

2014-02-25 14:23:03

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 2/2] mfd: twl6040: Remove duplicate register write

> When probing, regmap_register_patch() will bypass the cache and perform
> i2c writes for the given patches. It is thus unnecessary to manually set
> the TWL6040_REG_ACCCTL register just before, as it will be done when
> registering the twl6040_patch.
>
> Signed-off-by: Florian Vaussard <[email protected]>
> ---
> drivers/mfd/twl6040.c | 1 -
> 1 file changed, 1 deletion(-)

Applied, thanks.

--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

2014-02-25 14:27:15

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 0/2] mfd: twl6040: Small clean-ups

> > Here is two cleanups patches for the TWL6040 audio codec. The first
> > one checks for an error when reading the revision register (first read
> > in the probe path). The second removes a duplicate I2C writes.
> >
> > Regards,
> > Florian
>
> To both:
> Acked-by: Peter Ujfalusi <[email protected]>

Applied both with Peter's Ack.

> > Florian Vaussard (2):
> > mfd: twl6040: Check for error when reading revision register
> > mfd: twl6040: Remove duplicate register write
> >
> > drivers/mfd/twl6040.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
>
>

--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

2014-02-25 14:31:10

by Florian Vaussard

[permalink] [raw]
Subject: Re: [PATCH 0/2] mfd: twl6040: Small clean-ups


On 02/25/2014 03:27 PM, Lee Jones wrote:
>>> Here is two cleanups patches for the TWL6040 audio codec. The first
>>> one checks for an error when reading the revision register (first read
>>> in the probe path). The second removes a duplicate I2C writes.
>>>
>>> Regards,
>>> Florian
>>
>> To both:
>> Acked-by: Peter Ujfalusi <[email protected]>
>
> Applied both with Peter's Ack.
>

Thanks!

Florian