From: <robert.rosengren@axis.com>
To: Shengjiu Wang <shengjiu.wang@gmail.com>,
Xiubo Li <Xiubo.Lee@gmail.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>
Cc: Nicolin Chen <nicoleotsuka@gmail.com>,
kernel@axis.com, alsa-devel@alsa-project.org,
Fabio Estevam <festevam@gmail.com>
Subject: [PATCH] ASoC: fsl_spdif: add ALSA event on dpll locked
Date: Thu, 8 Sep 2022 15:33:19 +0200 [thread overview]
Message-ID: <20220908133319.2149486-1-robert.rosengren@axis.com> (raw)
From: Robert Rosengren <robert.rosengren@axis.com>
Add an ALSA event on the RX Sample Rate controller upon the dpll locked
interrupt, making it possible for audio applications to monitor changes
in the hardware.
Signed-off-by: Robert Rosengren <robert.rosengren@axis.com>
---
sound/soc/fsl/fsl_spdif.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c
index 7fc1c96929bb..1679a21ffdca 100644
--- a/sound/soc/fsl/fsl_spdif.c
+++ b/sound/soc/fsl/fsl_spdif.c
@@ -44,6 +44,8 @@ static u8 srpc_dpll_locked[] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0xa, 0xb };
#define DEFAULT_RXCLK_SRC 1
+#define RX_SAMPLE_RATE_KCONTROL "RX Sample Rate"
+
/**
* struct fsl_spdif_soc_data: soc specific data
*
@@ -122,6 +124,7 @@ struct fsl_spdif_priv {
const struct fsl_spdif_soc_data *soc;
struct spdif_mixer_control fsl_spdif_control;
struct snd_soc_dai_driver cpu_dai_drv;
+ struct snd_soc_dai *dai;
struct platform_device *pdev;
struct regmap *regmap;
bool dpll_locked;
@@ -223,9 +226,19 @@ static void spdif_irq_dpll_lock(struct fsl_spdif_priv *spdif_priv)
locked &= SRPC_DPLL_LOCKED;
dev_dbg(&pdev->dev, "isr: Rx dpll %s \n",
- locked ? "locked" : "loss lock");
+ locked ? "locked" : "loss lock");
spdif_priv->dpll_locked = locked ? true : false;
+
+ if (spdif_priv->dai) {
+ struct snd_soc_component *component = spdif_priv->dai->component;
+ struct snd_kcontrol *kctl = snd_soc_card_get_kcontrol(component->card,
+ RX_SAMPLE_RATE_KCONTROL);
+
+ if (kctl)
+ snd_ctl_notify(component->card->snd_card,
+ SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id);
+ }
}
/* Receiver found illegal symbol interrupt handler */
@@ -1197,7 +1210,7 @@ static struct snd_kcontrol_new fsl_spdif_ctrls[] = {
/* DPLL lock info get controller */
{
.iface = SNDRV_CTL_ELEM_IFACE_PCM,
- .name = "RX Sample Rate",
+ .name = RX_SAMPLE_RATE_KCONTROL,
.access = SNDRV_CTL_ELEM_ACCESS_READ |
SNDRV_CTL_ELEM_ACCESS_VOLATILE,
.info = fsl_spdif_rxrate_info,
@@ -1241,6 +1254,7 @@ static struct snd_kcontrol_new fsl_spdif_ctrls_rcm[] = {
static int fsl_spdif_dai_probe(struct snd_soc_dai *dai)
{
struct fsl_spdif_priv *spdif_private = snd_soc_dai_get_drvdata(dai);
+ spdif_private->dai = dai;
snd_soc_dai_init_dma_data(dai, &spdif_private->dma_params_tx,
&spdif_private->dma_params_rx);
--
2.30.2
next reply other threads:[~2022-09-08 13:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-08 13:33 robert.rosengren [this message]
2022-09-09 8:17 ` [PATCH] ASoC: fsl_spdif: add ALSA event on dpll locked Shengjiu Wang
2022-09-09 8:26 ` Shengjiu Wang
2022-09-16 6:09 ` Robert Rosengren
2022-09-09 8:27 ` Jaroslav Kysela
2022-09-16 6:12 ` Robert Rosengren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220908133319.2149486-1-robert.rosengren@axis.com \
--to=robert.rosengren@axis.com \
--cc=Xiubo.Lee@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=festevam@gmail.com \
--cc=kernel@axis.com \
--cc=lgirdwood@gmail.com \
--cc=nicoleotsuka@gmail.com \
--cc=perex@perex.cz \
--cc=shengjiu.wang@gmail.com \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox