Re: [PATCH v2 08/12] drm: bridge/dw_hdmi: add audio config interfaces

From: Yang Kuankuan
Date: Sat Jan 31 2015 - 09:35:14 EST



On 01/31/2015 06:48 AM, Russell King - ARM Linux wrote:
On Fri, Jan 30, 2015 at 06:32:23AM -0500, Yakir Yang wrote:
+static void hdmi_config_audio(struct dw_hdmi *hdmi,
+ struct hdmi_audio_fmt *aud_fmt)
+{
+ if (aud_fmt)
+ hdmi->aud_fmt = *aud_fmt;
+
+ hdmi_modb(hdmi, AUDIO_CONF0_INTERFACE_II2S,
+ AUDIO_CONF0_INTERFACE_MSK, HDMI_AUD_CONF0);
+
+ hdmi_modb(hdmi, hdmi->aud_fmt.chan_num, AUDIO_CONF0_I2SINEN_MSK,
+ HDMI_AUD_CONF0);
+
+ hdmi_modb(hdmi, hdmi->aud_fmt.word_length, AUDIO_CONF1_DATWIDTH_MSK,
+ HDMI_AUD_CONF1);
+
+ hdmi_modb(hdmi, hdmi->aud_fmt.dai_fmt, AUDIO_CONF1_DATAMODE_MSK,
+ HDMI_AUD_CONF1);
These registers are not defined on iMX6 SoCs, so this probably needs to be
conditionalised with the dw-hdmi IP version.
okay, i will fixed what you have suggest in cover-letter first.

Thanks. : )
+void hdmi_audio_clk_enable(struct dw_hdmi *hdmi)
+{
+ if (hdmi->audio_enable)
+ return;
+
+ mutex_lock(&hdmi->audio_mutex);
+ hdmi->audio_enable = true;
+ hdmi_modb(hdmi, 0, HDMI_MC_CLKDIS_AUDCLK_DISABLE, HDMI_MC_CLKDIS);
+ mutex_unlock(&hdmi->audio_mutex);
This is racy. The test needs to be within the mutex-protected region.
This function will be called by other driver (dw-hdmi-audio), both modify the variable "hdmi->audio_enable", so i add the mutex-protected.

+}
+
+void hdmi_audio_clk_disable(struct dw_hdmi *hdmi)
+{
+ if (!hdmi->audio_enable)
+ return;
+
+ mutex_lock(&hdmi->audio_mutex);
+ hdmi_modb(hdmi, HDMI_MC_CLKDIS_AUDCLK_DISABLE,
+ HDMI_MC_CLKDIS_AUDCLK_DISABLE, HDMI_MC_CLKDIS);
+ hdmi->audio_enable = false;
+ mutex_unlock(&hdmi->audio_mutex);
Ditto.



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/