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=-3.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,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 286A1C2D0BF for ; Tue, 10 Dec 2019 16:08:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F33522077B for ; Tue, 10 Dec 2019 16:08:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LXhUHm6e" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727506AbfLJQIJ (ORCPT ); Tue, 10 Dec 2019 11:08:09 -0500 Received: from mail-vs1-f65.google.com ([209.85.217.65]:40049 "EHLO mail-vs1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727420AbfLJQIJ (ORCPT ); Tue, 10 Dec 2019 11:08:09 -0500 Received: by mail-vs1-f65.google.com with SMTP id g23so13429981vsr.7 for ; Tue, 10 Dec 2019 08:08:08 -0800 (PST) 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=Rd/M1jiw0bt7SsTtI3ZjdMOpbgNyyyrt/v3LP3zJjyA=; b=LXhUHm6ees0V0daVV3GQg9YAcoUDnJGJR5XPnfgQTLm7CmZ0Okb7xp1ztsvHD7ZbIv ExwTnZquC2H2l8T0Am5u0xrerj9gjBxgEcYku5ZL2brd0iY3ErVBqq3K7+tErHtH/n+8 YOxAcV64D4NP87dYnMko+2GcXDHaGESpDGDsyn15tyiyFgNyQt5jb2qvECazs3RC8ITr f8JhZe414FVdLb2sU00OqyPe+TM3vNpwgsBgDWzN43Lb1Bqj9gnqR0Xn+zEo5A/dhz4m V/l8DQJaaBTQFmnFWE0rZGFkeTbOdTky8VSpJKeF04+15zWxiJrNdxIlIQmFKeHieKm4 SrrA== 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=Rd/M1jiw0bt7SsTtI3ZjdMOpbgNyyyrt/v3LP3zJjyA=; b=lB3i3QdnCRPGJcT3IU1GpUWbingIe0OyXvrMedusOwjLZjuprNliLURxPRnQEPDTjA HZBYQz65ZzjFes53L+NTw1qRVprAyyewfX1TsGDjq65jcsIEIpZxOT63tRkTaz5a1kmw uAYM+6Dd5qDvZ706ujQGsWfEMsm6/sVfdMya0ZsjVqi2HmUyMbFOksk81rosUnIwyFHv S1dHb3NbrPbXJlHmFooHlGgbFaFvg/P/kytvZTmfdZ0jtG85plA/jEFhF0HbKA3+3oGz Rk70CECA3/TaCGKbfgNuD6HfuXD1Vas479CeIQIdFzdTKEh6198JNJrEbSGxAE3VL5M2 /mGw== X-Gm-Message-State: APjAAAUri22tnSfd2AnSW74CsSgyOZEW+F6XYe/blAYEAh0n6GsyXi+e wPnG59PTAFGPcTNao/7+dVlmk/QzvzPdnmCkfDA= X-Google-Smtp-Source: APXvYqzXUcVL7ay7dzMEdK34LEth1oxt2wC88iEyUDWeYkDCjpAhFxfaBz0vmF+f9wnrE9NhZohviL0n9DQi6jo5fz4= X-Received: by 2002:a67:e205:: with SMTP id g5mr16607588vsa.186.1575994087596; Tue, 10 Dec 2019 08:08:07 -0800 (PST) MIME-Version: 1.0 References: <1575966995-13757-1-git-send-email-kevin3.tang@gmail.com> <1575966995-13757-3-git-send-email-kevin3.tang@gmail.com> In-Reply-To: <1575966995-13757-3-git-send-email-kevin3.tang@gmail.com> From: Emil Velikov Date: Tue, 10 Dec 2019 16:06:53 +0000 Message-ID: Subject: Re: [PATCH RFC 2/8] drm/sprd: add Unisoc's drm kms master To: Kevin Tang Cc: David Airlie , Daniel Vetter , orsonzhai@gmail.com, ML dri-devel , "Linux-Kernel@Vger. Kernel. Org" , zhang.lyra@gmail.com, baolin.wang@linaro.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > 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 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=-3.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,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 D0BC6C43603 for ; Tue, 10 Dec 2019 16:08:10 +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 9E11C2077B for ; Tue, 10 Dec 2019 16:08:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LXhUHm6e" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9E11C2077B 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 E461F6E12A; Tue, 10 Dec 2019 16:08:09 +0000 (UTC) Received: from mail-vs1-xe43.google.com (mail-vs1-xe43.google.com [IPv6:2607:f8b0:4864:20::e43]) by gabe.freedesktop.org (Postfix) with ESMTPS id C4BED6E12A for ; Tue, 10 Dec 2019 16:08:08 +0000 (UTC) Received: by mail-vs1-xe43.google.com with SMTP id t12so13402054vso.13 for ; Tue, 10 Dec 2019 08:08:08 -0800 (PST) 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=Rd/M1jiw0bt7SsTtI3ZjdMOpbgNyyyrt/v3LP3zJjyA=; b=LXhUHm6ees0V0daVV3GQg9YAcoUDnJGJR5XPnfgQTLm7CmZ0Okb7xp1ztsvHD7ZbIv ExwTnZquC2H2l8T0Am5u0xrerj9gjBxgEcYku5ZL2brd0iY3ErVBqq3K7+tErHtH/n+8 YOxAcV64D4NP87dYnMko+2GcXDHaGESpDGDsyn15tyiyFgNyQt5jb2qvECazs3RC8ITr f8JhZe414FVdLb2sU00OqyPe+TM3vNpwgsBgDWzN43Lb1Bqj9gnqR0Xn+zEo5A/dhz4m V/l8DQJaaBTQFmnFWE0rZGFkeTbOdTky8VSpJKeF04+15zWxiJrNdxIlIQmFKeHieKm4 SrrA== 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=Rd/M1jiw0bt7SsTtI3ZjdMOpbgNyyyrt/v3LP3zJjyA=; b=S/CXoosMu1ZMNqY+EftvMSO3RpDGgMKGaTY4cw8jheIst+YKBm/dt16HECin4zy0gG q+7Q0KB6nyy/n+D+f5X+R+2vmSnltkZyUm28lrR9Kq+l3d8Tym0YoPKnBlW9VpZj4Crb YVVomV+tA8YiogaN99KYZbJF0utRDmU3/eWQTtS/11E1MUuazCZN/qQFFzBrGobkEWsH dpqaLufx7/OlfksXKYRnE+Mua2HlLr7vIU1B05nPEPSusupYZafq1XIWXrz+lztx+Q/J MR564+MDSjGsKP8F5om76P8vUZOpcGmwIH0KSEQaRfk7b6vfBx6srZY0DhzYnrs80fbN zz1A== X-Gm-Message-State: APjAAAVWx2vU10wBWkPALgEXphT7FVS/z4gGzl2fGx/x+Z5pPybt5Udr 1EgAqr7a7uEOS6xF6W1jH9U4Fnx3/XF6wEGDB0U= X-Google-Smtp-Source: APXvYqzXUcVL7ay7dzMEdK34LEth1oxt2wC88iEyUDWeYkDCjpAhFxfaBz0vmF+f9wnrE9NhZohviL0n9DQi6jo5fz4= X-Received: by 2002:a67:e205:: with SMTP id g5mr16607588vsa.186.1575994087596; Tue, 10 Dec 2019 08:08:07 -0800 (PST) MIME-Version: 1.0 References: <1575966995-13757-1-git-send-email-kevin3.tang@gmail.com> <1575966995-13757-3-git-send-email-kevin3.tang@gmail.com> In-Reply-To: <1575966995-13757-3-git-send-email-kevin3.tang@gmail.com> From: Emil Velikov Date: Tue, 10 Dec 2019 16:06:53 +0000 Message-ID: Subject: Re: [PATCH RFC 2/8] drm/sprd: add Unisoc's drm kms master To: Kevin Tang 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: baolin.wang@linaro.org, David Airlie , zhang.lyra@gmail.com, "Linux-Kernel@Vger. Kernel. Org" , ML dri-devel , orsonzhai@gmail.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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? > 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 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel