Re: [PATCH 8/8] arm64: dts: renesas: salvator: add a connection from adv748x codec (HDMI input) to the R-Car SoC

From: Alex Riesen
Date: Mon Mar 09 2020 - 07:09:51 EST


Hi,

Kuninori Morimoto, Mon, Mar 09, 2020 02:31:01 +0100:
> > > > Those clocks are part of the CSI-2 protocol and also don't need to be
> > > > explicitly controlled. As far as I can tell from a quick check of the
> > > > ADV7482 documentation, only the I2S MCLK is a general-purpose clock that
> > > > needs to be exposed.
> (snip)
> > > Do you know, by chance, which of the snd_soc* callbacks should be used to
> > > implement setting of the MCLK? The one in snd_soc_component_driver or
> > > snd_soc_dai_driver->ops (snd_soc_dai_ops)?
> > >
> > > Or how the userspace interface looks like? Or, if there is no userspace
> > > interface for this, how the MCLK is supposed to be set? Through mclk-fs?
> >
> > I'm afraid my knowledge of the sound subsystem is limited. Morimoto-san
> > is the main developer and maintainer of Renesas sound drivers.
> > Morimoto-sensei, would you have an answer to that question ? :-)
>
> In my quick check, it goes to AUDIO_CLKC.
> If so, you can update rcar_sound::clocks.
>
> &rcar_sound {
> ...
> - /* update <audio_clk_b> to <cs2000> */
> + /* update <audio_clk_b> to <cs2000>,
> + * <audio_clk_c> to <adv748x> */
> clocks = <&cpg CPG_MOD 1005>,
> ...
> <&audio_clk_a>, <&cs2000>,
> - <&audio_clk_c>,
> + <&adv748x>,
> <&cpg CPG_CORE CPG_AUDIO_CLK_I>;
>
> Thank you for your help !!

Thanks.

Should the adv748x driver also implement anything to configure the frequency
of MCLK clock? I mean something like .set_sysclk and .set_fmt callbacks of
snd_soc_dai_ops?

Or is the driver implementation, which depends on mclk-fs to be 256, the audio
stream format to be 8x S24_LE, and requires strictly 48kHz sampling rate on
the HDMI input, a totally acceptable first attempt at writing a DAI driver?

I'm a bit bothered by that, as the hardware is also capable of decoding
stereo, sampling rate 32-192kHz, a variety of PCM and compressed/encrypted
formats, 128-768fs MCLK multipliers, and a row of I2S options.

I just find it confusing to place the configuration interfaces.
For instance, the patches use the media ioctl for audio output selection to
select I2S protocol. While works, it does not feel right (shouldn't it be in
the device tree?)

Maybe you can point me at a driver doing something similar? I'm studying media
drivers now, but not many of them use ASoC interfaces for devices providing a
clock. Or maybe I should better look at sound/soc/...?

Thanks in advance,
Alex