diff mbox series

[v2,4/8] media: i2c: ds90ub953: Handle V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK

Message ID 20230720-fpdlink-additions-v2-4-b91b1eca2ad3@ideasonboard.com (mailing list archive)
State New, archived
Headers show
Series media: i2c: ds90ub9xx: Misc improvements | expand

Commit Message

Tomi Valkeinen July 20, 2023, 10:30 a.m. UTC
Handle V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK flag to configure the CSI-2 RX
continuous/non-continuous clock register.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 drivers/media/i2c/ds90ub953.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Laurent Pinchart July 25, 2023, 4:36 p.m. UTC | #1
Hi Tomi,

Thank you for the patch.

On Thu, Jul 20, 2023 at 01:30:35PM +0300, Tomi Valkeinen wrote:
> Handle V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK flag to configure the CSI-2 RX
> continuous/non-continuous clock register.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
> ---
>  drivers/media/i2c/ds90ub953.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/ds90ub953.c b/drivers/media/i2c/ds90ub953.c
> index ad964bd6c7eb..ad479923d2b4 100644
> --- a/drivers/media/i2c/ds90ub953.c
> +++ b/drivers/media/i2c/ds90ub953.c
> @@ -138,6 +138,7 @@ struct ub953_data {
>  	struct regmap		*regmap;
>  
>  	u32			num_data_lanes;
> +	bool			non_cont_clk;

Maybe non_continous_clk for consistency with 1/8 ?

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

>  
>  	struct gpio_chip	gpio_chip;
>  
> @@ -1139,6 +1140,9 @@ static int ub953_parse_dt(struct ub953_data *priv)
>  
>  	priv->num_data_lanes = nlanes;
>  
> +	priv->non_cont_clk = vep.bus.mipi_csi2.flags &
> +			     V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK;
> +
>  	return 0;
>  }
>  
> @@ -1201,7 +1205,7 @@ static int ub953_hw_init(struct ub953_data *priv)
>  		return dev_err_probe(dev, ret, "i2c init failed\n");
>  
>  	ub953_write(priv, UB953_REG_GENERAL_CFG,
> -		    UB953_REG_GENERAL_CFG_CONT_CLK |
> +		    (priv->non_cont_clk ? 0 : UB953_REG_GENERAL_CFG_CONT_CLK) |
>  		    ((priv->num_data_lanes - 1) << UB953_REG_GENERAL_CFG_CSI_LANE_SEL_SHIFT) |
>  		    UB953_REG_GENERAL_CFG_CRC_TX_GEN_ENABLE);
>  
>
diff mbox series

Patch

diff --git a/drivers/media/i2c/ds90ub953.c b/drivers/media/i2c/ds90ub953.c
index ad964bd6c7eb..ad479923d2b4 100644
--- a/drivers/media/i2c/ds90ub953.c
+++ b/drivers/media/i2c/ds90ub953.c
@@ -138,6 +138,7 @@  struct ub953_data {
 	struct regmap		*regmap;
 
 	u32			num_data_lanes;
+	bool			non_cont_clk;
 
 	struct gpio_chip	gpio_chip;
 
@@ -1139,6 +1140,9 @@  static int ub953_parse_dt(struct ub953_data *priv)
 
 	priv->num_data_lanes = nlanes;
 
+	priv->non_cont_clk = vep.bus.mipi_csi2.flags &
+			     V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK;
+
 	return 0;
 }
 
@@ -1201,7 +1205,7 @@  static int ub953_hw_init(struct ub953_data *priv)
 		return dev_err_probe(dev, ret, "i2c init failed\n");
 
 	ub953_write(priv, UB953_REG_GENERAL_CFG,
-		    UB953_REG_GENERAL_CFG_CONT_CLK |
+		    (priv->non_cont_clk ? 0 : UB953_REG_GENERAL_CFG_CONT_CLK) |
 		    ((priv->num_data_lanes - 1) << UB953_REG_GENERAL_CFG_CSI_LANE_SEL_SHIFT) |
 		    UB953_REG_GENERAL_CFG_CRC_TX_GEN_ENABLE);