diff mbox series

[2/4] rcar-vin: cache the CSI-2 channel selection value

Message ID 20181214061824.10296-3-niklas.soderlund+renesas@ragnatech.se (mailing list archive)
State New, archived
Headers show
Series rcar-vin: add support for suspend and resume | expand

Commit Message

Niklas Söderlund Dec. 14, 2018, 6:18 a.m. UTC
In preparation of suspend/resume support cache the chsel value when we
write it to the register so it can be restored on resume if needed.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 drivers/media/platform/rcar-vin/rcar-dma.c | 2 ++
 drivers/media/platform/rcar-vin/rcar-vin.h | 2 ++
 2 files changed, 4 insertions(+)

Comments

Laurent Pinchart Dec. 14, 2018, 8:23 a.m. UTC | #1
Hi Niklas,

Thank you for the patch.

On Friday, 14 December 2018 08:18:22 EET Niklas Söderlund wrote:
> In preparation of suspend/resume support cache the chsel value when we
> write it to the register so it can be restored on resume if needed.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> ---
>  drivers/media/platform/rcar-vin/rcar-dma.c | 2 ++
>  drivers/media/platform/rcar-vin/rcar-vin.h | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c
> b/drivers/media/platform/rcar-vin/rcar-dma.c index
> beb9248992a48a74..64f7636f94d6a0a3 100644
> --- a/drivers/media/platform/rcar-vin/rcar-dma.c
> +++ b/drivers/media/platform/rcar-vin/rcar-dma.c
> @@ -1336,6 +1336,8 @@ int rvin_set_channel_routing(struct rvin_dev *vin, u8
> chsel)
> 
>  	vin_dbg(vin, "Set IFMD 0x%x\n", ifmd);
> 
> +	vin->chsel = chsel;
> +

Would it be useful to add a

	if (vin->chsel == chsel)
		return 0;

at the beginning of the function, or is that impossible ?

>  	/* Restore VNMC. */
>  	rvin_write(vin, vnmc, VNMC_REG);
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h
> b/drivers/media/platform/rcar-vin/rcar-vin.h index
> 0b13b34d03e3dce4..d21fc991b7a9da36 100644
> --- a/drivers/media/platform/rcar-vin/rcar-vin.h
> +++ b/drivers/media/platform/rcar-vin/rcar-vin.h
> @@ -170,6 +170,7 @@ struct rvin_info {
>   * @state:		keeps track of operation state
>   *
>   * @is_csi:		flag to mark the VIN as using a CSI-2 subdevice
> + * @chsel		Cached value of the current CSI-2 channel selection

Nitpicking, the documentation for other fields don't start with a capital 
letter.

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

>   *
>   * @mbus_code:		media bus format code
>   * @format:		active V4L2 pixel format
> @@ -207,6 +208,7 @@ struct rvin_dev {
>  	enum rvin_dma_state state;
> 
>  	bool is_csi;
> +	unsigned int chsel;
> 
>  	u32 mbus_code;
>  	struct v4l2_pix_format format;
diff mbox series

Patch

diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c
index beb9248992a48a74..64f7636f94d6a0a3 100644
--- a/drivers/media/platform/rcar-vin/rcar-dma.c
+++ b/drivers/media/platform/rcar-vin/rcar-dma.c
@@ -1336,6 +1336,8 @@  int rvin_set_channel_routing(struct rvin_dev *vin, u8 chsel)
 
 	vin_dbg(vin, "Set IFMD 0x%x\n", ifmd);
 
+	vin->chsel = chsel;
+
 	/* Restore VNMC. */
 	rvin_write(vin, vnmc, VNMC_REG);
 
diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h b/drivers/media/platform/rcar-vin/rcar-vin.h
index 0b13b34d03e3dce4..d21fc991b7a9da36 100644
--- a/drivers/media/platform/rcar-vin/rcar-vin.h
+++ b/drivers/media/platform/rcar-vin/rcar-vin.h
@@ -170,6 +170,7 @@  struct rvin_info {
  * @state:		keeps track of operation state
  *
  * @is_csi:		flag to mark the VIN as using a CSI-2 subdevice
+ * @chsel		Cached value of the current CSI-2 channel selection
  *
  * @mbus_code:		media bus format code
  * @format:		active V4L2 pixel format
@@ -207,6 +208,7 @@  struct rvin_dev {
 	enum rvin_dma_state state;
 
 	bool is_csi;
+	unsigned int chsel;
 
 	u32 mbus_code;
 	struct v4l2_pix_format format;