openwrt/target/linux/bcm27xx/patches-5.15/950-0608-dt-Create-static-regulators-and-clocks-for-camera-no.patch

384 lines
9.8 KiB
Diff
Raw Normal View History

From 322899a48088cb09b3f2a068f78c93a63615da9e Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Sat, 20 Nov 2021 10:48:36 +0000
Subject: [PATCH] dt: Create static regulators and clocks for camera
nodes
Unloading regulators through dynamic device tree doesn't work
as the regulators will unregister whilst clients are still
registered. Whilst the regulator framework does WARN when that
happens, the client putting the regulator then typically results
in a NULL dereference and badness.
Instead of creating regulators and clocks from the overlays,
create regulators and clocks for the sensors in the base DT.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 4 ++-
arch/arm/boot/dts/bcm2708-rpi-b-rev1.dts | 4 ++-
arch/arm/boot/dts/bcm2708-rpi-b.dts | 4 ++-
arch/arm/boot/dts/bcm2708-rpi-cm.dts | 21 ++++--------
arch/arm/boot/dts/bcm2708-rpi-zero-w.dts | 4 ++-
arch/arm/boot/dts/bcm2708-rpi-zero.dts | 4 ++-
arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 4 ++-
arch/arm/boot/dts/bcm270x.dtsi | 33 +++++++++++++++++++
arch/arm/boot/dts/bcm2710-rpi-2-b.dts | 4 ++-
arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts | 4 ++-
arch/arm/boot/dts/bcm2710-rpi-3-b.dts | 4 ++-
arch/arm/boot/dts/bcm2710-rpi-cm3.dts | 21 ++++--------
arch/arm/boot/dts/bcm2710-rpi-zero-2-w.dts | 4 ++-
arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 4 ++-
arch/arm/boot/dts/bcm2711-rpi-cm4.dts | 1 -
.../boot/dts/bcm283x-rpi-cam1-regulator.dtsi | 10 ------
16 files changed, 80 insertions(+), 50 deletions(-)
delete 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,7 +5,6 @@
#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";
@@ -116,6 +115,9 @@
gpio = <&gpio 41 GPIO_ACTIVE_HIGH>;
};
+cam0_reg: &cam_dummy_reg {
+};
+
/ {
__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,7 +4,6 @@
#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";
@@ -123,6 +122,9 @@ i2c_csi_dsi: &i2c1 {
gpio = <&gpio 27 GPIO_ACTIVE_HIGH>;
};
+cam0_reg: &cam_dummy_reg {
+};
+
/ {
__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,7 +5,6 @@
#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";
@@ -110,6 +109,9 @@
gpio = <&gpio 21 GPIO_ACTIVE_HIGH>;
};
+cam0_reg: &cam_dummy_reg {
+};
+
/ {
__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,21 +8,14 @@
/ {
compatible = "raspberrypi,compute-module", "brcm,bcm2835";
model = "Raspberry Pi Compute Module";
+};
+
+&cam1_reg {
+ gpio = <&gpio 2 GPIO_ACTIVE_HIGH>;
+};
- 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";
- };
+cam0_reg: &cam0_regulator {
+ gpio = <&gpio 30 GPIO_ACTIVE_HIGH>;
};
&uart0 {
--- a/arch/arm/boot/dts/bcm2708-rpi-zero-w.dts
+++ b/arch/arm/boot/dts/bcm2708-rpi-zero-w.dts
@@ -5,7 +5,6 @@
#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";
@@ -167,6 +166,9 @@
gpio = <&gpio 44 GPIO_ACTIVE_HIGH>;
};
+cam0_reg: &cam_dummy_reg {
+};
+
/ {
__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,7 +4,6 @@
#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";
@@ -114,6 +113,9 @@
gpio = <&gpio 41 GPIO_ACTIVE_HIGH>;
};
+cam0_reg: &cam_dummy_reg {
+};
+
/ {
__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,7 +5,6 @@
#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";
@@ -116,6 +115,9 @@
gpio = <&gpio 41 GPIO_ACTIVE_HIGH>;
};
+cam0_reg: &cam_dummy_reg {
+};
+
/ {
__overrides__ {
act_led_gpio = <&act_led>,"gpios:4";
--- a/arch/arm/boot/dts/bcm270x.dtsi
+++ b/arch/arm/boot/dts/bcm270x.dtsi
@@ -153,6 +153,39 @@
};
};
+ cam1_reg: cam1_regulator {
+ compatible = "regulator-fixed";
+ regulator-name = "cam1-reg";
+ enable-active-high;
+ /* Needs to be enabled, as removing a regulator is very unsafe */
+ status = "okay";
+ };
+
+ cam1_clk: cam1_clk {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ status = "disabled";
+ };
+
+ cam0_regulator: cam0_regulator {
+ compatible = "regulator-fixed";
+ regulator-name = "cam0-reg";
+ enable-active-high;
+ status = "disabled";
+ };
+
+ cam0_clk: cam0_clk {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ status = "disabled";
+ };
+
+ cam_dummy_reg: cam_dummy_reg {
+ compatible = "regulator-fixed";
+ regulator-name = "cam-dummy-reg";
+ status = "okay";
+ };
+
__overrides__ {
cam0-pwdn-ctrl;
cam0-pwdn;
--- a/arch/arm/boot/dts/bcm2710-rpi-2-b.dts
+++ b/arch/arm/boot/dts/bcm2710-rpi-2-b.dts
@@ -5,7 +5,6 @@
#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";
@@ -116,6 +115,9 @@
gpio = <&gpio 41 GPIO_ACTIVE_HIGH>;
};
+cam0_reg: &cam_dummy_reg {
+};
+
/ {
__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,7 +6,6 @@
#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";
@@ -188,6 +187,9 @@
gpio = <&expgpio 5 GPIO_ACTIVE_HIGH>;
};
+cam0_reg: &cam_dummy_reg {
+};
+
/ {
__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,7 +6,6 @@
#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";
@@ -197,6 +196,9 @@
gpio = <&expgpio 5 GPIO_ACTIVE_HIGH>;
};
+cam0_reg: &cam_dummy_reg {
+};
+
/ {
__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,21 +8,14 @@
/ {
compatible = "raspberrypi,3-compute-module", "brcm,bcm2837";
model = "Raspberry Pi Compute Module 3";
+};
+
+&cam1_reg {
+ gpio = <&gpio 2 GPIO_ACTIVE_HIGH>;
+};
- 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";
- };
+cam0_reg: &cam0_regulator {
+ gpio = <&gpio 30 GPIO_ACTIVE_HIGH>;
};
&uart0 {
--- a/arch/arm/boot/dts/bcm2710-rpi-zero-2-w.dts
+++ b/arch/arm/boot/dts/bcm2710-rpi-zero-2-w.dts
@@ -5,7 +5,6 @@
#include "bcm283x-rpi-csi1-2lane.dtsi"
#include "bcm283x-rpi-i2c0mux_0_44.dtsi"
#include "bcm2708-rpi-bt.dtsi"
-#include "bcm283x-rpi-cam1-regulator.dtsi"
/ {
compatible = "raspberrypi,model-zero-2-w", "brcm,bcm2837";
@@ -188,6 +187,9 @@
gpio = <&gpio 40 GPIO_ACTIVE_HIGH>;
};
+cam0_reg: &cam_dummy_reg {
+};
+
/ {
__overrides__ {
act_led_gpio = <&act_led>,"gpios:4";
--- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
+++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
@@ -279,7 +279,6 @@
#include "bcm2711-rpi-ds.dtsi"
#include "bcm283x-rpi-csi1-2lane.dtsi"
#include "bcm283x-rpi-i2c0mux_0_44.dtsi"
-#include "bcm283x-rpi-cam1-regulator.dtsi"
/ {
chosen {
@@ -548,6 +547,9 @@
gpio = <&expgpio 5 GPIO_ACTIVE_HIGH>;
};
+cam0_reg: &cam_dummy_reg {
+};
+
/ {
__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
@@ -297,7 +297,6 @@
#include "bcm283x-rpi-csi0-2lane.dtsi"
#include "bcm283x-rpi-csi1-4lane.dtsi"
#include "bcm283x-rpi-i2c0mux_0_44.dtsi"
-#include "bcm283x-rpi-cam1-regulator.dtsi"
/ {
chosen {
--- a/arch/arm/boot/dts/bcm283x-rpi-cam1-regulator.dtsi
+++ /dev/null
@@ -1,10 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-
-/ {
- cam1_reg: cam1_reg {
- compatible = "regulator-fixed";
- regulator-name = "cam1-reg";
- enable-active-high;
- status = "disabled";
- };
-};