mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	drm/bridge: adv7533: Change number of DSI lanes dynamically
Lower modes on ADV7533 require lower number of DSI lanes for correct operation. If ADV7533 is being used with 4 DSI lanes, then switch the lanes to 3 when the target mode's pixel clock is less than 80 Mhz. Based on patch by Andy Green <andy.green@linaro.org> Signed-off-by: Archit Taneja <architt@codeaurora.org>
This commit is contained in:
		
							parent
							
								
									78fa479d70
								
							
						
					
					
						commit
						62b2f026cd
					
				
					 3 changed files with 31 additions and 0 deletions
				
			
		| 
						 | 
					@ -339,6 +339,7 @@ struct adv7511 {
 | 
				
			||||||
#ifdef CONFIG_DRM_I2C_ADV7533
 | 
					#ifdef CONFIG_DRM_I2C_ADV7533
 | 
				
			||||||
void adv7533_dsi_power_on(struct adv7511 *adv);
 | 
					void adv7533_dsi_power_on(struct adv7511 *adv);
 | 
				
			||||||
void adv7533_dsi_power_off(struct adv7511 *adv);
 | 
					void adv7533_dsi_power_off(struct adv7511 *adv);
 | 
				
			||||||
 | 
					void adv7533_mode_set(struct adv7511 *adv, struct drm_display_mode *mode);
 | 
				
			||||||
int adv7533_patch_registers(struct adv7511 *adv);
 | 
					int adv7533_patch_registers(struct adv7511 *adv);
 | 
				
			||||||
void adv7533_uninit_cec(struct adv7511 *adv);
 | 
					void adv7533_uninit_cec(struct adv7511 *adv);
 | 
				
			||||||
int adv7533_init_cec(struct adv7511 *adv);
 | 
					int adv7533_init_cec(struct adv7511 *adv);
 | 
				
			||||||
| 
						 | 
					@ -354,6 +355,11 @@ static inline void adv7533_dsi_power_off(struct adv7511 *adv)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static inline void adv7533_mode_set(struct adv7511 *adv,
 | 
				
			||||||
 | 
									    struct drm_display_mode *mode)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline int adv7533_patch_registers(struct adv7511 *adv)
 | 
					static inline int adv7533_patch_registers(struct adv7511 *adv)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return -ENODEV;
 | 
						return -ENODEV;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -712,6 +712,9 @@ static void adv7511_mode_set(struct adv7511 *adv7511,
 | 
				
			||||||
	regmap_update_bits(adv7511->regmap, 0x17,
 | 
						regmap_update_bits(adv7511->regmap, 0x17,
 | 
				
			||||||
		0x60, (vsync_polarity << 6) | (hsync_polarity << 5));
 | 
							0x60, (vsync_polarity << 6) | (hsync_polarity << 5));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (adv7511->type == ADV7533)
 | 
				
			||||||
 | 
							adv7533_mode_set(adv7511, adj_mode);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	drm_mode_copy(&adv7511->curr_mode, adj_mode);
 | 
						drm_mode_copy(&adv7511->curr_mode, adj_mode);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -115,6 +115,28 @@ void adv7533_dsi_power_off(struct adv7511 *adv)
 | 
				
			||||||
	regmap_write(adv->regmap_cec, 0x27, 0x0b);
 | 
						regmap_write(adv->regmap_cec, 0x27, 0x0b);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void adv7533_mode_set(struct adv7511 *adv, struct drm_display_mode *mode)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct mipi_dsi_device *dsi = adv->dsi;
 | 
				
			||||||
 | 
						int lanes, ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (adv->num_dsi_lanes != 4)
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (mode->clock > 80000)
 | 
				
			||||||
 | 
							lanes = 4;
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							lanes = 3;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (lanes != dsi->lanes) {
 | 
				
			||||||
 | 
							mipi_dsi_detach(dsi);
 | 
				
			||||||
 | 
							dsi->lanes = lanes;
 | 
				
			||||||
 | 
							ret = mipi_dsi_attach(dsi);
 | 
				
			||||||
 | 
							if (ret)
 | 
				
			||||||
 | 
								dev_err(&dsi->dev, "failed to change host lanes\n");
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int adv7533_patch_registers(struct adv7511 *adv)
 | 
					int adv7533_patch_registers(struct adv7511 *adv)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return regmap_register_patch(adv->regmap,
 | 
						return regmap_register_patch(adv->regmap,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue