All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keith Packard <keithp@keithp.com>
To: Wu Fengguang <fengguang.wu@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>,
	"intel-gfx@lists.freedesktop..."
	<intel-gfx@lists.freedesktop.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Michal Marek <mmarek@suse.com>,
	Robert Lemaire <rlemaire@suse.com>
Subject: Re: [PATCH] drm/i915: set AUD_CONFIG N_value_index for DisplayPort
Date: Mon, 16 Jan 2012 15:15:13 -0800	[thread overview]
Message-ID: <86d3ajgry6.fsf@sumi.keithp.com> (raw)
In-Reply-To: <20120116230809.GA7837@localhost>


[-- Attachment #1.1: Type: text/plain, Size: 3775 bytes --]

On Tue, 17 Jan 2012 07:08:09 +0800, Wu Fengguang <fengguang.wu@intel.com> wrote:
> On Mon, Jan 16, 2012 at 12:44:43PM -0800, Keith Packard wrote:
> > On Mon, 16 Jan 2012 21:26:18 +0100, Daniel Vetter <daniel@ffwll.ch> wrote:
> > 
> > > Keith, does this address your concern and this patch is r-b: Keith or do
> > > we want an
> > > 
> > > } else {
> > > 	I915_WRITE(aud_config, 0);
> > > }
> > > 
> > > for paranoia?
> > 
> > I think we want this added, just to be sure we set the configuration
> > correctly in all cases; it's easy to imagine moving from DP to HDMI and
> > leaving this bit set.
> 
> Ah good point! Here is the updated patch.
> 
> ---
> Subject: drm/i915: set AUD_CONFIG N_value_index for DisplayPort
> Date: Fri Jan 06 14:41:31 CST 2012
> 
> It should be programmed to "0" for HDMI or "1" for DisplayPort.
> 
> This enables DisplayPort audio for
> 
> - HP EliteBook 8460p
>   (whose BIOS does not set the N_value_index bit for us)
> 
> - DisplayPort monitor hot plugged after boot
>   (otherwise most BIOS will fill the N_value_index bit for us)
> 
> Tested-by: Robert Lemaire <rlemaire@suse.com>
> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>

Reviewed-by: Keith Packard <keithp@keithp.com>

> ---
>  drivers/gpu/drm/i915/i915_reg.h      |   12 ++++++++++++
>  drivers/gpu/drm/i915/intel_display.c |    8 +++++++-
>  2 files changed, 19 insertions(+), 1 deletion(-)
> 
> --- linux.orig/drivers/gpu/drm/i915/i915_reg.h	2012-01-07 23:11:10.000000000 +0800
> +++ linux/drivers/gpu/drm/i915/i915_reg.h	2012-01-10 13:20:17.000000000 +0800
> @@ -3582,4 +3582,16 @@
>  #define CPT_AUD_CNTL_ST_A		0xE50B4
>  #define CPT_AUD_CNTRL_ST2		0xE50C0
>  
> +#define IBX_AUD_CONFIG_A			0xe2000
> +#define CPT_AUD_CONFIG_A			0xe5000
> +#define   AUD_CONFIG_N_VALUE_INDEX		(1 << 29)
> +#define   AUD_CONFIG_N_PROG_ENABLE		(1 << 28)
> +#define   AUD_CONFIG_UPPER_N_SHIFT		20
> +#define   AUD_CONFIG_UPPER_N_VALUE		(0xff << 20)
> +#define   AUD_CONFIG_LOWER_N_SHIFT		4
> +#define   AUD_CONFIG_LOWER_N_VALUE		(0xfff << 4)
> +#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_SHIFT	16
> +#define   AUD_CONFIG_PIXEL_CLOCK_HDMI		(0xf << 16)
> +#define   AUD_CONFIG_DISABLE_NCTS		(1 << 3)
> +
>  #endif /* _I915_REG_H_ */
> --- linux.orig/drivers/gpu/drm/i915/intel_display.c	2012-01-07 23:11:10.000000000 +0800
> +++ linux/drivers/gpu/drm/i915/intel_display.c	2012-01-17 07:06:29.000000000 +0800
> @@ -5908,15 +5908,18 @@ static void ironlake_write_eld(struct dr
>  	uint32_t i;
>  	int len;
>  	int hdmiw_hdmiedid;
> +	int aud_config;
>  	int aud_cntl_st;
>  	int aud_cntrl_st2;
>  
>  	if (HAS_PCH_IBX(connector->dev)) {
>  		hdmiw_hdmiedid = IBX_HDMIW_HDMIEDID_A;
> +		aud_config = IBX_AUD_CONFIG_A;
>  		aud_cntl_st = IBX_AUD_CNTL_ST_A;
>  		aud_cntrl_st2 = IBX_AUD_CNTL_ST2;
>  	} else {
>  		hdmiw_hdmiedid = CPT_HDMIW_HDMIEDID_A;
> +		aud_config = CPT_AUD_CONFIG_A;
>  		aud_cntl_st = CPT_AUD_CNTL_ST_A;
>  		aud_cntrl_st2 = CPT_AUD_CNTRL_ST2;
>  	}
> @@ -5924,6 +5927,7 @@ static void ironlake_write_eld(struct dr
>  	i = to_intel_crtc(crtc)->pipe;
>  	hdmiw_hdmiedid += i * 0x100;
>  	aud_cntl_st += i * 0x100;
> +	aud_config += i * 0x100;
>  
>  	DRM_DEBUG_DRIVER("ELD on pipe %c\n", pipe_name(i));
>  
> @@ -5943,7 +5947,9 @@ static void ironlake_write_eld(struct dr
>  	if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) {
>  		DRM_DEBUG_DRIVER("ELD: DisplayPort detected\n");
>  		eld[5] |= (1 << 2);	/* Conn_Type, 0x1 = DisplayPort */
> -	}
> +		I915_WRITE(aud_config, AUD_CONFIG_N_VALUE_INDEX); /* 0x1 = DP */
> +	} else
> +		I915_WRITE(aud_config, 0);
>  
>  	if (intel_eld_uptodate(connector,
>  			       aud_cntrl_st2, eldv,

-- 
keith.packard@intel.com

[-- Attachment #1.2: Type: application/pgp-signature, Size: 827 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Keith Packard <keithp@keithp.com>
To: Wu Fengguang <fengguang.wu@intel.com>
Cc: Daniel Vetter <daniel@ffwll.ch>, Takashi Iwai <tiwai@suse.de>,
	"intel-gfx\@lists.freedesktop..."
	<intel-gfx@lists.freedesktop.org>, Michal Marek <mmarek@suse.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Robert Lemaire <rlemaire@suse.com>
Subject: Re: [Intel-gfx] [PATCH] drm/i915: set AUD_CONFIG N_value_index for DisplayPort
Date: Mon, 16 Jan 2012 15:15:13 -0800	[thread overview]
Message-ID: <86d3ajgry6.fsf@sumi.keithp.com> (raw)
In-Reply-To: <20120116230809.GA7837@localhost>

[-- Attachment #1: Type: text/plain, Size: 3775 bytes --]

On Tue, 17 Jan 2012 07:08:09 +0800, Wu Fengguang <fengguang.wu@intel.com> wrote:
> On Mon, Jan 16, 2012 at 12:44:43PM -0800, Keith Packard wrote:
> > On Mon, 16 Jan 2012 21:26:18 +0100, Daniel Vetter <daniel@ffwll.ch> wrote:
> > 
> > > Keith, does this address your concern and this patch is r-b: Keith or do
> > > we want an
> > > 
> > > } else {
> > > 	I915_WRITE(aud_config, 0);
> > > }
> > > 
> > > for paranoia?
> > 
> > I think we want this added, just to be sure we set the configuration
> > correctly in all cases; it's easy to imagine moving from DP to HDMI and
> > leaving this bit set.
> 
> Ah good point! Here is the updated patch.
> 
> ---
> Subject: drm/i915: set AUD_CONFIG N_value_index for DisplayPort
> Date: Fri Jan 06 14:41:31 CST 2012
> 
> It should be programmed to "0" for HDMI or "1" for DisplayPort.
> 
> This enables DisplayPort audio for
> 
> - HP EliteBook 8460p
>   (whose BIOS does not set the N_value_index bit for us)
> 
> - DisplayPort monitor hot plugged after boot
>   (otherwise most BIOS will fill the N_value_index bit for us)
> 
> Tested-by: Robert Lemaire <rlemaire@suse.com>
> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>

Reviewed-by: Keith Packard <keithp@keithp.com>

> ---
>  drivers/gpu/drm/i915/i915_reg.h      |   12 ++++++++++++
>  drivers/gpu/drm/i915/intel_display.c |    8 +++++++-
>  2 files changed, 19 insertions(+), 1 deletion(-)
> 
> --- linux.orig/drivers/gpu/drm/i915/i915_reg.h	2012-01-07 23:11:10.000000000 +0800
> +++ linux/drivers/gpu/drm/i915/i915_reg.h	2012-01-10 13:20:17.000000000 +0800
> @@ -3582,4 +3582,16 @@
>  #define CPT_AUD_CNTL_ST_A		0xE50B4
>  #define CPT_AUD_CNTRL_ST2		0xE50C0
>  
> +#define IBX_AUD_CONFIG_A			0xe2000
> +#define CPT_AUD_CONFIG_A			0xe5000
> +#define   AUD_CONFIG_N_VALUE_INDEX		(1 << 29)
> +#define   AUD_CONFIG_N_PROG_ENABLE		(1 << 28)
> +#define   AUD_CONFIG_UPPER_N_SHIFT		20
> +#define   AUD_CONFIG_UPPER_N_VALUE		(0xff << 20)
> +#define   AUD_CONFIG_LOWER_N_SHIFT		4
> +#define   AUD_CONFIG_LOWER_N_VALUE		(0xfff << 4)
> +#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_SHIFT	16
> +#define   AUD_CONFIG_PIXEL_CLOCK_HDMI		(0xf << 16)
> +#define   AUD_CONFIG_DISABLE_NCTS		(1 << 3)
> +
>  #endif /* _I915_REG_H_ */
> --- linux.orig/drivers/gpu/drm/i915/intel_display.c	2012-01-07 23:11:10.000000000 +0800
> +++ linux/drivers/gpu/drm/i915/intel_display.c	2012-01-17 07:06:29.000000000 +0800
> @@ -5908,15 +5908,18 @@ static void ironlake_write_eld(struct dr
>  	uint32_t i;
>  	int len;
>  	int hdmiw_hdmiedid;
> +	int aud_config;
>  	int aud_cntl_st;
>  	int aud_cntrl_st2;
>  
>  	if (HAS_PCH_IBX(connector->dev)) {
>  		hdmiw_hdmiedid = IBX_HDMIW_HDMIEDID_A;
> +		aud_config = IBX_AUD_CONFIG_A;
>  		aud_cntl_st = IBX_AUD_CNTL_ST_A;
>  		aud_cntrl_st2 = IBX_AUD_CNTL_ST2;
>  	} else {
>  		hdmiw_hdmiedid = CPT_HDMIW_HDMIEDID_A;
> +		aud_config = CPT_AUD_CONFIG_A;
>  		aud_cntl_st = CPT_AUD_CNTL_ST_A;
>  		aud_cntrl_st2 = CPT_AUD_CNTRL_ST2;
>  	}
> @@ -5924,6 +5927,7 @@ static void ironlake_write_eld(struct dr
>  	i = to_intel_crtc(crtc)->pipe;
>  	hdmiw_hdmiedid += i * 0x100;
>  	aud_cntl_st += i * 0x100;
> +	aud_config += i * 0x100;
>  
>  	DRM_DEBUG_DRIVER("ELD on pipe %c\n", pipe_name(i));
>  
> @@ -5943,7 +5947,9 @@ static void ironlake_write_eld(struct dr
>  	if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) {
>  		DRM_DEBUG_DRIVER("ELD: DisplayPort detected\n");
>  		eld[5] |= (1 << 2);	/* Conn_Type, 0x1 = DisplayPort */
> -	}
> +		I915_WRITE(aud_config, AUD_CONFIG_N_VALUE_INDEX); /* 0x1 = DP */
> +	} else
> +		I915_WRITE(aud_config, 0);
>  
>  	if (intel_eld_uptodate(connector,
>  			       aud_cntrl_st2, eldv,

-- 
keith.packard@intel.com

[-- Attachment #2: Type: application/pgp-signature, Size: 827 bytes --]

  reply	other threads:[~2012-01-16 23:15 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-09 13:17 [PATCH] drm/i915: set AUD_CONFIG N_value_index for DisplayPort Wu Fengguang
2012-01-09 13:17 ` Wu Fengguang
2012-01-09 17:22 ` Keith Packard
2012-01-09 17:22   ` Keith Packard
2012-01-10  5:45   ` Wu Fengguang
2012-01-12 17:33     ` Keith Packard
2012-01-12 17:33       ` Keith Packard
2012-01-16  8:02       ` Wu Fengguang
2012-01-16  8:02         ` Wu Fengguang
2012-01-16 20:26         ` Daniel Vetter
2012-01-16 20:26           ` [Intel-gfx] " Daniel Vetter
2012-01-16 20:44           ` Keith Packard
2012-01-16 20:44             ` Keith Packard
2012-01-16 23:08             ` Wu Fengguang
2012-01-16 23:15               ` Keith Packard [this message]
2012-01-16 23:15                 ` Keith Packard
2012-01-17 10:22               ` Daniel Vetter
2012-01-29  4:44                 ` [PATCH][rebased] " Wu Fengguang
2012-01-29  4:44                   ` Wu Fengguang
2012-01-29 12:12                   ` Daniel Vetter
2012-01-29 12:12                     ` Daniel Vetter
2012-01-29 13:23                     ` Wu Fengguang
2012-01-29 13:23                       ` Wu Fengguang
2012-01-29 15:14                       ` Daniel Vetter
2012-01-29 15:14                         ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86d3ajgry6.fsf@sumi.keithp.com \
    --to=keithp@keithp.com \
    --cc=fengguang.wu@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.com \
    --cc=rlemaire@suse.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.