From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF9D8C636C9 for ; Wed, 21 Jul 2021 07:28:22 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A50F2610D2 for ; Wed, 21 Jul 2021 07:28:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A50F2610D2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2F4B76E87E; Wed, 21 Jul 2021 07:28:22 +0000 (UTC) Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 16CD76E87E for ; Wed, 21 Jul 2021 07:28:21 +0000 (UTC) Received: by mail-io1-xd2c.google.com with SMTP id v26so1274150iom.11 for ; Wed, 21 Jul 2021 00:28:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=crzrKyOvq9XSzeVwcwYVEZyzEYKB+kuf+nGDzKw4bc8=; b=tjmB+xOvE90FRuCicGDmQvW54HE+z3q+OZelOKqukIr/u+qVAIoWvAD0/HPMMjnPoG fdqu1IHE314OBVff87JxATVUwxnxobOUkLpbPzEyBuErxbImOPCHTrxeQQqg+ISGZQX0 ETd6C2EUGOIUsuwafHcTP2DVkMjBwkBJ+kQf5tsOUDxDB5Rm8cN5w8narOE8P/0dvruY BlAzt2VZtSWrU0ai5A9DNHDmA5zrMuMr9/F9q/8hbd1WCUx318sUrDKV6avWSMrml1RK ecgpvgILwYFX1z+G1vxWQP6J2h1qmlEDetU2isQTLHhpjgBTw0fUaDZzCXqy378CeWuk 1UXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=crzrKyOvq9XSzeVwcwYVEZyzEYKB+kuf+nGDzKw4bc8=; b=Dw9KYhHVoBHH9Wwuk5rb89GWwiXtJs2QLEfrjm3h9DAzG4VZ/IDxBQmXPX/8bqe6Qy 90u+xhBGT/Ooti4tHU4RvQotQMcc4Emn6goIYIRx10/D42SJp74DvHilJHUPs4SW6fKt d+bT1ixjIa0iPqa3+hso8c6F9aSAadS3bUPcbXYN3migPPgR9Tfz6bFYv1XsAylxEk35 J8Z/y7QDDn1StYtZtqeapVT7K4TC/jRSmt0JRL4V//v/qkuSyy8gwCWJl7EkQjFu5nI0 +VR+XlkvsE2xc6WB84+d7lqEbXqLjPHzNjJfe1+XxZ8BmjJ1apXUJAdTB1ahhj9JYz9F KlBQ== X-Gm-Message-State: AOAM533oX8p0cuPGvXkhq7kBPuw4AUVQUHTIKhkm1KG2WR26CWYYh7pu 3cXugB+F38tq3y4vdn/wTnp8NjmP5YU5Nr4XNd8= X-Google-Smtp-Source: ABdhPJxhP4qhdGPqpGs8CMhq9oYFqXjrHGMxEFk4vfQhCG7aRsoRrdB41oD1dRCvjoO8UvLmFcg39J6E0oqBVq1+3Js= X-Received: by 2002:a05:6638:24c3:: with SMTP id y3mr29796193jat.10.1626852500466; Wed, 21 Jul 2021 00:28:20 -0700 (PDT) MIME-Version: 1.0 References: <1626430843-23823-1-git-send-email-dillon.minfei@gmail.com> <1626430843-23823-3-git-send-email-dillon.minfei@gmail.com> In-Reply-To: From: Dillon Min Date: Wed, 21 Jul 2021 15:27:44 +0800 Message-ID: Subject: Re: [PATCH 2/2] drm/panel: Add ilitek ili9341 panel driver To: Linus Walleij Content-Type: multipart/alternative; boundary="00000000000064709c05c79d1d01" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , =?UTF-8?Q?Noralf_Tr=C3=B8nnes?= , Dave Airlie , linux-kernel , Doug Anderson , "open list:DRM PANEL DRIVERS" , Alexandre Torgue , Rob Herring , "thierry.reding@gmail.com" , Sam Ravnborg Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" --00000000000064709c05c79d1d01 Content-Type: text/plain; charset="UTF-8" Hi Linus, Thanks for your detailed review. On Sun, 18 Jul 2021 at 08:31, Linus Walleij wrote: > Hi Dillon, > > thanks for your patch! > > On Fri, Jul 16, 2021 at 12:20 PM wrote: > > > From: Dillon Min > > > > This driver combine tiny/ili9341.c mipi_dbi_interface driver > > with mipi_dpi_interface driver, can support ili9341 with serial > > mode or parallel rgb interface mode by register configuration. > > > > Signed-off-by: Dillon Min > > Nice! > > > +config DRM_PANEL_ILITEK_ILI9341 > > + tristate "Ilitek ILI9341 240x320 QVGA panels" > > + depends on OF && SPI > > + depends on DRM_KMS_HELPER > > + depends on DRM_KMS_CMA_HELPER > (...) > > +#include > > +#include > > +#include > > +#include > > +#include > > Hm now there is a (partial) KMS driver in the panel driver, kinda, sorta. > Is this the right split? I'm not the best with DRM infrastructure, > just asking. > I tried to remove one of these two headers, but got compile errors: linux/drivers/gpu/drm/panel/panel-ilitek-ili9341.c:719:3: error: implicit declaration of function 'drm_atomic_helper_shutdown' [-Werror =implicit-function-declaration] 719 | drm_atomic_helper_shutdown(drm); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ or linux/drivers/gpu/drm/panel/panel-ilitek-ili9341.c:562:16: error: 'drm_gem_simple_display_pipe_prepare_fb' undeclared here (not in a function) 562 | .prepare_fb = drm_gem_simple_display_pipe_prepare_fb, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Actually, these two headers are merged from tiny/ili9341.c to support only- DBI interface, I'm not sure whether the maintainers will ask me to remove (tiny/ili9341.c) code from this patch. If so, I will remove these headers. But, It's a little strange to support different interfaces from different drivers. > > +struct ili9341_config { > > + u32 max_spi_speed; > > + /** @mode: the drm display mode */ > > + const struct drm_display_mode mode; > > + /* @ca: TODO: need comments for this register */ > > + u8 ca[ILI9341_CA_LEN]; > > These are all in the datasheet but I guess you plan to add these > TODOs later. (It's fine I suppose, the driver is already very nice.) > Yes, I didn't get detailed information about these registers from this panel datasheet, so leave TODOs here. > > + struct regulator *vcc; > > Use the right name of the pin for the regulator. I guess this is actually > vci. I would implement all three regulators and get them as bulk. > See e.g. drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c > for an example on how to get and enable several regulators > using bulk. > > The regulator framework will provide dummy regulators if you > didn't define some of them so it is fine to just provide one or two. > > Really appreciate your suggestion, will add to v2. > Yours, > Linus Walleij > --00000000000064709c05c79d1d01 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Linus,

Thanks for y= our detailed review.

On Sun, 18 Jul 2021 at 08:31, Linus Walleij <linus.walleij@linaro.org&= gt; wrote:
Hi Di= llon,

thanks for your patch!

On Fri, Jul 16, 2021 at 12:20 PM <dillon.minfei@gmail.com> wrote:

> From: Dillon Min <dillon.minfei@gmail.com>
>
> This driver combine tiny/ili9341.c mipi_dbi_interface driver
> with mipi_dpi_interface driver, can support ili9341 with serial
> mode or parallel rgb interface mode by register configuration.
>
> Signed-off-by: Dillon Min <dillon.minfei@gmail.com>

Nice!

> +config DRM_PANEL_ILITEK_ILI9341
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0tristate "Ilitek ILI9341 240x320 QVGA= panels"
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0depends on OF && SPI
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0depends on DRM_KMS_HELPER
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0depends on DRM_KMS_CMA_HELPER
(...)
> +#include <drm/drm_gem_framebuffer_helper.h>
> +#include <drm/drm_gem_cma_helper.h>
> +#include <drm/drm_fb_helper.h>
> +#include <drm/drm_gem_atomic_helper.h>
> +#include <drm/drm_atomic_helper.h>

Hm now there is a (partial) KMS driver in the panel driver, kinda, sorta. Is this the right split? I'm not the best with DRM infrastructure,
just asking.

I tried to remove one of t= hese two headers, but got compile errors:
<= br>
linux/drivers/gpu/drm/panel/panel-ilitek-ili9341.c:719:3: error: implicit declaration of = function 'drm_atomic_helper_shutdown' [-Wer= ror=3Dimplicit-function-declaration]
=C2=A0 719 | =C2=A0 drm_atomic_helper_shutdown(drm);
=C2=A0 =C2=A0 =C2=A0 | =C2=A0 ^~~~~~~~~~~~~~~~~~~~~~~~~~
or

linux/drivers/gpu/drm/panel/panel-ilitek-ili9= 341.c:562:16: error: 'drm_gem_simple_display_pipe_prepare_fb' undec= lared here (not in a function)
=C2=A0 562 | =C2=A0.prepare_fb =3D drm_gem_simple_= display_pipe_prepare_fb,
=C2=A0 =C2=A0= =C2=A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0^~~~~~~~~~= ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Actually, these two hea= ders are merged from tiny/ili9341.c to support only-DBI interface, I'm
not sure whether the maintainers = will ask me to remove (tiny/ili9341.c) code from this patch.
If s= o, I will remove these headers.

But, It's a li= ttle strange to support different interfaces from different drivers.
<= div>

> +struct ili9341_config {
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0u32 max_spi_speed;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0/** @mode: the drm display mode */
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0const struct drm_display_mode mode;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0/* @ca: TODO: need comments for this regis= ter */
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0u8 ca[ILI9341_CA_LEN];

These are all in the datasheet but I guess you plan to add these
TODOs later. (It's fine I suppose, the driver is already very nice.)

Yes, I didn't get detailed informatio= n about these registers from this
panel = datasheet, so leave TODOs here.


> +=C2=A0 =C2=A0 =C2=A0 =C2=A0struct regulator *vcc;

Use the right name of the pin for the regulator. I guess this is actually vci. I would implement all three regulators and get them as bulk.
See e.g. drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
for an example on how to get and enable several regulators
using bulk.

The regulator framework will provide dummy regulators if you
didn't define some of them so it is fine to just provide one or two.

Really appreciate your suggestion, wil= l add to v2.
=C2=A0
Yours,
Linus Walleij
--00000000000064709c05c79d1d01--