Re: [Intel-gfx] i915, HDMI/DP audio with multiple monitors

2018-09-12 Thread Yang, Libin

>-Original Message-
>From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
>Sent: Thursday, September 13, 2018 1:47 AM
>To: Bruno Prémont 
>Cc: intel-gfx@lists.freedesktop.org; dri-de...@lists.freedesktop.org; Takashi
>Iwai ; alsa-de...@alsa-project.org; Yang, Libin
>
>Subject: Re: i915, HDMI/DP audio with multiple monitors
>
>On Tue, Sep 11, 2018 at 03:50:13PM +0200, Bruno Prémont wrote:
>> Hi,
>>
>> I have a system with multiple monitors and would like to send
>> notification sounds to the monitor on which corresponding window is
>> visible.

This requirement is reasonable :)

>>
>> For a workstation and a tiny computer things look different:
>> - workstation (Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz):
>>  00:02.0 VGA compatible controller [0300]: Intel Corporation Xeon
>> E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller
>> [8086:0412] (rev 06)
>>  00:03.0 Audio device [0403]: Intel Corporation Xeon E3-1200 v3/4th
>> Gen Core Processor HD Audio Controller [8086:0c0c] (rev 06)
>>  00:1b.0 Audio device [0403]: Intel Corporation 8 Series/C220 Series
>> Chipset High Definition Audio Controller [8086:8c20] (rev 04)
>>
>>  Here alsa show me two cards:
>>  - HDA Intel PCH (Realtek ALC671)
>>  - HDA Intel HDMI (Intel Generic)
>>
>>   List of PLAYBACK Hardware Devices   card 0: HDMI [HDA Intel
>> HDMI], device 3: Generic Digital [Generic Digital]
>>Subdevices: 1/1
>>Subdevice #0: subdevice #0
>
>There should normally be multiple HDMI devices (one for each HDMI/DP
>connector more or less). Eg. my hsw shows:
>
>card 0: HDMI [HDA Intel HDMI], device 3: HDMI 0 [HDMI 0]
>  Subdevices: 1/1
>  Subdevice #0: subdevice #0
>card 0: HDMI [HDA Intel HDMI], device 7: HDMI 1 [HDMI 1]
>  Subdevices: 1/1
>  Subdevice #0: subdevice #0
>
>Looking at the hda_codec.c we see:
> static int audio_idx[HDA_PCM_NTYPES][5] = { ...
>[HDA_PCM_TYPE_HDMI]  = { 3, 7, 8, 9, -1 },
>
>So you always get those device numbers, but I don't see an immediate
>relationship between those and the pin numbers (which do have some kind of
>relationship with the HDMI/DP port). I guess if they always get registered in
>order of the pin numbers then those would translate to 3 == port B, 7 == port
>C, etc. And after that the problem is figuring out which port is related to 
>which
>connector, for which we have nothing at the moment.
>
>I suppose the ideal solution might be to have a sysfs symlink (or
>something) to connect the two together.
>
>But then there's MST where I think the pcm device correlates with the crtc
>rather than the connector. Maybe. I can't remember anymore, and I'm not
>sure it even works (I've recently heard people saying it doesn't).

Ville is right. For NON-MST (PCM static assignment), the PCM & PORT 
mapping is simple and static.

For DP-MST (PCM dynamic assignment), it is a little complicated. In HDMI
audio driver, the per_pin saves all the information. 
1. PORT info: per_pin->pin_nid is related to the PORT information. 
The mapping information is showed in hdmi audio driver function 
intel_pin_eld_notify(). 
2. PCM info: we can get the PCM with per_pin->pcm_idx.

With these information, we can tell which PCM is mapped to which PORT.

The audio driver can export such information to user space (No sure 
if such information is already exported.). And user space, such as 
pulseaudio and so on, can use such information automatically choose 
which PCM to playback corresponding to the monitor 
which active window is in. 

Regards,
Libin

>
>>  card 1: PCH [HDA Intel PCH], device 0: ALC671 Analog [ALC671 Analog]
>>Subdevices: 1/1
>>Subdevice #0: subdevice #0
>>
>>
>> - tiny computer (Intel(R) Core(TM) i5-6500T CPU @ 2.50GHz):
>>  00:02.0 VGA compatible controller [0300]: Intel Corporation HD
>> Graphics 530 [8086:1912] (rev 06)
>>  00:1f.3 Audio device [0403]: Intel Corporation Sunrise Point-H HD
>> Audio [8086:a170] (rev 31)
>>
>>  Here alsa shows a single card:
>>  - HDA Intel PCH (Realtek ALC671)
>>
>>   List of PLAYBACK Hardware Devices   card 0: PCH [HDA Intel
>> PCH], device 0: ALC671 Analog [ALC671 Analog]
>>Subdevices: 1/1
>>Subdevice #0: subdevice #0
>>  card 0: PCH [HDA Intel PCH], device 3: Generic Digital [Generic Digital]
>>Subdevices: 1/1
>>Subdevice #0: subdevice #0
>>
>>
>> How can I determine/set to which monitor the sound should go, and
>> preferably send different sounds to both monitors at same time?
>>
>>
>> Cheers,
>> Bruno
>> ___
>> dri-devel mailing list
>> dri-de...@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
>--
>Ville Syrjälä
>Intel
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915/audio: do not set Maud/Naud values manually on KBL

2018-02-10 Thread Yang, Libin

>-Original Message-
>From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org] On Behalf Of
>Rodrigo Vivi
>Sent: Wednesday, February 7, 2018 2:35 AM
>To: Nikula, Jani 
>Cc: Zhang, Keqiao ; Liu, Alice ;
>intel-gfx@lists.freedesktop.org; Cui, YuepingX ; # v4 .
>10+ ; Wang Zhijun ; Libin
>Yang 
>Subject: Re: [Intel-gfx] [PATCH] drm/i915/audio: do not set Maud/Naud values
>manually on KBL
>
>On Tue, Feb 06, 2018 at 11:49:18AM +, Jani Nikula wrote:
>> Apparently using the manual Maud/Naud mode does not work on KBL. The
>> details on the failure mode are scarce, except that there's no audio,
>> and there is obviously no idea on the root cause either. It is also
>> unknown whether the failure can be reproduced on newer platforms in
>> some scenarios.
>>
>> The problem was introduced when switching from automatic mode to
>> manual mode in commit 6014ac122ed0 ("drm/i915/audio: set proper N/M
>in
>> modeset"). Instead of reverting that, disable the feature on KBL as a
>> workaround.
>>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104093
>> Reported-by: Quanxian Wang 
>> Fixes: 6014ac122ed0 ("drm/i915/audio: set proper N/M in modeset")
>> Cc:  # v4.10+
>> Cc: Keqiao Zhang 
>> Cc: Ville Syrjälä 
>> Cc: Mengdong Lin 
>> Cc: Libin Yang 
>> Cc: Rodrigo Vivi 
>> Cc: Quanxian Wang 
>> Cc: Wang Zhijun 
>> Cc: Cui Yueping 
>> Cc: Alice Liu 
>> Cc: intel-gfx@lists.freedesktop.org
>> Signed-off-by: Jani Nikula 
>>
>> ---
>>
>> UNTESTED. Please provide Tested-by's on the affected KBLs, but *also*
>> on CFL, CNL, etc.
>> ---
>>  drivers/gpu/drm/i915/intel_audio.c | 11 +--
>>  1 file changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_audio.c
>> b/drivers/gpu/drm/i915/intel_audio.c
>> index 522d54fecb53..b7634cff12b6 100644
>> --- a/drivers/gpu/drm/i915/intel_audio.c
>> +++ b/drivers/gpu/drm/i915/intel_audio.c
>> @@ -294,12 +294,19 @@ hsw_dp_audio_config_update(struct
>intel_encoder *encoder,
>>  struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
>>  enum port port = encoder->port;
>>  enum pipe pipe = crtc->pipe;
>> -const struct dp_aud_n_m *nm;
>> +const struct dp_aud_n_m *nm = NULL;
>>  int rate;
>>  u32 tmp;
>>
>>  rate = acomp ? acomp->aud_sample_rate[port] : 0;
>> -nm = audio_config_dp_get_n_m(crtc_state, rate);
>> +
>> +/*
>> + * FIXME: For reasons still unknown, there seem to be issues with the
>> + * manual Maud/Naud mode on KBL.
>> + */
>> +if (!IS_KABYLAKE(dev_priv))
>
>Hmm... not much visibility on the audio gap between KBL and CFL.
>But on our side I believe we should also apply it for CFL.
>
>I wonder if some bugs audio guys are hunting now on CNL and ICL could also
>be related to it.

I'm wondering whether the later new platforms will have the same
behavior with KBL. If it is true, maybe we should use
+  if (need_manual_nm())

Let wait and see the later platforms behavior.

Regards,
Libin

>
>Isn't revert the original an option?
>
>> +nm = audio_config_dp_get_n_m(crtc_state, rate);
>> +
>>  if (nm)
>>  DRM_DEBUG_KMS("using Maud %u, Naud %u\n", nm->m,
>nm->n);
>>  else
>> --
>> 2.11.0
>>
>___
>Intel-gfx mailing list
>Intel-gfx@lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/intel-gfx
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] HDMI audio to support extcon

2017-05-15 Thread Yang, Libin

>-Original Message-
>From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of Daniel Vetter
>Sent: Monday, May 15, 2017 9:49 PM
>To: Yang, Libin <libin.y...@intel.com>
>Cc: Vetter, Daniel <daniel.vet...@intel.com>; Bossart, Pierre-louis louis.boss...@intel.com>; jani.nik...@linux.intel.com; intel-
>g...@lists.freedesktop.org; Girdwood, Liam R <liam.r.girdw...@intel.com>;
>DRI Development <dri-de...@lists.freedesktop.org>
>Subject: Re: [Intel-gfx] HDMI audio to support extcon
>
>Adding dri-devel.
>
>On Mon, May 15, 2017 at 08:16:44AM +, Yang, Libin wrote:
>> Hi Daniel,
>>
>> >-Original Message-
>> >From: Vetter, Daniel
>> >Sent: Friday, May 12, 2017 2:06 AM
>> >To: Bossart, Pierre-louis <pierre-louis.boss...@intel.com>; Yang,
>> >Libin <libin.y...@intel.com>; jani.nik...@linux.intel.com
>> >Cc: Girdwood, Liam R <liam.r.girdw...@intel.com>; Lin, Mengdong
>> ><mengdong....@intel.com>
>> >Subject: Re: HDMI audio to support extcon
>> >
>> >On Thu, 2017-05-11 at 11:13 -0500, Pierre-louis Bossart wrote:
>> >> On 5/11/17 9:41 AM, Yang, Libin wrote:
>> >> > > -Original Message-
>> >> > > From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
>> >> > > Sent: Thursday, May 11, 2017 4:29 PM
>> >> > > To: Yang, Libin <libin.y...@intel.com>; Vetter, Daniel
>> >> > > <daniel.vet...@intel.com>
>> >> > > Cc: Bossart, Pierre-louis <pierre-louis.boss...@intel.com>;
>> >> > > Lin, Mengdong <mengdong@intel.com>; Girdwood, Liam R
>> >> > > <liam.r.girdwood@intel .com>
>> >> > > Subject: Re: HDMI audio to support extcon
>> >> > >
>> >> > > On Thu, 11 May 2017, "Yang, Libin" <libin.y...@intel.com> wrote:
>> >> > > > Hi Daniel & Jani,
>> >> > > >
>> >> > > > Currently Pierre and I are trying to enabling extcon for HDMI
>> >> > > > audio, which
>> >> > >
>> >> > > will be used in Android for the hotplug event notification.
>> >> > >
>> >> > > What's "extcon"?
>> >> >
>> >> > Extcon is used by kernel to communicate with userspace. It tries
>> >> > to replace switch class (switch class is a legacy method to
>> >> > communicate with userspace in Android). The code is located in
>> >> > drivers/extcon/*
>> >>
>> >> Most Android kernels are ancient (3.10 to 3.18) and use an
>> >> Android-specific switch class implemented in the kernel, the
>> >> uevents are then used by AOSP to enable HDMI outputs. See
>> >>
>> >https://android.googlesource.com/platform/frameworks/base/+/0e2d281
>/s
>> >> ervices/java/com/android/server/WiredAccessoryManager.java#348
>> >>
>> >> For Android-IA we are using 4.9 and we'd like to move forward with
>> >> the extcon solution which part of the mainline kernel. The extcon
>> >> api relies on a registration and a state which set/unset when the
>> >> external device is hot-plugged/removed. The change in state
>> >> generates the uevents required by Android.When the CONFIG_ANDROID
>> >> is defined, the kernel creates a /sys/class/switch symlink which is
>> >> backwards compatible with what Android can parse.
>> >>
>> >> The question is where do we put the extcon registration 1. in the
>> >> i915 code (e.g. in intel_codec_enable()/disable()) 2. in the
>> >> HDaudio and LPEaudio code (two locations to maintain)
>> >>
>> >> Ideally we'd like to add information on ports to userspace so that
>> >> multiple outputs can be enabled. Currently Android can only support
>> >> one output since it doesn't get additional information.
>> >>
>> >> Does this help frame the problem statement?
>> >
>> >Yay for reinventing wheels in Android I guess (we have hotplug
>> >notifications since forever in drm ofc), but so be it. I think the
>> >right way to do this is to wire this into the generic drm output
>> >probe helpers in drm_probe_helpers.c, perhaps filtered to only handle
>HDMI (or whatever it is Android wants).
>>
>> The extcon implementation may be related to our hardware. For example,
>> it depends on the DDI port number and audio capability. I'm

Re: [Intel-gfx] HDMI audio to support extcon

2017-05-15 Thread Yang, Libin
Hi Daniel,

>-Original Message-
>From: Vetter, Daniel
>Sent: Friday, May 12, 2017 2:06 AM
>To: Bossart, Pierre-louis <pierre-louis.boss...@intel.com>; Yang, Libin
><libin.y...@intel.com>; jani.nik...@linux.intel.com
>Cc: Girdwood, Liam R <liam.r.girdw...@intel.com>; Lin, Mengdong
><mengdong@intel.com>
>Subject: Re: HDMI audio to support extcon
>
>On Thu, 2017-05-11 at 11:13 -0500, Pierre-louis Bossart wrote:
>> On 5/11/17 9:41 AM, Yang, Libin wrote:
>> > > -Original Message-
>> > > From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
>> > > Sent: Thursday, May 11, 2017 4:29 PM
>> > > To: Yang, Libin <libin.y...@intel.com>; Vetter, Daniel
>> > > <daniel.vet...@intel.com>
>> > > Cc: Bossart, Pierre-louis <pierre-louis.boss...@intel.com>; Lin,
>> > > Mengdong <mengdong....@intel.com>; Girdwood, Liam R
>> > > <liam.r.girdwood@intel .com>
>> > > Subject: Re: HDMI audio to support extcon
>> > >
>> > > On Thu, 11 May 2017, "Yang, Libin" <libin.y...@intel.com> wrote:
>> > > > Hi Daniel & Jani,
>> > > >
>> > > > Currently Pierre and I are trying to enabling extcon for HDMI
>> > > > audio, which
>> > >
>> > > will be used in Android for the hotplug event notification.
>> > >
>> > > What's "extcon"?
>> >
>> > Extcon is used by kernel to communicate with userspace. It tries to
>> > replace switch class (switch class is a legacy method to communicate
>> > with userspace in Android). The code is located in drivers/extcon/*
>>
>> Most Android kernels are ancient (3.10 to 3.18) and use an
>> Android-specific switch class implemented in the kernel, the uevents
>> are then used by AOSP to enable HDMI outputs. See
>>
>https://android.googlesource.com/platform/frameworks/base/+/0e2d281/s
>> ervices/java/com/android/server/WiredAccessoryManager.java#348
>>
>> For Android-IA we are using 4.9 and we'd like to move forward with the
>> extcon solution which part of the mainline kernel. The extcon api
>> relies on a registration and a state which set/unset when the external
>> device is hot-plugged/removed. The change in state generates the
>> uevents required by Android.When the CONFIG_ANDROID is defined, the
>> kernel creates a /sys/class/switch symlink which is backwards
>> compatible with what Android can parse.
>>
>> The question is where do we put the extcon registration 1. in the i915
>> code (e.g. in intel_codec_enable()/disable()) 2. in the HDaudio and
>> LPEaudio code (two locations to maintain)
>>
>> Ideally we'd like to add information on ports to userspace so that
>> multiple outputs can be enabled. Currently Android can only support
>> one output since it doesn't get additional information.
>>
>> Does this help frame the problem statement?
>
>Yay for reinventing wheels in Android I guess (we have hotplug notifications
>since forever in drm ofc), but so be it. I think the right way to do this is 
>to wire
>this into the generic drm output probe helpers in drm_probe_helpers.c,
>perhaps filtered to only handle HDMI (or whatever it is Android wants).

The extcon implementation may be related to our hardware. For example,
it depends on the DDI port number and audio capability. I'm not sure
it is OK to implement it in drm level.

Regards,
Libin

>
>So now we'll have drm uevent -> extcon -> android switch class compat
>multilayer. Impressive bikeshed :-) -Daniel
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915/audio: not to set N/M value manually for KBL.

2017-04-04 Thread Yang, Libin
Hi Quanxian,

>-Original Message-
>From: Wang, Quanxian
>Sent: Wednesday, April 5, 2017 10:21 AM
>To: Jani Nikula <jani.nik...@linux.intel.com>; intel-gfx@lists.freedesktop.org
>Cc: Yang, Libin <libin.y...@intel.com>
>Subject: RE: [Intel-gfx] [PATCH] drm/i915/audio: not to set N/M value
>manually for KBL.
>
>Sorry, I don't find them in bspec. With our testing, SKL/APL works and KBL
>failed.
>
>The commit 6014ac122ed081feca99217bc57b2e15c7fc1a51 mentioned  should
>not do testing on KBL DP audio.
>
>We found the issue in the testing for Ubuntu latest release 17.04. (Almost
>upstream)
>
>But really I don't know the root cause.
>
>Also I have mentioned in commit, for general process of DP audio in bspec,
>transcoder should be restart to make it.
> But no code to do that. Also I don't know why driver doesn't implement that.

Please see my another email. I explained the reason on it. And I strongly 
suggest
you doing all the resolution and audio format playback test. We did find some
resolution and audio format will fail on the auto setting of N/M.

Regards,
Libin

>
>-Original Message-
>From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
>Sent: Tuesday, April 4, 2017 6:55 PM
>To: Wang, Quanxian <quanxian.w...@intel.com>; intel-
>g...@lists.freedesktop.org
>Cc: Yang, Libin <libin.y...@intel.com>
>Subject: Re: [Intel-gfx] [PATCH] drm/i915/audio: not to set N/M value
>manually for KBL.
>
>On Sat, 01 Apr 2017, Quanxian Wang <quanxian.w...@intel.com> wrote:
>> It doesn't work on KBL. Just using automatic N/M.
>
>Please provide a more elaborate commit message. In particular, have a look at
>
>commit 6014ac122ed081feca99217bc57b2e15c7fc1a51
>Author: Libin Yang <libin.y...@linux.intel.com>
>Date:   Tue Oct 25 17:54:18 2016 +0300
>
>drm/i915/audio: set proper N/M in modeset
>
>and explain why that doesn't apply to KBL. And why just KBL, why not others?
>
>> According to the bspec, when set N/M, should disable and enable
>> transcoder which attaching DP audio. but there is no such code to do
>> that.
>> without this implementation except KBL platforms, seems work well.
>>
>> Signed-off-by: Quanxian Wang <quanxian.w...@intel.com>
>> Tested-By: Wang Zhijun<zhijunx.w...@intel.com>
>> Tested-By: Cui Yueping<yuepingx@intel.com>
>> ---
>>  drivers/gpu/drm/i915/intel_audio.c | 5 -
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_audio.c
>> b/drivers/gpu/drm/i915/intel_audio.c
>> index 52c207e..0542031 100644
>> --- a/drivers/gpu/drm/i915/intel_audio.c
>> +++ b/drivers/gpu/drm/i915/intel_audio.c
>> @@ -300,7 +300,7 @@ hsw_dp_audio_config_update(struct intel_crtc
>*intel_crtc, enum port port,
>>  tmp &= ~AUD_CONFIG_N_PROG_ENABLE;
>>  tmp |= AUD_CONFIG_N_VALUE_INDEX;
>>
>> -if (nm) {
>> +if (!IS_KABYLAKE(dev_priv) && nm) {
>>  tmp &= ~AUD_CONFIG_N_MASK;
>>  tmp |= AUD_CONFIG_N(nm->n);
>>  tmp |= AUD_CONFIG_N_PROG_ENABLE;
>> @@ -308,6 +308,9 @@ hsw_dp_audio_config_update(struct intel_crtc
>> *intel_crtc, enum port port,
>>
>>  I915_WRITE(HSW_AUD_CFG(pipe), tmp);
>>
>> +if (IS_KABYLAKE(dev_priv))
>> +return;
>> +
>
>The debug logging near the top of the function will be wrong for KBL, and you
>now bypass HSW_AUD_M_CTS_ENABLE() setting for the automatic values.
>
>Seems to me the simplest would be to do
>
>   if (IS_KABYLAKE(dev_priv))
>   nm = NULL;
>
>*but* this still needs better rationale, especially why this is specific to 
>KBL.
>
>BR,
>Jani.
>
>
>>  tmp = I915_READ(HSW_AUD_M_CTS_ENABLE(pipe));
>>  tmp &= ~AUD_CONFIG_M_MASK;
>>  tmp &= ~AUD_M_CTS_M_VALUE_INDEX;
>
>--
>Jani Nikula, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915/audio: not to set N/M value manually for KBL.

2017-04-04 Thread Yang, Libin

>-Original Message-
>From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
>Sent: Tuesday, April 4, 2017 6:55 PM
>To: Wang, Quanxian <quanxian.w...@intel.com>; intel-
>g...@lists.freedesktop.org
>Cc: Yang, Libin <libin.y...@intel.com>
>Subject: Re: [Intel-gfx] [PATCH] drm/i915/audio: not to set N/M value
>manually for KBL.
>
>On Sat, 01 Apr 2017, Quanxian Wang <quanxian.w...@intel.com> wrote:
>> It doesn't work on KBL. Just using automatic N/M.
>
>Please provide a more elaborate commit message. In particular, have a look at
>
>commit 6014ac122ed081feca99217bc57b2e15c7fc1a51
>Author: Libin Yang <libin.y...@linux.intel.com>
>Date:   Tue Oct 25 17:54:18 2016 +0300
>
>drm/i915/audio: set proper N/M in modeset
>
>and explain why that doesn't apply to KBL. And why just KBL, why not others?
>
>> According to the bspec, when set N/M, should disable and enable
>> transcoder which attaching DP audio. but there is no such code to do
>> that.
>> without this implementation except KBL platforms, seems work well.

Is this a mandatory requirement on the new platform?
We saw "disable and enable transcoder" requirement on old platforms.
But it will dramatically impact on the user experience. After discussion,
we skipped this step and did a lot of test on the old platforms. They all works.

I suggested that we can talk with silicon team to figure out a proper solution,
because on the new platform we may also meet the same situations like old
platforms that some resolution will not work properly.

BTW: please test the playback on 4K resolution to see whether the playback
and delay is normal. 4K is often an issue.

Regards,
Libin

>>
>> Signed-off-by: Quanxian Wang <quanxian.w...@intel.com>
>> Tested-By: Wang Zhijun<zhijunx.w...@intel.com>
>> Tested-By: Cui Yueping<yuepingx@intel.com>
>> ---
>>  drivers/gpu/drm/i915/intel_audio.c | 5 -
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_audio.c
>> b/drivers/gpu/drm/i915/intel_audio.c
>> index 52c207e..0542031 100644
>> --- a/drivers/gpu/drm/i915/intel_audio.c
>> +++ b/drivers/gpu/drm/i915/intel_audio.c
>> @@ -300,7 +300,7 @@ hsw_dp_audio_config_update(struct intel_crtc
>*intel_crtc, enum port port,
>>  tmp &= ~AUD_CONFIG_N_PROG_ENABLE;
>>  tmp |= AUD_CONFIG_N_VALUE_INDEX;
>>
>> -if (nm) {
>> +if (!IS_KABYLAKE(dev_priv) && nm) {
>>  tmp &= ~AUD_CONFIG_N_MASK;
>>  tmp |= AUD_CONFIG_N(nm->n);
>>  tmp |= AUD_CONFIG_N_PROG_ENABLE;
>> @@ -308,6 +308,9 @@ hsw_dp_audio_config_update(struct intel_crtc
>> *intel_crtc, enum port port,
>>
>>  I915_WRITE(HSW_AUD_CFG(pipe), tmp);
>>
>> +if (IS_KABYLAKE(dev_priv))
>> +return;
>> +
>
>The debug logging near the top of the function will be wrong for KBL, and you
>now bypass HSW_AUD_M_CTS_ENABLE() setting for the automatic values.
>
>Seems to me the simplest would be to do
>
>   if (IS_KABYLAKE(dev_priv))
>   nm = NULL;
>
>*but* this still needs better rationale, especially why this is specific to 
>KBL.
>
>BR,
>Jani.
>
>
>>  tmp = I915_READ(HSW_AUD_M_CTS_ENABLE(pipe));
>>  tmp &= ~AUD_CONFIG_M_MASK;
>>  tmp &= ~AUD_M_CTS_M_VALUE_INDEX;
>
>--
>Jani Nikula, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v5 0/3] support DP MST audio

2017-01-12 Thread Yang, Libin

>-Original Message-
>From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of Daniel Vetter
>Sent: Thursday, January 12, 2017 5:10 PM
>To: Jani Nikula <jani.nik...@linux.intel.com>
>Cc: Yang, Libin <libin.y...@intel.com>; intel-gfx@lists.freedesktop.org;
>ville.syrj...@linux.intel.com; Vetter, Daniel <daniel.vet...@intel.com>;
>Pandiyan, Dhinakaran <dhinakaran.pandi...@intel.com>; ti...@suse.de
>Subject: Re: [Intel-gfx] [PATCH v5 0/3] support DP MST audio
>
>On Thu, Jan 12, 2017 at 10:06:10AM +0100, Daniel Vetter wrote:
>> On Thu, Jan 12, 2017 at 10:53:35AM +0200, Jani Nikula wrote:
>> > On Thu, 12 Jan 2017, "Yang, Libin" <libin.y...@intel.com> wrote:
>> > >>-Original Message-
>> > >>From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
>> > >>Sent: Thursday, January 12, 2017 4:19 PM
>> > >>To: Yang, Libin <libin.y...@intel.com>;
>> > >>intel-gfx@lists.freedesktop.org; ville.syrj...@linux.intel.com;
>> > >>Vetter, Daniel <daniel.vet...@intel.com>; Pandiyan, Dhinakaran
>> > >><dhinakaran.pandi...@intel.com>; ti...@suse.de
>> > >>Cc: Yang, Libin <libin.y...@intel.com>
>> > >>Subject: Re: [PATCH v5 0/3] support DP MST audio
>> > >>
>> > >>On Thu, 12 Jan 2017, libin.y...@intel.com wrote:
>> > >>> From: Libin Yang <libin.y...@intel.com>
>> > >>>
>> > >>> This patchset starts to support DP MST audio.
>> > >>
>> > >>Given that this is only sent to intel-gfx, I *presume* this is now
>> > >>intended to be merged via drm-intel. Is that right?
>> > >>
>> > >>Please don't assume your poor maintainers remember everything!
>> > >
>> > > These patches are for drm-tip.
>> > >
>> > > Which mail list I should send? I found the mail addresses are:
>> > > intel-gfx@lists.freedesktop.org and 
>> > > drm-intel-fi...@lists.freedesktop.org.
>> > > from
>> > > https://01.org/linuxgraphics/gfx-docs/maintainer-tools/drm-intel.h
>> > > tml
>> >
>> > What I'm trying and apparently failing to say is that regardless of
>> > the tree and the mailing list, the patches only touch stuff under
>> > sound/, so it would be great to have a hint that these are really
>> > meant to be merged via us.
>>
>> And imo still good to cc: takashi and sound lists so they know I've
>> picked them up. Now I need to dig out that other thread (which is
>> somewhere) so I can confirm to Takashi that it has landed.
>
>Oops, Takashi _is_ already on cc, but ccing alsa wouldn't have hurt.
>Sorry about that, too early in the morning still ...
>
>Anyway, patches applied to drm-intel for 4.11.

Thanks. Yes, it is a good suggestion to cc ALSA. And as Jani said
it is better to describe it is for gfx.

Regards,
Libin

>
>Thanks, Daniel
>--
>Daniel Vetter
>Software Engineer, Intel Corporation
>http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v5 0/3] support DP MST audio

2017-01-12 Thread Yang, Libin

>-Original Message-
>From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
>Sent: Thursday, January 12, 2017 4:19 PM
>To: Yang, Libin <libin.y...@intel.com>; intel-gfx@lists.freedesktop.org;
>ville.syrj...@linux.intel.com; Vetter, Daniel <daniel.vet...@intel.com>;
>Pandiyan, Dhinakaran <dhinakaran.pandi...@intel.com>; ti...@suse.de
>Cc: Yang, Libin <libin.y...@intel.com>
>Subject: Re: [PATCH v5 0/3] support DP MST audio
>
>On Thu, 12 Jan 2017, libin.y...@intel.com wrote:
>> From: Libin Yang <libin.y...@intel.com>
>>
>> This patchset starts to support DP MST audio.
>
>Given that this is only sent to intel-gfx, I *presume* this is now intended to 
>be
>merged via drm-intel. Is that right?
>
>Please don't assume your poor maintainers remember everything!

These patches are for drm-tip.

Which mail list I should send? I found the mail addresses are:
intel-gfx@lists.freedesktop.org and drm-intel-fi...@lists.freedesktop.org.
from https://01.org/linuxgraphics/gfx-docs/maintainer-tools/drm-intel.html 

Thanks,
Libin

>
>
>BR,
>Jani.
>
>>
>> change log:
>> v4: refine some comments in 0001 and 0002 patches.
>> refine the 0003 patch for the new ALSA-Configuration document
>> v5: add Takashi's Reviewed-by
>>
>> Libin Yang (3):
>>   ALSA: hda - add DP mst verb support
>>   ALSA: hda - add DP MST audio support
>>   ALSA: Documentation about HDA DP MST pin init and connection
>>
>>  Documentation/sound/hd-audio/dp-mst.rst |  17 +++
>>  sound/pci/hda/hda_codec.c   |  76 +-
>>  sound/pci/hda/hda_codec.h   |   3 +
>>  sound/pci/hda/patch_hdmi.c  | 245 +---
>
>>  4 files changed, 285 insertions(+), 56 deletions(-)
>
>--
>Jani Nikula, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [alsa-devel] [PATCH v4 0/3] support DP MST audio

2017-01-11 Thread Yang, Libin
Hi Daniel,

OK, I will resend the patches tomorrow. Thanks.

Hi Takashi,

In case you still need the patches for i915, it is on
git://anongit.freedesktop.org/drm-tip:drm-tip

My patches are:

commit 9a148a96fc3a654ddcf142a7ab7db37b972ba5d8
drm/i915/debugfs: add dp mst info

commit 9935f7fa2854355203e3976762eecfb218079aac
drm/i915: abstract ddi being audio enabled

commit 7f9e77545b92bcb894b8e2be5646535e8ba8da9e
drm/i915: enable dp mst audio

commit 31613268c0a6f7abdb0c19487a084249bcf203ba
drm/i915/audio: extend get_saved_enc() to support more scenarios

commit f55d23be11ed15f493957246f3b81fc530e79d70
drm/i915/audio: extend audio sync rate support for DP MST

And you may still need the patches in gfx to fix the flicker issue, which 
Dhinakaran
can help.

Regards,
Libin


>-Original Message-
>From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of Daniel Vetter
>Sent: Wednesday, January 11, 2017 4:35 PM
>To: Takashi Iwai <ti...@suse.de>
>Cc: Daniel Vetter <dan...@ffwll.ch>; Yang, Libin <libin.y...@intel.com>; intel-
>gfx <intel-gfx@lists.freedesktop.org>; Nikula, Jani
><jani.nik...@linux.intel.com>; alsa-de...@alsa-project.org; Lin, Mengdong
><mengdong@intel.com>
>Subject: Re: [alsa-devel] [PATCH v4 0/3] support DP MST audio
>
>On Wed, Jan 11, 2017 at 09:00:27AM +0100, Takashi Iwai wrote:
>> On Wed, 11 Jan 2017 08:39:13 +0100,
>> Daniel Vetter wrote:
>> >
>> > On Tue, Jan 10, 2017 at 9:49 AM, Takashi Iwai <ti...@suse.de> wrote:
>> > > On Tue, 10 Jan 2017 09:45:31 +0100,
>> > >> >-Original Message-
>> > >> >From: Takashi Iwai [mailto:ti...@suse.de]
>> > >> >Sent: Tuesday, January 10, 2017 4:19 PM
>> > >> >To: Yang, Libin <libin.y...@intel.com>
>> > >> >Cc: Daniel Vetter <dan...@ffwll.ch>; intel-gfx
>> > >> ><intel-gfx@lists.freedesktop.org>;
>> > >> >Nikula, Jani <jani.nik...@linux.intel.com>;
>> > >> >alsa-de...@alsa-project.org; Lin, Mengdong
>> > >> ><mengdong@intel.com>
>> > >> >Subject: Re: [alsa-devel] [PATCH v4 0/3] support DP MST audio
>> > >> >
>> > >> >On Mon, 09 Jan 2017 07:22:55 +0100, Yang, Libin wrote:
>> > >> >>
>> > >> >> Hi Takashi,
>> > >> >>
>> > >> >> It seems the patches for DP MST in gfx is not merged into Linus
>branch.
>> > >> >>
>> > >> >> Do we have plan to merge gfx branch manually and review the
>> > >> >> patches for
>> > >> >audio? Or we will wait the DP MST patches for i915 merged into Linus
>branch?
>> > >> >
>> > >> >Sorry, this was delayed due to the vacation.
>> > >> >Now I applied these three patches to topic/hda-dp-mst branch
>> > >> >based on 4.10- rc2, and it was merged to for-next branch.
>> > >> >
>> > >> >  git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
>> > >> >topic/hda-dp- mst
>> > >>
>> > >> Thanks. These audio patches are based on the i915 dp mst patches.
>> > >> Without
>> > >> I915 driver patches support, it will make errors.
>> > >
>> > > Ah yeah, I forgot it.  So I removed it from for-next branch, but
>> > > topic/hda-dp-mst branch is kept so that it can be merged to i915
>> > > tree.
>> > >
>> > > Let me know if there is any i915 branch I can pull into sound tree.
>> >
>> > Aw, I didn't know that the depency goes this way round, the dp mst
>> > patches (I'm not even sure which ones they are) on the i915 are just
>> > on the general pile. So not anywhere near a place where I can make a
>> > topic branch.
>> >
>> > I guess what needs to be done now is a cherry-picked list of just
>> > the patches we need, on top of -rc3, that I can then pull into
>> > drm-intel.git plus send a pull request for that to Takashi. That
>> > means the patches are twice in drm-intel.git, but if we cherry-pick
>> > reference them correctly then that should be all ok and can't really
>> > be helped.
>> >
>> > Or we just delay the audio side for 4.12, dp mst audio support is 4
>> > years late anyway, so one more release won'thurt that much ;-)
>>
>> Well, thinking of the amount of patches, I guess we can do other way
>> round: basically it's fine to apply Libin's latest patches to drm tree
>> for 4.11, if it makes things easier.  I don't think we'll have a big
>> conflict with these changes for others during 4.11 development.  If
>> any, I can pull some of stable point from drm tree.
>>
>> Does it work for you?  If yes, feel free to apply these three sound
>> patches to drm or i915 tree with my ack.
>>
>> Reviewed-by: Takashi Iwai <ti...@suse.de>
>
>Works for me too. Libin, can you pls resend (somehow this thread
>disconnected from the patches for me), with Takashi's r-b + ack for merging
>through drm-intel?
>
>Thanks, Daniel
>--
>Daniel Vetter
>Software Engineer, Intel Corporation
>http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [alsa-devel] [PATCH v4 0/3] support DP MST audio

2017-01-10 Thread Yang, Libin
Hi Takashi,

>-Original Message-
>From: Takashi Iwai [mailto:ti...@suse.de]
>Sent: Tuesday, January 10, 2017 4:19 PM
>To: Yang, Libin <libin.y...@intel.com>
>Cc: Daniel Vetter <dan...@ffwll.ch>; intel-gfx 
><intel-gfx@lists.freedesktop.org>;
>Nikula, Jani <jani.nik...@linux.intel.com>; alsa-de...@alsa-project.org; Lin,
>Mengdong <mengdong@intel.com>
>Subject: Re: [alsa-devel] [PATCH v4 0/3] support DP MST audio
>
>On Mon, 09 Jan 2017 07:22:55 +0100,
>Yang, Libin wrote:
>>
>> Hi Takashi,
>>
>> It seems the patches for DP MST in gfx is not merged into Linus branch.
>>
>> Do we have plan to merge gfx branch manually and review the patches for
>audio? Or we will wait the DP MST patches for i915 merged into Linus branch?
>
>Sorry, this was delayed due to the vacation.
>Now I applied these three patches to topic/hda-dp-mst branch based on 4.10-
>rc2, and it was merged to for-next branch.
>
>  git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git topic/hda-dp-
>mst

Thanks. These audio patches are based on the i915 dp mst patches. Without
I915 driver patches support, it will make errors.

Regards,
Libin

>
>Daniel, Jani, if you guys need to merge to i915 tree, feel free to pull from 
>that
>branch.
>
>
>thanks,
>
>Takashi
>
>>
>> Regards,
>> Libin
>>
>>
>> >-Original Message-
>> >From: Takashi Iwai [mailto:ti...@suse.de]
>> >Sent: Tuesday, December 6, 2016 4:11 PM
>> >To: Daniel Vetter <dan...@ffwll.ch>
>> >Cc: intel-gfx <intel-gfx@lists.freedesktop.org>; Nikula, Jani
>> ><jani.nik...@linux.intel.com>; Yang, Libin <libin.y...@intel.com>;
>> >alsa- de...@alsa-project.org; Lin, Mengdong <mengdong@intel.com>
>> >Subject: Re: [alsa-devel] [PATCH v4 0/3] support DP MST audio
>> >
>> >On Tue, 06 Dec 2016 08:51:43 +0100,
>> >Daniel Vetter wrote:
>> >>
>> >> On Tue, Dec 6, 2016 at 8:20 AM, Takashi Iwai <ti...@suse.de> wrote:
>> >> > On Tue, 06 Dec 2016 03:58:21 +0100, Yang, Libin wrote:
>> >> >>
>> >> >> The patchset is based on drm-tip branch in
>> >> >> git://anongit.freedesktop.org/drm-tip
>> >> >
>> >> > I'll review and merge if it's OK.
>> >> >
>> >> > Daniel, do you guys have the stable branch that I can pull into
>> >> > sound tree for DP-MST audio stuff for 4.10?
>> >>
>> >> DP mst audio support missed 4.10 over here on the drm side. And I
>> >> wasn't aware that we need a topic branch for it, so I just smashed
>> >> it into our drm-intel-next queue ... I can send you the most recent
>> >> stable tag for that, but that's heading in only for 4.11.
>> >
>> >It's fine, we can postpone to 4.11 as well.  I just thought it were
>> >already queued for 4.10.
>> >
>> >If so, I'm going to queue these patches once after 4.10-rc1 is released.
>> >
>> >
>> >thanks,
>> >
>> >Takashi
>> >
>> >
>> >> -Daniel
>> >>
>> >> >
>> >> >
>> >> > thanks,
>> >> >
>> >> > Takashi
>> >> >
>> >> >
>> >> >> Regards,
>> >> >> Libin
>> >> >>
>> >> >>
>> >> >> >-Original Message-
>> >> >> >From: Yang, Libin
>> >> >> >Sent: Tuesday, December 6, 2016 10:49 AM
>> >> >> >To: alsa-de...@alsa-project.org; ti...@suse.de
>> >> >> >Cc: Lin, Mengdong <mengdong@intel.com>; Yang, Libin
>> >> >> ><libin.y...@intel.com>
>> >> >> >Subject: [alsa-devel] [PATCH v4 0/3] support DP MST audio
>> >> >> >
>> >> >> >From: Libin Yang <libin.y...@intel.com>
>> >> >> >
>> >> >> >This patchset starts to support DP MST audio.
>> >> >> >
>> >> >> >This patchset is based on drm-tip on
>> >> >> >git://anongit.freedesktop.org/drm-tip
>> >> >> >
>> >> >> >change log:
>> >> >> >v4: refine some comments in 0001 and 0002 patches.
>> >> >> >refine the 0003 patch for the new ALSA-Configuration
>> >> >> >document
>> >> >> >
>> >> >> >Libin Yang (3):
>> >> >> >  ALSA: hda - add DP mst verb support
>> >> >> >  ALSA: hda - add DP MST audio support
>> >> >> >  ALSA: Documentation about HDA DP MST pin init and connection
>> >> >> >
>> >> >> > Documentation/sound/hd-audio/dp-mst.rst |  17 +++
>> >> >> > sound/pci/hda/hda_codec.c   |  76 +-
>> >> >> > sound/pci/hda/hda_codec.h   |   3 +
>> >> >> > sound/pci/hda/patch_hdmi.c  | 245
>> >+--
>> >> >> >-
>> >> >> > 4 files changed, 285 insertions(+), 56 deletions(-)
>> >> >> >
>> >> >> >--
>> >> >> >2.7.4
>> >> >>
>> >>
>> >>
>> >>
>> >> --
>> >> Daniel Vetter
>> >> Software Engineer, Intel Corporation
>> >> +41 (0) 79 365 57 48 - http://blog.ffwll.ch
>> >>
>>
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [alsa-devel] [PATCH v4 0/3] support DP MST audio

2017-01-08 Thread Yang, Libin
Hi Takashi,

It seems the patches for DP MST in gfx is not merged into Linus branch.

Do we have plan to merge gfx branch manually and review the patches for audio? 
Or we will wait the DP MST patches for i915 merged into Linus branch?

Regards,
Libin


>-Original Message-
>From: Takashi Iwai [mailto:ti...@suse.de]
>Sent: Tuesday, December 6, 2016 4:11 PM
>To: Daniel Vetter <dan...@ffwll.ch>
>Cc: intel-gfx <intel-gfx@lists.freedesktop.org>; Nikula, Jani
><jani.nik...@linux.intel.com>; Yang, Libin <libin.y...@intel.com>; alsa-
>de...@alsa-project.org; Lin, Mengdong <mengdong@intel.com>
>Subject: Re: [alsa-devel] [PATCH v4 0/3] support DP MST audio
>
>On Tue, 06 Dec 2016 08:51:43 +0100,
>Daniel Vetter wrote:
>>
>> On Tue, Dec 6, 2016 at 8:20 AM, Takashi Iwai <ti...@suse.de> wrote:
>> > On Tue, 06 Dec 2016 03:58:21 +0100,
>> > Yang, Libin wrote:
>> >>
>> >> The patchset is based on drm-tip branch in
>> >> git://anongit.freedesktop.org/drm-tip
>> >
>> > I'll review and merge if it's OK.
>> >
>> > Daniel, do you guys have the stable branch that I can pull into
>> > sound tree for DP-MST audio stuff for 4.10?
>>
>> DP mst audio support missed 4.10 over here on the drm side. And I
>> wasn't aware that we need a topic branch for it, so I just smashed it
>> into our drm-intel-next queue ... I can send you the most recent
>> stable tag for that, but that's heading in only for 4.11.
>
>It's fine, we can postpone to 4.11 as well.  I just thought it were already
>queued for 4.10.
>
>If so, I'm going to queue these patches once after 4.10-rc1 is released.
>
>
>thanks,
>
>Takashi
>
>
>> -Daniel
>>
>> >
>> >
>> > thanks,
>> >
>> > Takashi
>> >
>> >
>> >> Regards,
>> >> Libin
>> >>
>> >>
>> >> >-Original Message-
>> >> >From: Yang, Libin
>> >> >Sent: Tuesday, December 6, 2016 10:49 AM
>> >> >To: alsa-de...@alsa-project.org; ti...@suse.de
>> >> >Cc: Lin, Mengdong <mengdong@intel.com>; Yang, Libin
>> >> ><libin.y...@intel.com>
>> >> >Subject: [alsa-devel] [PATCH v4 0/3] support DP MST audio
>> >> >
>> >> >From: Libin Yang <libin.y...@intel.com>
>> >> >
>> >> >This patchset starts to support DP MST audio.
>> >> >
>> >> >This patchset is based on drm-tip on
>> >> >git://anongit.freedesktop.org/drm-tip
>> >> >
>> >> >change log:
>> >> >v4: refine some comments in 0001 and 0002 patches.
>> >> >refine the 0003 patch for the new ALSA-Configuration document
>> >> >
>> >> >Libin Yang (3):
>> >> >  ALSA: hda - add DP mst verb support
>> >> >  ALSA: hda - add DP MST audio support
>> >> >  ALSA: Documentation about HDA DP MST pin init and connection
>> >> >
>> >> > Documentation/sound/hd-audio/dp-mst.rst |  17 +++
>> >> > sound/pci/hda/hda_codec.c   |  76 +-
>> >> > sound/pci/hda/hda_codec.h   |   3 +
>> >> > sound/pci/hda/patch_hdmi.c  | 245
>+--
>> >> >-
>> >> > 4 files changed, 285 insertions(+), 56 deletions(-)
>> >> >
>> >> >--
>> >> >2.7.4
>> >>
>>
>>
>>
>> --
>> Daniel Vetter
>> Software Engineer, Intel Corporation
>> +41 (0) 79 365 57 48 - http://blog.ffwll.ch
>>
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 2/2] drm/i915/audio: extend audio sync rate support for DP MST

2016-12-03 Thread Yang, Libin

>-Original Message-
>From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
>Sent: Friday, December 2, 2016 10:25 PM
>To: Yang, Libin <libin.y...@intel.com>; intel-gfx@lists.freedesktop.org;
>ville.syrj...@linux.intel.com; Vetter, Daniel <daniel.vet...@intel.com>;
>Pandiyan, Dhinakaran <dhinakaran.pandi...@intel.com>; ti...@suse.de;
>liang.xi...@dell.com
>Subject: RE: [PATCH 2/2] drm/i915/audio: extend audio sync rate support for
>DP MST
>
>On Fri, 02 Dec 2016, "Yang, Libin" <libin.y...@intel.com> wrote:
>> Any comments? Thanks.
>
>Both pushed to dinq, thanks for the patches.
>
>Libin and/or Dhinakaran, please improve the documentation of struct
>i915_audio_component_ops to describe the parameters of sync_audio_rate
>and get_eld hooks. For example, there's nothing about pipe being -1 for non-
>MST.

Thanks. Get it. I will update it next week.

Regards,
Libin

>
>BR,
>Jani.
>
>
>>
>> Regards,
>> Libin
>>
>>
>>>-Original Message-
>>>From: Yang, Libin
>>>Sent: Thursday, December 1, 2016 1:17 PM
>>>To: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com;
>>>ville.syrj...@linux.intel.com; Vetter, Daniel
>>><daniel.vet...@intel.com>; Pandiyan, Dhinakaran
>>><dhinakaran.pandi...@intel.com>; ti...@suse.de
>>>Cc: Yang, Libin <libin.y...@intel.com>
>>>Subject: [PATCH 2/2] drm/i915/audio: extend audio sync rate support
>>>for DP MST
>>>
>>>From: Libin Yang <libin.y...@intel.com>
>>>
>>>Remove the type judgement in i915_audio_component_sync_audio_rate().
>>>Audio rate sync is necessary for all i915 digital audio now.
>>>
>>>Signed-off-by: Libin Yang <libin.y...@intel.com>
>>>---
>>> drivers/gpu/drm/i915/intel_audio.c | 4 +---
>>> 1 file changed, 1 insertion(+), 3 deletions(-)
>>>
>>>diff --git a/drivers/gpu/drm/i915/intel_audio.c
>>>b/drivers/gpu/drm/i915/intel_audio.c
>>>index c8a1345..3bbc96c 100644
>>>--- a/drivers/gpu/drm/i915/intel_audio.c
>>>+++ b/drivers/gpu/drm/i915/intel_audio.c
>>>@@ -805,9 +805,7 @@ static int
>>>i915_audio_component_sync_audio_rate(struct device *kdev, int port,
>>>
>>> /* 1. get the pipe */
>>> intel_encoder = get_saved_enc(dev_priv, port, pipe);
>>>-if (!intel_encoder || !intel_encoder->base.crtc ||
>>>-(intel_encoder->type != INTEL_OUTPUT_HDMI &&
>>>- intel_encoder->type != INTEL_OUTPUT_DP)) {
>>>+if (!intel_encoder || !intel_encoder->base.crtc) {
>>> DRM_DEBUG_KMS("Not valid for port %c\n",
>port_name(port));
>>> err = -ENODEV;
>>> goto unlock;
>>>--
>>>2.7.4
>>
>
>--
>Jani Nikula, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 2/2] drm/i915/audio: extend audio sync rate support for DP MST

2016-12-01 Thread Yang, Libin
Any comments? Thanks.

Regards,
Libin


>-Original Message-
>From: Yang, Libin
>Sent: Thursday, December 1, 2016 1:17 PM
>To: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com;
>ville.syrj...@linux.intel.com; Vetter, Daniel <daniel.vet...@intel.com>;
>Pandiyan, Dhinakaran <dhinakaran.pandi...@intel.com>; ti...@suse.de
>Cc: Yang, Libin <libin.y...@intel.com>
>Subject: [PATCH 2/2] drm/i915/audio: extend audio sync rate support for DP
>MST
>
>From: Libin Yang <libin.y...@intel.com>
>
>Remove the type judgement in i915_audio_component_sync_audio_rate().
>Audio rate sync is necessary for all i915 digital audio now.
>
>Signed-off-by: Libin Yang <libin.y...@intel.com>
>---
> drivers/gpu/drm/i915/intel_audio.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
>diff --git a/drivers/gpu/drm/i915/intel_audio.c
>b/drivers/gpu/drm/i915/intel_audio.c
>index c8a1345..3bbc96c 100644
>--- a/drivers/gpu/drm/i915/intel_audio.c
>+++ b/drivers/gpu/drm/i915/intel_audio.c
>@@ -805,9 +805,7 @@ static int
>i915_audio_component_sync_audio_rate(struct device *kdev, int port,
>
>   /* 1. get the pipe */
>   intel_encoder = get_saved_enc(dev_priv, port, pipe);
>-  if (!intel_encoder || !intel_encoder->base.crtc ||
>-  (intel_encoder->type != INTEL_OUTPUT_HDMI &&
>-   intel_encoder->type != INTEL_OUTPUT_DP)) {
>+  if (!intel_encoder || !intel_encoder->base.crtc) {
>   DRM_DEBUG_KMS("Not valid for port %c\n",
>port_name(port));
>   err = -ENODEV;
>   goto unlock;
>--
>2.7.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 2/2] drm/i915/audio: Extend audio sync rate support for DP MST

2016-11-30 Thread Yang, Libin

>-Original Message-
>From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
>Sent: Wednesday, November 30, 2016 11:52 PM
>To: Yang, Libin <libin.y...@intel.com>; intel-gfx@lists.freedesktop.org;
>ville.syrj...@linux.intel.com; Vetter, Daniel <daniel.vet...@intel.com>;
>Pandiyan, Dhinakaran <dhinakaran.pandi...@intel.com>; Kp, Jeeja
><jeeja...@intel.com>; ti...@suse.de
>Subject: RE: [PATCH 2/2] drm/i915/audio: Extend audio sync rate support for
>DP MST
>
>On Wed, 30 Nov 2016, "Yang, Libin" <libin.y...@intel.com> wrote:
>>>-Original Message-
>>>From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
>>>Sent: Wednesday, November 30, 2016 12:34 AM
>>>To: Yang, Libin <libin.y...@intel.com>;
>>>intel-gfx@lists.freedesktop.org; ville.syrj...@linux.intel.com;
>>>Vetter, Daniel <daniel.vet...@intel.com>; Pandiyan, Dhinakaran
>>><dhinakaran.pandi...@intel.com>; Kp, Jeeja <jeeja...@intel.com>;
>>>ti...@suse.de
>>>Cc: Yang, Libin <libin.y...@intel.com>
>>>Subject: Re: [PATCH 2/2] drm/i915/audio: Extend audio sync rate
>>>support for DP MST
>>>
>>>On Tue, 15 Nov 2016, libin.y...@intel.com wrote:
>>>> From: Libin Yang <libin.y...@intel.com>
>>>>
>>>> This patch extends the support of audio sample rate sync up to DP MST.
>>>>
>>>> Signed-off-by: Libin Yang <libin.y...@intel.com>
>>>> ---
>>>>  drivers/gpu/drm/i915/intel_audio.c | 3 ++-
>>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/i915/intel_audio.c
>>>> b/drivers/gpu/drm/i915/intel_audio.c
>>>> index c8a1345..88ed869 100644
>>>> --- a/drivers/gpu/drm/i915/intel_audio.c
>>>> +++ b/drivers/gpu/drm/i915/intel_audio.c
>>>> @@ -807,7 +807,8 @@ static int
>>>i915_audio_component_sync_audio_rate(struct device *kdev, int port,
>>>>intel_encoder = get_saved_enc(dev_priv, port, pipe);
>>>>if (!intel_encoder || !intel_encoder->base.crtc ||
>>>>(intel_encoder->type != INTEL_OUTPUT_HDMI &&
>>>> -   intel_encoder->type != INTEL_OUTPUT_DP)) {
>>>> +   intel_encoder->type != INTEL_OUTPUT_DP &&
>>>> +   intel_encoder->type != INTEL_OUTPUT_DP_MST)) {
>>>
>>>I think the better option is to make absolutely sure we never store
>>>other kinds of encoders in dev_priv->av_enc_map[pipe] to begin with. I
>>>think that's true already, but please add
>>>
>>> if (WARN_ON(intel_encoder->type != INTEL_OUTPUT_HDMI &&
>>> intel_encoder->type != INTEL_OUTPUT_DP &&
>>> intel_encoder->type != INTEL_OUTPUT_DP_MST))
>>> return;
>>>
>>>near the beginning of intel_audio_codec_enable(), and remove the type
>>>checks here. This reduces the confusion about different kinds of
>>>checks after calling get_saved_enc().
>>
>> We can't put the check at the beginning of the function.
>> We still need the check in the same place as we need get intel_encoder at
>first.
>
>We do not need to duplicate the checks here if we ensure only good stuff is
>ever put into av_enc_map.

Yes, I agree. I will remove the type judgement.

Regards,
Libin

>
>>
>> Regards,
>> Libin
>>
>>>
>>>BR,
>>>Jani.
>>>
>>>
>>>>DRM_DEBUG_KMS("Not valid for port %c\n",
>>>port_name(port));
>>>>err = -ENODEV;
>>>>goto unlock;
>>>
>>>--
>>>Jani Nikula, Intel Open Source Technology Center
>
>--
>Jani Nikula, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 2/2] drm/i915/audio: Extend audio sync rate support for DP MST

2016-11-30 Thread Yang, Libin

>-Original Message-
>From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
>Sent: Wednesday, November 30, 2016 12:50 AM
>To: Jani Nikula <jani.nik...@linux.intel.com>
>Cc: Yang, Libin <libin.y...@intel.com>; intel-gfx@lists.freedesktop.org; 
>Vetter,
>Daniel <daniel.vet...@intel.com>; Pandiyan, Dhinakaran
><dhinakaran.pandi...@intel.com>; Kp, Jeeja <jeeja...@intel.com>;
>ti...@suse.de
>Subject: Re: [PATCH 2/2] drm/i915/audio: Extend audio sync rate support for
>DP MST
>
>On Tue, Nov 29, 2016 at 06:33:50PM +0200, Jani Nikula wrote:
>> On Tue, 15 Nov 2016, libin.y...@intel.com wrote:
>> > From: Libin Yang <libin.y...@intel.com>
>> >
>> > This patch extends the support of audio sample rate sync up to DP
>> > MST.
>> >
>> > Signed-off-by: Libin Yang <libin.y...@intel.com>
>> > ---
>> >  drivers/gpu/drm/i915/intel_audio.c | 3 ++-
>> >  1 file changed, 2 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/drivers/gpu/drm/i915/intel_audio.c
>> > b/drivers/gpu/drm/i915/intel_audio.c
>> > index c8a1345..88ed869 100644
>> > --- a/drivers/gpu/drm/i915/intel_audio.c
>> > +++ b/drivers/gpu/drm/i915/intel_audio.c
>> > @@ -807,7 +807,8 @@ static int
>i915_audio_component_sync_audio_rate(struct device *kdev, int port,
>> >intel_encoder = get_saved_enc(dev_priv, port, pipe);
>> >if (!intel_encoder || !intel_encoder->base.crtc ||
>> >(intel_encoder->type != INTEL_OUTPUT_HDMI &&
>> > -   intel_encoder->type != INTEL_OUTPUT_DP)) {
>> > +   intel_encoder->type != INTEL_OUTPUT_DP &&
>> > +   intel_encoder->type != INTEL_OUTPUT_DP_MST)) {
>>
>> I think the better option is to make absolutely sure we never store
>> other kinds of encoders in dev_priv->av_enc_map[pipe] to begin with. I
>> think that's true already, but please add
>>
>>  if (WARN_ON(intel_encoder->type != INTEL_OUTPUT_HDMI &&
>>  intel_encoder->type != INTEL_OUTPUT_DP &&
>>  intel_encoder->type != INTEL_OUTPUT_DP_MST))
>>  return;
>>
>> near the beginning of intel_audio_codec_enable(), and remove the type
>> checks here. This reduces the confusion about different kinds of
>> checks after calling get_saved_enc().
>
>This while encoder->type thing is pretty broken actually. Currently we're semi-
>randomly flipping DDI encoders between UNKNOWN,HDMI and DP.
>I want to eliminate that so that their type will always be just "DDI".
>For iguring out what kind of signal we are driving out you should be looking at
>crtc_state->output_types.

Do you mean the code should be like:
@@ -807,10 +807,7 @@ static int i915_audio_component_sync_audio_rate(struct 
device *kdev, int port,
 
/* 1. get the pipe */
intel_encoder = get_saved_enc(dev_priv, port, pipe);
-   if (!intel_encoder || !intel_encoder->base.crtc ||
-   (intel_encoder->type != INTEL_OUTPUT_HDMI &&
-intel_encoder->type != INTEL_OUTPUT_DP &&
-intel_encoder->type != INTEL_OUTPUT_DP_MST)) {
+   if (!intel_encoder || !intel_encoder->base.crtc) {
DRM_DEBUG_KMS("Not valid for port %c\n", port_name(port));
err = -ENODEV;
goto unlock;
@@ -819,7 +816,12 @@ static int i915_audio_component_sync_audio_rate(struct 
device *kdev, int port,
/* pipe passed from the audio driver will be -1 for Non-MST case */
crtc = to_intel_crtc(intel_encoder->base.crtc);
crtc_state = crtc->config;
+   if (WARN_ON((crtc_state->output_types &
+   ((1 << INTEL_OUTPUT_HDMI) |
+(1 << INTEL_OUTPUT_DP) |
+(1 << INTEL_OUTPUT_DP_MST))) == 0))
+   return 0;
+
pipe = crtc->pipe;

I did the test, and it seems intel_encoder->type can show the correct type 
on my platform. It is similar with crtc_state->output_types.

Regards,
Libin

>
>--
>Ville Syrjälä
>Intel OTC
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 2/2] drm/i915/audio: Extend audio sync rate support for DP MST

2016-11-30 Thread Yang, Libin

>-Original Message-
>From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
>Sent: Wednesday, November 30, 2016 12:34 AM
>To: Yang, Libin <libin.y...@intel.com>; intel-gfx@lists.freedesktop.org;
>ville.syrj...@linux.intel.com; Vetter, Daniel <daniel.vet...@intel.com>;
>Pandiyan, Dhinakaran <dhinakaran.pandi...@intel.com>; Kp, Jeeja
><jeeja...@intel.com>; ti...@suse.de
>Cc: Yang, Libin <libin.y...@intel.com>
>Subject: Re: [PATCH 2/2] drm/i915/audio: Extend audio sync rate support for
>DP MST
>
>On Tue, 15 Nov 2016, libin.y...@intel.com wrote:
>> From: Libin Yang <libin.y...@intel.com>
>>
>> This patch extends the support of audio sample rate sync up to DP MST.
>>
>> Signed-off-by: Libin Yang <libin.y...@intel.com>
>> ---
>>  drivers/gpu/drm/i915/intel_audio.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_audio.c
>> b/drivers/gpu/drm/i915/intel_audio.c
>> index c8a1345..88ed869 100644
>> --- a/drivers/gpu/drm/i915/intel_audio.c
>> +++ b/drivers/gpu/drm/i915/intel_audio.c
>> @@ -807,7 +807,8 @@ static int
>i915_audio_component_sync_audio_rate(struct device *kdev, int port,
>>  intel_encoder = get_saved_enc(dev_priv, port, pipe);
>>  if (!intel_encoder || !intel_encoder->base.crtc ||
>>  (intel_encoder->type != INTEL_OUTPUT_HDMI &&
>> - intel_encoder->type != INTEL_OUTPUT_DP)) {
>> + intel_encoder->type != INTEL_OUTPUT_DP &&
>> + intel_encoder->type != INTEL_OUTPUT_DP_MST)) {
>
>I think the better option is to make absolutely sure we never store other kinds
>of encoders in dev_priv->av_enc_map[pipe] to begin with. I think that's true
>already, but please add
>
>   if (WARN_ON(intel_encoder->type != INTEL_OUTPUT_HDMI &&
>   intel_encoder->type != INTEL_OUTPUT_DP &&
>   intel_encoder->type != INTEL_OUTPUT_DP_MST))
>   return;
>
>near the beginning of intel_audio_codec_enable(), and remove the type
>checks here. This reduces the confusion about different kinds of checks after
>calling get_saved_enc().

We can't put the check at the beginning of the function.
We still need the check in the same place as we need get intel_encoder at first.

Regards,
Libin

>
>BR,
>Jani.
>
>
>>  DRM_DEBUG_KMS("Not valid for port %c\n",
>port_name(port));
>>  err = -ENODEV;
>>  goto unlock;
>
>--
>Jani Nikula, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 1/3] drm/i915/debugfs: add dp mst info

2016-11-29 Thread Yang, Libin

>-Original Message-
>From: Vivi, Rodrigo
>Sent: Wednesday, November 30, 2016 1:22 AM
>To: jani.nik...@linux.intel.com
>Cc: ville.syrj...@linux.intel.com; intel-gfx@lists.freedesktop.org; Yang, Libin
><libin.y...@intel.com>; Vetter, Daniel <daniel.vet...@intel.com>;
>ti...@suse.de; Pandiyan, Dhinakaran <dhinakaran.pandi...@intel.com>
>Subject: Re: [PATCH 1/3] drm/i915/debugfs: add dp mst info
>
>On Tue, 2016-11-29 at 11:24 +0200, Jani Nikula wrote:
>> On Mon, 28 Nov 2016, libin.y...@intel.com wrote:
>> > From: Libin Yang <libin.y...@intel.com>
>> >
>> > Add the DP MST info dump in debugfs.
>> >
>> > Signed-off-by: Libin Yang <libin.y...@intel.com>
>> > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandi...@intel.com>
>> > Reviewed-by: Lyude <cp...@redhat.com>
>> > Signed-off-by: Rodrigo Vivi <rodrigo.v...@intel.com>
>>
>> I don't think Rodrigo's sob is proper here, even if he pushed the
>> original version of the patch that got later reverted.
>
>Jani is right. I haven't signed this off.
>I believe the idea was to CC me probably.

Get it. I will take care next time.
I added you because the original patch has your signed-off :)

Regards,
Libin

>
>>
>> Anyway,
>>
>> Reviewed-by: Jani Nikula <jani.nik...@intel.com>
>>
>> > ---
>> >  drivers/gpu/drm/i915/i915_debugfs.c | 19 ++-
>> >  1 file changed, 18 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/drivers/gpu/drm/i915/i915_debugfs.c
>> > b/drivers/gpu/drm/i915/i915_debugfs.c
>> > index e7f731f..f5f88b2 100644
>> > --- a/drivers/gpu/drm/i915/i915_debugfs.c
>> > +++ b/drivers/gpu/drm/i915/i915_debugfs.c
>> > @@ -2877,6 +2877,20 @@ static void intel_dp_info(struct seq_file *m,
>> >_dp->aux);
>> >  }
>> >
>> > +static void intel_dp_mst_info(struct seq_file *m,
>> > +struct intel_connector *intel_connector) {
>> > +  struct intel_encoder *intel_encoder = intel_connector->encoder;
>> > +  struct intel_dp_mst_encoder *intel_mst =
>> > +  enc_to_mst(_encoder->base);
>> > +  struct intel_digital_port *intel_dig_port = intel_mst->primary;
>> > +  struct intel_dp *intel_dp = _dig_port->dp;
>> > +  bool has_audio = drm_dp_mst_port_has_audio(_dp->mst_mgr,
>> > +  intel_connector->port);
>> > +
>> > +  seq_printf(m, "\taudio support: %s\n", yesno(has_audio)); }
>> > +
>> >  static void intel_hdmi_info(struct seq_file *m,
>> >struct intel_connector *intel_connector)  { @@ -
>2919,7
>> > +2933,10 @@ static void intel_connector_info(struct seq_file *m,
>> >switch (connector->connector_type) {
>> >case DRM_MODE_CONNECTOR_DisplayPort:
>> >case DRM_MODE_CONNECTOR_eDP:
>> > -  intel_dp_info(m, intel_connector);
>> > +  if (intel_encoder->type == INTEL_OUTPUT_DP_MST)
>> > +  intel_dp_mst_info(m, intel_connector);
>> > +  else
>> > +  intel_dp_info(m, intel_connector);
>> >break;
>> >case DRM_MODE_CONNECTOR_LVDS:
>> >if (intel_encoder->type == INTEL_OUTPUT_LVDS)
>>

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 1/2] drm/i915/audio: extend get_saved_enc() to support more scenarios

2016-11-28 Thread Yang, Libin

>-Original Message-
>From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
>Sent: Friday, November 25, 2016 10:46 PM
>To: Yang, Libin <libin.y...@intel.com>; intel-gfx@lists.freedesktop.org;
>ville.syrj...@linux.intel.com; Vetter, Daniel <daniel.vet...@intel.com>;
>Pandiyan, Dhinakaran <dhinakaran.pandi...@intel.com>; Kp, Jeeja
><jeeja...@intel.com>; ti...@suse.de
>Cc: Yang, Libin <libin.y...@intel.com>; Libin Yang <libin.y...@linux.intel.com>
>Subject: Re: [PATCH 1/2] drm/i915/audio: extend get_saved_enc() to support
>more scenarios
>
>On Tue, 15 Nov 2016, libin.y...@intel.com wrote:
>> From: Libin Yang <libin.y...@linux.intel.com>
>>
>> When bootup, audio driver may not know it is MST or not. The audio
>> driver will poll all the port & pipe combinations in either MST or
>> Non-MST mode. get_saved_enc() should handle this situation.
>>
>> Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
>> ---
>>  drivers/gpu/drm/i915/intel_audio.c | 32
>> 
>>  1 file changed, 28 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_audio.c
>> b/drivers/gpu/drm/i915/intel_audio.c
>> index 49f1053..c8a1345 100644
>> --- a/drivers/gpu/drm/i915/intel_audio.c
>> +++ b/drivers/gpu/drm/i915/intel_audio.c
>> @@ -737,25 +737,49 @@ static int
>i915_audio_component_get_cdclk_freq(struct device *kdev)
>>  return dev_priv->cdclk_freq;
>>  }
>>
>> +/*
>> + * get the intel_encoder according to the parameter port and pipe
>> + * intel_encoder is saved by the index of pipe
>> + * MST & (pipe >= 0): return the av_enc_map[pipe],
>> + *   when port is matched
>> + * MST & (pipe < 0): this is invalid
>> + * Non-MST & (pipe >= 0): only pipe = 0 (the first device entry)
>> + *   will get the right intel_encoder with port matched
>> + * Non-MST & (pipe < 0): get the right intel_encoder with port
>> +matched
>
>This essentially describes the code in English. I can read the code. I need to
>know more about the higher level of what this does and *why*.

In initialization, audio driver will call functions get_eld() and etc. But
at that time, audio driver may not know whether it is DP MST or not.
In the original function get_saved_enc(), if it is DP MST, it will set the pipe
to the correct value, otherwise, it will be set -1.

Although audio driver can get the knowledge whether it is in DP MST 
mode or not by reading the codec register. But it will drop performance
each time it call the get_eld and other functions. As gfx driver can easily
know whether it is in DP MST mode or not. I would like to extend the
get_saved_enc() function to handle the situation that audio driver still
send the device id info even it is in DP mode. In this situation, 
get_saved_enc() will return the correct intel_encoder instead of panic.

>
>I also look at the call sites of get_saved_enc and wonder why they have
>different checks for the return values. Also patch 2/2 only modifies one of
>them, not both. Why?

The 2 check should be similar? In sync_audio_rate(), it calls get_saved_enc()
and checked base.crtc, I think it is because it will use base.crtc later.

And it will check the intel_encoder->type because this function only need
handle HDMI/DP/DP MST situation to setup  the audio config.

Regards,
Libin

>
>So maybe I'm just too clueless about DP (MST) audio in general, and I
>wouldn't even get offended if you told me that. But I don't think the commit
>message and the comments in this patch properly help me either.
>
>BR,
>Jani.
>
>
>> + */
>>  static struct intel_encoder *get_saved_enc(struct drm_i915_private
>*dev_priv,
>> int port, int pipe)
>>  {
>> +struct intel_encoder *encoder;
>>
>>  if (WARN_ON(pipe >= I915_MAX_PIPES))
>>  return NULL;
>>
>>  /* MST */
>> -if (pipe >= 0)
>> -return dev_priv->av_enc_map[pipe];
>> +if (pipe >= 0) {
>> +encoder = dev_priv->av_enc_map[pipe];
>> +/*
>> + * when bootup, audio driver may not know it is
>> + * MST or not. So it will poll all the port & pipe
>> + * combinations
>> + */
>> +if (encoder != NULL && encoder->port == port &&
>> +encoder->type == INTEL_OUTPUT_DP_MST)
>> +return encoder;
>> +}
>>
>>  /* Non-MST */
>> -for_each_pipe(dev_priv, pipe) {
>> -struct intel_e

Re: [Intel-gfx] [PATCH v3] drm/i915: start adding dp mst audio

2016-11-26 Thread Yang, Libin
Hi Jani,

Thanks for review. I will split this patch.

Regards,
Libin

> -Original Message-
> From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
> Sent: Friday, November 25, 2016 10:23 PM
> To: Yang, Libin <libin.y...@intel.com>; intel-gfx@lists.freedesktop.org;
> ville.syrj...@linux.intel.com; Vetter, Daniel <daniel.vet...@intel.com>;
> ti...@suse.de
> Cc: Yang, Libin <libin.y...@intel.com>; Libin Yang
> <libin.y...@linux.intel.com>; Pandiyan, Dhinakaran
> <dhinakaran.pandi...@intel.com>; Vivi, Rodrigo <rodrigo.v...@intel.com>
> Subject: Re: [PATCH v3] drm/i915: start adding dp mst audio
> 
> On Mon, 14 Nov 2016, libin.y...@intel.com wrote:
> > From: Libin Yang <libin.y...@linux.intel.com>
> >
> > (This patch is developed by Dave Airlie <airl...@redhat.com>
> > originally)
> >
> > This patch adds support for DP MST audio in i915.
> >
> > Enable audio codec when DP MST is enabled if has_audio flag is set.
> > Disable audio codec when DP MST is disabled if has_audio flag is set.
> >
> > Another separated patches to support DP MST audio will be implemented
> > in audio driver.
> >
> > v2:
> > Rebased.
> > v3:
> > refine to support updated intel_audio_codec_enable()
> 
> I view this patch different from usual because this regressed and was
> reverted before. Please split this up to three patches:
> 
> 1) Do intel_dp_mst_info() in i915_debugfs.c. The information printed
>looks at the sink, not pipe config, so this is not dependent on the
>rest.
> 
> 2) Abstract intel_ddi_is_audio_enabled(). It's a nice clean
>non-functional change.
> 
> 3) The rest. The last patch *must* reference the original commit and the
>revert:
> 
>3708d5e082c3 ("drm/i915: start adding dp mst audio")
>be754b101f70 ("Revert "drm/i915: start adding dp mst audio"")
> 
>Please rename the patch title to something like, "enable dp mst
>audio" to distinguish.
> 
> If the split had been done originally, we would only have reverted part 3, not
> all of it. Please do it now.
> 
> More comments inline.
> 
> >
> > Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandi...@intel.com>
> > Reviewed-by: Lyude <cp...@redhat.com>
> > Signed-off-by: Rodrigo Vivi <rodrigo.v...@intel.com>
> > Link:
> > http://patchwork.freedesktop.org/patch/msgid/1474334681-22690-6-git-se
> > nd-email-dhinakaran.pandi...@intel.com
> > ---
> >  drivers/gpu/drm/i915/i915_debugfs.c | 19 ++-
> >  drivers/gpu/drm/i915/intel_ddi.c| 20 +++-
> >  drivers/gpu/drm/i915/intel_dp_mst.c | 18 ++
> >  drivers/gpu/drm/i915/intel_drv.h|  2 ++
> >  4 files changed, 53 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_debugfs.c
> > b/drivers/gpu/drm/i915/i915_debugfs.c
> > index bce3880..3442381 100644
> > --- a/drivers/gpu/drm/i915/i915_debugfs.c
> > +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> > @@ -2893,6 +2893,20 @@ static void intel_dp_info(struct seq_file *m,
> > _dp->aux);
> >  }
> >
> > +static void intel_dp_mst_info(struct seq_file *m,
> > + struct intel_connector *intel_connector) {
> > +   struct intel_encoder *intel_encoder = intel_connector->encoder;
> > +   struct intel_dp_mst_encoder *intel_mst =
> > +   enc_to_mst(_encoder->base);
> > +   struct intel_digital_port *intel_dig_port = intel_mst->primary;
> > +   struct intel_dp *intel_dp = _dig_port->dp;
> > +   bool has_audio = drm_dp_mst_port_has_audio(_dp->mst_mgr,
> > +   intel_connector->port);
> > +
> > +   seq_printf(m, "\taudio support: %s\n", yesno(has_audio)); }
> > +
> >  static void intel_hdmi_info(struct seq_file *m,
> > struct intel_connector *intel_connector)  { @@ -
> 2935,7
> > +2949,10 @@ static void intel_connector_info(struct seq_file *m,
> > switch (connector->connector_type) {
> > case DRM_MODE_CONNECTOR_DisplayPort:
> > case DRM_MODE_CONNECTOR_eDP:
> > -   intel_dp_info(m, intel_connector);
> > +   if (intel_encoder->type == INTEL_OUTPUT_DP_MST)
> > +   intel_dp_mst_info(m, intel_connector);
> > +   else
> > +   intel_dp_info(m, intel_connector);
> 
> The above two hunks make up patch 1/3.
> 
> > 

Re: [Intel-gfx] [PATCH v3] drm/i915: start adding dp mst audio

2016-11-16 Thread Yang, Libin
Hi all,

Could anyone help review the patches? Thanks.

Regards,
Libin


> -Original Message-
> From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org] On Behalf Of
> Yang, Libin
> Sent: Monday, November 14, 2016 1:41 PM
> To: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com;
> ville.syrj...@linux.intel.com; Vetter, Daniel <daniel.vet...@intel.com>;
> ti...@suse.de; Pandiyan, Dhinakaran <dhinakaran.pandi...@intel.com>;
> Kp, Jeeja <jeeja...@intel.com>
> Cc: Libin Yang <libin.y...@linux.intel.com>; Pandiyan, Dhinakaran
> <dhinakaran.pandi...@intel.com>; Vivi, Rodrigo <rodrigo.v...@intel.com>
> Subject: Re: [Intel-gfx] [PATCH v3] drm/i915: start adding dp mst audio
> 
> As the dp-mst flicker issue has been fixed by Dhinakaran, let's resend this
> patch to gfx driver to support DP-MST audio.
> 
> This patch is also refined to support the new intel_audio_codec_enable()
> parameters.
> 
> Regards,
> Libin
> 
> 
> > -Original Message-
> > From: Yang, Libin
> > Sent: Monday, November 14, 2016 1:32 PM
> > To: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com;
> > ville.syrj...@linux.intel.com; Vetter, Daniel
> > <daniel.vet...@intel.com>; ti...@suse.de
> > Cc: Yang, Libin <libin.y...@intel.com>; Libin Yang
> > <libin.y...@linux.intel.com>; Pandiyan, Dhinakaran
> > <dhinakaran.pandi...@intel.com>; Vivi, Rodrigo
> > <rodrigo.v...@intel.com>
> > Subject: [PATCH v3] drm/i915: start adding dp mst audio
> >
> > From: Libin Yang <libin.y...@linux.intel.com>
> >
> > (This patch is developed by Dave Airlie <airl...@redhat.com>
> > originally)
> >
> > This patch adds support for DP MST audio in i915.
> >
> > Enable audio codec when DP MST is enabled if has_audio flag is set.
> > Disable audio codec when DP MST is disabled if has_audio flag is set.
> >
> > Another separated patches to support DP MST audio will be implemented
> > in audio driver.
> >
> > v2:
> > Rebased.
> > v3:
> > refine to support updated intel_audio_codec_enable()
> >
> > Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandi...@intel.com>
> > Reviewed-by: Lyude <cp...@redhat.com>
> > Signed-off-by: Rodrigo Vivi <rodrigo.v...@intel.com>
> > Link: http://patchwork.freedesktop.org/patch/msgid/1474334681-22690-6-
> > git-send-email-dhinakaran.pandi...@intel.com
> > ---
> >  drivers/gpu/drm/i915/i915_debugfs.c | 19 ++-
> >  drivers/gpu/drm/i915/intel_ddi.c| 20 +++-
> >  drivers/gpu/drm/i915/intel_dp_mst.c | 18 ++
> >  drivers/gpu/drm/i915/intel_drv.h|  2 ++
> >  4 files changed, 53 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_debugfs.c
> > b/drivers/gpu/drm/i915/i915_debugfs.c
> > index bce3880..3442381 100644
> > --- a/drivers/gpu/drm/i915/i915_debugfs.c
> > +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> > @@ -2893,6 +2893,20 @@ static void intel_dp_info(struct seq_file *m,
> > _dp->aux);
> >  }
> >
> > +static void intel_dp_mst_info(struct seq_file *m,
> > + struct intel_connector *intel_connector) {
> > +   struct intel_encoder *intel_encoder = intel_connector->encoder;
> > +   struct intel_dp_mst_encoder *intel_mst =
> > +   enc_to_mst(_encoder->base);
> > +   struct intel_digital_port *intel_dig_port = intel_mst->primary;
> > +   struct intel_dp *intel_dp = _dig_port->dp;
> > +   bool has_audio = drm_dp_mst_port_has_audio(_dp->mst_mgr,
> > +   intel_connector->port);
> > +
> > +   seq_printf(m, "\taudio support: %s\n", yesno(has_audio)); }
> > +
> >  static void intel_hdmi_info(struct seq_file *m,
> > struct intel_connector *intel_connector)  { @@ -
> > 2935,7 +2949,10 @@ static void intel_connector_info(struct seq_file *m,
> > switch (connector->connector_type) {
> > case DRM_MODE_CONNECTOR_DisplayPort:
> > case DRM_MODE_CONNECTOR_eDP:
> > -   intel_dp_info(m, intel_connector);
> > +   if (intel_encoder->type == INTEL_OUTPUT_DP_MST)
> > +   intel_dp_mst_info(m, intel_connector);
> > +   else
> > +   intel_dp_info(m, intel_connector);
> > break;
> > case DRM_MODE_CONNECTOR_LVDS:
> > if (in

Re: [Intel-gfx] [PATCH v3] drm/i915: start adding dp mst audio

2016-11-13 Thread Yang, Libin
As the dp-mst flicker issue has been fixed by Dhinakaran, let's resend this 
patch to gfx driver to support DP-MST audio.

This patch is also refined to support the new intel_audio_codec_enable() 
parameters.

Regards,
Libin


> -Original Message-
> From: Yang, Libin
> Sent: Monday, November 14, 2016 1:32 PM
> To: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com;
> ville.syrj...@linux.intel.com; Vetter, Daniel <daniel.vet...@intel.com>;
> ti...@suse.de
> Cc: Yang, Libin <libin.y...@intel.com>; Libin Yang
> <libin.y...@linux.intel.com>; Pandiyan, Dhinakaran
> <dhinakaran.pandi...@intel.com>; Vivi, Rodrigo <rodrigo.v...@intel.com>
> Subject: [PATCH v3] drm/i915: start adding dp mst audio
> 
> From: Libin Yang <libin.y...@linux.intel.com>
> 
> (This patch is developed by Dave Airlie <airl...@redhat.com> originally)
> 
> This patch adds support for DP MST audio in i915.
> 
> Enable audio codec when DP MST is enabled if has_audio flag is set.
> Disable audio codec when DP MST is disabled if has_audio flag is set.
> 
> Another separated patches to support DP MST audio will be implemented in
> audio driver.
> 
> v2:
> Rebased.
> v3:
> refine to support updated intel_audio_codec_enable()
> 
> Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandi...@intel.com>
> Reviewed-by: Lyude <cp...@redhat.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.v...@intel.com>
> Link: http://patchwork.freedesktop.org/patch/msgid/1474334681-22690-6-
> git-send-email-dhinakaran.pandi...@intel.com
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 19 ++-
>  drivers/gpu/drm/i915/intel_ddi.c| 20 +++-
>  drivers/gpu/drm/i915/intel_dp_mst.c | 18 ++
>  drivers/gpu/drm/i915/intel_drv.h|  2 ++
>  4 files changed, 53 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c
> b/drivers/gpu/drm/i915/i915_debugfs.c
> index bce3880..3442381 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -2893,6 +2893,20 @@ static void intel_dp_info(struct seq_file *m,
>   _dp->aux);
>  }
> 
> +static void intel_dp_mst_info(struct seq_file *m,
> +   struct intel_connector *intel_connector) {
> + struct intel_encoder *intel_encoder = intel_connector->encoder;
> + struct intel_dp_mst_encoder *intel_mst =
> + enc_to_mst(_encoder->base);
> + struct intel_digital_port *intel_dig_port = intel_mst->primary;
> + struct intel_dp *intel_dp = _dig_port->dp;
> + bool has_audio = drm_dp_mst_port_has_audio(_dp->mst_mgr,
> + intel_connector->port);
> +
> + seq_printf(m, "\taudio support: %s\n", yesno(has_audio)); }
> +
>  static void intel_hdmi_info(struct seq_file *m,
>   struct intel_connector *intel_connector)  { @@ -
> 2935,7 +2949,10 @@ static void intel_connector_info(struct seq_file *m,
>   switch (connector->connector_type) {
>   case DRM_MODE_CONNECTOR_DisplayPort:
>   case DRM_MODE_CONNECTOR_eDP:
> - intel_dp_info(m, intel_connector);
> + if (intel_encoder->type == INTEL_OUTPUT_DP_MST)
> + intel_dp_mst_info(m, intel_connector);
> + else
> + intel_dp_info(m, intel_connector);
>   break;
>   case DRM_MODE_CONNECTOR_LVDS:
>   if (intel_encoder->type == INTEL_OUTPUT_LVDS) diff --git
> a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index 0ad4e16..b1e3442 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -1951,6 +1951,19 @@ void intel_ddi_prepare_link_retrain(struct
> intel_dp *intel_dp)
>   udelay(600);
>  }
> 
> +bool intel_ddi_is_audio_enabled(struct drm_i915_private *dev_priv,
> +  struct intel_crtc *intel_crtc)
> +{
> + u32 temp;
> +
> + if (intel_display_power_is_enabled(dev_priv,
> POWER_DOMAIN_AUDIO)) {
> + temp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD);
> + if (temp & AUDIO_OUTPUT_ENABLE(intel_crtc->pipe))
> + return true;
> + }
> + return false;
> +}
> +
>  void intel_ddi_get_config(struct intel_encoder *encoder,
> struct intel_crtc_state *pipe_config)  { @@ -2016,11
> +2029,8 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
>   break;
>   }
> 
> - if (intel_display_power_is_en

Re: [Intel-gfx] [PATCH v2] drm/i915/audio: fix hdmi audio noise issue

2016-11-11 Thread Yang, Libin

> -Original Message-
> From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
> Sent: Friday, November 11, 2016 4:41 PM
> To: Yang, Libin <libin.y...@intel.com>; intel-gfx@lists.freedesktop.org;
> ville.syrj...@linux.intel.com; Vetter, Daniel <daniel.vet...@intel.com>;
> ti...@suse.de
> Subject: RE: [PATCH v2] drm/i915/audio: fix hdmi audio noise issue
> 
> On Fri, 11 Nov 2016, "Yang, Libin" <libin.y...@intel.com> wrote:
> > Hi Jani,
> >
> >> -Original Message-
> >> From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
> >> Sent: Thursday, November 10, 2016 6:37 PM
> >> To: Yang, Libin <libin.y...@intel.com>;
> >> intel-gfx@lists.freedesktop.org; ville.syrj...@linux.intel.com;
> >> Vetter, Daniel <daniel.vet...@intel.com>; ti...@suse.de
> >> Cc: Yang, Libin <libin.y...@intel.com>
> >> Subject: Re: [PATCH v2] drm/i915/audio: fix hdmi audio noise issue
> >>
> >> On Thu, 10 Nov 2016, libin.y...@intel.com wrote:
> >> > From: Libin Yang <libin.y...@intel.com>
> >> >
> >> > Some monitors will have noise or even no sound after applying the
> >> > patch 6014ac12.
> >> >
> >> > In patch 6014ac12, it will reset the cts value to 0 for HDMI.
> >> > However, we need to disable Enable CTS or M Prog bit. This is the
> >> > initial setting after HW reset.
> >> >
> >> > Fixes: 6014ac122ed0 ("drm/i915/audio: set proper N/M in modeset")
> >> > Signed-off-by: Libin Yang <libin.y...@intel.com>
> >> > ---
> >> >  drivers/gpu/drm/i915/intel_audio.c | 15 ---
> >> >  1 file changed, 12 insertions(+), 3 deletions(-)
> >> >
> >> > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> >> > b/drivers/gpu/drm/i915/intel_audio.c
> >> > index 813fd74..a472d35 100644
> >> > --- a/drivers/gpu/drm/i915/intel_audio.c
> >> > +++ b/drivers/gpu/drm/i915/intel_audio.c
> >> > @@ -332,6 +332,13 @@ hsw_hdmi_audio_config_update(struct
> intel_crtc
> >> *intel_crtc, enum port port,
> >> >  int n;
> >> >  u32 tmp;
> >> >
> >> > +/* reset CTS value to 0 */
> >> > +tmp = I915_READ(HSW_AUD_M_CTS_ENABLE(pipe));
> >> > +tmp &= ~AUD_CONFIG_M_MASK;
> >> > +tmp &= ~AUD_M_CTS_M_VALUE_INDEX;
> >> > +tmp |= AUD_M_CTS_M_PROG_ENABLE;
> >> > +I915_WRITE(HSW_AUD_M_CTS_ENABLE(pipe), tmp);
> >> > +
> >> >  tmp = I915_READ(HSW_AUD_CFG(pipe));
> >> >  tmp &= ~AUD_CONFIG_N_VALUE_INDEX;
> >> >  tmp &= ~AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK;
> >> > @@ -351,10 +358,12 @@ hsw_hdmi_audio_config_update(struct
> >> > intel_crtc *intel_crtc, enum port port,
> >> >
> >> >  I915_WRITE(HSW_AUD_CFG(pipe), tmp);
> >> >
> >> > +/*
> >> > + * Let's disable "Enable CTS or M Prog bit"
> >> > + * and let HW calculate the value
> >> > + */
> >> >  tmp = I915_READ(HSW_AUD_M_CTS_ENABLE(pipe));
> >> > -tmp &= ~AUD_CONFIG_M_MASK;
> >> > -tmp &= ~AUD_M_CTS_M_VALUE_INDEX;
> >> > -tmp |= AUD_M_CTS_M_PROG_ENABLE;
> >> > +tmp &= ~AUD_M_CTS_M_PROG_ENABLE;
> >> >  I915_WRITE(HSW_AUD_M_CTS_ENABLE(pipe), tmp);
> >>
> >> You did not address my review comment on the earlier version:
> >>
> >> Is it necessary to do the HSW_AUD_M_CTS_ENABLE updates in two places?
> >> Why do you both enable and disable AUD_M_CTS_M_PROG_ENABLE bit
> here?
> >
> > Sorry, I missed your comments.
> >
> > The first doing the HSW_AUD_M_CTS_ENABLE is to reset the M value to 0.
> > The second doing the HSW_AUD_M_CTS_ENABLE is to let HW calculate the
> M value.
> >
> > Or we can just try to disable the HSW_AUD_M_CTS_ENABLE bit. What's
> your opinion?
> 
> I would have thought just doing the latter would be sufficient. Please test.

I have done the test on 32KHz, 44.1KHz, 48KHz, 88KHz, it is OK.

Regards,
Libin

> 
> BR,
> Jani.
> 
> >
> > Regards,
> > Libin
> >
> >>
> >> BR,
> >> Jani.
> >>
> >>
> >> >  }
> >>
> >> --
> >> Jani Nikula, Intel Open Source Technology Center
> 
> --
> Jani Nikula, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v2] drm/i915/audio: fix hdmi audio noise issue

2016-11-10 Thread Yang, Libin
Hi Jani,

> -Original Message-
> From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
> Sent: Thursday, November 10, 2016 6:37 PM
> To: Yang, Libin <libin.y...@intel.com>; intel-gfx@lists.freedesktop.org;
> ville.syrj...@linux.intel.com; Vetter, Daniel <daniel.vet...@intel.com>;
> ti...@suse.de
> Cc: Yang, Libin <libin.y...@intel.com>
> Subject: Re: [PATCH v2] drm/i915/audio: fix hdmi audio noise issue
> 
> On Thu, 10 Nov 2016, libin.y...@intel.com wrote:
> > From: Libin Yang <libin.y...@intel.com>
> >
> > Some monitors will have noise or even no sound after applying the
> > patch 6014ac12.
> >
> > In patch 6014ac12, it will reset the cts value to 0 for HDMI.
> > However, we need to disable Enable CTS or M Prog bit. This is the
> > initial setting after HW reset.
> >
> > Fixes: 6014ac122ed0 ("drm/i915/audio: set proper N/M in modeset")
> > Signed-off-by: Libin Yang <libin.y...@intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_audio.c | 15 ---
> >  1 file changed, 12 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> > b/drivers/gpu/drm/i915/intel_audio.c
> > index 813fd74..a472d35 100644
> > --- a/drivers/gpu/drm/i915/intel_audio.c
> > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > @@ -332,6 +332,13 @@ hsw_hdmi_audio_config_update(struct intel_crtc
> *intel_crtc, enum port port,
> > int n;
> > u32 tmp;
> >
> > +   /* reset CTS value to 0 */
> > +   tmp = I915_READ(HSW_AUD_M_CTS_ENABLE(pipe));
> > +   tmp &= ~AUD_CONFIG_M_MASK;
> > +   tmp &= ~AUD_M_CTS_M_VALUE_INDEX;
> > +   tmp |= AUD_M_CTS_M_PROG_ENABLE;
> > +   I915_WRITE(HSW_AUD_M_CTS_ENABLE(pipe), tmp);
> > +
> > tmp = I915_READ(HSW_AUD_CFG(pipe));
> > tmp &= ~AUD_CONFIG_N_VALUE_INDEX;
> > tmp &= ~AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK;
> > @@ -351,10 +358,12 @@ hsw_hdmi_audio_config_update(struct intel_crtc
> > *intel_crtc, enum port port,
> >
> > I915_WRITE(HSW_AUD_CFG(pipe), tmp);
> >
> > +   /*
> > +* Let's disable "Enable CTS or M Prog bit"
> > +* and let HW calculate the value
> > +*/
> > tmp = I915_READ(HSW_AUD_M_CTS_ENABLE(pipe));
> > -   tmp &= ~AUD_CONFIG_M_MASK;
> > -   tmp &= ~AUD_M_CTS_M_VALUE_INDEX;
> > -   tmp |= AUD_M_CTS_M_PROG_ENABLE;
> > +   tmp &= ~AUD_M_CTS_M_PROG_ENABLE;
> > I915_WRITE(HSW_AUD_M_CTS_ENABLE(pipe), tmp);
> 
> You did not address my review comment on the earlier version:
> 
> Is it necessary to do the HSW_AUD_M_CTS_ENABLE updates in two places?
> Why do you both enable and disable AUD_M_CTS_M_PROG_ENABLE bit here?

Sorry, I missed your comments.

The first doing the HSW_AUD_M_CTS_ENABLE is to reset the M value to 0.
The second doing the HSW_AUD_M_CTS_ENABLE is to let HW calculate the M value.

Or we can just try to disable the HSW_AUD_M_CTS_ENABLE bit. What's your opinion?

Regards,
Libin

> 
> BR,
> Jani.
> 
> 
> >  }
> 
> --
> Jani Nikula, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915/audio: fix hdmi audio noise issue

2016-11-09 Thread Yang, Libin

> -Original Message-
> From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
> Sent: Wednesday, November 9, 2016 6:59 PM
> To: Yang, Libin <libin.y...@intel.com>; intel-gfx@lists.freedesktop.org;
> ville.syrj...@linux.intel.com; Vetter, Daniel <daniel.vet...@intel.com>;
> ti...@suse.de
> Cc: Yang, Libin <libin.y...@intel.com>
> Subject: Re: [PATCH] drm/i915/audio: fix hdmi audio noise issue
> 
> On Wed, 09 Nov 2016, libin.y...@intel.com wrote:
> > From: Libin Yang <libin.y...@intel.com>
> >
> > This issue is caused by:
> > 6014ac12: drm/i915/audio: set proper N/M in modeset
> >
> > Some special monitors will have noise or even no sound after applying
> > the patch 6014ac12.
> >
> > In patch 6014ac12, it will reset the cts value to 0 for HDMI.
> > However, we need disable Enable CTS or M Prog bit. This is the initial
> > setting after HW reset.
> >
> 
> Fixes: 6014ac122ed0 ("drm/i915/audio: set proper N/M in modeset")

Get it. Thanks.

> 
> > Signed-off-by: Libin Yang <libin.y...@intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_audio.c | 15 ---
> >  1 file changed, 12 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> > b/drivers/gpu/drm/i915/intel_audio.c
> > index 813fd74..a472d35 100644
> > --- a/drivers/gpu/drm/i915/intel_audio.c
> > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > @@ -332,6 +332,13 @@ hsw_hdmi_audio_config_update(struct intel_crtc
> *intel_crtc, enum port port,
> > int n;
> > u32 tmp;
> >
> > +   /* reset CTS value to 0 */
> > +   tmp = I915_READ(HSW_AUD_M_CTS_ENABLE(pipe));
> > +   tmp &= ~AUD_CONFIG_M_MASK;
> > +   tmp &= ~AUD_M_CTS_M_VALUE_INDEX;
> > +   tmp |= AUD_M_CTS_M_PROG_ENABLE;
> > +   I915_WRITE(HSW_AUD_M_CTS_ENABLE(pipe), tmp);
> > +
> > tmp = I915_READ(HSW_AUD_CFG(pipe));
> > tmp &= ~AUD_CONFIG_N_VALUE_INDEX;
> > tmp &= ~AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK;
> > @@ -351,10 +358,12 @@ hsw_hdmi_audio_config_update(struct intel_crtc
> > *intel_crtc, enum port port,
> >
> > I915_WRITE(HSW_AUD_CFG(pipe), tmp);
> >
> > +   /*
> > +* Let's disable "Enable CTS or M Prog bit"
> > +* and let HW calculate the value
> > +*/
> > tmp = I915_READ(HSW_AUD_M_CTS_ENABLE(pipe));
> > -   tmp &= ~AUD_CONFIG_M_MASK;
> > -   tmp &= ~AUD_M_CTS_M_VALUE_INDEX;
> > -   tmp |= AUD_M_CTS_M_PROG_ENABLE;
> > +   tmp &= ~AUD_M_CTS_M_PROG_ENABLE;
> > I915_WRITE(HSW_AUD_M_CTS_ENABLE(pipe), tmp);
> 
> Is it necessary to do the HSW_AUD_M_CTS_ENABLE updates in two places?
> Why do you both enable and disable AUD_M_CTS_M_PROG_ENABLE bit here?
> 
> BR,
> Jani.
> 
> 
> >  }
> 
> --
> Jani Nikula, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [i-g-t PATCH v2] tests: do snd_hda_intel unbind before unload in module reload test

2016-10-31 Thread Yang, Libin
Reviewed-by: Libin Yang <libin.y...@intel.com>

Regards,
Libin


> -Original Message-
> From: Nikula, Jani
> Sent: Monday, October 31, 2016 7:00 PM
> To: Nikula, Jani <jani.nik...@intel.com>; intel-gfx@lists.freedesktop.org
> Cc: Zhang, Keqiao <keqiao.zh...@intel.com>; Yang, Libin
> <libin.y...@intel.com>
> Subject: [i-g-t PATCH v2] tests: do snd_hda_intel unbind before unload in
> module reload test
> 
> Try to make sure the snd_hda_intel module is not in use, and can be
> unloaded.
> 
> v2: unbind all cards (Libin)
> 
> Cc: Keqiao Zhang <keqiao.zh...@intel.com>
> Cc: Libin Yang <libin.y...@intel.com>
> Signed-off-by: Jani Nikula <jani.nik...@intel.com>
> 
> ---
> 
> Keqiao, Libin, here's the script this patch is against:
> 
> https://cgit.freedesktop.org/drm/igt-gpu-
> tools/tree/tests/drv_module_reload_basic
> ---
>  tests/drv_module_reload_basic | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/tests/drv_module_reload_basic b/tests/drv_module_reload_basic
> index b8cad88133e9..105852a56b46 100755
> --- a/tests/drv_module_reload_basic
> +++ b/tests/drv_module_reload_basic
> @@ -33,6 +33,11 @@ function reload() {
>   pkill alsactl
>   snd_hda_intel_unloaded=0
>   if mod_loaded snd_hda_intel; then
> + # unbind sound cards
> + for card in $(find /sys/bus/pci/drivers/snd_hda_intel -name
> ":*" -printf "%f\n"); do
> + echo $card >
> /sys/bus/pci/drivers/snd_hda_intel/unbind
> + done
> +
>   if rmmod snd_hda_intel; then
>   snd_hda_intel_unloaded=1
>   else
> --
> 2.1.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [i-g-t PATCH] tests: do snd_hda_intel unbind before unload in module reload test

2016-10-31 Thread Yang, Libin

> -Original Message-
> From: Nikula, Jani
> Sent: Monday, October 31, 2016 4:40 PM
> To: intel-gfx@lists.freedesktop.org
> Cc: Nikula, Jani <jani.nik...@intel.com>; Zhang, Keqiao
> <keqiao.zh...@intel.com>; Yang, Libin <libin.y...@intel.com>
> Subject: [i-g-t PATCH] tests: do snd_hda_intel unbind before unload in
> module reload test
> 
> Try to make sure the snd_hda_intel module is not in use, and can be
> unloaded.
> 
> Cc: Keqiao Zhang <keqiao.zh...@intel.com>
> Cc: Libin Yang <libin.y...@intel.com>
> Signed-off-by: Jani Nikula <jani.nik...@intel.com>
> 
> ---
> 
> Keqiao, Libin, here's the script this patch is against:
> 
> https://cgit.freedesktop.org/drm/igt-gpu-
> tools/tree/tests/drv_module_reload_basic
> ---
>  tests/drv_module_reload_basic | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/tests/drv_module_reload_basic b/tests/drv_module_reload_basic
> index b8cad88133e9..c0676fc65db0 100755
> --- a/tests/drv_module_reload_basic
> +++ b/tests/drv_module_reload_basic
> @@ -33,6 +33,9 @@ function reload() {
>   pkill alsactl
>   snd_hda_intel_unloaded=0
>   if mod_loaded snd_hda_intel; then
> + if [ -e /sys/bus/pci/drivers/snd_hda_intel/unbind ]; then
> + echo ":00:03.0" >

":00:03.0" is platform related.
We should check lspci -vvv |grep Audio to get the number.
Or we can check /sys/bus/pci/drivers/snd_hda_intel/ folder to get the number.
And sometimes there are 2 sound cards to unbind.

Regards,
Libin

> /sys/bus/pci/drivers/snd_hda_intel/unbind
> + fi
>   if rmmod snd_hda_intel; then
>   snd_hda_intel_unloaded=1
>   else
> --
> 2.1.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v4 1/2] drm/i915/dp: Enable DP audio stall fix for gen9 platforms

2016-10-28 Thread Yang, Libin

> -Original Message-
> From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org] On Behalf Of
> Pandiyan, Dhinakaran
> Sent: Thursday, October 27, 2016 2:14 AM
> To: ville.syrj...@linux.intel.com
> Cc: Nikula, Jani ; Kp, Jeeja ;
> intel-gfx@lists.freedesktop.org; libin.y...@linux.intel.com
> Subject: Re: [Intel-gfx] [PATCH v4 1/2] drm/i915/dp: Enable DP audio stall fix
> for gen9 platforms
> 
> On Wed, 2016-10-26 at 12:11 +0300, Ville Syrjälä wrote:
> > On Tue, Oct 25, 2016 at 07:37:36PM -0700, Dhinakaran Pandiyan wrote:
> > > Enabling DP audio stall fix is necessary to play audio over DP HBR2.
> > > So, let's set this bit right before enabling the audio codec.
> > > Playing audio without setting this bit results in pipe FIFO underruns.
> > >
> > > This workaround is applicable only for audio sample rates up to
> > > 96kHz. For frequencies above 96kHz, this is insufficient and cdclk
> > > should be increased to at least 432 MHz, just like BDW. Since, the
> > > audio driver does not support sample rates > 48 kHz, we are safe with
> this fix for now.
> > >
> > > v2: Inlined the code change within hsw_audio_codec_enable() (Jani)
> > > Fixed the port clock typo
> > > Added TODO comment
> > > Signed-off-by: Dhinakaran Pandiyan 
> > > ---
> > >  drivers/gpu/drm/i915/i915_reg.h|  5 +
> > >  drivers/gpu/drm/i915/intel_audio.c | 30
> > > +-
> > >  2 files changed, 34 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/i915/i915_reg.h
> > > b/drivers/gpu/drm/i915/i915_reg.h index 00efaa1..76dac48 100644
> > > --- a/drivers/gpu/drm/i915/i915_reg.h
> > > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > > @@ -6236,6 +6236,11 @@ enum {
> > >  #define SLICE_ECO_CHICKEN0   _MMIO(0x7308)
> > >  #define   PIXEL_MASK_CAMMING_DISABLE (1 << 14)
> > >
> > > +#define _CHICKEN_TRANS_A 0x420C0
> > > +#define _CHICKEN_TRANS_B 0x420C4
> > > +#define CHICKEN_TRANS(tran) _MMIO_TRANS(tran,
> _CHICKEN_TRANS_A, _CHICKEN_TRANS_B)
> > > +#define SPARE_13 (1<<13)
> > > +
> > >  /* WaCatErrorRejectionIssue */
> > >  #define GEN7_SQ_CHICKEN_MBCUNIT_CONFIG
>   _MMIO(0x9030)
> > >  #define  GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB(1<<11)
> > > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> > > b/drivers/gpu/drm/i915/intel_audio.c
> > > index 7093cfb..894f11e 100644
> > > --- a/drivers/gpu/drm/i915/intel_audio.c
> > > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > > @@ -283,6 +283,8 @@ static void hsw_audio_codec_disable(struct
> > > intel_encoder *encoder)  {
> > >   struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> > >   struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
> > > + struct intel_crtc_state *crtc_config =  intel_crtc->config;
> > > + enum transcoder cpu_transcoder = crtc_config->cpu_transcoder;
> > >   enum pipe pipe = intel_crtc->pipe;
> > >   uint32_t tmp;
> > >
> > > @@ -290,13 +292,21 @@ static void hsw_audio_codec_disable(struct
> > > intel_encoder *encoder)
> > >
> > >   mutex_lock(_priv->av_mutex);
> > >
> > > + /*Disable DP audio stall fix for HBR2*/
> > > + if (IS_GEN9(dev_priv) && intel_crtc_has_dp_encoder(crtc_config) &&
> > > + crtc_config->port_clock >= 54) {
> > > + tmp = I915_READ(CHICKEN_TRANS(cpu_transcoder));
> > > + tmp &= ~SPARE_13;
> > > + I915_WRITE(CHICKEN_TRANS(cpu_transcoder), tmp);
> > > + }
> > > +
> > >   /* Disable timestamps */
> > >   tmp = I915_READ(HSW_AUD_CFG(pipe));
> > >   tmp &= ~AUD_CONFIG_N_VALUE_INDEX;
> > >   tmp |= AUD_CONFIG_N_PROG_ENABLE;
> > >   tmp &= ~AUD_CONFIG_UPPER_N_MASK;
> > >   tmp &= ~AUD_CONFIG_LOWER_N_MASK;
> > > - if (intel_crtc_has_dp_encoder(intel_crtc->config))
> > > + if (intel_crtc_has_dp_encoder(crtc_config))
> > >   tmp |= AUD_CONFIG_N_VALUE_INDEX;
> > >   I915_WRITE(HSW_AUD_CFG(pipe), tmp);
> > >
> > > @@ -315,6 +325,8 @@ static void hsw_audio_codec_enable(struct
> > > drm_connector *connector,  {
> > >   struct drm_i915_private *dev_priv = to_i915(connector->dev);
> > >   struct intel_crtc *intel_crtc =
> > > to_intel_crtc(intel_encoder->base.crtc);
> > > + struct intel_crtc_state *crtc_config =  intel_crtc->config;
> > > + enum transcoder cpu_transcoder = crtc_config->cpu_transcoder;
> > >   enum pipe pipe = intel_crtc->pipe;
> > >   enum port port = intel_encoder->port;
> > >   const uint8_t *eld = connector->eld; @@ -326,6 +338,22 @@ static
> > > void hsw_audio_codec_enable(struct drm_connector *connector,
> > >
> > >   mutex_lock(_priv->av_mutex);
> > >
> > > + /* Enable DP audio stall fix for HBR2
> > > +  *
> > > +  * TODO: This workaround is applicable only for audio sample rates
> up
> > > +  * to 96kHz. For frequencies above 96kHz, this is insufficient and
> > > +  * cdclk should be increased to at least 432 MHz, just like BDW. Since,
> > > +  * the audio driver does not support sample rates > 48 kHz, we are

Re: [Intel-gfx] [PATCH RESEND 9/9] drm/i915: set proper N/M in modeset

2016-10-21 Thread Yang, Libin

> -Original Message-
> From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> Sent: Thursday, October 20, 2016 8:03 PM
> To: Nikula, Jani <jani.nik...@intel.com>
> Cc: Yang, Libin <libin.y...@intel.com>; Lin, Mengdong
> <mengdong@intel.com>; intel-gfx@lists.freedesktop.org; Zhang, Keqiao
> <keqiao.zh...@intel.com>; libin.y...@linux.intel.com; Pandiyan,
> Dhinakaran <dhinakaran.pandi...@intel.com>; Zhao, Juan J
> <juan.j.z...@intel.com>
> Subject: Re: [Intel-gfx] [PATCH RESEND 9/9] drm/i915: set proper N/M in
> modeset
> 
> On Thu, Oct 20, 2016 at 02:34:34PM +0300, Jani Nikula wrote:
> > On Thu, 20 Oct 2016, "Yang, Libin" <libin.y...@intel.com> wrote:
> > >> >> Any particular reason these M/N values are half of what they're
> > >> >> in table
> > >> >> 2-104 of DP 1.4 spec? (Admittedly the table is an informative
> > >> >> example.)
> > >> >
> > >> > For HDMI, we found only set N is enough. HW then can handle the
> > >> remaining.
> > >>
> > >> I meant, the M and N values in this part of the dp_aud_n_m table
> > >> are 1/2 of what they are in the DP spec table. Why?
> > >
> > > Which table are you meaning? I calculate the values myself. I didn't
> > > find the full table in DP spec. I only find the table for 270MHz and
> > > 162MHz in Table 2-50: Examples of Maud and Naud Values
> >
> > Table 2-104 in DP 1.4. Maybe you're looking at an older version of the
> > spec.
> 
> So it looks like they used the same M value for all link frequencies in that
> example, which for 540M ends up being double what the minimal accurate
> value is. But as both M and N are doubled the ratio is still exactly the same.

There is a formula in DP 1.2 spec:
Maud/Naud = 512 * fs / f_LS_Clk

Suppose all the values meeting the formula is acceptable.

> 
> And there is indeed a 64k and 128k bitrates added as well. Those are not
> classified under HBR audio. But as those can't be expressed via short audio
> descriptors in the EDID, I don't think they would be accepted by ALSA. Or am
> I wrong? I do wonder how they are supposed to be used though since there
> must be some way for the sink to advertise them, otherwise I can't see the
> point in adding them.

Oh, sorry, I was thinking 128k is HBR. I didn't see 64k and 128k description
in DP 1.2 spec. 

Regards,
Libin

> 
> --
> Ville Syrjälä
> Intel OTC
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH RESEND 9/9] drm/i915: set proper N/M in modeset

2016-10-21 Thread Yang, Libin
Hi Jani,

> -Original Message-
> From: Nikula, Jani
> Sent: Thursday, October 20, 2016 7:35 PM
> To: Yang, Libin <libin.y...@intel.com>; Lin, Mengdong
> <mengdong@intel.com>; intel-gfx@lists.freedesktop.org
> Cc: libin.y...@linux.intel.com; Pandiyan, Dhinakaran
> <dhinakaran.pandi...@intel.com>; Zhang, Keqiao
> <keqiao.zh...@intel.com>; Zhao, Juan J <juan.j.z...@intel.com>
> Subject: RE: [Intel-gfx] [PATCH RESEND 9/9] drm/i915: set proper N/M in
> modeset
> 
> On Thu, 20 Oct 2016, "Yang, Libin" <libin.y...@intel.com> wrote:
> >> >> Any particular reason these M/N values are half of what they're in
> >> >> table
> >> >> 2-104 of DP 1.4 spec? (Admittedly the table is an informative
> >> >> example.)
> >> >
> >> > For HDMI, we found only set N is enough. HW then can handle the
> >> remaining.
> >>
> >> I meant, the M and N values in this part of the dp_aud_n_m table are
> >> 1/2 of what they are in the DP spec table. Why?
> >
> > Which table are you meaning? I calculate the values myself. I didn't
> > find the full table in DP spec. I only find the table for 270MHz and
> > 162MHz in Table 2-50: Examples of Maud and Naud Values
> 
> Table 2-104 in DP 1.4. Maybe you're looking at an older version of the spec.

I was referring DP1.2. I don't have DP 1.4 spec on hand. But suppose
both table should be OK?

Regards,
Libin

> 
> BR,
> Jani.
> 
> 
> --
> Jani Nikula, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH RESEND 9/9] drm/i915: set proper N/M in modeset

2016-10-20 Thread Yang, Libin

> -Original Message-
> From: Nikula, Jani
> Sent: Thursday, October 20, 2016 4:34 PM
> To: Yang, Libin <libin.y...@intel.com>; Lin, Mengdong
> <mengdong@intel.com>; intel-gfx@lists.freedesktop.org
> Cc: libin.y...@linux.intel.com; Pandiyan, Dhinakaran
> <dhinakaran.pandi...@intel.com>; Zhang, Keqiao
> <keqiao.zh...@intel.com>; Zhao, Juan J <juan.j.z...@intel.com>
> Subject: RE: [Intel-gfx] [PATCH RESEND 9/9] drm/i915: set proper N/M in
> modeset
> 
> On Thu, 20 Oct 2016, "Yang, Libin" <libin.y...@intel.com> wrote:
> >> -Original Message-----
> >> From: Nikula, Jani
> >> Sent: Wednesday, October 19, 2016 11:09 PM
> >> To: Yang, Libin <libin.y...@intel.com>; Lin, Mengdong
> >> <mengdong@intel.com>; intel-gfx@lists.freedesktop.org
> >> Cc: libin.y...@linux.intel.com; Pandiyan, Dhinakaran
> >> <dhinakaran.pandi...@intel.com>; Zhang, Keqiao
> >> <keqiao.zh...@intel.com>; Zhao, Juan J <juan.j.z...@intel.com>
> >> Subject: RE: [Intel-gfx] [PATCH RESEND 9/9] drm/i915: set proper N/M
> >> in modeset
> >>
> >>
> >> Sorry it's taken me forever to get back to this. Some comments inline.
> >>
> >> BR,
> >> Jani.
> >>
> >> On Wed, 12 Oct 2016, "Yang, Libin" <libin.y...@intel.com> wrote:
> >> >> -Original Message-
> >> >> From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org]
> >> >> On Behalf Of Lin, Mengdong
> >> >> Sent: Wednesday, October 12, 2016 10:46 AM
> >> >> To: Nikula, Jani <jani.nik...@intel.com>;
> >> >> intel-gfx@lists.freedesktop.org
> >> >> Cc: Nikula, Jani <jani.nik...@intel.com>;
> >> >> libin.y...@linux.intel.com; Pandiyan, Dhinakaran
> >> >> <dhinakaran.pandi...@intel.com>
> >> >> Subject: Re: [Intel-gfx] [PATCH RESEND 9/9] drm/i915: set proper
> >> >> N/M in modeset
> >> >>
> >> >>
> >> >>
> >> >> > -Original Message-
> >> >> > From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org]
> >> >> > On Behalf Of Jani Nikula
> >> >> > Sent: Monday, October 10, 2016 11:04 PM
> >> >> > To: intel-gfx@lists.freedesktop.org
> >> >> > Cc: Nikula, Jani <jani.nik...@intel.com>;
> >> >> > libin.y...@linux.intel.com; Pandiyan, Dhinakaran
> >> >> > <dhinakaran.pandi...@intel.com>
> >> >> > Subject: [Intel-gfx] [PATCH RESEND 9/9] drm/i915: set proper N/M
> >> >> > in modeset
> >> >> >
> >> >> > When modeset occurs and the LS_CLK is set to some special values
> >> >> > in DP mode, the N/M need to be set manually if audio is playing.
> >> >> > Otherwise the first several seconds may be silent in audio playback.
> >> >> >
> >> >> > The relationship of Maud and Naud is expressed in the following
> >> equation:
> >> >> > Maud/Naud = 512 * fs / f_LS_Clk
> >> >> >
> >> >> > Please refer VESA DisplayPort Standard spec for details.
> >> >> >
> >> >> > Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> >> >> > Signed-off-by: Jani Nikula <jani.nik...@intel.com>
> >> >> > ---
> >> >> >  drivers/gpu/drm/i915/i915_reg.h|   7 +++
> >> >> >  drivers/gpu/drm/i915/intel_audio.c | 100
> >> >> > -
> >> >> >  2 files changed, 105 insertions(+), 2 deletions(-)
> >> >> >
> >> >> > diff --git a/drivers/gpu/drm/i915/i915_reg.h
> >> >> > b/drivers/gpu/drm/i915/i915_reg.h index
> >> >> > 595d196f753f..8d9dbc7d5b32
> >> >> > 100644
> >> >> > --- a/drivers/gpu/drm/i915/i915_reg.h
> >> >> > +++ b/drivers/gpu/drm/i915/i915_reg.h
> >> >> > @@ -7359,6 +7359,13 @@ enum {
> >> >> >  #define _HSW_AUD_MISC_CTRL_B 0x65110
> >> >> >  #define HSW_AUD_MISC_CTRL(pipe)  _MMIO_PIPE(pipe,
> >> >> > _HSW_AUD_MISC_CTRL_A, _HSW_AUD_MISC_CTRL_B)
> >> >> >
> >> >> > +#define _HSW_AUD_M_CTS_ENABLE_A  0x65028
> >> >> > +#define _HSW_AUD_M_CTS_ENABLE_B  

Re: [Intel-gfx] [PATCH RESEND 9/9] drm/i915: set proper N/M in modeset

2016-10-19 Thread Yang, Libin

> -Original Message-
> From: Nikula, Jani
> Sent: Wednesday, October 19, 2016 11:09 PM
> To: Yang, Libin <libin.y...@intel.com>; Lin, Mengdong
> <mengdong@intel.com>; intel-gfx@lists.freedesktop.org
> Cc: libin.y...@linux.intel.com; Pandiyan, Dhinakaran
> <dhinakaran.pandi...@intel.com>; Zhang, Keqiao
> <keqiao.zh...@intel.com>; Zhao, Juan J <juan.j.z...@intel.com>
> Subject: RE: [Intel-gfx] [PATCH RESEND 9/9] drm/i915: set proper N/M in
> modeset
> 
> 
> Sorry it's taken me forever to get back to this. Some comments inline.
> 
> BR,
> Jani.
> 
> On Wed, 12 Oct 2016, "Yang, Libin" <libin.y...@intel.com> wrote:
> >> -Original Message-
> >> From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org] On
> >> Behalf Of Lin, Mengdong
> >> Sent: Wednesday, October 12, 2016 10:46 AM
> >> To: Nikula, Jani <jani.nik...@intel.com>;
> >> intel-gfx@lists.freedesktop.org
> >> Cc: Nikula, Jani <jani.nik...@intel.com>; libin.y...@linux.intel.com;
> >> Pandiyan, Dhinakaran <dhinakaran.pandi...@intel.com>
> >> Subject: Re: [Intel-gfx] [PATCH RESEND 9/9] drm/i915: set proper N/M
> >> in modeset
> >>
> >>
> >>
> >> > -Original Message-
> >> > From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org] On
> >> > Behalf Of Jani Nikula
> >> > Sent: Monday, October 10, 2016 11:04 PM
> >> > To: intel-gfx@lists.freedesktop.org
> >> > Cc: Nikula, Jani <jani.nik...@intel.com>;
> >> > libin.y...@linux.intel.com; Pandiyan, Dhinakaran
> >> > <dhinakaran.pandi...@intel.com>
> >> > Subject: [Intel-gfx] [PATCH RESEND 9/9] drm/i915: set proper N/M in
> >> > modeset
> >> >
> >> > When modeset occurs and the LS_CLK is set to some special values in
> >> > DP mode, the N/M need to be set manually if audio is playing.
> >> > Otherwise the first several seconds may be silent in audio playback.
> >> >
> >> > The relationship of Maud and Naud is expressed in the following
> equation:
> >> > Maud/Naud = 512 * fs / f_LS_Clk
> >> >
> >> > Please refer VESA DisplayPort Standard spec for details.
> >> >
> >> > Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> >> > Signed-off-by: Jani Nikula <jani.nik...@intel.com>
> >> > ---
> >> >  drivers/gpu/drm/i915/i915_reg.h|   7 +++
> >> >  drivers/gpu/drm/i915/intel_audio.c | 100
> >> > -
> >> >  2 files changed, 105 insertions(+), 2 deletions(-)
> >> >
> >> > diff --git a/drivers/gpu/drm/i915/i915_reg.h
> >> > b/drivers/gpu/drm/i915/i915_reg.h index 595d196f753f..8d9dbc7d5b32
> >> > 100644
> >> > --- a/drivers/gpu/drm/i915/i915_reg.h
> >> > +++ b/drivers/gpu/drm/i915/i915_reg.h
> >> > @@ -7359,6 +7359,13 @@ enum {
> >> >  #define _HSW_AUD_MISC_CTRL_B0x65110
> >> >  #define HSW_AUD_MISC_CTRL(pipe) _MMIO_PIPE(pipe,
> >> > _HSW_AUD_MISC_CTRL_A, _HSW_AUD_MISC_CTRL_B)
> >> >
> >> > +#define _HSW_AUD_M_CTS_ENABLE_A 0x65028
> >> > +#define _HSW_AUD_M_CTS_ENABLE_B 0x65128
> >> > +#define HSW_AUD_M_CTS_ENABLE(pipe)  _MMIO_PIPE(pipe,
> >> > _HSW_AUD_M_CTS_ENABLE_A, _HSW_AUD_M_CTS_ENABLE_B)
> >> > +#define   AUD_M_CTS_M_VALUE_INDEX   (1 << 21)
> >> > +#define   AUD_M_CTS_M_PROG_ENABLE   (1 << 20)
> >> > +#define   AUD_CONFIG_M_MASK 0xf
> >>
> >> The last line cause misalignment after applying the patch.
> >>
> >> > +
> >> >  #define _HSW_AUD_DIP_ELD_CTRL_ST_A  0x650b4
> >> >  #define _HSW_AUD_DIP_ELD_CTRL_ST_B  0x651b4
> >> >  #define HSW_AUD_DIP_ELD_CTRL(pipe)  _MMIO_PIPE(pipe,
> >> > _HSW_AUD_DIP_ELD_CTRL_ST_A, _HSW_AUD_DIP_ELD_CTRL_ST_B)
> diff --
> >> git
> >> > a/drivers/gpu/drm/i915/intel_audio.c
> >> > b/drivers/gpu/drm/i915/intel_audio.c
> >> > index 81df29ca4947..0bc2701b6c9c 100644
> >> > --- a/drivers/gpu/drm/i915/intel_audio.c
> >> > +++ b/drivers/gpu/drm/i915/intel_audio.c
> >> > @@ -57,6 +57,70 @@
> >> >   * struct _audio_component_audio_ops @audio_ops is called
> >> > from
> >> > i915 driver.
> >> >   */
> >> >
&g

Re: [Intel-gfx] [PATCH] drm/i915/dp: Increase cdclk when DP audio is enabled with 4 lanes and HBR2

2016-10-16 Thread Yang, Libin

> -Original Message-
> From: Pandiyan, Dhinakaran
> Sent: Saturday, October 15, 2016 4:36 AM
> To: Yang, Libin <libin.y...@intel.com>
> Cc: intel-...@freedesktop.org; Nikula, Jani <jani.nik...@intel.com>; Kp, Jeeja
> <jeeja...@intel.com>; libin.y...@linux.intel.com
> Subject: Re: [Intel-gfx] [PATCH] drm/i915/dp: Increase cdclk when DP audio is
> enabled with 4 lanes and HBR2
> 
> On Fri, 2016-10-14 at 03:09 +, Yang, Libin wrote:
> > Tested-by: Libin Yang <libin.y...@intel.com>
> >
> > Regards,
> > Libin
> >
> >
> 
> Thanks Libin. Can you confirm the max. BCLK frequency we set for the audio
> controller?

Currently, we don't support HBR audio. We only test 48KHz, 44.1KHz and 32KHz.

For the BDW/HSW, audio requires that gfx driver should notify audio driver 
that cdclk is changed. Currently , eld notify will notify the audio the change
of cdclk.

I will ask our QA to do a full test on 48KHz, 44.1KHz and 32KHz.

Regards,
Libin

> 
> 
> -DK
> > > -Original Message-
> > > From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org] On
> > > Behalf Of Dhinakaran Pandiyan
> > > Sent: Friday, October 14, 2016 2:04 AM
> > > To: intel-...@freedesktop.org
> > > Cc: Nikula, Jani <jani.nik...@intel.com>; Kp, Jeeja
> > > <jeeja...@intel.com>; Libin Yang <libin.y...@linux.intel.com>;
> > > Pandiyan, Dhinakaran <dhinakaran.pandi...@intel.com>
> > > Subject: [Intel-gfx] [PATCH] drm/i915/dp: Increase cdclk when DP
> > > audio is enabled with 4 lanes and HBR2
> > >
> > > According to BSpec, cdclk has to be not less than 432 MHz with DP
> > > audio enabled, port width x4, and link rate HBR2 (5.4 GHz)
> > >
> > > Having a lower cdclk triggers pipe underruns, which then lead to
> > > displays continuously cycling off and on. This is essential for DP
> > > MST audio as the link is trained at HBR2 and 4 lanes by default.
> > >
> > > This should fix https://bugs.freedesktop.org/show_bug.cgi?id=97907
> > >
> > > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandi...@intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/intel_display.c | 47
> > > +---
> > >  1 file changed, 43 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/i915/intel_display.c
> > > b/drivers/gpu/drm/i915/intel_display.c
> > > index cfcb03f..6a05183 100644
> > > --- a/drivers/gpu/drm/i915/intel_display.c
> > > +++ b/drivers/gpu/drm/i915/intel_display.c
> > > @@ -6603,14 +6603,43 @@ static int
> > > valleyview_modeset_calc_cdclk(struct
> > > drm_atomic_state *state)
> > >   return 0;
> > >  }
> > >
> > > +static bool cdclk_min_for_dp_audio(struct drm_atomic_state *state)
> > > +{
> > > +
> > > + struct drm_crtc_state *crtc_state;
> > > + struct drm_crtc *crtc;
> > > + int i;
> > > +
> > > + /* BSpec says "Do not use DisplayPort with CDCLK less than 432 MHz,
> > > +  * audio enabled, port width x4, and link rate HBR2 (5.4 GHz), or else
> > > +  * there may be audio corruption or screen corruption."
> > > +  */
> > > +
> > > + for_each_crtc_in_state(state, crtc, crtc_state, i) {
> > > + struct intel_crtc_state *pipe_config =
> > > + to_intel_crtc_state(crtc_state);
> > > +
> > > + return (intel_crtc_has_dp_encoder(pipe_config) &&
> > > + pipe_config->has_audio &&
> > > + pipe_config->port_clock == 54 &&
> > > + pipe_config->lane_count == 4);
> > > + }
> > > +
> > > + return false;
> > > +}
> > > +
> > >  static int bxt_modeset_calc_cdclk(struct drm_atomic_state *state)  {
> > >   int max_pixclk = ilk_max_pixel_rate(state);
> > > + int cdclk, min_cdclk = 0;
> > >   struct intel_atomic_state *intel_state =
> > >   to_intel_atomic_state(state);
> > >
> > > - intel_state->cdclk = intel_state->dev_cdclk =
> > > - bxt_calc_cdclk(max_pixclk);
> > > + if (cdclk_min_for_dp_audio(state))
> > > + min_cdclk = bxt_calc_cdclk(432000);
> > > +
> > > + cdclk = bxt_calc_cdclk(max_pixclk);
> > > + intel_state->cdclk = intel_state->dev_cdclk = max(min_cdclk,
> > > +cdclk);
> > >
> > >   if (!intel_state->active_crtcs)
> &

Re: [Intel-gfx] [PATCH] drm/i915/dp: Increase cdclk when DP audio is enabled with 4 lanes and HBR2

2016-10-13 Thread Yang, Libin
Tested-by: Libin Yang 

Regards,
Libin


> -Original Message-
> From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org] On Behalf Of
> Dhinakaran Pandiyan
> Sent: Friday, October 14, 2016 2:04 AM
> To: intel-...@freedesktop.org
> Cc: Nikula, Jani ; Kp, Jeeja ;
> Libin Yang ; Pandiyan, Dhinakaran
> 
> Subject: [Intel-gfx] [PATCH] drm/i915/dp: Increase cdclk when DP audio is
> enabled with 4 lanes and HBR2
> 
> According to BSpec, cdclk has to be not less than 432 MHz with DP audio
> enabled, port width x4, and link rate HBR2 (5.4 GHz)
> 
> Having a lower cdclk triggers pipe underruns, which then lead to displays
> continuously cycling off and on. This is essential for DP MST audio as the 
> link
> is trained at HBR2 and 4 lanes by default.
> 
> This should fix https://bugs.freedesktop.org/show_bug.cgi?id=97907
> 
> Signed-off-by: Dhinakaran Pandiyan 
> ---
>  drivers/gpu/drm/i915/intel_display.c | 47
> +---
>  1 file changed, 43 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c
> b/drivers/gpu/drm/i915/intel_display.c
> index cfcb03f..6a05183 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -6603,14 +6603,43 @@ static int valleyview_modeset_calc_cdclk(struct
> drm_atomic_state *state)
>   return 0;
>  }
> 
> +static bool cdclk_min_for_dp_audio(struct drm_atomic_state *state) {
> +
> + struct drm_crtc_state *crtc_state;
> + struct drm_crtc *crtc;
> + int i;
> +
> + /* BSpec says "Do not use DisplayPort with CDCLK less than 432 MHz,
> +  * audio enabled, port width x4, and link rate HBR2 (5.4 GHz), or else
> +  * there may be audio corruption or screen corruption."
> +  */
> +
> + for_each_crtc_in_state(state, crtc, crtc_state, i) {
> + struct intel_crtc_state *pipe_config =
> + to_intel_crtc_state(crtc_state);
> +
> + return (intel_crtc_has_dp_encoder(pipe_config) &&
> + pipe_config->has_audio &&
> + pipe_config->port_clock == 54 &&
> + pipe_config->lane_count == 4);
> + }
> +
> + return false;
> +}
> +
>  static int bxt_modeset_calc_cdclk(struct drm_atomic_state *state)  {
>   int max_pixclk = ilk_max_pixel_rate(state);
> + int cdclk, min_cdclk = 0;
>   struct intel_atomic_state *intel_state =
>   to_intel_atomic_state(state);
> 
> - intel_state->cdclk = intel_state->dev_cdclk =
> - bxt_calc_cdclk(max_pixclk);
> + if (cdclk_min_for_dp_audio(state))
> + min_cdclk = bxt_calc_cdclk(432000);
> +
> + cdclk = bxt_calc_cdclk(max_pixclk);
> + intel_state->cdclk = intel_state->dev_cdclk = max(min_cdclk, cdclk);
> 
>   if (!intel_state->active_crtcs)
>   intel_state->dev_cdclk = bxt_calc_cdclk(0); @@ -10374,7
> +10403,10 @@ static int broadwell_modeset_calc_cdclk(struct
> drm_atomic_state *state)
>   struct drm_i915_private *dev_priv = to_i915(state->dev);
>   struct intel_atomic_state *intel_state = to_intel_atomic_state(state);
>   int max_pixclk = ilk_max_pixel_rate(state);
> - int cdclk;
> + int cdclk, min_cdclk = 0;
> +
> + if (cdclk_min_for_dp_audio(state))
> + min_cdclk = broadwell_calc_cdclk(432000);
> 
>   /*
>* FIXME should also account for plane ratio @@ -10382,6 +10414,8
> @@ static int broadwell_modeset_calc_cdclk(struct drm_atomic_state *state)
>*/
>   cdclk = broadwell_calc_cdclk(max_pixclk);
> 
> + cdclk = max(min_cdclk, cdclk);
> +
>   if (cdclk > dev_priv->max_cdclk_freq) {
>   DRM_DEBUG_KMS("requested cdclk (%d kHz) exceeds max
> (%d kHz)\n",
> cdclk, dev_priv->max_cdclk_freq); @@ -10411,7
> +10445,10 @@ static int skl_modeset_calc_cdclk(struct drm_atomic_state
> *state)
>   struct drm_i915_private *dev_priv = to_i915(state->dev);
>   const int max_pixclk = ilk_max_pixel_rate(state);
>   int vco = intel_state->cdclk_pll_vco;
> - int cdclk;
> + int cdclk, min_cdclk = 0;
> +
> + if (cdclk_min_for_dp_audio(state))
> + min_cdclk = skl_calc_cdclk(432000, vco);
> 
>   /*
>* FIXME should also account for plane ratio @@ -10419,6 +10456,8
> @@ static int skl_modeset_calc_cdclk(struct drm_atomic_state *state)
>*/
>   cdclk = skl_calc_cdclk(max_pixclk, vco);
> 
> + cdclk = max(min_cdclk, cdclk);
> +
>   /*
>* FIXME move the cdclk caclulation to
>* compute_config() so we can fail gracegully.
> --
> 2.7.4
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [PATCH RESEND 9/9] drm/i915: set proper N/M in modeset

2016-10-12 Thread Yang, Libin


> -Original Message-
> From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org] On Behalf Of
> Lin, Mengdong
> Sent: Wednesday, October 12, 2016 10:46 AM
> To: Nikula, Jani ; intel-gfx@lists.freedesktop.org
> Cc: Nikula, Jani ; libin.y...@linux.intel.com;
> Pandiyan, Dhinakaran 
> Subject: Re: [Intel-gfx] [PATCH RESEND 9/9] drm/i915: set proper N/M in
> modeset
> 
> 
> 
> > -Original Message-
> > From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org] On
> > Behalf Of Jani Nikula
> > Sent: Monday, October 10, 2016 11:04 PM
> > To: intel-gfx@lists.freedesktop.org
> > Cc: Nikula, Jani ; libin.y...@linux.intel.com;
> > Pandiyan, Dhinakaran 
> > Subject: [Intel-gfx] [PATCH RESEND 9/9] drm/i915: set proper N/M in
> > modeset
> >
> > When modeset occurs and the LS_CLK is set to some special values in DP
> > mode, the N/M need to be set manually if audio is playing. Otherwise
> > the first several seconds may be silent in audio playback.
> >
> > The relationship of Maud and Naud is expressed in the following equation:
> > Maud/Naud = 512 * fs / f_LS_Clk
> >
> > Please refer VESA DisplayPort Standard spec for details.
> >
> > Signed-off-by: Libin Yang 
> > Signed-off-by: Jani Nikula 
> > ---
> >  drivers/gpu/drm/i915/i915_reg.h|   7 +++
> >  drivers/gpu/drm/i915/intel_audio.c | 100
> > -
> >  2 files changed, 105 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_reg.h
> > b/drivers/gpu/drm/i915/i915_reg.h index 595d196f753f..8d9dbc7d5b32
> > 100644
> > --- a/drivers/gpu/drm/i915/i915_reg.h
> > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > @@ -7359,6 +7359,13 @@ enum {
> >  #define _HSW_AUD_MISC_CTRL_B   0x65110
> >  #define HSW_AUD_MISC_CTRL(pipe)_MMIO_PIPE(pipe,
> > _HSW_AUD_MISC_CTRL_A, _HSW_AUD_MISC_CTRL_B)
> >
> > +#define _HSW_AUD_M_CTS_ENABLE_A0x65028
> > +#define _HSW_AUD_M_CTS_ENABLE_B0x65128
> > +#define HSW_AUD_M_CTS_ENABLE(pipe) _MMIO_PIPE(pipe,
> > _HSW_AUD_M_CTS_ENABLE_A, _HSW_AUD_M_CTS_ENABLE_B)
> > +#define   AUD_M_CTS_M_VALUE_INDEX  (1 << 21)
> > +#define   AUD_M_CTS_M_PROG_ENABLE  (1 << 20)
> > +#define   AUD_CONFIG_M_MASK0xf
> 
> The last line cause misalignment after applying the patch.
> 
> > +
> >  #define _HSW_AUD_DIP_ELD_CTRL_ST_A 0x650b4
> >  #define _HSW_AUD_DIP_ELD_CTRL_ST_B 0x651b4
> >  #define HSW_AUD_DIP_ELD_CTRL(pipe) _MMIO_PIPE(pipe,
> > _HSW_AUD_DIP_ELD_CTRL_ST_A, _HSW_AUD_DIP_ELD_CTRL_ST_B) diff --
> git
> > a/drivers/gpu/drm/i915/intel_audio.c
> > b/drivers/gpu/drm/i915/intel_audio.c
> > index 81df29ca4947..0bc2701b6c9c 100644
> > --- a/drivers/gpu/drm/i915/intel_audio.c
> > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > @@ -57,6 +57,70 @@
> >   * struct _audio_component_audio_ops @audio_ops is called from
> > i915 driver.
> >   */
> >
> > +/* DP N/M table */
> > +#define LC_540M 54
> > +#define LC_270M 27
> > +#define LC_162M 162000
> > +
> > +struct dp_aud_n_m {
> > +   int sample_rate;
> > +   int clock;
> > +   u16 n;
> > +   u16 m;
> > +};
> > +
> > +static const struct dp_aud_n_m dp_aud_n_m[] = {
> > +   { 192000, LC_540M, 5625, 1024 },
> > +   { 176400, LC_540M, 9375, 1568 },
> > +   { 96000, LC_540M, 5625, 512 },
> > +   { 88200, LC_540M, 9375, 784 },
> > +   { 48000, LC_540M, 5625, 256 },
> > +   { 44100, LC_540M, 9375, 392 },
> > +   { 32000, LC_540M, 16875, 512 },
> > +   { 192000, LC_270M, 5625, 2048 },
> > +   { 176400, LC_270M, 9375, 3136 },
> > +   { 96000, LC_270M, 5625, 1024 },
> > +   { 88200, LC_270M, 9375, 1568 },
> > +   { 48000, LC_270M, 5625, 512 },
> > +   { 44100, LC_270M, 9375, 784 },
> > +   { 32000, LC_270M, 16875, 1024 },
> > +   { 192000, LC_162M, 3375, 2048 },
> > +   { 176400, LC_162M, 5625, 3136 },
> > +   { 96000, LC_162M, 3375, 1024 },
> > +   { 88200, LC_162M, 5625, 1568 },
> > +   { 48000, LC_162M, 3375, 512 },
> > +   { 44100, LC_162M, 5625, 784 },
> > +   { 32000, LC_162M, 10125, 1024 },
> > +};
> > +
> > +static const struct dp_aud_n_m *
> > +audio_config_dp_get_n_m(struct intel_crtc *intel_crtc, int rate) {
> > +   int i;
> > +
> > +   for (i = 0; i < ARRAY_SIZE(dp_aud_n_m); i++) {
> > +   if (rate == dp_aud_n_m[i].sample_rate &&
> > +   intel_crtc->config->port_clock == dp_aud_n_m[i].clock)
> > +   return _aud_n_m[i];
> > +   }
> > +
> > +   return NULL;
> > +}
> > +
> > +static int audio_config_dp_get_m(struct intel_crtc *intel_crtc, int
> > +rate) {
> > +   const struct dp_aud_n_m *nm =
> > audio_config_dp_get_n_m(intel_crtc,
> > +rate);
> > +
> > +   return nm ? nm->m : 0;
> > +}
> > +
> > +static int audio_config_dp_get_n(struct intel_crtc *intel_crtc, int
> > +rate) {
> > +   const struct dp_aud_n_m *nm =
> > audio_config_dp_get_n_m(intel_crtc,
> > 

Re: [Intel-gfx] [PATCH RESEND 8/9] drm/i915/audio: rename N value getter to emphasize it's for hdmi

2016-10-10 Thread Yang, Libin
Reviewed-by: Libin Yang 

Regards,
Libin


> -Original Message-
> From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org] On Behalf Of
> Jani Nikula
> Sent: Monday, October 10, 2016 11:04 PM
> To: intel-gfx@lists.freedesktop.org
> Cc: Nikula, Jani ; libin.y...@linux.intel.com;
> Pandiyan, Dhinakaran 
> Subject: [Intel-gfx] [PATCH RESEND 8/9] drm/i915/audio: rename N value
> getter to emphasize it's for hdmi
> 
> We'll be getting a function and a table for dp parameters soon enough, so
> rename the function and table for hdmi. No functional changes.
> 
> Cc: Libin Yang 
> Signed-off-by: Jani Nikula 
> ---
>  drivers/gpu/drm/i915/intel_audio.c | 16 
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_audio.c
> b/drivers/gpu/drm/i915/intel_audio.c
> index d2c6227f72b8..81df29ca4947 100644
> --- a/drivers/gpu/drm/i915/intel_audio.c
> +++ b/drivers/gpu/drm/i915/intel_audio.c
> @@ -81,7 +81,7 @@ static const struct {
>   int clock;
>   int n;
>   int cts;
> -} aud_ncts[] = {
> +} hdmi_aud_ncts[] = {
>   { 44100, TMDS_296M, 4459, 234375 },
>   { 44100, TMDS_297M, 4704, 247500 },
>   { 48000, TMDS_296M, 5824, 281250 },
> @@ -121,15 +121,15 @@ static u32 audio_config_hdmi_pixel_clock(const
> struct drm_display_mode *adjusted
>   return hdmi_audio_clock[i].config;
>  }
> 
> -static int audio_config_get_n(const struct drm_display_mode
> *adjusted_mode,
> -   int rate)
> +static int audio_config_hdmi_get_n(const struct drm_display_mode
> *adjusted_mode,
> +int rate)
>  {
>   int i;
> 
> - for (i = 0; i < ARRAY_SIZE(aud_ncts); i++) {
> - if ((rate == aud_ncts[i].sample_rate) &&
> - (adjusted_mode->crtc_clock == aud_ncts[i].clock)) {
> - return aud_ncts[i].n;
> + for (i = 0; i < ARRAY_SIZE(hdmi_aud_ncts); i++) {
> + if (rate == hdmi_aud_ncts[i].sample_rate &&
> + adjusted_mode->crtc_clock == hdmi_aud_ncts[i].clock) {
> + return hdmi_aud_ncts[i].n;
>   }
>   }
>   return 0;
> @@ -256,7 +256,7 @@ hsw_hdmi_audio_config_update(struct intel_crtc
> *intel_crtc, enum port port,
> 
>   if (adjusted_mode->crtc_clock == TMDS_296M ||
>   adjusted_mode->crtc_clock == TMDS_297M) {
> - n = audio_config_get_n(adjusted_mode, rate);
> + n = audio_config_hdmi_get_n(adjusted_mode, rate);
>   if (n != 0) {
>   tmp &= ~AUD_CONFIG_N_MASK;
>   tmp |= AUD_CONFIG_N(n);
> --
> 2.1.4
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH RESEND 7/9] drm/i915/audio: add register macros for audio config N value

2016-10-10 Thread Yang, Libin
Reviewed-by: Libin Yang 

Regards,
Libin


> -Original Message-
> From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org] On Behalf Of
> Jani Nikula
> Sent: Monday, October 10, 2016 11:04 PM
> To: intel-gfx@lists.freedesktop.org
> Cc: Nikula, Jani ; libin.y...@linux.intel.com;
> Pandiyan, Dhinakaran 
> Subject: [Intel-gfx] [PATCH RESEND 7/9] drm/i915/audio: add register macros
> for audio config N value
> 
> Have generic macros in line with the rest of the register bit definition 
> macros
> instead of a dedicated function in intel_audio.c, and use them.
> No functional changes.
> 
> Cc: Libin Yang 
> Signed-off-by: Jani Nikula 
> ---
>  drivers/gpu/drm/i915/i915_reg.h|  4 
>  drivers/gpu/drm/i915/intel_audio.c | 23 ++-
>  2 files changed, 10 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_reg.h
> b/drivers/gpu/drm/i915/i915_reg.h index acc767a52d8e..595d196f753f
> 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -7332,6 +7332,10 @@ enum {
>  #define   AUD_CONFIG_UPPER_N_MASK(0xff << 20)
>  #define   AUD_CONFIG_LOWER_N_SHIFT   4
>  #define   AUD_CONFIG_LOWER_N_MASK(0xfff << 4)
> +#define   AUD_CONFIG_N_MASK
>   (AUD_CONFIG_UPPER_N_MASK | AUD_CONFIG_LOWER_N_MASK)
> +#define   AUD_CONFIG_N(n) \
> + (n) >> 12) & 0xff) << AUD_CONFIG_UPPER_N_SHIFT) |   \
> +  (((n) & 0xfff) << AUD_CONFIG_LOWER_N_SHIFT))
>  #define   AUD_CONFIG_PIXEL_CLOCK_HDMI_SHIFT  16
>  #define   AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK   (0xf << 16)
>  #define   AUD_CONFIG_PIXEL_CLOCK_HDMI_25175  (0 << 16)
> diff --git a/drivers/gpu/drm/i915/intel_audio.c
> b/drivers/gpu/drm/i915/intel_audio.c
> index 6aa619a84439..d2c6227f72b8 100644
> --- a/drivers/gpu/drm/i915/intel_audio.c
> +++ b/drivers/gpu/drm/i915/intel_audio.c
> @@ -135,20 +135,6 @@ static int audio_config_get_n(const struct
> drm_display_mode *adjusted_mode,
>   return 0;
>  }
> 
> -static uint32_t audio_config_setup_n_reg(int n, uint32_t val) -{
> - int n_low, n_up;
> - uint32_t tmp = val;
> -
> - n_low = n & 0xfff;
> - n_up = (n >> 12) & 0xff;
> - tmp &= ~(AUD_CONFIG_UPPER_N_MASK |
> AUD_CONFIG_LOWER_N_MASK);
> - tmp |= ((n_up << AUD_CONFIG_UPPER_N_SHIFT) |
> - (n_low << AUD_CONFIG_LOWER_N_SHIFT) |
> - AUD_CONFIG_N_PROG_ENABLE);
> - return tmp;
> -}
> -
>  static bool intel_eld_uptodate(struct drm_connector *connector,
>  i915_reg_t reg_eldv, uint32_t bits_eldv,
>  i915_reg_t reg_elda, uint32_t bits_elda, @@ -
> 271,10 +257,13 @@ hsw_hdmi_audio_config_update(struct intel_crtc
> *intel_crtc, enum port port,
>   if (adjusted_mode->crtc_clock == TMDS_296M ||
>   adjusted_mode->crtc_clock == TMDS_297M) {
>   n = audio_config_get_n(adjusted_mode, rate);
> - if (n != 0)
> - tmp = audio_config_setup_n_reg(n, tmp);
> - else
> + if (n != 0) {
> + tmp &= ~AUD_CONFIG_N_MASK;
> + tmp |= AUD_CONFIG_N(n);
> + tmp |= AUD_CONFIG_N_PROG_ENABLE;
> + } else {
>   DRM_DEBUG_KMS("no suitable N value is found\n");
> + }
>   }
> 
>   I915_WRITE(HSW_AUD_CFG(pipe), tmp);
> --
> 2.1.4
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH RESEND 4/9] drm/i915/audio: split dp and hdmi audio config update

2016-10-10 Thread Yang, Libin
Reviewed-by: Libin Yang 

Regards,
Libin


> -Original Message-
> From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org] On Behalf Of
> Jani Nikula
> Sent: Monday, October 10, 2016 11:04 PM
> To: intel-gfx@lists.freedesktop.org
> Cc: Nikula, Jani ; libin.y...@linux.intel.com;
> Pandiyan, Dhinakaran 
> Subject: [Intel-gfx] [PATCH RESEND 4/9] drm/i915/audio: split dp and hdmi
> audio config update
> 
> The code for dp and hdmi are already different, and they're about to diverge
> even more. Split them for clarity in future work. No functional changes.
> 
> Cc: Libin Yang 
> Signed-off-by: Jani Nikula 
> ---
>  drivers/gpu/drm/i915/intel_audio.c | 55 +++--
> -
>  1 file changed, 34 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_audio.c
> b/drivers/gpu/drm/i915/intel_audio.c
> index 4d62b3e8ac19..db7fd6d8333f 100644
> --- a/drivers/gpu/drm/i915/intel_audio.c
> +++ b/drivers/gpu/drm/i915/intel_audio.c
> @@ -148,18 +148,6 @@ static uint32_t audio_config_setup_n_reg(int n,
> uint32_t val)
>   return tmp;
>  }
> 
> -/* check whether N/CTS/M need be set manually */ -static bool
> audio_rate_need_prog(struct intel_crtc *crtc,
> -  const struct drm_display_mode *mode)
> -{
> - if (((mode->clock == TMDS_297M) ||
> -  (mode->clock == TMDS_296M)) &&
> - intel_crtc_has_type(crtc->config, INTEL_OUTPUT_HDMI))
> - return true;
> - else
> - return false;
> -}
> -
>  static bool intel_eld_uptodate(struct drm_connector *connector,
>  i915_reg_t reg_eldv, uint32_t bits_eldv,
>  i915_reg_t reg_elda, uint32_t bits_elda, @@ -
> 245,9 +233,26 @@ static void g4x_audio_codec_enable(struct
> drm_connector *connector,
>   I915_WRITE(G4X_AUD_CNTL_ST, tmp);
>  }
> 
> -static void hsw_audio_config_update(struct intel_crtc *intel_crtc,
> - enum port port,
> - const struct drm_display_mode
> *adjusted_mode)
> +static void
> +hsw_dp_audio_config_update(struct intel_crtc *intel_crtc, enum port port,
> +const struct drm_display_mode *adjusted_mode) {
> + struct drm_i915_private *dev_priv = to_i915(intel_crtc->base.dev);
> + enum pipe pipe = intel_crtc->pipe;
> + u32 tmp;
> +
> + tmp = I915_READ(HSW_AUD_CFG(pipe));
> + tmp &= ~AUD_CONFIG_N_VALUE_INDEX;
> + tmp &= ~AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK;
> + tmp &= ~AUD_CONFIG_N_PROG_ENABLE;
> + tmp |= AUD_CONFIG_N_VALUE_INDEX;
> +
> + I915_WRITE(HSW_AUD_CFG(pipe), tmp);
> +}
> +
> +static void
> +hsw_hdmi_audio_config_update(struct intel_crtc *intel_crtc, enum port
> port,
> +  const struct drm_display_mode *adjusted_mode)
>  {
>   struct drm_i915_private *dev_priv = to_i915(intel_crtc->base.dev);
>   struct i915_audio_component *acomp = dev_priv-
> >audio_component; @@ -259,13 +264,11 @@ static void
> hsw_audio_config_update(struct intel_crtc *intel_crtc,
>   tmp = I915_READ(HSW_AUD_CFG(pipe));
>   tmp &= ~AUD_CONFIG_N_VALUE_INDEX;
>   tmp &= ~AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK;
> - if (intel_crtc_has_dp_encoder(intel_crtc->config))
> - tmp |= AUD_CONFIG_N_VALUE_INDEX;
> - else
> - tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
> -
>   tmp &= ~AUD_CONFIG_N_PROG_ENABLE;
> - if (audio_rate_need_prog(intel_crtc, adjusted_mode)) {
> + tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
> +
> + if (adjusted_mode->clock == TMDS_296M ||
> + adjusted_mode->clock == TMDS_297M) {
>   n = audio_config_get_n(adjusted_mode, rate);
>   if (n != 0)
>   tmp = audio_config_setup_n_reg(n, tmp); @@ -276,6
> +279,16 @@ static void hsw_audio_config_update(struct intel_crtc
> *intel_crtc,
>   I915_WRITE(HSW_AUD_CFG(pipe), tmp);
>  }
> 
> +static void
> +hsw_audio_config_update(struct intel_crtc *intel_crtc, enum port port,
> + const struct drm_display_mode *adjusted_mode) {
> + if (intel_crtc_has_dp_encoder(intel_crtc->config))
> + hsw_dp_audio_config_update(intel_crtc, port,
> adjusted_mode);
> + else
> + hsw_hdmi_audio_config_update(intel_crtc, port,
> adjusted_mode); }
> +
>  static void hsw_audio_codec_disable(struct intel_encoder *encoder)  {
>   struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> --
> 2.1.4
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org

Re: [Intel-gfx] [PATCH RESEND 3/9] drm/i915/audio: use the same code for updating audio config

2016-10-10 Thread Yang, Libin
Reviewed-by: Libin Yang 

Regards,
Libin


> -Original Message-
> From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org] On Behalf Of
> Jani Nikula
> Sent: Monday, October 10, 2016 11:04 PM
> To: intel-gfx@lists.freedesktop.org
> Cc: Nikula, Jani ; libin.y...@linux.intel.com;
> Pandiyan, Dhinakaran 
> Subject: [Intel-gfx] [PATCH RESEND 3/9] drm/i915/audio: use the same code
> for updating audio config
> 
> It gets fragile to duplicate the code for updating HSW_AUD_CFG. The only
> change should be that the hdmi pixel clock is also updated in
> i915_audio_component_sync_audio_rate(), but it should not be any
> different.
> 
> Cc: Libin Yang 
> Signed-off-by: Jani Nikula 
> ---
>  drivers/gpu/drm/i915/intel_audio.c | 29 +++--
>  1 file changed, 3 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_audio.c
> b/drivers/gpu/drm/i915/intel_audio.c
> index 5d0bd07afa51..4d62b3e8ac19 100644
> --- a/drivers/gpu/drm/i915/intel_audio.c
> +++ b/drivers/gpu/drm/i915/intel_audio.c
> @@ -671,10 +671,8 @@ static int
> i915_audio_component_sync_audio_rate(struct device *kdev, int port,
>   struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
>   struct intel_encoder *intel_encoder;
>   struct intel_crtc *crtc;
> - struct drm_display_mode *mode;
> + struct drm_display_mode *adjusted_mode;
>   struct i915_audio_component *acomp = dev_priv-
> >audio_component;
> - u32 tmp;
> - int n;
>   int err = 0;
> 
>   /* HSW, BDW, SKL, KBL need this fix */ @@ -700,33 +698,12 @@
> static int i915_audio_component_sync_audio_rate(struct device *kdev, int
> port,
>   crtc = to_intel_crtc(intel_encoder->base.crtc);
>   pipe = crtc->pipe;
> 
> - mode = >config->base.adjusted_mode;
> + adjusted_mode = >config->base.adjusted_mode;
> 
>   /* port must be valid now, otherwise the pipe will be invalid */
>   acomp->aud_sample_rate[port] = rate;
> 
> - /* 2. check whether to set the N/CTS/M manually or not */
> - if (!audio_rate_need_prog(crtc, mode)) {
> - tmp = I915_READ(HSW_AUD_CFG(pipe));
> - tmp &= ~AUD_CONFIG_N_PROG_ENABLE;
> - I915_WRITE(HSW_AUD_CFG(pipe), tmp);
> - goto unlock;
> - }
> -
> - n = audio_config_get_n(mode, rate);
> - if (n == 0) {
> - DRM_DEBUG_KMS("Using automatic mode for N value on
> port %c\n",
> -   port_name(port));
> - tmp = I915_READ(HSW_AUD_CFG(pipe));
> - tmp &= ~AUD_CONFIG_N_PROG_ENABLE;
> - I915_WRITE(HSW_AUD_CFG(pipe), tmp);
> - goto unlock;
> - }
> -
> - /* 3. set the N/CTS/M */
> - tmp = I915_READ(HSW_AUD_CFG(pipe));
> - tmp = audio_config_setup_n_reg(n, tmp);
> - I915_WRITE(HSW_AUD_CFG(pipe), tmp);
> + hsw_audio_config_update(crtc, port, adjusted_mode);
> 
>   unlock:
>   mutex_unlock(_priv->av_mutex);
> --
> 2.1.4
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH RESEND 2/9] drm/i915/audio: port is going to be just fine, simplify checks

2016-10-10 Thread Yang, Libin
Reviewed-by: Libin Yang 

Regards,
Libin


> -Original Message-
> From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org] On Behalf Of
> Jani Nikula
> Sent: Monday, October 10, 2016 11:04 PM
> To: intel-gfx@lists.freedesktop.org
> Cc: Nikula, Jani ; libin.y...@linux.intel.com;
> Pandiyan, Dhinakaran 
> Subject: [Intel-gfx] [PATCH RESEND 2/9] drm/i915/audio: port is going to be
> just fine, simplify checks
> 
> If it was wrong, we'd be screwed already.
> 
> Cc: Libin Yang 
> Signed-off-by: Jani Nikula 
> ---
>  drivers/gpu/drm/i915/intel_audio.c | 12 ++--
>  1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_audio.c
> b/drivers/gpu/drm/i915/intel_audio.c
> index 0a54f7cdce37..5d0bd07afa51 100644
> --- a/drivers/gpu/drm/i915/intel_audio.c
> +++ b/drivers/gpu/drm/i915/intel_audio.c
> @@ -251,8 +251,9 @@ static void hsw_audio_config_update(struct intel_crtc
> *intel_crtc,  {
>   struct drm_i915_private *dev_priv = to_i915(intel_crtc->base.dev);
>   struct i915_audio_component *acomp = dev_priv-
> >audio_component;
> + int rate = acomp ? acomp->aud_sample_rate[port] : 0;
>   enum pipe pipe = intel_crtc->pipe;
> - int n, rate;
> + int n;
>   u32 tmp;
> 
>   tmp = I915_READ(HSW_AUD_CFG(pipe));
> @@ -265,15 +266,6 @@ static void hsw_audio_config_update(struct
> intel_crtc *intel_crtc,
> 
>   tmp &= ~AUD_CONFIG_N_PROG_ENABLE;
>   if (audio_rate_need_prog(intel_crtc, adjusted_mode)) {
> - if (!acomp)
> - rate = 0;
> - else if (port >= PORT_A && port <= PORT_E)
> - rate = acomp->aud_sample_rate[port];
> - else {
> - DRM_ERROR("invalid port: %d\n", port);
> - rate = 0;
> - }
> -
>   n = audio_config_get_n(adjusted_mode, rate);
>   if (n != 0)
>   tmp = audio_config_setup_n_reg(n, tmp);
> --
> 2.1.4
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH RESEND 1/9] drm/i915/audio: abstract audio config update

2016-10-10 Thread Yang, Libin
Reviewed-by: Libin Yang 

Regards,
Libin


> -Original Message-
> From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org] On Behalf Of
> Jani Nikula
> Sent: Monday, October 10, 2016 11:04 PM
> To: intel-gfx@lists.freedesktop.org
> Cc: Nikula, Jani ; libin.y...@linux.intel.com;
> Pandiyan, Dhinakaran 
> Subject: [Intel-gfx] [PATCH RESEND 1/9] drm/i915/audio: abstract audio
> config update
> 
> Prepare for using the same code for updating HSW_AUD_CFG register. No
> functional changes.
> 
> Cc: Libin Yang 
> Signed-off-by: Jani Nikula 
> ---
>  drivers/gpu/drm/i915/intel_audio.c | 68 ++
> 
>  1 file changed, 40 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_audio.c
> b/drivers/gpu/drm/i915/intel_audio.c
> index 9583f432e02e..0a54f7cdce37 100644
> --- a/drivers/gpu/drm/i915/intel_audio.c
> +++ b/drivers/gpu/drm/i915/intel_audio.c
> @@ -245,6 +245,45 @@ static void g4x_audio_codec_enable(struct
> drm_connector *connector,
>   I915_WRITE(G4X_AUD_CNTL_ST, tmp);
>  }
> 
> +static void hsw_audio_config_update(struct intel_crtc *intel_crtc,
> + enum port port,
> + const struct drm_display_mode
> *adjusted_mode) {
> + struct drm_i915_private *dev_priv = to_i915(intel_crtc->base.dev);
> + struct i915_audio_component *acomp = dev_priv-
> >audio_component;
> + enum pipe pipe = intel_crtc->pipe;
> + int n, rate;
> + u32 tmp;
> +
> + tmp = I915_READ(HSW_AUD_CFG(pipe));
> + tmp &= ~AUD_CONFIG_N_VALUE_INDEX;
> + tmp &= ~AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK;
> + if (intel_crtc_has_dp_encoder(intel_crtc->config))
> + tmp |= AUD_CONFIG_N_VALUE_INDEX;
> + else
> + tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
> +
> + tmp &= ~AUD_CONFIG_N_PROG_ENABLE;
> + if (audio_rate_need_prog(intel_crtc, adjusted_mode)) {
> + if (!acomp)
> + rate = 0;
> + else if (port >= PORT_A && port <= PORT_E)
> + rate = acomp->aud_sample_rate[port];
> + else {
> + DRM_ERROR("invalid port: %d\n", port);
> + rate = 0;
> + }
> +
> + n = audio_config_get_n(adjusted_mode, rate);
> + if (n != 0)
> + tmp = audio_config_setup_n_reg(n, tmp);
> + else
> + DRM_DEBUG_KMS("no suitable N value is found\n");
> + }
> +
> + I915_WRITE(HSW_AUD_CFG(pipe), tmp);
> +}
> +
>  static void hsw_audio_codec_disable(struct intel_encoder *encoder)  {
>   struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> @@ -283,11 +322,9 @@ static void hsw_audio_codec_enable(struct
> drm_connector *connector,
>   struct intel_crtc *intel_crtc = to_intel_crtc(intel_encoder->base.crtc);
>   enum pipe pipe = intel_crtc->pipe;
>   enum port port = intel_encoder->port;
> - struct i915_audio_component *acomp = dev_priv-
> >audio_component;
>   const uint8_t *eld = connector->eld;
>   uint32_t tmp;
>   int len, i;
> - int n, rate;
> 
>   DRM_DEBUG_KMS("Enable audio codec on pipe %c, %u bytes ELD\n",
> pipe_name(pipe), drm_eld_size(eld)); @@ -323,32 +360,7
> @@ static void hsw_audio_codec_enable(struct drm_connector *connector,
>   I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp);
> 
>   /* Enable timestamps */
> - tmp = I915_READ(HSW_AUD_CFG(pipe));
> - tmp &= ~AUD_CONFIG_N_VALUE_INDEX;
> - tmp &= ~AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK;
> - if (intel_crtc_has_dp_encoder(intel_crtc->config))
> - tmp |= AUD_CONFIG_N_VALUE_INDEX;
> - else
> - tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
> -
> - tmp &= ~AUD_CONFIG_N_PROG_ENABLE;
> - if (audio_rate_need_prog(intel_crtc, adjusted_mode)) {
> - if (!acomp)
> - rate = 0;
> - else if (port >= PORT_A && port <= PORT_E)
> - rate = acomp->aud_sample_rate[port];
> - else {
> - DRM_ERROR("invalid port: %d\n", port);
> - rate = 0;
> - }
> - n = audio_config_get_n(adjusted_mode, rate);
> - if (n != 0)
> - tmp = audio_config_setup_n_reg(n, tmp);
> - else
> - DRM_DEBUG_KMS("no suitable N value is found\n");
> - }
> -
> - I915_WRITE(HSW_AUD_CFG(pipe), tmp);
> + hsw_audio_config_update(intel_crtc, port, adjusted_mode);
> 
>   mutex_unlock(_priv->av_mutex);
>  }
> --
> 2.1.4
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [PATCH] drm/i915/audio: extend get_saved_enc() to support more scenarios

2016-09-26 Thread Yang, Libin
Yes, I see. I will co-work with DK to fix the issue.

Regards,
Libin


> -Original Message-
> From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
> Sent: Monday, September 26, 2016 4:39 PM
> To: Yang, Libin <libin.y...@intel.com>; libin.y...@linux.intel.com; intel-
> g...@lists.freedesktop.org; ville.syrj...@linux.intel.com; Vetter, Daniel
> <daniel.vet...@intel.com>; ti...@suse.de
> Cc: Pandiyan, Dhinakaran <dhinakaran.pandi...@intel.com>; Bride, Jim
> <jim.br...@intel.com>; Kp, Jeeja <jeeja...@intel.com>
> Subject: RE: [PATCH] drm/i915/audio: extend get_saved_enc() to support
> more scenarios
> 
> 
> I will NAK all further DP MST audio patches until
> 
> https://bugs.freedesktop.org/show_bug.cgi?id=97907
> 
> is fixed.
> 
> 
> BR,
> Jani.
> 
> 
> On Mon, 26 Sep 2016, "Yang, Libin" <libin.y...@intel.com> wrote:
> > Add DK, Jim and Jeeja
> >
> > Regards,
> > Libin
> >
> >
> >> -Original Message-
> >> From: libin.y...@linux.intel.com [mailto:libin.y...@linux.intel.com]
> >> Sent: Monday, September 26, 2016 4:21 PM
> >> To: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com;
> >> ville.syrj...@linux.intel.com; Vetter, Daniel
> >> <daniel.vet...@intel.com>; ti...@suse.de
> >> Cc: Yang, Libin <libin.y...@intel.com>; Libin Yang
> >> <libin.y...@linux.intel.com>
> >> Subject: [PATCH] drm/i915/audio: extend get_saved_enc() to support
> >> more scenarios
> >>
> >> From: Libin Yang <libin.y...@linux.intel.com>
> >>
> >> When bootup, audio driver may not know it is MST or not. The audio
> >> driver will poll all the port & pipe combinations in either MST or Non-MST
> mode.
> >> get_saved_enc() should handle this situation.
> >>
> >> Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> >> ---
> >>  drivers/gpu/drm/i915/intel_audio.c | 32
> >> --
> >> --
> >>  1 file changed, 28 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/i915/intel_audio.c
> >> b/drivers/gpu/drm/i915/intel_audio.c
> >> index 9583f43..a6af14f 100644
> >> --- a/drivers/gpu/drm/i915/intel_audio.c
> >> +++ b/drivers/gpu/drm/i915/intel_audio.c
> >> @@ -635,25 +635,49 @@ static int
> >> i915_audio_component_get_cdclk_freq(struct device *kdev)
> >>return dev_priv->cdclk_freq;
> >>  }
> >>
> >> +/*
> >> + * get the intel_encoder according to the parameter port and pipe
> >> + * intel_encoder is saved by the index of pipe
> >> + * MST & (pipe >= 0): return the av_enc_map[pipe],
> >> + *   when port is matched
> >> + * MST & (pipe < 0): this is invalid
> >> + * Non-MST & (pipe >= 0): only pipe = 0 (the first device entry)
> >> + *   will get the right intel_encoder with port matched
> >> + * Non-MST & (pipe < 0): get the right intel_encoder with port
> >> +matched */
> >>  static struct intel_encoder *get_saved_enc(struct drm_i915_private
> >> *dev_priv,
> >>   int port, int pipe)
> >>  {
> >> +  struct intel_encoder *encoder;
> >>
> >>if (WARN_ON(pipe >= I915_MAX_PIPES))
> >>return NULL;
> >>
> >>/* MST */
> >> -  if (pipe >= 0)
> >> -  return dev_priv->av_enc_map[pipe];
> >> +  if (pipe >= 0) {
> >> +  encoder = dev_priv->av_enc_map[pipe];
> >> +  /*
> >> +   * when bootup, audio driver may not know it is
> >> +   * MST or not. So it will poll all the port & pipe
> >> +   * combinations
> >> +   */
> >> +  if (encoder != NULL && encoder->port == port &&
> >> +  encoder->type == INTEL_OUTPUT_DP_MST)
> >> +  return encoder;
> >> +  }
> >>
> >>/* Non-MST */
> >> -  for_each_pipe(dev_priv, pipe) {
> >> -  struct intel_encoder *encoder;
> >> +  if (pipe > 0)
> >> +  return NULL;
> >>
> >> +  for_each_pipe(dev_priv, pipe) {
> >>encoder = dev_priv->av_enc_map[pipe];
> >>if (encoder == NULL)
> >>continue;
> >>
> >> +  if (encoder->type == INTEL_OUTPUT_DP_MST)
> >> +  continue;
> >> +
> >>if (port == encoder->port)
> >>return encoder;
> >>}
> >> --
> >> 1.9.1
> >
> 
> --
> Jani Nikula, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915/audio: extend get_saved_enc() to support more scenarios

2016-09-26 Thread Yang, Libin
Add DK, Jim and Jeeja

Regards,
Libin


> -Original Message-
> From: libin.y...@linux.intel.com [mailto:libin.y...@linux.intel.com]
> Sent: Monday, September 26, 2016 4:21 PM
> To: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com;
> ville.syrj...@linux.intel.com; Vetter, Daniel <daniel.vet...@intel.com>;
> ti...@suse.de
> Cc: Yang, Libin <libin.y...@intel.com>; Libin Yang
> <libin.y...@linux.intel.com>
> Subject: [PATCH] drm/i915/audio: extend get_saved_enc() to support more
> scenarios
> 
> From: Libin Yang <libin.y...@linux.intel.com>
> 
> When bootup, audio driver may not know it is MST or not. The audio driver
> will poll all the port & pipe combinations in either MST or Non-MST mode.
> get_saved_enc() should handle this situation.
> 
> Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_audio.c | 32 --
> --
>  1 file changed, 28 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_audio.c
> b/drivers/gpu/drm/i915/intel_audio.c
> index 9583f43..a6af14f 100644
> --- a/drivers/gpu/drm/i915/intel_audio.c
> +++ b/drivers/gpu/drm/i915/intel_audio.c
> @@ -635,25 +635,49 @@ static int
> i915_audio_component_get_cdclk_freq(struct device *kdev)
>   return dev_priv->cdclk_freq;
>  }
> 
> +/*
> + * get the intel_encoder according to the parameter port and pipe
> + * intel_encoder is saved by the index of pipe
> + * MST & (pipe >= 0): return the av_enc_map[pipe],
> + *   when port is matched
> + * MST & (pipe < 0): this is invalid
> + * Non-MST & (pipe >= 0): only pipe = 0 (the first device entry)
> + *   will get the right intel_encoder with port matched
> + * Non-MST & (pipe < 0): get the right intel_encoder with port matched
> +*/
>  static struct intel_encoder *get_saved_enc(struct drm_i915_private
> *dev_priv,
>  int port, int pipe)
>  {
> + struct intel_encoder *encoder;
> 
>   if (WARN_ON(pipe >= I915_MAX_PIPES))
>   return NULL;
> 
>   /* MST */
> - if (pipe >= 0)
> - return dev_priv->av_enc_map[pipe];
> + if (pipe >= 0) {
> + encoder = dev_priv->av_enc_map[pipe];
> + /*
> +  * when bootup, audio driver may not know it is
> +  * MST or not. So it will poll all the port & pipe
> +  * combinations
> +  */
> + if (encoder != NULL && encoder->port == port &&
> + encoder->type == INTEL_OUTPUT_DP_MST)
> + return encoder;
> + }
> 
>   /* Non-MST */
> - for_each_pipe(dev_priv, pipe) {
> - struct intel_encoder *encoder;
> + if (pipe > 0)
> + return NULL;
> 
> + for_each_pipe(dev_priv, pipe) {
>   encoder = dev_priv->av_enc_map[pipe];
>   if (encoder == NULL)
>   continue;
> 
> + if (encoder->type == INTEL_OUTPUT_DP_MST)
> + continue;
> +
>   if (port == encoder->port)
>   return encoder;
>   }
> --
> 1.9.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v4 0/3] drm/i915: fix some audio support 4K resolution issues

2016-09-22 Thread Yang, Libin
Patches are tested and passed. Thanks.

Regards,
Libin


> -Original Message-
> From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
> Sent: Thursday, September 22, 2016 3:45 PM
> To: Yang, Libin <libin.y...@intel.com>; 'libin.y...@linux.intel.com'
> <libin.y...@linux.intel.com>; 'intel-gfx@lists.freedesktop.org'  g...@lists.freedesktop.org>; 'ville.syrj...@linux.intel.com'
> <ville.syrj...@linux.intel.com>; Vetter, Daniel <daniel.vet...@intel.com>;
> 'ti...@suse.de' <ti...@suse.de>
> Subject: RE: [PATCH v4 0/3] drm/i915: fix some audio support 4K resolution
> issues
> 
> On Thu, 22 Sep 2016, Jani Nikula <jani.nik...@linux.intel.com> wrote:
> > On Thu, 22 Sep 2016, "Yang, Libin" <libin.y...@intel.com> wrote:
> >> Hi Jani,
> >>
> >> Thanks a lot for your help on reviewing and refining these patches. I
> >> will test your patches and let you know the result.
> >
> > Thanks. Review is also much appreciated! ;)
> 
> Also #2, please have a look at bug [1], especially the patches and discussion
> from comment #26 on.
> 
> Thanks,
> Jani.
> 
> [1] https://bugs.freedesktop.org/show_bug.cgi?id=97442
> 
> 
> >
> > BR,
> > Jani.
> >
> >>
> >> Regards,
> >> Libin
> >>
> >>
> >>> -Original Message-
> >>> From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
> >>> Sent: Thursday, September 22, 2016 2:40 AM
> >>> To: Yang, Libin <libin.y...@intel.com>; 'libin.y...@linux.intel.com'
> >>> <libin.y...@linux.intel.com>; 'intel-gfx@lists.freedesktop.org'
> >>> ; 'ville.syrj...@linux.intel.com'
> >>> <ville.syrj...@linux.intel.com>; Vetter, Daniel
> >>> <daniel.vet...@intel.com>; 'ti...@suse.de' <ti...@suse.de>
> >>> Subject: RE: [PATCH v4 0/3] drm/i915: fix some audio support 4K
> >>> resolution issues
> >>>
> >>> On Mon, 12 Sep 2016, "Yang, Libin" <libin.y...@intel.com> wrote:
> >>> > Any comments?
> >>>
> >>> Apologies for the way too long delay. I felt it would have been
> >>> unfair to ask you to do the changes I thought were necessary after
> >>> such a delay, so I sent them as patches... The last one still needs
> >>> review, but at least the mundane stuff is out of the way now.
> >>>
> >>> https://patchwork.freedesktop.org/series/12754/
> >>>
> >>> BR,
> >>> Jani.
> >>>
> >>>
> >>> --
> >>> Jani Nikula, Intel Open Source Technology Center
> 
> --
> Jani Nikula, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v4 0/3] drm/i915: fix some audio support 4K resolution issues

2016-09-22 Thread Yang, Libin
Hi Jani,

Thanks a lot for your help on reviewing and refining these patches. I will test 
your patches and let you know the result.

Regards,
Libin


> -Original Message-
> From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
> Sent: Thursday, September 22, 2016 2:40 AM
> To: Yang, Libin <libin.y...@intel.com>; 'libin.y...@linux.intel.com'
> <libin.y...@linux.intel.com>; 'intel-gfx@lists.freedesktop.org'  g...@lists.freedesktop.org>; 'ville.syrj...@linux.intel.com'
> <ville.syrj...@linux.intel.com>; Vetter, Daniel <daniel.vet...@intel.com>;
> 'ti...@suse.de' <ti...@suse.de>
> Subject: RE: [PATCH v4 0/3] drm/i915: fix some audio support 4K resolution
> issues
> 
> On Mon, 12 Sep 2016, "Yang, Libin" <libin.y...@intel.com> wrote:
> > Any comments?
> 
> Apologies for the way too long delay. I felt it would have been unfair to ask
> you to do the changes I thought were necessary after such a delay, so I sent
> them as patches... The last one still needs review, but at least the mundane
> stuff is out of the way now.
> 
> https://patchwork.freedesktop.org/series/12754/
> 
> BR,
> Jani.
> 
> 
> --
> Jani Nikula, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v4 0/3] drm/i915: fix some audio support 4K resolution issues

2016-09-22 Thread Yang, Libin

> -Original Message-
> From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
> Sent: Thursday, September 22, 2016 3:45 PM
> To: Yang, Libin <libin.y...@intel.com>; 'libin.y...@linux.intel.com'
> <libin.y...@linux.intel.com>; 'intel-gfx@lists.freedesktop.org'  g...@lists.freedesktop.org>; 'ville.syrj...@linux.intel.com'
> <ville.syrj...@linux.intel.com>; Vetter, Daniel <daniel.vet...@intel.com>;
> 'ti...@suse.de' <ti...@suse.de>
> Subject: RE: [PATCH v4 0/3] drm/i915: fix some audio support 4K resolution
> issues
> 
> On Thu, 22 Sep 2016, Jani Nikula <jani.nik...@linux.intel.com> wrote:
> > On Thu, 22 Sep 2016, "Yang, Libin" <libin.y...@intel.com> wrote:
> >> Hi Jani,
> >>
> >> Thanks a lot for your help on reviewing and refining these patches. I
> >> will test your patches and let you know the result.
> >
> > Thanks. Review is also much appreciated! ;)
> 
> Also #2, please have a look at bug [1], especially the patches and discussion
> from comment #26 on.

OK, I will do it tomorrow. Today, I'm busy on DP MST patches.

Regards,
Libin

> 
> Thanks,
> Jani.
> 
> [1] https://bugs.freedesktop.org/show_bug.cgi?id=97442
> 
> 
> >
> > BR,
> > Jani.
> >
> >>
> >> Regards,
> >> Libin
> >>
> >>
> >>> -Original Message-
> >>> From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
> >>> Sent: Thursday, September 22, 2016 2:40 AM
> >>> To: Yang, Libin <libin.y...@intel.com>; 'libin.y...@linux.intel.com'
> >>> <libin.y...@linux.intel.com>; 'intel-gfx@lists.freedesktop.org'
> >>> ; 'ville.syrj...@linux.intel.com'
> >>> <ville.syrj...@linux.intel.com>; Vetter, Daniel
> >>> <daniel.vet...@intel.com>; 'ti...@suse.de' <ti...@suse.de>
> >>> Subject: RE: [PATCH v4 0/3] drm/i915: fix some audio support 4K
> >>> resolution issues
> >>>
> >>> On Mon, 12 Sep 2016, "Yang, Libin" <libin.y...@intel.com> wrote:
> >>> > Any comments?
> >>>
> >>> Apologies for the way too long delay. I felt it would have been
> >>> unfair to ask you to do the changes I thought were necessary after
> >>> such a delay, so I sent them as patches... The last one still needs
> >>> review, but at least the mundane stuff is out of the way now.
> >>>
> >>> https://patchwork.freedesktop.org/series/12754/
> >>>
> >>> BR,
> >>> Jani.
> >>>
> >>>
> >>> --
> >>> Jani Nikula, Intel Open Source Technology Center
> 
> --
> Jani Nikula, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v4 0/3] drm/i915: fix some audio support 4K resolution issues

2016-09-11 Thread Yang, Libin
Any comments?

Regards,
Libin


> -Original Message-
> From: Yang, Libin
> Sent: Wednesday, August 24, 2016 1:36 PM
> To: 'libin.y...@linux.intel.com' <libin.y...@linux.intel.com>; 'intel-
> g...@lists.freedesktop.org' <intel-gfx@lists.freedesktop.org>;
> 'jani.nik...@linux.intel.com' <jani.nik...@linux.intel.com>;
> 'ville.syrj...@linux.intel.com' <ville.syrj...@linux.intel.com>; Vetter, 
> Daniel
> <daniel.vet...@intel.com>; 'ti...@suse.de' <ti...@suse.de>
> Subject: RE: [PATCH v4 0/3] drm/i915: fix some audio support 4K resolution
> issues
> 
> Sorry for disturb. Is there any comments for the patches?
> 
> Regards,
> Libin
> 
> > -Original Message-
> > From: Yang, Libin
> > Sent: Monday, August 22, 2016 9:16 AM
> > To: libin.y...@linux.intel.com; intel-gfx@lists.freedesktop.org;
> > jani.nik...@linux.intel.com; ville.syrj...@linux.intel.com; Vetter,
> > Daniel <daniel.vet...@intel.com>; ti...@suse.de
> > Subject: RE: [PATCH v4 0/3] drm/i915: fix some audio support 4K
> > resolution issues
> >
> > Any comments?
> >
> > Regards,
> > Libin
> >
> >
> > > -Original Message-
> > > From: libin.y...@linux.intel.com [mailto:libin.y...@linux.intel.com]
> > > Sent: Thursday, August 18, 2016 2:42 PM
> > > To: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com;
> > > ville.syrj...@linux.intel.com; Vetter, Daniel
> > > <daniel.vet...@intel.com>; ti...@suse.de
> > > Cc: Yang, Libin <libin.y...@intel.com>; Libin Yang
> > > <libin.y...@linux.intel.com>
> > > Subject: [PATCH v4 0/3] drm/i915: fix some audio support 4K
> > > resolution issues
> > >
> > > From: Libin Yang <libin.y...@linux.intel.com>
> > >
> > > changelog:
> > > v1: initial patches
> > >
> > > v2: change to use crtc->config->port_clock instead of mode->clock for dp
> > > change to use mode->crtc_clock instead of mode->clock
> > >   rename mode to adjusted_mode
> > >
> > > v3: add support for 270MHz
> > > add more platforms support
> > >   use u16 n; u16 m to save the space
> > >   add support for 192KHz, 96KHz, 88.2KHz
> > >   split patch for more platform support separately
> > >
> > > v4: change to use intel_crtc_has_dp_encoder() to support DP MST
> > > add support for 176.4KHz
> > > fix some tiny code style issues
> > > reset cts to 0 for HDMI mode
> > >
> > > Libin Yang (3):
> > >   drm/i915: set proper N/M in modeset
> > >   drm/i915: set proper N/MCTS on more platforms
> > >   drm/i915: HDMI audio gets the TMDS clock by crtc_clock
> > >
> > >  drivers/gpu/drm/i915/i915_reg.h|   7 ++
> > >  drivers/gpu/drm/i915/intel_audio.c | 155
> > > +++--
> > >  2 files changed, 140 insertions(+), 22 deletions(-)
> > >
> > > --
> > > 1.9.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [alsa-devel] [PATCH v4] drm/i915/dp: DP audio API changes for MST

2016-09-02 Thread Yang, Libin

> -Original Message-
> From: alsa-devel-boun...@alsa-project.org [mailto:alsa-devel-
> boun...@alsa-project.org] On Behalf Of Pandiyan, Dhinakaran
> Sent: Thursday, September 1, 2016 3:48 PM
> To: intel-gfx@lists.freedesktop.org
> Cc: alsa-de...@alsa-project.org; ti...@suse.de; jim.br...@linux.intel.com;
> Kp, Jeeja ; libin.y...@linux.intel.com;
> ville.syrj...@linux.intel.com
> Subject: Re: [alsa-devel] [PATCH v4] drm/i915/dp: DP audio API changes for
> MST
> 
> The changes in this version are primarily in i915. I have carried over 
> Takashi's
> R-B from the previous version and removed Ville's.
> 
> 
> From: Pandiyan, Dhinakaran
> Sent: Thursday, September 01, 2016 12:50 AM
> To: intel-gfx@lists.freedesktop.org
> Cc: libin.y...@linux.intel.com; jim.br...@linux.intel.com;
> ville.syrj...@linux.intel.com; ti...@suse.de; alsa-de...@alsa-project.org; Kp,
> Jeeja; Pandiyan, Dhinakaran
> Subject: [PATCH v4] drm/i915/dp: DP audio API changes for MST
> 
> DP MST provides the capability to send multiple video and audio streams
> through a single port. This requires the API's between i915 and audio drivers
> to distinguish between multiple audio capable displays that can be connected
> to a port. Currently only the port identity is shared in the APIs. This patch
> adds support for MST with an additional parameter 'int pipe'. The existing
> parameter 'port' does not change it's meaning.
> 
> pipe =
> MST : display pipe that the stream originates from
> Non-MST : -1
> 
> Affected APIs:
> struct i915_audio_component_ops
> -   int (*sync_audio_rate)(struct device *, int port, int rate);
> +   int (*sync_audio_rate)(struct device *, int port, int pipe,
> +int rate);
> 
> -   int (*get_eld)(struct device *, int port, bool *enabled,
> -   unsigned char *buf, int max_bytes);
> +   int (*get_eld)(struct device *, int port, int pipe,
> +  bool *enabled, unsigned char *buf, int
> + max_bytes);
> 
> struct i915_audio_component_audio_ops
> -   void (*pin_eld_notify)(void *audio_ptr, int port);
> +   void (*pin_eld_notify)(void *audio_ptr, int port, int pipe);
> 
> This patch makes dummy changes in the audio drivers (thanks Libin) for build
> to succeed. The audio side drivers will send the right 'pipe' values for MST 
> in
> patches that will follow.
> 
> v2:
> Renamed the new API parameter from 'dev_id' to 'pipe'. (Jim, Ville) Included
> Asoc driver API compatibility changes from Jeeja.
> Added WARN_ON() for invalid pipe in get_saved_encoder(). (Takashi) Added
> comment for av_enc_map[] definition. (Takashi)
> 
> v3:
> Fixed logic error introduced while renaming 'dev_id' as 'pipe' (Ville) Renamed
> get_saved_encoder() to get_saved_enc() to reduce line length
> 
> v4:
> Rebased.
> Parameter check for pipe < -1 values in get_saved_enc() (Ville) Switched to
> for_each_pipe() in get_saved_enc() (Ville) Renamed 'pipe' to 'dev_id' in
> audio side code (Takashi)
> 
> Signed-off-by: Dhinakaran Pandiyan 
> Reviewed-by: Takashi Iwai 
> 
> ---
>  drivers/gpu/drm/i915/i915_drv.h|  3 +-
>  drivers/gpu/drm/i915/intel_audio.c | 94 ++-
> ---
>  include/drm/i915_component.h   |  6 +--
>  include/sound/hda_i915.h   | 11 +++--
>  sound/hda/hdac_i915.c  | 16 ---
>  sound/pci/hda/patch_hdmi.c |  7 +--
>  sound/soc/codecs/hdac_hdmi.c   |  2 +-
>  7 files changed, 92 insertions(+), 47 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h
> b/drivers/gpu/drm/i915/i915_drv.h index aaa9c60..dac81c7 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2056,7 +2056,8 @@ struct drm_i915_private {
> /* perform PHY state sanity checks? */
> bool chv_phy_assert[2];
> 
> -   struct intel_encoder *dig_port_map[I915_MAX_PORTS];
> +   /* Used to save the pipe-to-encoder mapping for audio */
> +   struct intel_encoder *av_enc_map[I915_MAX_PIPES];
> 
> /*
>  * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your 
> patch
> diff --git a/drivers/gpu/drm/i915/intel_audio.c
> b/drivers/gpu/drm/i915/intel_audio.c
> index 40fbdd8..9583f43 100644
> --- a/drivers/gpu/drm/i915/intel_audio.c
> +++ b/drivers/gpu/drm/i915/intel_audio.c
> @@ -491,6 +491,7 @@ void intel_audio_codec_enable(struct intel_encoder
> *intel_encoder)
> struct drm_i915_private *dev_priv = to_i915(encoder->dev);
> struct i915_audio_component *acomp = dev_priv->audio_component;
> enum port port = intel_encoder->port;
> +   enum pipe pipe = crtc->pipe;
> 
> connector = drm_select_eld(encoder);
> if (!connector)
> @@ -515,12 +516,18 @@ void intel_audio_codec_enable(struct
> intel_encoder *intel_encoder)
> 
> mutex_lock(_priv->av_mutex);
> 

Re: [Intel-gfx] [PATCH v4 0/3] drm/i915: fix some audio support 4K resolution issues

2016-08-24 Thread Yang, Libin
Hi Daniel,

Thanks. Let's wait for Ville back from vacation. :)

Regards,
Libin


> -Original Message-
> From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of Daniel
> Vetter
> Sent: Wednesday, August 24, 2016 1:53 PM
> To: Yang, Libin <libin.y...@intel.com>
> Cc: 'libin.y...@linux.intel.com' <libin.y...@linux.intel.com>; 'intel-
> g...@lists.freedesktop.org' <intel-gfx@lists.freedesktop.org>;
> 'jani.nik...@linux.intel.com' <jani.nik...@linux.intel.com>;
> 'ville.syrj...@linux.intel.com' <ville.syrj...@linux.intel.com>; Vetter, 
> Daniel
> <daniel.vet...@intel.com>; 'ti...@suse.de' <ti...@suse.de>
> Subject: Re: [Intel-gfx] [PATCH v4 0/3] drm/i915: fix some audio support 4K
> resolution issues
> 
> On Wed, Aug 24, 2016 at 05:35:34AM +, Yang, Libin wrote:
> > Sorry for disturb. Is there any comments for the patches?
> 
> Ville is on vacation, not sure whom else would be a good reviewer from our
> side ... Might need to escalate to managers to finding a random reviewer
> who first needs to ramp up on hdmi/audio issues.
> -Daniel
> 
> >
> > Regards,
> > Libin
> >
> > > -Original Message-
> > > From: Yang, Libin
> > > Sent: Monday, August 22, 2016 9:16 AM
> > > To: libin.y...@linux.intel.com; intel-gfx@lists.freedesktop.org;
> > > jani.nik...@linux.intel.com; ville.syrj...@linux.intel.com; Vetter,
> > > Daniel <daniel.vet...@intel.com>; ti...@suse.de
> > > Subject: RE: [PATCH v4 0/3] drm/i915: fix some audio support 4K
> > > resolution issues
> > >
> > > Any comments?
> > >
> > > Regards,
> > > Libin
> > >
> > >
> > > > -Original Message-
> > > > From: libin.y...@linux.intel.com
> > > > [mailto:libin.y...@linux.intel.com]
> > > > Sent: Thursday, August 18, 2016 2:42 PM
> > > > To: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com;
> > > > ville.syrj...@linux.intel.com; Vetter, Daniel
> > > > <daniel.vet...@intel.com>; ti...@suse.de
> > > > Cc: Yang, Libin <libin.y...@intel.com>; Libin Yang
> > > > <libin.y...@linux.intel.com>
> > > > Subject: [PATCH v4 0/3] drm/i915: fix some audio support 4K
> > > > resolution issues
> > > >
> > > > From: Libin Yang <libin.y...@linux.intel.com>
> > > >
> > > > changelog:
> > > > v1: initial patches
> > > >
> > > > v2: change to use crtc->config->port_clock instead of mode->clock for
> dp
> > > > change to use mode->crtc_clock instead of mode->clock
> > > > rename mode to adjusted_mode
> > > >
> > > > v3: add support for 270MHz
> > > > add more platforms support
> > > > use u16 n; u16 m to save the space
> > > > add support for 192KHz, 96KHz, 88.2KHz
> > > > split patch for more platform support separately
> > > >
> > > > v4: change to use intel_crtc_has_dp_encoder() to support DP MST
> > > > add support for 176.4KHz
> > > > fix some tiny code style issues
> > > > reset cts to 0 for HDMI mode
> > > >
> > > > Libin Yang (3):
> > > >   drm/i915: set proper N/M in modeset
> > > >   drm/i915: set proper N/MCTS on more platforms
> > > >   drm/i915: HDMI audio gets the TMDS clock by crtc_clock
> > > >
> > > >  drivers/gpu/drm/i915/i915_reg.h|   7 ++
> > > >  drivers/gpu/drm/i915/intel_audio.c | 155
> > > > +++--
> > > >  2 files changed, 140 insertions(+), 22 deletions(-)
> > > >
> > > > --
> > > > 1.9.1
> >
> > ___
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v4 0/3] drm/i915: fix some audio support 4K resolution issues

2016-08-23 Thread Yang, Libin
Sorry for disturb. Is there any comments for the patches?

Regards,
Libin

> -Original Message-
> From: Yang, Libin
> Sent: Monday, August 22, 2016 9:16 AM
> To: libin.y...@linux.intel.com; intel-gfx@lists.freedesktop.org;
> jani.nik...@linux.intel.com; ville.syrj...@linux.intel.com; Vetter, Daniel
> <daniel.vet...@intel.com>; ti...@suse.de
> Subject: RE: [PATCH v4 0/3] drm/i915: fix some audio support 4K resolution
> issues
> 
> Any comments?
> 
> Regards,
> Libin
> 
> 
> > -Original Message-
> > From: libin.y...@linux.intel.com [mailto:libin.y...@linux.intel.com]
> > Sent: Thursday, August 18, 2016 2:42 PM
> > To: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com;
> > ville.syrj...@linux.intel.com; Vetter, Daniel
> > <daniel.vet...@intel.com>; ti...@suse.de
> > Cc: Yang, Libin <libin.y...@intel.com>; Libin Yang
> > <libin.y...@linux.intel.com>
> > Subject: [PATCH v4 0/3] drm/i915: fix some audio support 4K resolution
> > issues
> >
> > From: Libin Yang <libin.y...@linux.intel.com>
> >
> > changelog:
> > v1: initial patches
> >
> > v2: change to use crtc->config->port_clock instead of mode->clock for dp
> > change to use mode->crtc_clock instead of mode->clock
> > rename mode to adjusted_mode
> >
> > v3: add support for 270MHz
> > add more platforms support
> > use u16 n; u16 m to save the space
> > add support for 192KHz, 96KHz, 88.2KHz
> > split patch for more platform support separately
> >
> > v4: change to use intel_crtc_has_dp_encoder() to support DP MST
> > add support for 176.4KHz
> > fix some tiny code style issues
> > reset cts to 0 for HDMI mode
> >
> > Libin Yang (3):
> >   drm/i915: set proper N/M in modeset
> >   drm/i915: set proper N/MCTS on more platforms
> >   drm/i915: HDMI audio gets the TMDS clock by crtc_clock
> >
> >  drivers/gpu/drm/i915/i915_reg.h|   7 ++
> >  drivers/gpu/drm/i915/intel_audio.c | 155
> > +++--
> >  2 files changed, 140 insertions(+), 22 deletions(-)
> >
> > --
> > 1.9.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v4 0/3] drm/i915: fix some audio support 4K resolution issues

2016-08-21 Thread Yang, Libin
Any comments?

Regards,
Libin


> -Original Message-
> From: libin.y...@linux.intel.com [mailto:libin.y...@linux.intel.com]
> Sent: Thursday, August 18, 2016 2:42 PM
> To: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com;
> ville.syrj...@linux.intel.com; Vetter, Daniel <daniel.vet...@intel.com>;
> ti...@suse.de
> Cc: Yang, Libin <libin.y...@intel.com>; Libin Yang
> <libin.y...@linux.intel.com>
> Subject: [PATCH v4 0/3] drm/i915: fix some audio support 4K resolution
> issues
> 
> From: Libin Yang <libin.y...@linux.intel.com>
> 
> changelog:
> v1: initial patches
> 
> v2: change to use crtc->config->port_clock instead of mode->clock for dp
> change to use mode->crtc_clock instead of mode->clock
>   rename mode to adjusted_mode
> 
> v3: add support for 270MHz
> add more platforms support
>   use u16 n; u16 m to save the space
>   add support for 192KHz, 96KHz, 88.2KHz
>   split patch for more platform support separately
> 
> v4: change to use intel_crtc_has_dp_encoder() to support DP MST
> add support for 176.4KHz
> fix some tiny code style issues
> reset cts to 0 for HDMI mode
> 
> Libin Yang (3):
>   drm/i915: set proper N/M in modeset
>   drm/i915: set proper N/MCTS on more platforms
>   drm/i915: HDMI audio gets the TMDS clock by crtc_clock
> 
>  drivers/gpu/drm/i915/i915_reg.h|   7 ++
>  drivers/gpu/drm/i915/intel_audio.c | 155
> +++--
>  2 files changed, 140 insertions(+), 22 deletions(-)
> 
> --
> 1.9.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v3 1/3] drm/i915: set proper N/M in modeset

2016-08-05 Thread Yang, Libin


> -Original Message-
> From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> Sent: Friday, August 5, 2016 6:54 PM
> To: Yang, Libin <libin.y...@intel.com>
> Cc: libin.y...@linux.intel.com; intel-gfx@lists.freedesktop.org;
> jani.nik...@linux.intel.com; Vetter, Daniel <daniel.vet...@intel.com>;
> ti...@suse.de
> Subject: Re: [PATCH v3 1/3] drm/i915: set proper N/M in modeset
> 
> On Fri, Aug 05, 2016 at 08:55:27AM +, Yang, Libin wrote:
> >
> > > -Original Message-
> > > From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> > > Sent: Friday, August 5, 2016 4:45 PM
> > > To: Yang, Libin <libin.y...@intel.com>
> > > Cc: libin.y...@linux.intel.com; intel-gfx@lists.freedesktop.org;
> > > jani.nik...@linux.intel.com; Vetter, Daniel
> > > <daniel.vet...@intel.com>; ti...@suse.de
> > > Subject: Re: [PATCH v3 1/3] drm/i915: set proper N/M in modeset
> > >
> > > On Fri, Aug 05, 2016 at 07:24:14AM +, Yang, Libin wrote:
> > > >
> > > > > -Original Message-
> > > > > From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> > > > > Sent: Friday, August 5, 2016 3:17 PM
> > > > > To: Yang, Libin <libin.y...@intel.com>
> > > > > Cc: libin.y...@linux.intel.com; intel-gfx@lists.freedesktop.org;
> > > > > jani.nik...@linux.intel.com; Vetter, Daniel
> > > > > <daniel.vet...@intel.com>; ti...@suse.de
> > > > > Subject: Re: [PATCH v3 1/3] drm/i915: set proper N/M in modeset
> > > > >
> > > > > > > > > > > > +   m = audio_config_get_m(intel_crtc, 
> > > > > > > > > > > > rate);
> > > > > > > > > > > > +   if (m != 0) {
> > > > > > > > > > > > +   tmp =
> > > > > > > I915_READ(HSW_AUD_M_CTS_ENABLE(pipe));
> > > > > > > > > > > > +   tmp =
> > > audio_config_setup_m_reg(intel_crtc,
> > > > > > > m, tmp);
> > > > > > > > > > > > +
> > >   I915_WRITE(HSW_AUD_M_CTS_ENABLE(pipe),
> > > > > > > tmp);
> > > > > > > > > > >
> > > > > > > > > > > We should program this register even for HDMI, so
> > > > > > > > > > > that we don't leak invalid register values eg. when
> > > > > > > > > > > changing from DP-
> > > >HDMI.
> > > > > > > > > >
> > > > > > > > > > HDMI doesn't need set these values based on our test.
> > > > > > > > > > It seems silicon can handle smoothly for HDMI.
> > > > > > > > >
> > > > > > > > > Yes, but we nee to make sure we clear whatever we
> > > > > > > > > programmed in for DP previously.
> > > > > > > >
> > > > > > > > The silicon seems to be able to handle the situation of DP
> > > > > > > > ->
> > > HDMI > > > > > and HDMI -> DP.
> > > > > > >
> > > > > > > Did you make sure eg. that the power well didn't get toggled
> > > > > > > in
> > > between?
> > > > > > > That would reset the register anyway.
> > > > > >
> > > > > > We have done the test for this case. So far it is OK.
> > > > >
> > > > > Test what? Checking that the register gets reset w/o any power
> > > > > well toggling and the like? So what event does reset that register?
> > > >
> > > > The register is used to set m/cts, which will impacts the audio
> > > > clock sync. We didn't check the register reset or not. But the
> > > > HDMI audio and DP will both works smoothly. And for your
> > > > consideration, it is for HDMI. Let's make another patch for this
> > > > issue if we really met the issue that hdmi can't sync the clock. What do
> you think?
> > >
> > > How about we just always write the register to make sure we won't
> > > get any stupid bugs because of this.
> >
> > OK. Do you think it is OK I will write a separate patch for it, not
> > included in the patch series?
> >
> > This is for HDMI N/CTS setting and this needs a lot of  test on HDMI 
> > platforms.
> 
> I don't mean you should write the CTS value there, that would change the
> behaviour. Just make sure the manual programming bit is cleared etc. like it
> was before this DP patch. Ie. probably just overwrite the register with 0, or
> something.

Get it. I was thinking you are saying setting the CTS.

Regards,
Libin

> 
> --
> Ville Syrjälä
> Intel OTC
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v3 1/3] drm/i915: set proper N/M in modeset

2016-08-05 Thread Yang, Libin

> -Original Message-
> From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> Sent: Friday, August 5, 2016 4:45 PM
> To: Yang, Libin <libin.y...@intel.com>
> Cc: libin.y...@linux.intel.com; intel-gfx@lists.freedesktop.org;
> jani.nik...@linux.intel.com; Vetter, Daniel <daniel.vet...@intel.com>;
> ti...@suse.de
> Subject: Re: [PATCH v3 1/3] drm/i915: set proper N/M in modeset
> 
> On Fri, Aug 05, 2016 at 07:24:14AM +, Yang, Libin wrote:
> >
> > > -Original Message-
> > > From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> > > Sent: Friday, August 5, 2016 3:17 PM
> > > To: Yang, Libin <libin.y...@intel.com>
> > > Cc: libin.y...@linux.intel.com; intel-gfx@lists.freedesktop.org;
> > > jani.nik...@linux.intel.com; Vetter, Daniel
> > > <daniel.vet...@intel.com>; ti...@suse.de
> > > Subject: Re: [PATCH v3 1/3] drm/i915: set proper N/M in modeset
> > >
> > > > > > > > > > +   m = audio_config_get_m(intel_crtc, rate);
> > > > > > > > > > +   if (m != 0) {
> > > > > > > > > > +   tmp =
> > > > > I915_READ(HSW_AUD_M_CTS_ENABLE(pipe));
> > > > > > > > > > +   tmp =
> audio_config_setup_m_reg(intel_crtc,
> > > > > m, tmp);
> > > > > > > > > > +
>   I915_WRITE(HSW_AUD_M_CTS_ENABLE(pipe),
> > > > > tmp);
> > > > > > > > >
> > > > > > > > > We should program this register even for HDMI, so that
> > > > > > > > > we don't leak invalid register values eg. when changing from 
> > > > > > > > > DP-
> >HDMI.
> > > > > > > >
> > > > > > > > HDMI doesn't need set these values based on our test. It
> > > > > > > > seems silicon can handle smoothly for HDMI.
> > > > > > >
> > > > > > > Yes, but we nee to make sure we clear whatever we programmed
> > > > > > > in for DP previously.
> > > > > >
> > > > > > The silicon seems to be able to handle the situation of DP ->
> HDMI > > > > > and HDMI -> DP.
> > > > >
> > > > > Did you make sure eg. that the power well didn't get toggled in
> between?
> > > > > That would reset the register anyway.
> > > >
> > > > We have done the test for this case. So far it is OK.
> > >
> > > Test what? Checking that the register gets reset w/o any power well
> > > toggling and the like? So what event does reset that register?
> >
> > The register is used to set m/cts, which will impacts the audio clock
> > sync. We didn't check the register reset or not. But the HDMI audio
> > and DP will both works smoothly. And for your consideration, it is for
> > HDMI. Let's make another patch for this issue if we really met the
> > issue that hdmi can't sync the clock. What do you think?
> 
> How about we just always write the register to make sure we won't get any
> stupid bugs because of this.

OK. Do you think it is OK I will write a separate patch for it, not included
in the patch series?

This is for HDMI N/CTS setting and this needs a lot of  test on HDMI platforms.

Regards,
Libin

> 
> >
> > >
> > > >
> > > > Regards,
> > > > Libin
> > > >
> > > > >
> > > > > > What's more it can handle sample rate/tmds changes.
> > > > > >
> > > > > > Regards,
> > > > > > Libin
> > > > > >
> > > > > > >
> > > > > > > >
> > > > > > > > >
> > > > > > > > > > +   }
> > > > > > > > > > +   }
> > > > > > > > > > +
> > > > > > > > > > mutex_unlock(_priv->av_mutex);
> > > > > > > > > >  }
> > > > > > > > > >
> > > > > > > > > > @@ -637,7 +728,7 @@ static int
> > > > > > > > > i915_audio_component_sync_audio_rate(struct device *dev,
> > > > > > > > > > struct drm_display_mode *mode;
> > > > > > > > > > struct i915_audio_component *acomp = dev_priv-
> > > > > >audio_component;
> > > &

Re: [Intel-gfx] [PATCH v3 1/3] drm/i915: set proper N/M in modeset

2016-08-05 Thread Yang, Libin

> -Original Message-
> From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> Sent: Friday, August 5, 2016 3:17 PM
> To: Yang, Libin <libin.y...@intel.com>
> Cc: libin.y...@linux.intel.com; intel-gfx@lists.freedesktop.org;
> jani.nik...@linux.intel.com; Vetter, Daniel <daniel.vet...@intel.com>;
> ti...@suse.de
> Subject: Re: [PATCH v3 1/3] drm/i915: set proper N/M in modeset
> 
> On Fri, Aug 05, 2016 at 06:40:45AM +, Yang, Libin wrote:
> >
> >
> > > -Original Message-
> > > From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> > > Sent: Friday, August 5, 2016 2:36 PM
> > > To: Yang, Libin <libin.y...@intel.com>
> > > Cc: libin.y...@linux.intel.com; intel-gfx@lists.freedesktop.org;
> > > jani.nik...@linux.intel.com; Vetter, Daniel
> > > <daniel.vet...@intel.com>; ti...@suse.de
> > > Subject: Re: [PATCH v3 1/3] drm/i915: set proper N/M in modeset
> > >
> > > On Fri, Aug 05, 2016 at 06:16:59AM +, Yang, Libin wrote:
> > > > Hi Ville,
> > > >
> > > > > -Original Message-
> > > > > From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> > > > > Sent: Friday, August 5, 2016 1:57 PM
> > > > > To: Yang, Libin <libin.y...@intel.com>
> > > > > Cc: libin.y...@linux.intel.com; intel-gfx@lists.freedesktop.org;
> > > > > jani.nik...@linux.intel.com; Vetter, Daniel
> > > > > <daniel.vet...@intel.com>; ti...@suse.de
> > > > > Subject: Re: [PATCH v3 1/3] drm/i915: set proper N/M in modeset
> > > > >
> > > > > On Fri, Aug 05, 2016 at 05:39:19AM +, Yang, Libin wrote:
> > > > > > Hi Ville,
> > > > > >
> > > > > > Sorry for delay reply. Please see my comments below.
> > > > > >
> > > > > > > -Original Message-
> > > > > > > From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> > > > > > > Sent: Thursday, August 4, 2016 4:53 PM
> > > > > > > To: libin.y...@linux.intel.com
> > > > > > > Cc: intel-gfx@lists.freedesktop.org;
> > > > > > > jani.nik...@linux.intel.com; Vetter, Daniel
> > > > > > > <daniel.vet...@intel.com>; ti...@suse.de; Yang, Libin
> > > > > > > <libin.y...@intel.com>
> > > > > > > Subject: Re: [PATCH v3 1/3] drm/i915: set proper N/M in
> > > > > > > modeset
> > > > > > >
> > > > > > > On Thu, Aug 04, 2016 at 03:58:02PM +0800,
> > > > > > > libin.y...@linux.intel.com
> > > > > wrote:
> > > > > > > > From: Libin Yang <libin.y...@linux.intel.com>
> > > > > > > >
> > > > > > > > When modeset occurs and the LS_CLK is set to some special
> > > > > > > > values in DP mode, the N/M need to be set manually if
> > > > > > > > audio is
> > > playing.
> > > > > > > > Otherwise the first several seconds may be silent in audio
> playback.
> > > > > > > >
> > > > > > > > The relationship of Maud and Naud is expressed in the
> > > > > > > > following
> > > > > > > > equation:
> > > > > > > > Maud/Naud = 512 * fs / f_LS_Clk
> > > > > > > >
> > > > > > > > Please refer VESA DisplayPort Standard spec for details.
> > > > > > >
> > > > > > > Pleas include a small changelog here so that I know what has
> > > > > > > changed with each revision of the patch. Eg:
> > > > > > >
> > > > > > > v2: blah
> > > > > > > v3: whatever
> > > > > > >
> > > > > > > >
> > > > > > > > Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> > > > > > > > ---
> > > > > > > >  drivers/gpu/drm/i915/i915_reg.h|   6 ++
> > > > > > > >  drivers/gpu/drm/i915/intel_audio.c | 133
> > > > > > > > -
> > > > > > > >  2 files changed, 123 insertions(+), 16 deletions(-)
> > > > > > > >
> > > > > > > > diff --git a/drivers/gpu/drm/i915/i915_reg.h
> > > >

Re: [Intel-gfx] [PATCH] drm/i915/dp: DP audio API changes for MST

2016-08-05 Thread Yang, Libin


> -Original Message-
> From: Pandiyan, Dhinakaran
> Sent: Friday, August 5, 2016 2:42 PM
> To: Yang, Libin <libin.y...@intel.com>
> Cc: intel-gfx@lists.freedesktop.org; ti...@suse.de; alsa-devel@alsa-
> project.org; libin.y...@linux.intel.com
> Subject: Re: [Intel-gfx] [PATCH] drm/i915/dp: DP audio API changes for MST
> 
> On Fri, 2016-08-05 at 06:21 +, Yang, Libin wrote:
> > > -Original Message-
> > > From: Pandiyan, Dhinakaran
> > > Sent: Friday, August 5, 2016 1:57 PM
> > > To: Yang, Libin <libin.y...@intel.com>
> > > Cc: intel-gfx@lists.freedesktop.org; ti...@suse.de; alsa-devel@alsa-
> > > project.org; libin.y...@linux.intel.com
> > > Subject: Re: [Intel-gfx] [PATCH] drm/i915/dp: DP audio API changes
> > > for MST
> > >
> > > On Fri, 2016-08-05 at 02:35 +, Yang, Libin wrote:
> > > > > -Original Message-
> > > > > From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org]
> > > > > On Behalf Of Dhinakaran Pandiyan
> > > > > Sent: Wednesday, August 3, 2016 10:15 AM
> > > > > To: intel-gfx@lists.freedesktop.org
> > > > > Cc: alsa-de...@alsa-project.org; ti...@suse.de;
> > > > > libin.y...@linux.intel.com; Pandiyan, Dhinakaran
> > > > > <dhinakaran.pandi...@intel.com>
> > > > > Subject: [Intel-gfx] [PATCH] drm/i915/dp: DP audio API changes
> > > > > for MST
> > > > >
> > > > > DP MST provides the capability to send multiple video and audio
> > > > > streams via one single port. This requires the API's between
> > > > > i915 and audio drivers to distinguish between audio capable
> > > > > displays connected to a port. This patch adds this support via
> > > > > an additional parameter 'int dev_id'. The existing parameter
> > > > > 'port' does not change it's
> > > meaning.
> > > > >
> > > > > dev_id =
> > > > >   MST : pipe that the stream originates from
> > > > >   Non-MST : -1
> > > > >
> > > > > Affected APIs:
> > > > > struct i915_audio_component_ops
> > > > > -   int (*sync_audio_rate)(struct device *, int port, int rate);
> > > > > + int (*sync_audio_rate)(struct device *, int port, int dev_id,
> > > > > +  int rate);
> > > > >
> > > > > -   int (*get_eld)(struct device *, int port, bool *enabled,
> > > > > -   unsigned char *buf, int max_bytes);
> > > > > +   int (*get_eld)(struct device *, int port, int dev_id,
> > > > > +bool *enabled, unsigned char *buf, int 
> > > > > max_bytes);
> > > > >
> > > > > struct i915_audio_component_audio_ops
> > > > > -   void (*pin_eld_notify)(void *audio_ptr, int port);
> > > > > +   void (*pin_eld_notify)(void *audio_ptr, int port, int
> > > > > + dev_id);
> > > > >
> > > > > This patch makes dummy changes in the audio drivers for build to
> succeed.
> > > > >
> > > > > Signed-off-by: Dhinakaran Pandiyan
> > > > > <dhinakaran.pandi...@intel.com>
> > > > > ---
> > > > >  drivers/gpu/drm/i915/i915_drv.h|  2 +-
> > > > >  drivers/gpu/drm/i915/intel_audio.c | 82
> > > > > +--
> > > > > ---
> > > > >  include/drm/i915_component.h   |  6 +--
> > > > >  include/sound/hda_i915.h   | 11 ++---
> > > > >  sound/hda/hdac_i915.c  |  9 +++--
> > > > >  sound/pci/hda/patch_hdmi.c |  7 ++--
> > > > >  6 files changed, 82 insertions(+), 35 deletions(-)
> > > > >
> > > > > diff --git a/drivers/gpu/drm/i915/i915_drv.h
> > > > > b/drivers/gpu/drm/i915/i915_drv.h index 65ada5d..8e4c8c8 100644
> > > > > --- a/drivers/gpu/drm/i915/i915_drv.h
> > > > > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > > > > @@ -2054,7 +2054,7 @@ struct drm_i915_private {
> > > > >   /* perform PHY state sanity checks? */
> > > > >   bool chv_phy_assert[2];
> > > > >
> > > > > - struct intel_encoder *dig_port_map[I915_MAX_PORTS];
> > > > > + struct intel_encoder *av_enc_map[I915_MAX_PIPES];
> > > >
>

Re: [Intel-gfx] [PATCH v3 1/3] drm/i915: set proper N/M in modeset

2016-08-05 Thread Yang, Libin


> -Original Message-
> From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> Sent: Friday, August 5, 2016 2:36 PM
> To: Yang, Libin <libin.y...@intel.com>
> Cc: libin.y...@linux.intel.com; intel-gfx@lists.freedesktop.org;
> jani.nik...@linux.intel.com; Vetter, Daniel <daniel.vet...@intel.com>;
> ti...@suse.de
> Subject: Re: [PATCH v3 1/3] drm/i915: set proper N/M in modeset
> 
> On Fri, Aug 05, 2016 at 06:16:59AM +, Yang, Libin wrote:
> > Hi Ville,
> >
> > > -Original Message-
> > > From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> > > Sent: Friday, August 5, 2016 1:57 PM
> > > To: Yang, Libin <libin.y...@intel.com>
> > > Cc: libin.y...@linux.intel.com; intel-gfx@lists.freedesktop.org;
> > > jani.nik...@linux.intel.com; Vetter, Daniel
> > > <daniel.vet...@intel.com>; ti...@suse.de
> > > Subject: Re: [PATCH v3 1/3] drm/i915: set proper N/M in modeset
> > >
> > > On Fri, Aug 05, 2016 at 05:39:19AM +, Yang, Libin wrote:
> > > > Hi Ville,
> > > >
> > > > Sorry for delay reply. Please see my comments below.
> > > >
> > > > > -Original Message-
> > > > > From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> > > > > Sent: Thursday, August 4, 2016 4:53 PM
> > > > > To: libin.y...@linux.intel.com
> > > > > Cc: intel-gfx@lists.freedesktop.org;
> > > > > jani.nik...@linux.intel.com; Vetter, Daniel
> > > > > <daniel.vet...@intel.com>; ti...@suse.de; Yang, Libin
> > > > > <libin.y...@intel.com>
> > > > > Subject: Re: [PATCH v3 1/3] drm/i915: set proper N/M in modeset
> > > > >
> > > > > On Thu, Aug 04, 2016 at 03:58:02PM +0800,
> > > > > libin.y...@linux.intel.com
> > > wrote:
> > > > > > From: Libin Yang <libin.y...@linux.intel.com>
> > > > > >
> > > > > > When modeset occurs and the LS_CLK is set to some special
> > > > > > values in DP mode, the N/M need to be set manually if audio is
> playing.
> > > > > > Otherwise the first several seconds may be silent in audio playback.
> > > > > >
> > > > > > The relationship of Maud and Naud is expressed in the
> > > > > > following
> > > > > > equation:
> > > > > > Maud/Naud = 512 * fs / f_LS_Clk
> > > > > >
> > > > > > Please refer VESA DisplayPort Standard spec for details.
> > > > >
> > > > > Pleas include a small changelog here so that I know what has
> > > > > changed with each revision of the patch. Eg:
> > > > >
> > > > > v2: blah
> > > > > v3: whatever
> > > > >
> > > > > >
> > > > > > Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> > > > > > ---
> > > > > >  drivers/gpu/drm/i915/i915_reg.h|   6 ++
> > > > > >  drivers/gpu/drm/i915/intel_audio.c | 133
> > > > > > -
> > > > > >  2 files changed, 123 insertions(+), 16 deletions(-)
> > > > > >
> > > > > > diff --git a/drivers/gpu/drm/i915/i915_reg.h
> > > > > > b/drivers/gpu/drm/i915/i915_reg.h index 8bfde75..2f9d00e
> > > > > > 100644
> > > > > > --- a/drivers/gpu/drm/i915/i915_reg.h
> > > > > > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > > > > > @@ -7351,6 +7351,12 @@ enum {
> > > > > >  #define _HSW_AUD_CONFIG_B  0x65100
> > > > > >  #define HSW_AUD_CFG(pipe)  _MMIO_PIPE(pipe,
> > > > > _HSW_AUD_CONFIG_A, _HSW_AUD_CONFIG_B)
> > > > > >
> > > > > > +#define _HSW_AUD_M_CTS_ENABLE_A0x65028
> > > > > > +#define _HSW_AUD_M_CTS_ENABLE_B0x65128
> > > > > > +#define HSW_AUD_M_CTS_ENABLE(pipe)
> > >   _MMIO_PIPE(pipe,
> > > > > _HSW_AUD_M_CTS_ENABLE_A, _HSW_AUD_M_CTS_ENABLE_B)
> > > > > > +#define   AUD_M_CTS_M_VALUE_INDEX  (1 << 21)
> > > > > > +#define   AUD_M_CTS_M_PROG_ENABLE  (1 << 20)
> > > > >
> > > > > Please try to keep the register defines in order by the register 
> > > > > offset.
> > > > > Ie. these registers should be placed just afte

Re: [Intel-gfx] [PATCH] drm/i915/dp: DP audio API changes for MST

2016-08-05 Thread Yang, Libin

> -Original Message-
> From: Pandiyan, Dhinakaran
> Sent: Friday, August 5, 2016 1:57 PM
> To: Yang, Libin <libin.y...@intel.com>
> Cc: intel-gfx@lists.freedesktop.org; ti...@suse.de; alsa-devel@alsa-
> project.org; libin.y...@linux.intel.com
> Subject: Re: [Intel-gfx] [PATCH] drm/i915/dp: DP audio API changes for MST
> 
> On Fri, 2016-08-05 at 02:35 +, Yang, Libin wrote:
> > > -Original Message-
> > > From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org] On
> > > Behalf Of Dhinakaran Pandiyan
> > > Sent: Wednesday, August 3, 2016 10:15 AM
> > > To: intel-gfx@lists.freedesktop.org
> > > Cc: alsa-de...@alsa-project.org; ti...@suse.de;
> > > libin.y...@linux.intel.com; Pandiyan, Dhinakaran
> > > <dhinakaran.pandi...@intel.com>
> > > Subject: [Intel-gfx] [PATCH] drm/i915/dp: DP audio API changes for
> > > MST
> > >
> > > DP MST provides the capability to send multiple video and audio
> > > streams via one single port. This requires the API's between i915
> > > and audio drivers to distinguish between audio capable displays
> > > connected to a port. This patch adds this support via an additional
> > > parameter 'int dev_id'. The existing parameter 'port' does not change it's
> meaning.
> > >
> > > dev_id =
> > >   MST : pipe that the stream originates from
> > >   Non-MST : -1
> > >
> > > Affected APIs:
> > > struct i915_audio_component_ops
> > > -   int (*sync_audio_rate)(struct device *, int port, int rate);
> > > + int (*sync_audio_rate)(struct device *, int port, int dev_id,
> > > +  int rate);
> > >
> > > -   int (*get_eld)(struct device *, int port, bool *enabled,
> > > -   unsigned char *buf, int max_bytes);
> > > +   int (*get_eld)(struct device *, int port, int dev_id,
> > > +bool *enabled, unsigned char *buf, int max_bytes);
> > >
> > > struct i915_audio_component_audio_ops
> > > -   void (*pin_eld_notify)(void *audio_ptr, int port);
> > > +   void (*pin_eld_notify)(void *audio_ptr, int port, int
> > > + dev_id);
> > >
> > > This patch makes dummy changes in the audio drivers for build to succeed.
> > >
> > > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandi...@intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/i915_drv.h|  2 +-
> > >  drivers/gpu/drm/i915/intel_audio.c | 82
> > > +--
> > > ---
> > >  include/drm/i915_component.h   |  6 +--
> > >  include/sound/hda_i915.h   | 11 ++---
> > >  sound/hda/hdac_i915.c  |  9 +++--
> > >  sound/pci/hda/patch_hdmi.c |  7 ++--
> > >  6 files changed, 82 insertions(+), 35 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/i915/i915_drv.h
> > > b/drivers/gpu/drm/i915/i915_drv.h index 65ada5d..8e4c8c8 100644
> > > --- a/drivers/gpu/drm/i915/i915_drv.h
> > > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > > @@ -2054,7 +2054,7 @@ struct drm_i915_private {
> > >   /* perform PHY state sanity checks? */
> > >   bool chv_phy_assert[2];
> > >
> > > - struct intel_encoder *dig_port_map[I915_MAX_PORTS];
> > > + struct intel_encoder *av_enc_map[I915_MAX_PIPES];
> >
> > We may still need save the port number info.
> > In non-MST mode, device entry means nothing. This means
> > av_enc_map[pipe] may not get the right intel_encoder
> >
> > Regards,
> > Libin
> >
> We find the encoder using port in get_saved_encoder()

It seems it still can't get the encoder for SST/HDMI as
pipe may always be -1 or 0 for SST/HDMI?

Regards,
Libin

> > >
> > >   /*
> > >* NOTE: This is the dri1/ums dungeon, don't add stuff here. Your
> > > patch diff --git a/drivers/gpu/drm/i915/intel_audio.c
> > > b/drivers/gpu/drm/i915/intel_audio.c
> > > index 8c493de..cbe44c8 100644
> > > --- a/drivers/gpu/drm/i915/intel_audio.c
> > > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > > @@ -500,6 +500,9 @@ void intel_audio_codec_enable(struct
> > > intel_encoder
> > > *intel_encoder)
> > >   struct i915_audio_component *acomp = dev_priv->audio_component;
> > >   struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
> > >   enum port port = intel_dig_port->port;
> > > + enum pipe pipe = crtc->pipe;
> > > + int dev_id = -1;
> > >

Re: [Intel-gfx] [PATCH v3 1/3] drm/i915: set proper N/M in modeset

2016-08-05 Thread Yang, Libin
Hi Ville,

> -Original Message-
> From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> Sent: Friday, August 5, 2016 1:57 PM
> To: Yang, Libin <libin.y...@intel.com>
> Cc: libin.y...@linux.intel.com; intel-gfx@lists.freedesktop.org;
> jani.nik...@linux.intel.com; Vetter, Daniel <daniel.vet...@intel.com>;
> ti...@suse.de
> Subject: Re: [PATCH v3 1/3] drm/i915: set proper N/M in modeset
> 
> On Fri, Aug 05, 2016 at 05:39:19AM +, Yang, Libin wrote:
> > Hi Ville,
> >
> > Sorry for delay reply. Please see my comments below.
> >
> > > -Original Message-
> > > From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> > > Sent: Thursday, August 4, 2016 4:53 PM
> > > To: libin.y...@linux.intel.com
> > > Cc: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com;
> > > Vetter, Daniel <daniel.vet...@intel.com>; ti...@suse.de; Yang, Libin
> > > <libin.y...@intel.com>
> > > Subject: Re: [PATCH v3 1/3] drm/i915: set proper N/M in modeset
> > >
> > > On Thu, Aug 04, 2016 at 03:58:02PM +0800, libin.y...@linux.intel.com
> wrote:
> > > > From: Libin Yang <libin.y...@linux.intel.com>
> > > >
> > > > When modeset occurs and the LS_CLK is set to some special values
> > > > in DP mode, the N/M need to be set manually if audio is playing.
> > > > Otherwise the first several seconds may be silent in audio playback.
> > > >
> > > > The relationship of Maud and Naud is expressed in the following
> > > > equation:
> > > > Maud/Naud = 512 * fs / f_LS_Clk
> > > >
> > > > Please refer VESA DisplayPort Standard spec for details.
> > >
> > > Pleas include a small changelog here so that I know what has changed
> > > with each revision of the patch. Eg:
> > >
> > > v2: blah
> > > v3: whatever
> > >
> > > >
> > > > Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> > > > ---
> > > >  drivers/gpu/drm/i915/i915_reg.h|   6 ++
> > > >  drivers/gpu/drm/i915/intel_audio.c | 133
> > > > -
> > > >  2 files changed, 123 insertions(+), 16 deletions(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/i915/i915_reg.h
> > > > b/drivers/gpu/drm/i915/i915_reg.h index 8bfde75..2f9d00e 100644
> > > > --- a/drivers/gpu/drm/i915/i915_reg.h
> > > > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > > > @@ -7351,6 +7351,12 @@ enum {
> > > >  #define _HSW_AUD_CONFIG_B  0x65100
> > > >  #define HSW_AUD_CFG(pipe)  _MMIO_PIPE(pipe,
> > > _HSW_AUD_CONFIG_A, _HSW_AUD_CONFIG_B)
> > > >
> > > > +#define _HSW_AUD_M_CTS_ENABLE_A0x65028
> > > > +#define _HSW_AUD_M_CTS_ENABLE_B0x65128
> > > > +#define HSW_AUD_M_CTS_ENABLE(pipe)
>   _MMIO_PIPE(pipe,
> > > _HSW_AUD_M_CTS_ENABLE_A, _HSW_AUD_M_CTS_ENABLE_B)
> > > > +#define   AUD_M_CTS_M_VALUE_INDEX  (1 << 21)
> > > > +#define   AUD_M_CTS_M_PROG_ENABLE  (1 << 20)
> > >
> > > Please try to keep the register defines in order by the register offset.
> > > Ie. these registers should be placed just after HSW_AUD_MISC_CTRL.
> > >
> > > > +
> > > >  #define _HSW_AUD_MISC_CTRL_A   0x65010
> > > >  #define _HSW_AUD_MISC_CTRL_B   0x65110
> > > >  #define HSW_AUD_MISC_CTRL(pipe)_MMIO_PIPE(pipe,
> > > _HSW_AUD_MISC_CTRL_A, _HSW_AUD_MISC_CTRL_B)
> > > > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> > > > b/drivers/gpu/drm/i915/intel_audio.c
> > > > index 6700a7b..04e7358 100644
> > > > --- a/drivers/gpu/drm/i915/intel_audio.c
> > > > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > > > @@ -98,6 +98,35 @@ static const struct {
> > > > { 192000, TMDS_297M, 20480, 247500 },  };
> > > >
> > > > +#define LC_540M 54
> > > > +#define LC_270M 27
> > > > +#define LC_162M 162000
> > > > +static const struct {
> > > > +   int sample_rate;
> > > > +   int clock;
> > > > +   u16 n;
> > > > +   u16 m;
> > > > +} aud_nm[] = {
> > > > +   {192000, LC_540M, 5625, 1024},
> > >  ^  ^
> > >
> > > Style nit: please add spaces here
> > &

Re: [Intel-gfx] [PATCH v3 2/3] drm/i915: set proper N/MCTS on more platforms

2016-08-04 Thread Yang, Libin

> -Original Message-
> From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> Sent: Thursday, August 4, 2016 4:54 PM
> To: libin.y...@linux.intel.com
> Cc: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com; Vetter, 
> Daniel
> <daniel.vet...@intel.com>; ti...@suse.de; Yang, Libin <libin.y...@intel.com>
> Subject: Re: [PATCH v3 2/3] drm/i915: set proper N/MCTS on more platforms
> 
> On Thu, Aug 04, 2016 at 03:58:03PM +0800, libin.y...@linux.intel.com wrote:
> > From: Libin Yang <libin.y...@linux.intel.com>
> >
> > This patch applies setting proper N/M, N/CTS on more platforms.
> >
> > Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> 
> Reviewed-by: Ville Syrjälä <ville.syrj...@linux.intel.com>
> 
> Not that I particularly like this special casing of platforms. We should 
> really try
> to unify this across the board, and I thought we already agreed that that was
> going to happen?

Yes, and based on the spec, even it is not supporting 4K resolution,
the n/mcts should also be OK. It is for clock, not for resolution.
So I agree to apply the patches to other platforms.

Regards,
Libin

> 
> > ---
> >  drivers/gpu/drm/i915/intel_audio.c | 6 +-
> >  1 file changed, 1 insertion(+), 5 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> > b/drivers/gpu/drm/i915/intel_audio.c
> > index 04e7358..7aa0203 100644
> > --- a/drivers/gpu/drm/i915/intel_audio.c
> > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > @@ -732,11 +732,7 @@ static int
> i915_audio_component_sync_audio_rate(struct device *dev,
> > int n;
> > int err = 0;
> >
> > -   /* HSW, BDW, SKL, KBL need this fix */
> > -   if (!IS_SKYLAKE(dev_priv) &&
> > -   !IS_KABYLAKE(dev_priv) &&
> > -   !IS_BROADWELL(dev_priv) &&
> > -   !IS_HASWELL(dev_priv))
> > +   if (!HAS_DDI(dev_priv))
> > return 0;
> >
> > mutex_lock(_priv->av_mutex);
> > --
> > 1.9.1
> 
> --
> Ville Syrjälä
> Intel OTC
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v3 1/3] drm/i915: set proper N/M in modeset

2016-08-04 Thread Yang, Libin
Hi Ville,

Sorry for delay reply. Please see my comments below.

> -Original Message-
> From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> Sent: Thursday, August 4, 2016 4:53 PM
> To: libin.y...@linux.intel.com
> Cc: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com; Vetter, 
> Daniel
> <daniel.vet...@intel.com>; ti...@suse.de; Yang, Libin <libin.y...@intel.com>
> Subject: Re: [PATCH v3 1/3] drm/i915: set proper N/M in modeset
> 
> On Thu, Aug 04, 2016 at 03:58:02PM +0800, libin.y...@linux.intel.com wrote:
> > From: Libin Yang <libin.y...@linux.intel.com>
> >
> > When modeset occurs and the LS_CLK is set to some special values in DP
> > mode, the N/M need to be set manually if audio is playing. Otherwise
> > the first several seconds may be silent in audio playback.
> >
> > The relationship of Maud and Naud is expressed in the following
> > equation:
> > Maud/Naud = 512 * fs / f_LS_Clk
> >
> > Please refer VESA DisplayPort Standard spec for details.
> 
> Pleas include a small changelog here so that I know what has changed with
> each revision of the patch. Eg:
> 
> v2: blah
> v3: whatever
> 
> >
> > Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_reg.h|   6 ++
> >  drivers/gpu/drm/i915/intel_audio.c | 133
> > -
> >  2 files changed, 123 insertions(+), 16 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_reg.h
> > b/drivers/gpu/drm/i915/i915_reg.h index 8bfde75..2f9d00e 100644
> > --- a/drivers/gpu/drm/i915/i915_reg.h
> > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > @@ -7351,6 +7351,12 @@ enum {
> >  #define _HSW_AUD_CONFIG_B  0x65100
> >  #define HSW_AUD_CFG(pipe)  _MMIO_PIPE(pipe,
> _HSW_AUD_CONFIG_A, _HSW_AUD_CONFIG_B)
> >
> > +#define _HSW_AUD_M_CTS_ENABLE_A0x65028
> > +#define _HSW_AUD_M_CTS_ENABLE_B0x65128
> > +#define HSW_AUD_M_CTS_ENABLE(pipe) _MMIO_PIPE(pipe,
> _HSW_AUD_M_CTS_ENABLE_A, _HSW_AUD_M_CTS_ENABLE_B)
> > +#define   AUD_M_CTS_M_VALUE_INDEX  (1 << 21)
> > +#define   AUD_M_CTS_M_PROG_ENABLE  (1 << 20)
> 
> Please try to keep the register defines in order by the register offset.
> Ie. these registers should be placed just after HSW_AUD_MISC_CTRL.
> 
> > +
> >  #define _HSW_AUD_MISC_CTRL_A   0x65010
> >  #define _HSW_AUD_MISC_CTRL_B   0x65110
> >  #define HSW_AUD_MISC_CTRL(pipe)_MMIO_PIPE(pipe,
> _HSW_AUD_MISC_CTRL_A, _HSW_AUD_MISC_CTRL_B)
> > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> > b/drivers/gpu/drm/i915/intel_audio.c
> > index 6700a7b..04e7358 100644
> > --- a/drivers/gpu/drm/i915/intel_audio.c
> > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > @@ -98,6 +98,35 @@ static const struct {
> > { 192000, TMDS_297M, 20480, 247500 },  };
> >
> > +#define LC_540M 54
> > +#define LC_270M 27
> > +#define LC_162M 162000
> > +static const struct {
> > +   int sample_rate;
> > +   int clock;
> > +   u16 n;
> > +   u16 m;
> > +} aud_nm[] = {
> > +   {192000, LC_540M, 5625, 1024},
>  ^  ^
> 
> Style nit: please add spaces here
> 
> > +   {96000, LC_540M, 5625, 512},
> > +   {88200, LC_540M, 9375, 784},
> > +   {48000, LC_540M, 5625, 256},
> > +   {44100, LC_540M, 9375, 392},
> > +   {32000, LC_540M, 16875, 512},
> > +   {192000, LC_270M, 5625, 2048},
> > +   {96000, LC_270M, 5625, 1024},
> > +   {88200, LC_270M, 9375, 1568},
> > +   {48000, LC_270M, 5625, 512},
> > +   {44100, LC_270M, 9375, 784},
> > +   {32000, LC_270M, 16875, 1024},
> > +   {192000, LC_162M, 3375, 2048},
> > +   {96000, LC_162M, 3375, 1024},
> > +   {88200, LC_162M, 5625, 1568},
> > +   {48000, LC_162M, 3375, 512},
> > +   {44100, LC_162M, 5625, 784},
> > +   {32000, LC_162M, 10125, 1024},
> 
> The numbers looks good. But looks like you forgot about 176.4 kHz?
> 
> > +};
> > +
> >  /* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */  static u32
> > audio_config_hdmi_pixel_clock(const struct drm_display_mode
> > *adjusted_mode)  { @@ -121,20 +150,50 @@ static u32
> > audio_config_hdmi_pixel_clock(const struct drm_display_mode *adjusted
> > return hdmi_audio_clock[i].config;
> >  }
> >
> > -static int audio_config_get_n(const struct drm_display_mode *mode,
> > int rate)
> > +static int audio_config_get_n(struct intel_crtc *crtc,
> > +  

Re: [Intel-gfx] [PATCH] drm/i915/dp: DP audio API changes for MST

2016-08-04 Thread Yang, Libin

> -Original Message-
> From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org] On Behalf Of
> Dhinakaran Pandiyan
> Sent: Wednesday, August 3, 2016 10:15 AM
> To: intel-gfx@lists.freedesktop.org
> Cc: alsa-de...@alsa-project.org; ti...@suse.de; libin.y...@linux.intel.com;
> Pandiyan, Dhinakaran 
> Subject: [Intel-gfx] [PATCH] drm/i915/dp: DP audio API changes for MST
> 
> DP MST provides the capability to send multiple video and audio streams via
> one single port. This requires the API's between i915 and audio drivers to
> distinguish between audio capable displays connected to a port. This patch
> adds this support via an additional parameter 'int dev_id'. The existing
> parameter 'port' does not change it's meaning.
> 
> dev_id =
>   MST : pipe that the stream originates from
>   Non-MST : -1
> 
> Affected APIs:
> struct i915_audio_component_ops
> -   int (*sync_audio_rate)(struct device *, int port, int rate);
> + int (*sync_audio_rate)(struct device *, int port, int dev_id,
> +  int rate);
> 
> -   int (*get_eld)(struct device *, int port, bool *enabled,
> -   unsigned char *buf, int max_bytes);
> +   int (*get_eld)(struct device *, int port, int dev_id,
> +bool *enabled, unsigned char *buf, int max_bytes);
> 
> struct i915_audio_component_audio_ops
> -   void (*pin_eld_notify)(void *audio_ptr, int port);
> +   void (*pin_eld_notify)(void *audio_ptr, int port, int dev_id);
> 
> This patch makes dummy changes in the audio drivers for build to succeed.
> 
> Signed-off-by: Dhinakaran Pandiyan 
> ---
>  drivers/gpu/drm/i915/i915_drv.h|  2 +-
>  drivers/gpu/drm/i915/intel_audio.c | 82 +--
> ---
>  include/drm/i915_component.h   |  6 +--
>  include/sound/hda_i915.h   | 11 ++---
>  sound/hda/hdac_i915.c  |  9 +++--
>  sound/pci/hda/patch_hdmi.c |  7 ++--
>  6 files changed, 82 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h
> b/drivers/gpu/drm/i915/i915_drv.h index 65ada5d..8e4c8c8 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2054,7 +2054,7 @@ struct drm_i915_private {
>   /* perform PHY state sanity checks? */
>   bool chv_phy_assert[2];
> 
> - struct intel_encoder *dig_port_map[I915_MAX_PORTS];
> + struct intel_encoder *av_enc_map[I915_MAX_PIPES];

We may still need save the port number info.
In non-MST mode, device entry means nothing. This means
av_enc_map[pipe] may not get the right intel_encoder

Regards,
Libin

> 
>   /*
>* NOTE: This is the dri1/ums dungeon, don't add stuff here. Your
> patch diff --git a/drivers/gpu/drm/i915/intel_audio.c
> b/drivers/gpu/drm/i915/intel_audio.c
> index 8c493de..cbe44c8 100644
> --- a/drivers/gpu/drm/i915/intel_audio.c
> +++ b/drivers/gpu/drm/i915/intel_audio.c
> @@ -500,6 +500,9 @@ void intel_audio_codec_enable(struct intel_encoder
> *intel_encoder)
>   struct i915_audio_component *acomp = dev_priv->audio_component;
>   struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
>   enum port port = intel_dig_port->port;
> + enum pipe pipe = crtc->pipe;
> + int dev_id = -1;
> +
> 
>   connector = drm_select_eld(encoder);
>   if (!connector)
> @@ -522,14 +525,19 @@ void intel_audio_codec_enable(struct intel_encoder
> *intel_encoder)
>   dev_priv->display.audio_codec_enable(connector,
> intel_encoder,
>adjusted_mode);
> 
> + if (intel_encoder->type == INTEL_OUTPUT_DP_MST)
> + dev_id = pipe;
> +
>   mutex_lock(_priv->av_mutex);
>   intel_encoder->audio_connector = connector;
> +
>   /* referred in audio callbacks */
> - dev_priv->dig_port_map[port] = intel_encoder;
> + dev_priv->av_enc_map[pipe] = intel_encoder;
>   mutex_unlock(_priv->av_mutex);
> 
>   if (acomp && acomp->audio_ops && acomp->audio_ops-
> >pin_eld_notify)
> - acomp->audio_ops->pin_eld_notify(acomp->audio_ops-
> >audio_ptr, (int) port);
> + acomp->audio_ops->pin_eld_notify(acomp->audio_ops-
> >audio_ptr,
> +  (int) port, dev_id);
>  }
> 
>  /**
> @@ -542,22 +550,29 @@ void intel_audio_codec_enable(struct intel_encoder
> *intel_encoder)  void intel_audio_codec_disable(struct intel_encoder
> *intel_encoder)  {
>   struct drm_encoder *encoder = _encoder->base;
> + struct intel_crtc *crtc = to_intel_crtc(encoder->crtc);
>   struct drm_device *dev = encoder->dev;
>   struct drm_i915_private *dev_priv = to_i915(dev);
>   struct i915_audio_component *acomp = dev_priv->audio_component;
>   struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
>   enum port port = intel_dig_port->port;
> + enum pipe pipe = crtc->pipe;
> 

Re: [Intel-gfx] [PATCH] drm/i915/dp: DP audio API changes for MST

2016-08-04 Thread Yang, Libin

> -Original Message-
> From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org] On Behalf Of
> Ville Syrjälä
> Sent: Friday, August 5, 2016 4:48 AM
> To: Takashi Iwai 
> Cc: libin.y...@linux.intel.com; intel-gfx@lists.freedesktop.org; alsa-
> de...@alsa-project.org; Pandiyan, Dhinakaran
> 
> Subject: Re: [Intel-gfx] [PATCH] drm/i915/dp: DP audio API changes for MST
> 
> On Thu, Aug 04, 2016 at 07:55:09PM +0200, Takashi Iwai wrote:
> > On Thu, 04 Aug 2016 19:35:16 +0200,
> > Ville Syrjälä wrote:
> > >
> > > On Thu, Aug 04, 2016 at 10:18:52AM -0700, Jim Bride wrote:
> > > > On Wed, Aug 03, 2016 at 10:08:12PM +0300, Ville Syrjälä wrote:
> > > > > On Tue, Aug 02, 2016 at 07:14:30PM -0700, Dhinakaran Pandiyan wrote:
> > > > > > DP MST provides the capability to send multiple video and
> > > > > > audio streams via one single port. This requires the API's
> > > > > > between i915 and audio drivers to distinguish between audio
> > > > > > capable displays connected to a port. This patch adds this
> > > > > > support via an additional parameter 'int dev_id'. The existing
> parameter 'port' does not change it's meaning.
> > > > > >
> > > > > > dev_id =
> > > > > > MST : pipe that the stream originates from
> > > > > > Non-MST : -1
> > > > > >
> > > > > > Affected APIs:
> > > > > > struct i915_audio_component_ops
> > > > > > -   int (*sync_audio_rate)(struct device *, int port, int rate);
> > > > > > +   int (*sync_audio_rate)(struct device *, int port, int
> > > > > > +dev_id,
> > > > >
> > > > > Does the term 'dev_id' have some special meaning on the audio
> > > > > side? On the i915 side things would be less confusing if we just
> > > > > called it 'pipe'.
> > > >
> > > > Yeah, it does.  All of the documentation on the audio side is
> > > > written in terms of device ID, so they asked for that nomenclature.
> > >
> > > And is the device ID always the same as the pipe? Until now we've
> > > made due with passing the port instead of the pipe, so either the
> > > audio side didn't use the device ID, or its meaning changes based on
> > > how we drive things, or they dug it out from somewhere else based on the
> port?
> >
> > This is my concern, too.  Currently we have a very wild assumption
> > even for the port mapping.  In the audio side, there is neither port
> > nor pipe.  There are only the widget node id and the device id.  The
> > former is supposedly corresponding to the port, and the latter to the
> > pipe.  But the audio side has absolutely no clue about how these are
> > connected.
> 
> So I tried to study this a bit, and MST and device are mentioned a few
> times in the description of some audio registers in the GPU docs. Looks like a
> bunch of bits overlap somehow with pin vs. device usage. I don't understand
> how that's supposed to work. Eg:

For SST & HDMI, port is mapping to pin.

For MST, in audio, each pin has several device entries. Each device entry
can transfer audio stream. And we confirmed with silicon team,
device entry is related to pipe.

Device entry is always the right concept in audio driver. We are not sure
the relationship will be always right between pipe and device entry.

We are worry that the relationship may be changed in the future between
pipe and device entry. I mean maybe the pipe is not related to device
entry in the new platforms, but some other conception, such as transcoder.
If so, if we are using pipe now, maybe we need change the API again.
For the stability, we are thinking device entry is suitable.

I think your concern is right. It is not good to use audio conception 
in gfx driver, which will cause confusion. If we can confirm that
pipe will always be the fixed mapping to device entry, it will be
better to use pipe.

>  AUD_PWRSTAUD_PWRST
>  1:0   PinB Widget PwrSt Set
>  PinB Widget power state that was setFor DP MST this represents Device1
> power state

For this register, it means different in different scenario:
In DP SST & HDMI, it is for PinB
In DP MST, it is for device entry 1 (on whichever pin). 

> 
> It's anyone's guees what those bits are suppoosed to reflect when you're doing
> MST with device1/pipe A, and at the same time you're driving port B in
> HDMI/SST mode.

I did the similar test before. I remember (but I didn't remember clearly now)
If one pin is used as DP MST, all the pins are used as DP MST. This means if
PinB is used as DP MST, 1:0 represents Device 1 and 5:4 represents Device 2.
Let's say PinC is connected to HDMI audio, it is now looked as Device 2 (or
other device id) not as PinC audio.

Regards,
Libin

> 
> Anyways, it doesn't help that this whole device widget aspect of hda seems to
> be undocumented. No spec I've found seems to know anything about any
> device widgets, and yet those are how MST rolls apparently.
> 
> In conclusion, I'd say that consistency's sake we should use either
> dev+pin or pipe+port in the interface, not mix both. In case of pin I
> 

Re: [Intel-gfx] [PATCH] drm/i915: set proper N/M in modeset

2016-08-04 Thread Yang, Libin
Hi Ville,

> -Original Message-
> From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> Sent: Thursday, August 4, 2016 2:24 PM
> To: Yang, Libin <libin.y...@intel.com>
> Cc: 'libin.y...@linux.intel.com' <libin.y...@linux.intel.com>; 'intel-
> g...@lists.freedesktop.org' <intel-gfx@lists.freedesktop.org>;
> 'jani.nik...@linux.intel.com' <jani.nik...@linux.intel.com>; Vetter, Daniel
> <daniel.vet...@intel.com>; 'ti...@suse.de' <ti...@suse.de>
> Subject: Re: [PATCH] drm/i915: set proper N/M in modeset
> 
> On Thu, Aug 04, 2016 at 06:04:10AM +, Yang, Libin wrote:
> > Hi Ville,
> >
> > > -Original Message-
> > > From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> > > Sent: Thursday, August 4, 2016 1:39 PM
> > > To: Yang, Libin <libin.y...@intel.com>
> > > Cc: 'libin.y...@linux.intel.com' <libin.y...@linux.intel.com>;
> > > 'intel- g...@lists.freedesktop.org'
> > > <intel-gfx@lists.freedesktop.org>;
> > > 'jani.nik...@linux.intel.com' <jani.nik...@linux.intel.com>; Vetter,
> > > Daniel <daniel.vet...@intel.com>; 'ti...@suse.de' <ti...@suse.de>
> > > Subject: Re: [PATCH] drm/i915: set proper N/M in modeset
> > >
> > > On Thu, Aug 04, 2016 at 02:48:54AM +, Yang, Libin wrote:
> > > > Hi Ville,
> > > >
> > > > > -Original Message-
> > > > > From: Yang, Libin
> > > > > Sent: Tuesday, August 2, 2016 9:59 PM
> > > > > To: Ville Syrjälä <ville.syrj...@linux.intel.com>;
> > > > > libin.y...@linux.intel.com
> > > > > Cc: intel-gfx@lists.freedesktop.org;
> > > > > jani.nik...@linux.intel.com; Vetter, Daniel
> > > > > <daniel.vet...@intel.com>; ti...@suse.de
> > > > > Subject: RE: [PATCH] drm/i915: set proper N/M in modeset
> > > > >
> > > > > Hi Ville
> > > > >
> > > > > > -Original Message-
> > > > > > From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> > > > > > Sent: Tuesday, August 2, 2016 6:47 PM
> > > > > > To: libin.y...@linux.intel.com
> > > > > > Cc: intel-gfx@lists.freedesktop.org;
> > > > > > jani.nik...@linux.intel.com; Vetter, Daniel
> > > > > > <daniel.vet...@intel.com>; ti...@suse.de; Yang, Libin
> > > > > > <libin.y...@intel.com>
> > > > > > Subject: Re: [PATCH] drm/i915: set proper N/M in modeset
> > > > > >
> > > > > > On Tue, Aug 02, 2016 at 09:35:10AM +0800,
> > > > > > libin.y...@linux.intel.com
> > > > > wrote:
> > > > > > > From: Libin Yang <libin.y...@linux.intel.com>
> > > > > > >
> > > > > > > When modeset occurs and the LS_CLK is set to some special
> > > > > > > values in DP mode, the N/M need to be set manually if audio is
> playing.
> > > > > > >
> > > > > > > The relationship of Maud and Naud is expressed in the
> > > > > > > following
> > > > > > > equation:
> > > > > > > Maud/Naud = 512 * fs / f_LS_Clk
> > > > > > >
> > > > > > > Please refer VESA DisplayPort Standard spec for details.
> > > > > > >
> > > > > > > Also, the patch applies
> > > > > > > commit 7e8275c2f2bb ("drm/i915: set proper N/CTS in
> > > > > > > modeset") to APL platform.
> > > > > > >
> > > > > > > Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> > > > > > > ---
> > > > > > >  drivers/gpu/drm/i915/i915_reg.h|   6 ++
> > > > > > >  drivers/gpu/drm/i915/intel_audio.c | 122
> > > > > > > +++--
> > > > > > >  2 files changed, 111 insertions(+), 17 deletions(-)
> > > > > > >
> > > > > > > diff --git a/drivers/gpu/drm/i915/i915_reg.h
> > > > > > > b/drivers/gpu/drm/i915/i915_reg.h index 8bfde75..2f9d00e
> > > > > > > 100644
> > > > > > > --- a/drivers/gpu/drm/i915/i915_reg.h
> > > > > > > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > > > > > > @@ -7351,6 +7351,12 @@ enum {
> > > > > > >  #define _HSW_AUD_CONF

Re: [Intel-gfx] [PATCH] drm/i915: set proper N/M in modeset

2016-08-04 Thread Yang, Libin
Hi Ville,

> -Original Message-
> From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> Sent: Thursday, August 4, 2016 2:06 PM
> To: Yang, Libin <libin.y...@intel.com>
> Cc: libin.y...@linux.intel.com; intel-gfx@lists.freedesktop.org;
> jani.nik...@linux.intel.com; Vetter, Daniel <daniel.vet...@intel.com>;
> ti...@suse.de
> Subject: Re: [PATCH] drm/i915: set proper N/M in modeset
> 
> On Thu, Aug 04, 2016 at 05:46:01AM +, Yang, Libin wrote:
> > Hi Ville,
> >
> > > -Original Message-
> > > From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> > > Sent: Wednesday, August 3, 2016 12:59 AM
> > > To: Yang, Libin <libin.y...@intel.com>
> > > Cc: libin.y...@linux.intel.com; intel-gfx@lists.freedesktop.org;
> > > jani.nik...@linux.intel.com; Vetter, Daniel
> > > <daniel.vet...@intel.com>; ti...@suse.de
> > > Subject: Re: [PATCH] drm/i915: set proper N/M in modeset
> > >
> > > On Tue, Aug 02, 2016 at 01:58:51PM +, Yang, Libin wrote:
> > > > Hi Ville
> > > >
> > > > > -Original Message-
> > > > > From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> > > > > Sent: Tuesday, August 2, 2016 6:47 PM
> > > > > To: libin.y...@linux.intel.com
> > > > > Cc: intel-gfx@lists.freedesktop.org;
> > > > > jani.nik...@linux.intel.com; Vetter, Daniel
> > > > > <daniel.vet...@intel.com>; ti...@suse.de; Yang, Libin
> > > > > <libin.y...@intel.com>
> > > > > Subject: Re: [PATCH] drm/i915: set proper N/M in modeset
> > > > >
> > > > > On Tue, Aug 02, 2016 at 09:35:10AM +0800,
> > > > > libin.y...@linux.intel.com
> > > wrote:
> > > > > > From: Libin Yang <libin.y...@linux.intel.com>
> > > > > >
> > > > > > When modeset occurs and the LS_CLK is set to some special
> > > > > > values in DP mode, the N/M need to be set manually if audio is
> playing.
> > > > > >
> > > > > > The relationship of Maud and Naud is expressed in the
> > > > > > following
> > > > > > equation:
> > > > > > Maud/Naud = 512 * fs / f_LS_Clk
> > > > > >
> > > > > > Please refer VESA DisplayPort Standard spec for details.
> > > > > >
> > > > > > Also, the patch applies
> > > > > > commit 7e8275c2f2bb ("drm/i915: set proper N/CTS in modeset")
> > > > > > to APL platform.
> > > > > >
> > > > > > Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> > > > > > ---
> > > > > >  drivers/gpu/drm/i915/i915_reg.h|   6 ++
> > > > > >  drivers/gpu/drm/i915/intel_audio.c | 122
> > > > > > +++--
> > > > > >  2 files changed, 111 insertions(+), 17 deletions(-)
> > > > > >
> > > > > > diff --git a/drivers/gpu/drm/i915/i915_reg.h
> > > > > > b/drivers/gpu/drm/i915/i915_reg.h index 8bfde75..2f9d00e
> > > > > > 100644
> > > > > > --- a/drivers/gpu/drm/i915/i915_reg.h
> > > > > > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > > > > > @@ -7351,6 +7351,12 @@ enum {
> > > > > >  #define _HSW_AUD_CONFIG_B  0x65100
> > > > > >  #define HSW_AUD_CFG(pipe)  _MMIO_PIPE(pipe,
> > > > > _HSW_AUD_CONFIG_A, _HSW_AUD_CONFIG_B)
> > > > > >
> > > > > > +#define _HSW_AUD_M_CTS_ENABLE_A0x65028
> > > > > > +#define _HSW_AUD_M_CTS_ENABLE_B0x65128
> > > > > > +#define HSW_AUD_M_CTS_ENABLE(pipe)
> > >   _MMIO_PIPE(pipe,
> > > > > _HSW_AUD_M_CTS_ENABLE_A, _HSW_AUD_M_CTS_ENABLE_B)
> > > > > > +#define   AUD_M_CTS_M_VALUE_INDEX  (1 << 21)
> > > > > > +#define   AUD_M_CTS_M_PROG_ENABLE  (1 << 20)
> > > > > > +
> > > > > >  #define _HSW_AUD_MISC_CTRL_A   0x65010
> > > > > >  #define _HSW_AUD_MISC_CTRL_B   0x65110
> > > > > >  #define HSW_AUD_MISC_CTRL(pipe)_MMIO_PIPE(pipe,
> > > > > _HSW_AUD_MISC_CTRL_A, _HSW_AUD_MISC_CTRL_B)
> > > > > > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> > > > > > b/drivers/gpu/drm/i915/intel_audio.c

Re: [Intel-gfx] [PATCH] drm/i915: set proper N/M in modeset

2016-08-04 Thread Yang, Libin
Hi Ville,

> -Original Message-
> From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> Sent: Thursday, August 4, 2016 1:39 PM
> To: Yang, Libin <libin.y...@intel.com>
> Cc: 'libin.y...@linux.intel.com' <libin.y...@linux.intel.com>; 'intel-
> g...@lists.freedesktop.org' <intel-gfx@lists.freedesktop.org>;
> 'jani.nik...@linux.intel.com' <jani.nik...@linux.intel.com>; Vetter, Daniel
> <daniel.vet...@intel.com>; 'ti...@suse.de' <ti...@suse.de>
> Subject: Re: [PATCH] drm/i915: set proper N/M in modeset
> 
> On Thu, Aug 04, 2016 at 02:48:54AM +, Yang, Libin wrote:
> > Hi Ville,
> >
> > > -Original Message-
> > > From: Yang, Libin
> > > Sent: Tuesday, August 2, 2016 9:59 PM
> > > To: Ville Syrjälä <ville.syrj...@linux.intel.com>;
> > > libin.y...@linux.intel.com
> > > Cc: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com;
> > > Vetter, Daniel <daniel.vet...@intel.com>; ti...@suse.de
> > > Subject: RE: [PATCH] drm/i915: set proper N/M in modeset
> > >
> > > Hi Ville
> > >
> > > > -Original Message-
> > > > From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> > > > Sent: Tuesday, August 2, 2016 6:47 PM
> > > > To: libin.y...@linux.intel.com
> > > > Cc: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com;
> > > > Vetter, Daniel <daniel.vet...@intel.com>; ti...@suse.de; Yang,
> > > > Libin <libin.y...@intel.com>
> > > > Subject: Re: [PATCH] drm/i915: set proper N/M in modeset
> > > >
> > > > On Tue, Aug 02, 2016 at 09:35:10AM +0800,
> > > > libin.y...@linux.intel.com
> > > wrote:
> > > > > From: Libin Yang <libin.y...@linux.intel.com>
> > > > >
> > > > > When modeset occurs and the LS_CLK is set to some special values
> > > > > in DP mode, the N/M need to be set manually if audio is playing.
> > > > >
> > > > > The relationship of Maud and Naud is expressed in the following
> > > > > equation:
> > > > > Maud/Naud = 512 * fs / f_LS_Clk
> > > > >
> > > > > Please refer VESA DisplayPort Standard spec for details.
> > > > >
> > > > > Also, the patch applies
> > > > > commit 7e8275c2f2bb ("drm/i915: set proper N/CTS in modeset") to
> > > > > APL platform.
> > > > >
> > > > > Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> > > > > ---
> > > > >  drivers/gpu/drm/i915/i915_reg.h|   6 ++
> > > > >  drivers/gpu/drm/i915/intel_audio.c | 122
> > > > > +++--
> > > > >  2 files changed, 111 insertions(+), 17 deletions(-)
> > > > >
> > > > > diff --git a/drivers/gpu/drm/i915/i915_reg.h
> > > > > b/drivers/gpu/drm/i915/i915_reg.h index 8bfde75..2f9d00e 100644
> > > > > --- a/drivers/gpu/drm/i915/i915_reg.h
> > > > > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > > > > @@ -7351,6 +7351,12 @@ enum {
> > > > >  #define _HSW_AUD_CONFIG_B0x65100
> > > > >  #define HSW_AUD_CFG(pipe)_MMIO_PIPE(pipe,
> > > > _HSW_AUD_CONFIG_A, _HSW_AUD_CONFIG_B)
> > > > >
> > > > > +#define _HSW_AUD_M_CTS_ENABLE_A  0x65028
> > > > > +#define _HSW_AUD_M_CTS_ENABLE_B  0x65128
> > > > > +#define HSW_AUD_M_CTS_ENABLE(pipe)
>   _MMIO_PIPE(pipe,
> > > > _HSW_AUD_M_CTS_ENABLE_A, _HSW_AUD_M_CTS_ENABLE_B)
> > > > > +#define   AUD_M_CTS_M_VALUE_INDEX(1 << 21)
> > > > > +#define   AUD_M_CTS_M_PROG_ENABLE(1 << 20)
> > > > > +
> > > > >  #define _HSW_AUD_MISC_CTRL_A 0x65010
> > > > >  #define _HSW_AUD_MISC_CTRL_B 0x65110
> > > > >  #define HSW_AUD_MISC_CTRL(pipe)  _MMIO_PIPE(pipe,
> > > > _HSW_AUD_MISC_CTRL_A, _HSW_AUD_MISC_CTRL_B)
> > > > > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> > > > > b/drivers/gpu/drm/i915/intel_audio.c
> > > > > index 6700a7b..de55ecf 100644
> > > > > --- a/drivers/gpu/drm/i915/intel_audio.c
> > > > > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > > > > @@ -98,6 +98,22 @@ static const struct {
> > > > >   { 192000, TMDS_297M, 20480, 247500 },  };
> > 

Re: [Intel-gfx] [PATCH] drm/i915: set proper N/M in modeset

2016-08-03 Thread Yang, Libin
Hi Ville,

> -Original Message-
> From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> Sent: Wednesday, August 3, 2016 12:59 AM
> To: Yang, Libin <libin.y...@intel.com>
> Cc: libin.y...@linux.intel.com; intel-gfx@lists.freedesktop.org;
> jani.nik...@linux.intel.com; Vetter, Daniel <daniel.vet...@intel.com>;
> ti...@suse.de
> Subject: Re: [PATCH] drm/i915: set proper N/M in modeset
> 
> On Tue, Aug 02, 2016 at 01:58:51PM +, Yang, Libin wrote:
> > Hi Ville
> >
> > > -Original Message-
> > > From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> > > Sent: Tuesday, August 2, 2016 6:47 PM
> > > To: libin.y...@linux.intel.com
> > > Cc: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com;
> > > Vetter, Daniel <daniel.vet...@intel.com>; ti...@suse.de; Yang, Libin
> > > <libin.y...@intel.com>
> > > Subject: Re: [PATCH] drm/i915: set proper N/M in modeset
> > >
> > > On Tue, Aug 02, 2016 at 09:35:10AM +0800, libin.y...@linux.intel.com
> wrote:
> > > > From: Libin Yang <libin.y...@linux.intel.com>
> > > >
> > > > When modeset occurs and the LS_CLK is set to some special values
> > > > in DP mode, the N/M need to be set manually if audio is playing.
> > > >
> > > > The relationship of Maud and Naud is expressed in the following
> > > > equation:
> > > > Maud/Naud = 512 * fs / f_LS_Clk
> > > >
> > > > Please refer VESA DisplayPort Standard spec for details.
> > > >
> > > > Also, the patch applies
> > > > commit 7e8275c2f2bb ("drm/i915: set proper N/CTS in modeset") to
> > > > APL platform.
> > > >
> > > > Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> > > > ---
> > > >  drivers/gpu/drm/i915/i915_reg.h|   6 ++
> > > >  drivers/gpu/drm/i915/intel_audio.c | 122
> > > > +++--
> > > >  2 files changed, 111 insertions(+), 17 deletions(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/i915/i915_reg.h
> > > > b/drivers/gpu/drm/i915/i915_reg.h index 8bfde75..2f9d00e 100644
> > > > --- a/drivers/gpu/drm/i915/i915_reg.h
> > > > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > > > @@ -7351,6 +7351,12 @@ enum {
> > > >  #define _HSW_AUD_CONFIG_B  0x65100
> > > >  #define HSW_AUD_CFG(pipe)  _MMIO_PIPE(pipe,
> > > _HSW_AUD_CONFIG_A, _HSW_AUD_CONFIG_B)
> > > >
> > > > +#define _HSW_AUD_M_CTS_ENABLE_A0x65028
> > > > +#define _HSW_AUD_M_CTS_ENABLE_B0x65128
> > > > +#define HSW_AUD_M_CTS_ENABLE(pipe)
>   _MMIO_PIPE(pipe,
> > > _HSW_AUD_M_CTS_ENABLE_A, _HSW_AUD_M_CTS_ENABLE_B)
> > > > +#define   AUD_M_CTS_M_VALUE_INDEX  (1 << 21)
> > > > +#define   AUD_M_CTS_M_PROG_ENABLE  (1 << 20)
> > > > +
> > > >  #define _HSW_AUD_MISC_CTRL_A   0x65010
> > > >  #define _HSW_AUD_MISC_CTRL_B   0x65110
> > > >  #define HSW_AUD_MISC_CTRL(pipe)_MMIO_PIPE(pipe,
> > > _HSW_AUD_MISC_CTRL_A, _HSW_AUD_MISC_CTRL_B)
> > > > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> > > > b/drivers/gpu/drm/i915/intel_audio.c
> > > > index 6700a7b..de55ecf 100644
> > > > --- a/drivers/gpu/drm/i915/intel_audio.c
> > > > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > > > @@ -98,6 +98,22 @@ static const struct {
> > > > { 192000, TMDS_297M, 20480, 247500 },  };
> > > >
> > > > +#define LC_540M 54
> > > > +#define LC_162M 162000
> > >
> > > Do we have some explanation why 2.7 doesn't need M/N programming,
> > > but
> > > 1.62 and 5.4 do?
> >
> > I didn't use 2.7 because I can't find a mode using 2.7.
> 
> Hmm. Maybe we should add some knobs to force a specific bpc/link
> rate/number of lanes to help with this kind of testing. Currently you just get
> what you get, which isn't so nice when you want to test all variations.
> ...
> OK, so I just went ahead and did that. Here's a branch:
> 
> git://github.com/vsyrjala/linux.git modparam_clock_bpp_limit
> 
> For your DP testing just setting
> i915.max_port_clock=162000 or i915.max_port_clock=27 and then
> forcing a modeset should do the trick.

Thanks for the new branch. It seems download is very slow, less than
10Kib/s. So I will submit the new patches firstl

Re: [Intel-gfx] [PATCH] drm/i915: set proper N/M in modeset

2016-08-03 Thread Yang, Libin
Hi Ville,

> -Original Message-
> From: Yang, Libin
> Sent: Tuesday, August 2, 2016 9:59 PM
> To: Ville Syrjälä <ville.syrj...@linux.intel.com>; libin.y...@linux.intel.com
> Cc: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com; Vetter, 
> Daniel
> <daniel.vet...@intel.com>; ti...@suse.de
> Subject: RE: [PATCH] drm/i915: set proper N/M in modeset
> 
> Hi Ville
> 
> > -Original Message-
> > From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> > Sent: Tuesday, August 2, 2016 6:47 PM
> > To: libin.y...@linux.intel.com
> > Cc: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com;
> > Vetter, Daniel <daniel.vet...@intel.com>; ti...@suse.de; Yang, Libin
> > <libin.y...@intel.com>
> > Subject: Re: [PATCH] drm/i915: set proper N/M in modeset
> >
> > On Tue, Aug 02, 2016 at 09:35:10AM +0800, libin.y...@linux.intel.com
> wrote:
> > > From: Libin Yang <libin.y...@linux.intel.com>
> > >
> > > When modeset occurs and the LS_CLK is set to some special values in
> > > DP mode, the N/M need to be set manually if audio is playing.
> > >
> > > The relationship of Maud and Naud is expressed in the following
> > > equation:
> > > Maud/Naud = 512 * fs / f_LS_Clk
> > >
> > > Please refer VESA DisplayPort Standard spec for details.
> > >
> > > Also, the patch applies
> > > commit 7e8275c2f2bb ("drm/i915: set proper N/CTS in modeset") to APL
> > > platform.
> > >
> > > Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/i915_reg.h|   6 ++
> > >  drivers/gpu/drm/i915/intel_audio.c | 122
> > > +++--
> > >  2 files changed, 111 insertions(+), 17 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/i915/i915_reg.h
> > > b/drivers/gpu/drm/i915/i915_reg.h index 8bfde75..2f9d00e 100644
> > > --- a/drivers/gpu/drm/i915/i915_reg.h
> > > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > > @@ -7351,6 +7351,12 @@ enum {
> > >  #define _HSW_AUD_CONFIG_B0x65100
> > >  #define HSW_AUD_CFG(pipe)_MMIO_PIPE(pipe,
> > _HSW_AUD_CONFIG_A, _HSW_AUD_CONFIG_B)
> > >
> > > +#define _HSW_AUD_M_CTS_ENABLE_A  0x65028
> > > +#define _HSW_AUD_M_CTS_ENABLE_B  0x65128
> > > +#define HSW_AUD_M_CTS_ENABLE(pipe)   _MMIO_PIPE(pipe,
> > _HSW_AUD_M_CTS_ENABLE_A, _HSW_AUD_M_CTS_ENABLE_B)
> > > +#define   AUD_M_CTS_M_VALUE_INDEX(1 << 21)
> > > +#define   AUD_M_CTS_M_PROG_ENABLE(1 << 20)
> > > +
> > >  #define _HSW_AUD_MISC_CTRL_A 0x65010
> > >  #define _HSW_AUD_MISC_CTRL_B 0x65110
> > >  #define HSW_AUD_MISC_CTRL(pipe)  _MMIO_PIPE(pipe,
> > _HSW_AUD_MISC_CTRL_A, _HSW_AUD_MISC_CTRL_B)
> > > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> > > b/drivers/gpu/drm/i915/intel_audio.c
> > > index 6700a7b..de55ecf 100644
> > > --- a/drivers/gpu/drm/i915/intel_audio.c
> > > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > > @@ -98,6 +98,22 @@ static const struct {
> > >   { 192000, TMDS_297M, 20480, 247500 },  };
> > >
> > > +#define LC_540M 54
> > > +#define LC_162M 162000
> >
> > Do we have some explanation why 2.7 doesn't need M/N programming, but
> > 1.62 and 5.4 do?
> 
> I didn't use 2.7 because I can't find a mode using 2.7. So I can't do the 
> test.
> 5.4 is for 4K and 1.62 is for 1080p.
> 
> >
> > And I see you're only doing this on HSW+. Earlier platforms don't need this?
> 
> We are not supporting earlier platforms and I'm not sure whether the old
> platforms supports 4K DP or not.
> 
> >
> > > +static const struct {
> > > + int sample_rate;
> > > + int clock;
> > > + int n;
> > > + int m;
> >
> > Can save a bit of space by using u16 for m and n.
> 
> OK, I will do it in next version.
> 
> >
> > > +} aud_nm[] = {
> > > + {48000, LC_540M, 5625, 256},`
> > > + {44100, LC_540M, 9375, 392},
> > > + {32000, LC_540M, 16875, 512},
> > > + {48000, LC_162M, 3375, 512},
> > > + {44100, LC_162M, 5625, 784},
> > > + {32000, LC_162M, 10125, 1024
> > > +};
> >
> > The numbers look good, but what about other sample rates? For HDMI we
> > go up to 192kHz, why not for DP?
> 
> Our test only includes

Re: [Intel-gfx] [PATCH 2/3] drm/i915: Move audio_connector to intel_encoder

2016-08-02 Thread Yang, Libin
Add Takashi

Regards,
Libin


> -Original Message-
> From: Pandiyan, Dhinakaran
> Sent: Wednesday, August 3, 2016 9:47 AM
> To: intel-gfx@lists.freedesktop.org
> Cc: cp...@redhat.com; ville.syrj...@linux.intel.com; Yang, Libin
> <libin.y...@intel.com>; Pandiyan, Dhinakaran
> <dhinakaran.pandi...@intel.com>
> Subject: [PATCH 2/3] drm/i915: Move audio_connector to intel_encoder
> 
> With DP MST, a digital_port can carry more than one audio stream. Hence,
> more than one audio_connector needs to be attached to intel_digital_port in
> such cases. However, each stream is associated with an unique encoder. So,
> instead of creating an array of audio_connectors per port, move
> audio_connector from struct intel_digital_port to struct intel_encoder.
> This also simplifies access to the right audio_connector from codec functions
> in intel_audio.c that receive intel_encoder.
> 
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandi...@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_audio.c | 10 --
>  drivers/gpu/drm/i915/intel_drv.h   |  4 ++--
>  2 files changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_audio.c
> b/drivers/gpu/drm/i915/intel_audio.c
> index 6700a7b..8c493de 100644
> --- a/drivers/gpu/drm/i915/intel_audio.c
> +++ b/drivers/gpu/drm/i915/intel_audio.c
> @@ -523,7 +523,7 @@ void intel_audio_codec_enable(struct intel_encoder
> *intel_encoder)
>adjusted_mode);
> 
>   mutex_lock(_priv->av_mutex);
> - intel_dig_port->audio_connector = connector;
> + intel_encoder->audio_connector = connector;
>   /* referred in audio callbacks */
>   dev_priv->dig_port_map[port] = intel_encoder;
>   mutex_unlock(_priv->av_mutex);
> @@ -552,7 +552,7 @@ void intel_audio_codec_disable(struct intel_encoder
> *intel_encoder)
>   dev_priv->display.audio_codec_disable(intel_encoder);
> 
>   mutex_lock(_priv->av_mutex);
> - intel_dig_port->audio_connector = NULL;
> + intel_encoder->audio_connector = NULL;
>   dev_priv->dig_port_map[port] = NULL;
>   mutex_unlock(_priv->av_mutex);
> 
> @@ -707,7 +707,6 @@ static int i915_audio_component_get_eld(struct
> device *dev, int port,  {
>   struct drm_i915_private *dev_priv = dev_to_i915(dev);
>   struct intel_encoder *intel_encoder;
> - struct intel_digital_port *intel_dig_port;
>   const u8 *eld;
>   int ret = -EINVAL;
> 
> @@ -716,10 +715,9 @@ static int i915_audio_component_get_eld(struct
> device *dev, int port,
>   /* intel_encoder might be NULL for DP MST */
>   if (intel_encoder) {
>   ret = 0;
> - intel_dig_port = enc_to_dig_port(_encoder->base);
> - *enabled = intel_dig_port->audio_connector != NULL;
> + *enabled = intel_encoder->audio_connector != NULL;
>   if (*enabled) {
> - eld = intel_dig_port->audio_connector->eld;
> + eld = intel_encoder->audio_connector->eld;
>   ret = drm_eld_size(eld);
>   memcpy(buf, eld, min(max_bytes, ret));
>   }
> diff --git a/drivers/gpu/drm/i915/intel_drv.h
> b/drivers/gpu/drm/i915/intel_drv.h
> index f73de63c..45020d2 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -220,6 +220,8 @@ struct intel_encoder {
>   void (*suspend)(struct intel_encoder *);
>   int crtc_mask;
>   enum hpd_pin hpd_pin;
> + /* for communication with audio component; protected by av_mutex
> */
> + const struct drm_connector *audio_connector;
>  };
> 
>  struct intel_panel {
> @@ -929,8 +931,6 @@ struct intel_digital_port {
>   enum irqreturn (*hpd_pulse)(struct intel_digital_port *, bool);
>   bool release_cl2_override;
>   uint8_t max_lanes;
> - /* for communication with audio component; protected by av_mutex
> */
> - const struct drm_connector *audio_connector;
>  };
> 
>  struct intel_dp_mst_encoder {
> --
> 2.5.0

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 1/3] drm/i915: start adding dp mst audio

2016-08-02 Thread Yang, Libin
Add Takashi

Regards,
Libin


> -Original Message-
> From: Pandiyan, Dhinakaran
> Sent: Wednesday, August 3, 2016 9:47 AM
> To: intel-gfx@lists.freedesktop.org
> Cc: cp...@redhat.com; ville.syrj...@linux.intel.com; Yang, Libin
> <libin.y...@intel.com>; Libin Yang <libin.y...@linux.intel.com>
> Subject: [PATCH 1/3] drm/i915: start adding dp mst audio
> 
> From: Libin Yang <libin.y...@linux.intel.com>
> 
> (This patch is developed by Dave Airlie <airl...@redhat.com> originally)
> 
> This patch adds support for DP MST audio in i915.
> 
> Enable audio codec when DP MST is enabled if has_audio flag is set.
> Disable audio codec when DP MST is disabled if has_audio flag is set.
> 
> Another separated patches to support DP MST audio will be implemented in
> audio driver.
> 
> Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 19 ++-
>  drivers/gpu/drm/i915/intel_ddi.c| 20 +++-
>  drivers/gpu/drm/i915/intel_dp_mst.c | 21 +
>  drivers/gpu/drm/i915/intel_drv.h|  2 ++
>  4 files changed, 56 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c
> b/drivers/gpu/drm/i915/i915_debugfs.c
> index 531ca02..56e38b1 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -2961,6 +2961,20 @@ static void intel_dp_info(struct seq_file *m,
>   intel_panel_info(m, _connector->panel);  }
> 
> +static void intel_dp_mst_info(struct seq_file *m,
> +   struct intel_connector *intel_connector) {
> + struct intel_encoder *intel_encoder = intel_connector->encoder;
> + struct intel_dp_mst_encoder *intel_mst =
> + enc_to_mst(_encoder->base);
> + struct intel_digital_port *intel_dig_port = intel_mst->primary;
> + struct intel_dp *intel_dp = _dig_port->dp;
> + bool has_audio = drm_dp_mst_port_has_audio(_dp->mst_mgr,
> + intel_connector->port);
> +
> + seq_printf(m, "\taudio support: %s\n", yesno(has_audio)); }
> +
>  static void intel_hdmi_info(struct seq_file *m,
>   struct intel_connector *intel_connector)  { @@ -
> 3003,7 +3017,10 @@ static void intel_connector_info(struct seq_file *m,
>   switch (connector->connector_type) {
>   case DRM_MODE_CONNECTOR_DisplayPort:
>   case DRM_MODE_CONNECTOR_eDP:
> - intel_dp_info(m, intel_connector);
> + if (intel_encoder->type == INTEL_OUTPUT_DP_MST)
> + intel_dp_mst_info(m, intel_connector);
> + else
> + intel_dp_info(m, intel_connector);
>   break;
>   case DRM_MODE_CONNECTOR_LVDS:
>   if (intel_encoder->type == INTEL_OUTPUT_LVDS) diff --git
> a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index dd1d6fe..cbb4e7a 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -2154,6 +2154,19 @@ void intel_ddi_fdi_disable(struct drm_crtc *crtc)
>   I915_WRITE(FDI_RX_CTL(PIPE_A), val);
>  }
> 
> +bool intel_ddi_is_audio_enabled(struct drm_i915_private *dev_priv,
> +  struct intel_crtc *intel_crtc)
> +{
> + u32 temp;
> +
> + if (intel_display_power_is_enabled(dev_priv,
> POWER_DOMAIN_AUDIO)) {
> + temp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD);
> + if (temp & AUDIO_OUTPUT_ENABLE(intel_crtc->pipe))
> + return true;
> + }
> + return false;
> +}
> +
>  void intel_ddi_get_config(struct intel_encoder *encoder,
> struct intel_crtc_state *pipe_config)  { @@ -2219,11
> +2232,8 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
>   break;
>   }
> 
> - if (intel_display_power_is_enabled(dev_priv,
> POWER_DOMAIN_AUDIO)) {
> - temp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD);
> - if (temp & AUDIO_OUTPUT_ENABLE(intel_crtc->pipe))
> - pipe_config->has_audio = true;
> - }
> + pipe_config->has_audio =
> + intel_ddi_is_audio_enabled(dev_priv, intel_crtc);
> 
>   if (encoder->type == INTEL_OUTPUT_EDP && dev_priv->vbt.edp.bpp
> &&
>   pipe_config->pipe_bpp > dev_priv->vbt.edp.bpp) { diff --git
> a/drivers/gpu/drm/i915/intel_dp_mst.c
> b/drivers/gpu/drm/i915/intel_dp_mst.c
> index 68a005d..84dbb50 100644
> --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
>

Re: [Intel-gfx] Prep. for DP audio MST support

2016-08-02 Thread Yang, Libin
Add Takashi who is the audio driver maintainer.

Dhinakaran is working on gfx driver support for DP MST.


> -Original Message-
> From: Pandiyan, Dhinakaran
> Sent: Wednesday, August 3, 2016 9:47 AM
> To: intel-gfx@lists.freedesktop.org
> Cc: cp...@redhat.com; ville.syrj...@linux.intel.com; Yang, Libin
> <libin.y...@intel.com>
> Subject: Prep. for DP audio MST support
> 
> This series lays the groundwork for more DP MST audio work that will follow.
> Patch 1 got possibly reverted because Patch 3 was missing.
> 
> The APIs between i915 and audio drivers have to modified so that the audio
> drivers can identify different displays connected to a port. The changes
> introduced in Patch 2 will make that easy.
> 
> Dhinakaran Pandiyan(2)
> [PATCH 2/3] drm/i915: Move audio_connector to intel_encoder [PATCH 3/3]
> drm/i915: Fix enc_to_dig_port for MST encoders
> 
> Libin Yang(1)
> [PATCH 1/3] drm/i915: start adding dp mst audio
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: set proper N/M in modeset

2016-08-02 Thread Yang, Libin
Hi Jani,

> -Original Message-
> From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
> Sent: Tuesday, August 2, 2016 6:53 PM
> To: libin.y...@linux.intel.com; intel-gfx@lists.freedesktop.org;
> ville.syrj...@linux.intel.com; Vetter, Daniel <daniel.vet...@intel.com>;
> ti...@suse.de
> Cc: Yang, Libin <libin.y...@intel.com>; Libin Yang
> <libin.y...@linux.intel.com>
> Subject: Re: [PATCH] drm/i915: set proper N/M in modeset
> 
> On Tue, 02 Aug 2016, libin.y...@linux.intel.com wrote:
> > From: Libin Yang <libin.y...@linux.intel.com>
> >
> > When modeset occurs and the LS_CLK is set to some special values in DP
> > mode, the N/M need to be set manually if audio is playing.
> >
> > The relationship of Maud and Naud is expressed in the following
> > equation:
> > Maud/Naud = 512 * fs / f_LS_Clk
> >
> > Please refer VESA DisplayPort Standard spec for details.
> >
> > Also, the patch applies
> > commit 7e8275c2f2bb ("drm/i915: set proper N/CTS in modeset") to APL
> > platform.
> 
> Whenever a commit message says "also", it makes me think the patch should
> probably be split to several patches. And that is certainly true here.

I will split the patch in next version.

Regards,
Libin

> 
> 
> --
> Jani Nikula, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: set proper N/M in modeset

2016-08-02 Thread Yang, Libin
Hi Ville

> -Original Message-
> From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> Sent: Tuesday, August 2, 2016 6:47 PM
> To: libin.y...@linux.intel.com
> Cc: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com; Vetter, 
> Daniel
> <daniel.vet...@intel.com>; ti...@suse.de; Yang, Libin <libin.y...@intel.com>
> Subject: Re: [PATCH] drm/i915: set proper N/M in modeset
> 
> On Tue, Aug 02, 2016 at 09:35:10AM +0800, libin.y...@linux.intel.com wrote:
> > From: Libin Yang <libin.y...@linux.intel.com>
> >
> > When modeset occurs and the LS_CLK is set to some special values in DP
> > mode, the N/M need to be set manually if audio is playing.
> >
> > The relationship of Maud and Naud is expressed in the following
> > equation:
> > Maud/Naud = 512 * fs / f_LS_Clk
> >
> > Please refer VESA DisplayPort Standard spec for details.
> >
> > Also, the patch applies
> > commit 7e8275c2f2bb ("drm/i915: set proper N/CTS in modeset") to APL
> > platform.
> >
> > Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_reg.h|   6 ++
> >  drivers/gpu/drm/i915/intel_audio.c | 122
> > +++--
> >  2 files changed, 111 insertions(+), 17 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_reg.h
> > b/drivers/gpu/drm/i915/i915_reg.h index 8bfde75..2f9d00e 100644
> > --- a/drivers/gpu/drm/i915/i915_reg.h
> > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > @@ -7351,6 +7351,12 @@ enum {
> >  #define _HSW_AUD_CONFIG_B  0x65100
> >  #define HSW_AUD_CFG(pipe)  _MMIO_PIPE(pipe,
> _HSW_AUD_CONFIG_A, _HSW_AUD_CONFIG_B)
> >
> > +#define _HSW_AUD_M_CTS_ENABLE_A0x65028
> > +#define _HSW_AUD_M_CTS_ENABLE_B0x65128
> > +#define HSW_AUD_M_CTS_ENABLE(pipe) _MMIO_PIPE(pipe,
> _HSW_AUD_M_CTS_ENABLE_A, _HSW_AUD_M_CTS_ENABLE_B)
> > +#define   AUD_M_CTS_M_VALUE_INDEX  (1 << 21)
> > +#define   AUD_M_CTS_M_PROG_ENABLE  (1 << 20)
> > +
> >  #define _HSW_AUD_MISC_CTRL_A   0x65010
> >  #define _HSW_AUD_MISC_CTRL_B   0x65110
> >  #define HSW_AUD_MISC_CTRL(pipe)_MMIO_PIPE(pipe,
> _HSW_AUD_MISC_CTRL_A, _HSW_AUD_MISC_CTRL_B)
> > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> > b/drivers/gpu/drm/i915/intel_audio.c
> > index 6700a7b..de55ecf 100644
> > --- a/drivers/gpu/drm/i915/intel_audio.c
> > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > @@ -98,6 +98,22 @@ static const struct {
> > { 192000, TMDS_297M, 20480, 247500 },  };
> >
> > +#define LC_540M 54
> > +#define LC_162M 162000
> 
> Do we have some explanation why 2.7 doesn't need M/N programming, but
> 1.62 and 5.4 do?

I didn't use 2.7 because I can't find a mode using 2.7. So I can't do the test.
5.4 is for 4K and 1.62 is for 1080p.

> 
> And I see you're only doing this on HSW+. Earlier platforms don't need this?

We are not supporting earlier platforms and I'm not sure whether the
old platforms supports 4K DP or not.

> 
> > +static const struct {
> > +   int sample_rate;
> > +   int clock;
> > +   int n;
> > +   int m;
> 
> Can save a bit of space by using u16 for m and n.

OK, I will do it in next version.

> 
> > +} aud_nm[] = {
> > +   {48000, LC_540M, 5625, 256},`
> > +   {44100, LC_540M, 9375, 392},
> > +   {32000, LC_540M, 16875, 512},
> > +   {48000, LC_162M, 3375, 512},
> > +   {44100, LC_162M, 5625, 784},
> > +   {32000, LC_162M, 10125, 1024
> > +};
> 
> The numbers look good, but what about other sample rates? For HDMI we go
> up to 192kHz, why not for DP?

Our test only includes 32K, 44.1K and 48K :)
I will add the support if you think we should.

> 
> > +
> >  /* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */  static u32
> > audio_config_hdmi_pixel_clock(const struct drm_display_mode
> > *adjusted_mode)  { @@ -121,20 +137,50 @@ static u32
> > audio_config_hdmi_pixel_clock(const struct drm_display_mode *adjusted
> > return hdmi_audio_clock[i].config;
> >  }
> >
> > -static int audio_config_get_n(const struct drm_display_mode *mode,
> > int rate)
> > +static int audio_config_get_n(struct intel_crtc *crtc,
> > + const struct drm_display_mode *adjusted_mode,
> > + int rate)
> > +{
> > +   int i;
> > +
> > +   if (intel_crtc_has_type(crtc->config, INTEL_OUTPUT_HDMI)) {
> > +   for (i = 0; i <

Re: [Intel-gfx] [PATCH] drm/i915: HDMI audio gets the TMDS clock by crtc_clock

2016-08-02 Thread Yang, Libin
This patch is based on drm/i915: set proper N/M in modeset

Regards,
Libin


> -Original Message-
> From: libin.y...@linux.intel.com [mailto:libin.y...@linux.intel.com]
> Sent: Tuesday, August 2, 2016 2:18 PM
> To: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com;
> ville.syrj...@linux.intel.com; Vetter, Daniel <daniel.vet...@intel.com>;
> ti...@suse.de
> Cc: Yang, Libin <libin.y...@intel.com>; Libin Yang
> <libin.y...@linux.intel.com>
> Subject: [PATCH] drm/i915: HDMI audio gets the TMDS clock by crtc_clock
> 
> From: Libin Yang <libin.y...@linux.intel.com>
> 
> HDMI audio should use crtc_clock to get the TMDS clock.
> 
> Besides, this patch renames mode to adjusted_mode to unify the name.
> 
> Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_audio.c | 14 +++---
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_audio.c
> b/drivers/gpu/drm/i915/intel_audio.c
> index de55ecf..a291a31 100644
> --- a/drivers/gpu/drm/i915/intel_audio.c
> +++ b/drivers/gpu/drm/i915/intel_audio.c
> @@ -146,7 +146,7 @@ static int audio_config_get_n(struct intel_crtc *crtc,
>   if (intel_crtc_has_type(crtc->config, INTEL_OUTPUT_HDMI)) {
>   for (i = 0; i < ARRAY_SIZE(aud_ncts); i++) {
>   if ((rate == aud_ncts[i].sample_rate) &&
> - (adjusted_mode->clock == aud_ncts[i].clock)) {
> + (adjusted_mode->crtc_clock == aud_ncts[i].clock)) {
>   return aud_ncts[i].n;
>   }
>   }
> @@ -215,8 +215,8 @@ static uint32_t audio_config_setup_m_reg(struct
> intel_crtc *crtc,  static bool audio_rate_need_prog(struct intel_crtc *crtc,
>const struct drm_display_mode
> *adjusted_mode)  {
> - if (((adjusted_mode->clock == TMDS_297M) ||
> -  (adjusted_mode->clock == TMDS_296M)) &&
> + if (((adjusted_mode->crtc_clock == TMDS_297M) ||
> +  (adjusted_mode->crtc_clock == TMDS_296M)) &&
>   intel_crtc_has_type(crtc->config, INTEL_OUTPUT_HDMI))
>   return true;
>   else if (((crtc->config->port_clock == LC_540M) || @@ -711,7 +711,7
> @@ static int i915_audio_component_sync_audio_rate(struct device *dev,
>   struct drm_i915_private *dev_priv = dev_to_i915(dev);
>   struct intel_encoder *intel_encoder;
>   struct intel_crtc *crtc;
> - struct drm_display_mode *mode;
> + struct drm_display_mode *adjusted_mode;
>   struct i915_audio_component *acomp = dev_priv->audio_component;
>   enum pipe pipe = INVALID_PIPE;
>   u32 tmp, m;
> @@ -747,20 +747,20 @@ static int
> i915_audio_component_sync_audio_rate(struct device *dev,
> 
>   DRM_DEBUG_KMS("pipe %c connects port %c\n",
> pipe_name(pipe), port_name(port));
> - mode = >config->base.adjusted_mode;
> + adjusted_mode = >config->base.adjusted_mode;
> 
>   /* port must be valid now, otherwise the pipe will be invalid */
>   acomp->aud_sample_rate[port] = rate;
> 
>   /* 2. check whether to set the N/CTS/M manually or not */
> - if (!audio_rate_need_prog(crtc, mode)) {
> + if (!audio_rate_need_prog(crtc, adjusted_mode)) {
>   tmp = I915_READ(HSW_AUD_CFG(pipe));
>   tmp &= ~AUD_CONFIG_N_PROG_ENABLE;
>   I915_WRITE(HSW_AUD_CFG(pipe), tmp);
>   goto unlock;
>   }
> 
> - n = audio_config_get_n(crtc, mode, rate);
> + n = audio_config_get_n(crtc, adjusted_mode, rate);
>   if (n == 0) {
>   DRM_DEBUG_KMS("Using automatic mode for N value on
> port %c\n",
> port_name(port));
> --
> 1.9.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: set proper N/M in modeset

2016-07-31 Thread Yang, Libin
Hi Ville,

> -Original Message-
> From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> Sent: Friday, July 29, 2016 5:47 PM
> To: Yang, Libin <libin.y...@intel.com>
> Cc: libin.y...@linux.intel.com; intel-gfx@lists.freedesktop.org;
> jani.nik...@linux.intel.com; Vetter, Daniel <daniel.vet...@intel.com>;
> ti...@suse.de
> Subject: Re: [PATCH] drm/i915: set proper N/M in modeset
> 
> On Fri, Jul 29, 2016 at 05:54:23AM +, Yang, Libin wrote:
> > Hi Ville,
> >
> > > -Original Message-
> > > From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> > > Sent: Thursday, July 28, 2016 3:42 PM
> > > To: libin.y...@linux.intel.com
> > > Cc: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com;
> > > Vetter, Daniel <daniel.vet...@intel.com>; ti...@suse.de; Yang, Libin
> > > <libin.y...@intel.com>
> > > Subject: Re: [PATCH] drm/i915: set proper N/M in modeset
> > >
> > > On Thu, Jul 14, 2016 at 03:06:21PM +0800, libin.y...@linux.intel.com
> wrote:
> > > > From: Libin Yang <libin.y...@linux.intel.com>
> > > >
> > > > When modeset occurs and the LS_CLK is set to some special values
> > > > in DP mode, the N/M need to be set manually if audio is playing.
> > > >
> > > > Also, the patch applies
> > > > commit 7e8275c2f2bb ("drm/i915: set proper N/CTS in modeset") to
> > > > APL platform.
> > > >
> > > > Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> > > > ---
> > > >  drivers/gpu/drm/i915/i915_reg.h|   6 ++
> > > >  drivers/gpu/drm/i915/intel_audio.c | 116
> > > > -
> > > >  2 files changed, 108 insertions(+), 14 deletions(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/i915/i915_reg.h
> > > > b/drivers/gpu/drm/i915/i915_reg.h index 8bfde75..2f9d00e 100644
> > > > --- a/drivers/gpu/drm/i915/i915_reg.h
> > > > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > > > @@ -7351,6 +7351,12 @@ enum {
> > > >  #define _HSW_AUD_CONFIG_B  0x65100
> > > >  #define HSW_AUD_CFG(pipe)  _MMIO_PIPE(pipe,
> > > _HSW_AUD_CONFIG_A, _HSW_AUD_CONFIG_B)
> > > >
> > > > +#define _HSW_AUD_M_CTS_ENABLE_A0x65028
> > > > +#define _HSW_AUD_M_CTS_ENABLE_B0x65128
> > > > +#define HSW_AUD_M_CTS_ENABLE(pipe)
>   _MMIO_PIPE(pipe,
> > > _HSW_AUD_M_CTS_ENABLE_A, _HSW_AUD_M_CTS_ENABLE_B)
> > > > +#define   AUD_M_CTS_M_VALUE_INDEX  (1 << 21)
> > > > +#define   AUD_M_CTS_M_PROG_ENABLE  (1 << 20)
> > > > +
> > > >  #define _HSW_AUD_MISC_CTRL_A   0x65010
> > > >  #define _HSW_AUD_MISC_CTRL_B   0x65110
> > > >  #define HSW_AUD_MISC_CTRL(pipe)_MMIO_PIPE(pipe,
> > > _HSW_AUD_MISC_CTRL_A, _HSW_AUD_MISC_CTRL_B)
> > > > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> > > > b/drivers/gpu/drm/i915/intel_audio.c
> > > > index 6700a7b..e2e4d4b 100644
> > > > --- a/drivers/gpu/drm/i915/intel_audio.c
> > > > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > > > @@ -98,6 +98,22 @@ static const struct {
> > > > { 192000, TMDS_297M, 20480, 247500 },  };
> > > >
> > > > +#define LC_533M 533250
> > > > +#define LC_148M 148500
> > > > +static const struct {
> > > > +   int sample_rate;
> > > > +   int clock;
> > > > +   int n;
> > > > +   int m;
> > > > +} aud_nm[] = {
> > > > +   {48000, LC_533M, 88875, 4096},
> > > > +   {44100, LC_533M, 148125, 6272},
> > > > +   {32000, LC_533M, 266625, 8192},
> > > > +   {48000, LC_148M, 12375, 2048},
> > > > +   {44100, LC_148M, 20625, 3136},
> > > > +   {32000, LC_148M, 37125, 4096},
> > > > +};
> > > > +
> > > >  /* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */  static
> > > > u32 audio_config_hdmi_pixel_clock(const struct drm_display_mode
> > > > *adjusted_mode)  { @@ -121,20 +137,50 @@ static u32
> > > > audio_config_hdmi_pixel_clock(const struct drm_display_mode
> *adjusted
> > > > return hdmi_audio_clock[i].config;  }
> > > >
> > > > -static int audio_config_get_n(const struct drm_display_mode
> > > > *mode

Re: [Intel-gfx] [PATCH] drm/i915: set proper N/M in modeset

2016-07-28 Thread Yang, Libin
Hi Ville,

> -Original Message-
> From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> Sent: Thursday, July 28, 2016 3:42 PM
> To: libin.y...@linux.intel.com
> Cc: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com; Vetter,
> Daniel <daniel.vet...@intel.com>; ti...@suse.de; Yang, Libin
> <libin.y...@intel.com>
> Subject: Re: [PATCH] drm/i915: set proper N/M in modeset
> 
> On Thu, Jul 14, 2016 at 03:06:21PM +0800, libin.y...@linux.intel.com wrote:
> > From: Libin Yang <libin.y...@linux.intel.com>
> >
> > When modeset occurs and the LS_CLK is set to some special values in DP
> > mode, the N/M need to be set manually if audio is playing.
> >
> > Also, the patch applies
> > commit 7e8275c2f2bb ("drm/i915: set proper N/CTS in modeset") to APL
> > platform.
> >
> > Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_reg.h|   6 ++
> >  drivers/gpu/drm/i915/intel_audio.c | 116
> > -
> >  2 files changed, 108 insertions(+), 14 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_reg.h
> > b/drivers/gpu/drm/i915/i915_reg.h index 8bfde75..2f9d00e 100644
> > --- a/drivers/gpu/drm/i915/i915_reg.h
> > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > @@ -7351,6 +7351,12 @@ enum {
> >  #define _HSW_AUD_CONFIG_B  0x65100
> >  #define HSW_AUD_CFG(pipe)  _MMIO_PIPE(pipe,
> _HSW_AUD_CONFIG_A, _HSW_AUD_CONFIG_B)
> >
> > +#define _HSW_AUD_M_CTS_ENABLE_A0x65028
> > +#define _HSW_AUD_M_CTS_ENABLE_B0x65128
> > +#define HSW_AUD_M_CTS_ENABLE(pipe) _MMIO_PIPE(pipe,
> _HSW_AUD_M_CTS_ENABLE_A, _HSW_AUD_M_CTS_ENABLE_B)
> > +#define   AUD_M_CTS_M_VALUE_INDEX  (1 << 21)
> > +#define   AUD_M_CTS_M_PROG_ENABLE  (1 << 20)
> > +
> >  #define _HSW_AUD_MISC_CTRL_A   0x65010
> >  #define _HSW_AUD_MISC_CTRL_B   0x65110
> >  #define HSW_AUD_MISC_CTRL(pipe)_MMIO_PIPE(pipe,
> _HSW_AUD_MISC_CTRL_A, _HSW_AUD_MISC_CTRL_B)
> > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> > b/drivers/gpu/drm/i915/intel_audio.c
> > index 6700a7b..e2e4d4b 100644
> > --- a/drivers/gpu/drm/i915/intel_audio.c
> > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > @@ -98,6 +98,22 @@ static const struct {
> > { 192000, TMDS_297M, 20480, 247500 },  };
> >
> > +#define LC_533M 533250
> > +#define LC_148M 148500
> > +static const struct {
> > +   int sample_rate;
> > +   int clock;
> > +   int n;
> > +   int m;
> > +} aud_nm[] = {
> > +   {48000, LC_533M, 88875, 4096},
> > +   {44100, LC_533M, 148125, 6272},
> > +   {32000, LC_533M, 266625, 8192},
> > +   {48000, LC_148M, 12375, 2048},
> > +   {44100, LC_148M, 20625, 3136},
> > +   {32000, LC_148M, 37125, 4096},
> > +};
> > +
> >  /* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */  static u32
> > audio_config_hdmi_pixel_clock(const struct drm_display_mode
> > *adjusted_mode)  { @@ -121,20 +137,50 @@ static u32
> > audio_config_hdmi_pixel_clock(const struct drm_display_mode *adjusted
> > return hdmi_audio_clock[i].config;
> >  }
> >
> > -static int audio_config_get_n(const struct drm_display_mode *mode,
> > int rate)
> > +static int audio_config_get_n(struct intel_crtc *crtc,
> > + const struct drm_display_mode *mode, int rate) {
> > +   int i;
> > +
> > +   if (intel_crtc_has_type(crtc->config, INTEL_OUTPUT_HDMI)) {
> > +   for (i = 0; i < ARRAY_SIZE(aud_ncts); i++) {
> > +   if ((rate == aud_ncts[i].sample_rate) &&
> > +   (mode->clock == aud_ncts[i].clock)) {
> > +   return aud_ncts[i].n;
> > +   }
> > +   }
> > +   }
> > +
> > +   if (intel_crtc_has_type(crtc->config, INTEL_OUTPUT_DP)) {
> > +   for (i = 0; i < ARRAY_SIZE(aud_nm); i++) {
> > +   if ((rate == aud_nm[i].sample_rate) &&
> > +   (mode->clock == aud_nm[i].clock)) {
> 
> So the spec says we should have "Maud / Naud = 512 * fs / f_LS_Clk", where
> fs is the audio sample rate, and f_LS_CLK is the link symbol clock.
> With that in mind this should not be looking at mode->clock but
> crtc->config->port_clock.
> 
> So I don't actually understand why you say LS_CLK has "special" values.
> It shouldn't. It's always either 162, 270, or 540 MHz.

T

Re: [Intel-gfx] [PATCH] drm/i915: set proper N/M in modeset

2016-07-28 Thread Yang, Libin
Hi all,

Is there anyone can help review this patch? This patch is set N/M for audio in 
DP 4k resolution. Thanks.

I calculate these values based on the DP1.2 spec chapter 6.6 on page 469:
Maud / Naud = 512 * fs / f_LS_Clk

Regards,
Libin


> -Original Message-
> From: libin.y...@linux.intel.com [mailto:libin.y...@linux.intel.com]
> Sent: Thursday, July 14, 2016 3:06 PM
> To: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com;
> ville.syrj...@linux.intel.com; Vetter, Daniel <daniel.vet...@intel.com>;
> ti...@suse.de
> Cc: Yang, Libin <libin.y...@intel.com>; Libin Yang
> <libin.y...@linux.intel.com>
> Subject: [PATCH] drm/i915: set proper N/M in modeset
> 
> From: Libin Yang <libin.y...@linux.intel.com>
> 
> When modeset occurs and the LS_CLK is set to some special values in DP
> mode, the N/M need to be set manually if audio is playing.
> 
> Also, the patch applies
> commit 7e8275c2f2bb ("drm/i915: set proper N/CTS in modeset") to APL
> platform.
> 
> Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_reg.h|   6 ++
>  drivers/gpu/drm/i915/intel_audio.c | 116
> -
>  2 files changed, 108 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_reg.h
> b/drivers/gpu/drm/i915/i915_reg.h index 8bfde75..2f9d00e 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -7351,6 +7351,12 @@ enum {
>  #define _HSW_AUD_CONFIG_B0x65100
>  #define HSW_AUD_CFG(pipe)_MMIO_PIPE(pipe,
> _HSW_AUD_CONFIG_A, _HSW_AUD_CONFIG_B)
> 
> +#define _HSW_AUD_M_CTS_ENABLE_A  0x65028
> +#define _HSW_AUD_M_CTS_ENABLE_B  0x65128
> +#define HSW_AUD_M_CTS_ENABLE(pipe)   _MMIO_PIPE(pipe,
> _HSW_AUD_M_CTS_ENABLE_A, _HSW_AUD_M_CTS_ENABLE_B)
> +#define   AUD_M_CTS_M_VALUE_INDEX(1 << 21)
> +#define   AUD_M_CTS_M_PROG_ENABLE(1 << 20)
> +
>  #define _HSW_AUD_MISC_CTRL_A 0x65010
>  #define _HSW_AUD_MISC_CTRL_B 0x65110
>  #define HSW_AUD_MISC_CTRL(pipe)  _MMIO_PIPE(pipe,
> _HSW_AUD_MISC_CTRL_A, _HSW_AUD_MISC_CTRL_B)
> diff --git a/drivers/gpu/drm/i915/intel_audio.c
> b/drivers/gpu/drm/i915/intel_audio.c
> index 6700a7b..e2e4d4b 100644
> --- a/drivers/gpu/drm/i915/intel_audio.c
> +++ b/drivers/gpu/drm/i915/intel_audio.c
> @@ -98,6 +98,22 @@ static const struct {
>   { 192000, TMDS_297M, 20480, 247500 },
>  };
> 
> +#define LC_533M 533250
> +#define LC_148M 148500
> +static const struct {
> + int sample_rate;
> + int clock;
> + int n;
> + int m;
> +} aud_nm[] = {
> + {48000, LC_533M, 88875, 4096},
> + {44100, LC_533M, 148125, 6272},
> + {32000, LC_533M, 266625, 8192},
> + {48000, LC_148M, 12375, 2048},
> + {44100, LC_148M, 20625, 3136},
> + {32000, LC_148M, 37125, 4096},
> +};
> +
>  /* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */  static u32
> audio_config_hdmi_pixel_clock(const struct drm_display_mode
> *adjusted_mode)  { @@ -121,20 +137,50 @@ static u32
> audio_config_hdmi_pixel_clock(const struct drm_display_mode *adjusted
>   return hdmi_audio_clock[i].config;
>  }
> 
> -static int audio_config_get_n(const struct drm_display_mode *mode, int
> rate)
> +static int audio_config_get_n(struct intel_crtc *crtc,
> +   const struct drm_display_mode *mode, int rate) {
> + int i;
> +
> + if (intel_crtc_has_type(crtc->config, INTEL_OUTPUT_HDMI)) {
> + for (i = 0; i < ARRAY_SIZE(aud_ncts); i++) {
> + if ((rate == aud_ncts[i].sample_rate) &&
> + (mode->clock == aud_ncts[i].clock)) {
> + return aud_ncts[i].n;
> + }
> + }
> + }
> +
> + if (intel_crtc_has_type(crtc->config, INTEL_OUTPUT_DP)) {
> + for (i = 0; i < ARRAY_SIZE(aud_nm); i++) {
> + if ((rate == aud_nm[i].sample_rate) &&
> + (mode->clock == aud_nm[i].clock)) {
> + return aud_nm[i].n;
> + }
> + }
> + }
> + return 0;
> +}
> +
> +static int audio_config_get_m(struct intel_crtc *crtc,
> +   const struct drm_display_mode *mode, int rate)
>  {
>   int i;
> 
> - for (i = 0; i < ARRAY_SIZE(aud_ncts); i++) {
> - if ((rate == aud_ncts[i].sample_rate) &&
> - (mode->clock == aud_ncts[i].clock)) {
> - return aud_ncts[i].n;
&g

Re: [Intel-gfx] ✗ Ro.CI.BAT: failure for drm/i915: set proper N/M in modeset

2016-07-18 Thread Yang, Libin
Hi All,

I submitted a patch and it show to fail in CI.

Does the message means it is failed because of "ro-bdw-i7-5557U failed to 
connect after reboot". And how can I get the dmesg?

Regards,
Libin


> -Original Message-
> From: Intel-gfx [mailto:intel-gfx-boun...@lists.freedesktop.org] On Behalf Of
> Patchwork
> Sent: Thursday, July 14, 2016 3:39 PM
> To: libin.y...@linux.intel.com
> Cc: intel-gfx@lists.freedesktop.org
> Subject: [Intel-gfx] ✗ Ro.CI.BAT: failure for drm/i915: set proper N/M in
> modeset
> 
> == Series Details ==
> 
> Series: drm/i915: set proper N/M in modeset
> URL   : https://patchwork.freedesktop.org/series/9857/
> State : failure
> 
> == Summary ==
> 
> Series 9857v1 drm/i915: set proper N/M in modeset
> http://patchwork.freedesktop.org/api/1.0/series/9857/revisions/1/mbox
> 
> Test drv_module_reload_basic:
> dmesg-warn -> SKIP   (fi-skl-i5-6260u)
> Test kms_pipe_crc_basic:
> Subgroup suspend-read-crc-pipe-b:
> pass   -> DMESG-WARN (ro-skl3-i5-6260u)
> Test prime_self_import:
> Subgroup basic-with_fd_dup:
> pass   -> INCOMPLETE (ro-byt-n2820)
> Subgroup basic-with_one_bo_two_files:
> pass   -> INCOMPLETE (ro-byt-n2820)
> Subgroup basic-with_two_bos:
> pass   -> INCOMPLETE (ro-byt-n2820)
> 
> fi-kbl-qkkr  total:237  pass:174  dwarn:27  dfail:2   fail:7   skip:27
> fi-skl-i5-6260u  total:237  pass:189  dwarn:26  dfail:2   fail:7   skip:13
> fi-skl-i7-6700k  total:237  pass:200  dwarn:2   dfail:0   fail:9   skip:26
> fi-snb-i7-2600   total:237  pass:188  dwarn:0   dfail:0   fail:9   skip:40
> ro-bdw-i5-5250u  total:237  pass:210  dwarn:2   dfail:0   fail:9   skip:16
> ro-bdw-i7-5600u  total:237  pass:195  dwarn:2   dfail:0   fail:9   skip:31
> ro-bsw-n3050 total:217  pass:170  dwarn:0   dfail:0   fail:4   skip:42
> ro-byt-n2820 total:237  pass:174  dwarn:0   dfail:0   fail:7   skip:38
> ro-hsw-i3-4010u  total:237  pass:199  dwarn:5   dfail:2   fail:7   skip:24
> ro-hsw-i7-4770r  total:237  pass:204  dwarn:0   dfail:0   fail:9   skip:24
> ro-ilk-i7-620lm  total:237  pass:166  dwarn:0   dfail:0   fail:8   skip:63
> ro-ilk1-i5-650   total:232  pass:166  dwarn:0   dfail:0   fail:8   skip:58
> ro-ivb-i7-3770   total:237  pass:197  dwarn:0   dfail:0   fail:7   skip:33
> ro-skl3-i5-6260u total:237  pass:212  dwarn:4   dfail:0   fail:9   skip:12
> ro-snb-i7-2620M  total:237  pass:187  dwarn:0   dfail:0   fail:9   skip:41
> ro-bdw-i7-5557U failed to connect after reboot
> 
> Results at /archive/results/CI_IGT_test/RO_Patchwork_1490/
> 
> 5cd2699 drm-intel-nightly: 2016y-07m-13d-14h-43m-27s UTC integration
> manifest 9ea6eab drm/i915: set proper N/M in modeset
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: Acquire intel_runtime_pm for HD-Audio registers

2016-07-16 Thread Yang, Libin
Hi Wilson,

Thanks for tell the details.

SKL is different from HSW/BDW.

HSW/BDW has 2 audio controllers. One is in PCH and another is in gfx.
SKL has one controller, which is in PCH.

Both HSW/BDW and SKL has display audio codec in gfx.

For HSW/BDW, to use the controller inside gfx, we must get the gfx power.
For SKL, to use the controller, we don't need to get the gfx power.
For both HSW/BDW and SKL, to use display audio codec, we must get the gfx power.

Without the patch, all the audio controllers except BYT/BSW will get the gfx 
power.
However this is not true, SKL and APL audio controller don't need this power.
-   /* Baytral/Braswell controllers don't need this power */
-   if (pci->device != 0x0f04 && pci->device != 0x2284)
+   /* HSW/BDW controllers need this power */
+   if (CONTROLLER_IN_GPU(pci))
hda->need_i915_power = 1;

For skl, it need to get gfx power only when display audio codec is used, this is
set in the patch:
+   if (is_valleyview_plus(codec) || is_skylake(codec))
codec->core.link_power_control = 1;

Without the patch, SKL may consume gfx power even it doesn't need.

This patch has been tested by our full test cases for about one year,
it shows the right result. Do you think maybe there is another recent
patch cause this issue? I will debug the Bugzilla next week on audio side.

Regards,
Libin


> -Original Message-
> From: Chris Wilson [mailto:ch...@chris-wilson.co.uk]
> Sent: Friday, July 15, 2016 4:45 PM
> To: Yang, Libin <libin.y...@intel.com>
> Cc: Mika Kuoppala <mika.kuopp...@linux.intel.com>; intel-
> g...@lists.freedesktop.org; Takashi Iwai <ti...@suse.de>
> Subject: Re: [Intel-gfx] [PATCH] drm/i915: Acquire intel_runtime_pm for HD-
> Audio registers
> 
> On Fri, Jul 15, 2016 at 02:40:42AM +, Yang, Libin wrote:
> > Hi Wilson,
> >
> > > -Original Message-
> > > From: Chris Wilson [mailto:ch...@chris-wilson.co.uk]
> > > Sent: Thursday, July 14, 2016 10:34 PM
> > > To: Mika Kuoppala <mika.kuopp...@linux.intel.com>; intel-
> > > g...@lists.freedesktop.org; Takashi Iwai <ti...@suse.de>; Yang, Libin
> > > <libin.y...@intel.com>
> > > Subject: Re: [Intel-gfx] [PATCH] drm/i915: Acquire intel_runtime_pm
> > > for HD- Audio registers
> > >
> > > On Wed, Jul 13, 2016 at 05:01:02PM +0300, Marius Vlad wrote:
> > > > Did try when you submitted the patch...but can't seem to replicate
> > > > with latest nightly on other SKLs, and currently do not have
> > > > access on the machine that caused it.
> > >
> > > So fwiw, Hans de Geode confirmed that only reverting 03b135cebc47
> > > (which enables the display powerwell as well) was enough.
> > >
> > > Libin, do you want to handle the revert or explain the mistake in
> >
> > What's the problem with the patch? I can find the details from the email
> thread.
> >
> > HSW/BSW need acquire the power because it is inside the gpu. So we
> > limited need i915 power for controller to HSW/BDW.
> 
> Please see
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96214
> 
> Judging from the reports, Skylake uses the same display powerwell as
> HSW/BDW.
> -Chris
> 
> --
> Chris Wilson, Intel Open Source Technology Centre
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: Acquire intel_runtime_pm for HD-Audio registers

2016-07-14 Thread Yang, Libin
Hi Wilson,

> -Original Message-
> From: Chris Wilson [mailto:ch...@chris-wilson.co.uk]
> Sent: Thursday, July 14, 2016 10:34 PM
> To: Mika Kuoppala <mika.kuopp...@linux.intel.com>; intel-
> g...@lists.freedesktop.org; Takashi Iwai <ti...@suse.de>; Yang, Libin
> <libin.y...@intel.com>
> Subject: Re: [Intel-gfx] [PATCH] drm/i915: Acquire intel_runtime_pm for HD-
> Audio registers
> 
> On Wed, Jul 13, 2016 at 05:01:02PM +0300, Marius Vlad wrote:
> > Did try when you submitted the patch...but can't seem to replicate
> > with latest nightly on other SKLs, and currently do not have access on
> > the machine that caused it.
> 
> So fwiw, Hans de Geode confirmed that only reverting 03b135cebc47 (which
> enables the display powerwell as well) was enough.
> 
> Libin, do you want to handle the revert or explain the mistake in

What's the problem with the patch? I can find the details from the email thread.

HSW/BSW need acquire the power because it is inside the gpu. So we 
limited need i915 power for controller to HSW/BDW. 

> 
> commit 03b135cebc47d75ea2dc346770374ab741966955
> Author: Libin Yang <libin.y...@intel.com>
> Date:   Wed Jun 3 09:30:15 2015 +0800
> 
> ALSA: hda - remove controller dependency on i915 power well for SKL
> 
> -Chris
> 
> --
> Chris Wilson, Intel Open Source Technology Centre
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] Could you merge the tsc patches directly from Len Brown's public repo?

2016-04-28 Thread Yang, Libin
Does this mean that Len's patches will be merged into upstream except this one?

Regards,
Libin


> -Original Message-
> From: Chen, Yu C
> Sent: Friday, April 29, 2016 9:43 AM
> To: Lu, Han; 'Ville Syrjälä'; Brown, Len
> Cc: 'Daniel Vetter'; Nikula, Jani; Lin, Mengdong; Yang, Libin; Li, Jocelyn;
> 'intel-gfx'; Zhao, Juan J
> Subject: RE: Could you merge the tsc patches directly from Len Brown's
> public repo?
> 
> Please ignore my previous patch(it is incorrect), you can cherry pick Len's
> 8 patches except this one:
> 
> 540cc882de7d1da2e71591e215f0e04cb89883fa
> x86 tsc_msr: Extend to include Intel Core Architecture
> 
> thanks,
> Yu
> 
> > -Original Message-
> > From: Lu, Han
> > Sent: Friday, April 29, 2016 9:38 AM
> > To: 'Ville Syrjälä'; Brown, Len
> > Cc: 'Daniel Vetter'; Nikula, Jani; Lin, Mengdong; Yang, Libin; Li, Jocelyn;
> 'intel-
> > gfx'; Chen, Yu C; Zhao, Juan J
> > Subject: RE: Could you merge the tsc patches directly from Len Brown's
> public
> > repo?
> >
> > +Juan
> >
> > Hi Yu,
> >
> > Do you have any update on your patches? We need a solution to fix the
> > SandyBridge hang asap, then Daniel and Jani can help to cherry-pick the
> tsc
> > patches to drm-intel repo.
> >
> > BR,
> > Han Lu
> >
> > > -Original Message-
> > > From: Lu, Han
> > > Sent: Wednesday, April 27, 2016 1:18 PM
> > > To: Ville Syrjälä <ville.syrj...@linux.intel.com>; Brown, Len
> > > <len.br...@intel.com>
> > > Cc: Daniel Vetter <daniel.vet...@ffwll.ch>; Nikula, Jani
> > > <jani.nik...@intel.com>; Lin, Mengdong <mengdong@intel.com>;
> Yang,
> > > Libin <libin.y...@intel.com>; Li, Jocelyn <jocelyn...@intel.com>;
> > > intel-gfx <intel-gfx@lists.freedesktop.org>; Chen, Yu C
> > > <yu.c.c...@intel.com>
> > > Subject: RE: Could you merge the tsc patches directly from Len
> Brown's
> > > public repo?
> > >
> > > Hi Len,
> > >
> > > Could you please share if you have any following plan to fix the
> > > hard-hang on SandyBridge? Will you modify patch
> > > 540cc882de7d1da2e71591e215f0e04cb89883fa and update your
> public repo?
> > > Thanks.
> > >
> > > BR,
> > > Han Lu
> > >
> > > > -Original Message-
> > > > From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> > > > Sent: Wednesday, April 27, 2016 12:36 AM
> > > > To: Brown, Len <len.br...@intel.com>
> > > > Cc: Daniel Vetter <daniel.vet...@ffwll.ch>; Lu, Han
> > > > <han...@intel.com>; Nikula, Jani <jani.nik...@intel.com>; Lin,
> > > > Mengdong <mengdong@intel.com>; Yang, Libin
> > > > <libin.y...@intel.com>; Li, Jocelyn <jocelyn...@intel.com>;
> > > > intel-gfx <intel-gfx@lists.freedesktop.org>
> > > > Subject: Re: Could you merge the tsc patches directly from Len
> > > > Brown's public repo?
> > > >
> > > > On Tue, Apr 26, 2016 at 06:46:23AM +, Brown, Len wrote:
> > > > > > On Wed, Apr 20, 2016 at 11:24 AM, Daniel Vetter
> > > > > > <daniel.vet...@ffwll.ch>
> > > > > > wrote:
> > > > > > > On Wed, Apr 20, 2016 at 10:26 AM, Lu, Han
> <han...@intel.com>
> > wrote:
> > > > > > >> Hi Jani,
> > > > > > >>
> > > > > > >> Please find the repo and commit id below:
> > > > > > >> Repo:
> > > > > > >> https://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux.gi
> > > > > > >> t
> > > > > > >> Branch: x86
> > > > > > >> Commit id (begin from earliest):
> > > > > > >> 6e0c25e64e0fb65a42dfc63ad5f660302e07cd87
> > > > > > >> 16caa2834b2f08cdfd130baa490c45822edef256
> > > > > > >> ce5c7b5eaad93c7b0043a7509eec319fe0a0e8a0
> > > > > > >> ca376a9909f1151484854c46dc7f01be6d6d9bdb
> > > > > > >> 4a62ba36cf4fb77ea35dee1f5992e0e7c48dad14
> > > > > > >> 540cc882de7d1da2e71591e215f0e04cb89883fa
> > > > > > >> 433f82c8ab3fcaa7ff3b852d01cc74dbdf6d94f1
> > > > > > >> 65ae86d4fa3473d24445ea402b190e4b4342172e
> > > > > > >> 

Re: [Intel-gfx] [PATCH] drm/i915: intel_audio clear eld buf when disconnecting monitor

2016-03-21 Thread Yang, Libin
Hi Takashi,

> -Original Message-
> From: Takashi Iwai [mailto:ti...@suse.de]
> Sent: Monday, March 21, 2016 11:30 PM
> To: Yang, Libin
> Cc: libin.y...@linux.intel.com; intel-gfx@lists.freedesktop.org;
> conselv...@gmail.com; jani.nik...@linux.intel.com;
> ville.syrj...@linux.intel.com; Vetter, Daniel
> Subject: Re: [PATCH] drm/i915: intel_audio clear eld buf when
> disconnecting monitor
> 
> On Mon, 21 Mar 2016 16:19:31 +0100,
> Takashi Iwai wrote:
> >
> > On Mon, 21 Mar 2016 16:12:05 +0100,
> > Takashi Iwai wrote:
> > >
> > > On Mon, 21 Mar 2016 16:00:21 +0100,
> > > Takashi Iwai wrote:
> > > >
> > > > On Mon, 21 Mar 2016 15:17:37 +0100,
> > > > Yang, Libin wrote:
> > > > >
> > > > >
> > > > > > -Original Message-
> > > > > > From: Takashi Iwai [mailto:ti...@suse.de]
> > > > > > Sent: Monday, March 21, 2016 6:45 PM
> > > > > > To: libin.y...@linux.intel.com
> > > > > > Cc: intel-gfx@lists.freedesktop.org; conselv...@gmail.com;
> > > > > > jani.nik...@linux.intel.com; ville.syrj...@linux.intel.com; Vetter,
> Daniel;
> > > > > > ti...@suse.de; Yang, Libin
> > > > > > Subject: Re: [PATCH] drm/i915: intel_audio clear eld buf when
> > > > > > disconnecting monitor
> > > > > >
> > > > > > On Mon, 21 Mar 2016 06:03:29 +0100,
> > > > > > libin.y...@linux.intel.com wrote:
> > > > > > >
> > > > > > > From: Libin Yang <libin.y...@linux.intel.com>
> > > > > > >
> > > > > > > When disconnecting monitor, dev_priv->dig_port_map[port]
> > > > > > > will be set NULL, which causes eld will not be updated in
> > > > > > > i915_audio_component_get_eld().
> > > > > > >
> > > > > > > This patch clears the eld buf when dev_priv-
> >dig_port_map[port]
> > > > > > > is NULL.
> > > > > > >
> > > > > > > Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> > > > > >
> > > > > > While this isn't certainly bad, I don't think it's mandatory.  The
> > > > > > function returns zero, i.e. no data is copied.  So the caller
> > > > > > shouldn't expect that the buffer is cleared in this case.
> > > > >
> > > > > Without the patch, we find when unplug the monitor, the eld info
> > > > > will not be updated. The means the eld info in the procfs still
> remains
> > > > > the old info after the monitor is disconnected.
> > > >
> > > > Well, it's not about zero-clear but rather because the function
> > > > returns an error (-EINVAL), and the caller takes it too seriously.
> > > > Upon receiving an error code, the HDA driver doesn't read ELD at all,
> > > > so it won't help even if you do zero-clear there.
> > > >
> > > > The alternative fix patch is below.
> > >
> > > ... or we can fix it in HDA side like below, too.
> >
> > This patch won't be applied cleanly on the upstream tree as I wrote it
> > on the my working tree, sorry.  Below is the revised one that is
> > applicable to upstream tree.
> 
> Gah, a typo was included in this patch, too.  Sorry, the correct one
> is attached below.

Yes. The patch seems more reasonable than mine.

Do we still need the patch to set i915_audio_component_get_eld()
return value to 0? It seems -EINVAL makes sense.

Regards,
Libin

> 
> 
> Takashi -- obviously needs a coffee break
> 
> -- 8< --
> From: Takashi Iwai <ti...@suse.de>
> Subject: [PATCH v3] ALSA: hda - Fix missing ELD update at unplugging
> 
> i915 get_eld ops may return an error when no encoder is connected, and
> currently we regard the error as fatal and skip the whole ELD
> handling.  This ended up with the missing ELD update at unplugging.
> 
> This patch fixes the issue by treating the error as the unplugged
> state, instead of skipping the rest.
> 
> Reported-by: Libin Yang <libin.y...@linux.intel.com>
> Cc: <sta...@vger.kernel.org> # v4.5
> Signed-off-by: Takashi Iwai <ti...@suse.de>
> ---
>  sound/pci/hda/patch_hdmi.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
> index 7ae614d27954..5af372d01834 100644
> --- a/sound/pci/hda/patch_hdmi.c
> +++ b/sound/pci/hda/patch_hdmi.c
> @@ -1484,11 +1484,10 @@ static void sync_eld_via_acomp(struct
> hda_codec *codec,
>   int size;
> 
>   mutex_lock(_pin->lock);
> + eld->monitor_present = false;
>   size = snd_hdac_acomp_get_eld(>bus->core, per_pin-
> >pin_nid,
> >monitor_present, eld-
> >eld_buffer,
> ELD_MAX_SIZE);
> - if (size < 0)
> - goto unlock;
>   if (size > 0) {
>   size = min(size, ELD_MAX_SIZE);
>   if (snd_hdmi_parse_eld(codec, >info,
> --
> 2.7.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: intel_audio clear eld buf when disconnecting monitor

2016-03-21 Thread Yang, Libin

> -Original Message-
> From: Takashi Iwai [mailto:ti...@suse.de]
> Sent: Monday, March 21, 2016 6:45 PM
> To: libin.y...@linux.intel.com
> Cc: intel-gfx@lists.freedesktop.org; conselv...@gmail.com;
> jani.nik...@linux.intel.com; ville.syrj...@linux.intel.com; Vetter, Daniel;
> ti...@suse.de; Yang, Libin
> Subject: Re: [PATCH] drm/i915: intel_audio clear eld buf when
> disconnecting monitor
> 
> On Mon, 21 Mar 2016 06:03:29 +0100,
> libin.y...@linux.intel.com wrote:
> >
> > From: Libin Yang <libin.y...@linux.intel.com>
> >
> > When disconnecting monitor, dev_priv->dig_port_map[port]
> > will be set NULL, which causes eld will not be updated in
> > i915_audio_component_get_eld().
> >
> > This patch clears the eld buf when dev_priv->dig_port_map[port]
> > is NULL.
> >
> > Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> 
> While this isn't certainly bad, I don't think it's mandatory.  The
> function returns zero, i.e. no data is copied.  So the caller
> shouldn't expect that the buffer is cleared in this case.

Without the patch, we find when unplug the monitor, the eld info
will not be updated. The means the eld info in the procfs still remains
the old info after the monitor is disconnected.

> 
> Actually, if we do zero-clear, a safer fix would be to do it at the
> beginning.  The similar "leak" can be seen, as we do memcpy() only for
> drm_eld_size() bytes at max.

OK. I will clear at the beginning.

> 
> 
> thanks,
> 
> Takashi
> 
> > ---
> >  drivers/gpu/drm/i915/intel_audio.c | 7 +++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> b/drivers/gpu/drm/i915/intel_audio.c
> > index fdc8b2a..9d3879e 100644
> > --- a/drivers/gpu/drm/i915/intel_audio.c
> > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > @@ -732,6 +732,13 @@ static int
> i915_audio_component_get_eld(struct device *dev, int port,
> > ret = drm_eld_size(eld);
> > memcpy(buf, eld, min(max_bytes, ret));
> > }
> > +   } else {
> > +   /* dev_priv->dig_port_map[port] will be set NULL in
> > +* intel_audio_codec_disable when disconnecting
> monitor.
> > +* We need clear the eld buf.
> > +*/
> > +   memset(buf, 0, max_bytes);
> > +   ret = 0;
> > }
> >
> > mutex_unlock(_priv->av_mutex);
> > --
> > 1.9.1
> >
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: add audio_ptr pointer check

2016-03-02 Thread Yang, Libin
Hi Takashi,

> -Original Message-
> From: Takashi Iwai [mailto:ti...@suse.de]
> Sent: Wednesday, March 02, 2016 4:57 PM
> To: Yang, Libin
> Cc: libin.y...@linux.intel.com; intel-gfx@lists.freedesktop.org;
> conselv...@gmail.com; jani.nik...@linux.intel.com;
> ville.syrj...@linux.intel.com; Vetter, Daniel
> Subject: Re: [PATCH] drm/i915: add audio_ptr pointer check
> 
> On Wed, 02 Mar 2016 08:59:23 +0100,
> Yang, Libin wrote:
> >
> > Hi Takashi,
> >
> > > -Original Message-
> > > From: Takashi Iwai [mailto:ti...@suse.de]
> > > Sent: Wednesday, March 02, 2016 3:44 PM
> > > To: libin.y...@linux.intel.com
> > > Cc: intel-gfx@lists.freedesktop.org; conselv...@gmail.com;
> > > jani.nik...@linux.intel.com; ville.syrj...@linux.intel.com; Vetter,
> Daniel;
> > > ti...@suse.de; Yang, Libin
> > > Subject: Re: [PATCH] drm/i915: add audio_ptr pointer check
> > >
> > > On Wed, 02 Mar 2016 03:24:31 +0100,
> > > libin.y...@linux.intel.com wrote:
> > > >
> > > > From: Libin Yang <libin.y...@linux.intel.com>
> > > >
> > > > check to make sure audio_ptr is not NULL before
> > > > using it.
> > >
> > > I don't think non-NULL is mandatory.  If any invalid access is seen,
> > > it should be fixed rather in the audio side.
> >
> > When I enable MST with other patches (not submitted so far),
> > I found system may be random hang when boot up.
> >
> > After apply this patch and another patch (I sent the patch in
> > ALSA Mail list: ALSA: hda - hdmi defer to register acomp eld notifier),
> > the hang issue is fixed.
> >
> > I make the patch because in sound driver side, setting audio_ptr and
> > audio_ops is not in the lock. I'm wondering that the compiler or CPU
> > may optimize and change the setting order (the gfx code and alsa code
> > may run parallelly?).
> 
> There are several ways to deal with such a thing.  An easy one would
> be the memory barrier.

Yes, agree to use mb. It will be easier and safer.

I think wmb() should be enough for this case, right?

I will do the stress test on mb.

Regards,
Libin

> 
> 
> Takashi
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: add audio_ptr pointer check

2016-03-02 Thread Yang, Libin
Hi Takashi,

> -Original Message-
> From: Takashi Iwai [mailto:ti...@suse.de]
> Sent: Wednesday, March 02, 2016 3:44 PM
> To: libin.y...@linux.intel.com
> Cc: intel-gfx@lists.freedesktop.org; conselv...@gmail.com;
> jani.nik...@linux.intel.com; ville.syrj...@linux.intel.com; Vetter, Daniel;
> ti...@suse.de; Yang, Libin
> Subject: Re: [PATCH] drm/i915: add audio_ptr pointer check
> 
> On Wed, 02 Mar 2016 03:24:31 +0100,
> libin.y...@linux.intel.com wrote:
> >
> > From: Libin Yang <libin.y...@linux.intel.com>
> >
> > check to make sure audio_ptr is not NULL before
> > using it.
> 
> I don't think non-NULL is mandatory.  If any invalid access is seen,
> it should be fixed rather in the audio side.

When I enable MST with other patches (not submitted so far),
I found system may be random hang when boot up.

After apply this patch and another patch (I sent the patch in
ALSA Mail list: ALSA: hda - hdmi defer to register acomp eld notifier),
the hang issue is fixed.

I make the patch because in sound driver side, setting audio_ptr and
audio_ops is not in the lock. I'm wondering that the compiler or CPU
may optimize and change the setting order (the gfx code and alsa code
may run parallelly?).

Regards,
Libin

> 
> 
> thanks,
> 
> Takashi
> 
> >
> > Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_audio.c | 6 --
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> b/drivers/gpu/drm/i915/intel_audio.c
> > index 31f6d21..667596d 100644
> > --- a/drivers/gpu/drm/i915/intel_audio.c
> > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > @@ -529,7 +529,8 @@ void intel_audio_codec_enable(struct
> intel_encoder *intel_encoder)
> > intel_dig_port->audio_connector = connector;
> > mutex_unlock(_priv->av_mutex);
> >
> > -   if (acomp && acomp->audio_ops && acomp->audio_ops-
> >pin_eld_notify)
> > +   if (acomp && acomp->audio_ops && acomp->audio_ops-
> >pin_eld_notify &&
> > +   acomp->audio_ops->audio_ptr)
> > acomp->audio_ops->pin_eld_notify(acomp->audio_ops-
> >audio_ptr, (int) port);
> >  }
> >
> > @@ -556,7 +557,8 @@ void intel_audio_codec_disable(struct
> intel_encoder *intel_encoder)
> > intel_dig_port->audio_connector = NULL;
> > mutex_unlock(_priv->av_mutex);
> >
> > -   if (acomp && acomp->audio_ops && acomp->audio_ops-
> >pin_eld_notify)
> > +   if (acomp && acomp->audio_ops && acomp->audio_ops-
> >pin_eld_notify &&
> > +   acomp->audio_ops->audio_ptr)
> > acomp->audio_ops->pin_eld_notify(acomp->audio_ops-
> >audio_ptr, (int) port);
> >  }
> >
> > --
> > 1.9.1
> >
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 1/2] drm/i915: fix get digital port issue in intel_audio

2016-01-07 Thread Yang, Libin
Hi Ville,

> -Original Message-
> From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> Sent: Friday, January 08, 2016 12:50 AM
> To: libin.y...@linux.intel.com
> Cc: intel-gfx@lists.freedesktop.org; conselv...@gmail.com;
> jani.nik...@linux.intel.com; Vetter, Daniel; ti...@suse.de; Yang, Libin
> Subject: Re: [PATCH 1/2] drm/i915: fix get digital port issue in intel_audio
> 
> On Wed, Jan 06, 2016 at 10:26:41AM +0800, libin.y...@linux.intel.com
> wrote:
> > From: Libin Yang <libin.y...@linux.intel.com>
> >
> > For DP MST, use enc_to_mst(encoder)->primary to get
> intel_digital_port,
> > instead of using enc_to_dig_port(encoder).
> >
> > Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_audio.c | 21 +
> >  1 file changed, 17 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> b/drivers/gpu/drm/i915/intel_audio.c
> > index 31f6d21..431487a0 100644
> > --- a/drivers/gpu/drm/i915/intel_audio.c
> > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > @@ -187,6 +187,16 @@ static bool intel_eld_uptodate(struct
> drm_connector *connector,
> > return true;
> >  }
> >
> > +static struct intel_digital_port *
> > +intel_encoder_to_dig_port(struct intel_encoder *intel_encoder)
> > +{
> > +   struct drm_encoder *encoder = _encoder->base;
> > +
> > +   if (intel_encoder->type == INTEL_OUTPUT_DP_MST)
> > +   return enc_to_mst(encoder)->primary;
> > +   return enc_to_dig_port(encoder);
> > +}
> > +
> >  static void g4x_audio_codec_disable(struct intel_encoder *encoder)
> >  {
> > struct drm_i915_private *dev_priv = encoder->base.dev-
> >dev_private;
> > @@ -286,7 +296,7 @@ static void hsw_audio_codec_enable(struct
> drm_connector *connector,
> > struct i915_audio_component *acomp = dev_priv-
> >audio_component;
> > const uint8_t *eld = connector->eld;
> > struct intel_digital_port *intel_dig_port =
> > -   enc_to_dig_port(>base);
> > +   intel_encoder_to_dig_port(encoder);
> 
> This hunk makes sense since we just look at intel_dig_port->port. Might
> make sense to entirely eliminate the local inte_dig_port variable from
> these hooks so that there's no confusion whether it points at the fake
> or primary encoder.

Do you mean we can still use enc_to_dig_port()? Maybe the new code
is better. What do you think we use the wrapper
intel_encoder_to_dig_port() here?

> 
> > enum port port = intel_dig_port->port;
> > uint32_t tmp;
> > int len, i;
> > @@ -500,7 +510,8 @@ void intel_audio_codec_enable(struct
> intel_encoder *intel_encoder)
> > struct drm_device *dev = encoder->dev;
> > struct drm_i915_private *dev_priv = dev->dev_private;
> > struct i915_audio_component *acomp = dev_priv-
> >audio_component;
> > -   struct intel_digital_port *intel_dig_port =
> enc_to_dig_port(encoder);
> > +   struct intel_digital_port *intel_dig_port =
> > +   intel_encoder_to_dig_port(intel_encoder);
> > enum port port = intel_dig_port->port;
> >
> > connector = drm_select_eld(encoder);
> > @@ -546,7 +557,8 @@ void intel_audio_codec_disable(struct
> intel_encoder *intel_encoder)
> > struct drm_device *dev = encoder->dev;
> > struct drm_i915_private *dev_priv = dev->dev_private;
> > struct i915_audio_component *acomp = dev_priv-
> >audio_component;
> > -   struct intel_digital_port *intel_dig_port =
> enc_to_dig_port(encoder);
> > +   struct intel_digital_port *intel_dig_port =
> > +   intel_encoder_to_dig_port(intel_encoder);
> 
> > enum port port = intel_dig_port->port;
> >
> > if (dev_priv->display.audio_codec_disable)
> > @@ -724,7 +736,8 @@ static int
> i915_audio_component_get_eld(struct device *dev, int port,
> > /* intel_encoder might be NULL for DP MST */
> > if (intel_encoder) {
> > ret = 0;
> > -   intel_dig_port = enc_to_dig_port(_encoder-
> >base);
> > +   intel_dig_port =
> > +   intel_encoder_to_dig_port(intel_encoder);
> > *enabled = intel_dig_port->audio_connector != NULL;
> 
> These not so much. We'd clobber 'intel_dig_port->audio_connector' for
> the primary encoder whenever a new MST stream is enabled.

Yes. If we are using i915_audio_component_get_eld() for MST audio,
we need a parameter device_entry_id in the function. I remember
David has sent a patch to supp

Re: [Intel-gfx] [PATCH 2/2] drm/i915: add dp mst judgement in hsw_audio_codec_enable

2016-01-05 Thread Yang, Libin
Hi Ville,

> -Original Message-
> From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> Sent: Tuesday, January 05, 2016 12:03 AM
> To: libin.y...@linux.intel.com
> Cc: intel-gfx@lists.freedesktop.org; conselv...@gmail.com;
> ti...@suse.de; jani.nik...@linux.intel.com; Vetter, Daniel; Yang, Libin
> Subject: Re: [PATCH 2/2] drm/i915: add dp mst judgement in
> hsw_audio_codec_enable
> 
> On Wed, Dec 23, 2015 at 02:50:47PM +0800, libin.y...@linux.intel.com
> wrote:
> > From: Libin Yang <libin.y...@linux.intel.com>
> >
> > hsw platforms supports DP MST while ilk doesn't.
> > This patch fixes the bug.
> >
> > Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_audio.c | 16 +---
> >  1 file changed, 9 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> b/drivers/gpu/drm/i915/intel_audio.c
> > index 431487a0..f46fa7b 100644
> > --- a/drivers/gpu/drm/i915/intel_audio.c
> > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > @@ -255,6 +255,11 @@ static void g4x_audio_codec_enable(struct
> drm_connector *connector,
> > I915_WRITE(G4X_AUD_CNTL_ST, tmp);
> >  }
> >
> > +/* pipe type is DP SST or DP MST */
> > +#define intel_pipe_is_dp(intel_crtc) \
> > +   (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT)
> || \
> > +intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DP_MST))
> > +
> 
> crtc->config->has_dp_encoder should be good enough for all platforms.
> 
> Though I have some plans to eliminate it, but that doesn't mean we can't
> use it in the meantime.

Thanks. I have verified your method and it works. I will send the refined
patches.

Regards,
Libin

> 
> >  static void hsw_audio_codec_disable(struct intel_encoder *encoder)
> >  {
> > struct drm_i915_private *dev_priv = encoder->base.dev-
> >dev_private;
> > @@ -272,8 +277,7 @@ static void hsw_audio_codec_disable(struct
> intel_encoder *encoder)
> > tmp |= AUD_CONFIG_N_PROG_ENABLE;
> > tmp &= ~AUD_CONFIG_UPPER_N_MASK;
> > tmp &= ~AUD_CONFIG_LOWER_N_MASK;
> > -   if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT)
> ||
> > -   intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DP_MST))
> > +   if (intel_pipe_is_dp(intel_crtc))
> > tmp |= AUD_CONFIG_N_VALUE_INDEX;
> > I915_WRITE(HSW_AUD_CFG(pipe), tmp);
> >
> > @@ -339,7 +343,7 @@ static void hsw_audio_codec_enable(struct
> drm_connector *connector,
> > tmp = I915_READ(HSW_AUD_CFG(pipe));
> > tmp &= ~AUD_CONFIG_N_VALUE_INDEX;
> > tmp &= ~AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK;
> > -   if (intel_pipe_has_type(intel_crtc,
> INTEL_OUTPUT_DISPLAYPORT))
> > +   if (intel_pipe_is_dp(intel_crtc))
> > tmp |= AUD_CONFIG_N_VALUE_INDEX;
> > else
> > tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
> > @@ -486,8 +490,7 @@ static void ilk_audio_codec_enable(struct
> drm_connector *connector,
> > tmp &= ~AUD_CONFIG_N_VALUE_INDEX;
> > tmp &= ~AUD_CONFIG_N_PROG_ENABLE;
> > tmp &= ~AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK;
> > -   if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT)
> ||
> > -   intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DP_MST))
> > +   if (intel_pipe_has_type(intel_crtc,
> INTEL_OUTPUT_DISPLAYPORT))
> > tmp |= AUD_CONFIG_N_VALUE_INDEX;
> > else
> > tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
> > @@ -526,8 +529,7 @@ void intel_audio_codec_enable(struct
> intel_encoder *intel_encoder)
> >
> > /* ELD Conn_Type */
> > connector->eld[5] &= ~(3 << 2);
> > -   if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT) ||
> > -   intel_pipe_has_type(crtc, INTEL_OUTPUT_DP_MST))
> > +   if (intel_pipe_is_dp(crtc))
> > connector->eld[5] |= (1 << 2);
> >
> > connector->eld[6] = drm_av_sync_delay(connector,
> adjusted_mode) / 2;
> > --
> > 1.9.1
> 
> --
> Ville Syrjälä
> Intel OTC
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [V2 PATCH 1/2] dp/mst: add SDP stream support

2015-11-12 Thread Yang, Libin
Hi Jani,

Do you have time to have a review? Thanks.

Regards,
Libin

> -Original Message-
> From: libin.y...@linux.intel.com [mailto:libin.y...@linux.intel.com]
> Sent: Wednesday, November 11, 2015 1:33 PM
> To: intel-gfx@lists.freedesktop.org; jani.nik...@linux.intel.com; Vetter,
> Daniel; ville.syrj...@linux.intel.com
> Cc: Yang, Libin; Libin Yang; Dave Airlie
> Subject: [V2 PATCH 1/2] dp/mst: add SDP stream support
> 
> From: Libin Yang <libin.y...@linux.intel.com>
> 
> This adds code to initialise the SDP streams
> for a sink in the simplest ordering.
> 
> I've no idea how you'd want to control the
> ordering at this level, so don't bother
> until someone comes up with a use case.
> 
> Signed-off-by: Libin Yang <libin.y...@linux.intel.com>
> Signed-off-by: Dave Airlie <airl...@redhat.com>
> ---
>  drivers/gpu/drm/drm_dp_mst_topology.c | 38
> ---
>  include/drm/drm_dp_mst_helper.h   |  7 +--
>  2 files changed, 40 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c
> b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 809959d..f50eb7b 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -666,7 +666,9 @@ static int build_enum_path_resources(struct
> drm_dp_sideband_msg_tx *msg, int por
>  }
> 
>  static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg,
> int port_num,
> -   u8 vcpi, uint16_t pbn)
> +   u8 vcpi, uint16_t pbn,
> +   u8 number_sdp_streams,
> +   u8 *sdp_stream_sink)
>  {
>   struct drm_dp_sideband_msg_req_body req;
>   memset(, 0, sizeof(req));
> @@ -674,6 +676,9 @@ static int build_allocate_payload(struct
> drm_dp_sideband_msg_tx *msg, int port_n
>   req.u.allocate_payload.port_number = port_num;
>   req.u.allocate_payload.vcpi = vcpi;
>   req.u.allocate_payload.pbn = pbn;
> + req.u.allocate_payload.number_sdp_streams =
> number_sdp_streams;
> + memcpy(req.u.allocate_payload.sdp_stream_sink,
> sdp_stream_sink,
> +number_sdp_streams);
>   drm_dp_encode_sideband_req(, msg);
>   msg->path_msg = true;
>   return 0;
> @@ -1562,6 +1567,8 @@ static int drm_dp_payload_send_msg(struct
> drm_dp_mst_topology_mgr *mgr,
>   struct drm_dp_sideband_msg_tx *txmsg;
>   struct drm_dp_mst_branch *mstb;
>   int len, ret;
> + u8 sinks[DRM_DP_MAX_SDP_STREAMS];
> + int i;
> 
>   mstb = drm_dp_get_validated_mstb_ref(mgr, port->parent);
>   if (!mstb)
> @@ -1573,10 +1580,13 @@ static int
> drm_dp_payload_send_msg(struct drm_dp_mst_topology_mgr *mgr,
>   goto fail_put;
>   }
> 
> + for (i = 0; i < port->num_sdp_streams; i++)
> + sinks[i] = i;
> +
>   txmsg->dst = mstb;
>   len = build_allocate_payload(txmsg, port->port_num,
>id,
> -  pbn);
> +  pbn, port->num_sdp_streams, sinks);
> 
>   drm_dp_queue_down_tx(mgr, txmsg);
> 
> @@ -2259,6 +2269,27 @@ out:
>  EXPORT_SYMBOL(drm_dp_mst_detect_port);
> 
>  /**
> + * drm_dp_mst_port_has_audio() - Check whether port has audio
> capability or not
> + * @mgr: manager for this port
> + * @port: unverified pointer to a port.
> + *
> + * This returns whether the port supports audio or not.
> + */
> +bool drm_dp_mst_port_has_audio(struct drm_dp_mst_topology_mgr
> *mgr,
> + struct drm_dp_mst_port *port)
> +{
> + bool ret = false;
> +
> + port = drm_dp_get_validated_port_ref(mgr, port);
> + if (!port)
> + return ret;
> + ret = port->has_audio;
> + drm_dp_put_port(port);
> + return ret;
> +}
> +EXPORT_SYMBOL(drm_dp_mst_port_has_audio);
> +
> +/**
>   * drm_dp_mst_get_edid() - get EDID for an MST port
>   * @connector: toplevel connector to get EDID for
>   * @mgr: manager for this port
> @@ -2283,6 +2314,7 @@ struct edid *drm_dp_mst_get_edid(struct
> drm_connector *connector, struct drm_dp_
>   edid = drm_get_edid(connector, >aux.ddc);
>   drm_mode_connector_set_tile_property(connector);
>   }
> + port->has_audio = drm_detect_monitor_audio(edid);
>   drm_dp_put_port(port);
>   return edid;
>  }
> @@ -2566,7 +2598,7 @@ static void drm_dp_mst_dump_mstb(struct
> seq_file *m,
> 
>   seq_printf(m, "%smst: %p, %d\n", prefix, mstb, mstb-
> >num_ports);
>   list_fo

Re: [Intel-gfx] [PATCH 3/3] drm/i915: add DOC for i915_component

2015-10-07 Thread Yang, Libin
Hi all,

Any comments? Thanks.

Regards,
Libin

> -Original Message-
> From: Yang, Libin
> Sent: Thursday, October 01, 2015 5:01 PM
> To: intel-gfx@lists.freedesktop.org; daniel.vet...@ffwll.ch;
> jani.nik...@linux.intel.com; ville.syrj...@linux.intel.com
> Cc: Yang, Libin
> Subject: [PATCH 3/3] drm/i915: add DOC for i915_component
> 
> From: Libin Yang <libin.y...@intel.com>
> 
> Add the DOC for i915_component.h. Explain the struct
> i915_audio_component_ops and struct
> i915_audio_component_audio_ops
> usage.
> 
> Signed-off-by: Libin Yang <libin.y...@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_audio.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_audio.c
> b/drivers/gpu/drm/i915/intel_audio.c
> index 72d696b..56c2f54 100644
> --- a/drivers/gpu/drm/i915/intel_audio.c
> +++ b/drivers/gpu/drm/i915/intel_audio.c
> @@ -50,6 +50,11 @@
>   * co-operation between the graphics and audio drivers is handled via
> audio
>   * related registers. (The notable exception is the power management,
> not
>   * covered here.)
> + *
> + * The struct i915_audio_component is used to interact between the
> graphics
> + * and audio drivers. The struct i915_audio_component_ops *ops in it
> is
> + * defined in graphics driver and called in audio driver. The
> + * struct i915_audio_component_audio_ops *audio_ops is called
> from i915 driver.
>   */
> 
>  static const struct {
> --
> 1.9.1

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


Re: [Intel-gfx] [PATCH 3/3] drm/i915: add DOC for i915_component

2015-10-07 Thread Yang, Libin
Hi Daniel,

> -Original Message-
> From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of
> Daniel Vetter
> Sent: Wednesday, October 07, 2015 9:39 PM
> To: Yang, Libin
> Cc: intel-gfx@lists.freedesktop.org; daniel.vet...@ffwll.ch;
> jani.nik...@linux.intel.com; ville.syrj...@linux.intel.com
> Subject: Re: [PATCH 3/3] drm/i915: add DOC for i915_component
> 
> On Wed, Oct 07, 2015 at 07:47:09AM +, Yang, Libin wrote:
> > Hi all,
> >
> > Any comments? Thanks.
> 
> Was simply held up with some merge ordering troubles, I had to wait
> for
> Takashi to apply the last patch so I could do a backmerge. And then I
> forget about your patch series, thanks a lot for the reminder.
> 
> I applied them to dinq, with patches 2&3 squashed together.

Get it .

Thanks,
Libin

> 
> Thanks, Daniel
> 
> >
> > Regards,
> > Libin
> >
> > > -Original Message-
> > > From: Yang, Libin
> > > Sent: Thursday, October 01, 2015 5:01 PM
> > > To: intel-gfx@lists.freedesktop.org; daniel.vet...@ffwll.ch;
> > > jani.nik...@linux.intel.com; ville.syrj...@linux.intel.com
> > > Cc: Yang, Libin
> > > Subject: [PATCH 3/3] drm/i915: add DOC for i915_component
> > >
> > > From: Libin Yang <libin.y...@intel.com>
> > >
> > > Add the DOC for i915_component.h. Explain the struct
> > > i915_audio_component_ops and struct
> > > i915_audio_component_audio_ops
> > > usage.
> > >
> > > Signed-off-by: Libin Yang <libin.y...@intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/intel_audio.c | 5 +
> > >  1 file changed, 5 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> > > b/drivers/gpu/drm/i915/intel_audio.c
> > > index 72d696b..56c2f54 100644
> > > --- a/drivers/gpu/drm/i915/intel_audio.c
> > > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > > @@ -50,6 +50,11 @@
> > >   * co-operation between the graphics and audio drivers is handled
> via
> > > audio
> > >   * related registers. (The notable exception is the power
> management,
> > > not
> > >   * covered here.)
> > > + *
> > > + * The struct i915_audio_component is used to interact between
> the
> > > graphics
> > > + * and audio drivers. The struct i915_audio_component_ops *ops
> in it
> > > is
> > > + * defined in graphics driver and called in audio driver. The
> > > + * struct i915_audio_component_audio_ops *audio_ops is called
> > > from i915 driver.
> > >   */
> > >
> > >  static const struct {
> > > --
> > > 1.9.1
> >
> 
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: set proper N/CTS in modeset

2015-09-24 Thread Yang, Libin
Hi Takashi,

Currently, our testing environment seems not to work. I will setup the test 
environment and send the patch after doing the test.

Regards,
Libin


> -Original Message-
> From: Yang, Libin
> Sent: Wednesday, September 23, 2015 10:20 PM
> To: Takashi Iwai; Jani Nikula
> Cc: alsa-de...@alsa-project.org; intel-gfx@lists.freedesktop.org;
> daniel.vet...@ffwll.ch; ville.syrj...@linux.intel.com
> Subject: RE: [PATCH] drm/i915: set proper N/CTS in modeset
> 
> Hi Takashi,
> 
> 
> > -Original Message-
> > From: Takashi Iwai [mailto:ti...@suse.de]
> > Sent: Wednesday, September 23, 2015 4:41 PM
> > To: Jani Nikula
> > Cc: Yang, Libin; alsa-de...@alsa-project.org; intel-
> > g...@lists.freedesktop.org; daniel.vet...@ffwll.ch;
> > ville.syrj...@linux.intel.com
> > Subject: Re: [PATCH] drm/i915: set proper N/CTS in modeset
> >
> > On Wed, 16 Sep 2015 15:03:15 +0200,
> > Jani Nikula wrote:
> > >
> > > > diff --git a/include/drm/i915_component.h
> > b/include/drm/i915_component.h
> > > > index e6d35d7..89dc7d6 100644
> > > > --- a/include/drm/i915_component.h
> > > > +++ b/include/drm/i915_component.h
> > > > @@ -24,8 +24,18 @@
> > > >  #ifndef _I915_COMPONENT_H_
> > > >  #define _I915_COMPONENT_H_
> > > >
> > > > +/* MAX_PORT is the number of port
> > > > + * It must be sync with I915_MAX_PORTS defined i915_drv.h
> > > > + * 5 should be enough as only HSW, BDW, SKL need such fix.
> > >
> > > You should probably add BUILD_BUG_ON(MAX_PORTS !=
> > I915_MAX_PORTS)
> > > somewhere near the loop above. Or at least change
> > I915_MAX_PORTS to
> > > ARRAY_SIZE(acomp->aud_sample_rate) in the loop to not run over
> > the array
> > > if MAX_PORTS gets out of sync.
> > >
> > > With that addressed one way or another, this is
> > >
> > > Reviewed-by: Jani Nikula <jani.nik...@intel.com>
> >
> > Libin, could you resubmit the patch with fixes Jani suggested?
> > Then I'm going to merge it to the existing topic/drm-sync-audio-rate
> > branch.
> 
> OK, I will send it tomorrow.
> 
> Regards,
> Libin
> 
> >
> >
> > thanks,
> >
> > Takashi
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: set proper N/CTS in modeset

2015-09-23 Thread Yang, Libin
Hi Takashi,


> -Original Message-
> From: Takashi Iwai [mailto:ti...@suse.de]
> Sent: Wednesday, September 23, 2015 4:41 PM
> To: Jani Nikula
> Cc: Yang, Libin; alsa-de...@alsa-project.org; intel-
> g...@lists.freedesktop.org; daniel.vet...@ffwll.ch;
> ville.syrj...@linux.intel.com
> Subject: Re: [PATCH] drm/i915: set proper N/CTS in modeset
> 
> On Wed, 16 Sep 2015 15:03:15 +0200,
> Jani Nikula wrote:
> >
> > > diff --git a/include/drm/i915_component.h
> b/include/drm/i915_component.h
> > > index e6d35d7..89dc7d6 100644
> > > --- a/include/drm/i915_component.h
> > > +++ b/include/drm/i915_component.h
> > > @@ -24,8 +24,18 @@
> > >  #ifndef _I915_COMPONENT_H_
> > >  #define _I915_COMPONENT_H_
> > >
> > > +/* MAX_PORT is the number of port
> > > + * It must be sync with I915_MAX_PORTS defined i915_drv.h
> > > + * 5 should be enough as only HSW, BDW, SKL need such fix.
> >
> > You should probably add BUILD_BUG_ON(MAX_PORTS !=
> I915_MAX_PORTS)
> > somewhere near the loop above. Or at least change
> I915_MAX_PORTS to
> > ARRAY_SIZE(acomp->aud_sample_rate) in the loop to not run over
> the array
> > if MAX_PORTS gets out of sync.
> >
> > With that addressed one way or another, this is
> >
> > Reviewed-by: Jani Nikula <jani.nik...@intel.com>
> 
> Libin, could you resubmit the patch with fixes Jani suggested?
> Then I'm going to merge it to the existing topic/drm-sync-audio-rate
> branch.

OK, I will send it tomorrow.

Regards,
Libin

> 
> 
> thanks,
> 
> Takashi
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: add kerneldoc for i915_audio_component

2015-09-08 Thread Yang, Libin
Hi Daniel,

As Takashi has already accepted the first 3 patches for 
sync_audio_rate() and the patches are not merged
into -nightly branch. If I make a kerneldoc patch
based on currently -nightly branch, there will
be conflict when you are merging Takashi's branch.

What do you think if I make the kerneldoc patch
after the sync_audio_rate() patches are merged
into the -nightly branch?

Regards,
Libin


> -Original Message-
> From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of
> Daniel Vetter
> Sent: Friday, September 04, 2015 3:55 PM
> To: Jani Nikula
> Cc: Yang, Libin; Daniel Vetter; intel-gfx@lists.freedesktop.org;
> daniel.vet...@ffwll.ch; ville.syrj...@linux.intel.com
> Subject: Re: [PATCH] drm/i915: add kerneldoc for
> i915_audio_component
> 
> On Fri, Sep 04, 2015 at 09:40:17AM +0300, Jani Nikula wrote:
> > On Fri, 04 Sep 2015, "Yang, Libin" <libin.y...@intel.com> wrote:
> > >> -Original Message-
> > >> From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of
> > >> Daniel Vetter
> > >> Sent: Wednesday, September 02, 2015 8:18 PM
> > >> To: Yang, Libin
> > >> Cc: intel-gfx@lists.freedesktop.org; daniel.vet...@ffwll.ch;
> > >> jani.nik...@linux.intel.com; ville.syrj...@linux.intel.com
> > >> Subject: Re: [PATCH] drm/i915: add kerneldoc for
> > >> i915_audio_component
> > >>
> > >> On Wed, Sep 02, 2015 at 02:12:24PM +0800,
> libin.y...@intel.com
> > >> wrote:
> > >> > From: Libin Yang <libin.y...@intel.com>
> > >> >
> > >> > Add the kerneldoc for i915_audio_component in
> i915_component.h
> > >> >
> > >> > Signed-off-by: Libin Yang <libin.y...@intel.com>
> > >> > ---
> > >> >  include/drm/i915_component.h | 39
> --
> > >> -
> > >> >  1 file changed, 24 insertions(+), 15 deletions(-)
> > >> >
> > >> > diff --git a/include/drm/i915_component.h
> > >> b/include/drm/i915_component.h
> > >> > index 8ad6f1b..187acc8 100644
> > >> > --- a/include/drm/i915_component.h
> > >> > +++ b/include/drm/i915_component.h
> > >> > @@ -24,23 +24,32 @@
> > >> >  #ifndef _I915_COMPONENT_H_
> > >> >  #define _I915_COMPONENT_H_
> > >> >
> > >> > +/**
> > >> > + * struct i915_audio_component_ops - callbacks defined in gfx
> > >> driver
> > >> > + * @owner: the module owner
> > >> > + * @get_power: get the POWER_DOMAIN_AUDIO power well
> > >> > + * @put_power: put the POWER_DOMAIN_AUDIO power well
> > >> > + * @codec_wake_override: Enable/Disable generating the
> codec
> > >> wake signal
> > >> > + * @get_cdclk_freq: get the Core Display Clock in KHz
> > >> > + * @sync_audio_rate: set n/cts based on the sample rate
> > >> > + */
> > >> > +struct i915_audio_component_ops {
> > >> > +  struct module *owner;
> > >>
> > >> New kerneldoc in 4.3 allows you to split structure documentation
> up
> > >> into
> > >> per-member comments. Especially with vtables I think this makes
> a lot
> > >> of
> > >> sense, since then you have enough space to document where and
> how
> > >> exactly
> > >> a given hook is called (looks, place in the overall sequence).
> > >>
> > >> Also please include your stancas in the drm.tmpl docbook
> template,
> > >> otherwise it won't be included in the html docs. And finally please
> add
> > >
> > > OK, I will add it in drm.tmpl.
> > >
> > >> a
> > >> DOC: overview section which explains at a high level how i915 and
> > >> hda-intel corporate for hdmi/dp audio.
> > >
> > > Where the DOC should be located in?
> >
> > i915/intel_audio.c already has a "DOC: High Definition Audio over
> HDMI
> > and Display Port" comment. IMO you could just amend that, as
> there's
> > already some references to the audio driver.
> 
> Yeah I think that would be a perfect place.
> -Daniel
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v6 4/4] drm/i915: set proper N/CTS in modeset

2015-09-03 Thread Yang, Libin

> -Original Message-
> From: Takashi Iwai [mailto:ti...@suse.de]
> Sent: Wednesday, September 02, 2015 11:36 PM
> To: Daniel Vetter
> Cc: Jani Nikula; Yang, Libin; alsa-de...@alsa-project.org; intel-
> g...@lists.freedesktop.org; daniel.vet...@ffwll.ch;
> ville.syrj...@linux.intel.com
> Subject: Re: [PATCH v6 4/4] drm/i915: set proper N/CTS in modeset
> 
> On Wed, 02 Sep 2015 17:22:01 +0200,
> Daniel Vetter wrote:
> >
> > On Wed, Sep 02, 2015 at 03:46:40PM +0200, Takashi Iwai wrote:
> > > On Wed, 02 Sep 2015 15:44:34 +0200,
> > > Jani Nikula wrote:
> > > >
> > > > On Wed, 02 Sep 2015, Takashi Iwai <ti...@suse.de> wrote:
> > > > > On Wed, 02 Sep 2015 11:02:42 +0200,
> > > > > Jani Nikula wrote:
> > > > >>
> > > > >> >> Nitpick. I'd prefer some sharing with the similar blocks from
> the
> > > > >> >> earlier patch. Also a debug message on n == 0 would be
> nice; you
> > > > >> >> probably didn't notice your audio_config_get_rate() wasn't
> working
> > > > >> >> right
> > > > >> >> because this silently fell back to the automatic mode here.
> > > > >> >
> > > > >> > OK, I will add the msg. As you and Ville are insisting on
> > > > >> > sharing code, I will do it in next version.
> > > > >>
> > > > >> Well, really, I'm fine with having that part duplicated as-is for
> now,
> > > > >> we can fix it later. More important to focus on getting
> > > > >> audio_config_get_rate() right.
> > > > >>
> > > > >> I don't know if you're still targeting v4.3 with this (up to
> Takashi I
> > > > >> guess) we'll really need to wrap this up soon.
> > > > >
> > > > > I'm in favor of merging this into 4.3, so it'd be appreciated if
> Libin
> > > > > can prepare the fixed version soonish, indeed.
> > > >
> > > > IIUC patches 1-3 would be useful on their own already, and a
> fixed
> > > > version of patch 4 could follow. Just a thought.
> > >
> > > That's good, then I can take the first three patches.
> > >
> > > Daniel, would you like to review these three before I merge them?
> > > I assumed your previous mail as a kind of ack to this series, too.
> >
> > fwiw ack on that plan, but given how much I made a mess out of
> these two
> > series and mixed them up I wouldn't trust me anyway ;-)
> >
> > Once the code settles I'll rebase/backmerge so that I can apply the
> > follow-up documentation/kerneldoc work that's still getting done.
> 
> FYI, I've pushed a branch including Libin's patchset (but only patches
> 1-3) just for checking.  Let me know if this looks OK.

Thanks, Takashi, Daniel, Jani and Ville.

So I need submit the 4th patch only next time, right?

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


Re: [Intel-gfx] [PATCH] drm/i915: add kerneldoc for i915_audio_component

2015-09-03 Thread Yang, Libin

> -Original Message-
> From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of
> Daniel Vetter
> Sent: Wednesday, September 02, 2015 8:18 PM
> To: Yang, Libin
> Cc: intel-gfx@lists.freedesktop.org; daniel.vet...@ffwll.ch;
> jani.nik...@linux.intel.com; ville.syrj...@linux.intel.com
> Subject: Re: [PATCH] drm/i915: add kerneldoc for
> i915_audio_component
> 
> On Wed, Sep 02, 2015 at 02:12:24PM +0800, libin.y...@intel.com
> wrote:
> > From: Libin Yang <libin.y...@intel.com>
> >
> > Add the kerneldoc for i915_audio_component in i915_component.h
> >
> > Signed-off-by: Libin Yang <libin.y...@intel.com>
> > ---
> >  include/drm/i915_component.h | 39 --
> -
> >  1 file changed, 24 insertions(+), 15 deletions(-)
> >
> > diff --git a/include/drm/i915_component.h
> b/include/drm/i915_component.h
> > index 8ad6f1b..187acc8 100644
> > --- a/include/drm/i915_component.h
> > +++ b/include/drm/i915_component.h
> > @@ -24,23 +24,32 @@
> >  #ifndef _I915_COMPONENT_H_
> >  #define _I915_COMPONENT_H_
> >
> > +/**
> > + * struct i915_audio_component_ops - callbacks defined in gfx
> driver
> > + * @owner: the module owner
> > + * @get_power: get the POWER_DOMAIN_AUDIO power well
> > + * @put_power: put the POWER_DOMAIN_AUDIO power well
> > + * @codec_wake_override: Enable/Disable generating the codec
> wake signal
> > + * @get_cdclk_freq: get the Core Display Clock in KHz
> > + * @sync_audio_rate: set n/cts based on the sample rate
> > + */
> > +struct i915_audio_component_ops {
> > +   struct module *owner;
> 
> New kerneldoc in 4.3 allows you to split structure documentation up
> into
> per-member comments. Especially with vtables I think this makes a lot
> of
> sense, since then you have enough space to document where and how
> exactly
> a given hook is called (looks, place in the overall sequence).
> 
> Also please include your stancas in the drm.tmpl docbook template,
> otherwise it won't be included in the html docs. And finally please add

OK, I will add it in drm.tmpl.

> a
> DOC: overview section which explains at a high level how i915 and
> hda-intel corporate for hdmi/dp audio.

Where the DOC should be located in?

> 
> Thanks, Daniel
> 
> > +   void (*get_power)(struct device *);
> > +   void (*put_power)(struct device *);
> > +   void (*codec_wake_override)(struct device *, bool enable);
> > +   int (*get_cdclk_freq)(struct device *);
> > +   int (*sync_audio_rate)(struct device *, int port, int rate);
> > +};
> > +
> > +/**
> > + * struct i915_audio_component - used for audio video interaction
> > + * @dev: the device from gfx driver
> > + * @ops: callback for audio driver calling
> > + */
> >  struct i915_audio_component {
> > struct device *dev;
> > -
> > -   const struct i915_audio_component_ops {
> > -   struct module *owner;
> > -   void (*get_power)(struct device *);
> > -   void (*put_power)(struct device *);
> > -   void (*codec_wake_override)(struct device *, bool
> enable);
> > -   int (*get_cdclk_freq)(struct device *);
> > -   /**
> > -* @sync_audio_rate: set n/cts based on the sample
> rate
> > -*
> > -* Called from audio driver. After audio driver sets the
> > -* sample rate, it will call this function to set n/cts
> > -*/
> > -   int (*sync_audio_rate)(struct device *, int port, int
> rate);
> > -   } *ops;
> > +   const struct i915_audio_component_ops *ops;
> >  };
> >
> >  #endif /* _I915_COMPONENT_H_ */
> > --
> > 1.9.1
> >
> 
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v6 4/4] drm/i915: set proper N/CTS in modeset

2015-09-02 Thread Yang, Libin
Hi Jani,

> -Original Message-
> From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
> Sent: Wednesday, September 02, 2015 4:20 PM
> To: Yang, Libin; alsa-de...@alsa-project.org; ti...@suse.de; intel-
> g...@lists.freedesktop.org; daniel.vet...@ffwll.ch;
> ville.syrj...@linux.intel.com
> Cc: Yang, Libin
> Subject: Re: [PATCH v6 4/4] drm/i915: set proper N/CTS in modeset
> 
> On Wed, 02 Sep 2015, libin.y...@intel.com wrote:
> > From: Libin Yang <libin.y...@intel.com>
> >
> > When modeset occurs and the TMDS frequency is set to some
> > speical values, the N/CTS need to be set manually if audio
> > is playing.
> 
> Do we still need this patch after David Henningsson's series [1]? IIUC
> you will now always get the callback on modesets, so you should be
> able
> to, uh, callback on the callback to set audio rate. Granted, with this I
> suppose you reduce the time there might be wrong N/CTS after enable.

Yes, we need. David's patch will not trigger the sync_audio_rate
callback.

> 
> Some other comments inline.
> 
> [1] http://mid.gmane.org/1440781350-12053-1-git-send-email-
> david.hennings...@canonical.com
> 
> >
> > Signed-off-by: Libin Yang <libin.y...@intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_reg.h|  8 
> >  drivers/gpu/drm/i915/intel_audio.c | 40
> +-
> >  2 files changed, 47 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_reg.h
> b/drivers/gpu/drm/i915/i915_reg.h
> > index ae7fa3e..5bdee36 100644
> > --- a/drivers/gpu/drm/i915/i915_reg.h
> > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > @@ -7058,6 +7058,8 @@ enum skl_disp_power_wells {
> > _HSW_AUD_MISC_CTRL_A, \
> > _HSW_AUD_MISC_CTRL_B)
> >
> > +#define HSW_AUD_PIPE_CONN_SEL_CTRL  0x650ac
> 
> Nitpick. The bit fields are not defined.

OK, I will add the bit definition. 

> 
> > +
> >  #define _HSW_AUD_DIP_ELD_CTRL_ST_A 0x650b4
> >  #define _HSW_AUD_DIP_ELD_CTRL_ST_B 0x651b4
> >  #define HSW_AUD_DIP_ELD_CTRL(pipe) _PIPE(pipe, \
> > @@ -7072,6 +7074,12 @@ enum skl_disp_power_wells {
> > _HSW_AUD_DIG_CNVT_2)
> >  #define DIP_PORT_SEL_MASK  0x3
> >
> > +#define _HSW_AUD_STR_DESC_10x65084
> > +#define _HSW_AUD_STR_DESC_20x65184
> > +#define AUD_STR_DESC(pipe) _PIPE(pipe, \
> > +_HSW_AUD_STR_DESC_1,
>   \
> > +_HSW_AUD_STR_DESC_2)
> 
> Nitpick. The bit fields are not defined. I think it's fine to use _PIPE
> macro, but you should probably use "converter" or "cvt" or something
> for
> the parameter name to not mislead people into thinking this is pipe
> based.

Do you mean it should be like:
_PIPE(cvt, _HSW_AUD_STR_DESC_1, ...) ?

> 
> > +
> >  #define _HSW_AUD_EDID_DATA_A   0x65050
> >  #define _HSW_AUD_EDID_DATA_B   0x65150
> >  #define HSW_AUD_EDID_DATA(pipe) _PIPE(pipe, \
> > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> b/drivers/gpu/drm/i915/intel_audio.c
> > index a021720..acdb68c 100644
> > --- a/drivers/gpu/drm/i915/intel_audio.c
> > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > @@ -140,6 +140,27 @@ static bool audio_rate_need_prog(struct
> intel_crtc *crtc,
> > return false;
> >  }
> >
> > +static int audio_config_get_rate(struct drm_i915_private *dev_priv,
> > +   enum pipe pipe)
> > +{
> > +   uint32_t tmp;
> > +   int cvt_idx;
> > +   int base_rate, mul, div, rate;
> > +
> > +   tmp = I915_READ(HSW_AUD_PIPE_CONN_SEL_CTRL);
> > +   cvt_idx = (tmp >> (pipe * 8)) & 0xff;
> 
> This one needs to be addressed. Are you sure it's indexed by pipe? The
> spec is vague.

Yes, I did lot of test to confirm it.

> 
> Bits 7:0 are "control B", 15:8 are "control C", and so on, while your
> (tmp >> (pipe * 8)) maps pipe A to control B, pipe B to control C,
> etc. This would speak for port, not pipe, as pipe A should be valid
> while port A not.

We found there is something wrong/or vague in the spec.

> 
> > +   tmp = I915_READ(AUD_STR_DESC(cvt_idx));
> > +   base_rate = tmp & (1 << 14);
> 
> Nitpick. We prefer (tmp & MASK) >> SHIFT.

OK, I will change it.

> 
> > +   if (base_rate == 0)
> > +   rate = 48000;
> > +   else
> > +   rate = 44100;
> > +   m

Re: [Intel-gfx] [PATCH v6 2/4] drm/i915: implement sync_audio_rate callback

2015-09-02 Thread Yang, Libin
Hi Jani,

> -Original Message-
> From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
> Sent: Wednesday, September 02, 2015 3:52 PM
> To: Yang, Libin; alsa-de...@alsa-project.org; ti...@suse.de; intel-
> g...@lists.freedesktop.org; daniel.vet...@ffwll.ch;
> ville.syrj...@linux.intel.com
> Cc: Yang, Libin
> Subject: Re: [PATCH v6 2/4] drm/i915: implement sync_audio_rate
> callback
> 
> On Wed, 02 Sep 2015, libin.y...@intel.com wrote:
> > From: Libin Yang <libin.y...@intel.com>
> >
> > HDMI audio may not work at some frequencies
> > with the HW provided N/CTS.
> >
> > This patch sets the proper N value for the
> > given audio sample rate at the impacted frequencies.
> > At other frequencies, it will use the N/CTS value
> > which HW provides.
> >
> > Signed-off-by: Libin Yang <libin.y...@intel.com>
> 
> Okay, so there are a number of questions and comments this patch still
> raises. Please find them inline.
> 
> *However*, we should really get this finally moving forward, and I
> don't
> think the issues are or need to be blockers, so this is
> 
> Reviewed-by: Jani Nikula <jani.nik...@intel.com>
> 
> I think we (as in i915 folks) can clean the rest of the bikeshedding up,
> and I don't think we should be NAKing this ad infinitum to teach you to
> become an i915 developer... unless you want to be one. ;)
> 
> > ---
> >  drivers/gpu/drm/i915/i915_dma.c|   1 +
> >  drivers/gpu/drm/i915/i915_drv.h|   5 ++
> >  drivers/gpu/drm/i915/intel_audio.c | 138
> +
> >  3 files changed, 144 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_dma.c
> b/drivers/gpu/drm/i915/i915_dma.c
> > index 097d4ba..8ffb5dc 100644
> > --- a/drivers/gpu/drm/i915/i915_dma.c
> > +++ b/drivers/gpu/drm/i915/i915_dma.c
> > @@ -858,6 +858,7 @@ int i915_driver_load(struct drm_device *dev,
> unsigned long flags)
> > mutex_init(_priv->sb_lock);
> > mutex_init(_priv->modeset_restore_lock);
> > mutex_init(_priv->csr_lock);
> > +   mutex_init(_priv->av_mutex);
> >
> > intel_pm_setup(dev);
> >
> > diff --git a/drivers/gpu/drm/i915/i915_drv.h
> b/drivers/gpu/drm/i915/i915_drv.h
> > index 05ffd5a..2c6b76f 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -1882,6 +1882,11 @@ struct drm_i915_private {
> >
> > /* hda/i915 audio component */
> > bool audio_component_registered;
> > +   /**
> > +* av_mutex - mutex for audio/video sync
> > +*
> > +*/
> > +   struct mutex av_mutex;
> >
> > uint32_t hw_context_size;
> > struct list_head context_list;
> > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> b/drivers/gpu/drm/i915/intel_audio.c
> > index dc32cf4..a021720 100644
> > --- a/drivers/gpu/drm/i915/intel_audio.c
> > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > @@ -68,6 +68,31 @@ static const struct {
> > { 148500, AUD_CONFIG_PIXEL_CLOCK_HDMI_148500 },
> >  };
> >
> > +/* HDMI N/CTS table */
> > +#define TMDS_297M 297000
> > +#define TMDS_296M DIV_ROUND_UP(297000 * 1000, 1001)
> > +static const struct {
> > +   int sample_rate;
> > +   int clock;
> > +   int n;
> > +   int cts;
> > +} aud_ncts[] = {
> > +   { 44100, TMDS_296M, 4459, 234375 },
> > +   { 44100, TMDS_297M, 4704, 247500 },
> > +   { 48000, TMDS_296M, 5824, 281250 },
> > +   { 48000, TMDS_297M, 5120, 247500 },
> > +   { 32000, TMDS_296M, 5824, 421875 },
> > +   { 32000, TMDS_297M, 3072, 222750 },
> > +   { 88200, TMDS_296M, 8918, 234375 },
> > +   { 88200, TMDS_297M, 9408, 247500 },
> > +   { 96000, TMDS_296M, 11648, 281250 },
> > +   { 96000, TMDS_297M, 10240, 247500 },
> > +   { 176400, TMDS_296M, 17836, 234375 },
> > +   { 176400, TMDS_297M, 18816, 247500 },
> > +   { 192000, TMDS_296M, 23296, 281250 },
> > +   { 192000, TMDS_297M, 20480, 247500 },
> > +};
> 
> Okay, I admit, I did not look these up in the spec. *blush*. I'm sure
> Ville has/will. ;)
> 
> > +
> >  /* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */
> >  static u32 audio_config_hdmi_pixel_clock(struct drm_display_mode
> *mode)
> >  {
> > @@ -90,6 +115,31 @@ static u32
> audio_config_hdmi_pixel_clock(struct drm_display_mode *mode)
> > return hdmi_audio_clock[i].config;
> >  }
> >
> > +static int audio_config_get_n(const struct drm_display_mode
> *mode, int rate)
> > +{
> > +   int i;
> 

Re: [Intel-gfx] [PATCH v6 2/4] drm/i915: implement sync_audio_rate callback

2015-09-02 Thread Yang, Libin
Hi Jani,



> -Original Message-
> From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
> Sent: Wednesday, September 02, 2015 4:42 PM
> To: Yang, Libin; alsa-de...@alsa-project.org; ti...@suse.de; intel-
> g...@lists.freedesktop.org; daniel.vet...@ffwll.ch;
> ville.syrj...@linux.intel.com
> Subject: RE: [PATCH v6 2/4] drm/i915: implement sync_audio_rate
> callback
> 
> On Wed, 02 Sep 2015, "Yang, Libin" <libin.y...@intel.com> wrote:
> > Hi Jani,
> >
> >> -Original Message-
> >> From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
> >> Sent: Wednesday, September 02, 2015 3:52 PM
> >> To: Yang, Libin; alsa-de...@alsa-project.org; ti...@suse.de; intel-
> >> g...@lists.freedesktop.org; daniel.vet...@ffwll.ch;
> >> ville.syrj...@linux.intel.com
> >> Cc: Yang, Libin
> >> Subject: Re: [PATCH v6 2/4] drm/i915: implement sync_audio_rate
> >> callback
> >>
> >> On Wed, 02 Sep 2015, libin.y...@intel.com wrote:
> >> > From: Libin Yang <libin.y...@intel.com>
> >> >
> >> > HDMI audio may not work at some frequencies
> >> > with the HW provided N/CTS.
> >> >
> >> > This patch sets the proper N value for the
> >> > given audio sample rate at the impacted frequencies.
> >> > At other frequencies, it will use the N/CTS value
> >> > which HW provides.
> >> >
> >> > Signed-off-by: Libin Yang <libin.y...@intel.com>
> >>
> >> Okay, so there are a number of questions and comments this patch
> still
> >> raises. Please find them inline.
> >>
> >> *However*, we should really get this finally moving forward, and I
> >> don't
> >> think the issues are or need to be blockers, so this is
> >>
> >> Reviewed-by: Jani Nikula <jani.nik...@intel.com>
> >>
> >> I think we (as in i915 folks) can clean the rest of the bikeshedding up,
> >> and I don't think we should be NAKing this ad infinitum to teach you
> to
> >> become an i915 developer... unless you want to be one. ;)
> 
> Libin, I suggest taking that R-b now instead of writing a new version of
> this patch if you want to get things upstreamed!
> 
> Please focus on patch 4.

Oh, I didn't realize you mean this. Thanks. :) 

Regards,
Libin
> 
> BR,
> Jani.
> 
> 
> >>
> >> > ---
> >> >  drivers/gpu/drm/i915/i915_dma.c|   1 +
> >> >  drivers/gpu/drm/i915/i915_drv.h|   5 ++
> >> >  drivers/gpu/drm/i915/intel_audio.c | 138
> >> +
> >> >  3 files changed, 144 insertions(+)
> >> >
> >> > diff --git a/drivers/gpu/drm/i915/i915_dma.c
> >> b/drivers/gpu/drm/i915/i915_dma.c
> >> > index 097d4ba..8ffb5dc 100644
> >> > --- a/drivers/gpu/drm/i915/i915_dma.c
> >> > +++ b/drivers/gpu/drm/i915/i915_dma.c
> >> > @@ -858,6 +858,7 @@ int i915_driver_load(struct drm_device
> *dev,
> >> unsigned long flags)
> >> >  mutex_init(_priv->sb_lock);
> >> >  mutex_init(_priv->modeset_restore_lock);
> >> >  mutex_init(_priv->csr_lock);
> >> > +mutex_init(_priv->av_mutex);
> >> >
> >> >  intel_pm_setup(dev);
> >> >
> >> > diff --git a/drivers/gpu/drm/i915/i915_drv.h
> >> b/drivers/gpu/drm/i915/i915_drv.h
> >> > index 05ffd5a..2c6b76f 100644
> >> > --- a/drivers/gpu/drm/i915/i915_drv.h
> >> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> >> > @@ -1882,6 +1882,11 @@ struct drm_i915_private {
> >> >
> >> >  /* hda/i915 audio component */
> >> >  bool audio_component_registered;
> >> > +/**
> >> > + * av_mutex - mutex for audio/video sync
> >> > + *
> >> > + */
> >> > +struct mutex av_mutex;
> >> >
> >> >  uint32_t hw_context_size;
> >> >  struct list_head context_list;
> >> > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> >> b/drivers/gpu/drm/i915/intel_audio.c
> >> > index dc32cf4..a021720 100644
> >> > --- a/drivers/gpu/drm/i915/intel_audio.c
> >> > +++ b/drivers/gpu/drm/i915/intel_audio.c
> >> > @@ -68,6 +68,31 @@ static const struct {
> >> >  { 148500, AUD_CONFIG_PIXEL_CLOCK_HDMI_148500 },
> >> >  };
> >> >
> >> >

Re: [Intel-gfx] [PATCH v5 1/4] drm/i915: Add audio sync_audio_rate callback

2015-08-26 Thread Yang, Libin
Hi Daniel,

 -Original Message-
 From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of
 Daniel Vetter
 Sent: Wednesday, August 26, 2015 4:18 PM
 To: Yang, Libin
 Cc: alsa-de...@alsa-project.org; ti...@suse.de; intel-
 g...@lists.freedesktop.org; daniel.vet...@ffwll.ch;
 jani.nik...@linux.intel.com
 Subject: Re: [PATCH v5 1/4] drm/i915: Add audio sync_audio_rate
 callback
 
 On Tue, Aug 18, 2015 at 02:51:51PM +0800, libin.y...@intel.com
 wrote:
  From: Libin Yang libin.y...@intel.com
 
  Add the sync_audio_rate callback.
 
  With the callback, audio driver can trigger
  i915 driver to set the proper N/CTS or N/M
  based on different sample rates.
 
  Signed-off-by: Libin Yang libin.y...@intel.com
  ---
   include/drm/i915_component.h | 1 +
   1 file changed, 1 insertion(+)
 
  diff --git a/include/drm/i915_component.h
 b/include/drm/i915_component.h
  index c9a8b64..aabebcb 100644
  --- a/include/drm/i915_component.h
  +++ b/include/drm/i915_component.h
  @@ -33,6 +33,7 @@ struct i915_audio_component {
  void (*put_power)(struct device *);
  void (*codec_wake_override)(struct device *, bool
 enable);
  int (*get_cdclk_freq)(struct device *);
  +   int (*sync_audio_rate)(struct device *, int port, int
 rate);
 
 We're missing kerneldoc for this entire struct here, which isn't great.
 This needs to be fixed. Please
 - pull out the ops structure so it's not inlined (kerneldoc can't handle
   nested ops structures).
 - please document all the callbacks with kerneldoc. In 4.3 we can have
   kerneldoc in-line in structures right above each member like this
 
   /**
* @put_power:
*
* Longer text explaining this hook.
*/
   void (*put_power)(struct device *);
 
   For each hook please explain at least who calls it (gfx or audio) and
   where exactly it's called in the overall flow.
 - Extended the overview doc section with references to the
 component/ops
   structure would be needed too.
 
 And please make sure it all looks pretty with make htmldocs.

Could we start another patch session for this task because,
as you know, this is a little independent on these patches?
What do you think?

Regards,
Libin

 
 Thanks, Daniel
 --
 Daniel Vetter
 Software Engineer, Intel Corporation
 http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v3 2/4] drm/i915: implement sync_audio_rate callback

2015-08-26 Thread Yang, Libin
Hi Daniel,

 -Original Message-
 From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of
 Daniel Vetter
 Sent: Wednesday, August 26, 2015 3:53 PM
 To: Jani Nikula
 Cc: Yang, Libin; alsa-de...@alsa-project.org; ti...@suse.de; intel-
 g...@lists.freedesktop.org; daniel.vet...@ffwll.ch
 Subject: Re: [Intel-gfx] [PATCH v3 2/4] drm/i915: implement
 sync_audio_rate callback
 
 On Mon, Aug 17, 2015 at 03:20:38PM +0300, Jani Nikula wrote:
  On Mon, 17 Aug 2015, libin.y...@intel.com wrote:
   From: Libin Yang libin.y...@intel.com
  
   HDMI audio may not work at some frequencies
   with the HW provided N/CTS.
  
   This patch sets the proper N value for the
   given audio sample rate at the impacted frequencies.
   At other frequencies, it will use the N/CTS value
   which HW provides.
  
   Signed-off-by: Libin Yang libin.y...@intel.com
   ---
drivers/gpu/drm/i915/intel_audio.c | 117
 +
1 file changed, 117 insertions(+)
  
   diff --git a/drivers/gpu/drm/i915/intel_audio.c
 b/drivers/gpu/drm/i915/intel_audio.c
   index dc32cf4..27add6a 100644
   --- a/drivers/gpu/drm/i915/intel_audio.c
   +++ b/drivers/gpu/drm/i915/intel_audio.c
   @@ -68,6 +68,31 @@ static const struct {
 { 148500, AUD_CONFIG_PIXEL_CLOCK_HDMI_148500 },
};
  
   +/* HDMI N/CTS table */
   +#define TMDS_297M 297000
   +#define TMDS_296M DIV_ROUND_UP(297000 * 1000, 1001)
   +static const struct {
   + int sample_rate;
   + int clock;
   + int n;
   + int cts;
   +} aud_ncts[] = {
   + { 44100, TMDS_296M, 4459, 234375 },
   + { 44100, TMDS_297M, 4704, 247500 },
   + { 48000, TMDS_296M, 5824, 281250 },
   + { 48000, TMDS_297M, 5120, 247500 },
   + { 32000, TMDS_296M, 5824, 421875 },
   + { 32000, TMDS_297M, 3072, 222750 },
   + { 88200, TMDS_296M, 8918, 234375 },
   + { 88200, TMDS_297M, 9408, 247500 },
   + { 96000, TMDS_296M, 11648, 281250 },
   + { 96000, TMDS_297M, 10240, 247500 },
   + { 176400, TMDS_296M, 17836, 234375 },
   + { 176400, TMDS_297M, 18816, 247500 },
   + { 44100, TMDS_296M, 23296, 281250 },
   + { 44100, TMDS_297M, 20480, 247500 },
   +};
   +
/* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */
static u32 audio_config_hdmi_pixel_clock(struct
 drm_display_mode *mode)
{
   @@ -90,6 +115,31 @@ static u32
 audio_config_hdmi_pixel_clock(struct drm_display_mode *mode)
 return hdmi_audio_clock[i].config;
}
  
   +static int audio_config_get_n(struct drm_display_mode *mode,
 int rate)
   +{
   + int i;
   +
   + for (i = 0; i  ARRAY_SIZE(aud_ncts); i++) {
   + if ((rate == aud_ncts[i].sample_rate) 
   + (mode-clock == aud_ncts[i].clock)) {
   + return aud_ncts[i].n;
   + }
   + }
   + return 0;
   +}
   +
   +/* check whether N/CTS/M need be set manually */
   +static bool audio_rate_need_prog(struct intel_crtc *crtc,
   + struct drm_display_mode
 *mode)
   +{
   + if (((mode-clock == TMDS_297M) ||
   +  (mode-clock == TMDS_296M)) 
   + intel_pipe_has_type(crtc, INTEL_OUTPUT_HDMI))
   + return true;
   + else
   + return false;
   +}
   +
static bool intel_eld_uptodate(struct drm_connector *connector,
int reg_eldv, uint32_t bits_eldv,
int reg_elda, uint32_t bits_elda,
   @@ -514,12 +564,79 @@ static int
 i915_audio_component_get_cdclk_freq(struct device *dev)
 return ret;
}
  
   +static int i915_audio_component_sync_audio_rate(struct device
 *dev,
   + int port, int rate)
   +{
   + struct drm_i915_private *dev_priv = dev_to_i915(dev);
   + struct drm_device *drm_dev = dev_priv-dev;
   + struct intel_encoder *intel_encoder;
   + struct intel_digital_port *intel_dig_port;
   + struct intel_crtc *crtc;
   + struct drm_display_mode *mode;
   + enum pipe pipe = -1;
   + u32 tmp;
   + int n_low, n_up, n;
   +
   + /* 1. get the pipe */
   + for_each_intel_encoder(drm_dev, intel_encoder) {
   + intel_dig_port = enc_to_dig_port(intel_encoder-
 base);
 
  Mmmh, not all encoders are digital ports. enc_to_dig_port does a
  container_of, so you can't just check for NULL either. IOW, you need
 to
  check the encoder-type (and you only care about HDMI here).
 
 encoder-type is changed at runtime thanks to ddi encoders. Also
 shouldn't
 we care about dp audio too or am I confused?

Do you have suggestion how to handle it as it is changed
at runtime? Need a lock or not?

For DP, because the 4K DP display is not stable, so we didn't
do the full test on DP and no patch is ready for DP currently.

Based on the very simple test on DP, it seems DP audio is
OK. When DP is stable, we will do the full test and decide
to make the patch or not based on the test result.

Regards,
Libin

 -Daniel
 
 
   + if (port == intel_dig_port-port) {
   + crtc = to_intel_crtc(intel_encoder-base.crtc);
   + if (!crtc

Re: [Intel-gfx] [PATCH v5 1/4] drm/i915: Add audio sync_audio_rate callback

2015-08-26 Thread Yang, Libin
Hi Daniel,

 -Original Message-
 From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of
 Daniel Vetter
 Sent: Wednesday, August 26, 2015 5:08 PM
 To: Yang, Libin
 Cc: Daniel Vetter; alsa-de...@alsa-project.org; ti...@suse.de; intel-
 g...@lists.freedesktop.org; daniel.vet...@ffwll.ch;
 jani.nik...@linux.intel.com
 Subject: Re: [PATCH v5 1/4] drm/i915: Add audio sync_audio_rate
 callback
 
 On Wed, Aug 26, 2015 at 08:29:09AM +, Yang, Libin wrote:
  Hi Daniel,
 
   -Original Message-
   From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of
   Daniel Vetter
   Sent: Wednesday, August 26, 2015 4:18 PM
   To: Yang, Libin
   Cc: alsa-de...@alsa-project.org; ti...@suse.de; intel-
   g...@lists.freedesktop.org; daniel.vet...@ffwll.ch;
   jani.nik...@linux.intel.com
   Subject: Re: [PATCH v5 1/4] drm/i915: Add audio sync_audio_rate
   callback
  
   On Tue, Aug 18, 2015 at 02:51:51PM +0800, libin.y...@intel.com
   wrote:
From: Libin Yang libin.y...@intel.com
   
Add the sync_audio_rate callback.
   
With the callback, audio driver can trigger
i915 driver to set the proper N/CTS or N/M
based on different sample rates.
   
Signed-off-by: Libin Yang libin.y...@intel.com
---
 include/drm/i915_component.h | 1 +
 1 file changed, 1 insertion(+)
   
diff --git a/include/drm/i915_component.h
   b/include/drm/i915_component.h
index c9a8b64..aabebcb 100644
--- a/include/drm/i915_component.h
+++ b/include/drm/i915_component.h
@@ -33,6 +33,7 @@ struct i915_audio_component {
void (*put_power)(struct device *);
void (*codec_wake_override)(struct device *, bool
   enable);
int (*get_cdclk_freq)(struct device *);
+   int (*sync_audio_rate)(struct device *, int port, int
   rate);
  
   We're missing kerneldoc for this entire struct here, which isn't
 great.
   This needs to be fixed. Please
   - pull out the ops structure so it's not inlined (kerneldoc can't
 handle
 nested ops structures).
   - please document all the callbacks with kerneldoc. In 4.3 we can
 have
 kerneldoc in-line in structures right above each member like this
  
 /**
  * @put_power:
  *
  * Longer text explaining this hook.
  */
 void (*put_power)(struct device *);
  
 For each hook please explain at least who calls it (gfx or audio)
 and
 where exactly it's called in the overall flow.
   - Extended the overview doc section with references to the
   component/ops
 structure would be needed too.
  
   And please make sure it all looks pretty with make htmldocs.
 
  Could we start another patch session for this task because,
  as you know, this is a little independent on these patches?
  What do you think?
 
 Nowadays I want proper docs for new features, and for places where
 we
 missed them thus far they need to be backfilled. Also there's some
 good
 confusion in the review about how this all works together, so better
 docs
 seem called for no matter what to get this in. Instead of just adding all
 the explanations to commit messages only I figured it's better to do
 them
 as kerneldoc.

Yes, I agree and I will add it for the sync_audio_rate function
in the next version.

Regards,
Libin

 -Daniel
 --
 Daniel Vetter
 Software Engineer, Intel Corporation
 http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v5 2/4] drm/i915: implement sync_audio_rate callback

2015-08-26 Thread Yang, Libin
Hi Ville,

 -Original Message-
 From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
 Sent: Wednesday, August 26, 2015 8:27 PM
 To: Yang, Libin
 Cc: alsa-de...@alsa-project.org; ti...@suse.de; intel-
 g...@lists.freedesktop.org; daniel.vet...@ffwll.ch;
 jani.nik...@linux.intel.com
 Subject: Re: [Intel-gfx] [PATCH v5 2/4] drm/i915: implement
 sync_audio_rate callback
 
 On Tue, Aug 25, 2015 at 01:48:13AM +, Yang, Libin wrote:
 
   -Original Message-
   From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
   Sent: Tuesday, August 25, 2015 12:27 AM
   To: Yang, Libin
   Cc: alsa-de...@alsa-project.org; ti...@suse.de; intel-
   g...@lists.freedesktop.org; daniel.vet...@ffwll.ch;
   jani.nik...@linux.intel.com
   Subject: Re: [Intel-gfx] [PATCH v5 2/4] drm/i915: implement
   sync_audio_rate callback
  
   On Mon, Aug 24, 2015 at 03:35:33PM +, Yang, Libin wrote:
 -Original Message-
 From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
 Sent: Monday, August 24, 2015 8:53 PM
 To: Yang, Libin
 Cc: alsa-de...@alsa-project.org; ti...@suse.de; intel-
 g...@lists.freedesktop.org; daniel.vet...@ffwll.ch;
 jani.nik...@linux.intel.com
 Subject: Re: [Intel-gfx] [PATCH v5 2/4] drm/i915: implement
 sync_audio_rate callback

 On Mon, Aug 24, 2015 at 02:38:14AM +, Yang, Libin wrote:
   -Original Message-
   From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
   Sent: Friday, August 21, 2015 11:14 PM
   To: Yang, Libin
   Cc: alsa-de...@alsa-project.org; ti...@suse.de; intel-
   g...@lists.freedesktop.org; daniel.vet...@ffwll.ch;
   jani.nik...@linux.intel.com
   Subject: Re: [Intel-gfx] [PATCH v5 2/4] drm/i915: implement
   sync_audio_rate callback
  
   On Tue, Aug 18, 2015 at 02:51:52PM +0800,
   libin.y...@intel.com
   wrote:
+static int i915_audio_component_sync_audio_rate(struct
   device
   *dev,
+   int port, int
   rate)
+{
+   struct drm_i915_private *dev_priv = dev_to_i915(dev);
+   struct drm_device *drm_dev = dev_priv-dev;
+   struct intel_encoder *intel_encoder;
+   struct intel_digital_port *intel_dig_port;
+   struct intel_crtc *crtc;
+   struct drm_display_mode *mode;
+   enum pipe pipe = -1;
+   u32 tmp;
+   int n_low, n_up, n;
+
+   /* 1. get the pipe */
+   for_each_intel_encoder(drm_dev, intel_encoder) {
+   if (intel_encoder-type !=
   INTEL_OUTPUT_HDMI)
+   continue;
+   intel_dig_port =
   enc_to_dig_port(intel_encoder-
   base);
+   if (port == intel_dig_port-port) {
+   crtc = to_intel_crtc(intel_encoder-
   base.crtc);
  
   This sort of thing would need some locking to safely start
   digging
 at
   the modeset state.
  
   I would probably not do that, and instead add some new
 lock(s)
   for
 this.
   The modeset code would then fill out some relevant
   information
   protected
   by that same lock, and this function could then go look at it
 without
   having to worry about the rest of modeset locking/state.
 
  From audio side, there is no competition when calling the
   function,
  I think.
  For protecting the competition between audio and gfx driver,
  it seems we need use the lock from gfx side. Do you have
   suggested
   lock I can use?

 To do it like this we'd need pretty much all the modeset locks,
   which
 to me feels a bit troublesome if the audio driver can call this at
 any point. So I suggested that we may want to add some kind
 of
   new
 audio lock to i915.
   
If we are using a new audio lock, I believe we still need use the
lock when gfx is doing the modeset. Only adding the new lock
in the function i915_audio_component_sync_audio_rate()
is not enough because gfx driver will still modify it without
locking.
   
I'm not sure where to add the lock in the gfx driver.
  
   The audio enable/disable during modeset would also grab the lock,
   and
   consult whatever information the audio driver provided. I would
 also
   suggest renaming the .sync_audio_rate() to something more clear
 like
   .set_sample_rate()
 
  The sample rate in audio means the how often the audio data
  is sampled. Actually this function is none of setting sample rate.
 
 Well it's more of sample_rate_change_notify() or something like that.
 But I don't mind too much what it's called. We can go with your
 original
 name if you feel it's more clear.

OK, I will keep the original name as it will be more clear for 
audio driver developer.

 
  The sample rate setting is done in audio driver. What the function

  1   2   >