rcar-csi2: enable support for r8a77970
cover rcar-csi2: enable support for r8a77970
Hi,
This series adds Renesas r8a77970 (V3M) support to rcar-csi2. It is tested on V3M using the HDMI input connected to the adv748x on the V3M extension board. It depends on the series 'rcar-csi2: add Renesas R-Car MIPI CSI-2'.
There are many different types of video sources and pipelines on the V3M and this is only tested with one of them as there are other none rcar-csi2 related issues in testing all of them. Therefor I do not wish to squash these changes into the series it depends on which adds the rcar-csi2 driver.
It's my firm belief that this is all that is needed to add CSI-2 support on V3M but it would be great if more pipelines where tested before this series is picked up. Therefor I post it here so other developers working on video capture on V3M can use this for CSI-2 support.
Niklas Söderlund (2):
rcar-csi2: split Mbps calculation to separate function
rcar-csi2: enable support for r8a77970
.../bindings/media/renesas,rcar-csi2.txt | 1 + drivers/media/platform/rcar-vin/rcar-csi2.c | 126 ++++++++++++++++++--- 2 files changed, 114 insertions(+), 13 deletions(-)
Signature · 1 line
2.15.0
PATCH 1/2 rcar-csi2: split Mbps calculation to separate function
The calculation of the Mbps to configured the link with needs to be split out if other configuration procedures on new SoCs are to be able to reuse the calculation procedure.
--- drivers/media/platform/rcar-vin/rcar-csi2.c | 32 +++++++++++++++++------------ 1 file changed, 19 insertions(+), 13 deletions(-)
drivers/media/platform/rcar-vin/rcar-csi2.c +19 -13
@@ -348,11 +348,8 @@ static int rcar_csi2_wait_phy_start(struct rcar_csi2 *priv)return -ETIMEDOUT ; } -static int rcar_csi2_calc_phypll (struct rcar_csi2 *priv,unsigned int bpp, -u32 *phypll) +static int rcar_csi2_calc_mbps (struct rcar_csi2 *priv,unsigned int bpp) { - -const struct phypll_hsfreqrange *hsfreq;struct media_pad *pad, *source_pad;struct v4l2_subdev *source =NULL ;struct v4l2_ctrl *ctrl;
@@ -382,19 +379,26 @@ static int rcar_csi2_calc_phypll(struct rcar_csi2 *priv, unsigned int bpp, mbps =v4l2_ctrl_g_ctrl_int64 (ctrl) * bpp;do_div (mbps, priv->lanes *1000000 ); +return mbps; +} + +static int rcar_csi2_set_phypll (struct rcar_csi2 *priv,unsigned int mbps) +{ +const struct phypll_hsfreqrange *hsfreq; +for (hsfreq = priv->info->hsfreqrange; hsfreq->mbps !=0 ; hsfreq++)if (hsfreq->mbps >= mbps)break ;if (!hsfreq->mbps) { -dev_err (priv->dev,"Unsupported PHY speed (%llu Mbps)" , mbps); +dev_err (priv->dev,"Unsupported PHY speed (%u Mbps)" , mbps);return -ERANGE ; } -dev_dbg (priv->dev,"PHY HSFREQRANGE requested %llu got %u Mbps\n" , mbps, +dev_dbg (priv->dev,"PHY HSFREQRANGE requested %u got %u Mbps\n" , mbps, hsfreq->mbps); - *phypll =PHYPLL_HSFREQRANGE (hsfreq->reg); +rcar_csi2_write (priv,PHYPLL_REG ,PHYPLL_HSFREQRANGE (hsfreq->reg));return 0 ; }
@@ -402,10 +406,10 @@ static int rcar_csi2_calc_phypll(struct rcar_csi2 *priv, unsigned int bpp,static int rcar_csi2_start (struct rcar_csi2 *priv) {const struct rcar_csi2_format *format; -u32 phycnt, phypll, tmp; +u32 phycnt, tmp;u32 vcdt =0 , vcdt2 =0 ;unsigned int i; -int ret; +int mbps, ret; dev_dbg(priv->dev, "Input size (%ux%u%c)\n", priv->mf.width, priv->mf.height,
@@ -447,9 +451,9 @@ static int rcar_csi2_start(struct rcar_csi2 *priv)return -EINVAL ; } - ret =rcar_csi2_calc_phypll (priv, format->bpp, &phypll); -if (ret) -return ret; + mbps =rcar_csi2_calc_mbps (priv, format->bpp); +if (mbps <0 ) +return mbps;/* Clear Ultra Low Power interrupt */ if (priv->info->clear_ulps)
@@ -490,7 +494,9 @@ static int rcar_csi2_start(struct rcar_csi2 *priv) }/* Start */ -rcar_csi2_write (priv,PHYPLL_REG , phypll); + ret =rcar_csi2_set_phypll (priv, mbps); +if (ret) +return ret;/* Set frequency range if we have it */ if (priv->info->csi0clkfreqrange)
Signature · 1 line
2.15.0
Re: [PATCH 1/2] rcar-csi2: split Mbps calculation to separate function
Quoted 1 line · Niklas Söderlund
The calculation of the Mbps to configured the link with needs to be
... to configure the link needs to be?
Quoted 2 lines
split out if other configuration procedures on new SoCs are to be able to reuse the calculation procedure.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
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
PATCH 2/2 rcar-csi2: enable support for r8a77970
In reply to Niklas SöderlundEnable support for Renesas r8a77970 (V3M) by adding the new SoC specific setup procedure and device tree binding.
--- .../bindings/media/renesas,rcar-csi2.txt | 1 + drivers/media/platform/rcar-vin/rcar-csi2.c | 100 ++++++++++++++++++++- 2 files changed, 98 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/media/renesas,rcar-csi2.txt +1 -0
@@ -10,6 +10,7 @@ Mandatory properties - compatible: Must be one or more of the following - "renesas,r8a7795-csi2" for the R8A7795 device. - "renesas,r8a7796-csi2" for the R8A7796 device. + - "renesas,r8a77970-csi2" for the R8A77970 device. - reg: the register base and size for the device registers - interrupts: the interrupt for the device
drivers/media/platform/rcar-vin/rcar-csi2.c +97 -3
142 lines not on this page · raw message
Signature · 1 line
2.15.0