Message ID | 20220311103803.25239-3-biju.das.jz@bp.renesas.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add support for RZ/G2L VSPD | expand |
Hi Biju, On Fri, Mar 11, 2022 at 11:38 AM Biju Das <biju.das.jz@bp.renesas.com> wrote: > As the resets DT property is mandatory, and is present in all .dtsi > in mainline, add support to perform deassert/assert using reference > counted reset handle. > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> > Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> > --- > v2->v3: > * Added Rb tag from Philipp > * If reset_control_deassert() failed, return ret directly. Thanks for the update! > --- a/drivers/media/platform/vsp1/vsp1_drv.c > +++ b/drivers/media/platform/vsp1/vsp1_drv.c > @@ -16,6 +16,7 @@ > #include <linux/of_device.h> > #include <linux/platform_device.h> > #include <linux/pm_runtime.h> > +#include <linux/reset.h> > #include <linux/videodev2.h> > > #include <media/rcar-fcp.h> > @@ -569,6 +570,11 @@ static void vsp1_mask_all_interrupts(struct vsp1_device *vsp1) > */ > int vsp1_device_get(struct vsp1_device *vsp1) > { > + int ret = reset_control_deassert(vsp1->rstc); > + > + if (ret < 0) > + return ret; > + > return pm_runtime_resume_and_get(vsp1->dev); You've removed too much :-( If pm_runtime_resume_and_get() fails, so still need to assert the reset again. The rest LGTM. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Hi Geert, > Subject: Re: [PATCH v3 2/3] media: vsp1: Add support to deassert/assert > reset line > > Hi Biju, > > On Fri, Mar 11, 2022 at 11:38 AM Biju Das <biju.das.jz@bp.renesas.com> > wrote: > > As the resets DT property is mandatory, and is present in all .dtsi in > > mainline, add support to perform deassert/assert using reference > > counted reset handle. > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > > Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> > > Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> > > --- > > v2->v3: > > * Added Rb tag from Philipp > > * If reset_control_deassert() failed, return ret directly. > > Thanks for the update! > > > --- a/drivers/media/platform/vsp1/vsp1_drv.c > > +++ b/drivers/media/platform/vsp1/vsp1_drv.c > > @@ -16,6 +16,7 @@ > > #include <linux/of_device.h> > > #include <linux/platform_device.h> > > #include <linux/pm_runtime.h> > > +#include <linux/reset.h> > > #include <linux/videodev2.h> > > > > #include <media/rcar-fcp.h> > > @@ -569,6 +570,11 @@ static void vsp1_mask_all_interrupts(struct > vsp1_device *vsp1) > > */ > > int vsp1_device_get(struct vsp1_device *vsp1) { > > + int ret = reset_control_deassert(vsp1->rstc); > > + > > + if (ret < 0) > > + return ret; > > + > > return pm_runtime_resume_and_get(vsp1->dev); > > You've removed too much :-( My Bad. Will restore error checking related to pm_runtime_resume_and_get. Cheers, Biju > If pm_runtime_resume_and_get() fails, so still need to assert the reset > again. > > The rest LGTM. > > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux- > m68k.org > > In personal conversations with technical people, I call myself a hacker. > But when I'm talking to journalists I just say "programmer" or something > like that. > -- Linus Torvalds
diff --git a/drivers/media/platform/vsp1/vsp1.h b/drivers/media/platform/vsp1/vsp1.h index 37cf33c7e6ca..c5da829c79b5 100644 --- a/drivers/media/platform/vsp1/vsp1.h +++ b/drivers/media/platform/vsp1/vsp1.h @@ -79,6 +79,7 @@ struct vsp1_device { void __iomem *mmio; struct rcar_fcp_device *fcp; struct device *bus_master; + struct reset_control *rstc; struct vsp1_brx *brs; struct vsp1_brx *bru; diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c index 502c7d9d6890..2b1a6ada9fff 100644 --- a/drivers/media/platform/vsp1/vsp1_drv.c +++ b/drivers/media/platform/vsp1/vsp1_drv.c @@ -16,6 +16,7 @@ #include <linux/of_device.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> +#include <linux/reset.h> #include <linux/videodev2.h> #include <media/rcar-fcp.h> @@ -569,6 +570,11 @@ static void vsp1_mask_all_interrupts(struct vsp1_device *vsp1) */ int vsp1_device_get(struct vsp1_device *vsp1) { + int ret = reset_control_deassert(vsp1->rstc); + + if (ret < 0) + return ret; + return pm_runtime_resume_and_get(vsp1->dev); } @@ -581,6 +587,7 @@ int vsp1_device_get(struct vsp1_device *vsp1) void vsp1_device_put(struct vsp1_device *vsp1) { pm_runtime_put_sync(vsp1->dev); + reset_control_assert(vsp1->rstc); } /* ----------------------------------------------------------------------------- @@ -827,6 +834,11 @@ static int vsp1_probe(struct platform_device *pdev) if (irq < 0) return irq; + vsp1->rstc = devm_reset_control_get_shared(&pdev->dev, NULL); + if (IS_ERR(vsp1->rstc)) + return dev_err_probe(&pdev->dev, PTR_ERR(vsp1->rstc), + "failed to get reset ctrl\n"); + /* FCP (optional). */ fcp_node = of_parse_phandle(pdev->dev.of_node, "renesas,fcp", 0); if (fcp_node) {