Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5327044ybi; Wed, 12 Jun 2019 00:16:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqzIpZXi2enlpmdAGNK/UgfaD8ElkeM6PDE0NA8tbtGvo5jilTvgW7Y/1qmDRuzatobjFrIS X-Received: by 2002:a05:6a00:6:: with SMTP id h6mr20586411pfk.237.1560323804050; Wed, 12 Jun 2019 00:16:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560323804; cv=none; d=google.com; s=arc-20160816; b=TCLP1V4nZiuOIUwXpyxvMxKd1KCWhKBbB5oXFHUiAaXROqoJZ6sN22R4y2bzX6GXTW ogoc1hfD3cmS1te1OwYGOSloQYvS+WsI9YpY1yNwlVklqo+SixLNqdyQYmNImiB7d49+ GErAMQk4H9sXvOEBGB05QF2binZr2AGWDwCy1WWG/WkiWyOrYaIjgoK6J/PSKx5HW4XG P4bR7LpeSCMyq/Lj8fBZEckgywdHQEzBR1ypJDYtjBYARhHc1shkPutGJjx09Z/DCSUq /pydQTChnhYTfMpBExh+10VovBpUmBcazRUHJ+YFbQaw+A3cWdHV6sQuD3w/kAeWcudz pzJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=KRAxkF68gmKecn3z+xJVKQmHHe3fhnjLkR6e2Rk4Xyw=; b=nuRc9q7EF7ZsVu3wbXTdVtT4jFxaHfOJK8xCJwLSD65rUNCY3leeDgdmpLJUpxwmIz pzrWvV+u+gebq6fEtwLqIpbxiQN3K0NKRX/dKbPu7tpXPXPtY3tvYfjHpaGQwg9G7+B3 vjpQ6yzDSZo65Px+nwvlw4jWcozEd704Vvg/D7hb1RQYMv1/8dGGSVMayabd5biYL7e7 PUtW9rpDmT8GdKObd229R6vafz5OvLr/pbcz8yAlprQeZaUN00OsqwqX+I5yVaPYOdkt V7RIJGd9dpQcXvGprWVWf/8InhSItqa2+Dx4tTnNAFCRCWZ2i7H4cXLSKEepfTvqXmNp OQoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=fJnj+nia; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w189si14599997pgw.205.2019.06.12.00.16.24; Wed, 12 Jun 2019 00:16:44 -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=pass header.i=@chromium.org header.s=google header.b=fJnj+nia; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407403AbfFLA0A (ORCPT + 99 others); Tue, 11 Jun 2019 20:26:00 -0400 Received: from mail-vs1-f66.google.com ([209.85.217.66]:34013 "EHLO mail-vs1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405491AbfFLAZ7 (ORCPT ); Tue, 11 Jun 2019 20:25:59 -0400 Received: by mail-vs1-f66.google.com with SMTP id q64so9159909vsd.1 for ; Tue, 11 Jun 2019 17:25:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=KRAxkF68gmKecn3z+xJVKQmHHe3fhnjLkR6e2Rk4Xyw=; b=fJnj+niayR1N1ZzWwcqhYntA6jPdSi35aIBMUPGQoq+fZuXbt6Wr6mmgcT8Li0DIbl mZ2rnLWVOMBADToUfCnXK8dduYeGZIhdvwAbBqOL/0VDH2EXhFYIC3SscfoxzwRtMruh aQxEGghx7B2GqXT7GjKG0V9vlxKyPvJG2ZRNA= 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=KRAxkF68gmKecn3z+xJVKQmHHe3fhnjLkR6e2Rk4Xyw=; b=EEOnVEIyGtG9F9Y3RrWON4LTEFxITilqmjVCIGZxUUiytDAlvOkrkhqpXHId9r3Mn2 6weUAWQcdh5lyFwRVMe3IROQLPu9VbOy3C0ZbXpJ2pU1r5lv/sK189xifDrA4FIhs7ow yHZSxz4q+TYNHl7xOpZv9MJvgisxSi0R93MzThKJfE0/33q2U/nnGI1jh81k22aBWzzm xPeGoTLi0ZBYUMKXfHmd8JU8/Ad2qZ/EO8f0MCQ96qUE6LFUUvsyeTo+DMsVtCA6mZCs YCTqpH135lIlD0yeoJ1Jh3TnhoZF3YO5/6NSl/nDUbvnVFJJwmU6mR0MB/9Uhb7hQPDK 4Jhw== X-Gm-Message-State: APjAAAWqEVSJJCXb5NB58mCg2XcDpUIDojf0N2Ylt5L5z/8B75kBcCw2 yzm5X57PAk5cnbLueGYEx8ScLFR1pUAmm0iaD6mmzw== X-Received: by 2002:a67:ea42:: with SMTP id r2mr31201742vso.207.1560299158074; Tue, 11 Jun 2019 17:25:58 -0700 (PDT) MIME-Version: 1.0 References: <20190611040350.90064-1-dbasehore@chromium.org> <20190611040350.90064-4-dbasehore@chromium.org> <20190611085722.GX21222@phenom.ffwll.local> In-Reply-To: <20190611085722.GX21222@phenom.ffwll.local> From: "dbasehore ." Date: Tue, 11 Jun 2019 17:25:47 -0700 Message-ID: Subject: Re: [PATCH 3/5] drm/panel: Add attach/detach callbacks To: Derek Basehore , linux-kernel , 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 , devicetree@vger.kernel.org, Intel Graphics , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , "moderated list:ARM/Mediatek SoC support" Cc: Daniel Vetter 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 On Tue, Jun 11, 2019 at 1:57 AM Daniel Vetter wrote: > > 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. So do you want all of this information added to the drm_panel struct? If we do that, we don't necessarily even need the drm helper function. We could just copy the values over here in the drm_panel_attach function (and clear them in drm_panel_detach). > -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