diff --git a/Documentation/devicetree/bindings/leds/ti,lm3644.yaml b/Documentation/devicetree/bindings/leds/ti,lm3644.yaml index 4e0c612dc2..9e9c5c8fd1 100644 --- a/Documentation/devicetree/bindings/leds/ti,lm3644.yaml +++ b/Documentation/devicetree/bindings/leds/ti,lm3644.yaml @@ -27,6 +27,12 @@ properties: maxItems: 1 description: GPIO connected to the HWEN pin. + strobe-gpios: + maxItems: 1 + description: | + GPIO connected to the active-high STROBE pin. When supplied, the + torch-only driver holds it low to prevent external flash triggering. + led: type: object $ref: common.yaml# diff --git a/arch/arm64/boot/dts/exynos/google/gs101-oriole.dts b/arch/arm64/boot/dts/exynos/google/gs101-oriole.dts index 6b204aa530..d8ff3a5609 100644 --- a/arch/arm64/boot/dts/exynos/google/gs101-oriole.dts +++ b/arch/arm64/boot/dts/exynos/google/gs101-oriole.dts @@ -8,6 +8,7 @@ /dts-v1/; +#include #include #include "gs101-pixel-common.dtsi" @@ -107,3 +108,35 @@ samsung,pin-drv = ; }; }; + +/* + * Rear flash wiring from Google's GPL gs101-oriole-camera.dtsi. Keep the + * external strobe low; torch only, one sink with a conservative 6 mA cap. + * Enable only after a guarded qualification on the matching kernel. + */ +&usi7 { + samsung,mode = ; + samsung,clkreq-on; + status = "disabled"; +}; + +&hsi2c_7 { + clock-frequency = <100000>; + status = "disabled"; + + led-controller@63 { + compatible = "ti,lm3644"; + reg = <0x63>; + enable-gpios = <&gpp23 6 GPIO_ACTIVE_HIGH>; + strobe-gpios = <&gpp27 0 GPIO_ACTIVE_HIGH>; + status = "disabled"; + + led { + function = LED_FUNCTION_TORCH; + color = ; + led-sources = <1>; + led-max-microamp = <6000>; + default-state = "off"; + }; + }; +}; diff --git a/drivers/leds/flash/leds-lm3644.c b/drivers/leds/flash/leds-lm3644.c index a370a90d73..a7b51ca55f 100644 --- a/drivers/leds/flash/leds-lm3644.c +++ b/drivers/leds/flash/leds-lm3644.c @@ -5,8 +5,9 @@ * The chip sits in shutdown while its HWEN pin is low. This driver raises * HWEN only while the torch is lit, so every switch-on starts from the * register reset values, and it never enters flash (strobe) mode: no flash - * timeout or strobe pin is involved. Brightness steps are the chip's torch - * current codes, capped by the board's led-max-microamp. + * timeout is involved. An optional external strobe GPIO is held inactive. + * Brightness steps are the chip's torch current codes, capped by the + * board's led-max-microamp. */ #include @@ -218,6 +219,7 @@ static void lm3644_shutdown(void *data) static int lm3644_probe(struct i2c_client *client) { struct led_init_data init_data = {}; + struct gpio_desc *strobe; struct device *dev = &client->dev; struct fwnode_handle *child; u32 sources[2], max_ua, max_code; @@ -238,6 +240,11 @@ static int lm3644_probe(struct i2c_client *client) if (IS_ERR(lm->regmap)) return PTR_ERR(lm->regmap); + /* Keep external flash triggering inactive before raising HWEN. */ + strobe = devm_gpiod_get_optional(dev, "strobe", GPIOD_OUT_LOW); + if (IS_ERR(strobe)) + return dev_err_probe(dev, PTR_ERR(strobe), "strobe GPIO\n"); + lm->hwen = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW); if (IS_ERR(lm->hwen)) return dev_err_probe(dev, PTR_ERR(lm->hwen), "HWEN GPIO\n");