Skip to content

Commit

Permalink
Update touchbar drivers as per upstream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaGarg8 authored Feb 10, 2025
1 parent 347de5d commit 22d9a15
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 23 deletions.
26 changes: 11 additions & 15 deletions 1005-HID-hid-appletb-bl-add-driver-for-the-backlight-of-A.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 1e34fd0bbe2ad1fd4d2091379b93ac19b84b7af3 Mon Sep 17 00:00:00 2001
From 9fd738032d10a6b9d36972f2df61fb55d7a8a1b4 Mon Sep 17 00:00:00 2001
From: Kerem Karabay <[email protected]>
Date: Sun, 5 Mar 2023 18:52:43 +0300
Subject: [PATCH 1/4] HID: hid-appletb-bl: add driver for the backlight of
Subject: [PATCH 1/2] HID: hid-appletb-bl: add driver for the backlight of
Apple Touch Bars
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Expand All @@ -19,13 +19,13 @@ Signed-off-by: Aditya Garg <[email protected]>
---
drivers/hid/Kconfig | 10 ++
drivers/hid/Makefile | 1 +
drivers/hid/hid-appletb-bl.c | 207 +++++++++++++++++++++++++++++++++++
drivers/hid/hid-appletb-bl.c | 203 +++++++++++++++++++++++++++++++++++
drivers/hid/hid-quirks.c | 4 +-
4 files changed, 221 insertions(+), 1 deletion(-)
4 files changed, 217 insertions(+), 1 deletion(-)
create mode 100644 drivers/hid/hid-appletb-bl.c

diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 4d2a89d65..f6678db27 100644
index b53eb569b..b58c09f84 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -148,6 +148,16 @@ config HID_APPLEIR
Expand All @@ -46,7 +46,7 @@ index 4d2a89d65..f6678db27 100644
tristate "Asus"
depends on USB_HID
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 24de45f36..444d24cec 100644
index 482b096ee..d001c3ffd 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_HID_ALPS) += hid-alps.o
Expand All @@ -59,10 +59,10 @@ index 24de45f36..444d24cec 100644
obj-$(CONFIG_HID_AUREAL) += hid-aureal.o
diff --git a/drivers/hid/hid-appletb-bl.c b/drivers/hid/hid-appletb-bl.c
new file mode 100644
index 000000000..819157686
index 000000000..1a3dcd44b
--- /dev/null
+++ b/drivers/hid/hid-appletb-bl.c
@@ -0,0 +1,207 @@
@@ -0,0 +1,203 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Apple Touch Bar Backlight Driver
Expand Down Expand Up @@ -206,12 +206,8 @@ index 000000000..819157686
+ bl->aux1_field = aux1_field;
+ bl->brightness_field = brightness_field;
+
+ if (appletb_bl_def_brightness == 0)
+ ret = appletb_bl_set_brightness(bl, APPLETB_BL_OFF);
+ else if (appletb_bl_def_brightness == 1)
+ ret = appletb_bl_set_brightness(bl, APPLETB_BL_DIM);
+ else
+ ret = appletb_bl_set_brightness(bl, APPLETB_BL_ON);
+ ret = appletb_bl_set_brightness(bl,
+ appletb_bl_brightness_map[(appletb_bl_def_brightness > 2) ? 2 : appletb_bl_def_brightness]);
+
+ if (ret) {
+ dev_err_probe(dev, ret, "Failed to set touch bar brightness to off\n");
Expand Down Expand Up @@ -293,5 +289,5 @@ index e0bbf0c63..818d41a35 100644
{ HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD) },
{ HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_I2C_TOUCHPAD) },
--
2.43.0
2.48.1

16 changes: 8 additions & 8 deletions 1006-HID-hid-appletb-kbd-add-driver-for-the-keyboard-mode.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 5a1adaa13943fd27405f3bbc2ca5e2f24f9641a0 Mon Sep 17 00:00:00 2001
From a7b5b204d9f2d5c6a93c255ecf6bc99465f7f24d Mon Sep 17 00:00:00 2001
From: Kerem Karabay <[email protected]>
Date: Sun, 5 Mar 2023 18:17:23 +0300
Subject: [PATCH 2/4] HID: hid-appletb-kbd: add driver for the keyboard mode of
Subject: [PATCH 2/2] HID: hid-appletb-kbd: add driver for the keyboard mode of
Apple Touch Bars
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Expand Down Expand Up @@ -51,7 +51,7 @@ index 000000000..2a19584d0
+ 3 None
+ == =================
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index f6678db27..5b16bfadc 100644
index b58c09f84..c42f98955 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -158,6 +158,19 @@ config HID_APPLETB_BL
Expand All @@ -75,7 +75,7 @@ index f6678db27..5b16bfadc 100644
tristate "Asus"
depends on USB_HID
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 444d24cec..1989288e0 100644
index d001c3ffd..0775269be 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -30,6 +30,7 @@ obj-$(CONFIG_HID_ACRUX) += hid-axff.o
Expand All @@ -88,7 +88,7 @@ index 444d24cec..1989288e0 100644
obj-$(CONFIG_HID_AUREAL) += hid-aureal.o
diff --git a/drivers/hid/hid-appletb-kbd.c b/drivers/hid/hid-appletb-kbd.c
new file mode 100644
index 000000000..80c87396f
index 000000000..7a93f1bba
--- /dev/null
+++ b/drivers/hid/hid-appletb-kbd.c
@@ -0,0 +1,303 @@
Expand All @@ -98,7 +98,7 @@ index 000000000..80c87396f
+ *
+ * Copyright (c) 2017-2018 Ronald Tschalär
+ * Copyright (c) 2022-2023 Kerem Karabay <[email protected]>
+ * Copyright (c) 2024 Aditya Garg <[email protected]>
+ * Copyright (c) 2024-2025 Aditya Garg <[email protected]>
+ */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Expand Down Expand Up @@ -210,7 +210,7 @@ index 000000000..80c87396f
+}
+static DEVICE_ATTR_RW(mode);
+
+struct attribute *appletb_kbd_attrs[] = {
+static struct attribute *appletb_kbd_attrs[] = {
+ &dev_attr_mode.attr,
+ NULL
+};
Expand Down Expand Up @@ -418,5 +418,5 @@ index 818d41a35..7c576d654 100644
{ HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD) },
{ HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_I2C_TOUCHPAD) },
--
2.43.0
2.48.1

0 comments on commit 22d9a15

Please sign in to comment.