Re: [PATCH] drm/ast: fixed reading monitor EDID not stable issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 30, 2018 at 4:24 AM Y.C. Chen <yacheng600221@xxxxxxxxx> wrote:
>
> From: "Y.C. Chen" <yc_chen@xxxxxxxxxxxxxx>
>
> over-sample data to increase the stability with some specific monitors
>
> Signed-off-by: Y.C. Chen <yc_chen@xxxxxxxxxxxxxx>
> ---
>  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



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux