[PATCH v2 05/10] soc: bcm: raspberrypi-power: Release firmware handle on unbind
From: Nicolas Saenz Julienne
Date: Thu Oct 22 2020 - 11:59:20 EST
Upon unbinding the device make sure we release RPi's firmware interface.
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@xxxxxxx>
---
drivers/soc/bcm/raspberrypi-power.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/soc/bcm/raspberrypi-power.c b/drivers/soc/bcm/raspberrypi-power.c
index 5d1aacdd84ef..a0b38db5886c 100644
--- a/drivers/soc/bcm/raspberrypi-power.c
+++ b/drivers/soc/bcm/raspberrypi-power.c
@@ -225,6 +225,20 @@ static int rpi_power_probe(struct platform_device *pdev)
return 0;
}
+static int rpi_power_remove(struct platform_device *pdev)
+{
+ struct rpi_power_domains *rpi_domains = platform_get_drvdata(pdev);
+
+ of_genpd_del_provider(dev->of_node);
+
+ for (i = 0; i < RPI_POWER_DOMAIN_COUNT; i++)
+ pm_genpd_remove(&rpi_domains->domains[i].base);
+
+ rpi_firmware_put(rpi_domaina->fw);
+
+ return 0;
+}
+
static const struct of_device_id rpi_power_of_match[] = {
{ .compatible = "raspberrypi,bcm2835-power", },
{},
@@ -237,6 +251,7 @@ static struct platform_driver rpi_power_driver = {
.of_match_table = rpi_power_of_match,
},
.probe = rpi_power_probe,
+ .remove = rpi_power_remove,
};
builtin_platform_driver(rpi_power_driver);
--
2.28.0