On Tue, Dec 31, 2024 at 01:43:11AM +0100, Martin Blumenstingl wrote: > Hello Dmitry, > > this is great work - thanks for your efforts! > > To give some context: > I am working on a HDMI controller driver for the Amlogic Meson8/8b/8m2 > SoCs. Unfortunately the driver is not mature enough for upstream > submission (all I have is the vendor driver which serves as reference). > That said, my goal is to upstream the driver at some point. I have > already switched my driver to use hdmi_{clear,write}_infoframe. Now > I'm trying this series to simplify my code even further - by using > your audio helper work! > > > --- /dev/null > > +++ b/drivers/gpu/drm/display/drm_hdmi_audio_helper.c > > @@ -0,0 +1,190 @@ > > [...] > > +static const struct hdmi_codec_ops drm_connector_hdmi_audio_ops = { > > + .audio_startup = drm_connector_hdmi_audio_startup, > > + .prepare = drm_connector_hdmi_audio_prepare, > > + .audio_shutdown = drm_connector_hdmi_audio_shutdown, > > + .mute_stream = drm_connector_hdmi_audio_mute_stream, > > + .get_eld = drm_connector_hdmi_audio_get_eld, > > + .get_dai_id = drm_connector_hdmi_audio_get_dai_id, > > + .hook_plugged_cb = drm_connector_hdmi_audio_hook_plugged_cb, > > +}; > On my platform drm_connector_hdmi_audio_prepare() is never called. As > a result of that the audio infoframe is never written to my HDMI > controller hardware (hdmi_write_infoframe() is never called with type > HDMI_INFOFRAME_TYPE_AUDIO). My hack to make it work is to add the > following line to drm_connector_hdmi_audio_ops: > .hw_params = drm_connector_hdmi_audio_prepare, > > I checked all instances of struct hdmi_codec_ops in v6.13-rc3 and it > seems that there is only a single driver which uses the .prepare > callback (drivers/gpu/drm/vc4/vc4_hdmi.c). All other drivers seem to > implement .hw_params instead. Yes. However .hw_params don't have access to the infoframe contents, so I had to settle on implementing .prepare. > > The audio controller code for my platform is already upstream: > - sound/soc/meson/aiu-codec-ctrl.c > - sound/soc/meson/aiu-encoder-i2s.c > - sound/soc/meson/aiu-fifo-i2s.c > > My understanding is that you have a platform with a lontium-lt9611 > HDMI controller available for testing. Can you please help me > investigate and find out which piece of code is calling > hdmi_codec_prepare() and therefore lt9611_hdmi_audio_prepare() on > your board? Sure, this is the call trace on my platform (Qualcomm SDM845, sdm845-db845c.dts): lt9611_hdmi_audio_prepare+0x1c/0xc0 (P) drm_bridge_connector_audio_prepare+0x2c/0x40 (L) drm_bridge_connector_audio_prepare+0x2c/0x40 drm_connector_hdmi_audio_prepare+0x24/0x30 hdmi_codec_prepare+0xec/0x144 snd_soc_pcm_dai_prepare+0x78/0x10c __soc_pcm_prepare+0x54/0x190 dpcm_be_dai_prepare+0x120/0x1d0 dpcm_fe_dai_prepare+0x9c/0x2a0 snd_pcm_do_prepare+0x30/0x50 snd_pcm_action_single+0x48/0xa4 snd_pcm_action_nonatomic+0xa0/0xa8 snd_pcm_prepare+0x90/0xec snd_pcm_common_ioctl+0xd94/0x1a24 snd_pcm_ioctl+0x30/0x48 __arm64_sys_ioctl+0xb4/0xec invoke_syscall+0x48/0x110 el0_svc_common.constprop.0+0x40/0xe0 do_el0_svc+0x1c/0x28 el0_svc+0x48/0x110 el0t_64_sync_handler+0x10c/0x138 el0t_64_sync+0x198/0x19c Hope, this helps. -- With best wishes Dmitry