Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp394529lqb; Tue, 28 May 2024 21:01:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX9l25fFXiIib9PxdA2QPn2ArtoYVc6QWBChfeRsU4H5jPNpXiDY88Tuhmb0fwNroCepR1OpOoRqN7J07XQEgqvwcELWWQuDq4geODYFw== X-Google-Smtp-Source: AGHT+IE7/yIBLGvJBKAG8CGLcStvpadP25e4FizxlhnXNedbDmrikjIX8JMhCHmIXjjPyZ64MaXg X-Received: by 2002:a05:6830:1117:b0:6f1:164b:f9e7 with SMTP id 46e09a7af769-6f8d0a86714mr13450331a34.19.1716955250581; Tue, 28 May 2024 21:00:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716955250; cv=pass; d=google.com; s=arc-20160816; b=sMHU3opAgt1uf9CIzvb9MZVYOsCGKO7xWVDlNXDp/l84kaGPrs50ZCu5GhFcu4Br19 PkU3MfDMH5lBc2BgaaoCrML1VBU0BWcCApcD105lvSePk2VpSOOYHRTo820uiDmVQRIc qIKOODXBJduxd3yAJaGrsUDCeYOKC/fE6qXnSBiGsvjfTXWRpRGNgqWz9AT8wT6HJa3B p+INUagmLmZg21+vHF+FYRa076BpxiM1km+xjkEKSQwRxEjXRGn1D6qieAD2XQ1v2AVr LqF3jegvREDPMDgyKbqb3DDA1xaLrT1PLc+Wvek4brQ9Aw7maS+r0DIzS1epfFdmkjYt LhcA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:feedback-id:dkim-signature:dkim-signature; bh=LNipYAkSRLIdv0+aK0KD7aPesVOUo+kH+La70D2FdvE=; fh=WDf2fzzXJEYQ2k4FXP75D2meq4urYMyDO+O0ViGWY24=; b=aVl2NxsGzgFJZlkxj+Oo50N6QekMgNHcwUMyGj9vGXK86l/3/e8vhZu99rq5SpePZO Isv85X0c7ChjnyIZABF46MKuvKrO+8j0QXtYScTrt4PG+nRhEcW7Qxhuc87aiFRHvy84 3Yhc+hzGxwIrhW9VJYXe2Whc9GY8qPiCDKkyenu/UtE55FBsm98a8R15q0WXmoc2K7wp IHgdVqbFhC59r0F6+e7lI/5pnKSzequubttWz6wzuumoxKxUWuCNet12A9+jzV7lRij7 yN5vqZEucK6R3rRoF+JXpVtwV/wX7TnrHJbROlRZbi6LW5eJSudwzxlApWU+RjA9ki2A XZcw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ljones.dev header.s=fm2 header.b=iBEF5K+l; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=KxqS8xZ+; arc=pass (i=1 dkim=pass dkdomain=ljones.dev dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-193298-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193298-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-68227890415si9042434a12.287.2024.05.28.21.00.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 21:00:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-193298-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ljones.dev header.s=fm2 header.b=iBEF5K+l; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=KxqS8xZ+; arc=pass (i=1 dkim=pass dkdomain=ljones.dev dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-193298-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193298-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3A9FA28969D for ; Wed, 29 May 2024 01:29:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0286515AAC6; Wed, 29 May 2024 01:28:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ljones.dev header.i=@ljones.dev header.b="iBEF5K+l"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="KxqS8xZ+" Received: from wfout4-smtp.messagingengine.com (wfout4-smtp.messagingengine.com [64.147.123.147]) (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 821DA15B0EE; Wed, 29 May 2024 01:28:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.147 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716946128; cv=none; b=KfDqJcJZR9lIKWaVL/yVC1xaxnKAJ1T/7jxfqQSxUVbwwGcWcgrEgoEzS8uGhmDC6jegLnNwArvCtS+ld7VqMZII9jSKlirSbB9LG7ASwNuH27yv/AmDFB6laqBhmJijzszJ5y1QyiZlXsOP9KkderJ8da+KFy/EJWQBGPLkbxc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716946128; c=relaxed/simple; bh=LDZLCHZzuZFdB9MB2gzeXB2ldjxyM30EyBUTBHEphxw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YEKT+3+leIFDzeuBhREe9efka5+IYVS2f2pc5+7xlsX/+YLVOcxCGuZLUYyoN34CmHlgSchS0mBklIRmrWSiwsSpmLRm8GjqcCd1E3dVMvBp+kvQ3SuQ9ErXZGZwkseXFGzi+4VqjXbwDrEaCo/KBlTDJ9cbLCqpToMN/fDY5wU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ljones.dev; spf=none smtp.mailfrom=ljones.dev; dkim=pass (2048-bit key) header.d=ljones.dev header.i=@ljones.dev header.b=iBEF5K+l; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=KxqS8xZ+; arc=none smtp.client-ip=64.147.123.147 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ljones.dev Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ljones.dev Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfout.west.internal (Postfix) with ESMTP id 3CD511C000F6; Tue, 28 May 2024 21:28:46 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 28 May 2024 21:28:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ljones.dev; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1716946125; x= 1717032525; bh=LNipYAkSRLIdv0+aK0KD7aPesVOUo+kH+La70D2FdvE=; b=i BEF5K+lImWFXNvL3XvfT8sdACcTIfn67z9Rrh5LJgkOdTmEKXDXWZS2jZ2dVWybg NYU9rvIrW+LYKmzd1OOEizR2xY+jwpBjXHw5oCCzWoGwggY1c83heADkPppOgrjX rxKIwkNvY99+9CvX6YvmlL1dG1e4Fq+xCW7WOnxXKCihtpavQeABrc5UNzoiqF0/ DCiXfQy5d1nyIJ06gl//IUZHLU0X5m6vHzMVxvBFN7q3N7pd0c6UdTLe3fjlfuBf XlgqeCq8+kt/VfvHC1tBx4Wm37Ll9hzmTzKEBjuqERShjvfu0QD9TkzdjEN+uo43 X6yWxZLrgwTzOJ6XFhONw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1716946125; x= 1717032525; bh=LNipYAkSRLIdv0+aK0KD7aPesVOUo+kH+La70D2FdvE=; b=K xqS8xZ+x6kb8uQlUJzSWcceRFdI/8pD/sxM61py/i74w3eaGnC3ajekCQVGRN0Cm OVF00g9xvv7uVYWSw4u1D0uG2MXzPqJ3kA0jpdsnFV+Ae7q/cqJGyD4u9UX4rX4+ eArOLYoAnKaYTIKHxJMNCEeBx+DFTOYZ4C2urMKeOfeNHZkMbw2TW6iJrTJ1Jomx WzB2zScTng4XK/mI2mnT4t5CmYQUWCPEpYtlb5aNdnSpC+Q+fK13K/TNoFeS1dY+ fFxQUdNOeqimWkvQ40Hfnw6vd7APxHbQF0fLG+rxl7n6KbZ0fNFxX3RVQIjQiSAe 21UCFI1rFEn3h+ediL7hg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdejledggeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpedfnfhukhgvucffrdculfhonhgvshdfuceolhhukhgvsehl jhhonhgvshdruggvvheqnecuggftrfgrthhtvghrnhepgfetfedugfetudeuheetjefhue fggfelleetvdevtefhueeujeefvdegleevhefgnecuvehluhhsthgvrhfuihiivgeptden ucfrrghrrghmpehmrghilhhfrhhomheplhhukhgvsehljhhonhgvshdruggvvh X-ME-Proxy: Feedback-ID: i5ec1447f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 May 2024 21:28:42 -0400 (EDT) From: "Luke D. Jones" To: jikos@kernel.org Cc: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, corentin.chary@gmail.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, bentiss@kernel.org, "Luke D. Jones" Subject: [PATCH v1 2/2] hid-asus: change the report_id used for HID LED control Date: Wed, 29 May 2024 13:28:27 +1200 Message-ID: <20240529012827.146005-3-luke@ljones.dev> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240529012827.146005-1-luke@ljones.dev> References: <20240529012827.146005-1-luke@ljones.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On some laptops the report_id used for LED brightness control must be 0x5D instead of 0x5A. Signed-off-by: Luke D. Jones --- drivers/hid/hid-asus.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index 4cba8e143031..ec3556cc4eef 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -94,6 +94,8 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad"); #define TRKID_SGN ((TRKID_MAX + 1) >> 1) +static const char * const use_alt_led_report_id[] = { "GU605", "GA403" }; + struct asus_kbd_leds { struct led_classdev cdev; struct hid_device *hdev; @@ -101,6 +103,7 @@ struct asus_kbd_leds { unsigned int brightness; spinlock_t lock; bool removed; + int report_id; }; struct asus_touchpad_info { @@ -473,7 +476,7 @@ static enum led_brightness asus_kbd_backlight_get(struct led_classdev *led_cdev) static void asus_kbd_backlight_work(struct work_struct *work) { struct asus_kbd_leds *led = container_of(work, struct asus_kbd_leds, work); - u8 buf[] = { FEATURE_KBD_REPORT_ID, 0xba, 0xc5, 0xc4, 0x00 }; + u8 buf[] = { led->report_id, 0xba, 0xc5, 0xc4, 0x00 }; int ret; unsigned long flags; @@ -513,6 +516,23 @@ static bool asus_kbd_wmi_led_control_present(struct hid_device *hdev) return !!(value & ASUS_WMI_DSTS_PRESENCE_BIT); } +static bool asus_kbd_is_input_led(void) +{ + const char *product; + int i; + + product = dmi_get_system_info(DMI_PRODUCT_NAME); + if (!product) + return false; + + for (i = 0; i < ARRAY_SIZE(use_alt_led_report_id); i++) { + if (strstr(product, use_alt_led_report_id[i])) + return true; + } + + return false; +} + static int asus_kbd_register_leds(struct hid_device *hdev) { struct asus_drvdata *drvdata = hid_get_drvdata(hdev); @@ -555,6 +575,10 @@ static int asus_kbd_register_leds(struct hid_device *hdev) if (!drvdata->kbd_backlight) return -ENOMEM; + drvdata->kbd_backlight->report_id = FEATURE_KBD_REPORT_ID; + if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD && asus_kbd_is_input_led()) + drvdata->kbd_backlight->report_id = FEATURE_KBD_LED_REPORT_ID1; + drvdata->kbd_backlight->removed = false; drvdata->kbd_backlight->brightness = 0; drvdata->kbd_backlight->hdev = hdev; -- 2.45.1