Spacemit: fix HDMI audio (and rCPU communication)
Signed-off-by: Sven-Ola Tuecke <sven-ola@gmx.de>
This commit is contained in:
parent
0b796f314d
commit
eeeae16755
@ -0,0 +1,27 @@
|
||||
From 2b3c42481125604611f53a19c8607f1cbf80fc88 Mon Sep 17 00:00:00 2001
|
||||
From: Sven-Ola Tuecke <sven-ola@gmx.de>
|
||||
Date: Thu, 22 Jan 2026 13:07:06 +0100
|
||||
Subject: [PATCH] Spacemit HDMI audio does not work without dummy codec
|
||||
|
||||
See device tree, sound_hdmi/sound-dai = <&dummy_codec>;
|
||||
|
||||
Signed-off-by: Sven-Ola Tuecke <sven-ola@gmx.de>
|
||||
---
|
||||
sound/soc/spacemit/Kconfig | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/sound/soc/spacemit/Kconfig b/sound/soc/spacemit/Kconfig
|
||||
index 15e91c693..b7df8ed77 100644
|
||||
--- a/sound/soc/spacemit/Kconfig
|
||||
+++ b/sound/soc/spacemit/Kconfig
|
||||
@@ -26,6 +26,7 @@ config SPACEMIT_I2S
|
||||
config SPACEMIT_HDMIAUDIO
|
||||
tristate "Audio Cpudai HDMI Audio"
|
||||
depends on SND_SOC_SPACEMIT
|
||||
+ select SPACEMIT_DUMMYCODEC
|
||||
help
|
||||
Say Y or M here if you want to enable audio data dump function
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@ -0,0 +1,145 @@
|
||||
From f20f7c80fc10e873bb258abf8e5a2bb4d52b4088 Mon Sep 17 00:00:00 2001
|
||||
From: Sven-Ola Tuecke <sven-ola@gmx.de>
|
||||
Date: Fri, 23 Jan 2026 15:15:33 +0100
|
||||
Subject: [PATCH] Spacemit: copy kernel thread handling from Xunlong/Ky
|
||||
|
||||
Background: have a non-working rpmsg connection to
|
||||
the realtime CPU kernels that handle e.g. the ADMA
|
||||
required for HDMI audio.
|
||||
|
||||
Signed-off-by: Sven-Ola Tuecke <sven-ola@gmx.de>
|
||||
---
|
||||
drivers/remoteproc/k1x-rproc.c | 58 ++++++++++++++++++++++++++++++----
|
||||
1 file changed, 51 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/drivers/remoteproc/k1x-rproc.c b/drivers/remoteproc/k1x-rproc.c
|
||||
index ddad600246..fbd7ca8f76 100644
|
||||
--- a/drivers/remoteproc/k1x-rproc.c
|
||||
+++ b/drivers/remoteproc/k1x-rproc.c
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <linux/reset.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/clkdev.h>
|
||||
+#include <linux/kthread.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/mailbox_client.h>
|
||||
#include <linux/completion.h>
|
||||
@@ -67,6 +68,8 @@ struct spacemit_mbox {
|
||||
const char name[10];
|
||||
struct mbox_chan *chan;
|
||||
struct mbox_client client;
|
||||
+ struct task_struct *mb_thread;
|
||||
+ bool kthread_running;
|
||||
struct completion mb_comp;
|
||||
int vq_id;
|
||||
};
|
||||
@@ -302,6 +305,29 @@ static struct rproc_ops spacemit_rproc_ops = {
|
||||
.get_boot_addr = spacemit_get_boot_addr,
|
||||
};
|
||||
|
||||
+static int __process_theread(void *arg)
|
||||
+{
|
||||
+ int ret;
|
||||
+ struct mbox_client *cl = arg;
|
||||
+ struct rproc *rproc = dev_get_drvdata(cl->dev);
|
||||
+ struct spacemit_mbox *mb = container_of(cl, struct spacemit_mbox, client);
|
||||
+ struct sched_param param = {.sched_priority = 0 };
|
||||
+
|
||||
+ mb->kthread_running = true;
|
||||
+ ret = sched_setscheduler(current, SCHED_FIFO, ¶m);
|
||||
+ set_freezable();
|
||||
+
|
||||
+ do {
|
||||
+ try_to_freeze();
|
||||
+ wait_for_completion_timeout(&mb->mb_comp, 10);
|
||||
+ if (rproc_vq_interrupt(rproc, mb->vq_id) == IRQ_NONE)
|
||||
+ dev_dbg(&rproc->dev, "no message found in vq%d\n", mb->vq_id);
|
||||
+ } while (!kthread_should_stop());
|
||||
+
|
||||
+ mb->kthread_running = false;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
static void k1x_rproc_mb_callback(struct mbox_client *cl, void *data)
|
||||
{
|
||||
struct spacemit_mbox *mb = container_of(cl, struct spacemit_mbox, client);
|
||||
@@ -316,9 +342,6 @@ static struct spacemit_mbox k1x_rpoc_mbox[] = {
|
||||
.client = {
|
||||
.rx_callback = k1x_rproc_mb_callback,
|
||||
.tx_block = true,
|
||||
- .tx_done = NULL,
|
||||
- .tx_tout = 500,
|
||||
- .knows_txdone = false,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -327,10 +350,7 @@ static struct spacemit_mbox k1x_rpoc_mbox[] = {
|
||||
.client = {
|
||||
.rx_callback = k1x_rproc_mb_callback,
|
||||
.tx_block = true,
|
||||
- .tx_done = NULL,
|
||||
- .tx_tout = 500,
|
||||
- .knows_txdone = false,
|
||||
- },
|
||||
+ },
|
||||
},
|
||||
};
|
||||
|
||||
@@ -687,6 +707,14 @@ static int spacemit_rproc_probe(struct platform_device *pdev)
|
||||
ret = -EINVAL;
|
||||
goto err_1;
|
||||
}
|
||||
+
|
||||
+ if (priv->mb[i].vq_id >= 0) {
|
||||
+ priv->mb[i].mb_thread = kthread_run(__process_theread, (void *)cl, name);
|
||||
+ if (IS_ERR(priv->mb[i].mb_thread)) {
|
||||
+ ret = PTR_ERR(priv->mb[i].mb_thread);
|
||||
+ goto err_1;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
@@ -769,6 +797,8 @@ static int spacemit_rproc_probe(struct platform_device *pdev)
|
||||
while (--i >= 0) {
|
||||
if (priv->mb[i].chan)
|
||||
mbox_free_channel(priv->mb[i].chan);
|
||||
+ if (priv->mb[i].mb_thread)
|
||||
+ kthread_stop(priv->mb[i].mb_thread);
|
||||
}
|
||||
err_0:
|
||||
rproc_free(rproc);
|
||||
@@ -790,9 +820,14 @@ static void k1x_rproc_free_mbox(struct rproc *rproc)
|
||||
|
||||
static int spacemit_rproc_remove(struct platform_device *pdev)
|
||||
{
|
||||
+ int i = 0;
|
||||
struct rproc *rproc = platform_get_drvdata(pdev);
|
||||
struct spacemit_rproc *ddata = rproc->priv;
|
||||
|
||||
+ for (i = 0; i < MAX_MBOX; ++i)
|
||||
+ if (ddata->mb[i].kthread_running)
|
||||
+ kthread_stop(ddata->mb[i].mb_thread);
|
||||
+
|
||||
rproc_del(rproc);
|
||||
k1x_rproc_free_mbox(rproc);
|
||||
rproc_free(rproc);
|
||||
@@ -825,6 +860,15 @@ static void spacemit_rproc_shutdown(struct platform_device *pdev)
|
||||
|
||||
rproc = dev_get_drvdata(&pdev->dev);
|
||||
priv = rproc->priv;
|
||||
+
|
||||
+ for (i = 0; i < MAX_MBOX; ++i) {
|
||||
+ /* release the resource of rt thread */
|
||||
+ if (priv->mb[i].kthread_running) {
|
||||
+ if (!frozen((priv->mb[i].mb_thread)))
|
||||
+ kthread_stop(priv->mb[i].mb_thread);
|
||||
+ }
|
||||
+ /* mbox_free_channel(priv->mb[i].chan); */
|
||||
+ }
|
||||
}
|
||||
|
||||
static struct platform_driver spacemit_rproc_driver = {
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
From 1717b2bd76b377ee99bef83666263a113bda74cc Mon Sep 17 00:00:00 2001
|
||||
From: Sven-Ola Tuecke <sven-ola@gmx.de>
|
||||
Date: Thu, 22 Jan 2026 13:07:06 +0100
|
||||
Subject: [PATCH] Spacemit HDMI audio does not work without dummy codec
|
||||
|
||||
See device tree, sound_hdmi/sound-dai = <&dummy_codec>;
|
||||
|
||||
Signed-off-by: Sven-Ola Tuecke <sven-ola@gmx.de>
|
||||
---
|
||||
sound/soc/spacemit/Kconfig | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/sound/soc/spacemit/Kconfig b/sound/soc/spacemit/Kconfig
|
||||
index 2662bd260c..7225278d03 100644
|
||||
--- a/sound/soc/spacemit/Kconfig
|
||||
+++ b/sound/soc/spacemit/Kconfig
|
||||
@@ -26,6 +26,7 @@ config SPACEMIT_I2S
|
||||
config SPACEMIT_HDMIAUDIO
|
||||
tristate "Audio Cpudai HDMI Audio"
|
||||
depends on SND_SOC_SPACEMIT && SPACEMIT_HDMI
|
||||
+ select SPACEMIT_DUMMYCODEC
|
||||
help
|
||||
Say Y or M here if you want to enable audio data dump function
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user