Skip to content

Commit 62faabb

Browse files
roliver-rpipelwell
authored andcommitted
media: i2c: imx500: Enable LED during SPI transfers
The Raspberry Pi 'AI Camera' is equipped with an LED. Enable this LED during SPI transfers to indicate to the end-user that progress is being made during large tramsfers. Signed-off-by: Richard Oliver <[email protected]>
1 parent 19adb19 commit 62faabb

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

arch/arm/boot/dts/overlays/imx500-overlay.dts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105

106106
&cam_node {
107107
status = "okay";
108+
led-gpios = <&spi_bridge 19 GPIO_ACTIVE_HIGH>;
108109
reset-gpios = <&spi_bridge 20 GPIO_ACTIVE_HIGH>;
109110
clocks = <&clk_aicam_gated>;
110111
spi = <&spi_bridgedev0>;

arch/arm/boot/dts/overlays/imx500-pi5-overlay.dts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110

111111
&cam_node {
112112
status = "okay";
113+
led-gpios = <&spi_bridge 19 GPIO_ACTIVE_HIGH>;
113114
reset-gpios = <&spi_bridge 20 GPIO_ACTIVE_HIGH>;
114115
clocks = <&clk_aicam_gated>;
115116
spi = <&spi_bridgedev0>;

drivers/media/i2c/imx500.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,7 @@ struct imx500 {
965965
struct clk *xclk;
966966
u32 xclk_freq;
967967

968+
struct gpio_desc *led_gpio;
968969
struct gpio_desc *reset_gpio;
969970
struct regulator_bulk_data supplies[IMX500_NUM_SUPPLIES];
970971

@@ -1990,7 +1991,10 @@ static int imx500_state_transition(struct imx500 *imx500, const u8 *fw,
19901991
}
19911992

19921993
/* Do SPI transfer */
1994+
gpiod_set_value_cansleep(imx500->led_gpio, 1);
19931995
ret = imx500_spi_write(imx500, data, size);
1996+
gpiod_set_value_cansleep(imx500->led_gpio, 0);
1997+
19941998
imx500->fw_progress += size;
19951999

19962000
if (ret < 0)
@@ -2670,6 +2674,8 @@ static int imx500_probe(struct i2c_client *client)
26702674
return ret;
26712675
}
26722676

2677+
imx500->led_gpio = devm_gpiod_get_optional(dev, "led", GPIOD_OUT_LOW);
2678+
26732679
imx500->reset_gpio =
26742680
devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
26752681

0 commit comments

Comments
 (0)