From nobody Mon Jun 8 16:30:31 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 816902BCF45; Thu, 28 May 2026 02:34:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779935672; cv=none; b=dEiitFjiwRMEBaVS4CjOF/0wVvA1p1P4C7Y8co2vdBYOL/wKomHFYSJb3O9nXrcIVxqMsgVtOcgBYvNLaslgsVMjcH7lkdQ/jjjLrLTcHPF7fCT23xwyEG5SJNNVbM7/SzXh2XaG8qZKZTgflfjlOAiv2SyEwef0dg4bB2gCT6A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779935672; c=relaxed/simple; bh=cWFq0UmsChy1UMKhJ3jNAc6iyXXgrydkyp2h6htMuew=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=a+wbvEj0U7JTXDdV3p3EhIS5f7oaM+i0CRqiydIH62KmEDDMi1A7sywlTw4K8WF+poqyjrShOrARp6+TucldQhw7L7YbdRPQDtIOOSh6neBg76E+UxH99NCRMc+V1iN31zxxlL/TxWvlM2YaVKBCV8rihqGW6O4BRcxUdt6Qsec= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=t3Xkv2Tu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="t3Xkv2Tu" Received: by smtp.kernel.org (Postfix) with ESMTPS id 27998C2BCB4; Thu, 28 May 2026 02:34:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1779935672; bh=cWFq0UmsChy1UMKhJ3jNAc6iyXXgrydkyp2h6htMuew=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=t3Xkv2Tuy3HGPA+x+efSpVrJ4fXs6qm7x1cFQ16Fk8GOlXZzqJ6PCi6qS3rzDJoN8 ZYhIJo/zsKyDJCMSKNniAFs5Gs2sb/t6bDHfoJ3eCQ0PcQI6otmT8wNPCwXlelYaQz V4GYErK3yV+Oe0mIegO0bZyWCB9D1Joyh2LLtso2dP5/l3M7vMrUOmcuQjMXfV33Ai l1iqTylfAUXfWfex8enm7AXQdOHkOrvnY1vJ2KF7yba9evGv26OfgFtXkn+PXRRpC2 xcetoKj0cmeh+Y3ASuIHcRGMyCekEIxN5SnxWeEp24shZcQGVThWoOINg6Z3/GVZYi h5Jl8gAwaPbwA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1289ACD6E44; Thu, 28 May 2026 02:34:32 +0000 (UTC) From: Rudraksha Gupta via B4 Relay Date: Wed, 27 May 2026 19:34:30 -0700 Subject: [PATCH v6 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with vin supply Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260527-expressatt_camera_flash-v6-1-de0f150024e4@gmail.com> References: <20260527-expressatt_camera_flash-v6-0-de0f150024e4@gmail.com> In-Reply-To: <20260527-expressatt_camera_flash-v6-0-de0f150024e4@gmail.com> To: Lee Jones , Pavel Machek , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Linus Walleij , Bjorn Andersson , Konrad Dybcio , Liam Girdwood , Mark Brown Cc: linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, phone-devel@vger.kernel.org, Rudraksha Gupta , Conor Dooley X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779935671; l=2722; i=guptarud@gmail.com; s=20240916; h=from:subject:message-id; bh=zVrQqx9DX85PpInFmz437RLTadxI5BhJ9KjSu1CJI9w=; b=9br2+hzBNCL2YlZb5RbnwvO/7VUwaI0dFKogVbWsOPN5yREx/vtJ4hNiMBQ7O35T8kaCW/F7J QRn6EJLHBD+BpUwzAmDyu6Q23uNxSArfVVKBZlBMQqqni9kDkfBoSbT X-Developer-Key: i=guptarud@gmail.com; a=ed25519; pk=ETrudRugWAtOpr0OhRiheQ1lXM4Kk4KGFnBySlKDi2I= X-Endpoint-Received: by B4 Relay for guptarud@gmail.com/20240916 with auth_id=211 X-Original-From: Rudraksha Gupta Reply-To: guptarud@gmail.com From: Rudraksha Gupta Some flash ICs use the same one-wire pulse-count protocol as the RT8515 but have only a single enable line for both flash and torch modes, plus an optional input voltage supply (e.g. a GPIO-controlled fixed regulator) that gates power to the chip. Make ent-gpios optional and add a vin-supply property to support these variants. Add a oneOf constraint requiring exactly one of ent-gpios or vin-supply. Add a binding example showing the single-GPIO configuration with an input supply. Assisted-by: Claude:claude-opus-4.6 Acked-by: Conor Dooley Reviewed-by: Linus Walleij Signed-off-by: Rudraksha Gupta --- .../devicetree/bindings/leds/richtek,rt8515.yaml | 34 ++++++++++++++++++= +++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/leds/richtek,rt8515.yaml b/D= ocumentation/devicetree/bindings/leds/richtek,rt8515.yaml index 0356371a6b01..ab3c5139132c 100644 --- a/Documentation/devicetree/bindings/leds/richtek,rt8515.yaml +++ b/Documentation/devicetree/bindings/leds/richtek,rt8515.yaml @@ -15,6 +15,10 @@ description: | current for each mode is defined in hardware using two resistors RFS and RTS. =20 + Some flash ICs use the same one-wire pulse-count protocol but have + only a single enable line for both flash and torch modes. For these + single-channel variants, only enf-gpios is needed. + properties: compatible: const: richtek,rt8515 @@ -26,6 +30,11 @@ properties: ent-gpios: maxItems: 1 description: A connection to the 'ENT' (enable torch) pin. + Not present on single-channel flash ICs that use only one enable + line for both flash and torch modes. + + vin-supply: + description: Optional input supply for the flash IC. =20 richtek,rfs-ohms: minimum: 7680 @@ -81,10 +90,15 @@ properties: =20 required: - compatible - - ent-gpios - enf-gpios - led =20 +oneOf: + - required: + - ent-gpios + - required: + - vin-supply + additionalProperties: false =20 examples: @@ -108,4 +122,22 @@ examples: }; }; =20 + - | + /* Single-channel flash IC with input supply */ + #include + #include + + led-controller { + compatible =3D "richtek,rt8515"; + enf-gpios =3D <&tlmm 3 GPIO_ACTIVE_HIGH>; + vin-supply =3D <&flash_reg>; + richtek,rfs-ohms =3D <16000>; + + led { + function =3D LED_FUNCTION_FLASH; + color =3D ; + flash-max-timeout-us =3D <250000>; + }; + }; + ... --=20 2.54.0 From nobody Mon Jun 8 16:30:31 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 815193438AF; Thu, 28 May 2026 02:34:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779935672; cv=none; b=JzuczlF6l5U4Zm38VDLXRX52KKbQ/SbXRivXLHlLa7xtVh3dyQVeqgjAZoyNBeBp69d8MdEcj3RbixPK0P5x4HDooppJPB28Kpeah2UkTxtHtlQXvtNUtgwqO5P4dK3oe9lV55Og1CabDVdMMS6FQM5pqsCmoioU7XZmA/da7TY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779935672; c=relaxed/simple; bh=Y+4wVy0zYARcOMHewWAaadofMeQq0fIFyZ0TGq0ZCY8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=h68SJzW1dsLE8NkZqZJF6oSPSX3AZCrytyzAunZaJRg8LRHadiEDjhxfBhg+27Yuivl2iPzT9s2BjwajM/ztEP+NzWtiuREAbmD+Gqh9h8GxjJxNzCJPMGtdLBYoY6VIkhdpzihLofJUY+41r2K2oFtk2BRk9MW4Nd1qYgbBg9c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mDFDcqHI; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mDFDcqHI" Received: by smtp.kernel.org (Postfix) with ESMTPS id 37C3DC2BCC7; Thu, 28 May 2026 02:34:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1779935672; bh=Y+4wVy0zYARcOMHewWAaadofMeQq0fIFyZ0TGq0ZCY8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=mDFDcqHI/hEBhKlpKPoiBW6wViuW8n5xRm/ZIZeVvU4eBJcrsPqPL8Ei2f7GLG/4P U67E3gfvwp5/USnEcSb3A8ULN939BfgR9yMdqW2rx+w68CoxOZTzDIRIowRpXFWFk2 9G2rE6rCX9X/cdsr0B2zoDFO4NjqrKmaYVBuo1OdDZtlmINX2C7N4OK2gFzMTh9iwA CvFNggSzO2kje1ZqVE5FJJLwT7BmnjDOHHxnZyBk0lAbb92v4adGHUpHPIBAeCTDY3 K7+aE7pwNVyLZcRaPQc7v1uisT6J7vkEKs0SGidMu2Zh+eTd382IJKM/nE7E//dWP+ qRqqPMpTKMjzw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23B40CD5BC9; Thu, 28 May 2026 02:34:32 +0000 (UTC) From: Rudraksha Gupta via B4 Relay Date: Wed, 27 May 2026 19:34:31 -0700 Subject: [PATCH v6 2/3] leds: flash: rt8515: Support single-GPIO flash ICs with vin supply Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260527-expressatt_camera_flash-v6-2-de0f150024e4@gmail.com> References: <20260527-expressatt_camera_flash-v6-0-de0f150024e4@gmail.com> In-Reply-To: <20260527-expressatt_camera_flash-v6-0-de0f150024e4@gmail.com> To: Lee Jones , Pavel Machek , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Linus Walleij , Bjorn Andersson , Konrad Dybcio , Liam Girdwood , Mark Brown Cc: linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, phone-devel@vger.kernel.org, Rudraksha Gupta X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779935671; l=8840; i=guptarud@gmail.com; s=20240916; h=from:subject:message-id; bh=ECsUFWhTz2Rp4ynQ93GJ/pcNMjhSeYMsU+5K5mwgLYA=; b=E84r0jz3m/L680wFgNeCdunrTp+3koZAjcqJHxPV5OrepgPKzNhhMIB2klC9prQnRppxiqM4p dwM7B/PKPMQBqk1Gvnu8mFSUNjEHIS8vj0EKqklZHCCZt7c346v0GHC X-Developer-Key: i=guptarud@gmail.com; a=ed25519; pk=ETrudRugWAtOpr0OhRiheQ1lXM4Kk4KGFnBySlKDi2I= X-Endpoint-Received: by B4 Relay for guptarud@gmail.com/20240916 with auth_id=211 X-Original-From: Rudraksha Gupta Reply-To: guptarud@gmail.com From: Rudraksha Gupta Extend the RT8515 driver to support flash ICs that use only a single GPIO for both flash and torch modes (no separate ENT pin), with an optional vin regulator that gates power to the flash IC. When vin-supply is provided, the driver enables the regulator before activating the LED and disables it when turning off. Make ent-gpios optional. When ent-gpios is absent, the driver uses enf-gpios for both flash and torch brightness control. Assisted-by: Claude:claude-opus-4.6 Reviewed-by: Linus Walleij Signed-off-by: Rudraksha Gupta --- drivers/leds/flash/leds-rt8515.c | 148 +++++++++++++++++++++++++++++------= ---- 1 file changed, 112 insertions(+), 36 deletions(-) diff --git a/drivers/leds/flash/leds-rt8515.c b/drivers/leds/flash/leds-rt8= 515.c index f6b439674c03..0fb84d98211d 100644 --- a/drivers/leds/flash/leds-rt8515.c +++ b/drivers/leds/flash/leds-rt8515.c @@ -31,6 +31,7 @@ #include #include #include +#include =20 #include =20 @@ -44,6 +45,9 @@ #define RT8515_TIMEOUT_US 250000U #define RT8515_MAX_TIMEOUT_US 300000U =20 +#define RT8515_OFF 0 +#define RT8515_ON 1 + struct rt8515 { struct led_classdev_flash fled; struct device *dev; @@ -52,7 +56,7 @@ struct rt8515 { struct regulator *reg; struct gpio_desc *enable_torch; struct gpio_desc *enable_flash; - struct timer_list powerdown_timer; + struct delayed_work powerdown_work; u32 max_timeout; /* Flash max timeout */ int flash_max_intensity; int torch_max_intensity; @@ -63,27 +67,57 @@ static struct rt8515 *to_rt8515(struct led_classdev_fla= sh *fled) return container_of(fled, struct rt8515, fled); } =20 -static void rt8515_gpio_led_off(struct rt8515 *rt) +static int rt8515_gpio_led_off(struct rt8515 *rt) { - gpiod_set_value(rt->enable_flash, 0); - gpiod_set_value(rt->enable_torch, 0); + int ret =3D 0; + + gpiod_set_value(rt->enable_flash, RT8515_OFF); + gpiod_set_value(rt->enable_torch, RT8515_OFF); + + if (!rt->reg) + return ret; + + ret =3D regulator_is_enabled(rt->reg); + if (ret > 0) + ret =3D regulator_disable(rt->reg); + + return ret; } =20 -static void rt8515_gpio_brightness_commit(struct gpio_desc *gpiod, - int brightness) +static int rt8515_gpio_brightness_commit(struct rt8515 *rt, struct gpio_de= sc *gpiod, int brightness) { int i; + int ret; + + /* + * Reset the IC to start brightness from zero, + * then re-enable and pulse to the desired level. + */ + ret =3D rt8515_gpio_led_off(rt); + if (ret) + return ret; + + /* IC needs time to reset its brightness counter */ + usleep_range(100, 200); + + if (rt->reg) { + ret =3D regulator_enable(rt->reg); + if (ret) + return ret; + } =20 /* * Toggling a GPIO line with a small delay increases the * brightness one step at a time. */ for (i =3D 0; i < brightness; i++) { - gpiod_set_value(gpiod, 0); + gpiod_set_value(gpiod, RT8515_OFF); udelay(1); - gpiod_set_value(gpiod, 1); + gpiod_set_value(gpiod, RT8515_ON); udelay(1); } + + return 0; } =20 /* This is setting the torch light level */ @@ -92,23 +126,38 @@ static int rt8515_led_brightness_set(struct led_classd= ev *led, { struct led_classdev_flash *fled =3D lcdev_to_flcdev(led); struct rt8515 *rt =3D to_rt8515(fled); + int ret =3D 0; =20 mutex_lock(&rt->lock); =20 if (brightness =3D=3D LED_OFF) { /* Off */ - rt8515_gpio_led_off(rt); + ret =3D rt8515_gpio_led_off(rt); + if (ret) + goto out; } else if (brightness < RT8515_TORCH_MAX) { - /* Step it up to movie mode brightness using the flash pin */ - rt8515_gpio_brightness_commit(rt->enable_torch, brightness); + /* + * Step it up to movie mode brightness. + * If there is no separate torch pin, use the flash pin + * for torch as well. + */ + ret =3D rt8515_gpio_brightness_commit(rt, + rt->enable_torch ?: rt->enable_flash, brightness); + if (ret) + goto out; } else { - /* Max torch brightness requested */ - gpiod_set_value(rt->enable_torch, 1); + /* + * Max torch brightness requested. + * If there is no separate torch pin, use the flash pin + * for torch as well. + */ + gpiod_set_value(rt->enable_torch ?: rt->enable_flash, RT8515_ON); } =20 +out: mutex_unlock(&rt->lock); =20 - return 0; + return ret; } =20 static int rt8515_led_flash_strobe_set(struct led_classdev_flash *fled, @@ -117,27 +166,36 @@ static int rt8515_led_flash_strobe_set(struct led_cla= ssdev_flash *fled, struct rt8515 *rt =3D to_rt8515(fled); struct led_flash_setting *timeout =3D &fled->timeout; int brightness =3D rt->flash_max_intensity; + int ret =3D 0; =20 - mutex_lock(&rt->lock); - - if (state) { - /* Enable LED flash mode and set brightness */ - rt8515_gpio_brightness_commit(rt->enable_flash, brightness); - /* Set timeout */ - mod_timer(&rt->powerdown_timer, - jiffies + usecs_to_jiffies(timeout->val)); - } else { - timer_delete_sync(&rt->powerdown_timer); + if (!state) { + cancel_delayed_work_sync(&rt->powerdown_work); + mutex_lock(&rt->lock); /* Turn the LED off */ - rt8515_gpio_led_off(rt); + ret =3D rt8515_gpio_led_off(rt); + if (!ret) + fled->led_cdev.brightness =3D LED_OFF; + mutex_unlock(&rt->lock); + return ret; } =20 + mutex_lock(&rt->lock); + + /* Enable LED flash mode and set brightness */ + ret =3D rt8515_gpio_brightness_commit(rt, rt->enable_flash, brightness); + if (ret) + goto out; + + /* Set timeout */ + schedule_delayed_work(&rt->powerdown_work, usecs_to_jiffies(timeout->val)= ); + fled->led_cdev.brightness =3D LED_OFF; /* After this the torch LED will be disabled */ =20 +out: mutex_unlock(&rt->lock); =20 - return 0; + return ret; } =20 static int rt8515_led_flash_strobe_get(struct led_classdev_flash *fled, @@ -145,7 +203,7 @@ static int rt8515_led_flash_strobe_get(struct led_class= dev_flash *fled, { struct rt8515 *rt =3D to_rt8515(fled); =20 - *state =3D timer_pending(&rt->powerdown_timer); + *state =3D delayed_work_pending(&rt->powerdown_work); =20 return 0; } @@ -163,12 +221,18 @@ static const struct led_flash_ops rt8515_flash_ops = =3D { .timeout_set =3D rt8515_led_flash_timeout_set, }; =20 -static void rt8515_powerdown_timer(struct timer_list *t) +static void rt8515_powerdown_work(struct work_struct *work) { - struct rt8515 *rt =3D timer_container_of(rt, t, powerdown_timer); + struct rt8515 *rt =3D container_of(work, struct rt8515, powerdown_work.wo= rk); + int ret; =20 /* Turn the LED off */ - rt8515_gpio_led_off(rt); + mutex_lock(&rt->lock); + ret =3D rt8515_gpio_led_off(rt); + mutex_unlock(&rt->lock); + + if (ret) + dev_err(rt->dev, "failed to turn off LED (%d)\n", ret); } =20 static void rt8515_init_flash_timeout(struct rt8515 *rt) @@ -298,11 +362,18 @@ static int rt8515_probe(struct platform_device *pdev) return dev_err_probe(dev, PTR_ERR(rt->enable_flash), "cannot get ENF (enable flash) GPIO\n"); =20 - /* ENT - Enable Torch line */ - rt->enable_torch =3D devm_gpiod_get(dev, "ent", GPIOD_OUT_LOW); + /* ENT - Enable Torch line (optional for single-GPIO flash ICs) */ + rt->enable_torch =3D devm_gpiod_get_optional(dev, "ent", GPIOD_OUT_LOW); if (IS_ERR(rt->enable_torch)) return dev_err_probe(dev, PTR_ERR(rt->enable_torch), - "cannot get ENT (enable torch) GPIO\n"); + "Failed to obtain the Enable Torch GPIO\n"); + + rt->reg =3D devm_regulator_get_optional(dev, "vin"); + if (IS_ERR(rt->reg)) { + if (PTR_ERR(rt->reg) =3D=3D -EPROBE_DEFER) + return -EPROBE_DEFER; + rt->reg =3D NULL; + } =20 child =3D device_get_next_child_node(dev, NULL); if (!child) { @@ -328,12 +399,17 @@ static int rt8515_probe(struct platform_device *pdev) dev_warn(dev, "flash-max-timeout-us property missing\n"); } - timer_setup(&rt->powerdown_timer, rt8515_powerdown_timer, 0); + INIT_DELAYED_WORK(&rt->powerdown_work, rt8515_powerdown_work); rt8515_init_flash_timeout(rt); =20 fled->ops =3D &rt8515_flash_ops; =20 - led->max_brightness =3D rt->torch_max_intensity; + /* + * If there is no separate torch pin, use flash max intensity + * as max brightness instead. + */ + led->max_brightness =3D rt->enable_torch ? + rt->torch_max_intensity : rt->flash_max_intensity; led->brightness_set_blocking =3D rt8515_led_brightness_set; led->flags |=3D LED_CORE_SUSPENDRESUME | LED_DEV_CAP_FLASH; =20 @@ -372,7 +448,7 @@ static void rt8515_remove(struct platform_device *pdev) struct rt8515 *rt =3D platform_get_drvdata(pdev); =20 rt8515_v4l2_flash_release(rt); - timer_delete_sync(&rt->powerdown_timer); + cancel_delayed_work_sync(&rt->powerdown_work); mutex_destroy(&rt->lock); } =20 --=20 2.54.0 From nobody Mon Jun 8 16:30:31 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8160D253B73; Thu, 28 May 2026 02:34:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779935672; cv=none; b=SeKnGO0xA5kvz/60V5+A43OMK/N/Fu9qNY+y0/J45PmE0yuQ3ReuFXYb9LN09rJfYOztlDSYOBT0+D/tESdvcieAn0lL9MZe68It6CEd2R9z9GLohfaa3OCU19khlnvT5o7sYPOt54x2tTaT5K/LqI0rfJ7ZB0sdvJdrq0OH7JE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779935672; c=relaxed/simple; bh=hyWGe4LoKdOz2ufuUZwugNnXg7/lcAA7rw4Pu1D+Mk4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TXFxG0B1pekVoYnZFoWgB8e5CLs1RsKVctxYqlSVEuAUHsBP2BU5ywIBnApKzG5YxULIttRNQ/TEOY3EPis+ZK+nBYiubNkhXus6pJO/+rk+0Sl/s4rz4/V6TXiIh4iCWCNJj3YZ3Zb2PuyWZiVTb+Q4c5CWIpMJymo6MpqFraE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=i6dhiBcT; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="i6dhiBcT" Received: by smtp.kernel.org (Postfix) with ESMTPS id 4017FC2BCF5; Thu, 28 May 2026 02:34:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1779935672; bh=hyWGe4LoKdOz2ufuUZwugNnXg7/lcAA7rw4Pu1D+Mk4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=i6dhiBcTzc33gMR9Z329RR/Sg6r3GAhHoPQyxu2PhbLdOZ6nt98w9ZAW+KhDEG1/2 QhsapmtyIR+dBq5eqyMG6IHipvbjiHpxrd/4aoXrN9VAjfhnaJQw2nKlKNXOBsCLhi ZMPYD9les4OQgCm1/5+ndkx+WVs+EZ1oDb/05RKE5BKBtBAVE33DPlgVHIJ2a2/sBb gd59atKlin+FIlm5CfRhwq4iHTkQe/NmabbMD46oNuUkRvq1UU97PjTa0ejoBwYN2K 72PAxqobHZX6kKRPddo+73uYCS0lu8vDWRFVMuFgA/Ax/b1UvmNz2FaoIx1uzXbQXY Hnr6kMRtmAh+A== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3322ACD6E48; Thu, 28 May 2026 02:34:32 +0000 (UTC) From: Rudraksha Gupta via B4 Relay Date: Wed, 27 May 2026 19:34:32 -0700 Subject: [PATCH v6 3/3] ARM: dts: qcom: msm8960: expressatt: Add camera flash Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260527-expressatt_camera_flash-v6-3-de0f150024e4@gmail.com> References: <20260527-expressatt_camera_flash-v6-0-de0f150024e4@gmail.com> In-Reply-To: <20260527-expressatt_camera_flash-v6-0-de0f150024e4@gmail.com> To: Lee Jones , Pavel Machek , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Linus Walleij , Bjorn Andersson , Konrad Dybcio , Liam Girdwood , Mark Brown Cc: linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, phone-devel@vger.kernel.org, Rudraksha Gupta , David Heidelberg , Konrad Dybcio X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779935671; l=2830; i=guptarud@gmail.com; s=20240916; h=from:subject:message-id; bh=c3pguP4p4sJML5y1bS/4w0Oy/+Pm7okFRZWMElZDoA0=; b=pKnBUSBZ/y8XHkVPgoy6GGUDn7DbsvbBzUygzI/ILQdXmPBmLzBg2DfKnfqSF+PLm+T7kSNhv tMUfSjsMOgaD/QodEFB7stFNWblAhbLmPKbPkLfsypfK8MVvkS0ac4+ X-Developer-Key: i=guptarud@gmail.com; a=ed25519; pk=ETrudRugWAtOpr0OhRiheQ1lXM4Kk4KGFnBySlKDi2I= X-Endpoint-Received: by B4 Relay for guptarud@gmail.com/20240916 with auth_id=211 X-Original-From: Rudraksha Gupta Reply-To: guptarud@gmail.com From: Rudraksha Gupta Add camera flash support for the Samsung Galaxy Express (expressatt). The flash IC uses a one-wire pulse-count protocol on GPIO 3, powered by a GPIO-controlled fixed regulator on PMIC MPP 4. The regulator is modeled as a regulator-fixed node and supplied to the flash IC via vin-supply. Downstream references: Link: https://github.com/LineageOS/android_kernel_samsung_d2/blob/stable/cm= -12.0-YNG4N/drivers/leds/Makefile#L51 Link: https://github.com/LineageOS/android_kernel_samsung_d2/blob/stable/cm= -12.0-YNG4N/arch/arm/mach-msm/board-apexq-camera.c#L591 Assisted-by: Claude:claude-opus-4.6 Reviewed-by: David Heidelberg Reviewed-by: Konrad Dybcio Signed-off-by: Rudraksha Gupta --- .../dts/qcom/qcom-msm8960-samsung-expressatt.dts | 43 ++++++++++++++++++= ++++ 1 file changed, 43 insertions(+) diff --git a/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts b/a= rch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts index 5a3d88e31cf5..8fcd5e8574fa 100644 --- a/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts +++ b/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 #include +#include #include =20 #include "qcom-msm8960.dtsi" @@ -61,6 +62,32 @@ touchkey_enable: touchkey-enable { regulator-boot-on; }; =20 + vreg_flash: regulator-flash { + compatible =3D "regulator-fixed"; + regulator-name =3D "VREG_FLASH_3P3"; + regulator-min-microvolt =3D <3300000>; + regulator-max-microvolt =3D <3300000>; + gpio =3D <&pm8921_mpps 4 GPIO_ACTIVE_HIGH>; + enable-active-high; + pinctrl-0 =3D <&flash_led_unlock>; + pinctrl-names =3D "default"; + }; + + led-controller { + compatible =3D "richtek,rt8515"; + enf-gpios =3D <&tlmm 3 GPIO_ACTIVE_HIGH>; + vin-supply =3D <&vreg_flash>; + richtek,rfs-ohms =3D <16000>; + pinctrl-0 =3D <&cam_flash_en>; + pinctrl-names =3D "default"; + + led { + function =3D LED_FUNCTION_FLASH; + color =3D ; + flash-max-timeout-us =3D <250000>; + }; + }; + i2c-gpio-touchkey { compatible =3D "i2c-gpio"; #address-cells =3D <1>; @@ -171,6 +198,13 @@ touchscreen@4a { }; =20 &tlmm { + cam_flash_en: cam-flash-en-state { + pins =3D "gpio3"; + function =3D "gpio"; + drive-strength =3D <16>; + bias-pull-down; + }; + spi1_default: spi1-default-state { mosi-pins { pins =3D "gpio6"; @@ -571,3 +605,12 @@ magnetometer@2e { /* TODO: Figure out Mount Matrix */ }; }; + +&pm8921_mpps { + flash_led_unlock: flash-led-unlock-state { + pins =3D "mpp4"; + function =3D "digital"; + output-low; + power-source =3D ; + }; +}; --=20 2.54.0