On 08. 09. 22 15:33, robert.rosengren@xxxxxxxx wrote:
From: Robert Rosengren <robert.rosengren@xxxxxxxx>
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@xxxxxxxx>
---
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);
I would cache the pointer to snd_kcontrol structure in spdif_priv. This lookup
is expensive for the interrupt routine in my eyes.
Jaroslav
--
Jaroslav Kysela <perex@xxxxxxxx>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.