2022-09-27 11:55:04

by Martin Povišer

[permalink] [raw]
Subject: [PATCH 1/3] ASoC: apple: mca: Trigger, not deassert, the peripheral reset

Replace the deassertion of the peripheral's shared reset with the
triggering of a pulse on it. This is what we should have been using all
along as the platform's custom is not leaving the reset asserted on
unused peripherals.

Fixes: 3df5d0d97289 ("ASoC: apple: mca: Start new platform driver")
Signed-off-by: Martin Povišer <[email protected]>
---

Cc: Philipp Zabel <[email protected]>

sound/soc/apple/mca.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/apple/mca.c b/sound/soc/apple/mca.c
index 69643524796e..75925bfcf754 100644
--- a/sound/soc/apple/mca.c
+++ b/sound/soc/apple/mca.c
@@ -995,7 +995,7 @@ static void apple_mca_release(struct mca_data *mca)
if (!IS_ERR_OR_NULL(mca->pd_dev))
dev_pm_domain_detach(mca->pd_dev, true);

- reset_control_assert(mca->rstc);
+ reset_control_rearm(mca->rstc);
}

static int apple_mca_probe(struct platform_device *pdev)
@@ -1049,12 +1049,12 @@ static int apple_mca_probe(struct platform_device *pdev)
DL_FLAG_RPM_ACTIVE);
if (!mca->pd_link) {
ret = -EINVAL;
- /* Prevent an unbalanced reset assert */
+ /* Prevent an unbalanced reset rearm */
mca->rstc = NULL;
goto err_release;
}

- reset_control_deassert(mca->rstc);
+ reset_control_reset(mca->rstc);

for (i = 0; i < nclusters; i++) {
struct mca_cluster *cl = &clusters[i];
--
2.33.0


2022-09-27 11:57:22

by Martin Povišer

[permalink] [raw]
Subject: [PATCH 3/3] ASoC: apple: mca: Adjust timing of component unregister

On removal of the driver, the ASoC component should be unregistered
first, before we start releasing any of the other resources.

Fixes: 3df5d0d97289 ("ASoC: apple: mca: Start new platform driver")
Signed-off-by: Martin Povišer <[email protected]>
---
sound/soc/apple/mca.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sound/soc/apple/mca.c b/sound/soc/apple/mca.c
index 7ca653987b78..24381c42eb54 100644
--- a/sound/soc/apple/mca.c
+++ b/sound/soc/apple/mca.c
@@ -1129,8 +1129,8 @@ static int apple_mca_probe(struct platform_device *pdev)
}
}

- ret = devm_snd_soc_register_component(&pdev->dev, &mca_component,
- dai_drivers, nclusters * 2);
+ ret = snd_soc_register_component(&pdev->dev, &mca_component,
+ dai_drivers, nclusters * 2);
if (ret) {
dev_err(&pdev->dev, "unable to register ASoC component: %d\n",
ret);
@@ -1148,6 +1148,7 @@ static int apple_mca_remove(struct platform_device *pdev)
{
struct mca_data *mca = platform_get_drvdata(pdev);

+ snd_soc_unregister_component(&pdev->dev);
apple_mca_release(mca);
return 0;
}
--
2.33.0

2022-09-27 12:42:18

by Martin Povišer

[permalink] [raw]
Subject: [PATCH 2/3] ASoC: apple: mca: Remove stale release of DMA channels

The commit 4ec8179c212f ("ASoC: apple: mca: Postpone requesting of DMA
channels") shuffled around with the requesting and releasing of DMA
channels. It left behind stale release calls from within
apple_mca_release, remove those now.

Fixes: 4ec8179c212f ("ASoC: apple: mca: Postpone requesting of DMA channels")
Signed-off-by: Martin Povišer <[email protected]>
---
sound/soc/apple/mca.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/sound/soc/apple/mca.c b/sound/soc/apple/mca.c
index 75925bfcf754..7ca653987b78 100644
--- a/sound/soc/apple/mca.c
+++ b/sound/soc/apple/mca.c
@@ -970,18 +970,11 @@ static const struct snd_soc_component_driver mca_component = {

static void apple_mca_release(struct mca_data *mca)
{
- int i, stream;
+ int i;

for (i = 0; i < mca->nclusters; i++) {
struct mca_cluster *cl = &mca->clusters[i];

- for_each_pcm_streams(stream) {
- if (IS_ERR_OR_NULL(cl->dma_chans[stream]))
- continue;
-
- dma_release_channel(cl->dma_chans[stream]);
- }
-
if (!IS_ERR_OR_NULL(cl->clk_parent))
clk_put(cl->clk_parent);

--
2.33.0