drm: dw-hdmi: various improvements
Subsystems (4)
v2 cover drm: dw-hdmi: various improvements
This set of patches split the stream handling functions in two parts. It introduces new callbacks that are specific to each variant, one for I2S and one for AHB.
Then, as requested by the datasheet for the I2S variant, it adds support for gating the audio sampler clock when the audio stream is enabled and disabled.
This patches series is the continuity of the following discussion:
http://lists.infradead.org/pipermail/linux-arm-kernel/2017-March/493550.html
Changes in v2:
- Add NULL check in dw_hdmi_audio_enable/dw_hdmi_audio_disable
- Don't define dw_hdmi_i2s_audio_disable in PATCH 1/2
- Rebased onto drm-misc-next
Romain Perier (2):
drm: dw-hdmi: add specific I2S and AHB functions for stream handling
drm: dw-hdmi: gate audio clock from the I2S enablement callbacks
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 46 +++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 8 deletions(-)
Signature · 1 line
2.9.3
PATCH v2 1/2 drm: dw-hdmi: add specific I2S and AHB functions for stream handling
Currently, CTS+N is forced to zero as a workaround of the IP block for i.MX platforms. This is requested in the datasheet of the corresponding IP for AHB mode only. However, we have seen that it introduces glitches or delays when playing a sound on HDMI for I2S mode. This proves that we cannot keep the current functions for handling audio stream as-is if these contain workaround that are specific to a mode.
This commit introduces two callbacks, one for each variant. dw_hdmi_setup defines the right function depending on the detected variant. Then, the exported functions dw_hdmi_audio_enable and dw_hdmi_audio_disable calls the corresponding callbacks
--- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +24 -2
@@ -173,6 +173,8 @@ struct dw_hdmi {unsigned int reg_shift;struct regmap *regm; +void (*enable_audio)(struct dw_hdmi *hdmi); +void (*disable_audio)(struct dw_hdmi *hdmi); };#define HDMI_IH_PHY_STAT0_RX_SENSE \
@@ -542,13 +544,29 @@ void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate) }EXPORT_SYMBOL_GPL (dw_hdmi_set_sample_rate); +void dw_hdmi_ahb_audio_enable (struct dw_hdmi *hdmi) +{ +hdmi_set_cts_n (hdmi, hdmi->audio_cts, hdmi->audio_n); +} + +void dw_hdmi_ahb_audio_disable (struct dw_hdmi *hdmi) +{ +hdmi_set_cts_n (hdmi, hdmi->audio_cts,0 ); +} + +void dw_hdmi_i2s_audio_enable (struct dw_hdmi *hdmi) +{ +hdmi_set_cts_n (hdmi, hdmi->audio_cts, hdmi->audio_n); +} +void dw_hdmi_audio_enable (struct dw_hdmi *hdmi) {unsigned long flags;spin_lock_irqsave (&hdmi->audio_lock, flags); hdmi->audio_enable = true; -hdmi_set_cts_n (hdmi, hdmi->audio_cts, hdmi->audio_n); +if (hdmi->enable_audio) + hdmi->enable_audio (hdmi);spin_unlock_irqrestore (&hdmi->audio_lock, flags); }EXPORT_SYMBOL_GPL (dw_hdmi_audio_enable);
@@ -559,7 +577,8 @@ void dw_hdmi_audio_disable(struct dw_hdmi *hdmi)spin_lock_irqsave (&hdmi->audio_lock, flags); hdmi->audio_enable = false; -hdmi_set_cts_n (hdmi, hdmi->audio_cts,0 ); +if (hdmi->disable_audio) + hdmi->disable_audio (hdmi);spin_unlock_irqrestore (&hdmi->audio_lock, flags); }EXPORT_SYMBOL_GPL (dw_hdmi_audio_disable);
@@ -2404,6 +2423,8 @@ __dw_hdmi_probe(struct platform_device *pdev, audio.irq = irq; audio.hdmi = hdmi; audio.eld = hdmi->connector.eld; + hdmi->enable_audio = dw_hdmi_ahb_audio_enable; + hdmi->disable_audio = dw_hdmi_ahb_audio_disable; pdevinfo.name ="dw-hdmi-ahb-audio" ; pdevinfo.data = &audio;
@@ -2416,6 +2437,7 @@ __dw_hdmi_probe(struct platform_device *pdev, audio.hdmi = hdmi; audio.write = hdmi_writeb; audio.read = hdmi_readb; + hdmi->enable_audio = dw_hdmi_i2s_audio_enable; pdevinfo.name ="dw-hdmi-i2s-audio" ; pdevinfo.data = &audio;
Signature · 1 line
2.9.3
Re: [PATCH v2 1/2] drm: dw-hdmi: add specific I2S and AHB functions for stream handling
Quoted 82 lines · Romain Perier
Currently, CTS+N is forced to zero as a workaround of the IP block for i.MX platforms. This is requested in the datasheet of the corresponding IP for AHB mode only. However, we have seen that it introduces glitches or delays when playing a sound on HDMI for I2S mode. This proves that we cannot keep the current functions for handling audio stream as-is if these contain workaround that are specific to a mode.
This commit introduces two callbacks, one for each variant.
dw_hdmi_setupdefines the right function depending on the detected variant. Then, the exported functionsdw_hdmi_audio_enableanddw_hdmi_audio_disablecalls the corresponding callbacksSigned-off-by Romain Perier <[email protected]>--- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +23
-2@@ -173,6 +173,8 @@ struct dw_hdmi {unsigned int reg_shift;struct regmap *regm; +void (*enable_audio)(struct dw_hdmi *hdmi); +void (*disable_audio)(struct dw_hdmi *hdmi); };#define HDMI_IH_PHY_STAT0_RX_SENSE \@@ -542,13 +544,29 @@ void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate) }EXPORT_SYMBOL_GPL (dw_hdmi_set_sample_rate); +void dw_hdmi_ahb_audio_enable (struct dw_hdmi *hdmi) +{ +hdmi_set_cts_n (hdmi, hdmi->audio_cts, hdmi->audio_n); +} + +void dw_hdmi_ahb_audio_disable (struct dw_hdmi *hdmi) +{ +hdmi_set_cts_n (hdmi, hdmi->audio_cts,0 ); +} + +void dw_hdmi_i2s_audio_enable (struct dw_hdmi *hdmi) +{ +hdmi_set_cts_n (hdmi, hdmi->audio_cts, hdmi->audio_n); +} +void dw_hdmi_audio_enable (struct dw_hdmi *hdmi) {unsigned long flags;spin_lock_irqsave (&hdmi->audio_lock, flags); hdmi->audio_enable = true; -hdmi_set_cts_n (hdmi, hdmi->audio_cts, hdmi->audio_n); +if (hdmi->enable_audio) + hdmi->enable_audio (hdmi);spin_unlock_irqrestore (&hdmi->audio_lock, flags); }EXPORT_SYMBOL_GPL (dw_hdmi_audio_enable);@@ -559,7 +577,8 @@ void dw_hdmi_audio_disable(struct dw_hdmi *hdmi)spin_lock_irqsave (&hdmi->audio_lock, flags); hdmi->audio_enable = false; -hdmi_set_cts_n (hdmi, hdmi->audio_cts,0 ); +if (hdmi->disable_audio) + hdmi->disable_audio (hdmi);spin_unlock_irqrestore (&hdmi->audio_lock, flags); }EXPORT_SYMBOL_GPL (dw_hdmi_audio_disable);@@ -2404,6 +2423,8 @@ __dw_hdmi_probe(struct platform_device *pdev, audio.irq = irq; audio.hdmi = hdmi; audio.eld = hdmi->connector.eld; + hdmi->enable_audio = dw_hdmi_ahb_audio_enable; + hdmi->disable_audio = dw_hdmi_ahb_audio_disable; pdevinfo.name ="dw-hdmi-ahb-audio" ; pdevinfo.data = &audio;
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c __dw_hdmi_probe(struct platform_device *pdev, · line 2443
Quoted 7 lines
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +1
-0@@ -2416,6 +2437,7 @@ __dw_hdmi_probe(struct platform_device *pdev, audio.hdmi = hdmi; audio.write = hdmi_writeb; audio.read = hdmi_readb; + hdmi->enable_audio = dw_hdmi_i2s_audio_enable; pdevinfo.name ="dw-hdmi-i2s-audio" ; pdevinfo.data = &audio;
Hi Romain,
Re: [PATCH v2 1/2] drm: dw-hdmi: add specific I2S and AHB functions for stream handling
In reply to Romain PerierQuoted 39 lines · Romain Perier
Currently, CTS+N is forced to zero as a workaround of the IP block for i.MX platforms. This is requested in the datasheet of the corresponding IP for AHB mode only. However, we have seen that it introduces glitches or delays when playing a sound on HDMI for I2S mode. This proves that we cannot keep the current functions for handling audio stream as-is if these contain workaround that are specific to a mode.
This commit introduces two callbacks, one for each variant.
dw_hdmi_setupdefines the right function depending on the detected variant. Then, the exported functionsdw_hdmi_audio_enableanddw_hdmi_audio_disablecalls the corresponding callbacksSigned-off-by Romain Perier <[email protected]>--- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +7
-0@@ -173,6 +173,8 @@ struct dw_hdmi {unsigned int reg_shift;struct regmap *regm; +void (*enable_audio)(struct dw_hdmi *hdmi); +void (*disable_audio)(struct dw_hdmi *hdmi); };#define HDMI_IH_PHY_STAT0_RX_SENSE \@@ -542,13 +544,29 @@ void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate) }EXPORT_SYMBOL_GPL (dw_hdmi_set_sample_rate); +void dw_hdmi_ahb_audio_enable (struct dw_hdmi *hdmi) +{ +hdmi_set_cts_n (hdmi, hdmi->audio_cts, hdmi->audio_n); +} +
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate) · line 561
Quoted 10 lines
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +10
-0+void dw_hdmi_ahb_audio_disable (struct dw_hdmi *hdmi) +{ +hdmi_set_cts_n (hdmi, hdmi->audio_cts,0 ); +} + +void dw_hdmi_i2s_audio_enable (struct dw_hdmi *hdmi) +{ +hdmi_set_cts_n (hdmi, hdmi->audio_cts, hdmi->audio_n); +} +
I get some sparse warnings asking for the above 3 to be static.
Thanks,
Archit
Quoted 40 lines
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +7
-2void dw_hdmi_audio_enable (struct dw_hdmi *hdmi) {unsigned long flags;spin_lock_irqsave (&hdmi->audio_lock, flags); hdmi->audio_enable = true; -hdmi_set_cts_n (hdmi, hdmi->audio_cts, hdmi->audio_n); +if (hdmi->enable_audio) + hdmi->enable_audio (hdmi);spin_unlock_irqrestore (&hdmi->audio_lock, flags); }EXPORT_SYMBOL_GPL (dw_hdmi_audio_enable);@@ -559,7 +577,8 @@ void dw_hdmi_audio_disable(struct dw_hdmi *hdmi)spin_lock_irqsave (&hdmi->audio_lock, flags); hdmi->audio_enable = false; -hdmi_set_cts_n (hdmi, hdmi->audio_cts,0 ); +if (hdmi->disable_audio) + hdmi->disable_audio (hdmi);spin_unlock_irqrestore (&hdmi->audio_lock, flags); }EXPORT_SYMBOL_GPL (dw_hdmi_audio_disable);@@ -2404,6 +2423,8 @@ __dw_hdmi_probe(struct platform_device *pdev, audio.irq = irq; audio.hdmi = hdmi; audio.eld = hdmi->connector.eld; + hdmi->enable_audio = dw_hdmi_ahb_audio_enable; + hdmi->disable_audio = dw_hdmi_ahb_audio_disable; pdevinfo.name ="dw-hdmi-ahb-audio" ; pdevinfo.data = &audio;@@ -2416,6 +2437,7 @@ __dw_hdmi_probe(struct platform_device *pdev, audio.hdmi = hdmi; audio.write = hdmi_writeb; audio.read = hdmi_readb; + hdmi->enable_audio = dw_hdmi_i2s_audio_enable; pdevinfo.name ="dw-hdmi-i2s-audio" ; pdevinfo.data = &audio;
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v2 2/2 drm: dw-hdmi: gate audio clock from the I2S enablement callbacks
In reply to Romain PerierCurrently, the audio sampler clock is enabled from dw_hdmi_setup() at step E. and is kept enabled for later use. This clock should be enabled and disabled along with the actual audio stream and not always on (that is bad for PM). Futhermore, as described by the datasheet, the I2S variant need to gate/ungate the clock when the stream is enabled/disabled.
This commit adds a parameter to hdmi_audio_enable_clk() that controls when the audio sample clock must be enabled or disabled. Then, it adds the call to this function from dw_hdmi_i2s_audio_enable() and dw_hdmi_i2s_audio_disable().
--- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +14 -6
@@ -544,6 +544,12 @@ void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate) }EXPORT_SYMBOL_GPL (dw_hdmi_set_sample_rate); +static void hdmi_enable_audio_clk (struct dw_hdmi *hdmi,bool enable) +{ +hdmi_modb (hdmi, enable ?0 :HDMI_MC_CLKDIS_AUDCLK_DISABLE , +HDMI_MC_CLKDIS_AUDCLK_DISABLE ,HDMI_MC_CLKDIS ); +} +void dw_hdmi_ahb_audio_enable (struct dw_hdmi *hdmi) {hdmi_set_cts_n (hdmi, hdmi->audio_cts, hdmi->audio_n);
@@ -557,6 +563,12 @@ void dw_hdmi_ahb_audio_disable(struct dw_hdmi *hdmi)void dw_hdmi_i2s_audio_enable (struct dw_hdmi *hdmi) {hdmi_set_cts_n (hdmi, hdmi->audio_cts, hdmi->audio_n); +hdmi_enable_audio_clk (hdmi, true); +} + +void dw_hdmi_i2s_audio_disable (struct dw_hdmi *hdmi) +{ +hdmi_enable_audio_clk (hdmi, false); }void dw_hdmi_audio_enable (struct dw_hdmi *hdmi)
@@ -1592,11 +1604,6 @@ static void dw_hdmi_enable_video_path(struct dw_hdmi *hdmi) HDMI_MC_FLOWCTRL); } -static void hdmi_enable_audio_clk (struct dw_hdmi *hdmi) -{ -hdmi_modb (hdmi,0 ,HDMI_MC_CLKDIS_AUDCLK_DISABLE ,HDMI_MC_CLKDIS ); -} -/* Workaround to clear the overflow condition */ static void dw_hdmi_clear_overflow (struct dw_hdmi *hdmi) {
@@ -1710,7 +1717,7 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode)/* HDMI Initialization Step E - Configure audio */ hdmi_clk_regenerator_update_pixel_clock (hdmi); -hdmi_enable_audio_clk (hdmi); +hdmi_enable_audio_clk (hdmi, true); }/* not for DVI mode */
@@ -2438,6 +2445,7 @@ __dw_hdmi_probe(struct platform_device *pdev, audio.write = hdmi_writeb; audio.read = hdmi_readb; hdmi->enable_audio = dw_hdmi_i2s_audio_enable; + hdmi->disable_audio = dw_hdmi_i2s_audio_disable; pdevinfo.name ="dw-hdmi-i2s-audio" ; pdevinfo.data = &audio;
Signature · 1 line
2.9.3
Re: [PATCH v2 2/2] drm: dw-hdmi: gate audio clock from the I2S enablement callbacks
Quoted 70 lines · Romain Perier
Currently, the audio sampler clock is enabled from
dw_hdmi_setup()at step E. and is kept enabled for later use. This clock should be enabled and disabled along with the actual audio stream and not always on (that is bad for PM). Futhermore, as described by the datasheet, the I2S variant need to gate/ungate the clock when the stream is enabled/disabled.This commit adds a parameter to
hdmi_audio_enable_clk()that controls when the audio sample clock must be enabled or disabled. Then, it adds the call to this function fromdw_hdmi_i2s_audio_enable()anddw_hdmi_i2s_audio_disable().Signed-off-by Romain Perier <[email protected]>--- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +13
-6@@ -544,6 +544,12 @@ void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate) }EXPORT_SYMBOL_GPL (dw_hdmi_set_sample_rate); +static void hdmi_enable_audio_clk (struct dw_hdmi *hdmi,bool enable) +{ +hdmi_modb (hdmi, enable ?0 :HDMI_MC_CLKDIS_AUDCLK_DISABLE , +HDMI_MC_CLKDIS_AUDCLK_DISABLE ,HDMI_MC_CLKDIS ); +} +void dw_hdmi_ahb_audio_enable (struct dw_hdmi *hdmi) {hdmi_set_cts_n (hdmi, hdmi->audio_cts, hdmi->audio_n);@@ -557,6 +563,12 @@ void dw_hdmi_ahb_audio_disable(struct dw_hdmi *hdmi)void dw_hdmi_i2s_audio_enable (struct dw_hdmi *hdmi) {hdmi_set_cts_n (hdmi, hdmi->audio_cts, hdmi->audio_n); +hdmi_enable_audio_clk (hdmi, true); +} + +void dw_hdmi_i2s_audio_disable (struct dw_hdmi *hdmi) +{ +hdmi_enable_audio_clk (hdmi, false); }void dw_hdmi_audio_enable (struct dw_hdmi *hdmi)@@ -1592,11 +1604,6 @@ static void dw_hdmi_enable_video_path(struct dw_hdmi *hdmi) HDMI_MC_FLOWCTRL); } -static void hdmi_enable_audio_clk (struct dw_hdmi *hdmi) -{ -hdmi_modb (hdmi,0 ,HDMI_MC_CLKDIS_AUDCLK_DISABLE ,HDMI_MC_CLKDIS ); -} -/* Workaround to clear the overflow condition */ static void dw_hdmi_clear_overflow (struct dw_hdmi *hdmi) {@@ -1710,7 +1717,7 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode)/* HDMI Initialization Step E - Configure audio */ hdmi_clk_regenerator_update_pixel_clock (hdmi); -hdmi_enable_audio_clk (hdmi); +hdmi_enable_audio_clk (hdmi, true); }/* not for DVI mode */
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c __dw_hdmi_probe(struct platform_device *pdev, · line 2451
Quoted 7 lines
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +1
-0@@ -2438,6 +2445,7 @@ __dw_hdmi_probe(struct platform_device *pdev, audio.write = hdmi_writeb; audio.read = hdmi_readb; hdmi->enable_audio = dw_hdmi_i2s_audio_enable; + hdmi->disable_audio = dw_hdmi_i2s_audio_disable; pdevinfo.name ="dw-hdmi-i2s-audio" ; pdevinfo.data = &audio;
Hi Romain,
Re: [PATCH v2 2/2] drm: dw-hdmi: gate audio clock from the I2S enablement callbacks
In reply to Romain PerierQuoted 4 lines · Romain Perier
Currently, the audio sampler clock is enabled from
dw_hdmi_setup()at step E. and is kept enabled for later use. This clock should be enabled and disabled along with the actual audio stream and not always on (that is bad for PM). Futhermore, as described by the datasheet, the I2S
s/Futhermore/Furthermore
Quoted 1 line
variant need to gate/ungate the clock when the stream is
s/need/needs
Quoted 30 lines
enabled/disabled.
This commit adds a parameter to
hdmi_audio_enable_clk()that controls when the audio sample clock must be enabled or disabled. Then, it adds the call to this function fromdw_hdmi_i2s_audio_enable()anddw_hdmi_i2s_audio_disable().Signed-off-by Romain Perier <[email protected]>--- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +6
-0@@ -544,6 +544,12 @@ void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate) }EXPORT_SYMBOL_GPL (dw_hdmi_set_sample_rate); +static void hdmi_enable_audio_clk (struct dw_hdmi *hdmi,bool enable) +{ +hdmi_modb (hdmi, enable ?0 :HDMI_MC_CLKDIS_AUDCLK_DISABLE , +HDMI_MC_CLKDIS_AUDCLK_DISABLE ,HDMI_MC_CLKDIS ); +} +void dw_hdmi_ahb_audio_enable (struct dw_hdmi *hdmi) {hdmi_set_cts_n (hdmi, hdmi->audio_cts, hdmi->audio_n);
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c void dw_hdmi_ahb_audio_disable(struct dw_hdmi *hdmi) · line 572
Quoted 10 lines
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +6
-0@@ -557,6 +563,12 @@ void dw_hdmi_ahb_audio_disable(struct dw_hdmi *hdmi)void dw_hdmi_i2s_audio_enable (struct dw_hdmi *hdmi) {hdmi_set_cts_n (hdmi, hdmi->audio_cts, hdmi->audio_n); +hdmi_enable_audio_clk (hdmi, true); +} + +void dw_hdmi_i2s_audio_disable (struct dw_hdmi *hdmi) +{ +hdmi_enable_audio_clk (hdmi, false); }
This should be static too.
If you're okay with the suggestions, I can fix these myself and push. Let me know if that's okay.
Thanks,
Archit
Quoted 32 lines
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +2
-6void dw_hdmi_audio_enable (struct dw_hdmi *hdmi)@@ -1592,11 +1604,6 @@ static void dw_hdmi_enable_video_path(struct dw_hdmi *hdmi) HDMI_MC_FLOWCTRL); } -static void hdmi_enable_audio_clk (struct dw_hdmi *hdmi) -{ -hdmi_modb (hdmi,0 ,HDMI_MC_CLKDIS_AUDCLK_DISABLE ,HDMI_MC_CLKDIS ); -} -/* Workaround to clear the overflow condition */ static void dw_hdmi_clear_overflow (struct dw_hdmi *hdmi) {@@ -1710,7 +1717,7 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode)/* HDMI Initialization Step E - Configure audio */ hdmi_clk_regenerator_update_pixel_clock (hdmi); -hdmi_enable_audio_clk (hdmi); +hdmi_enable_audio_clk (hdmi, true); }/* not for DVI mode */ @@ -2438,6 +2445,7 @@ __dw_hdmi_probe(struct platform_device *pdev, audio.write = hdmi_writeb; audio.read = hdmi_readb; hdmi->enable_audio = dw_hdmi_i2s_audio_enable; + hdmi->disable_audio = dw_hdmi_i2s_audio_disable; pdevinfo.name ="dw-hdmi-i2s-audio" ; pdevinfo.data = &audio;
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH v2 2/2] drm: dw-hdmi: gate audio clock from the I2S enablement callbacks
Quoted 57 lines · Archit Taneja
Quoted 4 lines · Romain Perier
Currently, the audio sampler clock is enabled from
dw_hdmi_setup()at step E. and is kept enabled for later use. This clock should be enabled and disabled along with the actual audio stream and not always on (that is bad for PM). Futhermore, as described by the datasheet, the I2Ss/Futhermore/Furthermore
Quoted 1 line
variant need to gate/ungate the clock when the stream is
s/need/needs
Quoted 30 lines
enabled/disabled.
This commit adds a parameter to
hdmi_audio_enable_clk()that controls when the audio sample clock must be enabled or disabled. Then, it adds the call to this function fromdw_hdmi_i2s_audio_enable()anddw_hdmi_i2s_audio_disable().Signed-off-by Romain Perier <[email protected]>--- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +6
-0@@ -544,6 +544,12 @@ void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate) }EXPORT_SYMBOL_GPL (dw_hdmi_set_sample_rate); +static void hdmi_enable_audio_clk (struct dw_hdmi *hdmi,bool enable) +{ +hdmi_modb (hdmi, enable ?0 :HDMI_MC_CLKDIS_AUDCLK_DISABLE , +HDMI_MC_CLKDIS_AUDCLK_DISABLE ,HDMI_MC_CLKDIS ); +} +void dw_hdmi_ahb_audio_enable (struct dw_hdmi *hdmi) {hdmi_set_cts_n (hdmi, hdmi->audio_cts, hdmi->audio_n);drivers/gpu/drm/bridge/synopsys/dw-hdmi.c void dw_hdmi_ahb_audio_disable(struct dw_hdmi *hdmi) · line 572
Quoted 10 lines
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +6
-0@@ -557,6 +563,12 @@ void dw_hdmi_ahb_audio_disable(struct dw_hdmi *hdmi)void dw_hdmi_i2s_audio_enable (struct dw_hdmi *hdmi) {hdmi_set_cts_n (hdmi, hdmi->audio_cts, hdmi->audio_n); +hdmi_enable_audio_clk (hdmi, true); +} + +void dw_hdmi_i2s_audio_disable (struct dw_hdmi *hdmi) +{ +hdmi_enable_audio_clk (hdmi, false); }This should be static too.
Quoted 2 lines
If you're okay with the suggestions, I can fix these myself and push. Let me know if that's okay.
Took the liberty of going ahead with the fixes. Queued both patches to drm-misc-next.
Thanks,
Archit
Quoted 37 lines
Thanks,
ArchitQuoted 32 lines
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +2
-6void dw_hdmi_audio_enable (struct dw_hdmi *hdmi)@@ -1592,11 +1604,6 @@ static void dw_hdmi_enable_video_path(struct dw_hdmi *hdmi) HDMI_MC_FLOWCTRL); } -static void hdmi_enable_audio_clk (struct dw_hdmi *hdmi) -{ -hdmi_modb (hdmi,0 ,HDMI_MC_CLKDIS_AUDCLK_DISABLE ,HDMI_MC_CLKDIS ); -} -/* Workaround to clear the overflow condition */ static void dw_hdmi_clear_overflow (struct dw_hdmi *hdmi) {@@ -1710,7 +1717,7 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode)/* HDMI Initialization Step E - Configure audio */ hdmi_clk_regenerator_update_pixel_clock (hdmi); -hdmi_enable_audio_clk (hdmi); +hdmi_enable_audio_clk (hdmi, true); }/* not for DVI mode */ @@ -2438,6 +2445,7 @@ __dw_hdmi_probe(struct platform_device *pdev, audio.write = hdmi_writeb; audio.read = hdmi_readb; hdmi->enable_audio = dw_hdmi_i2s_audio_enable; + hdmi->disable_audio = dw_hdmi_i2s_audio_disable; pdevinfo.name ="dw-hdmi-i2s-audio" ; pdevinfo.data = &audio;
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH v2 2/2] drm: dw-hdmi: gate audio clock from the I2S enablement callbacks
Hello,
Quoted 5 lines
Took the liberty of going ahead with the fixes. Queued both patches to drm-misc-next.
Thanks,
Archit
You were right. Sorry for the delay, I am back from vacations :)
Regards,
Romain
Re: [PATCH v2 2/2] drm: dw-hdmi: gate audio clock from the I2S enablement callbacks
In reply to Archit TanejaHello,
Quoted 60 lines · Archit Taneja
Quoted 4 lines · Romain Perier
Currently, the audio sampler clock is enabled from
dw_hdmi_setup()at step E. and is kept enabled for later use. This clock should be enabled and disabled along with the actual audio stream and not always on (that is bad for PM). Futhermore, as described by the datasheet, the I2Ss/Futhermore/Furthermore
Quoted 1 line
variant need to gate/ungate the clock when the stream is
s/need/needs
Quoted 33 lines
enabled/disabled.
This commit adds a parameter to
hdmi_audio_enable_clk()that controls when the audio sample clock must be enabled or disabled. Then, it adds the call to this function fromdw_hdmi_i2s_audio_enable()anddw_hdmi_i2s_audio_disable().Signed-off-by Romain Perier <[email protected]>--- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +6
-0@@ -544,6 +544,12 @@ void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate) }EXPORT_SYMBOL_GPL (dw_hdmi_set_sample_rate); +static void hdmi_enable_audio_clk (struct dw_hdmi *hdmi,bool enable) +{ +hdmi_modb (hdmi, enable ?0 :HDMI_MC_CLKDIS_AUDCLK_DISABLE , +HDMI_MC_CLKDIS_AUDCLK_DISABLE ,HDMI_MC_CLKDIS ); +} +void dw_hdmi_ahb_audio_enable (struct dw_hdmi *hdmi) {hdmi_set_cts_n(hdmi, hdmi->audio_cts, hdmi->audio_n);drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +0
-0@@ -557,6 +563,12 @@ void dw_hdmi_ahb_audio_disable(struct dw_hdmi *hdmi)drivers/gpu/drm/bridge/synopsys/dw-hdmi.c void dw_hdmi_ahb_audio_disable(struct dw_hdmi · line 573
Quoted 10 lines
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +6
-0void dw_hdmi_i2s_audio_enable (struct dw_hdmi *hdmi) {hdmi_set_cts_n (hdmi, hdmi->audio_cts, hdmi->audio_n); +hdmi_enable_audio_clk (hdmi, true); +} + +void dw_hdmi_i2s_audio_disable (struct dw_hdmi *hdmi) +{ +hdmi_enable_audio_clk (hdmi, false); }This should be static too.
Quoted 6 lines
If you're okay with the suggestions, I can fix these myself and push. Let me know if that's okay.
Thanks,
Archit
Yes, I completely agree.
Thanks,
Romain