[PATCH] drm/ast: fixed reading monitor EDID not stable issue
Ilia Mirkin
imirkin at alum.mit.edu
Tue Oct 30 13:01:00 UTC 2018
On Tue, Oct 30, 2018 at 4:24 AM Y.C. Chen <yacheng600221 at gmail.com> wrote:
>
> From: "Y.C. Chen" <yc_chen at aspeedtech.com>
>
> over-sample data to increase the stability with some specific monitors
>
> Signed-off-by: Y.C. Chen <yc_chen at aspeedtech.com>
> ---
> drivers/gpu/drm/ast/ast_mode.c | 32 ++++++++++++++++++++++++++------
> 1 file changed, 26 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
> index 5e77d45..22e80c0 100644
> --- a/drivers/gpu/drm/ast/ast_mode.c
> +++ b/drivers/gpu/drm/ast/ast_mode.c
> @@ -972,9 +972,19 @@ static int get_clock(void *i2c_priv)
> {
> struct ast_i2c_chan *i2c = i2c_priv;
> struct ast_private *ast = i2c->dev->dev_private;
> - uint32_t val;
> + volatile uint32_t val, val2, count;
> +
> + count = 0;
> + val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4) & 0x01;
> + do {
> + val2 = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4) & 0x01;
> + if (val == val2) count++;
> + else {
> + count = 0;
> + val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4) & 0x01;
> + }
> + } while (count < 5);
This can lead to an infinite loop if there's no stable output, no? I
think those are frowned upon in the kernel...
Cheers,
-ilia
More information about the dri-devel
mailing list