Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4163231ybi; Tue, 11 Jun 2019 01:58:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwBoHnkzLT4BX25Yi5XR1hdV4tdb82L2NhLTxfLhr6lv98LPL+RDDBhADbfAEQX2AXh8Id X-Received: by 2002:aa7:8007:: with SMTP id j7mr14997881pfi.154.1560243516064; Tue, 11 Jun 2019 01:58:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560243516; cv=none; d=google.com; s=arc-20160816; b=HiN7YfgqYbh+V+26JX5SPl5JaFtvsG0H5yEllyHuWF4oT2chcBUH4rh2mEbhyBOw27 OmYcKQjs5K53i4aRgoQIKNPIdBBoykqVw/hhD8frDizKaGW0mddSghGz0LkGZWy57yWU OK3NFj5+QEOQe9p2GK40gRZjBmUsLTMVm8zLWLperA9/P1g9v05tTeSiQ22Xb102TliE E09rIsnl1+rw6Vhsi+OZoZmK2Z1sB5uuXCuSFw6LB9UHhqL09GfdK9HC5P+kAYbgEI3Q p7c6xiJM2OMq+zCDdaLzfrykMlhmU2yqqcTiM+0xZ0e8qHw0deyzkgZS7eJhRw16qDMi Hs3Q== 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=bTkOEfoVS8xqoBdJMHWo3E+Rkaj2bpqidMUiZcDnoAk=; b=HbYfAq941Aw4P7Z2iFJQP5YS3Jf9+AxtPQ0LohmpH/vql9yeHnBJzy1bcdxRCygx+a +3aUzOvWwooL2XuomI+T4SpcLWcaO7iR9avUGaZ8nDLA62HtfaDks+HRVceL80ypAusE GGlat7gMvXUTyGlZApGQkyAzhTFzOdVUURw0Z0T7KQgXL6chqgKdIUJufapTkm+Z71Dl tUb3ECBCRXy/4pL3PE/caXag26ro3xM5sK+b6xFicE3rUbz72S3UisVaLt7i1S36F7cA r9ZlcnIGNGwme0SK0lPJ/uDmNVzgbQOxVZ24Ew54n6NvbCSMkzzp7mxR+/RxxGnqgkNT AmLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=ZiTDkJRV; 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 k23si11913475pgm.556.2019.06.11.01.58.21; Tue, 11 Jun 2019 01:58:36 -0700 (PDT) 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=fail header.i=@ffwll.ch header.s=google header.b=ZiTDkJRV; 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 S2404816AbfFKI52 (ORCPT + 99 others); Tue, 11 Jun 2019 04:57:28 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:41271 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403860AbfFKI51 (ORCPT ); Tue, 11 Jun 2019 04:57:27 -0400 Received: by mail-ed1-f67.google.com with SMTP id p15so18863282eds.8 for ; Tue, 11 Jun 2019 01:57:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=bTkOEfoVS8xqoBdJMHWo3E+Rkaj2bpqidMUiZcDnoAk=; b=ZiTDkJRVzn+jc565v456AsNS1x9g3BjkYr7za4w5jSGUMvN0zRkNbwrjz+WKcjgJ7G nVEabfR7lwPxQPzOWNyhTaNeCZNmuZbiS/yoZmcFwLZx8+TklX/CEVM6W8dFxldKtroS fKKE1lLtvvPaX/DCq4LqhJjtJN0r4j+0DpEZc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=bTkOEfoVS8xqoBdJMHWo3E+Rkaj2bpqidMUiZcDnoAk=; b=D5Q93TUvX8FIbD7JzNd4JxmVTYLdIVZXWjefoWl5xw4tptx6ZNHoGiTAJcRHmslGS7 bgJ6sHdV0dholkYgYZIa0JPa1ll0fuNelmE9wMhJRBMfYmpDYqd69MUZFsfl3R8CJ19A G4dg62nSHIsT0muFrm8GqRXvfupobi1IIRkTiVmWNK5DBq/warOhcC/pL5WPKyEzzo2O sBiqrLz042qxuCrIn9odmN3jN/zeC+pcPR7RTgWWoIOHAWGdVa55PkTF70Fwxtz1SsIc 0jzqMDa39N4+NiofinKKw2tDtI9XasQL5YKe4Gupf2MZpmqHiAij86TMsuDMKUGYghi9 tiuw== X-Gm-Message-State: APjAAAU2qFI5gxL+fJ7Jep0o5sb7YlaVVmJ/h/2KlHPakSbopL9A33ll aenl2/0ozF2/vc5iMNszn/xf3w== X-Received: by 2002:a05:6402:8d7:: with SMTP id d23mr37696956edz.17.1560243445858; Tue, 11 Jun 2019 01:57:25 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id m3sm3498364edi.33.2019.06.11.01.57.24 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 11 Jun 2019 01:57:25 -0700 (PDT) Date: Tue, 11 Jun 2019 10:57:22 +0200 From: Daniel Vetter To: Derek Basehore Cc: linux-kernel@vger.kernel.org, Thierry Reding , Sam Ravnborg , David Airlie , Daniel Vetter , Rob Herring , Mark Rutland , Maarten Lankhorst , Maxime Ripard , Sean Paul , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , CK Hu , Philipp Zabel , Matthias Brugger , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, intel-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH 3/5] drm/panel: Add attach/detach callbacks Message-ID: <20190611085722.GX21222@phenom.ffwll.local> Mail-Followup-To: Derek Basehore , linux-kernel@vger.kernel.org, Thierry Reding , Sam Ravnborg , David Airlie , Rob Herring , Mark Rutland , Maarten Lankhorst , Maxime Ripard , Sean Paul , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , CK Hu , Philipp Zabel , Matthias Brugger , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, intel-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org References: <20190611040350.90064-1-dbasehore@chromium.org> <20190611040350.90064-4-dbasehore@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190611040350.90064-4-dbasehore@chromium.org> X-Operating-System: Linux phenom 4.14.0-3-amd64 User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 10, 2019 at 09:03:48PM -0700, Derek Basehore wrote: > This adds the attach/detach callbacks. These are for setting up > internal state for the connector/panel pair that can't be done at > probe (since the connector doesn't exist) and which don't need to be > repeatedly done for every get/modes, prepare, or enable callback. > Values such as the panel orientation, and display size can be filled > in for the connector. > > Signed-off-by: Derek Basehore > --- > drivers/gpu/drm/drm_panel.c | 14 ++++++++++++++ > include/drm/drm_panel.h | 4 ++++ > 2 files changed, 18 insertions(+) > > diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c > index 3b689ce4a51a..72f67678d9d5 100644 > --- a/drivers/gpu/drm/drm_panel.c > +++ b/drivers/gpu/drm/drm_panel.c > @@ -104,12 +104,23 @@ EXPORT_SYMBOL(drm_panel_remove); > */ > int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector) > { > + int ret; > + > if (panel->connector) > return -EBUSY; > > panel->connector = connector; > panel->drm = connector->dev; > > + if (panel->funcs->attach) { > + ret = panel->funcs->attach(panel); > + if (ret < 0) { > + panel->connector = NULL; > + panel->drm = NULL; > + return ret; > + } > + } Why can't we just implement this in the drm helpers for everyone, by e.g. storing a dt node in drm_panel? Feels a bit overkill to have these new hooks here. Also, my understanding is that this dt stuff is supposed to be standardized, so this should work. -Daniel > + > return 0; > } > EXPORT_SYMBOL(drm_panel_attach); > @@ -128,6 +139,9 @@ EXPORT_SYMBOL(drm_panel_attach); > */ > int drm_panel_detach(struct drm_panel *panel) > { > + if (panel->funcs->detach) > + panel->funcs->detach(panel); > + > panel->connector = NULL; > panel->drm = NULL; > > diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h > index 13631b2efbaa..e136e3a3c996 100644 > --- a/include/drm/drm_panel.h > +++ b/include/drm/drm_panel.h > @@ -37,6 +37,8 @@ struct display_timing; > * struct drm_panel_funcs - perform operations on a given panel > * @disable: disable panel (turn off back light, etc.) > * @unprepare: turn off panel > + * @detach: detach panel->connector (clear internal state, etc.) > + * @attach: attach panel->connector (update internal state, etc.) > * @prepare: turn on panel and perform set up > * @enable: enable panel (turn on back light, etc.) > * @get_modes: add modes to the connector that the panel is attached to and > @@ -70,6 +72,8 @@ struct display_timing; > struct drm_panel_funcs { > int (*disable)(struct drm_panel *panel); > int (*unprepare)(struct drm_panel *panel); > + void (*detach)(struct drm_panel *panel); > + int (*attach)(struct drm_panel *panel); > int (*prepare)(struct drm_panel *panel); > int (*enable)(struct drm_panel *panel); > int (*get_modes)(struct drm_panel *panel); > -- > 2.22.0.rc2.383.gf4fbbf30c2-goog > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch