Skip to contentSkip to conversation

drm/i915: provide interface for audio driver to query cdclk

PATCH Superseded [email protected] 4 participants 8 messages Jul 3, 2014 – Jul 4, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 drm/i915: provide interface for audio driver to query cdclk

From: Jani Nikula <[email protected]>

drivers/gpu/drm/i915/intel_pm.c +21 -0
index a90fdbd..21170e5 100644
@@ -6256,6 +6256,27 @@ int i915_release_power_well(void)
 }
 EXPORT_SYMBOL_GPL(i915_release_power_well);
 
+/*
+ * Private interface for the audio driver to get CDCLK in kHz.
+ *
+ * Caller must request power well using i915_request_power_well() prior to
+ * making the call.
+ */
+int i915_get_cdclk_freq(void)
+{
+	struct drm_i915_private *dev_priv;
+
+	if (!hsw_pwr)
+		return -ENODEV;
+
+	dev_priv = container_of(hsw_pwr, struct drm_i915_private,
+				power_domains);
+
+	return intel_ddi_get_cdclk_freq(dev_priv);
+}
+EXPORT_SYMBOL_GPL(i915_get_cdclk_freq);
+
+
 #define POWER_DOMAIN_MASK (BIT(POWER_DOMAIN_NUM) - 1)
 
 #define HSW_ALWAYS_ON_POWER_DOMAINS (			\
include/drm/i915_powerwell.h +1 -0
index 2baba99..baa6f11 100644
@@ -32,5 +32,6 @@
 /* For use by hda_i915 driver */
 extern int i915_request_power_well(void);
 extern int i915_release_power_well(void);
+extern int i915_get_cdclk_freq(void);
 
 #endif				/* _I915_POWERWELL_H_ */
Signature · 1 line
1.8.1.2
#1 lore raw
Quoted 1 line · On Thu, 03 Jul 2014, [email protected] wrote:

From: Jani Nikula <[email protected]>

I wrote this as a quick hack patch to try as an alternative to [1] which ended up not working on Haswell. Please reassure me that this is going to be a temporary solution until we get a more generic interface between the audio and display drivers. I don't much like this, but at least it's isolated and small.

I'd like the commit message amended with something like:

"""
If the display power well has been disabled, the display audio controller divider values EM4 MVALUE and EM5 NVALUE will have been lost. The CDCLK frequency is required for reprogramming them. Provide a private interface for the audio driver to query CDCLK.

This is a stopgap solution until a more generic interface between audio and display drivers has been implemented.
"""

I'd also like to have an additional Reviewed-by from the i915 side. After that, I'm fine with merging this through alsa.

BR,
Jani.

[1] http://mid.gmane.org/[email protected]

Quoted 54 lines
drivers/gpu/drm/i915/intel_pm.c +21 -0
index a90fdbd..21170e5 100644
@@ -6256,6 +6256,27 @@ int i915_release_power_well(void)
 }
 EXPORT_SYMBOL_GPL(i915_release_power_well);
 
+/*
+ * Private interface for the audio driver to get CDCLK in kHz.
+ *
+ * Caller must request power well using i915_request_power_well() prior to
+ * making the call.
+ */
+int i915_get_cdclk_freq(void)
+{
+	struct drm_i915_private *dev_priv;
+
+	if (!hsw_pwr)
+		return -ENODEV;
+
+	dev_priv = container_of(hsw_pwr, struct drm_i915_private,
+				power_domains);
+
+	return intel_ddi_get_cdclk_freq(dev_priv);
+}
+EXPORT_SYMBOL_GPL(i915_get_cdclk_freq);
+
+
 #define POWER_DOMAIN_MASK (BIT(POWER_DOMAIN_NUM) - 1)
 
 #define HSW_ALWAYS_ON_POWER_DOMAINS (			\
include/drm/i915_powerwell.h +1 -0
index 2baba99..baa6f11 100644
@@ -32,5 +32,6 @@
 /* For use by hda_i915 driver */
 extern int i915_request_power_well(void);
 extern int i915_release_power_well(void);
+extern int i915_get_cdclk_freq(void);
 
 #endif				/* _I915_POWERWELL_H_ */
Signature · 6 lines
1.8.1.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
#2 lore raw

Hi Jani,

Quoted 9 lines

-----Original Message-----
From: Nikula, Jani
Sent: Thursday, July 03, 2014 3:33 PM

I wrote this as a quick hack patch to try as an alternative to [1] which ended up not working on Haswell. Please reassure me that this is going to be a temporary solution until we get a more generic interface between the audio and display drivers. I don't much like this, but at least it's isolated and small.

Sure. We'll clean up code when the generic interface is ready. This is only a temporary solution, safer than the BIOS notifications.

And would you like to further revise this patch?
But please keep this API not changed at the moment since the audio driver already queries the symbol name.

Thanks
Mengdong

Quoted 14 lines

I'd like the commit message amended with something like:

"""
If the display power well has been disabled, the display audio controller divider values EM4 MVALUE and EM5 NVALUE will have been lost. The CDCLK frequency is required for reprogramming them. Provide a private interface for the audio driver to query CDCLK.

This is a stopgap solution until a more generic interface between audio and display drivers has been implemented.
"""

I'd also like to have an additional Reviewed-by from the i915 side. After that, I'm fine with merging this through alsa.

#3 lore raw
Quoted 6 lines · Mengdong

Hi Jani,

Quoted 3 lines

-----Original Message-----
From: Nikula, Jani
Sent: Thursday, July 03, 2014 3:33 PM

Quoted 8 lines
Quoted 5 lines

I wrote this as a quick hack patch to try as an alternative to [1] which ended up not working on Haswell. Please reassure me that this is going to be a temporary solution until we get a more generic interface between the audio and display drivers. I don't much like this, but at least it's isolated and small.

Sure. We'll clean up code when the generic interface is ready. This is only a temporary solution, safer than the BIOS notifications.

Thanks.

Quoted 3 lines

And would you like to further revise this patch?
But please keep this API not changed at the moment since the audio driver already queries the symbol name.

Please just take over the patch, and amend the commit message along the lines of what I proposed. I think it's easiest if it gets merged through the alsa tree - you have a dependency on it and your changes are much bigger. The i915 changes are isolated and not expected to conflict.

But as I said, I'd like a Reviewed-by from another i915 developer first. I don't like to push/ack my own patches without review from others, no matter how small the patches.

Thanks,
Jani.

Quoted 18 lines

Thanks
Mengdong

Quoted 14 lines

I'd like the commit message amended with something like:

"""
If the display power well has been disabled, the display audio controller divider values EM4 MVALUE and EM5 NVALUE will have been lost. The CDCLK frequency is required for reprogramming them. Provide a private interface for the audio driver to query CDCLK.

This is a stopgap solution until a more generic interface between audio and display drivers has been implemented.
"""

I'd also like to have an additional Reviewed-by from the i915 side. After that, I'm fine with merging this through alsa.

Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Reviewed-by
#4 lore raw
In reply to Jani Nikula
Quoted 17 lines · Jani Nikula
Quoted 1 line · On Thu, 03 Jul 2014, [email protected] wrote:

From: Jani Nikula <[email protected]>

I wrote this as a quick hack patch to try as an alternative to [1] which ended up not working on Haswell. Please reassure me that this is going to be a temporary solution until we get a more generic interface between the audio and display drivers. I don't much like this, but at least it's isolated and small.

I'd like the commit message amended with something like:

"""
If the display power well has been disabled, the display audio controller divider values EM4 MVALUE and EM5 NVALUE will have been lost. The CDCLK frequency is required for reprogramming them. Provide a private interface for the audio driver to query CDCLK.

Quoted 6 lines

This is a stopgap solution until a more generic interface between audio and display drivers has been implemented.
"""

I'd also like to have an additional Reviewed-by from the i915 side. After that, I'm fine with merging this through alsa.

Sure.

Signature · 1 line
Damien
#5 lore raw
Quoted 34 lines

-----Original Message-----
From: Lespiau, Damien
Sent: Thursday, July 03, 2014 7:19 PM
To: Nikula, Jani
Cc: Lin, Mengdong; [email protected]; [email protected]; [email protected]
Subject: Re: [Intel-gfx] [PATCH v2 1/2] drm/i915: provide interface for audio driver to query cdclk

Quoted 17 lines · Jani Nikula
Quoted 1 line · On Thu, 03 Jul 2014, [email protected] wrote:

From: Jani Nikula <[email protected]>

I wrote this as a quick hack patch to try as an alternative to [1] which ended up not working on Haswell. Please reassure me that this is going to be a temporary solution until we get a more generic interface between the audio and display drivers. I don't much like this, but at least it's isolated and small.

I'd like the commit message amended with something like:

"""
If the display power well has been disabled, the display audio controller divider values EM4 MVALUE and EM5 NVALUE will have been lost. The CDCLK frequency is required for reprogramming them. Provide a private interface for the audio driver to query CDCLK.

Quoted 6 lines

This is a stopgap solution until a more generic interface between audio and display drivers has been implemented.
"""

I'd also like to have an additional Reviewed-by from the i915 side. After that, I'm fine with merging this through alsa.

Quoted 6 lines

Sure.

--
Damien

Thank you, Jani and Damien!

I'll add the comment message and submit the revised patch tomorrow.

Regards
Mengdong

#6 lore raw

PATCH v3 1/2 drm/i915: provide interface for audio driver to query cdclk

In reply to [email protected]

From: Jani Nikula <[email protected]>

For Haswell and Broadwell, if the display power well has been disabled, the display audio controller divider values EM4 M VALUE and EM5 N VALUE will have been lost. The CDCLK frequency is required for reprogramming them to generate 24MHz HD-A link BCLK. So provide a private interface for the audio driver to query CDCLK.

This is a stopgap solution until a more generic interface between audio and display drivers has been implemented.

drivers/gpu/drm/i915/intel_pm.c +21 -0
index a90fdbd..21170e5 100644
@@ -6256,6 +6256,27 @@ int i915_release_power_well(void)
 }
 EXPORT_SYMBOL_GPL(i915_release_power_well);
 
+/*
+ * Private interface for the audio driver to get CDCLK in kHz.
+ *
+ * Caller must request power well using i915_request_power_well() prior to
+ * making the call.
+ */
+int i915_get_cdclk_freq(void)
+{
+	struct drm_i915_private *dev_priv;
+
+	if (!hsw_pwr)
+		return -ENODEV;
+
+	dev_priv = container_of(hsw_pwr, struct drm_i915_private,
+				power_domains);
+
+	return intel_ddi_get_cdclk_freq(dev_priv);
+}
+EXPORT_SYMBOL_GPL(i915_get_cdclk_freq);
+
+
 #define POWER_DOMAIN_MASK (BIT(POWER_DOMAIN_NUM) - 1)
 
 #define HSW_ALWAYS_ON_POWER_DOMAINS (			\
include/drm/i915_powerwell.h +1 -0
index 2baba99..baa6f11 100644
@@ -32,5 +32,6 @@
 /* For use by hda_i915 driver */
 extern int i915_request_power_well(void);
 extern int i915_release_power_well(void);
+extern int i915_get_cdclk_freq(void);
 
 #endif				/* _I915_POWERWELL_H_ */
Signature · 1 line
1.8.1.2
Applied
#7 lore raw

At Fri, 4 Jul 2014 10:00:37 +0800,

Quoted 9 lines · [email protected] wrote:

From: Jani Nikula <[email protected]>

For Haswell and Broadwell, if the display power well has been disabled, the display audio controller divider values EM4 M VALUE and EM5 N VALUE will have been lost. The CDCLK frequency is required for reprogramming them to generate 24MHz HD-A link BCLK. So provide a private interface for the audio driver to query CDCLK.

Quoted 6 lines

This is a stopgap solution until a more generic interface between audio and display drivers has been implemented.

Thanks, applied (with Cc to stable).

Takashi

Quoted 47 lines
drivers/gpu/drm/i915/intel_pm.c +21 -0
index a90fdbd..21170e5 100644
@@ -6256,6 +6256,27 @@ int i915_release_power_well(void)
 }
 EXPORT_SYMBOL_GPL(i915_release_power_well);
 
+/*
+ * Private interface for the audio driver to get CDCLK in kHz.
+ *
+ * Caller must request power well using i915_request_power_well() prior to
+ * making the call.
+ */
+int i915_get_cdclk_freq(void)
+{
+	struct drm_i915_private *dev_priv;
+
+	if (!hsw_pwr)
+		return -ENODEV;
+
+	dev_priv = container_of(hsw_pwr, struct drm_i915_private,
+				power_domains);
+
+	return intel_ddi_get_cdclk_freq(dev_priv);
+}
+EXPORT_SYMBOL_GPL(i915_get_cdclk_freq);
+
+
 #define POWER_DOMAIN_MASK (BIT(POWER_DOMAIN_NUM) - 1)
 
 #define HSW_ALWAYS_ON_POWER_DOMAINS (			\
include/drm/i915_powerwell.h +1 -0
index 2baba99..baa6f11 100644
@@ -32,5 +32,6 @@
 /* For use by hda_i915 driver */
 extern int i915_request_power_well(void);
 extern int i915_release_power_well(void);
+extern int i915_get_cdclk_freq(void);
 
 #endif				/* _I915_POWERWELL_H_ */
Signature · 1 line
1.8.1.2