* [PATCH] drm: dw-hdmi-i2s: enable audio clock in audio_startup
@ 2019-08-29 4:29 Cheng-Yi Chiang
2019-08-29 22:16 ` Doug Anderson
2019-09-01 10:03 ` Jonas Karlman
0 siblings, 2 replies; 6+ messages in thread
From: Cheng-Yi Chiang @ 2019-08-29 4:29 UTC (permalink / raw)
To: linux-kernel
Cc: alsa-devel, linux-arm-kernel, linux-rockchip, a.hajda,
Laurent.pinchart, airlied, daniel, kuninori.morimoto.gx, sam,
cychiang, dianders, dgreid, tzungbi, zhengxing, cain.cai,
eddie.cai, jeffy.chen, enric.balletbo, dri-devel
In the designware databook, the sequence of enabling audio clock and
setting format is not clearly specified.
Currently, audio clock is enabled in the end of hw_param ops after
setting format.
On some monitors, there is a possibility that audio does not come out.
Fix this by enabling audio clock in audio_startup ops
before hw_param ops setting format.
Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
---
drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
index 5cbb71a866d5..08b4adbb1ddc 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
@@ -69,6 +69,14 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data,
hdmi_write(audio, conf0, HDMI_AUD_CONF0);
hdmi_write(audio, conf1, HDMI_AUD_CONF1);
+ return 0;
+}
+
+static int dw_hdmi_i2s_audio_startup(struct device *dev, void *data)
+{
+ struct dw_hdmi_i2s_audio_data *audio = data;
+ struct dw_hdmi *hdmi = audio->hdmi;
+
dw_hdmi_audio_enable(hdmi);
return 0;
@@ -105,6 +113,7 @@ static int dw_hdmi_i2s_get_dai_id(struct snd_soc_component *component,
}
static struct hdmi_codec_ops dw_hdmi_i2s_ops = {
+ .audio_startup = dw_hdmi_i2s_audio_startup,
.hw_params = dw_hdmi_i2s_hw_params,
.audio_shutdown = dw_hdmi_i2s_audio_shutdown,
.get_dai_id = dw_hdmi_i2s_get_dai_id,
--
2.23.0.187.g17f5b7556c-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] drm: dw-hdmi-i2s: enable audio clock in audio_startup
2019-08-29 4:29 [PATCH] drm: dw-hdmi-i2s: enable audio clock in audio_startup Cheng-Yi Chiang
@ 2019-08-29 22:16 ` Doug Anderson
2019-09-01 10:03 ` Jonas Karlman
1 sibling, 0 replies; 6+ messages in thread
From: Doug Anderson @ 2019-08-29 22:16 UTC (permalink / raw)
To: Cheng-Yi Chiang
Cc: LKML, ALSA Development Mailing List, Linux ARM,
open list:ARM/Rockchip SoC...,
Andrzej Hajda, Laurent Pinchart, David Airlie, Daniel Vetter,
kuninori.morimoto.gx, Sam Ravnborg, Dylan Reid, tzungbi,
郑兴, 蔡艺伟,
Eddie Cai, 陈渐飞,
Enric Balletbo i Serra, dri-devel
Hi,
On Wed, Aug 28, 2019 at 9:30 PM Cheng-Yi Chiang <cychiang@chromium.org> wrote:
>
> In the designware databook, the sequence of enabling audio clock and
> setting format is not clearly specified.
> Currently, audio clock is enabled in the end of hw_param ops after
> setting format.
>
> On some monitors, there is a possibility that audio does not come out.
> Fix this by enabling audio clock in audio_startup ops
> before hw_param ops setting format.
>
> Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
> ---
> drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
> index 5cbb71a866d5..08b4adbb1ddc 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
> @@ -69,6 +69,14 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data,
> hdmi_write(audio, conf0, HDMI_AUD_CONF0);
> hdmi_write(audio, conf1, HDMI_AUD_CONF1);
>
> + return 0;
> +}
> +
> +static int dw_hdmi_i2s_audio_startup(struct device *dev, void *data)
> +{
> + struct dw_hdmi_i2s_audio_data *audio = data;
> + struct dw_hdmi *hdmi = audio->hdmi;
> +
> dw_hdmi_audio_enable(hdmi);
>
> return 0;
> @@ -105,6 +113,7 @@ static int dw_hdmi_i2s_get_dai_id(struct snd_soc_component *component,
> }
>
> static struct hdmi_codec_ops dw_hdmi_i2s_ops = {
> + .audio_startup = dw_hdmi_i2s_audio_startup,
> .hw_params = dw_hdmi_i2s_hw_params,
> .audio_shutdown = dw_hdmi_i2s_audio_shutdown,
> .get_dai_id = dw_hdmi_i2s_get_dai_id,
> --
I am no expert on audio stuff, but this seems sane to me. If you
happened to spin it for another reason, it might seem slightly nicer
to put the setting of ".audio_startup" adjacent to the setting of
".audio_shutdown" in the struct.
I have tested your patch on Chrome OS 4.19 and it definitely fixes the
problems I saw. Chrome OS 4.19 is a little different than upstream
and I'm not setup to test HDMI audio directly on upstream, but I did
at least confirm that my problem _wasn't_ magically fixed by any of
these patches that I found upstream (I picked them into my tree and
still saw the problem):
fc1ca6e01d0a drm/bridge: dw-hdmi-i2s: add .get_eld support
43e88f670a5e drm/bridge: dw-hdmi-i2s: enable only the required i2s lanes
46cecde310bb drm/bridge: dw-hdmi-i2s: reset audio fifo before applying
new params
0c6098859176 drm/bridge: dw-hdmi-i2s: set the channel allocation
17a1e555b608 drm/bridge: dw-hdmi-i2s: enable lpcm multi channels
da5f5bc92f49 drm/bridge: dw-hdmi: set channel count in the infoframes
2a2a3d2ff799 drm/bridge: dw-hdmi: move audio channel setup out of ahb
8067f62bccaf drm/bridge: dw-hdmi-i2s: support more i2s format
Thus:
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Tested-by: Douglas Anderson <dianders@chromium.org>
-Doug
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm: dw-hdmi-i2s: enable audio clock in audio_startup
2019-08-29 4:29 [PATCH] drm: dw-hdmi-i2s: enable audio clock in audio_startup Cheng-Yi Chiang
2019-08-29 22:16 ` Doug Anderson
@ 2019-09-01 10:03 ` Jonas Karlman
2019-09-01 10:03 ` [alsa-devel] " Jonas Karlman
2019-09-02 2:06 ` Cheng-yi Chiang
1 sibling, 2 replies; 6+ messages in thread
From: Jonas Karlman @ 2019-09-01 10:03 UTC (permalink / raw)
To: Cheng-Yi Chiang, linux-kernel
Cc: Jernej Skrabec, alsa-devel, tzungbi, zhengxing,
kuninori.morimoto.gx, linux-rockchip, airlied, jeffy.chen,
dianders, dri-devel, cain.cai, Neil Armstrong, eddie.cai,
Laurent.pinchart, enric.balletbo, dgreid@chromium.org
On 2019-08-29 06:29, Cheng-Yi Chiang wrote:
> In the designware databook, the sequence of enabling audio clock and
> setting format is not clearly specified.
> Currently, audio clock is enabled in the end of hw_param ops after
> setting format.
>
> On some monitors, there is a possibility that audio does not come out.
> Fix this by enabling audio clock in audio_startup ops
> before hw_param ops setting format.
>
> Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
> ---
> drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
> index 5cbb71a866d5..08b4adbb1ddc 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
> @@ -69,6 +69,14 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data,
> hdmi_write(audio, conf0, HDMI_AUD_CONF0);
> hdmi_write(audio, conf1, HDMI_AUD_CONF1);
>
> + return 0;
> +}
> +
> +static int dw_hdmi_i2s_audio_startup(struct device *dev, void *data)
> +{
> + struct dw_hdmi_i2s_audio_data *audio = data;
> + struct dw_hdmi *hdmi = audio->hdmi;
> +
> dw_hdmi_audio_enable(hdmi);
>
> return 0;
> @@ -105,6 +113,7 @@ static int dw_hdmi_i2s_get_dai_id(struct snd_soc_component *component,
> }
>
> static struct hdmi_codec_ops dw_hdmi_i2s_ops = {
> + .audio_startup = dw_hdmi_i2s_audio_startup,
A small white space nit, there should be a tab and not space to align the equal sign above.
Also this patch do not cleanly apply to drm-misc-next or linux-next after
fc1ca6e01d0a "drm/bridge: dw-hdmi-i2s: add .get_eld support" was merged.
This patch does fix an issue I have observed on my Rockchip devices where audio would not always
came out after switching between audio streams having different rate and channels parameters.
I used to carry [1] to fix that issue, but this seems like a more sane fix.
[1] https://github.com/Kwiboo/linux-rockchip/commit/4862e4044532b8b480fa3a0faddc197586623808
With above fixed,
Reviewed-by: Jonas Karlman <jonas@kwiboo.se>
Regards,
Jonas
> .hw_params = dw_hdmi_i2s_hw_params,
> .audio_shutdown = dw_hdmi_i2s_audio_shutdown,
> .get_dai_id = dw_hdmi_i2s_get_dai_id,
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [alsa-devel] [PATCH] drm: dw-hdmi-i2s: enable audio clock in audio_startup
2019-09-01 10:03 ` Jonas Karlman
@ 2019-09-01 10:03 ` Jonas Karlman
2019-09-02 2:06 ` Cheng-yi Chiang
1 sibling, 0 replies; 6+ messages in thread
From: Jonas Karlman @ 2019-09-01 10:03 UTC (permalink / raw)
To: Cheng-Yi Chiang, linux-kernel
Cc: Jernej Skrabec, alsa-devel, tzungbi, zhengxing,
kuninori.morimoto.gx, linux-rockchip, airlied, jeffy.chen,
dianders, dri-devel, cain.cai, Neil Armstrong, a.hajda,
eddie.cai, Laurent.pinchart, daniel, enric.balletbo, dgreid, sam,
linux-arm-kernel
On 2019-08-29 06:29, Cheng-Yi Chiang wrote:
> In the designware databook, the sequence of enabling audio clock and
> setting format is not clearly specified.
> Currently, audio clock is enabled in the end of hw_param ops after
> setting format.
>
> On some monitors, there is a possibility that audio does not come out.
> Fix this by enabling audio clock in audio_startup ops
> before hw_param ops setting format.
>
> Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
> ---
> drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
> index 5cbb71a866d5..08b4adbb1ddc 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
> @@ -69,6 +69,14 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data,
> hdmi_write(audio, conf0, HDMI_AUD_CONF0);
> hdmi_write(audio, conf1, HDMI_AUD_CONF1);
>
> + return 0;
> +}
> +
> +static int dw_hdmi_i2s_audio_startup(struct device *dev, void *data)
> +{
> + struct dw_hdmi_i2s_audio_data *audio = data;
> + struct dw_hdmi *hdmi = audio->hdmi;
> +
> dw_hdmi_audio_enable(hdmi);
>
> return 0;
> @@ -105,6 +113,7 @@ static int dw_hdmi_i2s_get_dai_id(struct snd_soc_component *component,
> }
>
> static struct hdmi_codec_ops dw_hdmi_i2s_ops = {
> + .audio_startup = dw_hdmi_i2s_audio_startup,
A small white space nit, there should be a tab and not space to align the equal sign above.
Also this patch do not cleanly apply to drm-misc-next or linux-next after
fc1ca6e01d0a "drm/bridge: dw-hdmi-i2s: add .get_eld support" was merged.
This patch does fix an issue I have observed on my Rockchip devices where audio would not always
came out after switching between audio streams having different rate and channels parameters.
I used to carry [1] to fix that issue, but this seems like a more sane fix.
[1] https://github.com/Kwiboo/linux-rockchip/commit/4862e4044532b8b480fa3a0faddc197586623808
With above fixed,
Reviewed-by: Jonas Karlman <jonas@kwiboo.se>
Regards,
Jonas
> .hw_params = dw_hdmi_i2s_hw_params,
> .audio_shutdown = dw_hdmi_i2s_audio_shutdown,
> .get_dai_id = dw_hdmi_i2s_get_dai_id,
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm: dw-hdmi-i2s: enable audio clock in audio_startup
2019-09-01 10:03 ` Jonas Karlman
2019-09-01 10:03 ` [alsa-devel] " Jonas Karlman
@ 2019-09-02 2:06 ` Cheng-yi Chiang
2019-09-02 2:06 ` [alsa-devel] " Cheng-yi Chiang
1 sibling, 1 reply; 6+ messages in thread
From: Cheng-yi Chiang @ 2019-09-02 2:06 UTC (permalink / raw)
To: Jonas Karlman
Cc: linux-kernel, alsa-devel, tzungbi, zhengxing,
kuninori.morimoto.gx, a.hajda, airlied, jeffy.chen, dianders,
dri-devel, cain.cai, linux-rockchip, eddie.cai, Laurent.pinchart
On Sun, Sep 1, 2019 at 6:04 PM Jonas Karlman <jonas@kwiboo.se> wrote:
>
> On 2019-08-29 06:29, Cheng-Yi Chiang wrote:
> > In the designware databook, the sequence of enabling audio clock and
> > setting format is not clearly specified.
> > Currently, audio clock is enabled in the end of hw_param ops after
> > setting format.
> >
> > On some monitors, there is a possibility that audio does not come out.
> > Fix this by enabling audio clock in audio_startup ops
> > before hw_param ops setting format.
> >
> > Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
> > ---
> > drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 9 +++++++++
> > 1 file changed, 9 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
> > index 5cbb71a866d5..08b4adbb1ddc 100644
> > --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
> > +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
> > @@ -69,6 +69,14 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data,
> > hdmi_write(audio, conf0, HDMI_AUD_CONF0);
> > hdmi_write(audio, conf1, HDMI_AUD_CONF1);
> >
> > + return 0;
> > +}
> > +
> > +static int dw_hdmi_i2s_audio_startup(struct device *dev, void *data)
> > +{
> > + struct dw_hdmi_i2s_audio_data *audio = data;
> > + struct dw_hdmi *hdmi = audio->hdmi;
> > +
> > dw_hdmi_audio_enable(hdmi);
> >
> > return 0;
> > @@ -105,6 +113,7 @@ static int dw_hdmi_i2s_get_dai_id(struct snd_soc_component *component,
> > }
> >
> > static struct hdmi_codec_ops dw_hdmi_i2s_ops = {
> > + .audio_startup = dw_hdmi_i2s_audio_startup,
>
> A small white space nit, there should be a tab and not space to align the equal sign above.
ACK. Will fix in v2.
>
> Also this patch do not cleanly apply to drm-misc-next or linux-next after
> fc1ca6e01d0a "drm/bridge: dw-hdmi-i2s: add .get_eld support" was merged.
ACK. Will rebase in v2.
>
>
>
>
> This patch does fix an issue I have observed on my Rockchip devices where audio would not always
> came out after switching between audio streams having different rate and channels parameters.
> I used to carry [1] to fix that issue, but this seems like a more sane fix.
>
> [1] https://github.com/Kwiboo/linux-rockchip/commit/4862e4044532b8b480fa3a0faddc197586623808
>
> With above fixed,
>
> Reviewed-by: Jonas Karlman <jonas@kwiboo.se>
Thanks a lot!
>
>
> Regards,
> Jonas
>
> > .hw_params = dw_hdmi_i2s_hw_params,
> > .audio_shutdown = dw_hdmi_i2s_audio_shutdown,
> > .get_dai_id = dw_hdmi_i2s_get_dai_id,
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [alsa-devel] [PATCH] drm: dw-hdmi-i2s: enable audio clock in audio_startup
2019-09-02 2:06 ` Cheng-yi Chiang
@ 2019-09-02 2:06 ` Cheng-yi Chiang
0 siblings, 0 replies; 6+ messages in thread
From: Cheng-yi Chiang @ 2019-09-02 2:06 UTC (permalink / raw)
To: Jonas Karlman
Cc: Jernej Skrabec, alsa-devel, tzungbi, kuninori.morimoto.gx,
zhengxing, cain.cai, airlied, jeffy.chen, linux-kernel,
dri-devel, dianders, Neil Armstrong, a.hajda, eddie.cai,
Laurent.pinchart, daniel, enric.balletbo, linux-rockchip, dgreid,
sam, linux-arm-kernel
On Sun, Sep 1, 2019 at 6:04 PM Jonas Karlman <jonas@kwiboo.se> wrote:
>
> On 2019-08-29 06:29, Cheng-Yi Chiang wrote:
> > In the designware databook, the sequence of enabling audio clock and
> > setting format is not clearly specified.
> > Currently, audio clock is enabled in the end of hw_param ops after
> > setting format.
> >
> > On some monitors, there is a possibility that audio does not come out.
> > Fix this by enabling audio clock in audio_startup ops
> > before hw_param ops setting format.
> >
> > Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
> > ---
> > drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 9 +++++++++
> > 1 file changed, 9 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
> > index 5cbb71a866d5..08b4adbb1ddc 100644
> > --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
> > +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
> > @@ -69,6 +69,14 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data,
> > hdmi_write(audio, conf0, HDMI_AUD_CONF0);
> > hdmi_write(audio, conf1, HDMI_AUD_CONF1);
> >
> > + return 0;
> > +}
> > +
> > +static int dw_hdmi_i2s_audio_startup(struct device *dev, void *data)
> > +{
> > + struct dw_hdmi_i2s_audio_data *audio = data;
> > + struct dw_hdmi *hdmi = audio->hdmi;
> > +
> > dw_hdmi_audio_enable(hdmi);
> >
> > return 0;
> > @@ -105,6 +113,7 @@ static int dw_hdmi_i2s_get_dai_id(struct snd_soc_component *component,
> > }
> >
> > static struct hdmi_codec_ops dw_hdmi_i2s_ops = {
> > + .audio_startup = dw_hdmi_i2s_audio_startup,
>
> A small white space nit, there should be a tab and not space to align the equal sign above.
ACK. Will fix in v2.
>
> Also this patch do not cleanly apply to drm-misc-next or linux-next after
> fc1ca6e01d0a "drm/bridge: dw-hdmi-i2s: add .get_eld support" was merged.
ACK. Will rebase in v2.
>
>
>
>
> This patch does fix an issue I have observed on my Rockchip devices where audio would not always
> came out after switching between audio streams having different rate and channels parameters.
> I used to carry [1] to fix that issue, but this seems like a more sane fix.
>
> [1] https://github.com/Kwiboo/linux-rockchip/commit/4862e4044532b8b480fa3a0faddc197586623808
>
> With above fixed,
>
> Reviewed-by: Jonas Karlman <jonas@kwiboo.se>
Thanks a lot!
>
>
> Regards,
> Jonas
>
> > .hw_params = dw_hdmi_i2s_hw_params,
> > .audio_shutdown = dw_hdmi_i2s_audio_shutdown,
> > .get_dai_id = dw_hdmi_i2s_get_dai_id,
>
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-09-02 2:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-29 4:29 [PATCH] drm: dw-hdmi-i2s: enable audio clock in audio_startup Cheng-Yi Chiang
2019-08-29 22:16 ` Doug Anderson
2019-09-01 10:03 ` Jonas Karlman
2019-09-01 10:03 ` [alsa-devel] " Jonas Karlman
2019-09-02 2:06 ` Cheng-yi Chiang
2019-09-02 2:06 ` [alsa-devel] " Cheng-yi Chiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).