[linux-oem][PATCH 0/4] Patches for audio and display

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[linux-oem][PATCH 0/4] Patches for audio and display

Wen-chien Jesse Sung
BugLink: https://launchpad.net/bugs/1754216
BugLink: https://launchpad.net/bugs/1744058

The three audio patches are still waiting in the master-next-backlog of
artful. Although they will make it the the linux-oem, we need them now
to meet the project schedule.

The patch for i915 is a clean cherry-pick. It affects GLK and CNL and
we've verified it on a GLK system.

Imre Deak (1):
  drm/i915/glk, cnl: Implement WaDisableScalarClockGating

Kailang Yang (2):
  UBUNTU: SAUCE: ALSA: hda/realtek - Add support headset mode for DELL
    WYSE
  ALSA: hda/realtek - update ALC225 depop optimize

Wen-chien Jesse Sung (1):
  Revert "UBUNTU: SAUCE: ALSA: hda/realtek - Add support headset mode
    for DELL WYSE"

 drivers/gpu/drm/i915/i915_reg.h      |  10 +++
 drivers/gpu/drm/i915/intel_display.c |  26 +++++++
 sound/pci/hda/patch_realtek.c        | 128 +++++++++++++++++++++++++++++++----
 3 files changed, 151 insertions(+), 13 deletions(-)

--
2.14.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[linux-oem][PATCH 1/4] drm/i915/glk, cnl: Implement WaDisableScalarClockGating

Wen-chien Jesse Sung
From: Imre Deak <[hidden email]>

BugLink: https://launchpad.net/bugs/1754216

On GLK and CNL enabling a pipe with its pipe scaler enabled will result
in a FIFO underrun. This happens only once after driver loading or
system/runtime resume, more specifically after power well 1 gets
enabled; subsequent modesets seem to be free of underruns. The BSpec
workaround for this is to disable the pipe scaler clock gating for the
duration of modeset. Based on my tests disabling clock gating must be
done before enabling pipe scaling and we can re-enable it after the pipe
is enabled and one vblank has passed.

For consistency I also checked if plane scaling would cause the same
problem, but that doesn't seem to trigger this problem.

The patch is based on an earlier version from Ander.

v2 (Rodrigo):
- Set also CLKGATE_DIS_PSL bits 8 and 9.
- Add also the BSpec workaround ID.

Cc: Ander Conselvan de Oliveira <[hidden email]>
Cc: Rodrigo Vivi <[hidden email]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100302
Signed-off-by: Imre Deak <[hidden email]>
Reviewed-by: Rodrigo Vivi <[hidden email]>
Link: https://patchwork.freedesktop.org/patch/msgid/20171002075557.32615-1-imre.deak@...
(cherry picked from commit ed69cd40685c949ec9c65701758bbf9e6840240f)
Signed-off-by: Wen-chien Jesse Sung <[hidden email]>
---
 drivers/gpu/drm/i915/i915_reg.h      | 10 ++++++++++
 drivers/gpu/drm/i915/intel_display.c | 26 ++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 669572a03542..91b1e92dbd82 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -3625,6 +3625,16 @@ enum {
 #define   PWM2_GATING_DIS (1 << 14)
 #define   PWM1_GATING_DIS (1 << 13)
 
+#define _CLKGATE_DIS_PSL_A 0x46520
+#define _CLKGATE_DIS_PSL_B 0x46524
+#define _CLKGATE_DIS_PSL_C 0x46528
+#define   DPF_GATING_DIS (1 << 10)
+#define   DPF_RAM_GATING_DIS (1 << 9)
+#define   DPFR_GATING_DIS (1 << 8)
+
+#define CLKGATE_DIS_PSL(pipe) \
+ _MMIO_PIPE(pipe, _CLKGATE_DIS_PSL_A, _CLKGATE_DIS_PSL_B)
+
 /*
  * Display engine regs
  */
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 7f7b961a4313..0368863ec364 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5300,6 +5300,20 @@ static bool hsw_crtc_supports_ips(struct intel_crtc *crtc)
  return HAS_IPS(to_i915(crtc->base.dev)) && crtc->pipe == PIPE_A;
 }
 
+static void glk_pipe_scaler_clock_gating_wa(struct drm_i915_private *dev_priv,
+    enum pipe pipe, bool apply)
+{
+ u32 val = I915_READ(CLKGATE_DIS_PSL(pipe));
+ u32 mask = DPF_GATING_DIS | DPF_RAM_GATING_DIS | DPFR_GATING_DIS;
+
+ if (apply)
+ val |= mask;
+ else
+ val &= ~mask;
+
+ I915_WRITE(CLKGATE_DIS_PSL(pipe), val);
+}
+
 static void haswell_crtc_enable(struct intel_crtc_state *pipe_config,
  struct drm_atomic_state *old_state)
 {
@@ -5310,6 +5324,7 @@ static void haswell_crtc_enable(struct intel_crtc_state *pipe_config,
  enum transcoder cpu_transcoder = intel_crtc->config->cpu_transcoder;
  struct intel_atomic_state *old_intel_state =
  to_intel_atomic_state(old_state);
+ bool psl_clkgate_wa;
 
  if (WARN_ON(intel_crtc->active))
  return;
@@ -5364,6 +5379,12 @@ static void haswell_crtc_enable(struct intel_crtc_state *pipe_config,
  if (!transcoder_is_dsi(cpu_transcoder))
  intel_ddi_enable_pipe_clock(pipe_config);
 
+ /* Display WA #1180: WaDisableScalarClockGating: glk, cnl */
+ psl_clkgate_wa = (IS_GEMINILAKE(dev_priv) || IS_CANNONLAKE(dev_priv)) &&
+ intel_crtc->config->pch_pfit.enabled;
+ if (psl_clkgate_wa)
+ glk_pipe_scaler_clock_gating_wa(dev_priv, pipe, true);
+
  if (INTEL_GEN(dev_priv) >= 9)
  skylake_pfit_enable(intel_crtc);
  else
@@ -5397,6 +5418,11 @@ static void haswell_crtc_enable(struct intel_crtc_state *pipe_config,
 
  intel_encoders_enable(crtc, pipe_config, old_state);
 
+ if (psl_clkgate_wa) {
+ intel_wait_for_vblank(dev_priv, pipe);
+ glk_pipe_scaler_clock_gating_wa(dev_priv, pipe, false);
+ }
+
  if (intel_crtc->config->has_pch_encoder) {
  intel_wait_for_vblank(dev_priv, pipe);
  intel_wait_for_vblank(dev_priv, pipe);
--
2.14.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[linux-oem][PATCH 2/4] Revert "UBUNTU: SAUCE: ALSA: hda/realtek - Add support headset mode for DELL WYSE"

Wen-chien Jesse Sung
In reply to this post by Wen-chien Jesse Sung
BugLink: https://launchpad.net/bugs/1744058

This reverts commit ce30ef771146fbc79b893ce936bd24cb3b33b70e to be
replaced by maintainer code plus updated patch.

Signed-off-by: Wen-chien Jesse Sung <[hidden email]>
Acked-by: Hui Wang<[hidden email]>
Acked-by: Aaron Ma <[hidden email]>
Signed-off-by: Khalid Elmously <[hidden email]>
(cherry picked from commit dad47e60e652851020bcebbb5aed6d10dcb35774)
Signed-off-by: Wen-chien Jesse Sung <[hidden email]>
---
 sound/pci/hda/patch_realtek.c | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 7ac9c2a4c2f8..f39027698738 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -5309,7 +5309,6 @@ enum {
  ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
  ALC233_FIXUP_LENOVO_MULTI_CODECS,
  ALC294_FIXUP_LENOVO_MIC_LOCATION,
- ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
  ALC274_FIXUP_DELL_BIND_DACS,
  ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
 };
@@ -6107,17 +6106,6 @@ static const struct hda_fixup alc269_fixups[] = {
  { }
  },
  },
- [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
- .type = HDA_FIXUP_PINS,
- .v.pins = (const struct hda_pintbl[]) {
- { 0x16, 0x0101102f }, /* Rear Headset HP */
- { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
- { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
- { }
- },
- .chained = true,
- .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
- },
  [ALC274_FIXUP_DELL_BIND_DACS] = {
  .type = HDA_FIXUP_FUNC,
  .v.func = alc274_fixup_bind_dacs,
@@ -6182,7 +6170,6 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
  SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
  SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
  SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
- SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
  SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
  SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
  SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
--
2.14.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[linux-oem][PATCH 3/4] UBUNTU: SAUCE: ALSA: hda/realtek - Add support headset mode for DELL WYSE

Wen-chien Jesse Sung
In reply to this post by Wen-chien Jesse Sung
From: Kailang Yang <[hidden email]>

BugLink: https://launchpad.net/bugs/1744058

Enable headset mode support for WYSE(0x080c) platform.

Signed-off-by: Kailang Yang <[hidden email]>

(backported from Kailang Yang's patch)
Signed-off-by: Wen-chien Jesse Sung <[hidden email]>
Acked-by: Hui Wang<[hidden email]>
Acked-by: Aaron Ma <[hidden email]>
Signed-off-by: Khalid Elmously <[hidden email]>
(cherry picked from commit 3fc8d1dd2c83f3d988846b48b6dd17f6a0d9b68d)
Signed-off-by: Wen-chien Jesse Sung <[hidden email]>
---
 sound/pci/hda/patch_realtek.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index f39027698738..ea7340602228 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -5311,6 +5311,7 @@ enum {
  ALC294_FIXUP_LENOVO_MIC_LOCATION,
  ALC274_FIXUP_DELL_BIND_DACS,
  ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
+ ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
 };
 
 static const struct hda_fixup alc269_fixups[] = {
@@ -6121,6 +6122,18 @@ static const struct hda_fixup alc269_fixups[] = {
  .chained = true,
  .chain_id = ALC274_FIXUP_DELL_BIND_DACS
  },
+ [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
+ .type = HDA_FIXUP_PINS,
+ .v.pins = (const struct hda_pintbl[]) {
+ { 0x16, 0x0101102f }, /* Rear Headset HP */
+ { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
+ { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
+ { 0x1b, 0x02011020 },
+ { }
+ },
+ .chained = true,
+ .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
+ },
 };
 
 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -6170,6 +6183,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
  SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
  SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
  SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
+ SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
  SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
  SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
  SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
--
2.14.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[linux-oem][PATCH 4/4] ALSA: hda/realtek - update ALC225 depop optimize

Wen-chien Jesse Sung
In reply to this post by Wen-chien Jesse Sung
From: Kailang Yang <[hidden email]>

BugLink: https://launchpad.net/bugs/1744058

Add ALC225 its own depop functions for alc_init and alc_shutup.
Add depop optimize step for headset mode functions.

Signed-off-by: Kailang Yang <[hidden email]>
Signed-off-by: Takashi Iwai <[hidden email]>

(backported from commit da911b1f5e98f21b20aa042748dfe73e36322fb1)
Signed-off-by: Wen-chien Jesse Sung <[hidden email]>
Acked-by: Hui Wang<[hidden email]>
Acked-by: Aaron Ma <[hidden email]>
Signed-off-by: Khalid Elmously <[hidden email]>
(cherry picked from commit db87055f98d4adeaa69cf74b8d103a4301dacb30)
Signed-off-by: Wen-chien Jesse Sung <[hidden email]>
---
 sound/pci/hda/patch_realtek.c | 103 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 102 insertions(+), 1 deletion(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index ea7340602228..37778fae5027 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -3138,6 +3138,93 @@ static void alc256_shutup(struct hda_codec *codec)
  snd_hda_shutup_pins(codec);
 }
 
+static void alc225_init(struct hda_codec *codec)
+{
+ struct alc_spec *spec = codec->spec;
+ hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
+ bool hp1_pin_sense, hp2_pin_sense;
+
+ if (!hp_pin)
+ return;
+
+ msleep(30);
+
+ hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
+ hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
+
+ if (hp1_pin_sense || hp2_pin_sense)
+ msleep(2);
+
+ alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
+
+ if (hp1_pin_sense)
+ snd_hda_codec_write(codec, hp_pin, 0,
+    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
+ if (hp2_pin_sense)
+ snd_hda_codec_write(codec, 0x16, 0,
+    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
+
+ if (hp1_pin_sense || hp2_pin_sense)
+ msleep(85);
+
+ if (hp1_pin_sense)
+ snd_hda_codec_write(codec, hp_pin, 0,
+    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
+ if (hp2_pin_sense)
+ snd_hda_codec_write(codec, 0x16, 0,
+    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
+
+ if (hp1_pin_sense || hp2_pin_sense)
+ msleep(100);
+
+ alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
+ alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
+}
+
+static void alc225_shutup(struct hda_codec *codec)
+{
+ struct alc_spec *spec = codec->spec;
+ hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
+ bool hp1_pin_sense, hp2_pin_sense;
+
+ if (!hp_pin) {
+ alc269_shutup(codec);
+ return;
+ }
+
+ /* 3k pull low control for Headset jack. */
+ alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
+
+ hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
+ hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
+
+ if (hp1_pin_sense || hp2_pin_sense)
+ msleep(2);
+
+ if (hp1_pin_sense)
+ snd_hda_codec_write(codec, hp_pin, 0,
+    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
+ if (hp2_pin_sense)
+ snd_hda_codec_write(codec, 0x16, 0,
+    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
+
+ if (hp1_pin_sense || hp2_pin_sense)
+ msleep(85);
+
+ if (hp1_pin_sense)
+ snd_hda_codec_write(codec, hp_pin, 0,
+    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
+ if (hp2_pin_sense)
+ snd_hda_codec_write(codec, 0x16, 0,
+    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
+
+ if (hp1_pin_sense || hp2_pin_sense)
+ msleep(100);
+
+ alc_auto_setup_eapd(codec, false);
+ snd_hda_shutup_pins(codec);
+}
+
 static void alc_default_init(struct hda_codec *codec)
 {
  struct alc_spec *spec = codec->spec;
@@ -4559,6 +4646,12 @@ static void alc_determine_headset_type(struct hda_codec *codec)
  case 0x10ec0295:
  case 0x10ec0289:
  case 0x10ec0299:
+ snd_hda_codec_write(codec, 0x21, 0,
+    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
+ msleep(80);
+ snd_hda_codec_write(codec, 0x21, 0,
+    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
+
  alc_process_coef_fw(codec, alc225_pre_hsmode);
  alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
  val = alc_read_coef_idx(codec, 0x45);
@@ -4578,6 +4671,12 @@ static void alc_determine_headset_type(struct hda_codec *codec)
  alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
  alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
  alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
+
+ snd_hda_codec_write(codec, 0x21, 0,
+    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
+ msleep(80);
+ snd_hda_codec_write(codec, 0x21, 0,
+    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
  break;
  case 0x10ec0867:
  is_ctia = true;
@@ -6919,7 +7018,9 @@ static int patch_alc269(struct hda_codec *codec)
  break;
  case 0x10ec0299:
  spec->codec_variant = ALC269_TYPE_ALC225;
- spec->gen.mixer_nid = 0; /* no loopback on ALC299 */
+ spec->shutup = alc225_shutup;
+ spec->init_hook = alc225_init;
+ spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
  break;
  case 0x10ec0234:
  case 0x10ec0274:
--
2.14.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team