Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /* (C) 2015 Pengutronix, Alexander Aring <aar@pengutronix.de>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Authors:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Alexander Aring <aar@pengutronix.de>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * Eric Anholt <eric@anholt.net>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/of_platform.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/pm_domain.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <dt-bindings/power/raspberrypi-power.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <soc/bcm2835/raspberrypi-firmware.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * Firmware indices for the old power domains interface.  Only a few
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  * of them were actually implemented.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #define RPI_OLD_POWER_DOMAIN_USB		3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #define RPI_OLD_POWER_DOMAIN_V3D		10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) struct rpi_power_domain {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	u32 domain;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	bool enabled;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	bool old_interface;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	struct generic_pm_domain base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	struct rpi_firmware *fw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) struct rpi_power_domains {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	bool has_new_interface;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	struct genpd_onecell_data xlate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	struct rpi_firmware *fw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	struct rpi_power_domain domains[RPI_POWER_DOMAIN_COUNT];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)  * Packet definition used by RPI_FIRMWARE_SET_POWER_STATE and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  * RPI_FIRMWARE_SET_DOMAIN_STATE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) struct rpi_power_domain_packet {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	u32 domain;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	u32 on;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  * Asks the firmware to enable or disable power on a specific power
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49)  * domain.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) static int rpi_firmware_set_power(struct rpi_power_domain *rpi_domain, bool on)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	struct rpi_power_domain_packet packet;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	packet.domain = rpi_domain->domain;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	packet.on = on;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	return rpi_firmware_property(rpi_domain->fw,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 				     rpi_domain->old_interface ?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 				     RPI_FIRMWARE_SET_POWER_STATE :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 				     RPI_FIRMWARE_SET_DOMAIN_STATE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 				     &packet, sizeof(packet));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) static int rpi_domain_off(struct generic_pm_domain *domain)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	struct rpi_power_domain *rpi_domain =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 		container_of(domain, struct rpi_power_domain, base);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	return rpi_firmware_set_power(rpi_domain, false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) static int rpi_domain_on(struct generic_pm_domain *domain)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	struct rpi_power_domain *rpi_domain =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 		container_of(domain, struct rpi_power_domain, base);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	return rpi_firmware_set_power(rpi_domain, true);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) static void rpi_common_init_power_domain(struct rpi_power_domains *rpi_domains,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 					 int xlate_index, const char *name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	struct rpi_power_domain *dom = &rpi_domains->domains[xlate_index];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	dom->fw = rpi_domains->fw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	dom->base.name = name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	dom->base.power_on = rpi_domain_on;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	dom->base.power_off = rpi_domain_off;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	 * Treat all power domains as off at boot.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	 * The firmware itself may be keeping some domains on, but
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	 * from Linux's perspective all we control is the refcounts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	 * that we give to the firmware, and we can't ask the firmware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	 * to turn off something that we haven't ourselves turned on.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	pm_genpd_init(&dom->base, NULL, true);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	rpi_domains->xlate.domains[xlate_index] = &dom->base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) static void rpi_init_power_domain(struct rpi_power_domains *rpi_domains,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 				  int xlate_index, const char *name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	struct rpi_power_domain *dom = &rpi_domains->domains[xlate_index];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	if (!rpi_domains->has_new_interface)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	/* The DT binding index is the firmware's domain index minus one. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	dom->domain = xlate_index + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	rpi_common_init_power_domain(rpi_domains, xlate_index, name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) static void rpi_init_old_power_domain(struct rpi_power_domains *rpi_domains,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 				      int xlate_index, int domain,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 				      const char *name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	struct rpi_power_domain *dom = &rpi_domains->domains[xlate_index];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	dom->old_interface = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	dom->domain = domain;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	rpi_common_init_power_domain(rpi_domains, xlate_index, name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)  * Detects whether the firmware supports the new power domains interface.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)  * The firmware doesn't actually return an error on an unknown tag,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)  * and just skips over it, so we do the detection by putting an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)  * unexpected value in the return field and checking if it was
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)  * unchanged.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) static bool
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) rpi_has_new_domain_support(struct rpi_power_domains *rpi_domains)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	struct rpi_power_domain_packet packet;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	packet.domain = RPI_POWER_DOMAIN_ARM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	packet.on = ~0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	ret = rpi_firmware_property(rpi_domains->fw,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 				    RPI_FIRMWARE_GET_DOMAIN_STATE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 				    &packet, sizeof(packet));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	return ret == 0 && packet.on != ~0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) static int rpi_power_probe(struct platform_device *pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	struct device_node *fw_np;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	struct device *dev = &pdev->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	struct rpi_power_domains *rpi_domains;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	rpi_domains = devm_kzalloc(dev, sizeof(*rpi_domains), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	if (!rpi_domains)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	rpi_domains->xlate.domains =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 		devm_kcalloc(dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 			     RPI_POWER_DOMAIN_COUNT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 			     sizeof(*rpi_domains->xlate.domains),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 			     GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	if (!rpi_domains->xlate.domains)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	rpi_domains->xlate.num_domains = RPI_POWER_DOMAIN_COUNT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	fw_np = of_parse_phandle(pdev->dev.of_node, "firmware", 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	if (!fw_np) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 		dev_err(&pdev->dev, "no firmware node\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	rpi_domains->fw = rpi_firmware_get(fw_np);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	of_node_put(fw_np);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	if (!rpi_domains->fw)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 		return -EPROBE_DEFER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	rpi_domains->has_new_interface =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 		rpi_has_new_domain_support(rpi_domains);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	rpi_init_power_domain(rpi_domains, RPI_POWER_DOMAIN_I2C0, "I2C0");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	rpi_init_power_domain(rpi_domains, RPI_POWER_DOMAIN_I2C1, "I2C1");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	rpi_init_power_domain(rpi_domains, RPI_POWER_DOMAIN_I2C2, "I2C2");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	rpi_init_power_domain(rpi_domains, RPI_POWER_DOMAIN_VIDEO_SCALER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 			      "VIDEO_SCALER");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	rpi_init_power_domain(rpi_domains, RPI_POWER_DOMAIN_VPU1, "VPU1");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	rpi_init_power_domain(rpi_domains, RPI_POWER_DOMAIN_HDMI, "HDMI");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	 * Use the old firmware interface for USB power, so that we
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	 * can turn it on even if the firmware hasn't been updated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	rpi_init_old_power_domain(rpi_domains, RPI_POWER_DOMAIN_USB,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 				  RPI_OLD_POWER_DOMAIN_USB, "USB");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	rpi_init_power_domain(rpi_domains, RPI_POWER_DOMAIN_VEC, "VEC");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	rpi_init_power_domain(rpi_domains, RPI_POWER_DOMAIN_JPEG, "JPEG");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	rpi_init_power_domain(rpi_domains, RPI_POWER_DOMAIN_H264, "H264");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	rpi_init_power_domain(rpi_domains, RPI_POWER_DOMAIN_V3D, "V3D");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	rpi_init_power_domain(rpi_domains, RPI_POWER_DOMAIN_ISP, "ISP");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	rpi_init_power_domain(rpi_domains, RPI_POWER_DOMAIN_UNICAM0, "UNICAM0");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	rpi_init_power_domain(rpi_domains, RPI_POWER_DOMAIN_UNICAM1, "UNICAM1");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	rpi_init_power_domain(rpi_domains, RPI_POWER_DOMAIN_CCP2RX, "CCP2RX");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	rpi_init_power_domain(rpi_domains, RPI_POWER_DOMAIN_CSI2, "CSI2");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	rpi_init_power_domain(rpi_domains, RPI_POWER_DOMAIN_CPI, "CPI");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	rpi_init_power_domain(rpi_domains, RPI_POWER_DOMAIN_DSI0, "DSI0");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	rpi_init_power_domain(rpi_domains, RPI_POWER_DOMAIN_DSI1, "DSI1");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	rpi_init_power_domain(rpi_domains, RPI_POWER_DOMAIN_TRANSPOSER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 			      "TRANSPOSER");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	rpi_init_power_domain(rpi_domains, RPI_POWER_DOMAIN_CCP2TX, "CCP2TX");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	rpi_init_power_domain(rpi_domains, RPI_POWER_DOMAIN_CDP, "CDP");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	rpi_init_power_domain(rpi_domains, RPI_POWER_DOMAIN_ARM, "ARM");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	of_genpd_add_provider_onecell(dev->of_node, &rpi_domains->xlate);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	platform_set_drvdata(pdev, rpi_domains);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) static const struct of_device_id rpi_power_of_match[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	{ .compatible = "raspberrypi,bcm2835-power", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	{},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) MODULE_DEVICE_TABLE(of, rpi_power_of_match);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) static struct platform_driver rpi_power_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	.driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 		.name = "raspberrypi-power",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 		.of_match_table = rpi_power_of_match,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	.probe		= rpi_power_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) builtin_platform_driver(rpi_power_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) MODULE_AUTHOR("Alexander Aring <aar@pengutronix.de>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) MODULE_AUTHOR("Eric Anholt <eric@anholt.net>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) MODULE_DESCRIPTION("Raspberry Pi power domain driver");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) MODULE_LICENSE("GPL v2");