From patchwork Fri Nov 17 01:15:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luke Jones X-Patchwork-Id: 165973 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp228672vqn; Thu, 16 Nov 2023 17:17:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IEaNmIWRf3Evu9rTUx76aWxLutbjtcBwz+/PvDC5EOEHnwnll9XliHmaG3x6wWRC5UcjbdJ X-Received: by 2002:a17:90b:4c45:b0:27d:c35:7f3 with SMTP id np5-20020a17090b4c4500b0027d0c3507f3mr16554032pjb.8.1700183859043; Thu, 16 Nov 2023 17:17:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700183859; cv=none; d=google.com; s=arc-20160816; b=dOj4hXZfllS90l3qt2E6yHdE28krNMfWsadfG6/GtHAeoi/BxiEO+PMvrdvU+66T+l qzopbcgB8AiOp6aAM1ZVU7IOXvBDAXolhMy4TLpK7XDpKL2L1d3Ns62iKl1DH+fBUxZy t5LQP6VeNNzFIOJ67irQDqD4mjBGD/W2eb/qgMpzrJQA8w5iqogpR9SnR0ih4m4XcX/6 /OzABmaCnLUh793tQE4yWBbXi0PiwfzhVZA+wEFAg3isEB/5iwRt0aC6mu/b+XEiqTiz cP74DFC565Ilb2ex16wkwsSIZsOlWNuThd+ojuN1FLeoMbbqAfO/RZ3+fk5JWMCl7i+z Rcxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=6VCvJjojGG/O8+rbwWkHTqMF8m/NO3fQFVfb6jMvLVc=; fh=JMzzSxVRPA/ydaJ3Dt0QS2ws9NywLb5x5SvfzqU5z7c=; b=PmLM10KdRiTF9wOK3Vq7alFUyhB3QpNGlcemE3TfWIxZjga1Qy2X6wjDEUiE9nmmVZ 0yauc78sBibEaZ9ciP3g/ryktRdwuKSauwzSE274dZ2J0RL9gVBthpCTxAurnj83tw/J BsUxGKZuqq3xWhxyFtjR/nlImkQySfie0pQYhIUTDSTO4R/8ae6K7hRoygVm0ssosPNg Y6ftDCnZIibxl0y+xPsfwxlgjk/LYHyjZGTjp6BkRecmPzct07+KM1zi6DLk/XE/ujf8 lmF1T4ZHm74G4OCFldVK9Epkh8R4c5CGanb/UkPHQkSrvpPzjIk1KDBVdERdwZ64MynN +Ohw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ljones.dev header.s=fm2 header.b=joJ1IrQk; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=OgcXPjZQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id x88-20020a17090a6c6100b0026b7f68f386si3284759pjj.73.2023.11.16.17.17.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 17:17:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@ljones.dev header.s=fm2 header.b=joJ1IrQk; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=OgcXPjZQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id CCAF6806A42A; Thu, 16 Nov 2023 17:16:39 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345618AbjKQBQc (ORCPT + 30 others); Thu, 16 Nov 2023 20:16:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229850AbjKQBQa (ORCPT ); Thu, 16 Nov 2023 20:16:30 -0500 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23A8D1AD; Thu, 16 Nov 2023 17:16:21 -0800 (PST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 80FF05C01D5; Thu, 16 Nov 2023 20:16:20 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 16 Nov 2023 20:16:20 -0500 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:sender:subject:subject:to:to; s=fm2; t=1700183780; x= 1700270180; bh=6VCvJjojGG/O8+rbwWkHTqMF8m/NO3fQFVfb6jMvLVc=; b=j oJ1IrQkctNq6Z9EoVV8wV+1PpDSuUJj7CRNNwjZ28LS6BcoHLF91fsc7JggUL00w zLKnMg5Rkxfhl5vaRFNP7LuQ1JxTbo8jenkt8KE3oMhhm5j0E1ciyHEC5tubM8C4 hJHKFYK56dhKw4H4bv05/4K2t25zgME1BVHginuNJToupYX1Y+vZ+H1byx5CFVDR VuhYNnoIOlUlhiMFIs4qq0ZXcEXvq0JRtE06SlwQsjlKKibILKaPsg0E4j+HI1cO BFGOcEXD4IJgzZ7L7etIXomAWGPlCtjSyfGyFhVVT2Tkr8MRnH971E1BA+rtownx FlcLqdYHevxGBPVF1ow/A== 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:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1700183780; x= 1700270180; bh=6VCvJjojGG/O8+rbwWkHTqMF8m/NO3fQFVfb6jMvLVc=; b=O gcXPjZQq/MUN7cHYWBpzZy4vSH6jAzg861vtzKMzj0M0TZY1uhebF4DcK2+slxV8 OjJOzuO8xbezJuq9oINt4k3aa/wZbHTgQMKCZp/Y/9og/NSEgAm1gcW9SXxnXQc2 X0hgo9oWOnB71CSyZFPrRTDFMJdysZxMYX6lk3IuJxtCsDcwrRm7Ibl187Y/5b+a eKPSR2WsoLXTatWnpyFUGUFlkH4oE8JcexVqoubex7EkvSf/RD9ruZA6lthmUg4q 0gLFGO9wO+jKd1TdLu1KGtDpHD9nfvuZJNiY106nQNYbAslkZoumgipZX1q8DLNd Cvfcc8ETFuHTjTCLawXww== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudefledgfeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpedfnfhukhgvucffrdculfhonhgvshdfuceolhhukhgvsehl jhhonhgvshdruggvvheqnecuggftrfgrthhtvghrnhepgfetfedugfetudeuheetjefhue fggfelleetvdevtefhueeujeefvdegleevhefgnecuvehluhhsthgvrhfuihiivgeptden ucfrrghrrghmpehmrghilhhfrhhomheplhhukhgvsehljhhonhgvshdruggvvh X-ME-Proxy: Feedback-ID: i5ec1447f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 16 Nov 2023 20:16:17 -0500 (EST) From: "Luke D. Jones" To: jikos@kernel.org Cc: benjamin.tissoires@redhat.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, benato.denis96@gmail.com Subject: [PATCH 1/2] hid-asus: add const to read-only outgoing usb buffer Date: Fri, 17 Nov 2023 14:15:55 +1300 Message-ID: <20231117011556.13067-2-luke@ljones.dev> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231117011556.13067-1-luke@ljones.dev> References: <20231117011556.13067-1-luke@ljones.dev> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 16 Nov 2023 17:16:39 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782771990044428078 X-GMAIL-MSGID: 1782771990044428078 From: Denis Benato In the function asus_kbd_set_report the parameter buf is read-only as it gets copied in a memory portion suitable for USB transfer, but the parameter is not marked as const: add the missing const and mark const immutable buffers passed to that function. Signed-off-by: Denis Benato --- drivers/hid/hid-asus.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index fd61dba88233..b70673a929a1 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -381,7 +381,7 @@ static int asus_raw_event(struct hid_device *hdev, return 0; } -static int asus_kbd_set_report(struct hid_device *hdev, u8 *buf, size_t buf_size) +static int asus_kbd_set_report(struct hid_device *hdev, const u8 *buf, size_t buf_size) { unsigned char *dmabuf; int ret; @@ -404,7 +404,7 @@ static int asus_kbd_set_report(struct hid_device *hdev, u8 *buf, size_t buf_size static int asus_kbd_init(struct hid_device *hdev) { - u8 buf[] = { FEATURE_KBD_REPORT_ID, 0x41, 0x53, 0x55, 0x53, 0x20, 0x54, + const u8 buf[] = { FEATURE_KBD_REPORT_ID, 0x41, 0x53, 0x55, 0x53, 0x20, 0x54, 0x65, 0x63, 0x68, 0x2e, 0x49, 0x6e, 0x63, 0x2e, 0x00 }; int ret; @@ -418,7 +418,7 @@ static int asus_kbd_init(struct hid_device *hdev) static int asus_kbd_get_functions(struct hid_device *hdev, unsigned char *kbd_func) { - u8 buf[] = { FEATURE_KBD_REPORT_ID, 0x05, 0x20, 0x31, 0x00, 0x08 }; + const u8 buf[] = { FEATURE_KBD_REPORT_ID, 0x05, 0x20, 0x31, 0x00, 0x08 }; u8 *readbuf; int ret; @@ -449,7 +449,7 @@ static int asus_kbd_get_functions(struct hid_device *hdev, static int rog_nkey_led_init(struct hid_device *hdev) { - u8 buf_init_start[] = { FEATURE_KBD_LED_REPORT_ID1, 0xB9 }; + const u8 buf_init_start[] = { FEATURE_KBD_LED_REPORT_ID1, 0xB9 }; u8 buf_init2[] = { FEATURE_KBD_LED_REPORT_ID1, 0x41, 0x53, 0x55, 0x53, 0x20, 0x54, 0x65, 0x63, 0x68, 0x2e, 0x49, 0x6e, 0x63, 0x2e, 0x00 }; u8 buf_init3[] = { FEATURE_KBD_LED_REPORT_ID1, From patchwork Fri Nov 17 01:15:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luke Jones X-Patchwork-Id: 165974 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp228690vqn; Thu, 16 Nov 2023 17:17:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IFLsmw/S6mDdfvQkh3PoL42Mc0ctZrg5wI/HqTCzwUTV3sK8eUIPxHrpxsXC1hJ/2HhrVvc X-Received: by 2002:a17:90b:60a:b0:280:97c2:5db7 with SMTP id gb10-20020a17090b060a00b0028097c25db7mr16037936pjb.17.1700183860941; Thu, 16 Nov 2023 17:17:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700183860; cv=none; d=google.com; s=arc-20160816; b=DYJPSJuO8YiP9CyiNSL9Xj+HO4EY66tNZ5nzwLMDhp1CoWGKj/iQqXZOMf7vc6V368 EFsyY7z+7HtRmJtPQ1OIThdSfRPh/My04fgccdzhBQMdVPxv/tLB37EmbIlJgiSHzOEh 0R2ASUVfXzTC7p+Xx8xYSZ2JzdhGx8mNnBV/EP27/eIXKorXYjvLxb2RG+yR/UHL6++H HfjFdHf2KXEYcA6TA11X5rVPpVS9a545l8TKnhKuDhvCxUdF14bsgIzw7NiO2nlLhXr8 MEYFU8BIJFvt2fEkO07uJ69vu7prOS46WRPCM7amXtPRDCHrgWuhJBRbp978jrFni6tX 19/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=eW7/wu+ICidmfZHSNxKv48b4TD+SrR9ios0hX/9qiic=; fh=JMzzSxVRPA/ydaJ3Dt0QS2ws9NywLb5x5SvfzqU5z7c=; b=FUJvFuQnlfgk28rJX9HDGF+9md/qVS6DSpvAZv9UW3x4MHwymQ6obv5cOK/2VL3Lbi wO2QvkkPf5ix9ard7wk0JF7kT8ZqedhRmnoF3bYwzCIGwh3I86KsFZnLn7va1fUoCRM8 6VWIcFqY2bNX3Gx8/Kd6hQM+Y2eaO5P7gOJcl4KZnRLRlTh3p5ZG+2CBqX4cYQ7adCZ2 BWzuEFF97kkmCyPX8GH88v7fT1dKp/g33R2R1EURApbMbqBGHLvzEmImfb8ooOCgelcQ B1tBDwJ2bhVwenXfF5qbYWeEQ70V0aup4mo3JMWQwovLABGBIlXymKJ7ZdtsztY+VXKY jBzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ljones.dev header.s=fm2 header.b=CmfGtmGu; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=jzb6JGxZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id b2-20020a17090a9bc200b002768cfbe6desi3236211pjw.112.2023.11.16.17.17.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 17:17:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@ljones.dev header.s=fm2 header.b=CmfGtmGu; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=jzb6JGxZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C05F6806A118; Thu, 16 Nov 2023 17:16:44 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345624AbjKQBQe (ORCPT + 30 others); Thu, 16 Nov 2023 20:16:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229877AbjKQBQa (ORCPT ); Thu, 16 Nov 2023 20:16:30 -0500 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FDA9182; Thu, 16 Nov 2023 17:16:24 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 9EAC45C01D0; Thu, 16 Nov 2023 20:16:23 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 16 Nov 2023 20:16:23 -0500 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:sender:subject:subject:to:to; s=fm2; t=1700183783; x= 1700270183; bh=eW7/wu+ICidmfZHSNxKv48b4TD+SrR9ios0hX/9qiic=; b=C mfGtmGuSaYypQGBqeXOqsgU84svGsmxsKEI6B1P7Up6LKAMVV4memvlhpkkpvSmu NbUpUijlEN5j+nHGZAc41KnIN2lFjlWVKkWxnfQG+LpVEhlyMHbv9/FJbxF9XvTm GK8PcciRWt5dSntKZw+Yn8GumCwPDGy3Tzwx3M6PFwbo+SzzsKox1mTATb0BVPmz y9yHl/CH8n6Vw1/IiILvCjT5D7Pg9R6t6n25ks6pa8lhTpGPdt+u0j2gAj+I9tKe sGnZ36pZN0Fxe7gfgC8vnjhCKtSAmzjwHJZ/106YHvNB9KVk78hbYw3VsqmdhcBi TPdREbF0UnXZc0T/+fAPA== 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:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1700183783; x= 1700270183; bh=eW7/wu+ICidmfZHSNxKv48b4TD+SrR9ios0hX/9qiic=; b=j zb6JGxZ5/h3mYwvyarhtE20qVT9ZQZcRtxt/hLoF71iKmwdBcQDGwx7uza6O5KXN gyp9FKKDeyA8B4U04jhXWIcgy4M6PP5qTD+U4YMvy8vIhA3tBa/sS1DOYHIHqFzN QSh/bPDxrY7ztw6xouoFRm1z1pBLLHOsJCB3akgFd53xPYVx/U2f4F3qvh0rSfli rEIh/FkqbBMGe0NLClXiKLKGAQUm1EX4wnur8HVgwuv7zc+EGZhqD03OTQSrBcIO PYjwqjDtXen/ynFbWP03uBPKJ1cevJIRt2MWrndItRwMeuZeD7Ru/IRFxGxPOJjb KSWodEkqKycqzJCQUnbaw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudefledgfeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpedfnfhukhgvucffrdculfhonhgvshdfuceolhhukhgvsehl jhhonhgvshdruggvvheqnecuggftrfgrthhtvghrnhepgfetfedugfetudeuheetjefhue fggfelleetvdevtefhueeujeefvdegleevhefgnecuvehluhhsthgvrhfuihiivgeptden ucfrrghrrghmpehmrghilhhfrhhomheplhhukhgvsehljhhonhgvshdruggvvh X-ME-Proxy: Feedback-ID: i5ec1447f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 16 Nov 2023 20:16:20 -0500 (EST) From: "Luke D. Jones" To: jikos@kernel.org Cc: benjamin.tissoires@redhat.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, benato.denis96@gmail.com Subject: [PATCH 2/2] hid-asus: reset the backlight brightness level on resume Date: Fri, 17 Nov 2023 14:15:56 +1300 Message-ID: <20231117011556.13067-3-luke@ljones.dev> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231117011556.13067-1-luke@ljones.dev> References: <20231117011556.13067-1-luke@ljones.dev> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 16 Nov 2023 17:16:44 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782771992156321770 X-GMAIL-MSGID: 1782771992156321770 From: Denis Benato Some devices managed by this driver automatically set brightness to 0 before entering a suspended state and reset it back to a default brightness level after the resume: this has the effect of having the kernel report wrong brightness status after a sleep, and on some devices (like the Asus RC71L) that brightness is the intensity of LEDs directly facing the user. Fix the above issue by setting back brightness to the level it had before entering a sleep state. Signed-off-by: Denis Benato --- drivers/hid/hid-asus.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index b70673a929a1..78cdfb8b9a7a 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -1000,6 +1000,24 @@ static int asus_start_multitouch(struct hid_device *hdev) return 0; } +static int __maybe_unused asus_resume(struct hid_device *hdev) { + struct asus_drvdata *drvdata = hid_get_drvdata(hdev); + int ret = 0; + + if (drvdata->kbd_backlight) { + const u8 buf[] = { FEATURE_KBD_REPORT_ID, 0xba, 0xc5, 0xc4, + drvdata->kbd_backlight->cdev.brightness }; + ret = asus_kbd_set_report(hdev, buf, sizeof(buf)); + if (ret < 0) { + hid_err(hdev, "Asus failed to set keyboard backlight: %d\n", ret); + goto asus_resume_err; + } + } + +asus_resume_err: + return ret; +} + static int __maybe_unused asus_reset_resume(struct hid_device *hdev) { struct asus_drvdata *drvdata = hid_get_drvdata(hdev); @@ -1294,6 +1312,7 @@ static struct hid_driver asus_driver = { .input_configured = asus_input_configured, #ifdef CONFIG_PM .reset_resume = asus_reset_resume, + .resume = asus_resume, #endif .event = asus_event, .raw_event = asus_raw_event