Skip to contentSkip to conversation

Raspberry Pi power domains

PATCH In review Eric Anholt 3 participants 8 messages Dec 17, 2015 – Dec 22, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v4 cover Raspberry Pi power domains

Update from v3 to move the driver under drivers/soc. I've placed it under drivers/soc/bcm since that's how the other drivers under drivers/soc are structured.

Alexander Aring (3):
ARM: bcm2835: add rpi power domain driver
dt-bindings: add rpi power domain driver bindings
ARM: bcm2835: Add the Raspberry Pi power domain driver to the DT.

Eric Anholt (1):
ARM: bcm2835: Define two new packets from the latest firmware.

 .../bindings/soc/bcm/raspberrypi,bcm2835-power.txt |  47 ++++
 arch/arm/boot/dts/bcm2835-rpi.dtsi                 |  11 +
 arch/arm/boot/dts/bcm2835.dtsi                     |   2 +-
 drivers/soc/Kconfig                                |   1 +
 drivers/soc/Makefile                               |   1 +
 drivers/soc/bcm/Kconfig                            |   9 +
 drivers/soc/bcm/Makefile                           |   1 +
 drivers/soc/bcm/raspberrypi-power.c                | 247 +++++++++++++++++++++
 include/dt-bindings/soc/raspberrypi-power.h        |  41 ++++
 include/soc/bcm2835/raspberrypi-firmware.h         |   2 +
 10 files changed, 361 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/soc/bcm/raspberrypi,bcm2835-power.txt
 create mode 100644 drivers/soc/bcm/Kconfig
 create mode 100644 drivers/soc/bcm/Makefile
 create mode 100644 drivers/soc/bcm/raspberrypi-power.c
 create mode 100644 include/dt-bindings/soc/raspberrypi-power.h
Signature · 1 line
2.6.2
#1 lore raw

PATCH v4 1/4 ARM: bcm2835: Define two new packets from the latest firmware.

These packets give us direct access to the firmware's power management code, as opposed to GET/SET_POWER_STATE packets that only had a couple of domains implemented.

---
 include/soc/bcm2835/raspberrypi-firmware.h | 2 ++
 1 file changed, 2 insertions(+)
include/soc/bcm2835/raspberrypi-firmware.h +2 -0
index c07d74a..3fb3571 100644
@@ -72,10 +72,12 @@ enum rpi_firmware_property_tag {
 	RPI_FIRMWARE_SET_ENABLE_QPU =                         0x00030012,
 	RPI_FIRMWARE_GET_DISPMANX_RESOURCE_MEM_HANDLE =       0x00030014,
 	RPI_FIRMWARE_GET_EDID_BLOCK =                         0x00030020,
+	RPI_FIRMWARE_GET_DOMAIN_STATE =                       0x00030030,
 	RPI_FIRMWARE_SET_CLOCK_STATE =                        0x00038001,
 	RPI_FIRMWARE_SET_CLOCK_RATE =                         0x00038002,
 	RPI_FIRMWARE_SET_VOLTAGE =                            0x00038003,
 	RPI_FIRMWARE_SET_TURBO =                              0x00038009,
+	RPI_FIRMWARE_SET_DOMAIN_STATE =                       0x00038030,
 
 	/* Dispmanx TAGS */
 	RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE =                   0x00040001,
Signature · 1 line
2.6.2
#2 lore raw

PATCH v4 2/4 ARM: bcm2835: add rpi power domain driver

In reply to Eric Anholt

From: Alexander Aring <[email protected]>

This patch adds support for several power domains on Raspberry Pi, including USB (so it can be enabled even if the bootloader didn't do it), and graphics.

This patch is the combined work of Eric Anholt (who wrote USB support inside of the Raspberry Pi firmware driver, and wrote the non-USB domain support) and Alexander Aring (who separated the original USB work out from the firmware driver).

---

v2: Add support for power domains other than USB, using the new
firmware interface, reword commit message (changes by Eric)

v3: Restructure as a builtin driver, and drop
of_genpd_add_provider_onecell error handling to avoid pm_genpd_exit() dependency until that API can be settled. Clean up copyright header, add missing ISP initialization, and fix typo in transposer's name.

v4: Move to drivers/soc/bcm/, move include to dt-bindings/soc/, set up
Makefile for the drivers/soc/bcm following clk/'s model.

 drivers/soc/Kconfig                         |   1 +
 drivers/soc/Makefile                        |   1 +
 drivers/soc/bcm/Kconfig                     |   9 +
 drivers/soc/bcm/Makefile                    |   1 +
 drivers/soc/bcm/raspberrypi-power.c         | 247 ++++++++++++++++++++++++++++
 include/dt-bindings/soc/raspberrypi-power.h |  41 +++++
 6 files changed, 300 insertions(+)
 create mode 100644 drivers/soc/bcm/Kconfig
 create mode 100644 drivers/soc/bcm/Makefile
 create mode 100644 drivers/soc/bcm/raspberrypi-power.c
 create mode 100644 include/dt-bindings/soc/raspberrypi-power.h
drivers/soc/Kconfig +1 -0
index 4e853ed..8441426 100644
@@ -1,5 +1,6 @@
 menu "SOC (System On Chip) specific Drivers"
 
+source "drivers/soc/bcm/Kconfig"
 source "drivers/soc/brcmstb/Kconfig"
 source "drivers/soc/mediatek/Kconfig"
 source "drivers/soc/qcom/Kconfig"
drivers/soc/Makefile +1 -0
index f2ba2e9..f3f955c 100644
@@ -2,6 +2,7 @@
 # Makefile for the Linux Kernel SOC specific device drivers.
 #
 
+obj-y				+= bcm/
 obj-$(CONFIG_SOC_BRCMSTB)	+= brcmstb/
 obj-$(CONFIG_MACH_DOVE)		+= dove/
 obj-$(CONFIG_ARCH_MEDIATEK)	+= mediatek/
drivers/soc/bcm/Kconfig new file +9 -0
new file mode 100644
index 0000000..5ba1827
@@ -0,0 +1,9 @@
+config RASPBERRYPI_POWER
+	bool "Raspberry Pi power domain driver"
+	depends on ARCH_BCM2835 || COMPILE_TEST
+	depends on RASPBERRYPI_FIRMWARE
+	select PM_GENERIC_DOMAINS if PM
+	select PM_GENERIC_DOMAINS_OF if PM
+	help
+	  This enables support for the RPi power domains which can be enabled
+	  or disabled via the RPi firmware.
drivers/soc/bcm/Makefile new file +1 -0
new file mode 100644
index 0000000..63aa3eb
@@ -0,0 +1 @@
+obj-$(CONFIG_RASPBERRYPI_POWER)	+= raspberrypi-power.o
drivers/soc/bcm/raspberrypi-power.c new file +247 -0

247 lines not on this page · raw message

include/dt-bindings/soc/raspberrypi-power.h new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
2.6.2
#5 lore raw

PATCH v4 3/4 dt-bindings: add rpi power domain driver bindings

In reply to Eric Anholt

From: Alexander Aring <[email protected]>

This patch adds devicetree tree bindings for the Raspberry Pi power domain driver.

---

v2: Add the new domains present in v2 to the list.
v4: Move to soc/ instead of arm/, to follow the driver's move.

 .../bindings/soc/bcm/raspberrypi,bcm2835-power.txt | 47 ++++++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/bcm/raspberrypi,bcm2835-power.txt
Documentation/devicetree/bindings/soc/bcm/raspberrypi,bcm2835-power.txt new file +47 -0
new file mode 100644
index 0000000..30942cf
@@ -0,0 +1,47 @@
+Raspberry Pi power domain driver
+
+Required properties:
+
+- compatible:		Should be "raspberrypi,bcm2835-power".
+- firmware:		Reference to the RPi firmware device node.
+- #power-domain-cells:	Should be <1>, we providing multiple power domains.
+
+The valid defines for power domain are:
+
+ RPI_POWER_DOMAIN_I2C0
+ RPI_POWER_DOMAIN_I2C1
+ RPI_POWER_DOMAIN_I2C2
+ RPI_POWER_DOMAIN_VIDEO_SCALER
+ RPI_POWER_DOMAIN_VPU1
+ RPI_POWER_DOMAIN_HDMI
+ RPI_POWER_DOMAIN_USB
+ RPI_POWER_DOMAIN_VEC
+ RPI_POWER_DOMAIN_JPEG
+ RPI_POWER_DOMAIN_H264
+ RPI_POWER_DOMAIN_V3D
+ RPI_POWER_DOMAIN_ISP
+ RPI_POWER_DOMAIN_UNICAM0
+ RPI_POWER_DOMAIN_UNICAM1
+ RPI_POWER_DOMAIN_CCP2RX
+ RPI_POWER_DOMAIN_CSI2
+ RPI_POWER_DOMAIN_CPI
+ RPI_POWER_DOMAIN_DSI0
+ RPI_POWER_DOMAIN_DSI1
+ RPI_POWER_DOMAIN_TRANSPOSER
+ RPI_POWER_DOMAIN_CCP2TX
+ RPI_POWER_DOMAIN_CDP
+ RPI_POWER_DOMAIN_ARM
+
+Example:
+
+power: power {
+	compatible = "raspberrypi,bcm2835-power";
+	firmware = <&firmware>;
+	#power-domain-cells = <1>;
+};
+
+Example for using power domain:
+
+&usb {
+       power-domains = <&power RPI_POWER_DOMAIN_USB>;
+};
Signature · 1 line
2.6.2
#6 lore raw

PATCH v4 4/4 ARM: bcm2835: Add the Raspberry Pi power domain driver to the DT.

In reply to Eric Anholt

From: Alexander Aring <[email protected]>

This connects the USB driver to the USB power domain, so that USB can actually be turned on at boot if the bootloader didn't do it for us.

---
 arch/arm/boot/dts/bcm2835-rpi.dtsi | 11 +++++++++++
 arch/arm/boot/dts/bcm2835.dtsi     |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
arch/arm/boot/dts/bcm2835-rpi.dtsi +11 -0
index 3572f03..7982d22 100644
@@ -1,3 +1,4 @@
+#include <dt-bindings/soc/raspberrypi-power.h>
 #include "bcm2835.dtsi"
 
 / {
@@ -20,6 +21,12 @@
 			compatible = "raspberrypi,bcm2835-firmware";
 			mboxes = <&mailbox>;
 		};
+
+		power: power {
+			compatible = "raspberrypi,bcm2835-power";
+			firmware = <&firmware>;
+			#power-domain-cells = <1>;
+		};
 	};
 };
 
@@ -60,3 +67,7 @@
 	status = "okay";
 	bus-width = <4>;
 };
+
+&usb {
+	power-domains = <&power RPI_POWER_DOMAIN_USB>;
+};
arch/arm/boot/dts/bcm2835.dtsi +1 -1
index aef64de..6d62af0 100644
@@ -177,7 +177,7 @@
 			status = "disabled";
 		};
 
-		usb at 7e980000 {
+		usb: usb at 7e980000 {
 			compatible = "brcm,bcm2835-usb";
 			reg = <0x7e980000 0x10000>;
 			interrupts = <1 9>;
Signature · 1 line
2.6.2
Reviewed-by on v4 2/4
#3 lore raw

Re: [PATCH v4 2/4] ARM: bcm2835: add rpi power domain driver

In reply to Eric Anholt
Quoted 27 lines · Eric Anholt

From: Alexander Aring <[email protected]>

This patch adds support for several power domains on Raspberry Pi, including USB (so it can be enabled even if the bootloader didn't do it), and graphics.

This patch is the combined work of Eric Anholt (who wrote USB support inside of the Raspberry Pi firmware driver, and wrote the non-USB domain support) and Alexander Aring (who separated the original USB work out from the firmware driver).

---

v2: Add support for power domains other than USB, using the new
firmware interface, reword commit message (changes by Eric)

v3: Restructure as a builtin driver, and drop
of_genpd_add_provider_onecell error handling to avoid pm_genpd_exit() dependency until that API can be settled. Clean up copyright header, add missing ISP initialization, and fix typo in transposer's name.

v4: Move to drivers/soc/bcm/, move include to dt-bindings/soc/, set up
Makefile for the drivers/soc/bcm following clk/'s model.

Quoted 6 lines
 drivers/soc/Kconfig                         |   1 +
 drivers/soc/Makefile                        |   1 +
 drivers/soc/bcm/Kconfig                     |   9 +
 drivers/soc/bcm/Makefile                    |   1 +
 drivers/soc/bcm/raspberrypi-power.c         | 247 ++++++++++++++++++++++++++++
 include/dt-bindings/soc/raspberrypi-power.h |  41 +++++

There is currently a directory which I think may be better. include/dt-bindings/power/*

Besides this nitpick, I think this looks good. You may add my:

Kind regards
Uffe

Reviewed-by on the v4 series
#7 lore raw
In reply to Eric Anholt
Quoted 3 lines · Eric Anholt

Update from v3 to move the driver under drivers/soc. I've placed it under drivers/soc/bcm since that's how the other drivers under drivers/soc are structured.

Thanks, I like it better under drivers/soc too.

Kevin

Quoted 24 lines

Alexander Aring (3):
ARM: bcm2835: add rpi power domain driver
dt-bindings: add rpi power domain driver bindings
ARM: bcm2835: Add the Raspberry Pi power domain driver to the DT.

Eric Anholt (1):
ARM: bcm2835: Define two new packets from the latest firmware.

 .../bindings/soc/bcm/raspberrypi,bcm2835-power.txt |  47 ++++
 arch/arm/boot/dts/bcm2835-rpi.dtsi                 |  11 +
 arch/arm/boot/dts/bcm2835.dtsi                     |   2 +-
 drivers/soc/Kconfig                                |   1 +
 drivers/soc/Makefile                               |   1 +
 drivers/soc/bcm/Kconfig                            |   9 +
 drivers/soc/bcm/Makefile                           |   1 +
 drivers/soc/bcm/raspberrypi-power.c                | 247 +++++++++++++++++++++
 include/dt-bindings/soc/raspberrypi-power.h        |  41 ++++
 include/soc/bcm2835/raspberrypi-firmware.h         |   2 +
 10 files changed, 361 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/soc/bcm/raspberrypi,bcm2835-power.txt
 create mode 100644 drivers/soc/bcm/Kconfig
 create mode 100644 drivers/soc/bcm/Makefile
 create mode 100644 drivers/soc/bcm/raspberrypi-power.c
 create mode 100644 include/dt-bindings/soc/raspberrypi-power.h
#4 lore raw

Re: [PATCH v4 2/4] ARM: bcm2835: add rpi power domain driver

In reply to Ulf Hansson
Quoted 35 lines · Ulf Hansson
Quoted 27 lines · Eric Anholt

From: Alexander Aring <[email protected]>

This patch adds support for several power domains on Raspberry Pi, including USB (so it can be enabled even if the bootloader didn't do it), and graphics.

This patch is the combined work of Eric Anholt (who wrote USB support inside of the Raspberry Pi firmware driver, and wrote the non-USB domain support) and Alexander Aring (who separated the original USB work out from the firmware driver).

---

v2: Add support for power domains other than USB, using the new
firmware interface, reword commit message (changes by Eric)

v3: Restructure as a builtin driver, and drop
of_genpd_add_provider_onecell error handling to avoid pm_genpd_exit() dependency until that API can be settled. Clean up copyright header, add missing ISP initialization, and fix typo in transposer's name.

v4: Move to drivers/soc/bcm/, move include to dt-bindings/soc/, set up
Makefile for the drivers/soc/bcm following clk/'s model.

Quoted 6 lines
 drivers/soc/Kconfig                         |   1 +
 drivers/soc/Makefile                        |   1 +
 drivers/soc/bcm/Kconfig                     |   9 +
 drivers/soc/bcm/Makefile                    |   1 +
 drivers/soc/bcm/raspberrypi-power.c         | 247 ++++++++++++++++++++++++++++
 include/dt-bindings/soc/raspberrypi-power.h |  41 +++++
Quoted 6 lines

There is currently a directory which I think may be better. include/dt-bindings/power/*

Besides this nitpick, I think this looks good. You may add my:

Thanks! I'll be sending my pull requests with the two r-bs added and
these nitpicks fixed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151221/50b4b2ea/attachment.sig>