mirror of
				https://github.com/Ysurac/openmptcprouter.git
				synced 2025-03-09 15:40:20 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			59 lines
		
	
	
	
		
			1.8 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			59 lines
		
	
	
	
		
			1.8 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
| From 9bedfcde963973493bca5330452f2d39a271b8c2 Mon Sep 17 00:00:00 2001
 | |
| From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
 | |
| Date: Mon, 16 Jan 2023 15:44:53 +0100
 | |
| Subject: [PATCH] media: i2c: imx290: Simplify imx290_set_data_lanes()
 | |
| 
 | |
| Upstream commit 76c001287f6a
 | |
| 
 | |
| There's no need to check for an incorrect number of data lanes in
 | |
| imx290_set_data_lanes() as the value is validated at probe() time. Drop
 | |
| the check.
 | |
| 
 | |
| The PHY_LANE_NUM and CSI_LANE_MODE registers are programmed with a value
 | |
| equal to the number of lanes minus one. Compute it instead of handling
 | |
| it in the switch/case.
 | |
| 
 | |
| Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
 | |
| Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com>
 | |
| Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
 | |
| Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
 | |
| ---
 | |
|  drivers/media/i2c/imx290.c | 17 +++++------------
 | |
|  1 file changed, 5 insertions(+), 12 deletions(-)
 | |
| 
 | |
| --- a/drivers/media/i2c/imx290.c
 | |
| +++ b/drivers/media/i2c/imx290.c
 | |
| @@ -512,28 +512,21 @@ static int imx290_set_register_array(str
 | |
|  
 | |
|  static int imx290_set_data_lanes(struct imx290 *imx290)
 | |
|  {
 | |
| -	int ret = 0, laneval, frsel;
 | |
| +	int ret = 0;
 | |
| +	u32 frsel;
 | |
|  
 | |
|  	switch (imx290->nlanes) {
 | |
|  	case 2:
 | |
| -		laneval = 0x01;
 | |
| +	default:
 | |
|  		frsel = 0x02;
 | |
|  		break;
 | |
|  	case 4:
 | |
| -		laneval = 0x03;
 | |
|  		frsel = 0x01;
 | |
|  		break;
 | |
| -	default:
 | |
| -		/*
 | |
| -		 * We should never hit this since the data lane count is
 | |
| -		 * validated in probe itself
 | |
| -		 */
 | |
| -		dev_err(imx290->dev, "Lane configuration not supported\n");
 | |
| -		return -EINVAL;
 | |
|  	}
 | |
|  
 | |
| -	imx290_write(imx290, IMX290_PHY_LANE_NUM, laneval, &ret);
 | |
| -	imx290_write(imx290, IMX290_CSI_LANE_MODE, laneval, &ret);
 | |
| +	imx290_write(imx290, IMX290_PHY_LANE_NUM, imx290->nlanes - 1, &ret);
 | |
| +	imx290_write(imx290, IMX290_CSI_LANE_MODE, imx290->nlanes - 1, &ret);
 | |
|  	imx290_write(imx290, IMX290_FR_FDG_SEL, frsel, &ret);
 | |
|  
 | |
|  	return ret;
 |