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=-6.0 required=3.0 tests=BAYES_00,DATE_IN_PAST_06_12, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,INCLUDES_CR_TRAILER, INCLUDES_PATCH,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 01275C433DB for ; Wed, 31 Mar 2021 09:20:40 +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 AF1956198F for ; Wed, 31 Mar 2021 09:20:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AF1956198F 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 345BF6EA22; Wed, 31 Mar 2021 09:20:39 +0000 (UTC) Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by gabe.freedesktop.org (Postfix) with ESMTPS id 455F46EA22 for ; Wed, 31 Mar 2021 09:20:37 +0000 (UTC) Received: by mail-lj1-x233.google.com with SMTP id f26so23000737ljp.8 for ; Wed, 31 Mar 2021 02:20:37 -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=0+OIv1gO6uxY8WzaB5fR8uUBJwOnLPfnfU8H+iSXLOg=; b=mgDLiRUtAzAGz/BZpi3FLaTEK4Ocd0y2SH0iMbnXL+AIUUlxibIuaGV5nlZRGr2NWf RV5+9j6CSSUOUv+aX1LYjdSJ43aTick8TJuoobVCBHgYK4SbB5zbX6rEnGlmgzqe7zyw rNrY1S5imiHicXlkuX3I1zrutEgMKOSO7UfhURLXiKdRkqwVjfpFP78slW5rSelSCaTq X2oWIdfTtKGoZLtsrNe0III21QOiwrKTiFsTe/VGPjrOH3+MBdGayIHuN7QQidlmjOsc Xc81TGwFrWwiAkLC3qJrR1KDKbfCUcsy5FwCgWpKh7/07dEOo4JM6mdwv4VNOjjvvsf8 UikA== 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=0+OIv1gO6uxY8WzaB5fR8uUBJwOnLPfnfU8H+iSXLOg=; b=ue5ISnxcN6Ji2Faw2HSFa06L1i/EQbEu4Mz66vodP3n29qdz1RcBr7uQ8/DxWBHjGb BcGQd3gTpW2rm34b4xo3vIgVrRlhMAf43iz81Zok0Qt7dOTvIP8HYN0wtWWqh555/8Tm YJOcztPT3glQI0F2nZPljf0s5AYY2wXJNitVi2I6WNOJI0c7w9NClP66ysaIR95PmHZv aJ9GsR720+qJyguzgwPy+7tiU27pg2ai3DjttE3GqVcZPtICuZRsFYrvi2qkfhUc4cy3 DDO7HU38RURnDrbpBGMthfQSrorqkpSMBIr8lKnUJvwBM2POPX0A8zFGZGgQS39w7uED 2iyA== X-Gm-Message-State: AOAM533zSZqG60DJzwFf/Nmf3UBW+/9H8+16AUMFI65OUohQgerkCWiP fl/R2YfgSPm07yf3KhBciMoG6n5ePGwlfi7cG8o= X-Google-Smtp-Source: ABdhPJxESvzvROQLc5SGNj9Uq8DMq1WXwZ7D2bEaYF7z1iwCL/YkfoZXFZ7p/6Ujo9+w4bK50dX/7p1bTXLwfOkEPgs= X-Received: by 2002:a2e:868b:: with SMTP id l11mr1501555lji.332.1617182435635; Wed, 31 Mar 2021 02:20:35 -0700 (PDT) MIME-Version: 1.0 References: <20210222132822.7830-1-kevin3.tang@gmail.com> <20210222132822.7830-3-kevin3.tang@gmail.com> <20210324105334.7pnrco53akhzjjjw@gilmour> In-Reply-To: <20210324105334.7pnrco53akhzjjjw@gilmour> From: Kevin Tang Date: Wed, 31 Mar 2021 09:20:02 +0800 Message-ID: Subject: Re: [PATCH v4 2/6] drm/sprd: add Unisoc's drm kms master To: Maxime Ripard 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: Mark Rutland , devicetree@vger.kernel.org, David Airlie , Chunyan Zhang , "Linux-Kernel@Vger. Kernel. Org" , ML dri-devel , Rob Herring , Orson Zhai , Sean Paul Content-Type: multipart/mixed; boundary="===============1705757445==" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" --===============1705757445== Content-Type: multipart/alternative; boundary="0000000000009cf6a705bed1a08c" --0000000000009cf6a705bed1a08c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Maxime Ripard =E4=BA=8E2021=E5=B9=B43=E6=9C=8824=E6=97= =A5=E5=91=A8=E4=B8=89 =E4=B8=8B=E5=8D=886:53=E5=86=99=E9=81=93=EF=BC=9A > Hi > > On Mon, Feb 22, 2021 at 09:28:18PM +0800, Kevin Tang wrote: > > Adds drm support for the Unisoc's display subsystem. > > > > This is drm kms driver, this driver provides support for the > > application framework in Android, Yocto and more. > > > > Application framework can access Unisoc's display internel > > ^ internal > > > peripherals through libdrm or libkms, it's test ok by modetest > > (DRM/KMS test tool) and Android HWComposer. > > > > Cc: Orson Zhai > > Cc: Chunyan Zhang > > Signed-off-by: Kevin Tang > > > > v4: > > - Move the devm_drm_dev_alloc to master_ops->bind function. > > - The managed drmm_mode_config_init() it is no longer necessary for > drivers to explicitly call drm_mode_config_cleanup, so delete it. > > --- > > drivers/gpu/drm/Kconfig | 2 + > > drivers/gpu/drm/Makefile | 1 + > > drivers/gpu/drm/sprd/Kconfig | 12 ++ > > drivers/gpu/drm/sprd/Makefile | 5 + > > drivers/gpu/drm/sprd/sprd_drm.c | 217 ++++++++++++++++++++++++++++++++ > > drivers/gpu/drm/sprd/sprd_drm.h | 16 +++ > > 6 files changed, 253 insertions(+) > > create mode 100644 drivers/gpu/drm/sprd/Kconfig > > create mode 100644 drivers/gpu/drm/sprd/Makefile > > create mode 100644 drivers/gpu/drm/sprd/sprd_drm.c > > create mode 100644 drivers/gpu/drm/sprd/sprd_drm.h > > > > diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig > > index 8bf103de1..9d6ce2867 100644 > > --- a/drivers/gpu/drm/Kconfig > > +++ b/drivers/gpu/drm/Kconfig > > @@ -382,6 +382,8 @@ source "drivers/gpu/drm/tidss/Kconfig" > > > > source "drivers/gpu/drm/xlnx/Kconfig" > > > > +source "drivers/gpu/drm/sprd/Kconfig" > > + > > # Keep legacy drivers last > > > > menuconfig DRM_LEGACY > > diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile > > index 02c229392..42d211d9c 100644 > > --- a/drivers/gpu/drm/Makefile > > +++ b/drivers/gpu/drm/Makefile > > @@ -126,3 +126,4 @@ obj-$(CONFIG_DRM_ASPEED_GFX) +=3D aspeed/ > > obj-$(CONFIG_DRM_MCDE) +=3D mcde/ > > obj-$(CONFIG_DRM_TIDSS) +=3D tidss/ > > obj-y +=3D xlnx/ > > +obj-$(CONFIG_DRM_SPRD) +=3D sprd/ > > diff --git a/drivers/gpu/drm/sprd/Kconfig b/drivers/gpu/drm/sprd/Kconfi= g > > new file mode 100644 > > index 000000000..6e80cc9f3 > > --- /dev/null > > +++ b/drivers/gpu/drm/sprd/Kconfig > > @@ -0,0 +1,12 @@ > > +config DRM_SPRD > > + tristate "DRM Support for Unisoc SoCs Platform" > > + depends on ARCH_SPRD || COMPILE_TEST > > + depends on DRM && OF > > + select DRM_KMS_HELPER > > + select DRM_GEM_CMA_HELPER > > + select DRM_KMS_CMA_HELPER > > + select DRM_MIPI_DSI > > I guess this should rather be moved to your DSI introduction patch? > Thks, it's will be fixed on patch v5. > > > + help > > + Choose this option if you have a Unisoc chipset. > > + If M is selected the module will be called sprd_drm. > > + > > diff --git a/drivers/gpu/drm/sprd/Makefile > b/drivers/gpu/drm/sprd/Makefile > > new file mode 100644 > > index 000000000..86d95d93a > > --- /dev/null > > +++ b/drivers/gpu/drm/sprd/Makefile > > @@ -0,0 +1,5 @@ > > +# SPDX-License-Identifier: GPL-2.0 > > + > > +subdir-ccflags-y +=3D -I$(srctree)/$(src) > > Is it really needed? I'm not seeing any header that aren't in the > include path already. > Thks, it's will be fixed on patch v5. > > > +obj-y :=3D sprd_drm.o > > diff --git a/drivers/gpu/drm/sprd/sprd_drm.c > b/drivers/gpu/drm/sprd/sprd_drm.c > > new file mode 100644 > > index 000000000..a1d3ed655 > > --- /dev/null > > +++ b/drivers/gpu/drm/sprd/sprd_drm.c > > @@ -0,0 +1,217 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > +/* > > + * Copyright (C) 2020 Unisoc Inc. > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#include "sprd_drm.h" > > + > > +#define DRIVER_NAME "sprd" > > +#define DRIVER_DESC "Spreadtrum SoCs' DRM Driver" > > +#define DRIVER_DATE "20200201" > > +#define DRIVER_MAJOR 1 > > +#define DRIVER_MINOR 0 > > + > > +static const struct drm_mode_config_helper_funcs > sprd_drm_mode_config_helper =3D { > > + .atomic_commit_tail =3D drm_atomic_helper_commit_tail_rpm, > > +}; > > + > > +static const struct drm_mode_config_funcs sprd_drm_mode_config_funcs = =3D { > > + .fb_create =3D drm_gem_fb_create, > > + .atomic_check =3D drm_atomic_helper_check, > > + .atomic_commit =3D drm_atomic_helper_commit, > > +}; > > + > > +static void sprd_drm_mode_config_init(struct drm_device *drm) > > +{ > > + drm->mode_config.min_width =3D 0; > > + drm->mode_config.min_height =3D 0; > > + drm->mode_config.max_width =3D 8192; > > + drm->mode_config.max_height =3D 8192; > > + drm->mode_config.allow_fb_modifiers =3D true; > > + > > + drm->mode_config.funcs =3D &sprd_drm_mode_config_funcs; > > + drm->mode_config.helper_private =3D &sprd_drm_mode_config_helper; > > +} > > + > > +DEFINE_DRM_GEM_CMA_FOPS(sprd_drm_fops); > > + > > +static struct drm_driver sprd_drm_drv =3D { > > + .driver_features =3D DRIVER_GEM | DRIVER_MODESET | > DRIVER_ATOMIC, > > + .fops =3D &sprd_drm_fops, > > + > > + /* GEM Operations */ > > + DRM_GEM_CMA_DRIVER_OPS, > > + > > + .name =3D DRIVER_NAME, > > + .desc =3D DRIVER_DESC, > > + .date =3D DRIVER_DATE, > > + .major =3D DRIVER_MAJOR, > > + .minor =3D DRIVER_MINOR, > > +}; > > + > > +static int sprd_drm_bind(struct device *dev) > > +{ > > + struct platform_device *pdev =3D to_platform_device(dev); > > + struct drm_device *drm; > > + struct sprd_drm *sprd; > > + int ret; > > + > > + sprd =3D devm_drm_dev_alloc(dev, &sprd_drm_drv, struct sprd_drm, > drm); > > + if (IS_ERR(sprd)) > > + return PTR_ERR(sprd); > > + > > + drm =3D &sprd->drm; > > + platform_set_drvdata(pdev, drm); > > + > > + ret =3D drmm_mode_config_init(drm); > > + if (ret) > > + return ret; > > + > > + sprd_drm_mode_config_init(drm); > > + > > + /* bind and init sub drivers */ > > + ret =3D component_bind_all(drm->dev, drm); > > + if (ret) { > > + drm_err(drm, "failed to bind all component.\n"); > > + return ret; > > + } > > + > > + /* vblank init */ > > + ret =3D drm_vblank_init(drm, drm->mode_config.num_crtc); > > + if (ret) { > > + drm_err(drm, "failed to initialize vblank.\n"); > > + goto err_unbind_all; > > + } > > + /* with irq_enabled =3D true, we can use the vblank feature. */ > > + drm->irq_enabled =3D true; > > + > > + /* reset all the states of crtc/plane/encoder/connector */ > > + drm_mode_config_reset(drm); > > + > > + /* init kms poll for handling hpd */ > > + drm_kms_helper_poll_init(drm); > > + > > + ret =3D drm_dev_register(drm, 0); > > + if (ret < 0) > > + goto err_kms_helper_poll_fini; > > + > > + return 0; > > + > > +err_kms_helper_poll_fini: > > + drm_kms_helper_poll_fini(drm); > > +err_unbind_all: > > + component_unbind_all(drm->dev, drm); > > + return ret; > > +} > > + > > +static void sprd_drm_unbind(struct device *dev) > > +{ > > + struct drm_device *drm =3D dev_get_drvdata(dev); > > + > > + drm_dev_unregister(drm); > > + > > + drm_kms_helper_poll_fini(drm); > > + > > + component_unbind_all(drm->dev, drm); > > +} > > + > > +static const struct component_master_ops drm_component_ops =3D { > > + .bind =3D sprd_drm_bind, > > + .unbind =3D sprd_drm_unbind, > > +}; > > + > > +static int compare_of(struct device *dev, void *data) > > +{ > > + return dev->of_node =3D=3D data; > > +} > > + > > +static int sprd_drm_probe(struct platform_device *pdev) > > +{ > > + struct device *dev =3D &pdev->dev; > > + int ret; > > + > > + ret =3D dma_set_mask_and_coherent(dev, ~0UL); > > + if (ret) { > > + dev_err(dev, "dma_set_mask_and_coherent failed (%d)\n", > ret); > > + return ret; > > + } > > It's not really clear to me what it's here for. Could you explain with a > comment here? > Thks, it's will be fixed on patch v5. > > Thanks > Maxime > --0000000000009cf6a705bed1a08c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
Maxime Ripard <maxime@cerno.tech&g= t; =E4=BA=8E2021=E5=B9=B43=E6=9C=8824=E6=97=A5=E5=91=A8=E4=B8=89 =E4=B8=8B= =E5=8D=886:53=E5=86=99=E9=81=93=EF=BC=9A
Hi

On Mon, Feb 22, 2021 at 09:28:18PM +0800, Kevin Tang wrote:
> Adds drm support for the Unisoc's display subsystem.
>
> This is drm kms driver, this driver provides support for the
> application framework in Android, Yocto and more.
>
> Application framework can access Unisoc's display internel

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^ internal

> peripherals through libdrm or libkms, it's test ok by modetest
> (DRM/KMS test tool) and Android HWComposer.
>
> Cc: Orson Zhai <orsonzhai@gmail.com>
> Cc: Chunyan Zhang <zhang.lyra@gmail.com>
> Signed-off-by: Kevin Tang <kevin.tang@unisoc.com>
>
> v4:
>=C2=A0 =C2=A0- Move the devm_drm_dev_alloc to master_ops->bind funct= ion.
>=C2=A0 =C2=A0- The managed drmm_mode_config_init() it is no longer nece= ssary for drivers to explicitly call drm_mode_config_cleanup, so delete it.=
> ---
>=C2=A0 drivers/gpu/drm/Kconfig=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0= =C2=A02 +
>=C2=A0 drivers/gpu/drm/Makefile=C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2= =A01 +
>=C2=A0 drivers/gpu/drm/sprd/Kconfig=C2=A0 =C2=A0 |=C2=A0 12 ++
>=C2=A0 drivers/gpu/drm/sprd/Makefile=C2=A0 =C2=A0|=C2=A0 =C2=A05 +
>=C2=A0 drivers/gpu/drm/sprd/sprd_drm.c | 217 ++++++++++++++++++++++++++= ++++++
>=C2=A0 drivers/gpu/drm/sprd/sprd_drm.h |=C2=A0 16 +++
>=C2=A0 6 files changed, 253 insertions(+)
>=C2=A0 create mode 100644 drivers/gpu/drm/sprd/Kconfig
>=C2=A0 create mode 100644 drivers/gpu/drm/sprd/Makefile
>=C2=A0 create mode 100644 drivers/gpu/drm/sprd/sprd_drm.c
>=C2=A0 create mode 100644 drivers/gpu/drm/sprd/sprd_drm.h
>
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 8bf103de1..9d6ce2867 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -382,6 +382,8 @@ source "drivers/gpu/drm/tidss/Kconfig" >=C2=A0
>=C2=A0 source "drivers/gpu/drm/xlnx/Kconfig"
>=C2=A0
> +source "drivers/gpu/drm/sprd/Kconfig"
> +
>=C2=A0 # Keep legacy drivers last
>=C2=A0
>=C2=A0 menuconfig DRM_LEGACY
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index 02c229392..42d211d9c 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -126,3 +126,4 @@ obj-$(CONFIG_DRM_ASPEED_GFX) +=3D aspeed/
>=C2=A0 obj-$(CONFIG_DRM_MCDE) +=3D mcde/
>=C2=A0 obj-$(CONFIG_DRM_TIDSS) +=3D tidss/
>=C2=A0 obj-y=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 +=3D xlnx/
> +obj-$(CONFIG_DRM_SPRD) +=3D sprd/
> diff --git a/drivers/gpu/drm/sprd/Kconfig b/drivers/gpu/drm/sprd/Kconf= ig
> new file mode 100644
> index 000000000..6e80cc9f3
> --- /dev/null
> +++ b/drivers/gpu/drm/sprd/Kconfig
> @@ -0,0 +1,12 @@
> +config DRM_SPRD
> +=C2=A0 =C2=A0 =C2=A0tristate "DRM Support for Unisoc SoCs Platfo= rm"
> +=C2=A0 =C2=A0 =C2=A0depends on ARCH_SPRD || COMPILE_TEST
> +=C2=A0 =C2=A0 =C2=A0depends on DRM && OF
> +=C2=A0 =C2=A0 =C2=A0select DRM_KMS_HELPER
> +=C2=A0 =C2=A0 =C2=A0select DRM_GEM_CMA_HELPER
> +=C2=A0 =C2=A0 =C2=A0select DRM_KMS_CMA_HELPER
> +=C2=A0 =C2=A0 =C2=A0select DRM_MIPI_DSI

I guess this should rather be moved to your DSI introduction patch?
Thks, it's will be fixed on patch v5.=C2=A0

> +=C2=A0 =C2=A0 =C2=A0help
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0Choose this option if you have a Unisoc ch= ipset.
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0If M is selected the module will be called= sprd_drm.
> +
> diff --git a/drivers/gpu/drm/sprd/Makefile b/drivers/gpu/drm/sprd/Make= file
> new file mode 100644
> index 000000000..86d95d93a
> --- /dev/null
> +++ b/drivers/gpu/drm/sprd/Makefile
> @@ -0,0 +1,5 @@
> +# SPDX-License-Identifier: GPL-2.0
> +
> +subdir-ccflags-y +=3D -I$(srctree)/$(src)

Is it really needed? I'm not seeing any header that aren't in the include path already.
Thks, it's will be fixed on patch v5.=C2=A0 =C2=A0

> +obj-y :=3D sprd_drm.o
> diff --git a/drivers/gpu/drm/sprd/sprd_drm.c b/drivers/gpu/drm/sprd/sp= rd_drm.c
> new file mode 100644
> index 000000000..a1d3ed655
> --- /dev/null
> +++ b/drivers/gpu/drm/sprd/sprd_drm.c
> @@ -0,0 +1,217 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (C) 2020 Unisoc Inc.
> + */
> +
> +#include <linux/component.h>
> +#include <linux/dma-mapping.h>
> +#include <linux/module.h>
> +#include <linux/mutex.h>
> +#include <linux/of_graph.h>
> +#include <linux/of_platform.h>
> +
> +#include <drm/drm_atomic_helper.h>
> +#include <drm/drm_crtc_helper.h>
> +#include <drm/drm_drv.h>
> +#include <drm/drm_gem_cma_helper.h>
> +#include <drm/drm_gem_framebuffer_helper.h>
> +#include <drm/drm_of.h>
> +#include <drm/drm_probe_helper.h>
> +#include <drm/drm_vblank.h>
> +
> +#include "sprd_drm.h"
> +
> +#define DRIVER_NAME=C2=A0 "sprd"
> +#define DRIVER_DESC=C2=A0 "Spreadtrum SoCs' DRM Driver"=
> +#define DRIVER_DATE=C2=A0 "20200201"
> +#define DRIVER_MAJOR 1
> +#define DRIVER_MINOR 0
> +
> +static const struct drm_mode_config_helper_funcs sprd_drm_mode_config= _helper =3D {
> +=C2=A0 =C2=A0 =C2=A0.atomic_commit_tail =3D drm_atomic_helper_commit_= tail_rpm,
> +};
> +
> +static const struct drm_mode_config_funcs sprd_drm_mode_config_funcs = =3D {
> +=C2=A0 =C2=A0 =C2=A0.fb_create =3D drm_gem_fb_create,
> +=C2=A0 =C2=A0 =C2=A0.atomic_check =3D drm_atomic_helper_check,
> +=C2=A0 =C2=A0 =C2=A0.atomic_commit =3D drm_atomic_helper_commit,
> +};
> +
> +static void sprd_drm_mode_config_init(struct drm_device *drm)
> +{
> +=C2=A0 =C2=A0 =C2=A0drm->mode_config.min_width =3D 0;
> +=C2=A0 =C2=A0 =C2=A0drm->mode_config.min_height =3D 0;
> +=C2=A0 =C2=A0 =C2=A0drm->mode_config.max_width =3D 8192;
> +=C2=A0 =C2=A0 =C2=A0drm->mode_config.max_height =3D 8192;
> +=C2=A0 =C2=A0 =C2=A0drm->mode_config.allow_fb_modifiers =3D true;<= br> > +
> +=C2=A0 =C2=A0 =C2=A0drm->mode_config.funcs =3D &sprd_drm_mode_= config_funcs;
> +=C2=A0 =C2=A0 =C2=A0drm->mode_config.helper_private =3D &sprd_= drm_mode_config_helper;
> +}
> +
> +DEFINE_DRM_GEM_CMA_FOPS(sprd_drm_fops);
> +
> +static struct drm_driver sprd_drm_drv =3D {
> +=C2=A0 =C2=A0 =C2=A0.driver_features=C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D D= RIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> +=C2=A0 =C2=A0 =C2=A0.fops=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D &sprd_drm_fops,
> +
> +=C2=A0 =C2=A0 =C2=A0/* GEM Operations */
> +=C2=A0 =C2=A0 =C2=A0DRM_GEM_CMA_DRIVER_OPS,
> +
> +=C2=A0 =C2=A0 =C2=A0.name=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D DRIVER_NAME,
> +=C2=A0 =C2=A0 =C2=A0.desc=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D DRIVER_DESC,
> +=C2=A0 =C2=A0 =C2=A0.date=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D DRIVER_DATE,
> +=C2=A0 =C2=A0 =C2=A0.major=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =3D DRIVER_MAJOR,
> +=C2=A0 =C2=A0 =C2=A0.minor=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =3D DRIVER_MINOR,
> +};
> +
> +static int sprd_drm_bind(struct device *dev)
> +{
> +=C2=A0 =C2=A0 =C2=A0struct platform_device *pdev =3D to_platform_devi= ce(dev);
> +=C2=A0 =C2=A0 =C2=A0struct drm_device *drm;
> +=C2=A0 =C2=A0 =C2=A0struct sprd_drm *sprd;
> +=C2=A0 =C2=A0 =C2=A0int ret;
> +
> +=C2=A0 =C2=A0 =C2=A0sprd =3D devm_drm_dev_alloc(dev, &sprd_drm_dr= v, struct sprd_drm, drm);
> +=C2=A0 =C2=A0 =C2=A0if (IS_ERR(sprd))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return PTR_ERR(sprd);=
> +
> +=C2=A0 =C2=A0 =C2=A0drm =3D &sprd->drm;
> +=C2=A0 =C2=A0 =C2=A0platform_set_drvdata(pdev, drm);
> +
> +=C2=A0 =C2=A0 =C2=A0ret =3D drmm_mode_config_init(drm);
> +=C2=A0 =C2=A0 =C2=A0if (ret)
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return ret;
> +
> +=C2=A0 =C2=A0 =C2=A0sprd_drm_mode_config_init(drm);
> +
> +=C2=A0 =C2=A0 =C2=A0/* bind and init sub drivers */
> +=C2=A0 =C2=A0 =C2=A0ret =3D component_bind_all(drm->dev, drm);
> +=C2=A0 =C2=A0 =C2=A0if (ret) {
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0drm_err(drm, "fa= iled to bind all component.\n");
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return ret;
> +=C2=A0 =C2=A0 =C2=A0}
> +
> +=C2=A0 =C2=A0 =C2=A0/* vblank init */
> +=C2=A0 =C2=A0 =C2=A0ret =3D drm_vblank_init(drm, drm->mode_config.= num_crtc);
> +=C2=A0 =C2=A0 =C2=A0if (ret) {
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0drm_err(drm, "fa= iled to initialize vblank.\n");
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto err_unbind_all;<= br> > +=C2=A0 =C2=A0 =C2=A0}
> +=C2=A0 =C2=A0 =C2=A0/* with irq_enabled =3D true, we can use the vbla= nk feature. */
> +=C2=A0 =C2=A0 =C2=A0drm->irq_enabled =3D true;
> +
> +=C2=A0 =C2=A0 =C2=A0/* reset all the states of crtc/plane/encoder/con= nector */
> +=C2=A0 =C2=A0 =C2=A0drm_mode_config_reset(drm);
> +
> +=C2=A0 =C2=A0 =C2=A0/* init kms poll for handling hpd */
> +=C2=A0 =C2=A0 =C2=A0drm_kms_helper_poll_init(drm);
> +
> +=C2=A0 =C2=A0 =C2=A0ret =3D drm_dev_register(drm, 0);
> +=C2=A0 =C2=A0 =C2=A0if (ret < 0)
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto err_kms_helper_p= oll_fini;
> +
> +=C2=A0 =C2=A0 =C2=A0return 0;
> +
> +err_kms_helper_poll_fini:
> +=C2=A0 =C2=A0 =C2=A0drm_kms_helper_poll_fini(drm);
> +err_unbind_all:
> +=C2=A0 =C2=A0 =C2=A0component_unbind_all(drm->dev, drm);
> +=C2=A0 =C2=A0 =C2=A0return ret;
> +}
> +
> +static void sprd_drm_unbind(struct device *dev)
> +{
> +=C2=A0 =C2=A0 =C2=A0struct drm_device *drm =3D dev_get_drvdata(dev);<= br> > +
> +=C2=A0 =C2=A0 =C2=A0drm_dev_unregister(drm);
> +
> +=C2=A0 =C2=A0 =C2=A0drm_kms_helper_poll_fini(drm);
> +
> +=C2=A0 =C2=A0 =C2=A0component_unbind_all(drm->dev, drm);
> +}
> +
> +static const struct component_master_ops drm_component_ops =3D {
> +=C2=A0 =C2=A0 =C2=A0.bind =3D sprd_drm_bind,
> +=C2=A0 =C2=A0 =C2=A0.unbind =3D sprd_drm_unbind,
> +};
> +
> +static int compare_of(struct device *dev, void *data)
> +{
> +=C2=A0 =C2=A0 =C2=A0return dev->of_node =3D=3D data;
> +}
> +
> +static int sprd_drm_probe(struct platform_device *pdev)
> +{
> +=C2=A0 =C2=A0 =C2=A0struct device *dev =3D &pdev->dev;
> +=C2=A0 =C2=A0 =C2=A0int ret;
> +
> +=C2=A0 =C2=A0 =C2=A0ret =3D dma_set_mask_and_coherent(dev, ~0UL);
> +=C2=A0 =C2=A0 =C2=A0if (ret) {
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dev_err(dev, "dm= a_set_mask_and_coherent failed (%d)\n", ret);
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return ret;
> +=C2=A0 =C2=A0 =C2=A0}

It's not really clear to me what it's here for. Could you explain w= ith a
comment here?
Thks, it's will be fixed on patch v5.=C2=A0 =C2=A0 =C2=A0

Thanks
Maxime
--0000000000009cf6a705bed1a08c-- --===============1705757445== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel --===============1705757445==--