All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ALSA: hda/hdmi - Remove duplicated define
@ 2019-07-16  7:42 Takashi Iwai
  2019-07-16  7:42 ` [PATCH 2/2] ALSA: hda/hdmi - Fix i915 reverse port/pin mapping Takashi Iwai
  0 siblings, 1 reply; 5+ messages in thread
From: Takashi Iwai @ 2019-07-16  7:42 UTC (permalink / raw)
  To: alsa-devel; +Cc: Hui Wang

INTEL_GET_VENDOR_VERB is defined twice identically.
Let's remove a superfluous line.

Fixes: b0d8bc50b9f2 ("ALSA: hda: hdmi - add Icelake support")
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_hdmi.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 40323d91f9e4..1e6c489bca15 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -2416,7 +2416,6 @@ static void intel_haswell_fixup_connect_list(struct hda_codec *codec,
 	snd_hda_override_conn_list(codec, nid, spec->num_cvts, spec->cvt_nids);
 }
 
-#define INTEL_GET_VENDOR_VERB	0xf81
 #define INTEL_GET_VENDOR_VERB	0xf81
 #define INTEL_SET_VENDOR_VERB	0x781
 #define INTEL_EN_DP12		0x02	/* enable DP 1.2 features */
-- 
2.16.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] ALSA: hda/hdmi - Fix i915 reverse port/pin mapping
  2019-07-16  7:42 [PATCH 1/2] ALSA: hda/hdmi - Remove duplicated define Takashi Iwai
@ 2019-07-16  7:42 ` Takashi Iwai
  2019-07-16 14:33   ` Kai Vehmanen
  0 siblings, 1 reply; 5+ messages in thread
From: Takashi Iwai @ 2019-07-16  7:42 UTC (permalink / raw)
  To: alsa-devel; +Cc: Hui Wang

The recent fix for Icelake HDMI codec introduced the mapping from pin
NID to the i915 gfx port number.  However, it forgot the reverse
mapping from the port number to the pin NID that is used in the ELD
notifier callback.  As a result, it's processed to a wrong widget and
gives a warning like
  snd_hda_codec_hdmi hdaudioC0D2: HDMI: pin nid 5 not registered

This patch corrects it with a proper reverse mapping function.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204133
Fixes: b0d8bc50b9f2 ("ALSA: hda: hdmi - add Icelake support")
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_hdmi.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 1e6c489bca15..664c81cf5ffb 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -2524,18 +2524,29 @@ static int intel_pin2port(void *audio_ptr, int pin_nid)
 	return -1;
 }
 
+static int intel_port2pin(struct hda_codec *codec, int port)
+{
+	struct hdmi_spec *spec = codec->spec;
+
+	if (!spec->port_num) {
+		/* we assume only from port-B to port-D */
+		if (port < 1 || port > 3)
+			return 0;
+		/* intel port is 1-based */
+		return port + intel_base_nid(codec) - 1;
+	}
+
+	if (port < 1 || port > spec->port_num)
+		return 0;
+	return spec->port_map[port - 1];
+}
+
 static void intel_pin_eld_notify(void *audio_ptr, int port, int pipe)
 {
 	struct hda_codec *codec = audio_ptr;
-	int pin_nid;
+	int pin_nid = intel_port2pin(codec, port);
 	int dev_id = pipe;
 
-	/* we assume only from port-B to port-D */
-	if (port < 1 || port > 3)
-		return;
-
-	pin_nid = port + intel_base_nid(codec) - 1; /* intel port is 1-based */
-
 	/* skip notification during system suspend (but not in runtime PM);
 	 * the state will be updated at resume
 	 */
-- 
2.16.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] ALSA: hda/hdmi - Fix i915 reverse port/pin mapping
  2019-07-16  7:42 ` [PATCH 2/2] ALSA: hda/hdmi - Fix i915 reverse port/pin mapping Takashi Iwai
@ 2019-07-16 14:33   ` Kai Vehmanen
  2019-07-16 14:37     ` Takashi Iwai
  0 siblings, 1 reply; 5+ messages in thread
From: Kai Vehmanen @ 2019-07-16 14:33 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Hui Wang, alsa-devel

Hi Takashi,

On Tue, 16 Jul 2019, Takashi Iwai wrote:

> The recent fix for Icelake HDMI codec introduced the mapping from pin
> NID to the i915 gfx port number.  However, it forgot the reverse
> mapping from the port number to the pin NID that is used in the ELD
> notifier callback.  As a result, it's processed to a wrong widget and
> gives a warning like
>   snd_hda_codec_hdmi hdaudioC0D2: HDMI: pin nid 5 not registered
> 
> This patch corrects it with a proper reverse mapping function.

looks good:

Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] ALSA: hda/hdmi - Fix i915 reverse port/pin mapping
  2019-07-16 14:33   ` Kai Vehmanen
@ 2019-07-16 14:37     ` Takashi Iwai
  2019-07-16 15:02       ` Kai Vehmanen
  0 siblings, 1 reply; 5+ messages in thread
From: Takashi Iwai @ 2019-07-16 14:37 UTC (permalink / raw)
  To: Kai Vehmanen; +Cc: Hui Wang, alsa-devel

On Tue, 16 Jul 2019 16:33:15 +0200,
Kai Vehmanen wrote:
> 
> Hi Takashi,
> 
> On Tue, 16 Jul 2019, Takashi Iwai wrote:
> 
> > The recent fix for Icelake HDMI codec introduced the mapping from pin
> > NID to the i915 gfx port number.  However, it forgot the reverse
> > mapping from the port number to the pin NID that is used in the ELD
> > notifier callback.  As a result, it's processed to a wrong widget and
> > gives a warning like
> >   snd_hda_codec_hdmi hdaudioC0D2: HDMI: pin nid 5 not registered
> > 
> > This patch corrects it with a proper reverse mapping function.
> 
> looks good:
> 
> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>

Thanks for the review.

Actually I found one minor problem now.  The caller doesn't handle the
error case returned from intel_port2pin().  It should be harmless, but
it's better to bail out earlier.

Will resubmit the v2 patch (only for patch 2/2) with the correction.


Takashi

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] ALSA: hda/hdmi - Fix i915 reverse port/pin mapping
  2019-07-16 14:37     ` Takashi Iwai
@ 2019-07-16 15:02       ` Kai Vehmanen
  0 siblings, 0 replies; 5+ messages in thread
From: Kai Vehmanen @ 2019-07-16 15:02 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Hui Wang, alsa-devel

Hey,

On Tue, 16 Jul 2019, Takashi Iwai wrote:

> Actually I found one minor problem now.  The caller doesn't handle the
> error case returned from intel_port2pin().  It should be harmless, but
> it's better to bail out earlier.
[...]
> Will resubmit the v2 patch (only for patch 2/2) with the correction.

ack, even better now. :)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-07-16 15:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-16  7:42 [PATCH 1/2] ALSA: hda/hdmi - Remove duplicated define Takashi Iwai
2019-07-16  7:42 ` [PATCH 2/2] ALSA: hda/hdmi - Fix i915 reverse port/pin mapping Takashi Iwai
2019-07-16 14:33   ` Kai Vehmanen
2019-07-16 14:37     ` Takashi Iwai
2019-07-16 15:02       ` Kai Vehmanen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.