From patchwork Sun May 26 18:17:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 799142 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (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 0D2E312BF1A; Sun, 26 May 2024 18:18:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716747514; cv=none; b=gAHS6l+0Y+TlwlKAw1e8343KKkg87NaRR02uhyyDAgKyqNbi9oOF8qg9YnMqqMcTYFdm9QQwtb0XXm72hBNCkK9QSDi+GacqvwrqyVflkAB17+g7eQoaJC9JQlybI1H4uY7R5B7g5eUMRa7IK/UNNYVYnDHUGXdS5K6TRodW29Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716747514; c=relaxed/simple; bh=RVbMZZPenvcdjoM7tM7SuacRL6z8c0aDQVo/8uG6Iis=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OW3alPaLNvqbh7fltCYGfttyrpzvToHdHhE2VSUkyJRShvwy3JPS1rTBqTsrR07IOZFsYhz9CU/+Dq/pe+eY8dhBFtXYOXu0Q/cJMPi5sHWUcYY3mCqvHu2Mrjp2H3e1CVulNVKbx1e3yh/5rAqeG5O8MHoGoN4pB/JhOx63KB4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=VSL0TaQR; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="VSL0TaQR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1716747502; bh=RVbMZZPenvcdjoM7tM7SuacRL6z8c0aDQVo/8uG6Iis=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=VSL0TaQRhrpXHjNGPjby/pUWJmoXOPgBw+zjOdh7jX4asLTeE9bBlss9lm5MTIFh8 /lUWK7YnoDkmdcUc8oFINJG5R/sRNm8ISfZ5qe78d3zdRJnnR0ubLa9bbSB3++F6RL MzTLwWVi+5y87v0hcIrmoLF+Xmh7eM3JXPhPMVIs= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sun, 26 May 2024 20:17:15 +0200 Subject: [PATCH v3 1/4] leds: class: warn about name collisions earlier Precedence: bulk X-Mailing-List: linux-leds@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240526-cros_ec-kbd-led-framework-v3-1-ee577415a521@weissschuh.net> References: <20240526-cros_ec-kbd-led-framework-v3-0-ee577415a521@weissschuh.net> In-Reply-To: <20240526-cros_ec-kbd-led-framework-v3-0-ee577415a521@weissschuh.net> To: Lee Jones , Benson Leung , Guenter Roeck , Tzung-Bi Shih , Pavel Machek Cc: chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, Dustin Howett , Mario Limonciello , linux-leds@vger.kernel.org, Rajas Paranjpe , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1716747501; l=1430; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=RVbMZZPenvcdjoM7tM7SuacRL6z8c0aDQVo/8uG6Iis=; b=jqYgFK1Xd+zJu9VNIlc2yIcfAB75+M4DSKRhePySUcMWt1kXjI0SS7WD0ihcqLtFsSI/HIH4M dx+GeS8nWUCDVp+mmtUAjc/us7tEiQTHK1YEazMzpSjNFB7z4Csu0Wu X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Other warnings refer to the name after renaming, which is clearer when that name is mentioned first. It is also clearer where "ret" comes from. While at it, also add the necessary newline to the message and fix the parameter alignment. Signed-off-by: Thomas Weißschuh --- drivers/leds/led-class.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 24fcff682b24..c298355d5b7d 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c @@ -503,6 +503,9 @@ int led_classdev_register_ext(struct device *parent, ret = led_classdev_next_name(proposed_name, final_name, sizeof(final_name)); if (ret < 0) return ret; + else if (ret) + dev_warn(parent, "Led %s renamed to %s due to name collision\n", + proposed_name, final_name); if (led_cdev->color >= LED_COLOR_ID_MAX) dev_warn(parent, "LED %s color identifier out of range\n", final_name); @@ -518,10 +521,6 @@ int led_classdev_register_ext(struct device *parent, if (init_data && init_data->fwnode) device_set_node(led_cdev->dev, init_data->fwnode); - if (ret) - dev_warn(parent, "Led %s renamed to %s due to name collision", - proposed_name, dev_name(led_cdev->dev)); - if (led_cdev->flags & LED_BRIGHT_HW_CHANGED) { ret = led_add_brightness_hw_changed(led_cdev); if (ret) { From patchwork Sun May 26 18:17:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 799344 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (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 0D21D12BF11; Sun, 26 May 2024 18:18:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716747515; cv=none; b=K8Af7r2F65Om1mJ/rlT+nO46/dUyfUKBS1of2bOcsiZWCaY4fFdPuyVTqUa7Ca/+9XkrczufaPkctfDUQMGPoIBOOqehP44reIL1UYB0Yorj7xIRjwb9NQg4SYk8FQwackQl/UXqNaAcjxt4q0jDN1VPNQB+l6ohNdq3w3XavIw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716747515; c=relaxed/simple; bh=o5fqvb3/w5pnVYn9E3ghdcEeFk44zpjLuVu8Q1kPrU8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YfYRE1Y9gQMCVqqZ7DGQKuKPeA/x9rGrDMJVPjWDH9ZjQfX0okkBJfdpfL2JzjpdWppuS5j62/4g8UB3HluwyGOkiThsIhY5vLnucPLA/HIFNWAJNX9CjNacMkzJSjmsIBTMqnvt5p+Oy9PoP21z59kvdtsiZuJ2wiKVyhLzt3I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=oG00mbCj; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="oG00mbCj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1716747502; bh=o5fqvb3/w5pnVYn9E3ghdcEeFk44zpjLuVu8Q1kPrU8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=oG00mbCjZV03syE8vVMKNMGLtxiI7CFz+i/mi6lKQ4kahXFCP6wZvyrkOWOhSBAOw cuKk+ENDV3luYvDrJhBFrIDurSvZbcA6GBkXZlf6vAN7DwdYXyRotPeszjbgbhiXe3 BrCp50SRfx438aTlKM6OlrdO2qRGhsrNdYP5+dR8= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sun, 26 May 2024 20:17:16 +0200 Subject: [PATCH v3 2/4] leds: add flag to avoid automatic renaming of led devices Precedence: bulk X-Mailing-List: linux-leds@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240526-cros_ec-kbd-led-framework-v3-2-ee577415a521@weissschuh.net> References: <20240526-cros_ec-kbd-led-framework-v3-0-ee577415a521@weissschuh.net> In-Reply-To: <20240526-cros_ec-kbd-led-framework-v3-0-ee577415a521@weissschuh.net> To: Lee Jones , Benson Leung , Guenter Roeck , Tzung-Bi Shih , Pavel Machek Cc: chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, Dustin Howett , Mario Limonciello , linux-leds@vger.kernel.org, Rajas Paranjpe , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1716747501; l=1355; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=o5fqvb3/w5pnVYn9E3ghdcEeFk44zpjLuVu8Q1kPrU8=; b=UuKtiug1UtluwOnfe1goI/vLdBWB9Kzcj4CMjbR6DCSxeESDq5Vp+XZD5i510Ppr35TMIzm9P rWGXRNI1GbBDXdyyEyP2JarvLHBwMgBzjeczQK5iMzhRtIQvBx70F5D X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Add a mechanism for drivers to opt-out of the automatic device renaming on conflicts. Those drivers will provide their own conflict resolution. Signed-off-by: Thomas Weißschuh --- drivers/leds/led-class.c | 2 ++ include/linux/leds.h | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index c298355d5b7d..2f08c20702f3 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c @@ -503,6 +503,8 @@ int led_classdev_register_ext(struct device *parent, ret = led_classdev_next_name(proposed_name, final_name, sizeof(final_name)); if (ret < 0) return ret; + else if (ret && led_cdev->flags & LED_REJECT_NAME_CONFLICT) + return -EEXIST; else if (ret) dev_warn(parent, "Led %s renamed to %s due to name collision\n", proposed_name, final_name); diff --git a/include/linux/leds.h b/include/linux/leds.h index 6300313c46b7..36663ac6c58a 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h @@ -107,6 +107,7 @@ struct led_classdev { #define LED_BRIGHT_HW_CHANGED BIT(21) #define LED_RETAIN_AT_SHUTDOWN BIT(22) #define LED_INIT_DEFAULT_TRIGGER BIT(23) +#define LED_REJECT_NAME_CONFLICT BIT(24) /* set_brightness_work / blink_timer flags, atomic, private. */ unsigned long work_flags; From patchwork Sun May 26 18:17:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 799345 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (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 0D30112BF1F; Sun, 26 May 2024 18:18:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716747514; cv=none; b=sA4kZGZxWxh5/jKBsjpzgPP0lH4fBsnPsf37BmfmY3e0qADRzqjWloGV4f6qEHkZjyWxS83/nPs5cX7W7wjjeoMgCchEMD7sIJwEOl0eTPRb61P1fTfUaEG7tb0IPseAIllfsYOdV1/4fcgLTcdMrk5M3dSGWpbQXtyBIYwLjkU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716747514; c=relaxed/simple; bh=KC/TRarvgs7SYNDEshZDwV92vrtoHyo8D9b8NVbqSj0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sf9VETrwjKp9pwop5RrQLhoVbowcZXKMGBFdciNhyXHRKxodQs7Bbkj8uBrORZzYHXvonEiUG7Wj7JWEkUB9J93gsL0Yu41HSppNlDrmTSNyNfFG4ZSygRZlQBmpkMHa42mBFdZ8w7TmRf1xIwc1bcg6v75nKGSrja2uTOS/U2U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=pUlo7Uoq; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="pUlo7Uoq" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1716747502; bh=KC/TRarvgs7SYNDEshZDwV92vrtoHyo8D9b8NVbqSj0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=pUlo7UoqvCt2hKNjomg112e4CjZDW7SQzNHNqP2qU/FL8GTONofbMhwN3LEl9jIVI QEjftnoeGQCXXQxLUfIgDdKKr+EgG5i6K7us0sKqI+22LCuWw2ifEnMVd2QM67oCjF hdum9kNVKike3MQVNGMbUqfswajciYpJ9GvTS5wg= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sun, 26 May 2024 20:17:17 +0200 Subject: [PATCH v3 3/4] platform/chrome: cros_kbd_led_backlight: allow binding through mfd device Precedence: bulk X-Mailing-List: linux-leds@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240526-cros_ec-kbd-led-framework-v3-3-ee577415a521@weissschuh.net> References: <20240526-cros_ec-kbd-led-framework-v3-0-ee577415a521@weissschuh.net> In-Reply-To: <20240526-cros_ec-kbd-led-framework-v3-0-ee577415a521@weissschuh.net> To: Lee Jones , Benson Leung , Guenter Roeck , Tzung-Bi Shih , Pavel Machek Cc: chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, Dustin Howett , Mario Limonciello , linux-leds@vger.kernel.org, Rajas Paranjpe , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1716747501; l=4015; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=KC/TRarvgs7SYNDEshZDwV92vrtoHyo8D9b8NVbqSj0=; b=+C/B13+2008IRCXdR+q2epMz/eBidKzeYrip9lHnqwu+xOiESAxjTZvJXOsGxL8PBhFJB40Ft xl25fZE5BLqCG3c5YHWQdG8bof3GCQdY4imntnDMXyd8wKrHgLxyFtr X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= The ChromeOS EC used in Framework laptops supports the standard CrOS EC keyboard backlight protocol. However the firmware on these laptops doesn't implement the ACPI ID GOOG0002 that is recognized by cros_kbd_led_backlight and they also don't use device tree. Prepare the existing cros_kbd_led_backlight driver to be probed through the CrOS EC mfd device which works without ACPI or OF support. Signed-off-by: Thomas Weißschuh --- drivers/platform/chrome/Kconfig | 2 +- drivers/platform/chrome/cros_kbd_led_backlight.c | 40 ++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/drivers/platform/chrome/Kconfig b/drivers/platform/chrome/Kconfig index 073616b5b5a0..7dbeb786352a 100644 --- a/drivers/platform/chrome/Kconfig +++ b/drivers/platform/chrome/Kconfig @@ -150,7 +150,7 @@ config CROS_EC_PROTO config CROS_KBD_LED_BACKLIGHT tristate "Backlight LED support for Chrome OS keyboards" - depends on LEDS_CLASS && (ACPI || CROS_EC) + depends on LEDS_CLASS && (ACPI || CROS_EC || MFD_CROS_EC_DEV) help This option enables support for the keyboard backlight LEDs on select Chrome OS systems. diff --git a/drivers/platform/chrome/cros_kbd_led_backlight.c b/drivers/platform/chrome/cros_kbd_led_backlight.c index b83e4f328620..78097c8a4966 100644 --- a/drivers/platform/chrome/cros_kbd_led_backlight.c +++ b/drivers/platform/chrome/cros_kbd_led_backlight.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -194,13 +195,46 @@ static const __maybe_unused struct keyboard_led_drvdata keyboard_led_drvdata_ec_ #endif /* IS_ENABLED(CONFIG_CROS_EC) */ +#if IS_ENABLED(CONFIG_MFD_CROS_EC_DEV) +static int keyboard_led_init_ec_pwm_mfd(struct platform_device *pdev) +{ + struct cros_ec_dev *ec_dev = dev_get_drvdata(pdev->dev.parent); + struct cros_ec_device *cros_ec = ec_dev->ec_dev; + struct keyboard_led *keyboard_led = platform_get_drvdata(pdev); + + keyboard_led->ec = cros_ec; + + return 0; +} + +static const struct keyboard_led_drvdata keyboard_led_drvdata_ec_pwm_mfd = { + .init = keyboard_led_init_ec_pwm_mfd, + .brightness_set_blocking = keyboard_led_set_brightness_ec_pwm, + .brightness_get = keyboard_led_get_brightness_ec_pwm, + .max_brightness = KEYBOARD_BACKLIGHT_MAX, +}; + +#else /* IS_ENABLED(CONFIG_MFD_CROS_EC_DEV) */ + +static const struct keyboard_led_drvdata keyboard_led_drvdata_ec_pwm_mfd = {}; + +#endif /* IS_ENABLED(CONFIG_MFD_CROS_EC_DEV) */ + +static int keyboard_led_is_mfd_device(struct platform_device *pdev) +{ + return IS_ENABLED(CONFIG_MFD_CROS_EC_DEV) && mfd_get_cell(pdev); +} + static int keyboard_led_probe(struct platform_device *pdev) { const struct keyboard_led_drvdata *drvdata; struct keyboard_led *keyboard_led; int error; - drvdata = device_get_match_data(&pdev->dev); + if (keyboard_led_is_mfd_device(pdev)) + drvdata = &keyboard_led_drvdata_ec_pwm_mfd; + else + drvdata = device_get_match_data(&pdev->dev); if (!drvdata) return -EINVAL; @@ -216,13 +250,15 @@ static int keyboard_led_probe(struct platform_device *pdev) } keyboard_led->cdev.name = "chromeos::kbd_backlight"; - keyboard_led->cdev.flags |= LED_CORE_SUSPENDRESUME; + keyboard_led->cdev.flags |= LED_CORE_SUSPENDRESUME | LED_REJECT_NAME_CONFLICT; keyboard_led->cdev.max_brightness = drvdata->max_brightness; keyboard_led->cdev.brightness_set = drvdata->brightness_set; keyboard_led->cdev.brightness_set_blocking = drvdata->brightness_set_blocking; keyboard_led->cdev.brightness_get = drvdata->brightness_get; error = devm_led_classdev_register(&pdev->dev, &keyboard_led->cdev); + if (error == -EEXIST) /* Already bound via other mechanism */ + return -ENODEV; if (error) return error; From patchwork Sun May 26 18:17:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 799140 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (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 77B6312BF20; Sun, 26 May 2024 18:18:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716747515; cv=none; b=bgItauGA5m50jNTEDf94wHo4+G2OfxQZvvUXLtEJAJUlyOWc/hqDl8KpS3S8CnaID6RiJNzDcmntmR1D51JuT2+666e6/rmwXXNsUn1pTiChWRErHeU9MSiV54nnuDl6Lou3BDE8No2hnx4hidnQUfemWw7dE3PmrzJrKYbzliY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716747515; c=relaxed/simple; bh=5whg+Ib6ob2V3Udbi5NwANP2fRI1+wV3sVY7NRxurO4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EHUZ/2yaV85cR3WJP/bqyTmKkRHrlW10sWrFI0AwyxMFbc0VGfRBPTg+rew53frBxv7Cw26jBRrujjvdnHXzcIx0UZ/ZAAvK4ocsM5zxl/bBI+7LRcMLsUcSYnbSqaUnYaf9s28ioLhePirs5aSEbXs4/T4RbD02uaylJatLXoQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=KL1kKobG; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="KL1kKobG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1716747502; bh=5whg+Ib6ob2V3Udbi5NwANP2fRI1+wV3sVY7NRxurO4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=KL1kKobG/hIYRlUHO/aN9r5j6u5ar31U6e6NwIAWUTis6Mu23S2xAYV7d0FutK1Ap wcWViMqCzNb6VITpUxLnQ7EkAN02woSxH5x0invTB9EPZ2FVscFInw+VUWXu+Hsp0z 5wITDrLolfQK3eXLS8+Bwv4mcHDqbYKW/E2wZk2c= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sun, 26 May 2024 20:17:18 +0200 Subject: [PATCH v3 4/4] mfd: cros_ec: Register keyboard backlight subdevice Precedence: bulk X-Mailing-List: linux-leds@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240526-cros_ec-kbd-led-framework-v3-4-ee577415a521@weissschuh.net> References: <20240526-cros_ec-kbd-led-framework-v3-0-ee577415a521@weissschuh.net> In-Reply-To: <20240526-cros_ec-kbd-led-framework-v3-0-ee577415a521@weissschuh.net> To: Lee Jones , Benson Leung , Guenter Roeck , Tzung-Bi Shih , Pavel Machek Cc: chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, Dustin Howett , Mario Limonciello , linux-leds@vger.kernel.org, Rajas Paranjpe , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1716747501; l=1230; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=5whg+Ib6ob2V3Udbi5NwANP2fRI1+wV3sVY7NRxurO4=; b=GzSekRHu7tiKgLifZlJdqItMDKzgvxrVirOKDe4ub8Gvkg5zgOqeYeH6/rcwblmhcT0tnPzbI 0k8y9tjv79JCca4RPruCGc6G/qbD+ycMqjJmERAxFeVKLLDbBdFtKZw X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Load cros_kbd_led_backlight when the EC reports EC_FEATURE_PWM_KEYB. This makes cros_kbd_led_backlight work on machines without specific ACPI or OF support for the keyboard backlight. Signed-off-by: Thomas Weißschuh --- drivers/mfd/cros_ec_dev.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c index a52d59cc2b1e..4444b361aeae 100644 --- a/drivers/mfd/cros_ec_dev.c +++ b/drivers/mfd/cros_ec_dev.c @@ -99,6 +99,10 @@ static const struct mfd_cell cros_ec_wdt_cells[] = { { .name = "cros-ec-wdt", } }; +static const struct mfd_cell cros_ec_keyboard_leds_cells[] = { + { .name = "cros-keyboard-leds", }, +}; + static const struct cros_feature_to_cells cros_subdevices[] = { { .id = EC_FEATURE_CEC, @@ -125,6 +129,11 @@ static const struct cros_feature_to_cells cros_subdevices[] = { .mfd_cells = cros_ec_wdt_cells, .num_cells = ARRAY_SIZE(cros_ec_wdt_cells), }, + { + .id = EC_FEATURE_PWM_KEYB, + .mfd_cells = cros_ec_keyboard_leds_cells, + .num_cells = ARRAY_SIZE(cros_ec_keyboard_leds_cells), + }, }; static const struct mfd_cell cros_ec_platform_cells[] = {