Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5936527ybl; Tue, 10 Dec 2019 14:04:51 -0800 (PST) X-Google-Smtp-Source: APXvYqy7i1reTAl0O/aerWCi3cbEMjTsNRpywBW5fRxLc12cDU5C3m9jlG4unNeetTqE4aSA++Ay X-Received: by 2002:aca:6186:: with SMTP id v128mr208894oib.17.1576015491001; Tue, 10 Dec 2019 14:04:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576015490; cv=none; d=google.com; s=arc-20160816; b=gvsod+pwphvHUZ6vHQrzUkz15PiHPH0ui6rnjYJXU2ZIf/N63gh8puk3hPMgl4BgGj 73Jiwj0NgBO91JrWbYzY3qzlhA/i8LKbZJKjQc01pkhDc5S2IOR5ucJg/qVQ5kQTRBha gruM1RsU0SQ8hs5LboAyPWmum2lpQScO+pfdb5Qfj0fMbOUO+eD549TsZaxksiBIdcfI LTuI5uSIQsLDVsFgusPNnHrE1pIiBriJWDq3EL1z2fORn5ynmoTunZJQSho8g1ibAVK7 4eX7z2vMtEf+wf7rLPvk14wYWcNCNhTXBWPm6KX38w1TvvanIxiBljJ8fWC0fNacL9RU JVFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=IdEgSF+/YKX111RPx3g26t6v4N0KcK/Dzr46XVnsmo8=; b=SfVZO1RwpsMR0s43GoaZZYRpN52mOcKKRAX7fIjkLFBhF0bkMOFhWmuCBu0wPXzJ3w Ux2JTbR8ta/aOk66wzIGlEMGemUUDynznd0/CAHKHL9luGJMjzLAE5on3km1JVm1lzGi IKy2rT9euaSyBVsr5oIknM5Q2jkxJKOcMnObWpnYPGLr5UJhYJw/mTg5BfB+A2JjDl7W pkR+9a1ZjK9Cz2seVU9ANUJyt5BJT36nqN+5Xntm7bFzQOUrobv+9+nCFtzSt65+guja aJPg90b/rK7qXMuRhTQLCcOFUd77uPc94WNi5wwz73S/8UfQo4ShnIjGp9WGQe2qJilp l4kA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=I2lgJAKz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z14si2707006oth.15.2019.12.10.14.04.31; Tue, 10 Dec 2019 14:04:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=I2lgJAKz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726949AbfLJWBj (ORCPT + 99 others); Tue, 10 Dec 2019 17:01:39 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:55779 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726362AbfLJWBj (ORCPT ); Tue, 10 Dec 2019 17:01:39 -0500 Received: by mail-wm1-f66.google.com with SMTP id q9so4889865wmj.5 for ; Tue, 10 Dec 2019 14:01:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=IdEgSF+/YKX111RPx3g26t6v4N0KcK/Dzr46XVnsmo8=; b=I2lgJAKzPmhuhNR5qnb+D+kfWQWwm3GyPv7nBqZQsLKz3OVTr/Vp2dkC8snQMtsgof oXwwUq4/fkGXQ7stdHlmy3Pzh+/qORuqEDYWDi9Q1/K3tgtirUKK91KMtP1YVg7jn0x6 6gO8Haoq52TACeS7xbE34SeMyc4zwBYDLGpnI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=IdEgSF+/YKX111RPx3g26t6v4N0KcK/Dzr46XVnsmo8=; b=tjRHeOQbvMrkVXWthI8aUFqM8dYiTrRk0I02LtWdoIFP8eYYNOgdcRcJ57/7bhuckd BUQSHS4ExVKLp6BzgdOeXZh9xnJ421oucK8qIqQomwN2M6TzA5CPxB1WhaPD2qVIcr7S o/ENXKJVDv/obvgM3GSDElSPvr6aiMHM4D1MTRri7zL78a5ruuq7u7wGVPMIPExrDsfP HP0/ugUaGH3EXhrXfqMgY+daeAAbP3qALUqWiAW/TaOC0MgLWW4d85qSe2Js/3Dx31cv 21FSweq4v5QBbktgYBo2mT+zNnwYns1Bj+UbyZlEnzIrm0Xrte7f76WHY+DX8l/dq45s zERA== X-Gm-Message-State: APjAAAWBmmgi59uEz4QTupixH8eMhgRmM0Q8AcIuSKzkNalx+K2RciVz hU9t4/AapD0OyB9mvwZNOVO68w== X-Received: by 2002:a7b:c19a:: with SMTP id y26mr7569408wmi.152.1576015296369; Tue, 10 Dec 2019 14:01:36 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:564b:0:7567:bb67:3d7f:f863]) by smtp.gmail.com with ESMTPSA id k19sm4412552wmi.42.2019.12.10.14.01.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2019 14:01:35 -0800 (PST) Date: Tue, 10 Dec 2019 23:01:33 +0100 From: Daniel Vetter To: Emil Velikov Cc: Kevin Tang , David Airlie , Daniel Vetter , orsonzhai@gmail.com, ML dri-devel , "Linux-Kernel@Vger. Kernel. Org" , zhang.lyra@gmail.com, baolin.wang@linaro.org Subject: Re: [PATCH RFC 2/8] drm/sprd: add Unisoc's drm kms master Message-ID: <20191210220133.GV624164@phenom.ffwll.local> Mail-Followup-To: Emil Velikov , Kevin Tang , David Airlie , orsonzhai@gmail.com, ML dri-devel , "Linux-Kernel@Vger. Kernel. Org" , zhang.lyra@gmail.com, baolin.wang@linaro.org References: <1575966995-13757-1-git-send-email-kevin3.tang@gmail.com> <1575966995-13757-3-git-send-email-kevin3.tang@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux phenom 5.3.0-2-amd64 User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 10, 2019 at 04:06:53PM +0000, Emil Velikov wrote: > Welcome to DRM Kevin, > > On Tue, 10 Dec 2019 at 08:40, Kevin Tang wrote: > > > > From: Kevin Tang > > > > Adds drm support for the Unisoc's display subsystem. > > > > This is drm device and gem driver. This driver provides support for the > > Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. > > > Did you use XFree86 or Xorg to test this? The XFree86 codebase have been > missing for years. > > Out of curiosity - did you try any Wayland, or bare-metal compositor? Just noticed that the driver also seems to be missing fbdev emulation. Given that that is a one-line (for a proper driver using all the right helpers) it should be added. See drm_fbdev_generic_setup(). -Daniel > > > source "drivers/gpu/drm/mcde/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 9f1c7c4..85ca211 100644 > > --- a/drivers/gpu/drm/Makefile > > +++ b/drivers/gpu/drm/Makefile > > @@ -122,3 +122,4 @@ obj-$(CONFIG_DRM_LIMA) += lima/ > > obj-$(CONFIG_DRM_PANFROST) += panfrost/ > > obj-$(CONFIG_DRM_ASPEED_GFX) += aspeed/ > > obj-$(CONFIG_DRM_MCDE) += mcde/ > > +obj-$(CONFIG_DRM_SPRD) += sprd/ > > diff --git a/drivers/gpu/drm/sprd/Kconfig b/drivers/gpu/drm/sprd/Kconfig > > new file mode 100644 > > index 0000000..79f286b > > --- /dev/null > > +++ b/drivers/gpu/drm/sprd/Kconfig > > @@ -0,0 +1,14 @@ > > +config DRM_SPRD > > + tristate "DRM Support for Unisoc SoCs Platform" > > + depends on ARCH_SPRD > > + depends on DRM && OF > > + select DRM_KMS_HELPER > > + select DRM_GEM_CMA_HELPER > > + select DRM_KMS_CMA_HELPER > > + select DRM_MIPI_DSI > > + select DRM_PANEL > > + select VIDEOMODE_HELPERS > > + select BACKLIGHT_CLASS_DEVICE > > + help > > + Choose this option if you have a Unisoc chipsets. > s/chipsets/chipset/ ? > > > > --- /dev/null > > +++ b/drivers/gpu/drm/sprd/Makefile > > @@ -0,0 +1,8 @@ > > +# SPDX-License-Identifier: GPL-2.0 > > + > > +ccflags-y += -Iinclude/drm > > + > > +subdir-ccflags-y += -I$(src) > > + > I think we can drop the includes here, unless there's a specific error > message that you're setting. > > > > --- /dev/null > > +++ b/drivers/gpu/drm/sprd/sprd_drm.c > > > +#define DRIVER_NAME "sprd" > > +#define DRIVER_DESC "Spreadtrum SoCs' DRM Driver" > > +#define DRIVER_DATE "20180501" > The date is mostly for cosmetic purposes. Yet we're nearly 2020 and > this reads 2018 - update? > > > > > +static struct drm_driver sprd_drm_drv = { > > + .driver_features = DRIVER_GEM | DRIVER_MODESET | > > + DRIVER_ATOMIC | DRIVER_HAVE_IRQ, > There is no modeset exposed by the driver, let alone an atomic one. > > Thus I would drop the following code from this patch and add it with a > patch that uses it. > - tokens - DRIVER_MODESET, DRIVER_ATOMIC) > - no-op modeset/atomic functions just above, and > - vblank/kms code (further down) in bind/unbind > > > > > > +static int sprd_drm_probe(struct platform_device *pdev) > > +{ > > + int ret; > > + > > + ret = dma_set_mask_and_coherent(&pdev->dev, ~0); > > + if (ret) > > + DRM_ERROR("dma_set_mask_and_coherent failed (%d)\n", ret); > > + > Is the hardware going to work correctly the dma call fails? Should we > use "return ret;" here? > > > + return sprd_drm_component_probe(&pdev->dev, &sprd_drm_component_ops); > > +} > > + > > +static int sprd_drm_remove(struct platform_device *pdev) > > +{ > > + component_master_del(&pdev->dev, &sprd_drm_component_ops); > > + return 0; > > +} > > + > > +static void sprd_drm_shutdown(struct platform_device *pdev) > > +{ > > + struct drm_device *drm = platform_get_drvdata(pdev); > > + > > + if (!drm) { > Can this happen in reality? > > > > > --- /dev/null > > +++ b/drivers/gpu/drm/sprd/sprd_drm.h > > @@ -0,0 +1,19 @@ > > +/* SPDX-License-Identifier: GPL-2.0 */ > > +/* > > + * Copyright (C) 2019 Unisoc Inc. > > + */ > > + > > +#ifndef _SPRD_DRM_H_ > > +#define _SPRD_DRM_H_ > > + > > +#include > > +#include > > + > > +struct sprd_drm { > > + struct drm_device *drm; > > > + struct drm_atomic_state *state; > > + struct device *dpu_dev; > > + struct device *gsp_dev; > These three are unused. Please add alongside the code which is using them. > > > > --- /dev/null > > +++ b/drivers/gpu/drm/sprd/sprd_gem.c > > As Thomas pointed out, this is effectively a copy of drm_gem_cma_helper.c > Please drop this file and use the respective CMA functions, instead. > > > > diff --git a/drivers/gpu/drm/sprd/sprd_gem.h b/drivers/gpu/drm/sprd/sprd_gem.h > > new file mode 100644 > > index 0000000..4c10d8a > > --- /dev/null > > +++ b/drivers/gpu/drm/sprd/sprd_gem.h > Just like the C file - this is effectively a copy of the existing CMA codebase. > > HTH > Emil -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch