From nobody Sun Feb 8 12:39:22 2026 Received: from fhigh4-smtp.messagingengine.com (fhigh4-smtp.messagingengine.com [103.168.172.155]) (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 B04372F22; Sun, 10 Mar 2024 06:54:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.155 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710053662; cv=none; b=FEnfV0SMk0jE56scoMvv6fuIixSuVd7Ihk0grXrX3L+EC3MrDL2e8I4VE1suRhkzkKeFRtLtxZ/97a5RRF+vGpGOi/j6U0/0ewZSHqg4OpbsIek9PQ6ejXhsdYC+cf+nbvI2kZe6ehSMxdXRULCeXUCKLfgsGXSDzSp5+t2qPO4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710053662; c=relaxed/simple; bh=TX1/HSDWVBD3VLcdB/aCBGqMrfNa0AJYTvTDkYqNxVg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XTM2VOP0DJ+6Lvek/7rkLFOjkOPiwqv9tWG9cBmwS+EJDFKRnRFIEdFGPRkJfensIajSVx7fPiYaf5YOPPSkXzfbj5RbC+9cwYjUSKbp7OJfImZL35dW72af+6CEF+poNXSmhT9gYfPP9PXufwZRlpX0dt/TWnoddGLKe3kCCSM= 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=cAs+/rTE; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=XTtbcgFC; arc=none smtp.client-ip=103.168.172.155 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ljones.dev header.i=@ljones.dev header.b="cAs+/rTE"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="XTtbcgFC" Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfhigh.nyi.internal (Postfix) with ESMTP id CCD7C114009D; Sun, 10 Mar 2024 01:54:19 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Sun, 10 Mar 2024 01:54:19 -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:subject:subject:to:to; s=fm3; t=1710053659; x= 1710140059; bh=jYgNFKoegeuVhWSAq6NHSNBWJ2GvxYXdAko3rNDG9NU=; b=c As+/rTEVJ14Ua0yWoQJUNaCXfBpkLKOXPD9IACmHIEYsqN8PMXWkKZ3dY2SVxySG xK93O1Vc3TvH1/gLwgs/PLHFjc1LIGZ4krpwTpR79U5dqoA1iScDBECxslHkvWnH blhTSfKiqLMrxphkIDNkMDRDWNKulYOmTqdvpUjWeD2aCyNSpu5xjVqWn2wByRaU SJYOhxbslLLb+ts7h+xapQJgEoq1kUnIx9NR0hqRv6+mSHEaA93KP0FimLIqqYko dnMYJr61SY2T5ot1QhzKLo1wmtWxKTovxRDZWDssyL42dw8CmtPLhtT39jPaSAV0 n66c77S0Sgzu3/C5VlhDA== 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=1710053659; x= 1710140059; bh=jYgNFKoegeuVhWSAq6NHSNBWJ2GvxYXdAko3rNDG9NU=; b=X TtbcgFCeJ9vXXFNKsdx5t5GOtkH8GQCX5wEXkG1qWxQNu2IOW23/bjuXYVCTRFlJ Rd5S3ltxqIKSDYf3QiPBe18C3qyowlxmZq1g86BRAHL9HSJib2IsGdDkWrpRcORc 5eG7aiViFOFnn0+l91fQfQM/kq/zMZ61ekskC7K380Wx1Hw+Zr07r3iHmFML8ZKG 7hjrXRyDlEyIIfzkVJsuFFGzwgTO2YOP3rlHuG+RA1ldKKvD/Xpe4b343eVu03VY SmLnqh2jWmUAOYj/TG/jI6WrJrTSyYJ22mq7EHXMzdicYkWB+5pSaj9Q78Z8DXZm +FFRSMMUCcv09DIfSR62w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrieekgddutdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpedfnfhukhgvucffrdculfhonhgvshdfuceolhhukhgvsehl jhhonhgvshdruggvvheqnecuggftrfgrthhtvghrnhepgfetfedugfetudeuheetjefhue fggfelleetvdevtefhueeujeefvdegleevhefgnecuvehluhhsthgvrhfuihiivgeptden ucfrrghrrghmpehmrghilhhfrhhomheplhhukhgvsehljhhonhgvshdruggvvh X-ME-Proxy: Feedback-ID: i5ec1447f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 10 Mar 2024 01:54:17 -0500 (EST) From: "Luke D. Jones" To: platform-driver-x86@vger.kernel.org Cc: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, "Luke D. Jones" Subject: [PATCH v1 1/1] platform/x86: asus-wmi: add support for 2024 ROG Mini-LED Date: Sun, 10 Mar 2024 19:54:08 +1300 Message-ID: <20240310065408.63703-2-luke@ljones.dev> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240310065408.63703-1-luke@ljones.dev> References: <20240310065408.63703-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: quoted-printable Content-Type: text/plain; charset="utf-8" Support the 2024 mini-led backlight and adjust the related functions to select the relevant dev-id. Also add `available_mini_led_mode` to the platform sysfs since the available mini-led levels can be different. Signed-off-by: Luke D. Jones --- .../ABI/testing/sysfs-platform-asus-wmi | 8 ++++ drivers/platform/x86/asus-wmi.c | 48 ++++++++++++++++--- include/linux/platform_data/x86/asus-wmi.h | 1 + 3 files changed, 51 insertions(+), 6 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-platform-asus-wmi b/Documentat= ion/ABI/testing/sysfs-platform-asus-wmi index 8a7e25bde085..e32b4f0ae15f 100644 --- a/Documentation/ABI/testing/sysfs-platform-asus-wmi +++ b/Documentation/ABI/testing/sysfs-platform-asus-wmi @@ -126,6 +126,14 @@ Description: Change the mini-LED mode: * 0 - Single-zone, * 1 - Multi-zone + * 2 - Multi-zone strong (available on newer generation mini-led) + +What: /sys/devices/platform//avilable_mini_led_mode +Date: Jun 2023 +KernelVersion: 6.9 +Contact: "Luke Jones" +Description: + List the available mini-led modes. =20 What: /sys/devices/platform//ppt_pl1_spl Date: Jun 2023 diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wm= i.c index 18be35fdb381..a56152ccfbe7 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -297,6 +297,7 @@ struct asus_wmi { =20 bool panel_overdrive_available; bool mini_led_mode_available; + u32 mini_led_dev_id; =20 struct hotplug_slot hotplug_slot; struct mutex hotplug_lock; @@ -2109,10 +2110,17 @@ static ssize_t mini_led_mode_show(struct device *de= v, struct asus_wmi *asus =3D dev_get_drvdata(dev); int result; =20 - result =3D asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_MINI_LED_MOD= E); - if (result < 0) - return result; + result =3D asus_wmi_get_devstate_simple(asus, asus->mini_led_dev_id); =20 + // Remap the mode values to match previous generation mini-led including + // if errored -19 since some of these bios return a bad result if set to = "2" + // which is mini-led off + if (asus->mini_led_dev_id =3D=3D ASUS_WMI_DEVID_MINI_LED_MODE2) { + if (result >=3D 0 || result =3D=3D -19) + result =3D result =3D=3D 1 ? 2 : result =3D=3D 0 ? 1 : 0; + } else if (result < 0) { + return result; + } return sysfs_emit(buf, "%d\n", result); } =20 @@ -2129,10 +2137,15 @@ static ssize_t mini_led_mode_store(struct device *d= ev, if (result) return result; =20 - if (mode > 1) + if (mode > 1 && asus->mini_led_dev_id =3D=3D ASUS_WMI_DEVID_MINI_LED_MODE) return -EINVAL; + if (mode > 2 && asus->mini_led_dev_id =3D=3D ASUS_WMI_DEVID_MINI_LED_MODE= 2) + return -EINVAL; + // Remap the mode values to match previous generation mini-led + if (asus->mini_led_dev_id =3D=3D ASUS_WMI_DEVID_MINI_LED_MODE2) + mode =3D mode =3D=3D 2 ? 1 : mode =3D=3D 0 ? 2 : 0; =20 - err =3D asus_wmi_set_devstate(ASUS_WMI_DEVID_MINI_LED_MODE, mode, &result= ); + err =3D asus_wmi_set_devstate(asus->mini_led_dev_id, mode, &result); =20 if (err) { pr_warn("Failed to set mini-LED: %d\n", err); @@ -2150,6 +2163,21 @@ static ssize_t mini_led_mode_store(struct device *de= v, } static DEVICE_ATTR_RW(mini_led_mode); =20 +static ssize_t available_mini_led_mode_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct asus_wmi *asus =3D dev_get_drvdata(dev); + + if (asus->mini_led_dev_id =3D=3D ASUS_WMI_DEVID_MINI_LED_MODE) + return sysfs_emit(buf, "0 1\n"); + if (asus->mini_led_dev_id =3D=3D ASUS_WMI_DEVID_MINI_LED_MODE2) + return sysfs_emit(buf, "0 1 2\n"); + + return sysfs_emit(buf, "0\n"); +} + +static DEVICE_ATTR_RO(available_mini_led_mode); + /* Quirks ****************************************************************= *****/ =20 static void asus_wmi_set_xusb2pr(struct asus_wmi *asus) @@ -4174,6 +4202,7 @@ static struct attribute *platform_attributes[] =3D { &dev_attr_nv_temp_target.attr, &dev_attr_panel_od.attr, &dev_attr_mini_led_mode.attr, + &dev_attr_available_mini_led_mode.attr, NULL }; =20 @@ -4496,10 +4525,17 @@ static int asus_wmi_add(struct platform_device *pde= v) asus->nv_dyn_boost_available =3D asus_wmi_dev_is_present(asus, ASUS_WMI_D= EVID_NV_DYN_BOOST); asus->nv_temp_tgt_available =3D asus_wmi_dev_is_present(asus, ASUS_WMI_DE= VID_NV_THERM_TARGET); asus->panel_overdrive_available =3D asus_wmi_dev_is_present(asus, ASUS_WM= I_DEVID_PANEL_OD); - asus->mini_led_mode_available =3D asus_wmi_dev_is_present(asus, ASUS_WMI_= DEVID_MINI_LED_MODE); asus->ally_mcu_usb_switch =3D acpi_has_method(NULL, ASUS_USB0_PWR_EC0_CSE= E) && dmi_match(DMI_BOARD_NAME, "RC71L"); =20 + if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_MINI_LED_MODE)) { + asus->mini_led_mode_available =3D true; + asus->mini_led_dev_id =3D ASUS_WMI_DEVID_MINI_LED_MODE; + } else if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_MINI_LED_MODE2)) { + asus->mini_led_mode_available =3D true; + asus->mini_led_dev_id =3D ASUS_WMI_DEVID_MINI_LED_MODE2; + } + err =3D fan_boost_mode_check_present(asus); if (err) goto fail_fan_boost_mode; diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/pla= tform_data/x86/asus-wmi.h index ab1c7deff118..9cadce10ad9a 100644 --- a/include/linux/platform_data/x86/asus-wmi.h +++ b/include/linux/platform_data/x86/asus-wmi.h @@ -71,6 +71,7 @@ #define ASUS_WMI_DEVID_LID_FLIP 0x00060062 #define ASUS_WMI_DEVID_LID_FLIP_ROG 0x00060077 #define ASUS_WMI_DEVID_MINI_LED_MODE 0x0005001E +#define ASUS_WMI_DEVID_MINI_LED_MODE2 0x0005002E =20 /* Storage */ #define ASUS_WMI_DEVID_CARDREADER 0x00080013 --=20 2.44.0