All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ASoC: rt5682: Disable irq on shutdown
@ 2021-05-08  7:51 ` Stephen Boyd
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen Boyd @ 2021-05-08  7:51 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-kernel, alsa-devel, Jairaj Arava, Sathyanarayana Nujella,
	Pierre-Louis Bossart, Shuming Fan, Ranjani Sridharan

We cancel the work queues, and reset the device on shutdown, but the irq
isn't disabled so the work queues could be queued again. Let's disable
the irq during shutdown so that we don't have to worry about this device
trying to do anything anymore. This fixes a problem seen where the i2c
bus is shutdown at reboot but this device irq still comes in and tries
to make another i2c transaction when the bus doesn't work.

Cc: Jairaj Arava <jairaj.arava@intel.com>
Cc: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@intel.com>
Cc: Shuming Fan <shumingf@realtek.com>
Cc: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Fixes: 45a2702ce109 ("ASoC: rt5682: Fix panic in rt5682_jack_detect_handler happening during system shutdown")
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 sound/soc/codecs/rt5682-i2c.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/codecs/rt5682-i2c.c b/sound/soc/codecs/rt5682-i2c.c
index 93c1603b42f1..8265b537ff4f 100644
--- a/sound/soc/codecs/rt5682-i2c.c
+++ b/sound/soc/codecs/rt5682-i2c.c
@@ -273,6 +273,7 @@ static void rt5682_i2c_shutdown(struct i2c_client *client)
 {
 	struct rt5682_priv *rt5682 = i2c_get_clientdata(client);
 
+	disable_irq(client->irq);
 	cancel_delayed_work_sync(&rt5682->jack_detect_work);
 	cancel_delayed_work_sync(&rt5682->jd_check_work);
 

base-commit: 9f4ad9e425a1d3b6a34617b8ea226d56a119a717
-- 
https://chromeos.dev


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] ASoC: rt5682: Disable irq on shutdown
@ 2021-05-08  7:51 ` Stephen Boyd
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen Boyd @ 2021-05-08  7:51 UTC (permalink / raw)
  To: Mark Brown
  Cc: alsa-devel, Jairaj Arava, linux-kernel, Ranjani Sridharan,
	Sathyanarayana Nujella, Shuming Fan, Pierre-Louis Bossart

We cancel the work queues, and reset the device on shutdown, but the irq
isn't disabled so the work queues could be queued again. Let's disable
the irq during shutdown so that we don't have to worry about this device
trying to do anything anymore. This fixes a problem seen where the i2c
bus is shutdown at reboot but this device irq still comes in and tries
to make another i2c transaction when the bus doesn't work.

Cc: Jairaj Arava <jairaj.arava@intel.com>
Cc: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@intel.com>
Cc: Shuming Fan <shumingf@realtek.com>
Cc: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Fixes: 45a2702ce109 ("ASoC: rt5682: Fix panic in rt5682_jack_detect_handler happening during system shutdown")
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 sound/soc/codecs/rt5682-i2c.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/codecs/rt5682-i2c.c b/sound/soc/codecs/rt5682-i2c.c
index 93c1603b42f1..8265b537ff4f 100644
--- a/sound/soc/codecs/rt5682-i2c.c
+++ b/sound/soc/codecs/rt5682-i2c.c
@@ -273,6 +273,7 @@ static void rt5682_i2c_shutdown(struct i2c_client *client)
 {
 	struct rt5682_priv *rt5682 = i2c_get_clientdata(client);
 
+	disable_irq(client->irq);
 	cancel_delayed_work_sync(&rt5682->jack_detect_work);
 	cancel_delayed_work_sync(&rt5682->jd_check_work);
 

base-commit: 9f4ad9e425a1d3b6a34617b8ea226d56a119a717
-- 
https://chromeos.dev


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [RFC/PATCH 2/2] ASoC: rt5682: Implement remove callback
  2021-05-08  7:51 ` Stephen Boyd
@ 2021-05-08  7:51   ` Stephen Boyd
  -1 siblings, 0 replies; 6+ messages in thread
From: Stephen Boyd @ 2021-05-08  7:51 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-kernel, alsa-devel, Jairaj Arava, Sathyanarayana Nujella,
	Pierre-Louis Bossart, Shuming Fan, Ranjani Sridharan

Let's implement a remove callback for this driver that's similar to the
shutdown hook, but also disables the regulators before they're put by
devm code.

Cc: Jairaj Arava <jairaj.arava@intel.com>
Cc: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@intel.com>
Cc: Shuming Fan <shumingf@realtek.com>
Cc: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---

This is totally untested, but sending it in case anyone is interested.

 sound/soc/codecs/rt5682-i2c.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/sound/soc/codecs/rt5682-i2c.c b/sound/soc/codecs/rt5682-i2c.c
index 8265b537ff4f..52a6fc56a232 100644
--- a/sound/soc/codecs/rt5682-i2c.c
+++ b/sound/soc/codecs/rt5682-i2c.c
@@ -280,6 +280,16 @@ static void rt5682_i2c_shutdown(struct i2c_client *client)
 	rt5682_reset(rt5682);
 }
 
+static int rt5682_i2c_remove(struct i2c_client *client)
+{
+	struct rt5682_priv *rt5682 = i2c_get_clientdata(client);
+
+	rt5682_i2c_shutdown(client);
+	regulator_bulk_disable(ARRAY_SIZE(rt5682->supplies), rt5682->supplies);
+
+	return 0;
+}
+
 static const struct of_device_id rt5682_of_match[] = {
 	{.compatible = "realtek,rt5682i"},
 	{},
@@ -306,6 +316,7 @@ static struct i2c_driver rt5682_i2c_driver = {
 		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
 	},
 	.probe = rt5682_i2c_probe,
+	.remove = rt5682_i2c_remove,
 	.shutdown = rt5682_i2c_shutdown,
 	.id_table = rt5682_i2c_id,
 };
-- 
https://chromeos.dev


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [RFC/PATCH 2/2] ASoC: rt5682: Implement remove callback
@ 2021-05-08  7:51   ` Stephen Boyd
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen Boyd @ 2021-05-08  7:51 UTC (permalink / raw)
  To: Mark Brown
  Cc: alsa-devel, Jairaj Arava, linux-kernel, Ranjani Sridharan,
	Sathyanarayana Nujella, Shuming Fan, Pierre-Louis Bossart

Let's implement a remove callback for this driver that's similar to the
shutdown hook, but also disables the regulators before they're put by
devm code.

Cc: Jairaj Arava <jairaj.arava@intel.com>
Cc: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@intel.com>
Cc: Shuming Fan <shumingf@realtek.com>
Cc: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---

This is totally untested, but sending it in case anyone is interested.

 sound/soc/codecs/rt5682-i2c.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/sound/soc/codecs/rt5682-i2c.c b/sound/soc/codecs/rt5682-i2c.c
index 8265b537ff4f..52a6fc56a232 100644
--- a/sound/soc/codecs/rt5682-i2c.c
+++ b/sound/soc/codecs/rt5682-i2c.c
@@ -280,6 +280,16 @@ static void rt5682_i2c_shutdown(struct i2c_client *client)
 	rt5682_reset(rt5682);
 }
 
+static int rt5682_i2c_remove(struct i2c_client *client)
+{
+	struct rt5682_priv *rt5682 = i2c_get_clientdata(client);
+
+	rt5682_i2c_shutdown(client);
+	regulator_bulk_disable(ARRAY_SIZE(rt5682->supplies), rt5682->supplies);
+
+	return 0;
+}
+
 static const struct of_device_id rt5682_of_match[] = {
 	{.compatible = "realtek,rt5682i"},
 	{},
@@ -306,6 +316,7 @@ static struct i2c_driver rt5682_i2c_driver = {
 		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
 	},
 	.probe = rt5682_i2c_probe,
+	.remove = rt5682_i2c_remove,
 	.shutdown = rt5682_i2c_shutdown,
 	.id_table = rt5682_i2c_id,
 };
-- 
https://chromeos.dev


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] ASoC: rt5682: Disable irq on shutdown
  2021-05-08  7:51 ` Stephen Boyd
@ 2021-05-11  8:25   ` Mark Brown
  -1 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2021-05-11  8:25 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Mark Brown, linux-kernel, alsa-devel, Pierre-Louis Bossart,
	Jairaj Arava, Sathyanarayana Nujella, Shuming Fan,
	Ranjani Sridharan

On Sat, 8 May 2021 00:51:50 -0700, Stephen Boyd wrote:
> We cancel the work queues, and reset the device on shutdown, but the irq
> isn't disabled so the work queues could be queued again. Let's disable
> the irq during shutdown so that we don't have to worry about this device
> trying to do anything anymore. This fixes a problem seen where the i2c
> bus is shutdown at reboot but this device irq still comes in and tries
> to make another i2c transaction when the bus doesn't work.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/2] ASoC: rt5682: Disable irq on shutdown
      commit: 47bcb1c7108363418cd578283333d72e310dfeaa
[2/2] ASoC: rt5682: Implement remove callback
      commit: 87b42abae99d3d851aec64cd4d0f7def8113950e

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] ASoC: rt5682: Disable irq on shutdown
@ 2021-05-11  8:25   ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2021-05-11  8:25 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: alsa-devel, Jairaj Arava, linux-kernel, Ranjani Sridharan,
	Mark Brown, Sathyanarayana Nujella, Shuming Fan,
	Pierre-Louis Bossart

On Sat, 8 May 2021 00:51:50 -0700, Stephen Boyd wrote:
> We cancel the work queues, and reset the device on shutdown, but the irq
> isn't disabled so the work queues could be queued again. Let's disable
> the irq during shutdown so that we don't have to worry about this device
> trying to do anything anymore. This fixes a problem seen where the i2c
> bus is shutdown at reboot but this device irq still comes in and tries
> to make another i2c transaction when the bus doesn't work.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/2] ASoC: rt5682: Disable irq on shutdown
      commit: 47bcb1c7108363418cd578283333d72e310dfeaa
[2/2] ASoC: rt5682: Implement remove callback
      commit: 87b42abae99d3d851aec64cd4d0f7def8113950e

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-05-11  8:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-08  7:51 [PATCH 1/2] ASoC: rt5682: Disable irq on shutdown Stephen Boyd
2021-05-08  7:51 ` Stephen Boyd
2021-05-08  7:51 ` [RFC/PATCH 2/2] ASoC: rt5682: Implement remove callback Stephen Boyd
2021-05-08  7:51   ` Stephen Boyd
2021-05-11  8:25 ` [PATCH 1/2] ASoC: rt5682: Disable irq on shutdown Mark Brown
2021-05-11  8:25   ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.