Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5762110ybp; Tue, 8 Oct 2019 07:57:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKy8EoXz8HjlZ+WCZRpYOoNX81Tu87dArcWfMC/ApubPegSJAs+/dRoDAAHQY231iYQKUz X-Received: by 2002:a50:9eac:: with SMTP id a41mr15057535edf.193.1570546657290; Tue, 08 Oct 2019 07:57:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570546657; cv=none; d=google.com; s=arc-20160816; b=ZCoNt7QalLlBcsEBWeTpZWE9PIPpLCGzjgTZ/TAANNQAZI7kTYJRIQX0cgbkhIv+yu jNVm7C5NCRwae5IvAMbS+/5rS81UXksm2KHA3ZA4FpTOv/J4fWYR0s2fVcuGEVoVoGwz jReHLorbrPhumS8KTvFCz9IS6PHFghARqMyzfZMszSBWvfnbA/e6MJQDrWMomFtWGSQM cU7P2Iu3GldYLvZxmqYfCNTCw/L6IyZQ4eC7+BxiDCr59spe57o/4A1cClMwWiBhuGTl SaF//WuUYdkXk7yEWFGgDd4G1rqSnXTamj8grqi9GCSm88clDUrXjqYNw9gH+GqISFP6 DkaQ== 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=sTRvcWuhsCDYM9nbsR+iqmjU/q191FPit5GKXH0WNCw=; b=X4m7XOO2SQvscFmpdO3ae7UGlShUEVnd1TPvw1GGh5L6niFdoTPsDM8b8eafzIJy8W CvuMPQj0kegr9qlabCnkajwphNelmFEekm7uGjoCWoJNXxqqR2I1gAaW/BV0+TQTJNfo BtidYtGfDacOjgfhCYfq799rt4XELTQ41Cxr5VM1peFDPr8e1q3stSnHeEvpLDrLl8EL /KpQPKsvEZt9XKNb9kzl24oQCJ0OeyE2oH8qwl5Pyy7hBw3yrDacKTg61M7wx6GZri/I WLieowC9VN+kS5J0bk/2Evs+Fm/f0lFquIweOoq4/FQPAbL+4MkXC7IKtLdTyfHYMtIJ 0dMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@poorly.run header.s=google header.b=KMSNlY73; 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 w30si10722427edd.137.2019.10.08.07.57.13; Tue, 08 Oct 2019 07:57:37 -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=KMSNlY73; 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 S1727372AbfJHO40 (ORCPT + 99 others); Tue, 8 Oct 2019 10:56:26 -0400 Received: from mail-yb1-f193.google.com ([209.85.219.193]:38494 "EHLO mail-yb1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726057AbfJHO40 (ORCPT ); Tue, 8 Oct 2019 10:56:26 -0400 Received: by mail-yb1-f193.google.com with SMTP id r68so78958ybf.5 for ; Tue, 08 Oct 2019 07:56:25 -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=sTRvcWuhsCDYM9nbsR+iqmjU/q191FPit5GKXH0WNCw=; b=KMSNlY73MWApM2LnJJ05n+pDdlTTB791f5huU/c6JQNIdCTYwu5MkPWBrSvcjOfwaJ RsIQQZmSbuw4lnEfKSiahEq5i1zzbr8exb3K+yZvrB88/MRZRDwfJE0uEVH86Nn9JU+g ucOEsnRc6GOLykNYKeJodJazifzD5v45OoQMGMMsy24WgeIvktRE9HHPLT+THzUJ0U56 +O4i5niWNKzssNdcq0RQ/stQZ1Kg7JjqBeuRW5WjnD35EjEFcTyXJv9nbrvKfwqwnV7d u39UXN1UxhENUBpLUdibXVnm0FSA6IKRNt5ICPRuzTXP2yeWSg/vxwUvhUshH2yMywal 4VHQ== 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=sTRvcWuhsCDYM9nbsR+iqmjU/q191FPit5GKXH0WNCw=; b=f3e40UoAGgFUC0ozkUPasV77FMLQGxZwpUZVFx0dBmgwAu6D9hlzg6E6QONq46/4vL nn3Z59r1X17OxU9ubopWEENgNNTMuf1Lk+23nZJ1lMFNu4gEQq13pAUhXZ/XiyCXqwn7 /VYW+h8iF8cLvbJaK0KVLilwDsUtQ1TN8ra+UFCHrmjxcaD4BZUDnGJAlvxBPZrKB7F+ DuU6Y3N3S8U+xMx60hx4y0UV7uZcbDZ2H5VyS9SbZkqgxq88OwDmAWmYi8CZ0uJKuZFC oQasAX69o4SSqbx1SEvNmxcO01xfXsRcyh+1keThsPPD/qHqq2papZFE65MkN6wCT89y JG1A== X-Gm-Message-State: APjAAAUKzDpA3tLjpFX0ned8mutShh8Z7cWWlqwyXDy+mm26oq+yTm2e xWRvpcC6UxHnujapFFNkgWspYA== X-Received: by 2002:a25:df87:: with SMTP id w129mr15524540ybg.121.1570546584814; Tue, 08 Oct 2019 07:56:24 -0700 (PDT) Received: from localhost ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id v15sm4644853ywa.39.2019.10.08.07.56.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2019 07:56:24 -0700 (PDT) Date: Tue, 8 Oct 2019 10:56:23 -0400 From: Sean Paul To: "dbasehore ." Cc: Sean Paul , linux-kernel , Maarten Lankhorst , Maxime Ripard , David Airlie , Daniel Vetter , Thierry Reding , Sam Ravnborg , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , CK Hu , Philipp Zabel , Matthias Brugger , dri-devel , Intel Graphics , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , "moderated list:ARM/Mediatek SoC support" Subject: Re: [PATCH v8 1/4] drm/panel: Add helper for reading DT rotation Message-ID: <20191008145623.GA85762@art_vandelay> References: <20190925225833.7310-1-dbasehore@chromium.org> <20190925225833.7310-2-dbasehore@chromium.org> <20191007163822.GA126146@art_vandelay> 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, Oct 07, 2019 at 03:12:00PM -0700, dbasehore . wrote: > On Mon, Oct 7, 2019 at 9:38 AM Sean Paul wrote: > > > > On Wed, Sep 25, 2019 at 03:58:30PM -0700, Derek Basehore wrote: > > > This adds a helper function for reading the rotation (panel > > > orientation) from the device tree. > > > > > > Signed-off-by: Derek Basehore > > > Reviewed-by: Sam Ravnborg > > > > The patch LGTM, but I don't see it used anywhere later in the patch? Is there a > > panel driver incoming? > > Yeah, the boe-tv101wum-nl6 panel will use it. It's not in the patch > currently sent upstream since I don't want to step on their toes, but > I plan on sending a patch to add it as soon as that is merged. > > I could hold back on this patch until that panel driver is merged too. Yeah, I think it's probably best. I don't anticipate any changes will be required, but it's always best to review the code end-to-end. I haven't checked in on that review, but if it's close to landing, you can also add a patch to this stack that is based on the in-flight patches. That way we can get all the review out of the way and then when the panel lands, we can apply your add-on with the rest of the series. Sean > Another alternative is to throw this into the generic drm_panel code, > but there's no obvious place to put it since DRM seems to leave > reading the DTS up to the panel drivers themselves. > > > > > Sean > > > > > --- > > > drivers/gpu/drm/drm_panel.c | 43 +++++++++++++++++++++++++++++++++++++ > > > include/drm/drm_panel.h | 9 ++++++++ > > > 2 files changed, 52 insertions(+) > > > > > > diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c > > > index 6b0bf42039cf..0909b53b74e6 100644 > > > --- a/drivers/gpu/drm/drm_panel.c > > > +++ b/drivers/gpu/drm/drm_panel.c > > > @@ -264,6 +264,49 @@ struct drm_panel *of_drm_find_panel(const struct device_node *np) > > > return ERR_PTR(-EPROBE_DEFER); > > > } > > > EXPORT_SYMBOL(of_drm_find_panel); > > > + > > > +/** > > > + * of_drm_get_panel_orientation - look up the orientation of the panel through > > > + * the "rotation" binding from a device tree node > > > + * @np: device tree node of the panel > > > + * @orientation: orientation enum to be filled in > > > + * > > > + * Looks up the rotation of a panel in the device tree. The orientation of the > > > + * panel is expressed as a property name "rotation" in the device tree. The > > > + * rotation in the device tree is counter clockwise. > > > + * > > > + * Return: 0 when a valid rotation value (0, 90, 180, or 270) is read or the > > > + * rotation property doesn't exist. -EERROR otherwise. > > > + */ > > > +int of_drm_get_panel_orientation(const struct device_node *np, > > > + enum drm_panel_orientation *orientation) > > > +{ > > > + int rotation, ret; > > > + > > > + ret = of_property_read_u32(np, "rotation", &rotation); > > > + if (ret == -EINVAL) { > > > + /* Don't return an error if there's no rotation property. */ > > > + *orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN; > > > + return 0; > > > + } > > > + > > > + if (ret < 0) > > > + return ret; > > > + > > > + if (rotation == 0) > > > + *orientation = DRM_MODE_PANEL_ORIENTATION_NORMAL; > > > + else if (rotation == 90) > > > + *orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP; > > > + else if (rotation == 180) > > > + *orientation = DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP; > > > + else if (rotation == 270) > > > + *orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP; > > > + else > > > + return -EINVAL; > > > + > > > + return 0; > > > +} > > > +EXPORT_SYMBOL(of_drm_get_panel_orientation); > > > #endif > > > > > > MODULE_AUTHOR("Thierry Reding "); > > > diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h > > > index 624bd15ecfab..d16158deacdc 100644 > > > --- a/include/drm/drm_panel.h > > > +++ b/include/drm/drm_panel.h > > > @@ -34,6 +34,8 @@ struct drm_device; > > > struct drm_panel; > > > struct display_timing; > > > > > > +enum drm_panel_orientation; > > > + > > > /** > > > * struct drm_panel_funcs - perform operations on a given panel > > > * > > > @@ -165,11 +167,18 @@ int drm_panel_get_modes(struct drm_panel *panel); > > > > > > #if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL) > > > struct drm_panel *of_drm_find_panel(const struct device_node *np); > > > +int of_drm_get_panel_orientation(const struct device_node *np, > > > + enum drm_panel_orientation *orientation); > > > #else > > > static inline struct drm_panel *of_drm_find_panel(const struct device_node *np) > > > { > > > return ERR_PTR(-ENODEV); > > > } > > > +static inline int of_drm_get_panel_orientation(const struct device_node *np, > > > + enum drm_panel_orientation *orientation) > > > +{ > > > + return -ENODEV; > > > +} > > > #endif > > > > > > #endif > > > -- > > > 2.23.0.351.gc4317032e6-goog > > > > > > > -- > > Sean Paul, Software Engineer, Google / Chromium OS -- Sean Paul, Software Engineer, Google / Chromium OS