openwrt/target/linux/bcm27xx/patches-5.10/950-0438-dt-Add-a-camera-regulator-node-to-all-downstream-Pi-.patch
Álvaro Fernández Rojas 8299d1f057 bcm27xx: add kernel 5.10 support
Rebased RPi foundation patches on linux 5.10.59, removed applied and reverted
patches, wireless patches and defconfig patches.

bcm2708: boot tested on RPi B+ v1.2
bcm2709: boot tested on RPi 4B v1.1 4G
bcm2711: boot tested on RPi 4B v1.1 4G

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-08-21 19:07:07 +02:00

329 lines
8.6 KiB
Diff

From 7782ca4dcb10a244ae476126220890a0843c439e Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Wed, 6 Jan 2021 17:28:57 +0000
Subject: [PATCH] dt: Add a camera regulator node to all downstream Pi
platforms
The current firmware fixup of camera sensor overlays is not
particularly nice, and it stops you being able to load them
dynamically.
It's also incompatible with creating a simple DT that can be
loaded for both CAM1 and CAM0 on a CM as they would both
try to claim the one GPIO.
Almost all sensors have a hook of some form for a regulator, so
it's relatively straightforward to convert them all to use a
fixed regulator with GPIO control.
Add a fixed regulator node for each platform with the GPIO
correctly configured for the camera shutdown line. (The LED line
is ignored).
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 5 +++++
arch/arm/boot/dts/bcm2708-rpi-b-rev1.dts | 5 +++++
arch/arm/boot/dts/bcm2708-rpi-b.dts | 5 +++++
arch/arm/boot/dts/bcm2708-rpi-cm.dts | 15 +++++++++++++++
arch/arm/boot/dts/bcm2708-rpi-zero-w.dts | 5 +++++
arch/arm/boot/dts/bcm2708-rpi-zero.dts | 5 +++++
arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 5 +++++
arch/arm/boot/dts/bcm2710-rpi-2-b.dts | 5 +++++
arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts | 5 +++++
arch/arm/boot/dts/bcm2710-rpi-3-b.dts | 5 +++++
arch/arm/boot/dts/bcm2710-rpi-cm3.dts | 15 +++++++++++++++
arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 5 +++++
arch/arm/boot/dts/bcm2711-rpi-cm4.dts | 8 ++++++++
arch/arm/boot/dts/bcm283x-rpi-cam1-regulator.dtsi | 10 ++++++++++
14 files changed, 98 insertions(+)
create mode 100644 arch/arm/boot/dts/bcm283x-rpi-cam1-regulator.dtsi
--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts
+++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts
@@ -5,6 +5,7 @@
#include "bcm283x-rpi-smsc9514.dtsi"
#include "bcm283x-rpi-csi1-2lane.dtsi"
#include "bcm283x-rpi-i2c0mux_0_28.dtsi"
+#include "bcm283x-rpi-cam1-regulator.dtsi"
/ {
compatible = "raspberrypi,model-b-plus", "brcm,bcm2835";
@@ -111,6 +112,10 @@
pinctrl-0 = <&audio_pins>;
};
+&cam1_reg {
+ gpio = <&gpio 41 GPIO_ACTIVE_HIGH>;
+};
+
/ {
__overrides__ {
act_led_gpio = <&act_led>,"gpios:4";
--- a/arch/arm/boot/dts/bcm2708-rpi-b-rev1.dts
+++ b/arch/arm/boot/dts/bcm2708-rpi-b-rev1.dts
@@ -4,6 +4,7 @@
#include "bcm2708-rpi.dtsi"
#include "bcm283x-rpi-smsc9512.dtsi"
#include "bcm283x-rpi-csi1-2lane.dtsi"
+#include "bcm283x-rpi-cam1-regulator.dtsi"
/ {
compatible = "raspberrypi,model-b", "brcm,bcm2835";
@@ -118,6 +119,10 @@ i2c_csi_dsi: &i2c1 {
pinctrl-0 = <&audio_pins>;
};
+&cam1_reg {
+ gpio = <&gpio 27 GPIO_ACTIVE_HIGH>;
+};
+
/ {
__overrides__ {
act_led_gpio = <&act_led>,"gpios:4";
--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts
+++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts
@@ -5,6 +5,7 @@
#include "bcm283x-rpi-smsc9512.dtsi"
#include "bcm283x-rpi-csi1-2lane.dtsi"
#include "bcm283x-rpi-i2c0mux_0_28.dtsi"
+#include "bcm283x-rpi-cam1-regulator.dtsi"
/ {
compatible = "raspberrypi,model-b", "brcm,bcm2835";
@@ -105,6 +106,10 @@
pinctrl-0 = <&audio_pins>;
};
+&cam1_reg {
+ gpio = <&gpio 21 GPIO_ACTIVE_HIGH>;
+};
+
/ {
__overrides__ {
act_led_gpio = <&act_led>,"gpios:4";
--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dts
+++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts
@@ -8,6 +8,21 @@
/ {
compatible = "raspberrypi,compute-module", "brcm,bcm2835";
model = "Raspberry Pi Compute Module";
+
+ cam1_reg: cam1_reg {
+ compatible = "regulator-fixed";
+ regulator-name = "cam1-regulator";
+ gpio = <&gpio 2 GPIO_ACTIVE_HIGH>;
+ enable-active-high;
+ status = "disabled";
+ };
+ cam0_reg: cam0_reg {
+ compatible = "regulator-fixed";
+ regulator-name = "cam0-regulator";
+ gpio = <&gpio 30 GPIO_ACTIVE_HIGH>;
+ enable-active-high;
+ status = "disabled";
+ };
};
&uart0 {
--- a/arch/arm/boot/dts/bcm2708-rpi-zero-w.dts
+++ b/arch/arm/boot/dts/bcm2708-rpi-zero-w.dts
@@ -5,6 +5,7 @@
#include "bcm283x-rpi-csi1-2lane.dtsi"
#include "bcm283x-rpi-i2c0mux_0_28.dtsi"
#include "bcm2708-rpi-bt.dtsi"
+#include "bcm283x-rpi-cam1-regulator.dtsi"
/ {
compatible = "raspberrypi,model-zero-w", "brcm,bcm2835";
@@ -155,6 +156,10 @@
brcm,disable-headphones = <1>;
};
+&cam1_reg {
+ gpio = <&gpio 44 GPIO_ACTIVE_HIGH>;
+};
+
/ {
__overrides__ {
act_led_gpio = <&act_led>,"gpios:4";
--- a/arch/arm/boot/dts/bcm2708-rpi-zero.dts
+++ b/arch/arm/boot/dts/bcm2708-rpi-zero.dts
@@ -4,6 +4,7 @@
#include "bcm2708-rpi.dtsi"
#include "bcm283x-rpi-csi1-2lane.dtsi"
#include "bcm283x-rpi-i2c0mux_0_28.dtsi"
+#include "bcm283x-rpi-cam1-regulator.dtsi"
/ {
compatible = "raspberrypi,model-zero", "brcm,bcm2835";
@@ -109,6 +110,10 @@
brcm,disable-headphones = <1>;
};
+&cam1_reg {
+ gpio = <&gpio 41 GPIO_ACTIVE_HIGH>;
+};
+
/ {
__overrides__ {
act_led_gpio = <&act_led>,"gpios:4";
--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts
+++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts
@@ -5,6 +5,7 @@
#include "bcm283x-rpi-smsc9514.dtsi"
#include "bcm283x-rpi-csi1-2lane.dtsi"
#include "bcm283x-rpi-i2c0mux_0_28.dtsi"
+#include "bcm283x-rpi-cam1-regulator.dtsi"
/ {
compatible = "raspberrypi,2-model-b", "brcm,bcm2836";
@@ -111,6 +112,10 @@
pinctrl-0 = <&audio_pins>;
};
+&cam1_reg {
+ gpio = <&gpio 41 GPIO_ACTIVE_HIGH>;
+};
+
/ {
__overrides__ {
act_led_gpio = <&act_led>,"gpios:4";
--- a/arch/arm/boot/dts/bcm2710-rpi-2-b.dts
+++ b/arch/arm/boot/dts/bcm2710-rpi-2-b.dts
@@ -5,6 +5,7 @@
#include "bcm283x-rpi-smsc9514.dtsi"
#include "bcm283x-rpi-csi1-2lane.dtsi"
#include "bcm283x-rpi-i2c0mux_0_28.dtsi"
+#include "bcm283x-rpi-cam1-regulator.dtsi"
/ {
compatible = "raspberrypi,2-model-b-rev2", "brcm,bcm2837";
@@ -111,6 +112,10 @@
pinctrl-0 = <&audio_pins>;
};
+&cam1_reg {
+ gpio = <&gpio 41 GPIO_ACTIVE_HIGH>;
+};
+
/ {
__overrides__ {
act_led_gpio = <&act_led>,"gpios:4";
--- a/arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts
+++ b/arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts
@@ -6,6 +6,7 @@
#include "bcm283x-rpi-csi1-2lane.dtsi"
#include "bcm283x-rpi-i2c0mux_0_44.dtsi"
#include "bcm271x-rpi-bt.dtsi"
+#include "bcm283x-rpi-cam1-regulator.dtsi"
/ {
compatible = "raspberrypi,3-model-b-plus", "brcm,bcm2837";
@@ -176,6 +177,10 @@
microchip,downshift-after = <2>;
};
+&cam1_reg {
+ gpio = <&expgpio 5 GPIO_ACTIVE_HIGH>;
+};
+
/ {
__overrides__ {
act_led_gpio = <&act_led>,"gpios:4";
--- a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts
+++ b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts
@@ -6,6 +6,7 @@
#include "bcm283x-rpi-csi1-2lane.dtsi"
#include "bcm283x-rpi-i2c0mux_0_44.dtsi"
#include "bcm271x-rpi-bt.dtsi"
+#include "bcm283x-rpi-cam1-regulator.dtsi"
/ {
compatible = "raspberrypi,3-model-b", "brcm,bcm2837";
@@ -185,6 +186,10 @@
pinctrl-0 = <&audio_pins>;
};
+&cam1_reg {
+ gpio = <&expgpio 5 GPIO_ACTIVE_HIGH>;
+};
+
/ {
__overrides__ {
act_led_gpio = <&act_led>,"gpios:4";
--- a/arch/arm/boot/dts/bcm2710-rpi-cm3.dts
+++ b/arch/arm/boot/dts/bcm2710-rpi-cm3.dts
@@ -8,6 +8,21 @@
/ {
compatible = "raspberrypi,3-compute-module", "brcm,bcm2837";
model = "Raspberry Pi Compute Module 3";
+
+ cam1_reg: cam1_reg {
+ compatible = "regulator-fixed";
+ regulator-name = "cam1-regulator";
+ gpio = <&gpio 2 GPIO_ACTIVE_HIGH>;
+ enable-active-high;
+ status = "disabled";
+ };
+ cam0_reg: cam0_reg {
+ compatible = "regulator-fixed";
+ regulator-name = "cam0-regulator";
+ gpio = <&gpio 30 GPIO_ACTIVE_HIGH>;
+ enable-active-high;
+ status = "disabled";
+ };
};
&uart0 {
--- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
+++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
@@ -319,6 +319,7 @@
#include "bcm2711-rpi.dtsi"
#include "bcm283x-rpi-csi1-2lane.dtsi"
#include "bcm283x-rpi-i2c0mux_0_44.dtsi"
+#include "bcm283x-rpi-cam1-regulator.dtsi"
/ {
chosen {
@@ -585,6 +586,10 @@
pinctrl-0 = <&audio_pins>;
};
+&cam1_reg {
+ gpio = <&expgpio 5 GPIO_ACTIVE_HIGH>;
+};
+
/ {
__overrides__ {
act_led_gpio = <&act_led>,"gpios:4";
--- a/arch/arm/boot/dts/bcm2711-rpi-cm4.dts
+++ b/arch/arm/boot/dts/bcm2711-rpi-cm4.dts
@@ -327,6 +327,14 @@
};
/delete-node/ wifi-pwrseq;
+
+ cam0_reg: cam1_reg: cam1_reg {
+ compatible = "regulator-fixed";
+ regulator-name = "cam1-reg";
+ gpio = <&expgpio 5 GPIO_ACTIVE_HIGH>;
+ enable-active-high;
+ status = "disabled";
+ };
};
&mmcnr {
--- /dev/null
+++ b/arch/arm/boot/dts/bcm283x-rpi-cam1-regulator.dtsi
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0
+
+/ {
+ cam1_reg: cam1_reg {
+ compatible = "regulator-fixed";
+ regulator-name = "cam1-reg";
+ enable-active-high;
+ status = "disabled";
+ };
+};