From patchwork Sat Aug 10 08:45:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Aditya Garg X-Patchwork-Id: 13759463 X-Patchwork-Delegate: jikos@jikos.cz Received: from IND01-MAX-obe.outbound.protection.outlook.com (mail-maxind01olkn2062.outbound.protection.outlook.com [40.92.102.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 941023C062; Sat, 10 Aug 2024 08:46:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.102.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723279568; cv=fail; b=IHGGeXh2+9kTep+bjDDxpyFOJRlTwS3ASA/xKmRc48MHXARKpc19P2m7L9nMgiKkamH1UePcu0yLuoaJh8dPi+AuxgbJS4vUWYBg/XbopMUIMDbcNN2OnMjXIPn1MXZnPE2RVqPipZcJuzr8v35hQD4egeviNWcXf5tinEtgRNM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723279568; c=relaxed/simple; bh=I7eT9GErmM5mvWSIAZHdaSkPA2UNNEIFo/u0vSPjVnk=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=II/7AXRCjcK2X+d3ldiUEqwykMOwKLPMvG6Oxlj2UJrJjsakn3m/qs8apf04e/GwRbMt3SXRAQF2w9AzhM2+ixe7lE3aKRQTWhBBYc3aPweRxb102tDn6DzbkcvbceRLcMLoAMuRuE1t23t14QF/BUPM4uo0UWVw7hrlFquD7Sw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=live.com; spf=pass smtp.mailfrom=live.com; dkim=pass (2048-bit key) header.d=live.com header.i=@live.com header.b=g2nRuMKv; arc=fail smtp.client-ip=40.92.102.62 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=live.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=live.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=live.com header.i=@live.com header.b="g2nRuMKv" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AqkdCHQ03Z6RIGSV5+dewc8en0kkzXyKcS/1M2L+t4oXi9Kmf5miYJMvfDJoLXnk6htCKN9lJ7DGhZ/n/7vLUWgDOyZGvuVeS0EolpUogcekBNeJkk3K1L/1LEYeguxSILQ1mrrjVDtGLJz3qAIS47BZJbuq2/vl9WVc7VMRZsIR2AfSwPuS/9NlS9krk7zeKeOeXKViRdsI+Dkq6RQog9p6XmWsw9RyIgntP5bVEEoRAvMsAELQR8ppYDeS6xInp8S+cO8r5xlKP/Xy0n0/MV6Ue1/zKhWns6A+Pk7aGQ42qyzO3K3sxqrrt8GhasIzhXXTcYW+xggo7GiQtcxKWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=I7eT9GErmM5mvWSIAZHdaSkPA2UNNEIFo/u0vSPjVnk=; b=AL7hS0DkysYJymxpo9/ZSh9NCfyXUJBn2rmYbIhXZSkHcveKZCXn1vUtjgoycEDzPQLVBWt8h0+2T6nD9zSfLP1ec+2fSNK3W7ZfRAlJly4LD8kEoCCDBx/O1AHn0rKemjRz+QCO+oT9FKhDAs3EcKypxhNJaFEL667d5vcnePqiqJhJx5aqn84bSAtVw0yXbDATEQYdaQczPY3vIf4QUijg8GqUCQ08t6MELl8gjVyAt9QciPZD5jlFwR0RAD2h9xfdiXj7rlXoEZZDWcp5jOVDMVsyvmmkLw/t+i/1ebXrIYbasygfHpKpapjU8revjN1f3L8gejLFvlXi828jcA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I7eT9GErmM5mvWSIAZHdaSkPA2UNNEIFo/u0vSPjVnk=; b=g2nRuMKvAlCsownjcSGmU27PdUvCTz48RUVbHbqV3plWqyshCTFrQhvkxkC8dOLeU9+PdmOLp5NteV0JzB0k26TEYjJY2PD8ecPzjn9pIbe+tYsWgNetOM9+A+Y17Fo9BVJvwc4/uJas0D1Exb3V8Mo5h48D1VgzuZwEmyK/aTrCJiCpiwTLofBBfmOfUAY7rh3jd6iQ0W9PZSzojw2Uk2gwlcjta1kfBCWiyo2vCWwimI1om4TbCn7ySjLFhyXEd7cpNlHfTFhX30GZVJ8wnAjhN0tg+WbCtU7sPJROMoka75xOeUJ9HF50dHQ2P8S5FAxEElYKet3oiuSyKu542g== Received: from MA0P287MB0217.INDP287.PROD.OUTLOOK.COM (2603:1096:a01:b3::9) by PN0P287MB1153.INDP287.PROD.OUTLOOK.COM (2603:1096:c01:141::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.18; Sat, 10 Aug 2024 08:45:57 +0000 Received: from MA0P287MB0217.INDP287.PROD.OUTLOOK.COM ([fe80::98d2:3610:b33c:435a]) by MA0P287MB0217.INDP287.PROD.OUTLOOK.COM ([fe80::98d2:3610:b33c:435a%5]) with mapi id 15.20.7849.015; Sat, 10 Aug 2024 08:45:57 +0000 From: Aditya Garg To: "tzimmermann@suse.de" , "maarten.lankhorst@linux.intel.com" , "mripard@kernel.org" , "airlied@gmail.com" , "daniel@ffwll.ch" , Jiri Kosina , "bentiss@kernel.org" CC: Kerem Karabay , Linux Kernel Mailing List , "dri-devel@lists.freedesktop.org" , "linux-input@vger.kernel.org" , Orlando Chamberlain Subject: [PATCH v4 1/10] HID: hid-appletb-bl: add driver for the backlight of Apple Touch Bars Thread-Topic: [PATCH v4 1/10] HID: hid-appletb-bl: add driver for the backlight of Apple Touch Bars Thread-Index: AQHa6wG3LKYnHSTJTU+tVxGpok9UWA== Date: Sat, 10 Aug 2024 08:45:57 +0000 Message-ID: <4938532E-FC92-4EC1-9BA4-EEFB30650609@live.com> References: <20190CD7-46CE-400D-9C58-29798479660E@live.com> In-Reply-To: <20190CD7-46CE-400D-9C58-29798479660E@live.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [CbppZRMY1teTPmtlZm8XihwlZ+nC/v9oJPW7fUKPTH3gScIYCz9cXaqghP/ocKuPaLrtaM26zvU=] x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MA0P287MB0217:EE_|PN0P287MB1153:EE_ x-ms-office365-filtering-correlation-id: de20b943-7098-4ecd-ab7f-08dcb918da7a x-microsoft-antispam: BCL:0;ARA:14566002|8060799006|461199028|19110799003|15080799003|3412199025|440099028|102099032; x-microsoft-antispam-message-info: 3CDevqwW4xFrl6nNFFZsSwXCXfK1zg/CC8jpgrhdep1SuEAcN7YRMDCXr3v2p+49VbULlzlBLThWwLOHag3lbDBgKAxqLa5iQaGD0TJ4RkjmrEvq6CIQ3ssQwpDxnjAZW4uUTx7tgaGk9BMwxGzOAxzpDRP2H/Y/IfwMvMSTVRogrYggV34mC2O7FA/s7KVBNVMsZSEx6QOXe8+cIFT/O1I0zxfjUdV/JXlv1kxRplDPAGTe7q/+GY8Cg/I6HNXB5K0HB0EzZjuC5G4654Blby3JSGqqBIB3tmbLWkhm9F5TbYA8ich4L1OtTnxo/Uwq7XOyJ82iizF+dP35h6IBhXYjYZPY2l2i/TGCt3tH1LS9KtoTpmHNOZPBulLHFzqGt/kAEJ27/2odeoTSZZonEOgxbenzLFiAFFxtaQ4YTuUpfmnSoai7Nyq8Sof6tzUMDylGJI1VxL99DXiMGwMgTS0w5lG0bTaHmkkB3EF3NS+Tz3P2O2ihw9LJYmY1WKRTQCs3bGHkw3BCGev7TYW9zUTmd2I+by0a53fJmudzMXE0OSP9S/kECciGvtjGITo1GbEBCcrxhCQ/t9pR2hCQSrWzyRoa28bLba+YuKCBZMa23DQsp/LJgyYovENPUbFn872yWuG/Hmc/YiEjOdN6j37dluXb9hopiSrExB9She6Sp86weHC+EEJqLDEWzWVi x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?bV5xHQiswoy/gUALCXssxHfGRFW2?= =?utf-8?q?nCGh4HSZOU1g7+VP2VI1OGCsxr8xejpwaKDQvhOdG2zaz+yGphgKok+MRo8MsPmya?= =?utf-8?q?WMtKbxudiLYXWgdIEBZJ2q8ismrUqCjUlzXp1Rg96EGq9FNLYlB5WLiHcYlDyghLc?= =?utf-8?q?LzfqBWljlXsDslwQiK2UFAGzf8k1uMhB9A+9XzxQObKNqb0o55oNH5q+5fJB45fZZ?= =?utf-8?q?XBQep7wQt93CDhfLpstUSccFPkVxlrN28C9HiWtVxul2OMPT4FecY5OfbskiWSJYv?= =?utf-8?q?U3Yp8HExoNqhJCrI0VPNcfBlbn7th8SQMafXHTNjBrmB2FTGY+EOnlh/pV7hsPNL9?= =?utf-8?q?ErackQBErVTHz91bwuLL29if3EUm0EHIhIIBwsWV3EI06utqcP8XKwnMQbWVfyMF+?= =?utf-8?q?Z0+ZanbVskwsDj0ZMqWLpWDxEqfv8xOOeSBQtIhup0qD9GhCmSKaZNZYBTo4NURMD?= =?utf-8?q?DKVyuXS7Bg6nDunp2A+0XJewNdZdQit9KevPvA0w+MLhF9ROTjg39n7Oq8YF5G9sL?= =?utf-8?q?qe13XCWnDY/s6zQQefht2a7FAW4jnpg8HPwVbHltYVq47QdGD9Dky4xLBkP6Auq0m?= =?utf-8?q?BiUOSyby2WLW8Sr5UX5QA5NaWsav5PZbqNcWb2MWtBIgiEJXwX7ktnYDyeHgEkQx2?= =?utf-8?q?PoRTBy8RE6T0qbDe5/LUTvJfz2WrYYYwInbWoMf96gpGPljDL0hs0jV3BWbgwYKXQ?= =?utf-8?q?kFEMyGFSTDWgQjV+HKSGBnyAO/fuldHwOuC7pdJW4sRbTLfUWtP+puGRj2RM0dAhq?= =?utf-8?q?cfdZFkE+ERgN/GjIHH1vsZa65AZq+QhTMlDMcmbXnPfZ+IvX/lSZjr+QxibSpK2rv?= =?utf-8?q?qLZ4jUKWdUSlaUN2erTxOVjzjMkmGWaA/TS7X/McmvjZJ6HA5Js3tGxlXInxMGXy+?= =?utf-8?q?TSfkfMRbUqmv6pskbGai7HZYuGMawgWHCe+arftdECov+UuCll5RclBMskAGe8WI9?= =?utf-8?q?dRQDcuchfaLZB9ay+1zW6ichNNjLaP1fxNtFvqNMhfKuqntSz/6ggPxcpj/zkXuva?= =?utf-8?q?VAYatLcF1aHl/5ChOsRgQhqDMCPufAGagdWumJiS8TTC3vDo0n+2EHiZAuQGtL8bc?= =?utf-8?q?3Q7vMJ8TIgec3csaCcXOhgw8GnKdczVkcprFSXGvkpL295rwttkluD0nObKRWQnRi?= =?utf-8?q?iRXoqpPJQO4N+0POsDKjbMlHcrtczj3Dmwf5vOEPwz1JdcUIRB1GhBbq79w0h8ga4?= =?utf-8?q?NbqSZ3+G+G+M8jefRDR7JmEsGNvARXFrVmkm8//rs5d/p0cTBI7akyG3XQp6m5KdZ?= =?utf-8?q?XBxcfbjF0F15kxMr?= Content-ID: <8F14E5E50C9EF5489C20D65F2CA48386@INDP287.PROD.OUTLOOK.COM> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-7719-20-msonline-outlook-24072.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MA0P287MB0217.INDP287.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: de20b943-7098-4ecd-ab7f-08dcb918da7a X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Aug 2024 08:45:57.5263 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: PN0P287MB1153 From: Kerem Karabay This commit adds a driver for the backlight of Apple Touch Bars on x86 Macs. Note that currently only T2 Macs are supported. This driver is based on previous work done by Ronald Tschalär . Signed-off-by: Kerem Karabay Co-developed-by: Aditya Garg Signed-off-by: Aditya Garg --- drivers/hid/Kconfig | 10 ++ drivers/hid/Makefile | 1 + drivers/hid/hid-appletb-bl.c | 206 +++++++++++++++++++++++++++++++++++ drivers/hid/hid-quirks.c | 4 +- 4 files changed, 220 insertions(+), 1 deletion(-) create mode 100644 drivers/hid/hid-appletb-bl.c diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 08446c89e..4988c1fb2 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -148,6 +148,16 @@ config HID_APPLEIR Say Y here if you want support for Apple infrared remote control. +config HID_APPLETB_BL + tristate "Apple Touch Bar Backlight" + depends on BACKLIGHT_CLASS_DEVICE + help + Say Y here if you want support for the backlight of Touch Bars on x86 + MacBook Pros. + + To compile this driver as a module, choose M here: the + module will be called hid-appletb-bl. + config HID_ASUS tristate "Asus" depends on USB_HID diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile index e40f1ddeb..1d825a474 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile @@ -29,6 +29,7 @@ obj-$(CONFIG_HID_ALPS) += hid-alps.o obj-$(CONFIG_HID_ACRUX) += hid-axff.o obj-$(CONFIG_HID_APPLE) += hid-apple.o obj-$(CONFIG_HID_APPLEIR) += hid-appleir.o +obj-$(CONFIG_HID_APPLETB_BL) += hid-appletb-bl.o obj-$(CONFIG_HID_CREATIVE_SB0540) += hid-creative-sb0540.o obj-$(CONFIG_HID_ASUS) += hid-asus.o 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..00bbe45df --- /dev/null +++ b/drivers/hid/hid-appletb-bl.c @@ -0,0 +1,206 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Apple Touch Bar Backlight Driver + * + * Copyright (c) 2017-2018 Ronald Tschalär + * Copyright (c) 2022-2023 Kerem Karabay + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include + +#include "hid-ids.h" + +#define APPLETB_BL_ON 1 +#define APPLETB_BL_DIM 3 +#define APPLETB_BL_OFF 4 + +#define HID_UP_APPLEVENDOR_TB_BL 0xff120000 + +#define HID_VD_APPLE_TB_BRIGHTNESS 0xff120001 +#define HID_USAGE_AUX1 0xff120020 +#define HID_USAGE_BRIGHTNESS 0xff120021 + +static int appletb_bl_def_brightness = 2; +module_param_named(brightness, appletb_bl_def_brightness, int, 0444); +MODULE_PARM_DESC(brightness, "Default brightness:\n" + " 0 - Touchbar is off\n" + " 1 - Dim brightness\n" + " [2] - Full brightness"); + +struct appletb_bl { + struct hid_field *aux1_field, *brightness_field; + struct backlight_device *bdev; + + bool full_on; +}; + +const u8 appletb_bl_brightness_map[] = { + APPLETB_BL_OFF, + APPLETB_BL_DIM, + APPLETB_BL_ON +}; + +static int appletb_bl_set_brightness(struct appletb_bl *bl, u8 brightness) +{ + struct hid_report *report = bl->brightness_field->report; + struct hid_device *hdev = report->device; + int ret; + + ret = hid_set_field(bl->aux1_field, 0, 1); + if (ret) { + hid_err(hdev, "Failed to set auxiliary field (%pe)\n", ERR_PTR(ret)); + return ret; + } + + ret = hid_set_field(bl->brightness_field, 0, brightness); + if (ret) { + hid_err(hdev, "Failed to set brightness field (%pe)\n", ERR_PTR(ret)); + return ret; + } + + if (!bl->full_on) { + ret = hid_hw_power(hdev, PM_HINT_FULLON); + if (ret < 0) { + hid_err(hdev, "Device didn't power on (%pe)\n", ERR_PTR(ret)); + return ret; + } + + bl->full_on = true; + } + + hid_hw_request(hdev, report, HID_REQ_SET_REPORT); + + if (brightness == APPLETB_BL_OFF) { + hid_hw_power(hdev, PM_HINT_NORMAL); + bl->full_on = false; + } + + return 0; +} + +static int appletb_bl_update_status(struct backlight_device *bdev) +{ + struct appletb_bl *bl = bl_get_data(bdev); + u16 brightness; + + if (bdev->props.state & BL_CORE_SUSPENDED) + brightness = 0; + else + brightness = backlight_get_brightness(bdev); + + return appletb_bl_set_brightness(bl, appletb_bl_brightness_map[brightness]); +} + +static const struct backlight_ops appletb_bl_backlight_ops = { + .options = BL_CORE_SUSPENDRESUME, + .update_status = appletb_bl_update_status, +}; + +static int appletb_bl_probe(struct hid_device *hdev, const struct hid_device_id *id) +{ + struct hid_field *aux1_field, *brightness_field; + struct backlight_properties bl_props = { 0 }; + struct device *dev = &hdev->dev; + struct appletb_bl *bl; + int ret; + + ret = hid_parse(hdev); + if (ret) + return dev_err_probe(dev, ret, "HID parse failed\n"); + + aux1_field = hid_find_field(hdev, HID_FEATURE_REPORT, + HID_VD_APPLE_TB_BRIGHTNESS, HID_USAGE_AUX1); + + brightness_field = hid_find_field(hdev, HID_FEATURE_REPORT, + HID_VD_APPLE_TB_BRIGHTNESS, HID_USAGE_BRIGHTNESS); + + if (!aux1_field || !brightness_field) + return -ENODEV; + + if (aux1_field->report != brightness_field->report) + return dev_err_probe(dev, -ENODEV, "Encountered unexpected report structure\n"); + + bl = devm_kzalloc(dev, sizeof(*bl), GFP_KERNEL); + if (!bl) + return -ENOMEM; + + ret = hid_hw_start(hdev, HID_CONNECT_DRIVER); + if (ret) + return dev_err_probe(dev, ret, "HID hardware start failed\n"); + + ret = hid_hw_open(hdev); + if (ret) { + dev_err_probe(dev, ret, "HID hardware open failed\n"); + goto stop_hw; + } + + 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); + + if (ret) { + dev_err_probe(dev, ret, "Failed to set touch bar brightness to off\n"); + goto close_hw; + } + + bl_props.type = BACKLIGHT_RAW; + bl_props.max_brightness = ARRAY_SIZE(appletb_bl_brightness_map) - 1; + + bl->bdev = devm_backlight_device_register(dev, "appletb_backlight", dev, bl, + &appletb_bl_backlight_ops, &bl_props); + if (IS_ERR(bl->bdev)) { + ret = PTR_ERR(bl->bdev); + dev_err_probe(dev, ret, "Failed to register backlight device\n"); + goto close_hw; + } + + hid_set_drvdata(hdev, bl); + + return 0; + +close_hw: + hid_hw_close(hdev); +stop_hw: + hid_hw_stop(hdev); + + return ret; +} + +static void appletb_bl_remove(struct hid_device *hdev) +{ + struct appletb_bl *bl = hid_get_drvdata(hdev); + + appletb_bl_set_brightness(bl, APPLETB_BL_OFF); + + hid_hw_close(hdev); + hid_hw_stop(hdev); +} + +static const struct hid_device_id appletb_bl_hid_ids[] = { + /* MacBook Pro's 2018, 2019, with T2 chip: iBridge DFR Brightness */ + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_TOUCHBAR_BACKLIGHT) }, + { } +}; +MODULE_DEVICE_TABLE(hid, appletb_bl_hid_ids); + +static struct hid_driver appletb_bl_hid_driver = { + .name = "hid-appletb-bl", + .id_table = appletb_bl_hid_ids, + .probe = appletb_bl_probe, + .remove = appletb_bl_remove, +}; +module_hid_driver(appletb_bl_hid_driver); + +MODULE_AUTHOR("Ronald Tschalär"); +MODULE_AUTHOR("Kerem Karabay "); +MODULE_DESCRIPTION("MacBookPro Touch Bar Backlight Driver"); +MODULE_LICENSE("GPL"); diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c index e0bbf0c63..818d41a35 100644 --- a/drivers/hid/hid-quirks.c +++ b/drivers/hid/hid-quirks.c @@ -328,7 +328,6 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021) }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_TOUCHBAR_BACKLIGHT) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_TOUCHBAR_DISPLAY) }, #endif #if IS_ENABLED(CONFIG_HID_APPLEIR) @@ -338,6 +337,9 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL5) }, #endif +#if IS_ENABLED(CONFIG_HID_APPLETB_BL) + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_TOUCHBAR_BACKLIGHT) }, +#endif #if IS_ENABLED(CONFIG_HID_ASUS) { 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) },