Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp7563150ybn; Mon, 30 Sep 2019 16:15:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqzVJyxPcC2+2ZCcR4htCzPQ8CWU7owyPl2cIA4hqDtFd+lJ4HMv9FTnKXxhvWFTJFd/pcUs X-Received: by 2002:a17:906:7245:: with SMTP id n5mr21588779ejk.173.1569885338596; Mon, 30 Sep 2019 16:15:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569885338; cv=none; d=google.com; s=arc-20160816; b=FIPCOitKRSy8CUmSYDAmKRL1Kd2duRfN8Uvgxe+mRCqHdrq6LjVg9fxCvT6ESsWW2e FkegOkWb3wkKPwuSHktbRRZHKSJpXI/o/LZMiyaD0R2utIkLkUgBea2gHXb//3lVpAeZ wap6FkJqqC/Vi6VxQCb0F00TVWad5GpTgPj6CTOD+NWaCm1VgJPE+dpccwivbp2w6mNY Pfc2NCD6pQjeJY4JuRizzZrZUsBeLHBxiN0RC4bbYJTBKb+x7x61igD2KP5dHBbmIl8K O7pxNrUXw5Ac6zND6NoNsMICW8QPb9HYeDdoMdAmGRJH/JNGf1fwX4A35rF1YgDGyH4h T86g== 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=ZvmsInxobmq4HhJGrTJAb1cqc8y4yno1C8lgAtF2gk8=; b=cbGICVKn99NQsOCt6WHfi0M9dS/+fijGOLK/NLdj8JpCIXRp3Ak0zTdLqeoes1B9Jq s2U1i2hF20GGO1dm5qZKxrJPyGTLDIfi2k6ZoZboh+Sgpn3Qa1QyzyYK0CvzB9iYS3w2 G66f0LNW+XMfApBE4PF5qnXW3oOcZGFzxE1Ue9dS5OgNB7oC/23p6p248Rfkl6LQY/DT 3oV5meOsf+Cv21SFA3ZlXMAkEjDy9CcFt1WR4gbUgubefxfT46tVuCinzwiIB3IAkXV+ 4zmAr0T4M1C8v4E018w7Ax1QX0OkeVuu3PJwmsvILt4etbTg2W00YdFGWPiStA1J7m+6 7ujA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ES9EqDtQ; 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 i24si4927492ejh.35.2019.09.30.16.15.12; Mon, 30 Sep 2019 16:15:38 -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=ES9EqDtQ; 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 S1729748AbfI3XPK (ORCPT + 99 others); Mon, 30 Sep 2019 19:15:10 -0400 Received: from mail-vs1-f67.google.com ([209.85.217.67]:34093 "EHLO mail-vs1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727118AbfI3XPJ (ORCPT ); Mon, 30 Sep 2019 19:15:09 -0400 Received: by mail-vs1-f67.google.com with SMTP id d3so8061451vsr.1 for ; Mon, 30 Sep 2019 16:15:07 -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=ZvmsInxobmq4HhJGrTJAb1cqc8y4yno1C8lgAtF2gk8=; b=ES9EqDtQiEYnjID3Hfnl05qt7DITnEPNp7lzr3XpwjKn9HNruwokeUM+q5wsTJllH1 Zaih+yOUuOG+fkotU5x9fMK9C8t1kLbiAWMyr5iDyFgF0XcV0iG0zWb6ZvdHooK1SP/e LhZbiWXJ1cgJg5ckEEeDaJIUGryJOBCjq3qlM= 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=ZvmsInxobmq4HhJGrTJAb1cqc8y4yno1C8lgAtF2gk8=; b=OtgbCub8LJT2JsUYtXwJ2gCeCqxUUG6QAtmRaKiLapbzYB39QmHBROgLGrtiQoV9q5 cxyXw7F/fXiMN6mPJrAQk1GjXEkh2/vAv9Otdw0ytpDfbMkR5iuWr5oc+bBuURW75YOX /LIsxT/B60jIxuAQjwU9lAxp1HsJHt78VTaQuU9vIPP9SdtzM4hPhQeZpCKG4OQofQd6 BYsMWnR7PEXFPaxbjADQPmR5zftrUeMvcV7/GcwInYEgLrg7DDTPNgqK7obBppswLIoC U8+S8EpYX2biazCFGhEYAEw9j7hA5IEo2pelNCPRDgc7nQ7oIoBrdj/5g5HshLhC3BwW b5hw== X-Gm-Message-State: APjAAAUKngzhxddtUMGjEWLqRj4XadSgtTBlqetZAnxZ1Y/eMafxYNfK jUW1n7mNTgAGEiWSYd4qx5gnEfH4tgFejC8HY2X4og== X-Received: by 2002:a05:6102:224b:: with SMTP id e11mr11010877vsb.232.1569885306079; Mon, 30 Sep 2019 16:15:06 -0700 (PDT) MIME-Version: 1.0 References: <20190925225833.7310-3-dbasehore@chromium.org> <20190929052307.GA28304@jamwan02-TSP300> In-Reply-To: <20190929052307.GA28304@jamwan02-TSP300> From: "dbasehore ." Date: Mon, 30 Sep 2019 16:14:54 -0700 Message-ID: Subject: Re: [v8,2/4] drm/panel: set display info in panel attach To: "james qian wang (Arm Technology China)" Cc: "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 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 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. > > 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