Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Documentation/devicetree/bindings/leds/ti,lm3644.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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#
Expand Down
33 changes: 33 additions & 0 deletions arch/arm64/boot/dts/exynos/google/gs101-oriole.dts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/dts-v1/;

#include <dt-bindings/leds/common.h>
#include <dt-bindings/regulator/samsung,s2mpg10-regulator.h>
#include "gs101-pixel-common.dtsi"

Expand Down Expand Up @@ -107,3 +108,35 @@
samsung,pin-drv = <GS101_PIN_DRV_2_5_MA>;
};
};

/*
* 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 = <USI_MODE_I2C>;
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_COLOR_ID_WHITE>;
led-sources = <1>;
led-max-microamp = <6000>;
default-state = "off";
};
};
};
11 changes: 9 additions & 2 deletions drivers/leds/flash/leds-lm3644.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <linux/bits.h>
Expand Down Expand Up @@ -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;
Expand All @@ -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");
Expand Down