From nobody Wed Apr 1 08:15:50 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 DB33130C372; Tue, 31 Mar 2026 17:08:08 +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=1774976888; cv=none; b=tgO/29Kohmx0SWnRvEymb8eeCcFsZbiu1iboqjNdNq4G4xk82y0ixl3q1QLtkmEmUaCrOnWneSPjPnG29sbLiBiiQF5xE5KyT29ACKMWWC/cdsubIbEn8y4KMQ7we239HvlJfyJuVDjMsjhYbeKsKQe/9ndQkbDxiCTZ8FRM938= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774976888; c=relaxed/simple; bh=vtWkUX7nJXT4VBvGcL/Y+2qsHiE82woSkLVt9snsg2I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WsQ9HNJ9YUoHwIy8rybI7zMo4SUNywa3U197pfjluluuU31Mq6uJwSPTa90A0jVTd/6keAHawTpSloOWFy9KiSJjx23fseOGGvBNInS+4NAKe51gsf9H35eYciD7Uzm26w75x18uDR19O6tw10tVVGQr0taQHlpaYNwd5WyuYAk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cby6fLku; 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="cby6fLku" Received: by smtp.kernel.org (Postfix) with ESMTPS id ACA3FC19423; Tue, 31 Mar 2026 17:08:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774976888; bh=vtWkUX7nJXT4VBvGcL/Y+2qsHiE82woSkLVt9snsg2I=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=cby6fLkuLFyt/sg9Ljx1dYmTGf2OEUxP4Ip8Q6aWyn/TmdVEqHyawHZTma5kLPNlL 3RVGLnVATSZre2qxDXC+GMp/0BT1fGyzwB6VKWMfstEjJzrSL8dx1m8GRgDVavwzLg FqQtY038VZNssm+RR+Iu8lbKeQZKYeelmKk9hWv8F5B/XbT0yiChRpWoxPJDX06F8R RzWduVsPK72xEValSI5f0iYeKt2n87dw/u/I0x672xqyGIAJpkhkx1ph97s7qIxepD +9ZY8YIIYOSWtXzwlYOw8lZq0cIh2g2tNqnkFKdgJpf62WMiAK3/MSO1mrEnmb1D/i 9P+4+xfB3YjbQ== 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 9A48110F92E9; Tue, 31 Mar 2026 17:08:08 +0000 (UTC) From: Rudraksha Gupta via B4 Relay Date: Tue, 31 Mar 2026 10:08:07 -0700 Subject: [PATCH v4 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: <20260331-expressatt_camera_flash-v4-1-f1e99f474513@gmail.com> References: <20260331-expressatt_camera_flash-v4-0-f1e99f474513@gmail.com> In-Reply-To: <20260331-expressatt_camera_flash-v4-0-f1e99f474513@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=1774976888; l=2722; i=guptarud@gmail.com; s=20240916; h=from:subject:message-id; bh=3x0hUrCLPBGYYoXg/LCYnxv46dNWEF519f2FRG1sBE0=; b=HtlQ1MzFcDtcQPMZhjjZxJ5A9joCavHsKGAQrqJ3Sh3iPdJ3y1Wzaxw/wWQwtsSl6fG1iXB5Q u82DXVvAgUlBzXDO4a1Y3xFo4uSBUmWHcApUTSWVJdC4G703ljNY+sx 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.53.0 From nobody Wed Apr 1 08:15:50 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 EEA0E30DEDC; Tue, 31 Mar 2026 17:08:08 +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=1774976889; cv=none; b=JuX/EwjHqjwf9e614Uogn9H/hb77zrXqnbdsvc8m24oIwkP3idQ2JTgwEpspFVV4eMtH61nu6JHGS5HcL6aetjlmBbVvXseYm5jQKoJKn8uYECrX6q+vnHZdtSyeTH6/pDd+h1fW0PSYdfguYSYbSRqTVozGlZoz08jfOq2xvVA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774976889; c=relaxed/simple; bh=1ilQ6NwIUAHuE2aXouCYG3EJCP4y8gHjjw4b67QEdUk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ilIybP6wMONjYJSvIfhF7b8IylM/11DsQdWFjAHOEEYPfWnZo/LeOJkW2xXGTaenIXh12hUIq6h3EJyEQzFWA2RvUU5yyoW3EgTpO1IslcR4slcxWlUQIBpBzZEAnpRBKmuhdeb39rYW2gvqWRp0z8IREv5UtSEzH+WUj2y8zwM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ihxkAxSo; 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="ihxkAxSo" Received: by smtp.kernel.org (Postfix) with ESMTPS id BB4C2C2BCB7; Tue, 31 Mar 2026 17:08:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774976888; bh=1ilQ6NwIUAHuE2aXouCYG3EJCP4y8gHjjw4b67QEdUk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=ihxkAxSoKYhMGXu3BnFe9EbNduu71ZjjQ0s+JMS8OAFmw3nZIw0AFh8C/LHT5bccE hvAc7vopHE7zpdOEZNZ3jAR6W35Mv2PoBTWH6tsuLCVEwAXOPIJr6PjE9Urd1c+vXR dT+pjrABYohYeVBM5IYzusPKxdS13kVeW7ingeejGSm5lCL530ZNKe4RqY7wMx0c+Y YN2HGDRs6aOVLKen2I7d0gTW2DlBw8UjhrvPVG6uFW+sjdlbXrsiNVCUn6Kt/oyxKf e/yG9flkrrpTesiB1DZuRpVUHTIdCCqMZhzKN89LLE1R4lCP4JnBpXJnGorjFXtV4e HjxYN+V5XfzLQ== 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 AE34910F92EB; Tue, 31 Mar 2026 17:08:08 +0000 (UTC) From: Rudraksha Gupta via B4 Relay Date: Tue, 31 Mar 2026 10:08:08 -0700 Subject: [PATCH v4 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: <20260331-expressatt_camera_flash-v4-2-f1e99f474513@gmail.com> References: <20260331-expressatt_camera_flash-v4-0-f1e99f474513@gmail.com> In-Reply-To: <20260331-expressatt_camera_flash-v4-0-f1e99f474513@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=1774976888; l=6626; i=guptarud@gmail.com; s=20240916; h=from:subject:message-id; bh=zZMrBj64Vyzjy9VmRNEhdaRoz7QyR5FMwlozpltanIw=; b=HmrcrSMHPZJNXzn2ONNfC4cfqhJNThuubjSJxk2wAFZA36qAzISrc/thEDUdcCtHIWAVCANvl a26on99UkSeBL/pA90C6DsjINzXLPUndo/9GTq4l9uSIvpY1sjWdd7y 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 and validate at probe time that exactly one of ent-gpios or vin-supply is provided. When ent-gpios is absent, the driver uses enf-gpios for both flash and torch brightness control. Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Rudraksha Gupta Reviewed-by: Linus Walleij --- drivers/leds/flash/leds-rt8515.c | 100 ++++++++++++++++++++++++++++++++---= ---- 1 file changed, 83 insertions(+), 17 deletions(-) diff --git a/drivers/leds/flash/leds-rt8515.c b/drivers/leds/flash/leds-rt8= 515.c index f6b439674c03..c7f0bdf804a7 100644 --- a/drivers/leds/flash/leds-rt8515.c +++ b/drivers/leds/flash/leds-rt8515.c @@ -63,16 +63,44 @@ 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) { + int ret; + gpiod_set_value(rt->enable_flash, 0); - gpiod_set_value(rt->enable_torch, 0); + if (rt->enable_torch) + gpiod_set_value(rt->enable_torch, 0); + + /* Disable regulator */ + ret =3D regulator_is_enabled(rt->reg); + if (ret < 0) + return ret; + if (ret > 0) + return regulator_disable(rt->reg); + + return 0; } =20 -static void rt8515_gpio_brightness_commit(struct gpio_desc *gpiod, - int brightness) +static int rt8515_gpio_brightness_commit(struct rt8515 *rt, + struct gpio_desc *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); + /* Enable regulator */ + ret =3D regulator_enable(rt->reg); + if (ret) + return ret; =20 /* * Toggling a GPIO line with a small delay increases the @@ -84,6 +112,8 @@ static void rt8515_gpio_brightness_commit(struct gpio_de= sc *gpiod, gpiod_set_value(gpiod, 1); udelay(1); } + + return 0; } =20 /* This is setting the torch light level */ @@ -92,23 +122,39 @@ 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_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_torch : + rt->enable_flash, 1); } =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 +163,33 @@ 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); =20 if (state) { /* Enable LED flash mode and set brightness */ - rt8515_gpio_brightness_commit(rt->enable_flash, brightness); + ret =3D rt8515_gpio_brightness_commit(rt, rt->enable_flash, brightness); + if (ret) + goto out; /* Set timeout */ mod_timer(&rt->powerdown_timer, jiffies + usecs_to_jiffies(timeout->val)); } else { timer_delete_sync(&rt->powerdown_timer); /* Turn the LED off */ - rt8515_gpio_led_off(rt); + ret =3D rt8515_gpio_led_off(rt); + if (ret) + goto out; } =20 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, @@ -166,9 +218,12 @@ static const struct led_flash_ops rt8515_flash_ops =3D= { static void rt8515_powerdown_timer(struct timer_list *t) { struct rt8515 *rt =3D timer_container_of(rt, t, powerdown_timer); + int ret; =20 /* Turn the LED off */ - rt8515_gpio_led_off(rt); + ret =3D rt8515_gpio_led_off(rt); + 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,12 +353,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"); =20 + /* Optional VIN supply */ + rt->reg =3D devm_regulator_get(dev, "vin"); + if (IS_ERR(rt->reg)) + return dev_err_probe(dev, PTR_ERR(rt->reg), + "failed to get vin supply\n"); + child =3D device_get_next_child_node(dev, NULL); if (!child) { dev_err(dev, @@ -333,7 +394,12 @@ static int rt8515_probe(struct platform_device *pdev) =20 fled->ops =3D &rt8515_flash_ops; =20 - led->max_brightness =3D rt->torch_max_intensity; + /* + * If there is no separate torch pin, use the flash max intensity + * as the 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 --=20 2.53.0 From nobody Wed Apr 1 08:15:50 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 3E20E30F819; Tue, 31 Mar 2026 17:08:09 +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=1774976889; cv=none; b=eZ1jkZPoiNowxwbuvZJyCMKClgqgP7jqSFS/WTBJbaThmld7KIzT4McxP1sK9rdwnFUvynvA4c5RmYnfqfAP/jql1q7hBspfKgnral2TycqKDNy8Y5DNMKhb+pSWcuVfJeHkzsL73QKdxNLSUSPWutUgHdJCyPKv/2A/JIZ6vJo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774976889; c=relaxed/simple; bh=lMmS7VKj6iu0kl1/nj5vjFiPjTrbee5i9kEgoc3RpKI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XtFUJJGmAuB8G+HptLLmuJHIaO0qfn2iZxSRiPcNAvF6gj9Eaf6kEaFAU9IkjtGt6W8srifOC9P0R9XCEPioB6zmOpzzBckwVzZyNRGoEG5Ft8I0mXszXHwI6qR/uRqEstihIBZcJgDUVXbvtxq9ctB6EVbM8qQ25lRvdOCm61w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WD64jzEN; 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="WD64jzEN" Received: by smtp.kernel.org (Postfix) with ESMTPS id D251DC2BCC9; Tue, 31 Mar 2026 17:08:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774976888; bh=lMmS7VKj6iu0kl1/nj5vjFiPjTrbee5i9kEgoc3RpKI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=WD64jzENwzJ9GW18p/TjvNYLnyWlBlnKKsomtnt0AbEVGp86dFt+HLQoZ3mgzkcrG KUB6j6DKcg3F+tz7PKnZkWOpsGW5+QcQDhvHPFqUdGtldWnrZIrnBDLr0Ks3vaagO8 qR/hyGX6hPhX3nPgMJKUQmo0W5nE4ZM4FLPhxcjJGEAtTZH7HUJh9b8zbWwCx/GBwq 4/fgQSKtRiuq9OkbJKTFn8OrPFZCZPELHxPIUj534DVteJxdHaukkJhcivH8KuapvO HzpuogBWqEsz9EFCn1cUIyio5HqqMpXF4Wk9iBHXngJ04GuKnZctF3HW/td/djps/J mh6Cduulbbz2g== 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 C78E710F92E0; Tue, 31 Mar 2026 17:08:08 +0000 (UTC) From: Rudraksha Gupta via B4 Relay Date: Tue, 31 Mar 2026 10:08:09 -0700 Subject: [PATCH v4 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: <20260331-expressatt_camera_flash-v4-3-f1e99f474513@gmail.com> References: <20260331-expressatt_camera_flash-v4-0-f1e99f474513@gmail.com> In-Reply-To: <20260331-expressatt_camera_flash-v4-0-f1e99f474513@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=1774976888; l=2830; i=guptarud@gmail.com; s=20240916; h=from:subject:message-id; bh=07mZd8vKTRbtfL1Tn6ze8Ye/wRA3griixRoQWefHTH4=; b=KpzdD7c/VobQZ+VbR2jDO/bg2Nc45RUxuWo803tkF34FzOoJF5ot/UidlT5cdE3bUpLuvdOfr 2o3Izz8n+KLDxEd1SQ9Ew8DIZBneDFs/Ta7tdtAIFAesy6jKtXnXRp7 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 c4b98af6955d..35514fd53e3d 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>; @@ -172,6 +199,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"; @@ -572,3 +606,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.53.0