Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4531539ybp; Mon, 7 Oct 2019 09:48:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqyMud9548c31sf/By/4wUFEm9CkiNLNS/JmiKS2AI4SRNJFawecR/Nr7axaj8faMsq2uKWw X-Received: by 2002:a17:906:57ce:: with SMTP id u14mr25187010ejr.184.1570466881418; Mon, 07 Oct 2019 09:48:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570466881; cv=none; d=google.com; s=arc-20160816; b=sthr7wsHh1IJrFzlbkIufO/499GEfjdmrYNg1K5MrVmpAQPe+xXqZWGG3/JmLFgK3D tx/pLSd0YZTTeQ8co1FTYRnUrokVuCXir0AOeBN+SsDQ1rE08PrMfJl4hawNXFs4UL3I yEdz4FAQgN+aqO2O0dK7PCGNNzBdPGODu+xVjtfHXYT7P93ptBQ7CRRmURQz6g9z8sJO 8vHmGSOegBGwTYGSOy4hkicWqpL7A2XeCDmnbiOFj5YvtLRYxwvo+oKhJT8TwoQgTrWQ 4whcHnBzKvLJoknwnw193SWf7lfDRjDtyTDkK3QOjEEHpD8p/eMMoPIDeZkUC/QcJhem 1+cg== 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:message-id:subject:cc :to:from:date:dkim-signature; bh=mS7sB/58XsSxkboHmbK13TsSVS2ybGG0SGJkhPLzIRA=; b=GbCe9W9qppyFpnO9FDbQeqSwX6nLqUY919OJyDWfIm3q9n8a6IAiVtF0NNjp4LiIBd S21yGoDtmREYEOg0ETIUtYejlK+D2LPmkfjDVPjzugguqVHKnMcM01PUblZSfOHB3pNy TGiHFHRhVh361Hz76X5iNBKTrG+x9I6WzsVq9Kx+5jnuMt5yvTQdhgl5Tj3KD75kCU2L qkTBqZ2gJst8eNVZL7YLe7TJGZyBTUXAARM5RjNmS4I72vj3MCHwM9sMBZG2qUxk1XqZ Mlsz9y6JgFyhZ40lZVopjNlneE0tw15J/zXPKWodGIVd546dWOFsPyjERrZ1FAUxJsyA CJHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@poorly.run header.s=google header.b=FJqwZjxV; 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 j23si2149405ejb.115.2019.10.07.09.47.37; Mon, 07 Oct 2019 09:48:01 -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=@poorly.run header.s=google header.b=FJqwZjxV; 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 S1729059AbfJGQoq (ORCPT + 99 others); Mon, 7 Oct 2019 12:44:46 -0400 Received: from mail-yb1-f195.google.com ([209.85.219.195]:41530 "EHLO mail-yb1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728019AbfJGQoo (ORCPT ); Mon, 7 Oct 2019 12:44:44 -0400 Received: by mail-yb1-f195.google.com with SMTP id 206so4885840ybc.8 for ; Mon, 07 Oct 2019 09:44:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=mS7sB/58XsSxkboHmbK13TsSVS2ybGG0SGJkhPLzIRA=; b=FJqwZjxVOe6UsLTNkV6cNOcVkQDkC4KclLXXo4pRQPaTooIORzEaZBlqgEJeBPOOD3 IJQUhOl2gpWpgG1j1CKSDYGLzeqAVgiFW2TicYYsu+Q1pQl+4rWLpGMHSz+gmo8/sdef 4xi+IBkorshJTxmB9ad2V6X1MF6kmcgw7GD5sR4YoOZv9/m5a1pYaTFZgtIn+WkJUzB6 9LJed7khMsczg24yP8Qh6TOa8wiJN2M8PC9lyanJtYECU2f8MvPAwAe983h359YDoDZ3 K2zL4QAkwA3zmBcxhurUBINhBfwbLvkPULM+XvXvbImd6H3qCjdwP8yYXR+0QdCI9Zw/ gWKw== 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=mS7sB/58XsSxkboHmbK13TsSVS2ybGG0SGJkhPLzIRA=; b=eIs1RTYSgv5T/Uddw5q5YKBRKYy+Z2pd2DoQlzqDHJFJ1/kryYhhCOgQkr8S9cSRId ShHCsPXKCS4ft7iY/SoqqQl1hmQQyUFBQz7FfEicK32r07IhaNQNm2Xc9Jq7CWpQWGis e1/ZgFU69M7s+PRoEURNWt6Ggj4TOI0TqTayW35ohpfAZx20eTDFIrwXTk3zN1hhPnCV otJWYzCMppncZzogbvzahWXztA9CuJmh/EV+ktmGCZkZ0KKNMv3lO34lLznmcNoWulgG dBPOUj1LckwrVapR84zsadILLbtrs3cdd03oLRc6uPeLKrLFrF7d6gnLRl+OT/TznQ9h IL1Q== X-Gm-Message-State: APjAAAWNg+1ZuTNbgCsZ3HCmIvga+ePe2tZvIGFARxWHykYoh9BneKy2 7wsgHsjcacCV/nOuzR5O++nzyQ== X-Received: by 2002:a25:8107:: with SMTP id o7mr11026920ybk.292.1570466682206; Mon, 07 Oct 2019 09:44:42 -0700 (PDT) Received: from localhost ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id p204sm4078445ywp.110.2019.10.07.09.44.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2019 09:44:41 -0700 (PDT) Date: Mon, 7 Oct 2019 12:44:41 -0400 From: Sean Paul To: "dbasehore ." Cc: "james qian wang (Arm Technology China)" , "linux-kernel@vger.kernel.org" , Maxime Ripard , Sam Ravnborg , "intel-gfx@lists.freedesktop.org" , David Airlie , Thierry Reding , Matthias Brugger , "dri-devel@lists.freedesktop.org" , Rodrigo Vivi , "linux-mediatek@lists.infradead.org" , Sean Paul , "linux-arm-kernel@lists.infradead.org" , nd Subject: Re: [v8,2/4] drm/panel: set display info in panel attach Message-ID: <20191007164441.GB126146@art_vandelay> References: <20190925225833.7310-3-dbasehore@chromium.org> <20190929052307.GA28304@jamwan02-TSP300> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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, Sep 30, 2019 at 04:14:54PM -0700, dbasehore . wrote: > On Sat, Sep 28, 2019 at 10:23 PM james qian wang (Arm Technology > China) wrote: > > > > On Wed, Sep 25, 2019 at 03:58:31PM -0700, Derek Basehore wrote: > > > Devicetree systems can set panel orientation via a panel binding, but > > > there's no way, as is, to propagate this setting to the connector, > > > where the property need to be added. > > > To address this, this patch sets orientation, as well as other fixed > > > values for the panel, in the drm_panel_attach function. These values > > > are stored from probe in the drm_panel struct. > > > > > > Signed-off-by: Derek Basehore > > > Reviewed-by: Sam Ravnborg > > > --- > > > drivers/gpu/drm/drm_panel.c | 28 +++++++++++++++++++++ > > > include/drm/drm_panel.h | 50 +++++++++++++++++++++++++++++++++++++ > > > 2 files changed, 78 insertions(+) > > > > > > diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c > > > index 0909b53b74e6..1cd2b56c9fe6 100644 > > > --- a/drivers/gpu/drm/drm_panel.c > > > +++ b/drivers/gpu/drm/drm_panel.c > > > @@ -104,11 +104,23 @@ EXPORT_SYMBOL(drm_panel_remove); > > > */ > > > int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector) > > > { > > > + struct drm_display_info *info; > > > + > > > if (panel->connector) > > > return -EBUSY; > > > > > > panel->connector = connector; > > > panel->drm = connector->dev; > > > + info = &connector->display_info; > > > + info->width_mm = panel->width_mm; > > > + info->height_mm = panel->height_mm; > > > + info->bpc = panel->bpc; > > > + info->panel_orientation = panel->orientation; > > > + info->bus_flags = panel->bus_flags; > > > + if (panel->bus_formats) > > > + drm_display_info_set_bus_formats(&connector->display_info, > > > + panel->bus_formats, > > > + panel->num_bus_formats); > > > > > > return 0; > > > } > > > @@ -126,6 +138,22 @@ EXPORT_SYMBOL(drm_panel_attach); > > > */ > > > void drm_panel_detach(struct drm_panel *panel) > > > { > > > + struct drm_display_info *info; > > > + > > > + if (!panel->connector) > > > + goto out; > > > + > > > + info = &panel->connector->display_info; > > > + info->width_mm = 0; > > > + info->height_mm = 0; > > > + info->bpc = 0; > > > + info->panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN; > > > + info->bus_flags = 0; > > > + kfree(info->bus_formats); > > > + info->bus_formats = NULL; > > > + info->num_bus_formats = 0; > > > + > > > +out: > > > panel->connector = NULL; > > > panel->drm = NULL; > > > } > > > diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h > > > index d16158deacdc..f3587a54b8ac 100644 > > > --- a/include/drm/drm_panel.h > > > +++ b/include/drm/drm_panel.h > > > @@ -141,6 +141,56 @@ struct drm_panel { > > > */ > > > const struct drm_panel_funcs *funcs; > > > > > > > All these new added members seems dupliated with drm_display_info, > > So I think, can we add a new drm_plane_funcs func: > > > > int (*set_display_info)(struct drm_panel *panel, > > struct drm_display_info *info); > > I don't disagree personally, since I originally wrote it this way, but > 2 maintainers, Daniel Vetter and Thierry Reding, requested that it be > changed. Unless that decision is reversed, I won't be changing this. > Reading back the feedback on v1, I don't think anyone said they were against storing a drm_display_info struct in drm_panel (no one really weighed in on it one way or another). IMO duplicating a bunch of fields feels pretty icky. I think most fields in drm_display_info have pretty reasonable defaults, so I'd recommend just storing a copy in drm_panel. As Thierry suggests, we can populate the dt parts in probe (orientation) and then copy over all or a subset of the struct to connector on attach. Sean > > > > Then in drm_panel_attach(), via this interface the specific panel > > driver can directly set connector->display_info. like > > > > ... > > if (panel->funcs && panel->funcs->set_display_info) > > panel->funcs->unprepare(panel, connector->display_info); > > ... > > > > Thanks > > James > > > > > + /** > > > + * @width_mm: > > > + * > > > + * Physical width in mm. > > > + */ > > > + unsigned int width_mm; > > > + > > > + /** > > > + * @height_mm: > > > + * > > > + * Physical height in mm. > > > + */ > > > + unsigned int height_mm; > > > + > > > + /** > > > + * @bpc: > > > + * > > > + * Maximum bits per color channel. Used by HDMI and DP outputs. > > > + */ > > > + unsigned int bpc; > > > + > > > + /** > > > + * @orientation > > > + * > > > + * Installation orientation of the panel with respect to the chassis. > > > + */ > > > + int orientation; > > > + > > > + /** > > > + * @bus_formats > > > + * > > > + * Pixel data format on the wire. > > > + */ > > > + const u32 *bus_formats; > > > + > > > + /** > > > + * @num_bus_formats: > > > + * > > > + * Number of elements pointed to by @bus_formats > > > + */ > > > + unsigned int num_bus_formats; > > > + > > > + /** > > > + * @bus_flags: > > > + * > > > + * Additional information (like pixel signal polarity) for the pixel > > > + * data on the bus. > > > + */ > > > + u32 bus_flags; > > > + > > > /** > > > * @list: > > > * > > Thanks for the review -- Sean Paul, Software Engineer, Google / Chromium OS