mfd: cs47l15: Add missing register default
Subsystems (2)
Charles Keepax
maintainerPATCH 1/3 mfd: cs47l15: Add missing register default
Accessory detect mode 1 is missing a default, add one to the table.
---
This patch can be applied separately from the other patches in the series, if needed.
Thanks,
Charles
drivers/mfd/cs47l15-tables.c | 1 + 1 file changed, 1 insertion(+)
drivers/mfd/cs47l15-tables.c +1 -0
@@ -112,6 +112,7 @@ static const struct reg_default cs47l15_reg_default[] = { { 0x000001dd, 0x0011 }, /* R477 (0x1DD) - FLL AO Control 11 */ { 0x00000218, 0x00e6 }, /* R536 (0x218) - Mic Bias Ctrl 1 */ { 0x0000021c, 0x0222 }, /* R540 (0x21C) - Mic Bias Ctrl 5 */ + { 0x00000293, 0x0080 }, /* R659 (0x293) - Accessory Detect Mode 1 */ { 0x00000299, 0x0000 }, /* R665 (0x299) - Headphone Detect 0 */ { 0x0000029b, 0x0000 }, /* R667 (0x29B) - Headphone Detect 1 */ { 0x000002a2, 0x0010 }, /* R674 (0x2A2) - Mic Detect 1 Control 0 */
Signature · 1 line
2.11.0
Charles Keepax
maintainerPATCH v2 3/3 mfd: madera: Allow more time for hardware reset
Both manual and power on resets have a brief period where the chip will not be accessible immediately afterwards. Extend the time allowed for this from a minimum of 1mS to 2mS based on newer evaluation of the hardware and ensure this reset happens in all reset conditions. Whilst making the change also remove the redundant NULL checks in the reset functions as the GPIO functions already check for this.
---
Changes since v1:
- Switch from a helper function to defines for the delay
This patch can be applied separately from the other patches in the series, if needed.
Thanks,
Charles
drivers/mfd/madera-core.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/mfd/madera-core.c +8 -8
@@ -35,6 +35,9 @@#define MADERA_32KZ_MCLK2 1 +#define MADERA_RESET_MIN_US 2000 +#define MADERA_RESET_MAX_US 3000 +static const char *const madera_core_supplies[] = {"AVDD" ,"DBVDD1" ,
@@ -256,16 +259,13 @@ static int madera_soft_reset(struct madera *madera) }/* Allow time for internal clocks to startup after reset */ -usleep_range (1000 ,2000 ); +usleep_range (MADERA_RESET_MIN_US ,MADERA_RESET_MAX_US );return 0 ; }static void madera_enable_hard_reset (struct madera *madera) { -if (!madera->pdata.reset) -return ; -/* * There are many existing out-of-tree users of these codecs that we * can't break so preserve the expected behaviour of setting the line
@@ -276,11 +276,9 @@ static void madera_enable_hard_reset(struct madera *madera)static void madera_disable_hard_reset (struct madera *madera) { -if (!madera->pdata.reset) -return ; -gpiod_set_raw_value_cansleep (madera->pdata.reset,1 ); -usleep_range (1000 ,2000 ); + +usleep_range (MADERA_RESET_MIN_US ,MADERA_RESET_MAX_US ); }static int __maybe_unused madera_runtime_resume (struct device *dev)
@@ -299,6 +297,8 @@ static int __maybe_unused madera_runtime_resume(struct device *dev)regcache_cache_only (madera->regmap, false);regcache_cache_only (madera->regmap_32bit, false); +usleep_range (MADERA_RESET_MIN_US ,MADERA_RESET_MAX_US ); + ret =madera_wait_for_boot (madera);if (ret) goto err;
Signature · 1 line
2.11.0
Lee Jones
AppliedRe: [PATCH v2 3/3] mfd: madera: Allow more time for hardware reset
Quoted 13 lines · Charles Keepax
Both manual and power on resets have a brief period where the chip will not be accessible immediately afterwards. Extend the time allowed for this from a minimum of 1mS to 2mS based on newer evaluation of the hardware and ensure this reset happens in all reset conditions. Whilst making the change also remove the redundant NULL checks in the reset functions as the GPIO functions already check for this.
Signed-off-by Charles Keepax <[email protected]>---
Changes since v1:
- Switch from a helper function to defines for the delay
Quoted 8 lines
This patch can be applied separately from the other patches in the series, if needed.
Thanks,
Charlesdrivers/mfd/madera-core.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
Applied, thanks.
Signature · 4 lines
Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Charles Keepax
maintainerPATCH RESEND 2/3 mfd: madera: Wait for boot done before accessing any other registers
In reply to Charles KeepaxIt is advised to wait for the boot done bit to be set before reading any other register, update the driver to respect this.
---
This patch can be applied separately from the other patches in the series, if needed. Just resending to keep everything together in one chain.
Thanks,
Charles
drivers/mfd/madera-core.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/mfd/madera-core.c +15 -2
@@ -199,7 +199,7 @@ EXPORT_SYMBOL_GPL(madera_name_from_type);#define MADERA_BOOT_POLL_INTERVAL_USEC 5000#define MADERA_BOOT_POLL_TIMEOUT_USEC 25000 -static int madera_wait_for_boot (struct madera *madera) +static int madera_wait_for_boot_noack (struct madera *madera) {ktime_t timeout;unsigned int val =0 ;
@@ -226,6 +226,13 @@ static int madera_wait_for_boot(struct madera *madera) ret = -ETIMEDOUT ; } +return ret; +} + +static int madera_wait_for_boot (struct madera *madera) +{ +int ret =madera_wait_for_boot_noack (madera); +/* * BOOT_DONE defaults to unmasked on boot so we must ack it. * Do this even after a timeout to avoid interrupt storms.
@@ -545,6 +552,12 @@ int madera_dev_init(struct madera *madera)regcache_cache_only (madera->regmap, false);regcache_cache_only (madera->regmap_32bit, false); + ret =madera_wait_for_boot_noack (madera); +if (ret) { +dev_err (madera->dev,"Device failed initial boot: %d\n" , ret); + goto err_reset; + } +/* * Now we can power up and verify that this is a chip we know about * before we start doing any writes to its registers.
@@ -650,7 +663,7 @@ int madera_dev_init(struct madera *madera) ret =madera_wait_for_boot (madera);if (ret) { -dev_err (madera->dev,"Device failed initial boot: %d\n" , ret); +dev_err (madera->dev,"Failed to clear boot done: %d\n" , ret); goto err_reset; }
Signature · 1 line
2.11.0
Re: [PATCH RESEND 2/3] mfd: madera: Wait for boot done before accessing any other registers
Quoted 6 lines · Charles Keepax
It is advised to wait for the boot done bit to be set before reading any other register, update the driver to respect this.
Signed-off-by Charles Keepax <[email protected]>---
Quoted 8 lines
This patch can be applied separately from the other patches in the series, if needed. Just resending to keep everything together in one chain.
Thanks,
Charlesdrivers/mfd/madera-core.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
Just applied v1 of this.
Signature · 4 lines
Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Lee Jones
AppliedQuoted 5 lines · Charles Keepax
Accessory detect mode 1 is missing a default, add one to the table.
Signed-off-by Charles Keepax <[email protected]>---
Quoted 8 lines
This patch can be applied separately from the other patches in the series, if needed.
Thanks,
Charlesdrivers/mfd/cs47l15-tables.c | 1 + 1 file changed, 1 insertion(+)
Applied, thanks.
Signature · 4 lines
Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog