summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authordragonn2020-09-09 21:48:49 +0200
committerdragonn2020-09-09 21:48:49 +0200
commitd09018a6d991fd3b7be60c7dd0c2ee284e1ad36c (patch)
tree3b2f7a4af7351ec944a5762f9868dd34a75cdd95
parentd8d8394e8fe2e6ee73ef9f36745d78f140d1471b (diff)
downloadaur-d09018a6d991fd3b7be60c7dd0c2ee284e1ad36c.tar.gz
5.8.7
-rw-r--r--.SRCINFO13
-rw-r--r--PKGBUILD13
-rw-r--r--sys-kernel_arch-sources-g14_files_0002-asus-nb-wmi-add-support-for-GU502DU.patch26
-rw-r--r--sys-kernel_arch-sources-g14_files_0004-hid-asus-n-key.patch140
-rw-r--r--sys-kernel_arch-sources-g14_files_0006-ALSA-hda-fixup-headset-for-ASUS-GX502-laptop.patch127
5 files changed, 241 insertions, 78 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 700c39c11672..f01e3856ac23 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = linux-g14
pkgdesc = Linux
- pkgver = 5.8.5.arch1
+ pkgver = 5.8.7.arch1
pkgrel = 1
url = https://lab.retarded.farm/zappel/asus-rog-zephyrus-g14/
arch = x86_64
@@ -12,13 +12,14 @@ pkgbase = linux-g14
makedepends = xmlto
makedepends = git
options = !strip
- source = archlinux-linux::git+https://git.archlinux.org/linux.git?signed#tag=v5.8.5-arch1
+ source = archlinux-linux::git+https://git.archlinux.org/linux.git?signed#tag=v5.8.7-arch1
source = config
source = sphinx-workaround.patch
source = sys-kernel_arch-sources-g14_files_0001-nonupstream-navi10-vfio-reset.patch
+ source = sys-kernel_arch-sources-g14_files_0002-asus-nb-wmi-add-support-for-GU502DU.patch
source = sys-kernel_arch-sources-g14_files_0003-i8042-dmiids.patch
source = sys-kernel_arch-sources-g14_files_0004-hid-asus-n-key.patch
- source = sys-kernel_arch-sources-g14_files_0005-drm-amd-display-use-correct-scale-for-actual_brightness.patch
+ source = sys-kernel_arch-sources-g14_files_0006-ALSA-hda-fixup-headset-for-ASUS-GX502-laptop.patch
source = sys-kernel_arch-sources-g14_files_6002-amdgpu-dm-kernel-5.8.patch
source = sys-kernel_arch-sources-g14_files_6003-vboxdrv-glp.patch
validpgpkeys = ABAF11C65A2970B130ABE3C479BE3E4300411886
@@ -28,10 +29,10 @@ pkgbase = linux-g14
sha256sums = 457d5c9717048cd5334ba3d14dfb37699ac1d2c6dc2fd1df93adb487d6921f2f
sha256sums = 8cb21e0b3411327b627a9dd15b8eb773295a0d2782b1a41b2a8839d1b2f5778c
sha256sums = 02c59a722f5d1912ba9ee4c2b5e84b079c13badc225040b834a18a42345a7a61
- sha256sums = fba0a46a4869378e75145f46d8d62bc259782115e59e6c24cc92088c22c9c2d5
+ sha256sums = edf23d81eb39f38e106c6ce172600cc06d7d155a4ef578c3c94344a45a8a7858
sha256sums = a7b045dc36aea9b3203a4910da3f3314121672e940d7bd8a8cf0126d913e0fe3
- sha256sums = fdea6ab1672ea4758359e9c6e743aba56f33224c5d759852817a01af5974fd4b
- sha256sums = 1179d773dc7c80a03650f571f95f027d1f9638bce631b9be52c4af4db7503101
+ sha256sums = 68bf0dcc390ed14d97f48ebd1095d2587ac2eb2671445125fbcaaf7a6aa01733
+ sha256sums = ac09472e9bcd5604666590b798b9194d446f79fa718ea67889173498676e99c3
sha256sums = 7063af2e6588575ee4fd20d2339850221595acd3da5d8912e6298aea57186887
sha256sums = e92f713d50425be96f118a7a3b9f62787453341a27ff10ac5ba394de060ccef7
diff --git a/PKGBUILD b/PKGBUILD
index 51ecabb0cc3a..41a52ef94577 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,8 +1,8 @@
# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
pkgbase=linux-g14
-pkgver=5.8.5.arch1
-pkgrel=2
+pkgver=5.8.7.arch1
+pkgrel=1
pkgdesc='Linux'
_srctag=v${pkgver%.*}-${pkgver##*.}
url="https://lab.retarded.farm/zappel/asus-rog-zephyrus-g14/"
@@ -20,9 +20,10 @@ source=(
config # the main kernel config file
sphinx-workaround.patch
"sys-kernel_arch-sources-g14_files_0001-nonupstream-navi10-vfio-reset.patch"
+ "sys-kernel_arch-sources-g14_files_0002-asus-nb-wmi-add-support-for-GU502DU.patch"
"sys-kernel_arch-sources-g14_files_0003-i8042-dmiids.patch"
"sys-kernel_arch-sources-g14_files_0004-hid-asus-n-key.patch"
- "sys-kernel_arch-sources-g14_files_0005-drm-amd-display-use-correct-scale-for-actual_brightness.patch"
+ "sys-kernel_arch-sources-g14_files_0006-ALSA-hda-fixup-headset-for-ASUS-GX502-laptop.patch"
"sys-kernel_arch-sources-g14_files_6002-amdgpu-dm-kernel-5.8.patch"
"sys-kernel_arch-sources-g14_files_6003-vboxdrv-glp.patch"
)
@@ -36,10 +37,10 @@ sha256sums=('SKIP'
'457d5c9717048cd5334ba3d14dfb37699ac1d2c6dc2fd1df93adb487d6921f2f'
'8cb21e0b3411327b627a9dd15b8eb773295a0d2782b1a41b2a8839d1b2f5778c'
'02c59a722f5d1912ba9ee4c2b5e84b079c13badc225040b834a18a42345a7a61'
- 'fba0a46a4869378e75145f46d8d62bc259782115e59e6c24cc92088c22c9c2d5'
+ 'edf23d81eb39f38e106c6ce172600cc06d7d155a4ef578c3c94344a45a8a7858'
'a7b045dc36aea9b3203a4910da3f3314121672e940d7bd8a8cf0126d913e0fe3'
- 'fdea6ab1672ea4758359e9c6e743aba56f33224c5d759852817a01af5974fd4b'
- '1179d773dc7c80a03650f571f95f027d1f9638bce631b9be52c4af4db7503101'
+ '68bf0dcc390ed14d97f48ebd1095d2587ac2eb2671445125fbcaaf7a6aa01733'
+ 'ac09472e9bcd5604666590b798b9194d446f79fa718ea67889173498676e99c3'
'7063af2e6588575ee4fd20d2339850221595acd3da5d8912e6298aea57186887'
'e92f713d50425be96f118a7a3b9f62787453341a27ff10ac5ba394de060ccef7')
diff --git a/sys-kernel_arch-sources-g14_files_0002-asus-nb-wmi-add-support-for-GU502DU.patch b/sys-kernel_arch-sources-g14_files_0002-asus-nb-wmi-add-support-for-GU502DU.patch
new file mode 100644
index 000000000000..978a55bf181f
--- /dev/null
+++ b/sys-kernel_arch-sources-g14_files_0002-asus-nb-wmi-add-support-for-GU502DU.patch
@@ -0,0 +1,26 @@
+--- a/drivers/platform/x86/asus-nb-wmi.c
++++ b/drivers/platform/x86/asus-nb-wmi.c
+@@ -493,6 +493,24 @@
+ },
+ .driver_data = &quirk_asus_ga502i,
+ },
++ {
++ .callback = dmi_matched,
++ .ident = "ASUSTeK COMPUTER INC. GA502DU",
++ .matches = {
++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
++ DMI_MATCH(DMI_PRODUCT_NAME, "GA502DU"),
++ },
++ .driver_data = &quirk_asus_ga502i,
++ },
++ {
++ .callback = dmi_matched,
++ .ident = "ASUSTeK COMPUTER INC. GU502DU",
++ .matches = {
++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
++ DMI_MATCH(DMI_PRODUCT_NAME, "GU502DU"),
++ },
++ .driver_data = &quirk_asus_ga502i,
++ },
+ {},
+ };
diff --git a/sys-kernel_arch-sources-g14_files_0004-hid-asus-n-key.patch b/sys-kernel_arch-sources-g14_files_0004-hid-asus-n-key.patch
index f73bc4f4fe49..5b5eb5515ac3 100644
--- a/sys-kernel_arch-sources-g14_files_0004-hid-asus-n-key.patch
+++ b/sys-kernel_arch-sources-g14_files_0004-hid-asus-n-key.patch
@@ -1,49 +1,48 @@
-From 65f12ef918d35ab8ae5eee84e4a1eea8300081da Mon Sep 17 00:00:00 2001
+From 5846c5fffd392e1158e228d05e64c0613fef4d49 Mon Sep 17 00:00:00 2001
From: Luke D Jones <luke@ljones.dev>
-Date: Thu, 30 Jul 2020 16:51:06 +1200
-Subject: [PATCH] HID: asus: add support for ASUS N-Key keyboard
+Date: Sun, 6 Sep 2020 19:30:02 +1200
+Subject: [PATCH V6] HID: ASUS: Add support for ASUS N-Key keyboard
-Enable missing functionality of the keyboard found in many ASUS
-Zephyrus laptops: Fn key combos and hotkeys, keyboard backlight
+The ASUS N-Key keyboard uses the productId of 0x1866 and is used in
+almost all modern ASUS gaming laptops with slight changes to the
+firmware. This patch enables: Fn+key hotkeys, keyboard backlight
brightness control, and notify asus-wmi to toggle "fan-mode".
-Two input event codes are added for keyboard LED mode switching
-prev/next.
The keyboard has many of the same key outputs as the existing G752
keyboard including a few extras, and varies a little between laptop
-models.
+models. The key-sets have been split and sub-grouped so that there
+will not be conflict between key event codes used.
-Additionally the keyboard requires the LED interface to be
+An existing key event used across some keyboards for "Mic Toggle"
+has been changed to emit "F20" as this is what all the main
+desktop environments are using.
+
+Additionally this keyboard requires the LED interface to be
intitialised before such things as keyboard backlight control work.
Misc changes in scope: update some hardcoded comparisons to use an
-available define, change "Mic Toggle" to use a keycode that works.
+available define.
Signed-off-by: Luke D Jones <luke@ljones.dev>
---
- drivers/hid/hid-asus.c | 166 ++++++++++++++++++---
+ drivers/hid/hid-asus.c | 188 ++++++++++++++++++---
drivers/hid/hid-ids.h | 1 +
include/linux/platform_data/x86/asus-wmi.h | 2 +
- include/uapi/linux/input-event-codes.h | 7 +
- 4 files changed, 153 insertions(+), 23 deletions(-)
+ 3 files changed, 166 insertions(+), 25 deletions(-)
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
-index c183caf89d49..90ed6f46e7fc 100644
+index c183caf89d49..541c92a7f108 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
-@@ -26,10 +26,12 @@
+@@ -26,6 +26,8 @@
#include <linux/dmi.h>
#include <linux/hid.h>
#include <linux/module.h>
++
+#include <linux/acpi.h>
#include <linux/platform_data/x86/asus-wmi.h>
#include <linux/input/mt.h>
#include <linux/usb.h> /* For to_usb_interface for T100 touchpad intf check */
- #include <linux/power_supply.h>
-+#include <../drivers/platform/x86/asus-wmi.h>
-
- #include "hid-ids.h"
-
@@ -48,6 +50,8 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad");
#define INPUT_REPORT_ID 0x5d
#define FEATURE_KBD_REPORT_ID 0x5a
@@ -67,7 +66,7 @@ index c183caf89d49..90ed6f46e7fc 100644
+/*
+ * This enables triggering events in asus-wmi
-+*/
++ */
+static int asus_wmi_send_event(struct asus_drvdata *drvdat, u8 code)
+{
+ int err;
@@ -96,39 +95,64 @@ index c183caf89d49..90ed6f46e7fc 100644
(usage->hid & HID_USAGE) != 0x00 &&
(usage->hid & HID_USAGE) != 0xff && !usage->type) {
hid_warn(hdev, "Unmapped Asus vendor usagepage code 0x%02x\n",
-@@ -332,6 +360,20 @@ static int asus_raw_event(struct hid_device *hdev,
+@@ -321,6 +349,7 @@ static int asus_event(struct hid_device *hdev, struct hid_field *field,
+ static int asus_raw_event(struct hid_device *hdev,
+ struct hid_report *report, u8 *data, int size)
+ {
++ int ret;
+ struct asus_drvdata *drvdata = hid_get_drvdata(hdev);
+
+ if (drvdata->battery && data[0] == BATTERY_REPORT_ID)
+@@ -332,6 +361,35 @@ static int asus_raw_event(struct hid_device *hdev,
if (drvdata->quirks & QUIRK_MEDION_E1239T)
return asus_e1239t_event(drvdata, data, size);
+ if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) {
+ /*
+ * Skip these report ID, the device emits a continuous stream associated
-+ * with the AURA mode it is in
++ * with the AURA mode it is in which looks like an 'echo'
+ */
+ if (report->id == FEATURE_KBD_LED_REPORT_ID1 ||
+ report->id == FEATURE_KBD_LED_REPORT_ID2) {
+ return -1;
-+ /* Fn+F5 "fan" symbol, trigger WMI event to toggle next mode */
-+ } else if (report->id == FEATURE_KBD_REPORT_ID && data[1] == 0xae) {
-+ return asus_wmi_send_event(drvdata, 0xae);
++ /* Additional report filtering */
++ } else if (report->id == FEATURE_KBD_REPORT_ID) {
++ /* Fn+F5 "fan" symbol, trigger WMI event to toggle next mode */
++ if (data[1] == 0xae) {
++ ret = asus_wmi_send_event(drvdata, 0xae);
++ if (ret < 0) {
++ hid_warn(hdev, "Asus failed to trigger fan control event");
++ }
++ return -1;
++ /*
++ * G14 and G15 send these codes on some keypresses with no
++ * discernable reason for doing so. We'll filter them out to avoid
++ * unmapped warning messages later
++ */
++ } else if (data[1] == 0xea || data[1] == 0xec || data[1] == 0x02 ||
++ data[1] == 0x8a || data[1] == 0x9e) {
++ return -1;
++ }
+ }
+ }
+
return 0;
}
-@@ -344,7 +386,9 @@ static int asus_kbd_set_report(struct hid_device *hdev, u8 *buf, size_t buf_size
+@@ -344,7 +402,11 @@ static int asus_kbd_set_report(struct hid_device *hdev, u8 *buf, size_t buf_size
if (!dmabuf)
return -ENOMEM;
- ret = hid_hw_raw_request(hdev, FEATURE_KBD_REPORT_ID, dmabuf,
-+ // The report ID should be set from the incoming buffer due to LED and key
-+ // interfaces having different pages
++ /*
++ * The report ID should be set from the incoming buffer due to LED and key
++ * interfaces having different pages
++ */
+ ret = hid_hw_raw_request(hdev, buf[0], dmabuf,
buf_size, HID_FEATURE_REPORT,
HID_REQ_SET_REPORT);
kfree(dmabuf);
-@@ -397,6 +441,44 @@ static int asus_kbd_get_functions(struct hid_device *hdev,
+@@ -397,6 +459,44 @@ static int asus_kbd_get_functions(struct hid_device *hdev,
return ret;
}
@@ -173,7 +197,7 @@ index c183caf89d49..90ed6f46e7fc 100644
static void asus_kbd_backlight_set(struct led_classdev *led_cdev,
enum led_brightness brightness)
{
-@@ -460,19 +542,28 @@ static int asus_kbd_register_leds(struct hid_device *hdev)
+@@ -460,19 +560,28 @@ static int asus_kbd_register_leds(struct hid_device *hdev)
unsigned char kbd_func;
int ret;
@@ -213,7 +237,7 @@ index c183caf89d49..90ed6f46e7fc 100644
drvdata->kbd_backlight = devm_kzalloc(&hdev->dev,
sizeof(struct asus_kbd_leds),
-@@ -751,14 +842,14 @@ static int asus_input_mapping(struct hid_device *hdev,
+@@ -751,14 +860,14 @@ static int asus_input_mapping(struct hid_device *hdev,
usage->hid == (HID_UP_GENDEVCTRLS | 0x0026)))
return -1;
@@ -231,25 +255,29 @@ index c183caf89d49..90ed6f46e7fc 100644
case 0x82: asus_map_key_clear(KEY_CAMERA); break;
case 0x88: asus_map_key_clear(KEY_RFKILL); break;
case 0xb5: asus_map_key_clear(KEY_CALC); break;
-@@ -771,16 +862,42 @@ static int asus_input_mapping(struct hid_device *hdev,
+@@ -771,16 +880,42 @@ static int asus_input_mapping(struct hid_device *hdev,
/* ROG key */
case 0x38: asus_map_key_clear(KEY_PROG1); break;
- /* Fn+C ASUS Splendid */
- case 0xba: asus_map_key_clear(KEY_PROG2); break;
-+ default:
+-
+- /* Fn+Space Power4Gear Hybrid */
+- case 0x5c: asus_map_key_clear(KEY_PROG3); break;
+-
+- /* Fn+F5 "fan" symbol on FX503VD */
+- case 0x99: asus_map_key_clear(KEY_PROG4); break;
+-
++ /* The keyboard ID's in this section don't share key events */
+ default:
+ if (drvdata->quirks & QUIRK_G752_KEYBOARD) {
+ switch (usage->hid & HID_USAGE) {
+ /* Fn+C ASUS Splendid */
+ case 0xba: asus_map_key_clear(KEY_PROG2); break;
-
-- /* Fn+Space Power4Gear Hybrid */
-- case 0x5c: asus_map_key_clear(KEY_PROG3); break;
++
+ /* Fn+Space Power4Gear Hybrid */
+ case 0x5c: asus_map_key_clear(KEY_PROG3); break;
-
-- /* Fn+F5 "fan" symbol on FX503VD */
-- case 0x99: asus_map_key_clear(KEY_PROG4); break;
++
+ /* Fn+F5 "fan" symbol on FX503VD */
+ case 0x99: asus_map_key_clear(KEY_PROG4); break;
+
@@ -258,30 +286,28 @@ index c183caf89d49..90ed6f46e7fc 100644
+ }
+ break;
+ }
-+
+ /* device 0x1866, N-KEY Device specific */
-+ if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) {
++ else if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) {
+ switch (usage->hid & HID_USAGE) {
+ /* Fn+Ret "Calc" symbol on device 0x1866, N-KEY Device */
+ case 0x92: asus_map_key_clear(KEY_CALC); break;
+
+ /* Fn+Left Aura mode previous */
-+ case 0xb2: asus_map_key_clear(KEY_KBDILLUM_MODE_PREV); break;
++ case 0xb2: asus_map_key_clear(KEY_PROG2); break;
+
+ /* Fn+Right Aura mode next */
-+ case 0xb3: asus_map_key_clear(KEY_KBDILLUM_MODE_NEXT); break;
++ case 0xb3: asus_map_key_clear(KEY_PROG3); break;
+
+ default:
+ return -1;
+ }
+ break;
+ }
-
-- default:
++
/* ASUS lazily declares 256 usages, ignore the rest,
* as some make the keyboard appear as a pointer device. */
return -1;
-@@ -1126,6 +1243,9 @@ static const struct hid_device_id asus_devices[] = {
+@@ -1126,6 +1261,9 @@ static const struct hid_device_id asus_devices[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
USB_DEVICE_ID_ASUSTEK_FX503VD_KEYBOARD),
QUIRK_USE_KBD_BACKLIGHT },
@@ -292,7 +318,7 @@ index c183caf89d49..90ed6f46e7fc 100644
USB_DEVICE_ID_ASUSTEK_T100TA_KEYBOARD),
QUIRK_T100_KEYBOARD | QUIRK_NO_CONSUMER_USAGES },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
-index 6f370e020feb..c9f930ddcfd7 100644
+index 74fc1df6e3c2..ce5ca078b232 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -190,6 +190,7 @@
@@ -316,24 +342,6 @@ index 897b8332a39f..05253cfe786c 100644
#define ASUS_WMI_UNSUPPORTED_METHOD 0xFFFFFFFE
/* Wireless */
-diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h
-index 0c2e27d28e0a..ca59f7d7a25e 100644
---- a/include/uapi/linux/input-event-codes.h
-+++ b/include/uapi/linux/input-event-codes.h
-@@ -772,6 +772,13 @@
- #define BTN_TRIGGER_HAPPY39 0x2e6
- #define BTN_TRIGGER_HAPPY40 0x2e7
-
-+/*
-+ * Some keyboards have function keys associated with
-+ * changing the keyboard backlight modes, e.g, RGB patterns
-+ */
-+#define KEY_KBDILLUM_MODE_PREV 0x2ea
-+#define KEY_KBDILLUM_MODE_NEXT 0x2eb
-+
- /* We avoid low common keys in module aliases so they don't get huge. */
- #define KEY_MIN_INTERESTING KEY_MUTE
- #define KEY_MAX 0x2ff
--
2.26.2
diff --git a/sys-kernel_arch-sources-g14_files_0006-ALSA-hda-fixup-headset-for-ASUS-GX502-laptop.patch b/sys-kernel_arch-sources-g14_files_0006-ALSA-hda-fixup-headset-for-ASUS-GX502-laptop.patch
new file mode 100644
index 000000000000..45772e69950f
--- /dev/null
+++ b/sys-kernel_arch-sources-g14_files_0006-ALSA-hda-fixup-headset-for-ASUS-GX502-laptop.patch
@@ -0,0 +1,127 @@
+From 0f4560ccaab0a17385a7d0995b07cf2afaa22d6a Mon Sep 17 00:00:00 2001
+From: Luke D Jones <luke@ljones.dev>
+Date: Sun, 6 Sep 2020 20:10:22 +1200
+Subject: [PATCH] ALSA: hda: fixup headset for ASUS GX502 laptop
+
+The GX502 requires a few steps to enable the headset i/o: pincfg,
+verbs to enable and unmute the amp used for headpone out, and
+a jacksense callback to toggle output via internal or jack using
+a verb.
+
+Signed-off-by: Luke Jones <luke@ljones.dev>
+---
+ sound/pci/hda/patch_realtek.c | 70 ++++++++++++++++++++++++++++++++++-
+ 1 file changed, 69 insertions(+), 1 deletion(-)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index 29f5878f0c50..9f6af6380ec2 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -5439,7 +5439,7 @@ static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
+ struct alc_spec *spec = codec->spec;
+ spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
+ alc255_set_default_jack_type(codec);
+- }
++ }
+ else
+ alc_fixup_headset_mode(codec, fix, action);
+ }
+@@ -5975,6 +5975,41 @@ static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
+ snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
+ }
+
++
++static void alc294_gx502_toggle_output(struct hda_codec *codec,
++ struct hda_jack_callback *cb)
++{
++ /* The Windows driver sets the codec up in a very different way where
++ * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
++ */
++ if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT) {
++ alc_write_coef_idx(codec, 0x10, 0x8a20);
++ } else {
++ alc_write_coef_idx(codec, 0x10, 0x0a20);
++ }
++}
++
++static void alc294_fixup_gx502_hp(struct hda_codec *codec,
++ const struct hda_fixup *fix, int action)
++{
++ /* Pin 0x21: headphones/headset mic */
++ if (!is_jack_detectable(codec, 0x21))
++ return;
++
++ switch (action) {
++ case HDA_FIXUP_ACT_PRE_PROBE:
++ snd_hda_jack_detect_enable_callback(codec, 0x21,
++ alc294_gx502_toggle_output);
++ break;
++ case HDA_FIXUP_ACT_INIT:
++ /* Make sure to start in a correct state, i.e. if
++ * headphones have been plugged in before powering up the system
++ */
++ alc294_gx502_toggle_output(codec, NULL);
++ break;
++ }
++}
++
+ static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
+ const struct hda_fixup *fix, int action)
+ {
+@@ -6154,6 +6189,9 @@ enum {
+ ALC285_FIXUP_THINKPAD_HEADSET_JACK,
+ ALC294_FIXUP_ASUS_HPE,
+ ALC294_FIXUP_ASUS_COEF_1B,
++ ALC294_FIXUP_ASUS_GX502_HP,
++ ALC294_FIXUP_ASUS_GX502_PINS,
++ ALC294_FIXUP_ASUS_GX502_VERBS,
+ ALC285_FIXUP_HP_GPIO_LED,
+ ALC285_FIXUP_HP_MUTE_LED,
+ ALC236_FIXUP_HP_MUTE_LED,
+@@ -7307,6 +7345,35 @@ static const struct hda_fixup alc269_fixups[] = {
+ .chained = true,
+ .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
+ },
++ [ALC294_FIXUP_ASUS_GX502_PINS] = {
++ .type = HDA_FIXUP_PINS,
++ .v.pins = (const struct hda_pintbl[]) {
++ { 0x19, 0x03a11050 }, /* front HP mic */
++ { 0x1a, 0x01a11830 }, //0x00a11030 }, /* rear external mic */
++ { 0x21, 0x03211020 }, /* HP out */
++ { }
++ },
++ .chained = true,
++ .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
++ },
++ [ALC294_FIXUP_ASUS_GX502_VERBS] = {
++ .type = HDA_FIXUP_VERBS,
++ .v.verbs = (const struct hda_verb[]) {
++ /* set 0x15 to HP-OUT ctrl */
++ { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
++ /* unmute the 0x15 amp */
++ { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
++ /* set 0x0a input converter to digital */
++ { 0x0a, 0x70d, 0x01 },
++ { }
++ },
++ .chained = true,
++ .chain_id = ALC294_FIXUP_ASUS_GX502_HP
++ },
++ [ALC294_FIXUP_ASUS_GX502_HP] = {
++ .type = HDA_FIXUP_FUNC,
++ .v.func = alc294_fixup_gx502_hp,
++ },
+ [ALC294_FIXUP_ASUS_COEF_1B] = {
+ .type = HDA_FIXUP_VERBS,
+ .v.verbs = (const struct hda_verb[]) {
+@@ -7588,6 +7655,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+ SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
+ SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
+ SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
++ SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
+ SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
+ SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
+ SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
+--
+2.26.2
+