forked from mirrors/linux
		
	drm: bridge: it66121: Set DDC preamble only once before reading EDID
The DDC preamble and target address only need to be set once before reading the EDID, even if multiple segments have to be read. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Reviewed-by: Robert Foss <robert.foss@linaro.org> Link: https://patchwork.freedesktop.org/patch/msgid/20221214125821.12489-9-paul@crapouillou.net
This commit is contained in:
		
							parent
							
								
									d7f139da0c
								
							
						
					
					
						commit
						e668565087
					
				
					 1 changed files with 16 additions and 12 deletions
				
			
		| 
						 | 
					@ -506,9 +506,6 @@ static int it66121_get_edid_block(void *context, u8 *buf,
 | 
				
			||||||
	while (remain > 0) {
 | 
						while (remain > 0) {
 | 
				
			||||||
		cnt = (remain > IT66121_EDID_FIFO_SIZE) ?
 | 
							cnt = (remain > IT66121_EDID_FIFO_SIZE) ?
 | 
				
			||||||
				IT66121_EDID_FIFO_SIZE : remain;
 | 
									IT66121_EDID_FIFO_SIZE : remain;
 | 
				
			||||||
		ret = it66121_preamble_ddc(ctx);
 | 
					 | 
				
			||||||
		if (ret)
 | 
					 | 
				
			||||||
			return ret;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ret = regmap_write(ctx->regmap, IT66121_DDC_COMMAND_REG,
 | 
							ret = regmap_write(ctx->regmap, IT66121_DDC_COMMAND_REG,
 | 
				
			||||||
				   IT66121_DDC_COMMAND_FIFO_CLR);
 | 
									   IT66121_DDC_COMMAND_FIFO_CLR);
 | 
				
			||||||
| 
						 | 
					@ -519,15 +516,6 @@ static int it66121_get_edid_block(void *context, u8 *buf,
 | 
				
			||||||
		if (ret)
 | 
							if (ret)
 | 
				
			||||||
			return ret;
 | 
								return ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ret = it66121_preamble_ddc(ctx);
 | 
					 | 
				
			||||||
		if (ret)
 | 
					 | 
				
			||||||
			return ret;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		ret = regmap_write(ctx->regmap, IT66121_DDC_HEADER_REG,
 | 
					 | 
				
			||||||
				   IT66121_DDC_HEADER_EDID);
 | 
					 | 
				
			||||||
		if (ret)
 | 
					 | 
				
			||||||
			return ret;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		ret = regmap_write(ctx->regmap, IT66121_DDC_OFFSET_REG, offset);
 | 
							ret = regmap_write(ctx->regmap, IT66121_DDC_OFFSET_REG, offset);
 | 
				
			||||||
		if (ret)
 | 
							if (ret)
 | 
				
			||||||
			return ret;
 | 
								return ret;
 | 
				
			||||||
| 
						 | 
					@ -842,9 +830,25 @@ static struct edid *it66121_bridge_get_edid(struct drm_bridge *bridge,
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct it66121_ctx *ctx = container_of(bridge, struct it66121_ctx, bridge);
 | 
						struct it66121_ctx *ctx = container_of(bridge, struct it66121_ctx, bridge);
 | 
				
			||||||
	struct edid *edid;
 | 
						struct edid *edid;
 | 
				
			||||||
 | 
						int ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	mutex_lock(&ctx->lock);
 | 
						mutex_lock(&ctx->lock);
 | 
				
			||||||
 | 
						ret = it66121_preamble_ddc(ctx);
 | 
				
			||||||
 | 
						if (ret) {
 | 
				
			||||||
 | 
							edid = ERR_PTR(ret);
 | 
				
			||||||
 | 
							goto out_unlock;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ret = regmap_write(ctx->regmap, IT66121_DDC_HEADER_REG,
 | 
				
			||||||
 | 
								   IT66121_DDC_HEADER_EDID);
 | 
				
			||||||
 | 
						if (ret) {
 | 
				
			||||||
 | 
							edid = ERR_PTR(ret);
 | 
				
			||||||
 | 
							goto out_unlock;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	edid = drm_do_get_edid(connector, it66121_get_edid_block, ctx);
 | 
						edid = drm_do_get_edid(connector, it66121_get_edid_block, ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					out_unlock:
 | 
				
			||||||
	mutex_unlock(&ctx->lock);
 | 
						mutex_unlock(&ctx->lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return edid;
 | 
						return edid;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue