[PATCH v6] fbtft: add tearing signal detect

Geert Uytterhoeven geert at linux-m68k.org
Wed Jan 27 09:00:13 UTC 2021


Hi Carlis,

On Wed, Jan 27, 2021 at 9:52 AM Carlis <zhangxuezhi3 at gmail.com> wrote:
> From: zhangxuezhi <zhangxuezhi1 at yulong.com>
>
> For st7789v ic,add tearing signal detect to avoid screen tearing
>
> Signed-off-by: zhangxuezhi <zhangxuezhi1 at yulong.com>

Thanks for your patch!

> --- a/drivers/staging/fbtft/fb_st7789v.c
> +++ b/drivers/staging/fbtft/fb_st7789v.c

> @@ -82,6 +111,34 @@ enum st7789v_command {
>   */
>  static int init_display(struct fbtft_par *par)
>  {
> +       int rc;
> +       struct device *dev = par->info->device;
> +
> +       par->gpio.te = devm_gpiod_get_index_optional(dev, "te", 0, GPIOD_IN);
> +       if (IS_ERR(par->gpio.te)) {
> +               rc = PTR_ERR(par->gpio.te);
> +               pr_err("Failed to request te gpio: %d\n", rc);
> +               par->gpio.te = NULL;

Errors (e.g. -EPROBE_DEFER) should be propagated upstream,
not ignored.

> +       }
> +       if (par->gpio.te) {
> +               init_completion(&spi_panel_te);
> +               mutex_init(&te_mutex);
> +               rc = devm_request_irq(dev,
> +                                     gpiod_to_irq(par->gpio.te),
> +                                    spi_panel_te_handler, IRQF_TRIGGER_RISING,
> +                                    "TE_GPIO", par);
> +               if (rc) {
> +                       pr_err("TE request_irq failed.\n");
> +                       devm_gpiod_put(dev, par->gpio.te);
> +                       par->gpio.te = NULL;

Errors (e.g. -EPROBE_DEFER) should be propagated upstream,
not ignored.

> +               } else {
> +                       disable_irq_nosync(gpiod_to_irq(par->gpio.te));
> +                       pr_info("TE request_irq completion.\n");
> +               }
> +       } else {
> +               pr_info("%s:%d, TE gpio not specified\n",
> +                       __func__, __LINE__);
> +       }
>         /* turn off sleep mode */
>         write_reg(par, MIPI_DCS_EXIT_SLEEP_MODE);
>         mdelay(120);

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds


More information about the dri-devel mailing list