linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] drm: dw-hdmi-i2s: enable audio clock in audio_startup
@ 2019-09-02  3:54 Cheng-Yi Chiang
  2019-09-02  9:42 ` Neil Armstrong
  0 siblings, 1 reply; 4+ messages in thread
From: Cheng-Yi Chiang @ 2019-09-02  3:54 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, Jonas Karlman

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>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Jonas Karlman <jonas@kwiboo.se>
Tested-by: Douglas Anderson <dianders@chromium.org>
---
 Changes from v1:
 1. Move audio_startup to the front of audio_shutdown.
 2. Fix the indentation of audio_startup equal sign using tab.
 3. Rebase the patch on linux-next/master.
 4. Add Reviewed-by and Tested-by fields from dianders@chromium.org.
 5. Add Reviewed-by field from jonas@kwiboo.se.

 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 1d15cf9b6821..34d8e837555f 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
@@ -109,6 +109,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;
@@ -153,6 +161,7 @@ static int dw_hdmi_i2s_get_dai_id(struct snd_soc_component *component,
 
 static struct hdmi_codec_ops dw_hdmi_i2s_ops = {
 	.hw_params	= dw_hdmi_i2s_hw_params,
+	.audio_startup  = dw_hdmi_i2s_audio_startup,
 	.audio_shutdown	= dw_hdmi_i2s_audio_shutdown,
 	.get_eld	= dw_hdmi_i2s_get_eld,
 	.get_dai_id	= dw_hdmi_i2s_get_dai_id,
-- 
2.23.0.187.g17f5b7556c-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] drm: dw-hdmi-i2s: enable audio clock in audio_startup
  2019-09-02  3:54 [PATCH v2] drm: dw-hdmi-i2s: enable audio clock in audio_startup Cheng-Yi Chiang
@ 2019-09-02  9:42 ` Neil Armstrong
  2019-09-02 10:32   ` Jonas Karlman
  0 siblings, 1 reply; 4+ messages in thread
From: Neil Armstrong @ 2019-09-02  9:42 UTC (permalink / raw)
  To: Cheng-Yi Chiang, linux-kernel
  Cc: alsa-devel, tzungbi, zhengxing, kuninori.morimoto.gx, a.hajda,
	airlied, jeffy.chen, dianders, dri-devel, cain.cai,
	linux-rockchip, Jonas Karlman, eddie.cai, Laurent.pinchart,
	daniel, enric.balletbo, dgreid, sam, linux-arm-kernel

Hi,

On 02/09/2019 05:54, 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>
> Reviewed-by: Douglas Anderson <dianders@chromium.org>
> Reviewed-by: Jonas Karlman <jonas@kwiboo.se>
> Tested-by: Douglas Anderson <dianders@chromium.org>
> ---
>  Changes from v1:
>  1. Move audio_startup to the front of audio_shutdown.
>  2. Fix the indentation of audio_startup equal sign using tab.
>  3. Rebase the patch on linux-next/master.
>  4. Add Reviewed-by and Tested-by fields from dianders@chromium.org.
>  5. Add Reviewed-by field from jonas@kwiboo.se.
> 
>  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 1d15cf9b6821..34d8e837555f 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
> @@ -109,6 +109,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;
> @@ -153,6 +161,7 @@ static int dw_hdmi_i2s_get_dai_id(struct snd_soc_component *component,
>  
>  static struct hdmi_codec_ops dw_hdmi_i2s_ops = {
>  	.hw_params	= dw_hdmi_i2s_hw_params,
> +	.audio_startup  = dw_hdmi_i2s_audio_startup,
>  	.audio_shutdown	= dw_hdmi_i2s_audio_shutdown,
>  	.get_eld	= dw_hdmi_i2s_get_eld,
>  	.get_dai_id	= dw_hdmi_i2s_get_dai_id,
> 
Looks sane, Jonas should I apply it now it's rebased ?

Neil

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] drm: dw-hdmi-i2s: enable audio clock in audio_startup
  2019-09-02  9:42 ` Neil Armstrong
@ 2019-09-02 10:32   ` Jonas Karlman
  2019-09-02 11:57     ` Neil Armstrong
  0 siblings, 1 reply; 4+ messages in thread
From: Jonas Karlman @ 2019-09-02 10:32 UTC (permalink / raw)
  To: Neil Armstrong, Cheng-Yi Chiang, linux-kernel
  Cc: alsa-devel, tzungbi, zhengxing, kuninori.morimoto.gx, a.hajda,
	airlied, jeffy.chen, dianders, dri-devel, cain.cai,
	linux-rockchip, eddie.cai, Laurent.pinchart, daniel,
	enric.balletbo, dgreid, sam, linux-arm-kernel

On 2019-09-02 11:42, Neil Armstrong wrote:
> Hi,
>
> On 02/09/2019 05:54, 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>
>> Reviewed-by: Douglas Anderson <dianders@chromium.org>
>> Reviewed-by: Jonas Karlman <jonas@kwiboo.se>
>> Tested-by: Douglas Anderson <dianders@chromium.org>
>> ---
>>  Changes from v1:
>>  1. Move audio_startup to the front of audio_shutdown.
>>  2. Fix the indentation of audio_startup equal sign using tab.
>>  3. Rebase the patch on linux-next/master.
>>  4. Add Reviewed-by and Tested-by fields from dianders@chromium.org.
>>  5. Add Reviewed-by field from jonas@kwiboo.se.
>>
>>  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 1d15cf9b6821..34d8e837555f 100644
>> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
>> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
>> @@ -109,6 +109,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;
>> @@ -153,6 +161,7 @@ static int dw_hdmi_i2s_get_dai_id(struct snd_soc_component *component,
>>  
>>  static struct hdmi_codec_ops dw_hdmi_i2s_ops = {
>>  	.hw_params	= dw_hdmi_i2s_hw_params,
>> +	.audio_startup  = dw_hdmi_i2s_audio_startup,
>>  	.audio_shutdown	= dw_hdmi_i2s_audio_shutdown,
>>  	.get_eld	= dw_hdmi_i2s_get_eld,
>>  	.get_dai_id	= dw_hdmi_i2s_get_dai_id,
>>
> Looks sane, Jonas should I apply it now it's rebased ?

Sure, looks sane and compiles without warnings on my build host.

Regards,
Jonas

>
> Neil


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] drm: dw-hdmi-i2s: enable audio clock in audio_startup
  2019-09-02 10:32   ` Jonas Karlman
@ 2019-09-02 11:57     ` Neil Armstrong
  0 siblings, 0 replies; 4+ messages in thread
From: Neil Armstrong @ 2019-09-02 11:57 UTC (permalink / raw)
  To: Jonas Karlman, Cheng-Yi Chiang, linux-kernel
  Cc: alsa-devel, tzungbi, zhengxing, kuninori.morimoto.gx, a.hajda,
	airlied, jeffy.chen, dianders, dri-devel, cain.cai,
	linux-rockchip, eddie.cai, Laurent.pinchart, daniel,
	enric.balletbo, dgreid, sam, linux-arm-kernel

On 02/09/2019 12:32, Jonas Karlman wrote:
> On 2019-09-02 11:42, Neil Armstrong wrote:
>> Hi,
>>
>> On 02/09/2019 05:54, 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>
>>> Reviewed-by: Douglas Anderson <dianders@chromium.org>
>>> Reviewed-by: Jonas Karlman <jonas@kwiboo.se>
>>> Tested-by: Douglas Anderson <dianders@chromium.org>
>>> ---
>>>  Changes from v1:
>>>  1. Move audio_startup to the front of audio_shutdown.
>>>  2. Fix the indentation of audio_startup equal sign using tab.
>>>  3. Rebase the patch on linux-next/master.
>>>  4. Add Reviewed-by and Tested-by fields from dianders@chromium.org.
>>>  5. Add Reviewed-by field from jonas@kwiboo.se.
>>>
>>>  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 1d15cf9b6821..34d8e837555f 100644
>>> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
>>> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
>>> @@ -109,6 +109,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;
>>> @@ -153,6 +161,7 @@ static int dw_hdmi_i2s_get_dai_id(struct snd_soc_component *component,
>>>  
>>>  static struct hdmi_codec_ops dw_hdmi_i2s_ops = {
>>>  	.hw_params	= dw_hdmi_i2s_hw_params,
>>> +	.audio_startup  = dw_hdmi_i2s_audio_startup,
>>>  	.audio_shutdown	= dw_hdmi_i2s_audio_shutdown,
>>>  	.get_eld	= dw_hdmi_i2s_get_eld,
>>>  	.get_dai_id	= dw_hdmi_i2s_get_dai_id,
>>>
>> Looks sane, Jonas should I apply it now it's rebased ?
> 
> Sure, looks sane and compiles without warnings on my build host.

Thx, Applied to drm-misc-next

Neil

> 
> Regards,
> Jonas
> 
>>
>> Neil
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-09-02 11:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-02  3:54 [PATCH v2] drm: dw-hdmi-i2s: enable audio clock in audio_startup Cheng-Yi Chiang
2019-09-02  9:42 ` Neil Armstrong
2019-09-02 10:32   ` Jonas Karlman
2019-09-02 11:57     ` Neil Armstrong

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).