Add a new SoundWire enumeration helper
Subsystems (6)
cover Add a new SoundWire enumeration helper
Add a new SoundWire enumeration helper function, many drivers have almost identical code in runtime resume so it makes sense to move this to the core.
It is worth noting this is really step one of a larger process, there are a few drivers that do more custom things and are not covered by this series. But this series picks up the low hanging fruit and moves things in a good direction.
The next step is to look at drivers that also wait at probe time, where the unattached_request flag is not going to be valid.
Thanks,
Charles
Charles Keepax (17):
soundwire: Add a helper function to wait for device initialisation
ASoC: cs42l42: Use new SoundWire enumeration helper
ASoC: max98363: Use new SoundWire enumeration helper
ASoC: max98373: Use new SoundWire enumeration helper
ASoC: rt700: Use new SoundWire enumeration helper
ASoC: rt711: Use new SoundWire enumeration helper
ASoC: rt712: Use new SoundWire enumeration helper
ASoC: rt715: Use new SoundWire enumeration helper
ASoc: rt721: Use new SoundWire enumeration helper
ASoC: rt722: Use new SoundWire enumeration helper
ASoC: rt1017: Use new SoundWire enumeration helper
ASoC: rt1308: Use new SoundWire enumeration helper
ASoC: rt1316: Use new SoundWire enumeration helper
ASoC: rt1318: Use new SoundWire enumeration helper
ASoC: rt1320: Use new SoundWire enumeration helper
ASoC: rt5682: Use new SoundWire enumeration helper
ASoC: tas2783: Use new SoundWire enumeration helper
drivers/soundwire/bus.c | 21 +++++++++++++++++++++ include/linux/soundwire/sdw.h | 2 ++ sound/soc/codecs/cs42l42-sdw.c | 15 ++++----------- sound/soc/codecs/max98363.c | 17 ++++------------- sound/soc/codecs/max98373-sdw.c | 18 ++++-------------- sound/soc/codecs/rt1017-sdca-sdw.c | 18 ++++-------------- sound/soc/codecs/rt1308-sdw.c | 18 ++++-------------- sound/soc/codecs/rt1316-sdw.c | 18 ++++-------------- sound/soc/codecs/rt1318-sdw.c | 16 ++++------------ sound/soc/codecs/rt1320-sdw.c | 16 ++++------------ sound/soc/codecs/rt5682-sdw.c | 16 ++++------------ sound/soc/codecs/rt700-sdw.c | 18 ++++-------------- sound/soc/codecs/rt711-sdca-sdw.c | 16 ++++------------ sound/soc/codecs/rt711-sdw.c | 14 ++++---------- sound/soc/codecs/rt712-sdca-dmic.c | 19 ++++--------------- sound/soc/codecs/rt712-sdca-sdw.c | 16 ++++------------ sound/soc/codecs/rt715-sdca-sdw.c | 18 ++++-------------- sound/soc/codecs/rt715-sdw.c | 18 ++++-------------- sound/soc/codecs/rt721-sdca-sdw.c | 16 ++++------------ sound/soc/codecs/rt722-sdca-sdw.c | 16 ++++------------ sound/soc/codecs/tas2783-sdw.c | 18 ++++-------------- 21 files changed, 99 insertions(+), 245 deletions(-)
Signature · 1 line
2.47.3
PATCH 1/17 soundwire: Add a helper function to wait for device initialisation
Add a new helper function to wait for the device to enumerate and be initialised by the SoundWire core. Most of the SoundWire drivers have very similar boiler plate code in their runtime resume, and that boiler plate tends to access various internals of the SoundWire structs which is a mild layering violation.
Adding a new core helper function greatly eases both of these issues.
--- drivers/soundwire/bus.c | 21 +++++++++++++++++++++ include/linux/soundwire/sdw.h | 2 ++ 2 files changed, 23 insertions(+)
drivers/soundwire/bus.c +21 -0
@@ -1372,6 +1372,27 @@ int sdw_slave_get_current_bank(struct sdw_slave *slave) }EXPORT_SYMBOL_GPL (sdw_slave_get_current_bank); +int sdw_slave_wait_for_init (struct sdw_slave *slave,int timeout) +{ +unsigned long time; + +if (!slave->unattach_request) +return 0 ; + + time =wait_for_completion_timeout (&slave->initialization_complete, +msecs_to_jiffies (timeout)); +if (!time) { +dev_err (&slave->dev,"Initialization not complete\n" ); +sdw_show_ping_status (slave->bus, true); +return -ETIMEDOUT ; + } + + slave->unattach_request =0 ; + +return 0 ; +} +EXPORT_SYMBOL_GPL (sdw_slave_wait_for_init); +static int sdw_slave_set_frequency (struct sdw_slave *slave) {int scale_index;
include/linux/soundwire/sdw.h +2 -0
@@ -1093,6 +1093,8 @@ int sdw_slave_get_current_bank(struct sdw_slave *sdev);int sdw_slave_get_scale_index (struct sdw_slave *slave,u8 *base); +int sdw_slave_wait_for_init (struct sdw_slave *slave,int timeout); +/* messaging and data APIs */ int sdw_read (struct sdw_slave *slave,u32 addr);int sdw_write (struct sdw_slave *slave,u32 addr,u8 value);
Signature · 1 line
2.47.3
Re: [PATCH 01/17] soundwire: Add a helper function to wait for device initialisation
Quoted 11 lines · Charles Keepax
Add a new helper function to wait for the device to enumerate and be initialised by the SoundWire core. Most of the SoundWire drivers have very similar boiler plate code in their runtime resume, and that boiler plate tends to access various internals of the SoundWire structs which is a mild layering violation.
Adding a new core helper function greatly eases both of these issues.
Signed-off-by Charles Keepax <[email protected]>---
Sorry Vinod, it appears I somehow completely forgot to CC you on this series. Let me know if you got it through the mailing list, and if not I will do a resend.
Thanks,
Charles
Quoted 52 lines
drivers/soundwire/bus.c | 21 +++++++++++++++++++++ include/linux/soundwire/sdw.h | 2 ++ 2 files changed, 23 insertions(+)drivers/soundwire/bus.c +21
-0@@ -1372,6 +1372,27 @@ int sdw_slave_get_current_bank(struct sdw_slave *slave) }EXPORT_SYMBOL_GPL (sdw_slave_get_current_bank); +int sdw_slave_wait_for_init (struct sdw_slave *slave,int timeout) +{ +unsigned long time; + +if (!slave->unattach_request) +return 0 ; + + time =wait_for_completion_timeout (&slave->initialization_complete, +msecs_to_jiffies (timeout)); +if (!time) { +dev_err (&slave->dev,"Initialization not complete\n" ); +sdw_show_ping_status (slave->bus, true); +return -ETIMEDOUT ; + } + + slave->unattach_request =0 ; + +return 0 ; +} +EXPORT_SYMBOL_GPL (sdw_slave_wait_for_init); +static int sdw_slave_set_frequency (struct sdw_slave *slave) {int scale_index;include/linux/soundwire/sdw.h +2
-0@@ -1093,6 +1093,8 @@ int sdw_slave_get_current_bank(struct sdw_slave *sdev);int sdw_slave_get_scale_index (struct sdw_slave *slave,u8 *base); +int sdw_slave_wait_for_init (struct sdw_slave *slave,int timeout); +/* messaging and data APIs */ int sdw_read (struct sdw_slave *slave,u32 addr);int sdw_write (struct sdw_slave *slave,u32 addr,u8 value);Signature · 1 line
2.47.3
Re: [PATCH 01/17] soundwire: Add a helper function to wait for device initialisation
Quoted 9 lines · Charles Keepax
include/linux/soundwire/sdw.h int sdw_slave_get_current_bank(struct sdw_slave *sdev); · line 1097
Quoted 8 lines · Charles Keepax
include/linux/soundwire/sdw.h +2
-0@@ -1093,6 +1093,8 @@ int sdw_slave_get_current_bank(struct sdw_slave *sdev);int sdw_slave_get_scale_index (struct sdw_slave *slave,u8 *base); +int sdw_slave_wait_for_init (struct sdw_slave *slave,int timeout); +
This should also probably get a stub for the no soundwire case.
Thanks,
Charles
Vinod Koul
maintainerRe: [PATCH 01/17] soundwire: Add a helper function to wait for device initialisation
In reply to Charles KeepaxQuoted 10 lines · Charles Keepax
Quoted 9 lines · Charles Keepax
Add a new helper function to wait for the device to enumerate and be initialised by the SoundWire core. Most of the SoundWire drivers have very similar boiler plate code in their runtime resume, and that boiler plate tends to access various internals of the SoundWire structs which is a mild layering violation.
Adding a new core helper function greatly eases both of these issues.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Charles Keepax <[email protected]>---
Sorry Vinod, it appears I somehow completely forgot to CC you on this series. Let me know if you got it through the mailing list, and if not I will do a resend.
Thanks, I was able to get the series. lgtm with only change required to add stub as you already noted
Signature · 1 line
~Vinod
PATCH 2/17 ASoC: cs42l42: Use new SoundWire enumeration helper
In reply to Charles KeepaxUpdate the driver to use the new core helper that waits for the device to enumerate on SoundWire and be initialised by the SoundWire core.
--- sound/soc/codecs/cs42l42-sdw.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
sound/soc/codecs/cs42l42-sdw.c +4 -11
@@ -433,19 +433,12 @@ static const struct reg_sequence cs42l42_soft_reboot_seq[] = {static int cs42l42_sdw_handle_unattach (struct cs42l42_private *cs42l42) {struct sdw_slave *peripheral = cs42l42->sdw_peripheral; - -if (!peripheral->unattach_request) -return 0 ; +int ret;/* Cannot access registers until master re-attaches. */ -dev_dbg (&peripheral->dev,"Wait for initialization_complete\n" ); -if (!wait_for_completion_timeout (&peripheral->initialization_complete, -msecs_to_jiffies (5000 ))) { -dev_err (&peripheral->dev,"initialization_complete timed out\n" ); -return -ETIMEDOUT ; - } - - peripheral->unattach_request =0 ; + ret =sdw_slave_wait_for_init (peripheral,5000 ); +if (ret) +return ret;/* * After a bus reset there must be a reconfiguration reset to
Signature · 1 line
2.47.3
Mark Brown
maintainerRe: [PATCH 02/17] ASoC: cs42l42: Use new SoundWire enumeration helper
Quoted 8 lines · Charles Keepax
Update the driver to use the new core helper that waits for the device to enumerate on SoundWire and be initialised by the SoundWire core.
static int
cs42l42_sdw_handle_unattach(struct cs42l42_private *cs42l42){sound/soc/codecs/cs42l42-sdw.c +0
-2-if (!peripheral->unattach_request) -return 0 ;
...
sound/soc/codecs/cs42l42-sdw.c static const struct reg_sequence cs42l42_soft_reboot_seq[] = { · line 444
Quoted 3 lines
sound/soc/codecs/cs42l42-sdw.c +0
-0/* * After a bus reset there must be a reconfiguration reset to
We now always fall through to this block of code instead of exiting early if the device wasn't actually reset, the new helper doesn't distinguish between no reset and successfully waited for reset.
Re: [PATCH 02/17] ASoC: cs42l42: Use new SoundWire enumeration helper
Quoted 13 lines · Mark Brown
Quoted 8 lines · Charles Keepax
Update the driver to use the new core helper that waits for the device to enumerate on SoundWire and be initialised by the SoundWire core.
static int
cs42l42_sdw_handle_unattach(struct cs42l42_private *cs42l42){sound/soc/codecs/cs42l42-sdw.c +0
-2-if (!peripheral->unattach_request) -return 0 ;...
Quoted 1 line
Quoted 6 lines
sound/soc/codecs/cs42l42-sdw.c static const struct reg_sequence cs42l42_soft_reboot_seq[] = { · line 444
Quoted 2 lines
sound/soc/codecs/cs42l42-sdw.c +0
-0/* * After a bus reset there must be a reconfiguration reset to We now always fall through to this block of code instead of exiting early if the device wasn't actually reset, the new helper doesn't distinguish between no reset and successfully waited for reset.
Thanks will give a couple days for any other comments then do a spin.
Thanks,
Charles
PATCH 3/17 ASoC: max98363: Use new SoundWire enumeration helper
In reply to Charles KeepaxUpdate the driver to use the new core helper that waits for the device to enumerate on SoundWire and be initialised by the SoundWire core.
--- sound/soc/codecs/max98363.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
sound/soc/codecs/max98363.c +4 -13
@@ -90,24 +90,15 @@ static int max98363_resume(struct device *dev) {struct sdw_slave *slave =dev_to_sdw_dev (dev);struct max98363_priv *max98363 =dev_get_drvdata (dev); -unsigned long time; +int ret;if (!max98363->first_hw_init)return 0 ; -if (!slave->unattach_request) - goto regmap_sync; - - time =wait_for_completion_timeout (&slave->initialization_complete, -msecs_to_jiffies (MAX98363_PROBE_TIMEOUT )); -if (!time) { -dev_err (dev,"Initialization not complete, timed out\n" ); -return -ETIMEDOUT ; - } - -regmap_sync: + ret =sdw_slave_wait_for_init (slave,MAX98363_PROBE_TIMEOUT ); +if (ret) +return ret; - slave->unattach_request =0 ;regcache_cache_only (max98363->regmap, false);regcache_sync (max98363->regmap);
Signature · 1 line
2.47.3
PATCH 4/17 ASoC: max98373: Use new SoundWire enumeration helper
In reply to Charles KeepaxUpdate the driver to use the new core helper that waits for the device to enumerate on SoundWire and be initialised by the SoundWire core.
--- sound/soc/codecs/max98373-sdw.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)
sound/soc/codecs/max98373-sdw.c +4 -14
@@ -266,25 +266,15 @@ static int max98373_resume(struct device *dev) {struct sdw_slave *slave =dev_to_sdw_dev (dev);struct max98373_priv *max98373 =dev_get_drvdata (dev); -unsigned long time; +int ret;if (!max98373->first_hw_init)return 0 ; -if (!slave->unattach_request) - goto regmap_sync; - - time =wait_for_completion_timeout (&slave->initialization_complete, -msecs_to_jiffies (MAX98373_PROBE_TIMEOUT )); -if (!time) { -dev_err (dev,"Initialization not complete, timed out\n" ); -sdw_show_ping_status (slave->bus, true); - -return -ETIMEDOUT ; - } + ret =sdw_slave_wait_for_init (slave,MAX98373_PROBE_TIMEOUT ); +if (ret) +return ret; -regmap_sync: - slave->unattach_request =0 ;regcache_cache_only (max98373->regmap, false);regcache_sync (max98373->regmap);
Signature · 1 line
2.47.3
PATCH 5/17 ASoC: rt700: Use new SoundWire enumeration helper
In reply to Charles KeepaxUpdate the driver to use the new core helper that waits for the device to enumerate on SoundWire and be initialised by the SoundWire core.
--- sound/soc/codecs/rt700-sdw.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)
sound/soc/codecs/rt700-sdw.c +4 -14
@@ -522,25 +522,15 @@ static int rt700_dev_resume(struct device *dev) {struct sdw_slave *slave =dev_to_sdw_dev (dev);struct rt700_priv *rt700 =dev_get_drvdata (dev); -unsigned long time; +int ret;if (!rt700->first_hw_init)return 0 ; -if (!slave->unattach_request) - goto regmap_sync; - - time =wait_for_completion_timeout (&slave->initialization_complete, -msecs_to_jiffies (RT700_PROBE_TIMEOUT )); -if (!time) { -dev_err (&slave->dev,"Initialization not complete, timed out\n" ); -sdw_show_ping_status (slave->bus, true); - -return -ETIMEDOUT ; - } + ret =sdw_slave_wait_for_init (slave,RT700_PROBE_TIMEOUT ); +if (ret) +return ret; -regmap_sync: - slave->unattach_request =0 ;regcache_cache_only (rt700->regmap, false);regcache_sync_region (rt700->regmap,0x3000 ,0x8fff );regcache_sync_region (rt700->regmap,0x752010 ,0x75206b );
Signature · 1 line
2.47.3
PATCH 6/17 ASoC: rt711: Use new SoundWire enumeration helper
In reply to Charles KeepaxUpdate the driver to use the new core helper that waits for the device to enumerate on SoundWire and be initialised by the SoundWire core.
--- sound/soc/codecs/rt711-sdca-sdw.c | 16 ++++------------ sound/soc/codecs/rt711-sdw.c | 14 ++++---------- 2 files changed, 8 insertions(+), 22 deletions(-)
sound/soc/codecs/rt711-sdca-sdw.c +4 -12
@@ -438,7 +438,7 @@ static int rt711_sdca_dev_resume(struct device *dev) {struct sdw_slave *slave =dev_to_sdw_dev (dev);struct rt711_sdca_priv *rt711 =dev_get_drvdata (dev); -unsigned long time; +int ret;if (!rt711->first_hw_init)return 0 ;
@@ -451,20 +451,12 @@ static int rt711_sdca_dev_resume(struct device *dev) rt711->disable_irq = false; }mutex_unlock (&rt711->disable_irq_lock); - goto regmap_sync; } - time =wait_for_completion_timeout (&slave->initialization_complete, -msecs_to_jiffies (RT711_PROBE_TIMEOUT )); -if (!time) { -dev_err (&slave->dev,"%s: Initialization not complete, timed out\n" , __func__); -sdw_show_ping_status (slave->bus, true); + ret =sdw_slave_wait_for_init (slave,RT711_PROBE_TIMEOUT ); +if (ret) +return ret; -return -ETIMEDOUT ; - } - -regmap_sync: - slave->unattach_request =0 ;regcache_cache_only (rt711->regmap, false);regcache_sync (rt711->regmap);regcache_cache_only (rt711->mbq_regmap, false);
sound/soc/codecs/rt711-sdw.c +4 -10
@@ -530,7 +530,7 @@ static int rt711_dev_resume(struct device *dev) {struct sdw_slave *slave =dev_to_sdw_dev (dev);struct rt711_priv *rt711 =dev_get_drvdata (dev); -unsigned long time; +int ret;if (!rt711->first_hw_init)return 0 ;
@@ -542,18 +542,12 @@ static int rt711_dev_resume(struct device *dev) rt711->disable_irq = false; }mutex_unlock (&rt711->disable_irq_lock); - goto regmap_sync; } - time =wait_for_completion_timeout (&slave->initialization_complete, -msecs_to_jiffies (RT711_PROBE_TIMEOUT )); -if (!time) { -dev_err (&slave->dev,"%s: Initialization not complete, timed out\n" , __func__); -return -ETIMEDOUT ; - } + ret =sdw_slave_wait_for_init (slave,RT711_PROBE_TIMEOUT ); +if (ret) +return ret; -regmap_sync: - slave->unattach_request =0 ;regcache_cache_only (rt711->regmap, false);regcache_sync_region (rt711->regmap,0x3000 ,0x8fff );regcache_sync_region (rt711->regmap,0x752009 ,0x752091 );
Signature · 1 line
2.47.3
PATCH 7/17 ASoC: rt712: Use new SoundWire enumeration helper
In reply to Charles KeepaxUpdate the driver to use the new core helper that waits for the device to enumerate on SoundWire and be initialised by the SoundWire core.
--- sound/soc/codecs/rt712-sdca-dmic.c | 19 ++++--------------- sound/soc/codecs/rt712-sdca-sdw.c | 16 ++++------------ 2 files changed, 8 insertions(+), 27 deletions(-)
sound/soc/codecs/rt712-sdca-dmic.c +4 -15
@@ -905,26 +905,15 @@ static int rt712_sdca_dmic_dev_resume(struct device *dev) {struct sdw_slave *slave =dev_to_sdw_dev (dev);struct rt712_sdca_dmic_priv *rt712 =dev_get_drvdata (dev); -unsigned long time; +int ret;if (!rt712->first_hw_init)return 0 ; -if (!slave->unattach_request) - goto regmap_sync; - - time =wait_for_completion_timeout (&slave->initialization_complete, -msecs_to_jiffies (RT712_PROBE_TIMEOUT )); -if (!time) { -dev_err (&slave->dev,"%s: Initialization not complete, timed out\n" , - __func__); -sdw_show_ping_status (slave->bus, true); - -return -ETIMEDOUT ; - } + ret =sdw_slave_wait_for_init (slave,RT712_PROBE_TIMEOUT ); +if (ret) +return ret; -regmap_sync: - slave->unattach_request =0 ;regcache_cache_only (rt712->regmap, false);regcache_sync (rt712->regmap);regcache_cache_only (rt712->mbq_regmap, false);
sound/soc/codecs/rt712-sdca-sdw.c +4 -12
@@ -450,7 +450,7 @@ static int rt712_sdca_dev_resume(struct device *dev) {struct sdw_slave *slave =dev_to_sdw_dev (dev);struct rt712_sdca_priv *rt712 =dev_get_drvdata (dev); -unsigned long time; +int ret;if (!rt712->first_hw_init)return 0 ;
@@ -464,20 +464,12 @@ static int rt712_sdca_dev_resume(struct device *dev) rt712->disable_irq = false; }mutex_unlock (&rt712->disable_irq_lock); - goto regmap_sync; } - time =wait_for_completion_timeout (&slave->initialization_complete, -msecs_to_jiffies (RT712_PROBE_TIMEOUT )); -if (!time) { -dev_err (&slave->dev,"%s: Initialization not complete, timed out\n" , __func__); -sdw_show_ping_status (slave->bus, true); + ret =sdw_slave_wait_for_init (slave,RT712_PROBE_TIMEOUT ); +if (ret) +return ret; -return -ETIMEDOUT ; - } - -regmap_sync: - slave->unattach_request =0 ;regcache_cache_only (rt712->regmap, false);regcache_sync (rt712->regmap);regcache_cache_only (rt712->mbq_regmap, false);
Signature · 1 line
2.47.3
PATCH 8/17 ASoC: rt715: Use new SoundWire enumeration helper
In reply to Charles KeepaxUpdate the driver to use the new core helper that waits for the device to enumerate on SoundWire and be initialised by the SoundWire core.
--- sound/soc/codecs/rt715-sdca-sdw.c | 18 ++++-------------- sound/soc/codecs/rt715-sdw.c | 18 ++++-------------- 2 files changed, 8 insertions(+), 28 deletions(-)
sound/soc/codecs/rt715-sdca-sdw.c +4 -14
@@ -224,25 +224,15 @@ static int rt715_dev_resume(struct device *dev) {struct sdw_slave *slave =dev_to_sdw_dev (dev);struct rt715_sdca_priv *rt715 =dev_get_drvdata (dev); -unsigned long time; +int ret;if (!rt715->first_hw_init)return 0 ; -if (!slave->unattach_request) - goto regmap_sync; + ret =sdw_slave_wait_for_init (slave,RT715_PROBE_TIMEOUT ); +if (ret) +return ret; - time =wait_for_completion_timeout (&slave->initialization_complete, -msecs_to_jiffies (RT715_PROBE_TIMEOUT )); -if (!time) { -dev_err (&slave->dev,"%s: Initialization not complete, timed out\n" , __func__); -sdw_show_ping_status (slave->bus, true); - -return -ETIMEDOUT ; - } - -regmap_sync: - slave->unattach_request =0 ;regcache_cache_only (rt715->regmap, false); regcache_sync_region(rt715->regmap, SDW_SDCA_CTL(FUN_JACK_CODEC, RT715_SDCA_ST_EN, RT715_SDCA_ST_CTRL,
sound/soc/codecs/rt715-sdw.c +4 -14
@@ -501,25 +501,15 @@ static int rt715_dev_resume(struct device *dev) {struct sdw_slave *slave =dev_to_sdw_dev (dev);struct rt715_priv *rt715 =dev_get_drvdata (dev); -unsigned long time; +int ret;if (!rt715->first_hw_init)return 0 ; -if (!slave->unattach_request) - goto regmap_sync; - - time =wait_for_completion_timeout (&slave->initialization_complete, -msecs_to_jiffies (RT715_PROBE_TIMEOUT )); -if (!time) { -dev_err (&slave->dev,"%s: Initialization not complete, timed out\n" , __func__); -sdw_show_ping_status (slave->bus, true); - -return -ETIMEDOUT ; - } + ret =sdw_slave_wait_for_init (slave,RT715_PROBE_TIMEOUT ); +if (ret) +return ret; -regmap_sync: - slave->unattach_request =0 ;regcache_cache_only (rt715->regmap, false);regcache_sync_region (rt715->regmap,0x3000 ,0x8fff );regcache_sync_region (rt715->regmap,0x752039 ,0x752039 );
Signature · 1 line
2.47.3
PATCH 9/17 ASoc: rt721: Use new SoundWire enumeration helper
In reply to Charles KeepaxUpdate the driver to use the new core helper that waits for the device to enumerate on SoundWire and be initialised by the SoundWire core.
--- sound/soc/codecs/rt721-sdca-sdw.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
sound/soc/codecs/rt721-sdca-sdw.c +4 -12
@@ -489,7 +489,7 @@ static int rt721_sdca_dev_resume(struct device *dev) {struct sdw_slave *slave =dev_to_sdw_dev (dev);struct rt721_sdca_priv *rt721 =dev_get_drvdata (dev); -unsigned long time; +int ret;if (!rt721->first_hw_init)return 0 ;
@@ -502,20 +502,12 @@ static int rt721_sdca_dev_resume(struct device *dev) rt721->disable_irq = false; }mutex_unlock (&rt721->disable_irq_lock); - goto regmap_sync; } - time =wait_for_completion_timeout (&slave->initialization_complete, -msecs_to_jiffies (RT721_PROBE_TIMEOUT )); -if (!time) { -dev_err (&slave->dev,"Initialization not complete, timed out\n" ); -sdw_show_ping_status (slave->bus, true); + ret =sdw_slave_wait_for_init (slave,RT721_PROBE_TIMEOUT ); +if (ret) +return ret; -return -ETIMEDOUT ; - } - -regmap_sync: - slave->unattach_request =0 ;regcache_cache_only (rt721->regmap, false);regcache_sync (rt721->regmap);regcache_cache_only (rt721->mbq_regmap, false);
Signature · 1 line
2.47.3
PATCH 10/17 ASoC: rt722: Use new SoundWire enumeration helper
In reply to Charles KeepaxUpdate the driver to use the new core helper that waits for the device to enumerate on SoundWire and be initialised by the SoundWire core.
--- sound/soc/codecs/rt722-sdca-sdw.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
sound/soc/codecs/rt722-sdca-sdw.c +4 -12
@@ -501,7 +501,7 @@ static int rt722_sdca_dev_resume(struct device *dev) {struct sdw_slave *slave =dev_to_sdw_dev (dev);struct rt722_sdca_priv *rt722 =dev_get_drvdata (dev); -unsigned long time; +int ret;if (!rt722->first_hw_init)return 0 ;
@@ -514,20 +514,12 @@ static int rt722_sdca_dev_resume(struct device *dev) rt722->disable_irq = false; }mutex_unlock (&rt722->disable_irq_lock); - goto regmap_sync; } - time =wait_for_completion_timeout (&slave->initialization_complete, -msecs_to_jiffies (RT722_PROBE_TIMEOUT )); -if (!time) { -dev_err (&slave->dev,"Initialization not complete, timed out\n" ); -sdw_show_ping_status (slave->bus, true); + ret =sdw_slave_wait_for_init (slave,RT722_PROBE_TIMEOUT ); +if (ret) +return ret; -return -ETIMEDOUT ; - } - -regmap_sync: - slave->unattach_request =0 ;regcache_cache_only (rt722->regmap, false);regcache_sync (rt722->regmap);return 0 ;
Signature · 1 line
2.47.3
PATCH 11/17 ASoC: rt1017: Use new SoundWire enumeration helper
In reply to Charles KeepaxUpdate the driver to use the new core helper that waits for the device to enumerate on SoundWire and be initialised by the SoundWire core.
--- sound/soc/codecs/rt1017-sdca-sdw.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)
sound/soc/codecs/rt1017-sdca-sdw.c +4 -14
@@ -773,25 +773,15 @@ static int rt1017_sdca_dev_resume(struct device *dev) {struct sdw_slave *slave =dev_to_sdw_dev (dev);struct rt1017_sdca_priv *rt1017 =dev_get_drvdata (dev); -unsigned long time; +int ret;if (!rt1017->first_hw_init)return 0 ; -if (!slave->unattach_request) - goto regmap_sync; - - time =wait_for_completion_timeout (&slave->initialization_complete, -msecs_to_jiffies (RT1017_PROBE_TIMEOUT )); -if (!time) { -dev_err (&slave->dev,"Initialization not complete, timed out\n" ); -sdw_show_ping_status (slave->bus, true); - -return -ETIMEDOUT ; - } + ret =sdw_slave_wait_for_init (slave,RT1017_PROBE_TIMEOUT ); +if (ret) +return ret; -regmap_sync: - slave->unattach_request =0 ;regcache_cache_only (rt1017->regmap, false);regcache_sync (rt1017->regmap);
Signature · 1 line
2.47.3
PATCH 12/17 ASoC: rt1308: Use new SoundWire enumeration helper
In reply to Charles KeepaxUpdate the driver to use the new core helper that waits for the device to enumerate on SoundWire and be initialised by the SoundWire core.
--- sound/soc/codecs/rt1308-sdw.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)
sound/soc/codecs/rt1308-sdw.c +4 -14
@@ -768,25 +768,15 @@ static int rt1308_dev_resume(struct device *dev) {struct sdw_slave *slave =dev_to_sdw_dev (dev);struct rt1308_sdw_priv *rt1308 =dev_get_drvdata (dev); -unsigned long time; +int ret;if (!rt1308->first_hw_init)return 0 ; -if (!slave->unattach_request) - goto regmap_sync; - - time =wait_for_completion_timeout (&slave->initialization_complete, -msecs_to_jiffies (RT1308_PROBE_TIMEOUT )); -if (!time) { -dev_err (&slave->dev,"Initialization not complete, timed out\n" ); -sdw_show_ping_status (slave->bus, true); - -return -ETIMEDOUT ; - } + ret =sdw_slave_wait_for_init (slave,RT1308_PROBE_TIMEOUT ); +if (ret) +return ret; -regmap_sync: - slave->unattach_request =0 ;regcache_cache_only (rt1308->regmap, false);regcache_sync_region (rt1308->regmap,0xc000 ,0xcfff );
Signature · 1 line
2.47.3
PATCH 13/17 ASoC: rt1316: Use new SoundWire enumeration helper
In reply to Charles KeepaxUpdate the driver to use the new core helper that waits for the device to enumerate on SoundWire and be initialised by the SoundWire core.
--- sound/soc/codecs/rt1316-sdw.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)
sound/soc/codecs/rt1316-sdw.c +4 -14
@@ -745,25 +745,15 @@ static int rt1316_dev_resume(struct device *dev) {struct sdw_slave *slave =dev_to_sdw_dev (dev);struct rt1316_sdw_priv *rt1316 =dev_get_drvdata (dev); -unsigned long time; +int ret;if (!rt1316->first_hw_init)return 0 ; -if (!slave->unattach_request) - goto regmap_sync; - - time =wait_for_completion_timeout (&slave->initialization_complete, -msecs_to_jiffies (RT1316_PROBE_TIMEOUT )); -if (!time) { -dev_err (&slave->dev,"%s: Initialization not complete, timed out\n" , __func__); -sdw_show_ping_status (slave->bus, true); - -return -ETIMEDOUT ; - } + ret =sdw_slave_wait_for_init (slave,RT1316_PROBE_TIMEOUT ); +if (ret) +return ret; -regmap_sync: - slave->unattach_request =0 ;regcache_cache_only (rt1316->regmap, false);regcache_sync (rt1316->regmap);
Signature · 1 line
2.47.3
PATCH 14/17 ASoC: rt1318: Use new SoundWire enumeration helper
In reply to Charles KeepaxUpdate the driver to use the new core helper that waits for the device to enumerate on SoundWire and be initialised by the SoundWire core.
--- sound/soc/codecs/rt1318-sdw.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
sound/soc/codecs/rt1318-sdw.c +4 -12
@@ -821,23 +821,15 @@ static int rt1318_dev_resume(struct device *dev) {struct sdw_slave *slave =dev_to_sdw_dev (dev);struct rt1318_sdw_priv *rt1318 =dev_get_drvdata (dev); -unsigned long time; +int ret;if (!rt1318->first_hw_init)return 0 ; -if (!slave->unattach_request) - goto regmap_sync; - - time =wait_for_completion_timeout (&slave->initialization_complete, -msecs_to_jiffies (RT1318_PROBE_TIMEOUT )); -if (!time) { -dev_err (&slave->dev,"%s: Initialization not complete, timed out\n" , __func__); -return -ETIMEDOUT ; - } + ret =sdw_slave_wait_for_init (slave,RT1318_PROBE_TIMEOUT ); +if (ret) +return ret; -regmap_sync: - slave->unattach_request =0 ;regcache_cache_only (rt1318->regmap, false);regcache_sync (rt1318->regmap);
Signature · 1 line
2.47.3
PATCH 15/17 ASoC: rt1320: Use new SoundWire enumeration helper
In reply to Charles KeepaxUpdate the driver to use the new core helper that waits for the device to enumerate on SoundWire and be initialised by the SoundWire core.
--- sound/soc/codecs/rt1320-sdw.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
sound/soc/codecs/rt1320-sdw.c +4 -12
@@ -3053,23 +3053,15 @@ static int rt1320_dev_resume(struct device *dev) {struct sdw_slave *slave =dev_to_sdw_dev (dev);struct rt1320_sdw_priv *rt1320 =dev_get_drvdata (dev); -unsigned long time; +int ret;if (!rt1320->first_hw_init)return 0 ; -if (!slave->unattach_request) - goto regmap_sync; - - time =wait_for_completion_timeout (&slave->initialization_complete, -msecs_to_jiffies (RT1320_PROBE_TIMEOUT )); -if (!time) { -dev_err (&slave->dev,"%s: Initialization not complete, timed out\n" , __func__); -return -ETIMEDOUT ; - } + ret =sdw_slave_wait_for_init (slave,RT1320_PROBE_TIMEOUT ); +if (ret) +return ret; -regmap_sync: - slave->unattach_request =0 ;regcache_cache_only (rt1320->regmap, false);regcache_sync (rt1320->regmap);regcache_cache_only (rt1320->mbq_regmap, false);
Signature · 1 line
2.47.3
PATCH 16/17 ASoC: rt5682: Use new SoundWire enumeration helper
In reply to Charles KeepaxUpdate the driver to use the new core helper that waits for the device to enumerate on SoundWire and be initialised by the SoundWire core.
--- sound/soc/codecs/rt5682-sdw.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
sound/soc/codecs/rt5682-sdw.c +4 -12
@@ -754,7 +754,7 @@ static int rt5682_dev_resume(struct device *dev) {struct sdw_slave *slave =dev_to_sdw_dev (dev);struct rt5682_priv *rt5682 =dev_get_drvdata (dev); -unsigned long time; +int ret;if (!rt5682->first_hw_init)return 0 ;
@@ -766,20 +766,12 @@ static int rt5682_dev_resume(struct device *dev) rt5682->disable_irq = false; }mutex_unlock (&rt5682->disable_irq_lock); - goto regmap_sync; } - time =wait_for_completion_timeout (&slave->initialization_complete, -msecs_to_jiffies (RT5682_PROBE_TIMEOUT )); -if (!time) { -dev_err (&slave->dev,"%s: Initialization not complete, timed out\n" , __func__); -sdw_show_ping_status (slave->bus, true); - -return -ETIMEDOUT ; - } + ret =sdw_slave_wait_for_init (slave,RT5682_PROBE_TIMEOUT ); +if (ret) +return ret; -regmap_sync: - slave->unattach_request =0 ;regcache_cache_only (rt5682->sdw_regmap, false);regcache_cache_only (rt5682->regmap, false);regcache_sync (rt5682->regmap);
Signature · 1 line
2.47.3
PATCH 17/17 ASoC: tas2783: Use new SoundWire enumeration helper
In reply to Charles KeepaxUpdate the driver to use the new core helper that waits for the device to enumerate on SoundWire and be initialised by the SoundWire core.
--- sound/soc/codecs/tas2783-sdw.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)
sound/soc/codecs/tas2783-sdw.c +4 -14
@@ -1082,22 +1082,12 @@ static s32 tas2783_sdca_dev_resume(struct device *dev) {struct sdw_slave *slave =dev_to_sdw_dev (dev);struct tas2783_prv *tas_dev =dev_get_drvdata (dev); -unsigned long t; - -if (!slave->unattach_request) - goto regmap_sync; - - t =wait_for_completion_timeout (&slave->initialization_complete, -msecs_to_jiffies (TAS2783_PROBE_TIMEOUT )); -if (!t) { -dev_err (&slave->dev,"resume: initialization timed out\n" ); -sdw_show_ping_status (slave->bus, true); -return -ETIMEDOUT ; - } +int ret; - slave->unattach_request =0 ; + ret =sdw_slave_wait_for_init (slave,TAS2783_PROBE_TIMEOUT ); +if (ret) +return ret; -regmap_sync:regcache_cache_only (tas_dev->regmap, false);regcache_sync (tas_dev->regmap);return 0 ;
Signature · 1 line
2.47.3