openwrt/target/linux/bcm27xx/patches-6.6/950-1250-media-i2c-imx500-Enable-LED-during-SPI-transfers.patch
Álvaro Fernández Rojas 538a1d740c bcm27xx: update to latest RPi patches
The patches were generated from the RPi repo with the following command:
git format-patch v6.6.58..rpi-6.6.y

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2024-10-31 13:44:23 +01:00

67 lines
2.1 KiB
Diff

From 62faabb61ae152e8289a00ffb3445f4c47777b33 Mon Sep 17 00:00:00 2001
From: Richard Oliver <richard.oliver@raspberrypi.com>
Date: Mon, 3 Jun 2024 16:02:41 +0100
Subject: [PATCH 1250/1350] 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 <richard.oliver@raspberrypi.com>
---
arch/arm/boot/dts/overlays/imx500-overlay.dts | 1 +
arch/arm/boot/dts/overlays/imx500-pi5-overlay.dts | 1 +
drivers/media/i2c/imx500.c | 6 ++++++
3 files changed, 8 insertions(+)
--- a/arch/arm/boot/dts/overlays/imx500-overlay.dts
+++ b/arch/arm/boot/dts/overlays/imx500-overlay.dts
@@ -105,6 +105,7 @@
&cam_node {
status = "okay";
+ led-gpios = <&spi_bridge 19 GPIO_ACTIVE_HIGH>;
reset-gpios = <&spi_bridge 20 GPIO_ACTIVE_HIGH>;
clocks = <&clk_aicam_gated>;
spi = <&spi_bridgedev0>;
--- a/arch/arm/boot/dts/overlays/imx500-pi5-overlay.dts
+++ b/arch/arm/boot/dts/overlays/imx500-pi5-overlay.dts
@@ -110,6 +110,7 @@
&cam_node {
status = "okay";
+ led-gpios = <&spi_bridge 19 GPIO_ACTIVE_HIGH>;
reset-gpios = <&spi_bridge 20 GPIO_ACTIVE_HIGH>;
clocks = <&clk_aicam_gated>;
spi = <&spi_bridgedev0>;
--- a/drivers/media/i2c/imx500.c
+++ b/drivers/media/i2c/imx500.c
@@ -965,6 +965,7 @@ struct imx500 {
struct clk *xclk;
u32 xclk_freq;
+ struct gpio_desc *led_gpio;
struct gpio_desc *reset_gpio;
struct regulator_bulk_data supplies[IMX500_NUM_SUPPLIES];
@@ -1990,7 +1991,10 @@ static int imx500_state_transition(struc
}
/* Do SPI transfer */
+ gpiod_set_value_cansleep(imx500->led_gpio, 1);
ret = imx500_spi_write(imx500, data, size);
+ gpiod_set_value_cansleep(imx500->led_gpio, 0);
+
imx500->fw_progress += size;
if (ret < 0)
@@ -2670,6 +2674,8 @@ static int imx500_probe(struct i2c_clien
return ret;
}
+ imx500->led_gpio = devm_gpiod_get_optional(dev, "led", GPIOD_OUT_LOW);
+
imx500->reset_gpio =
devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);