[PATCH v2 10/11] media: rcar-fcp: Handle resets
From: Paul Elder
Date: Fri Sep 18 2026 - 13:17:21 EST
On some versions of the FCP, such as the one on the X5H, reset control
is required to operate the FCP. Add support for handling resets
optionally, to continue supporting versions that do not require it.
Signed-off-by: Paul Elder <paul.elder+renesas@xxxxxxxxxxxxxxxx>
---
Changes in v2:
- handle errors
---
drivers/media/platform/renesas/rcar-fcp.c | 30 ++++++++++++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/renesas/rcar-fcp.c b/drivers/media/platform/renesas/rcar-fcp.c
index dfb0ca93e854dd0bb8aedfb757fd786ef6e45542..76d4c250b30815d9eac58f9b54ad923748df79f6 100644
--- a/drivers/media/platform/renesas/rcar-fcp.c
+++ b/drivers/media/platform/renesas/rcar-fcp.c
@@ -16,6 +16,7 @@
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
+#include <linux/reset.h>
#include <linux/slab.h>
#include <media/rcar-fcp.h>
@@ -29,6 +30,7 @@ struct rcar_fcp_device {
struct list_head list;
struct device *dev;
void __iomem *base;
+ struct reset_control *rstc;
};
static LIST_HEAD(fcp_devices);
@@ -162,20 +164,25 @@ static int rcar_fcp_probe(struct platform_device *pdev)
fcp->dev = &pdev->dev;
+ platform_set_drvdata(pdev, fcp);
+
fcp->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(fcp->base))
return PTR_ERR(fcp->base);
dma_set_max_seg_size(fcp->dev, UINT_MAX);
+ fcp->rstc = devm_reset_control_get_optional(&pdev->dev, NULL);
+ if (IS_ERR(fcp->rstc))
+ return dev_err_probe(&pdev->dev, PTR_ERR(fcp->rstc),
+ "failed to get reset control\n");
+
pm_runtime_enable(&pdev->dev);
mutex_lock(&fcp_lock);
list_add_tail(&fcp->list, &fcp_devices);
mutex_unlock(&fcp_lock);
- platform_set_drvdata(pdev, fcp);
-
return 0;
}
@@ -190,6 +197,24 @@ static void rcar_fcp_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);
}
+static int fcp_pm_runtime_suspend(struct device *dev)
+{
+ struct rcar_fcp_device *fcp = dev_get_drvdata(dev);
+
+ return reset_control_assert(fcp->rstc);
+}
+
+static int fcp_pm_runtime_resume(struct device *dev)
+{
+ struct rcar_fcp_device *fcp = dev_get_drvdata(dev);
+
+ return reset_control_deassert(fcp->rstc);
+}
+
+static const struct dev_pm_ops fcp_pm_ops = {
+ RUNTIME_PM_OPS(fcp_pm_runtime_suspend, fcp_pm_runtime_resume, NULL)
+};
+
static const struct of_device_id rcar_fcp_of_match[] = {
{ .compatible = "renesas,fcpf" },
{ .compatible = "renesas,fcpv" },
@@ -202,6 +227,7 @@ static struct platform_driver rcar_fcp_platform_driver = {
.remove = rcar_fcp_remove,
.driver = {
.name = "rcar-fcp",
+ .pm = pm_ptr(&fcp_pm_ops),
.of_match_table = rcar_fcp_of_match,
.suppress_bind_attrs = true,
},
--
2.47.3