Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4523665ybp; Mon, 7 Oct 2019 09:40:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqwo7dmgtoQOfzXpFxs/jgW1EEkf4C2M854qkW8RNQLm+2iiObhkQuSmstGz+0L3/oe8sbnl X-Received: by 2002:a17:906:7802:: with SMTP id u2mr25136224ejm.3.1570466447789; Mon, 07 Oct 2019 09:40:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570466447; cv=none; d=google.com; s=arc-20160816; b=G/1mA8qxamh9hN8O5dolcSJjDxqXwr7zc/TUfv2vz7KDFUsDLFZIJiy6pJ8ob4Aipq 1Yq28QM3zH1jP3x8Y7fwsAhUVr/efTK3TWPgUl1gw3DBz7i6nOTIS83ba/ykFfkT8Dp3 4QlI5vIN36E5zi4YybYdU694ykV2MVh9wGpkWJUR4R9wPONr3ZtIOAsJoRaYYJRDrJv2 zTjI0aDDOvB0Y+DzVrVAWyOkFwcZe4CDiJdkO5sERkg6udfN9L9OewikRkWzzvCNIiAJ iAEuLu+sD5woqfbNVBg3FHXnggDhNk74p9havZUDhoMvQM66uRS7I+PkoF8TM7hM8bHQ 8rjw== 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=FzqVNr7tcxlwpcYADlhda0qZOie+lz7LOX/589zfMus=; b=bctCyU6A0P53jsjPcy0TqmslBnU4jOQPF0+IICl8qoFBxYaMQsTuiJUFtgNiftwsPp 2DK4SlaANmF3IcSdR7WR9Bed7NszQQdn/DCIbu3XJ9Au5e9+BrJIsomDTkxMx8LpXWmq 1ZfWb0b5I552wrCwsmCToubxEAuihbXEphvFPK9X0FaHxRYM7HwvFpRv5ZfWlGui/3wf HVSEMRZmJH1d3bFVU19L0d3tFUeI9+tAi43QE6svLFWyPhF6N/u7A3cc2Wk7tpwV556p 4J6mDwzhfIG0Z9XlY4NPSMw7ciCbroWOVD6GWXKbX3QELWSjLVT1wMLqxFxf3s6JbdGl YD3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@poorly.run header.s=google header.b=fxB9cPqg; 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 h19si8217865edv.393.2019.10.07.09.40.23; Mon, 07 Oct 2019 09:40:47 -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=fxB9cPqg; 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 S1728654AbfJGQiZ (ORCPT + 99 others); Mon, 7 Oct 2019 12:38:25 -0400 Received: from mail-yb1-f194.google.com ([209.85.219.194]:38678 "EHLO mail-yb1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727830AbfJGQiZ (ORCPT ); Mon, 7 Oct 2019 12:38:25 -0400 Received: by mail-yb1-f194.google.com with SMTP id k10so1689621ybs.5 for ; Mon, 07 Oct 2019 09:38:24 -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=FzqVNr7tcxlwpcYADlhda0qZOie+lz7LOX/589zfMus=; b=fxB9cPqg4HqUGdYDivJJPdLacJmb3vp4VEHC//Z5ObTlsNu+ii6NbHEEOfwrQeRYHX rk9Jb8c/1D5BKy/LV/oDJUA6MnC9WVmwmt3fSMpUNLRxWG7ZP3rRNW4/ClVWqlZbovZy As3Gj9d4k//dQ6J9KSx8hENX+9aQYBCkzmyixVJHF7sf7hj6lmE9pUqAM43YZOgedk1y eawFwM01quT63JTy3IF4txAahS6VVT4G3O1ZwheamhN+J4JnEqmVqpUwPmZxqwgvAOzM I7psY1x+jCMxZFFJuHBb0X2S9SPae9WZjlXUS1+DbdH7W4YHGmcjuUR0yuC9HHwjsVvw tZ8w== 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=FzqVNr7tcxlwpcYADlhda0qZOie+lz7LOX/589zfMus=; b=W9iOQQzIV4zc80zfX9ownULhNcVA6/ACfLt6JkewpEeYGhe13CL1pkHFVNZSUwwxTo r8HqstXH5/0rudOaTxTmVX8vlEM8qIhlAO0bkrr1kESdEwePOhSAm3r0KqnoogMiMUMC 2nCAJeX4SRf34hNTodsCcghrgw43W1k1J9W0wR0ltAHO6OSNb+ba49mOjGaqScRUyIb7 D8kKKE6PixFcYLCiVXE2ZXgw4AHVUi0hKxTwGK8raL+ghYpbx1Ts8oD3YzTfan+CHGrH fn+/Q7ruMVhwTmcSRpiYRhPLHMtKPVvV900IOuAZv4auBmlCrUHmy7BfIShcxfOoP+Gh 0QvA== X-Gm-Message-State: APjAAAXPtYOLlOQ1IbJ9Xqz/ydCgcO29Ce+u59MZQmaHkKimBpxDUwuZ 6mfTfx/F8ZbFbKPlyo2KcgXP4w== X-Received: by 2002:a25:bfc3:: with SMTP id q3mr4652388ybm.507.1570466303991; Mon, 07 Oct 2019 09:38:23 -0700 (PDT) Received: from localhost ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id g20sm3932702ywe.98.2019.10.07.09.38.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2019 09:38:23 -0700 (PDT) Date: Mon, 7 Oct 2019 12:38:22 -0400 From: Sean Paul To: Derek Basehore Cc: linux-kernel@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Thierry Reding , Sam Ravnborg , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , CK Hu , Philipp Zabel , Matthias Brugger , dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH v8 1/4] drm/panel: Add helper for reading DT rotation Message-ID: <20191007163822.GA126146@art_vandelay> References: <20190925225833.7310-1-dbasehore@chromium.org> <20190925225833.7310-2-dbasehore@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190925225833.7310-2-dbasehore@chromium.org> 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 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? 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