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=-13.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 A025FC433F5 for ; Sun, 5 Sep 2021 18:42:30 +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 EA9BF60F5B for ; Sun, 5 Sep 2021 18:42:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EA9BF60F5B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3282689A0E; Sun, 5 Sep 2021 18:42:28 +0000 (UTC) Received: from mx2.smtp.larsendata.com (mx2.smtp.larsendata.com [91.221.196.228]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0E657899E9 for ; Sun, 5 Sep 2021 18:42:25 +0000 (UTC) Received: from mail01.mxhotel.dk (mail01.mxhotel.dk [91.221.196.236]) by mx2.smtp.larsendata.com (Halon) with ESMTPS id f9fb6ef3-0e78-11ec-9416-0050568cd888; Sun, 05 Sep 2021 18:42:09 +0000 (UTC) Received: from ravnborg.org (80-162-45-141-cable.dk.customer.tdc.net [80.162.45.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: sam@ravnborg.org) by mail01.mxhotel.dk (Postfix) with ESMTPSA id 261DF194B9C; Sun, 5 Sep 2021 20:42:12 +0200 (CEST) Date: Sun, 5 Sep 2021 20:42:19 +0200 X-Report-Abuse-To: abuse@mxhotel.dk From: Sam Ravnborg To: Douglas Anderson Cc: Thierry Reding , Rob Herring , Maarten Lankhorst , linux-arm-msm@vger.kernel.org, Bjorn Andersson , Linus W , Daniel Vetter , devicetree@vger.kernel.org, Steev Klimaszewski , Thomas Zimmermann , Maxime Ripard , David Airlie , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 05/16] drm/panel-simple-edp: Split eDP panels out of panel-simple Message-ID: References: <20210901201934.1084250-1-dianders@chromium.org> <20210901131531.v3.5.I0a2f75bb822d17ce06f5b147734764eeb0c3e3df@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210901131531.v3.5.I0a2f75bb822d17ce06f5b147734764eeb0c3e3df@changeid> 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi Douglas, On Wed, Sep 01, 2021 at 01:19:23PM -0700, Douglas Anderson wrote: > The panel-simple driver handles way too much. Let's start trying to > get a handle on it by splitting out the eDP panels. This patch does > this: > > 1. Start by copying simple-panel verbatim over to a new driver, > simple-panel-edp. > 2. Rename "panel_simple" to "panel_edp" in the new driver. > 3. Keep only panels marked with `DRM_MODE_CONNECTOR_eDP` in the new > driver. Remove those panels from the old driver. > 4. Remove all recent "DP AUX bus" stuff from the old driver. The DP > AUX bus is only possible on DP panels. > 5. Remove all DSI / MIPI related functions from the new driver. > 6. Remove bus_format / bus_flags from eDP driver. These things don't > seem to make any sense for eDP panels so let's stop filling in made > up stuff. > > In the end we end up with a bunch of duplicated code for now. Future > patches will try to address _some_ of this duplicated code though some > of it will be unavoidable. > > NOTE: This may not actually move all eDP panels over to the new driver > since not all panels were properly marked with > `DRM_MODE_CONNECTOR_eDP`. A future patch will attempt to move wayward > panels I could identify but even so there may be some missed. > > Suggested-by: Sam Ravnborg > Signed-off-by: Douglas Anderson > --- > I believe this is what Sam was looking for when he requested that the > eDP panels split out [1]. Please yell if not. I will yell a big thanks! This was exactly what I hoped to see. And very nice to have panel-simple complexity reduced. The code duplication is worth it. To avoid confusion I would prefer the file named panel-edp.c, as this is not "simple" panels and it then matches the compatible. A few nits in the following. Sam > > [1] https://lore.kernel.org/dri-devel/YRTsFNTn%2FT8fLxyB@ravnborg.org/ > > Changes in v3: > - Split eDP panels patch new for v3. > > drivers/gpu/drm/panel/Kconfig | 16 +- > drivers/gpu/drm/panel/Makefile | 1 + > drivers/gpu/drm/panel/panel-simple-edp.c | 1298 ++++++++++++++++++++++ > drivers/gpu/drm/panel/panel-simple.c | 575 +--------- > 4 files changed, 1323 insertions(+), 567 deletions(-) > create mode 100644 drivers/gpu/drm/panel/panel-simple-edp.c > > diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig > index 0b3784941312..4b7ff4ebdc34 100644 > --- a/drivers/gpu/drm/panel/Kconfig > +++ b/drivers/gpu/drm/panel/Kconfig > @@ -77,14 +77,26 @@ config DRM_PANEL_LVDS > backlight handling if the panel is attached to a backlight controller. > > config DRM_PANEL_SIMPLE > - tristate "support for simple panels" > + tristate "support for simple panels (other than eDP ones)" > + depends on OF > + depends on BACKLIGHT_CLASS_DEVICE > + depends on PM > + select VIDEOMODE_HELPERS > + help > + DRM panel driver for dumb non-eDP panels that need at most a regulator > + and a GPIO to be powered up. Optionally a backlight can be attached so > + that it can be automatically turned off when the panel goes into a > + low power state. > + > +config DRM_PANEL_SIMPLE_EDP So this should also be named DRM_PANEL_EDP to follow the name of the driver. > + tristate "support for simple Embedded DisplayPort panels" > depends on OF > depends on BACKLIGHT_CLASS_DEVICE > depends on PM > select VIDEOMODE_HELPERS > select DRM_DP_AUX_BUS > help > - DRM panel driver for dumb panels that need at most a regulator and > + DRM panel driver for dumb eDP panels that need at most a regulator and > a GPIO to be powered up. Optionally a backlight can be attached so > that it can be automatically turned off when the panel goes into a > low power state. > diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile > index 60c0149fc54a..640234d4d693 100644 > --- a/drivers/gpu/drm/panel/Makefile > +++ b/drivers/gpu/drm/panel/Makefile > @@ -7,6 +7,7 @@ obj-$(CONFIG_DRM_PANEL_BOE_TV101WUM_NL6) += panel-boe-tv101wum-nl6.o > obj-$(CONFIG_DRM_PANEL_DSI_CM) += panel-dsi-cm.o > obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o > obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o > +obj-$(CONFIG_DRM_PANEL_SIMPLE_EDP) += panel-simple-edp.o > obj-$(CONFIG_DRM_PANEL_ELIDA_KD35T133) += panel-elida-kd35t133.o > obj-$(CONFIG_DRM_PANEL_FEIXIN_K101_IM2BA02) += panel-feixin-k101-im2ba02.o > obj-$(CONFIG_DRM_PANEL_FEIYANG_FY07024DI26A30D) += panel-feiyang-fy07024di26a30d.o > diff --git a/drivers/gpu/drm/panel/panel-simple-edp.c b/drivers/gpu/drm/panel/panel-simple-edp.c > new file mode 100644 > index 000000000000..5b47ee4bc338 > --- /dev/null > +++ b/drivers/gpu/drm/panel/panel-simple-edp.c > @@ -0,0 +1,1298 @@ > +/* > + * Copyright (C) 2013, NVIDIA Corporation. All rights reserved. > + * > + * Permission is hereby granted, free of charge, to any person obtaining a > + * copy of this software and associated documentation files (the "Software"), > + * to deal in the Software without restriction, including without limitation > + * the rights to use, copy, modify, merge, publish, distribute, sub license, > + * and/or sell copies of the Software, and to permit persons to whom the > + * Software is furnished to do so, subject to the following conditions: > + * > + * The above copyright notice and this permission notice (including the > + * next paragraph) shall be included in all copies or substantial portions > + * of the Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER > + * DEALINGS IN THE SOFTWARE. > + */ Would be nice if you could use the SPDX thingy for the license. > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include