Lines Matching +full:bcm2835 +full:- +full:firmware
1 // SPDX-License-Identifier: GPL-2.0
13 #include <dt-bindings/power/raspberrypi-power.h>
14 #include <soc/bcm2835/raspberrypi-firmware.h>
17 * Firmware indices for the old power domains interface. Only a few
48 * Asks the firmware to enable or disable power on a specific power
55 bool old_interface = rpi_domain->old_interface; in rpi_firmware_set_power()
59 packet.domain = rpi_domain->domain; in rpi_firmware_set_power()
62 ret = rpi_firmware_property(rpi_domain->fw, old_interface ? in rpi_firmware_set_power()
67 dev_err(&domain->dev, "Failed to set %s to %u (%d)\n", in rpi_firmware_set_power()
70 dev_dbg(&domain->dev, "Set %s to %u\n", in rpi_firmware_set_power()
89 struct rpi_power_domain *dom = &rpi_domains->domains[xlate_index]; in rpi_common_init_power_domain()
91 dom->fw = rpi_domains->fw; in rpi_common_init_power_domain()
93 dom->base.name = name; in rpi_common_init_power_domain()
94 dom->base.flags = GENPD_FLAG_ACTIVE_WAKEUP; in rpi_common_init_power_domain()
95 dom->base.power_on = rpi_domain_on; in rpi_common_init_power_domain()
96 dom->base.power_off = rpi_domain_off; in rpi_common_init_power_domain()
101 * The firmware itself may be keeping some domains on, but in rpi_common_init_power_domain()
103 * that we give to the firmware, and we can't ask the firmware in rpi_common_init_power_domain()
106 pm_genpd_init(&dom->base, NULL, true); in rpi_common_init_power_domain()
108 rpi_domains->xlate.domains[xlate_index] = &dom->base; in rpi_common_init_power_domain()
114 struct rpi_power_domain *dom = &rpi_domains->domains[xlate_index]; in rpi_init_power_domain()
116 if (!rpi_domains->has_new_interface) in rpi_init_power_domain()
119 /* The DT binding index is the firmware's domain index minus one. */ in rpi_init_power_domain()
120 dom->domain = xlate_index + 1; in rpi_init_power_domain()
129 struct rpi_power_domain *dom = &rpi_domains->domains[xlate_index]; in rpi_init_old_power_domain()
131 dom->old_interface = true; in rpi_init_old_power_domain()
132 dom->domain = domain; in rpi_init_old_power_domain()
138 * Detects whether the firmware supports the new power domains interface.
140 * The firmware doesn't actually return an error on an unknown tag,
154 ret = rpi_firmware_property(rpi_domains->fw, in rpi_has_new_domain_support()
164 struct device *dev = &pdev->dev; in rpi_power_probe()
169 return -ENOMEM; in rpi_power_probe()
171 rpi_domains->xlate.domains = in rpi_power_probe()
174 sizeof(*rpi_domains->xlate.domains), in rpi_power_probe()
176 if (!rpi_domains->xlate.domains) in rpi_power_probe()
177 return -ENOMEM; in rpi_power_probe()
179 rpi_domains->xlate.num_domains = RPI_POWER_DOMAIN_COUNT; in rpi_power_probe()
181 fw_np = of_parse_phandle(pdev->dev.of_node, "firmware", 0); in rpi_power_probe()
183 dev_err(&pdev->dev, "no firmware node\n"); in rpi_power_probe()
184 return -ENODEV; in rpi_power_probe()
187 rpi_domains->fw = devm_rpi_firmware_get(&pdev->dev, fw_np); in rpi_power_probe()
189 if (!rpi_domains->fw) in rpi_power_probe()
190 return -EPROBE_DEFER; in rpi_power_probe()
192 rpi_domains->has_new_interface = in rpi_power_probe()
204 * Use the old firmware interface for USB power, so that we in rpi_power_probe()
205 * can turn it on even if the firmware hasn't been updated. in rpi_power_probe()
228 of_genpd_add_provider_onecell(dev->of_node, &rpi_domains->xlate); in rpi_power_probe()
236 { .compatible = "raspberrypi,bcm2835-power", },
243 .name = "raspberrypi-power",