From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FF02C38C09 for ; Mon, 24 Feb 2020 23:21:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 09E4D21556 for ; Mon, 24 Feb 2020 23:21:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728541AbgBXXVq (ORCPT ); Mon, 24 Feb 2020 18:21:46 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:60118 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728544AbgBXXVo (ORCPT ); Mon, 24 Feb 2020 18:21:44 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sre) with ESMTPSA id 61824293F4B Received: by earth.universe (Postfix, from userid 1000) id D35E23C0CBC; Tue, 25 Feb 2020 00:21:31 +0100 (CET) From: Sebastian Reichel To: Sebastian Reichel , Laurent Pinchart , Tomi Valkeinen Cc: Tony Lindgren , Merlijn Wajer , "H. Nikolaus Schaller" , Rob Herring , linux-omap@vger.kernel.org, dri-devel@lists.freedesktop.org, kernel@collabora.com, Sebastian Reichel Subject: [PATCHv2 55/56] drm/panel/panel-dsi-cm: support rotation property Date: Tue, 25 Feb 2020 00:21:25 +0100 Message-Id: <20200224232126.3385250-56-sebastian.reichel@collabora.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200224232126.3385250-1-sebastian.reichel@collabora.com> References: <20200224232126.3385250-1-sebastian.reichel@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Add support for the rotation property described by the common panel bindings. The information is forwarded to userspace using the orientation property. Signed-off-by: Sebastian Reichel --- drivers/gpu/drm/panel/panel-dsi-cm.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-dsi-cm.c b/drivers/gpu/drm/panel/panel-dsi-cm.c index fef9ba5319c2..b043ebb9c247 100644 --- a/drivers/gpu/drm/panel/panel-dsi-cm.c +++ b/drivers/gpu/drm/panel/panel-dsi-cm.c @@ -58,6 +58,7 @@ struct panel_drv_data { int width_mm; int height_mm; + enum drm_panel_orientation panel_orientation; /* runtime variables */ bool enabled; @@ -458,6 +459,7 @@ static int dsicm_get_modes(struct drm_panel *panel, connector->display_info.width_mm = ddata->width_mm; connector->display_info.height_mm = ddata->height_mm; + connector->display_info.panel_orientation = ddata->panel_orientation; drm_mode_probed_add(connector, mode); @@ -479,7 +481,7 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi) struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi); struct display_timing timing; struct videomode vm; - int err; + int err, rotation; vm.hactive = 864; vm.vactive = 480; @@ -509,6 +511,26 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi) ddata->height_mm = 0; of_property_read_u32(node, "height-mm", &ddata->height_mm); + rotation = -1; + of_property_read_u32(node, "rotation", &rotation); + switch (rotation) { + case 0: + ddata->panel_orientation = DRM_MODE_PANEL_ORIENTATION_NORMAL; + break; + case 90: + ddata->panel_orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP; + break; + case 180: + ddata->panel_orientation = DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP; + break; + case 270: + ddata->panel_orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP; + break; + default: + ddata->panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN; + break; + } + ddata->supplies[0].supply = "vpnl"; ddata->supplies[1].supply = "vddi"; err = devm_regulator_bulk_get(&dsi->dev, DCS_REGULATOR_SUPPLY_NUM, -- 2.25.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBC12C35DFE for ; Tue, 25 Feb 2020 08:52:10 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A7B242176D for ; Tue, 25 Feb 2020 08:52:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A7B242176D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7F6656EA43; Tue, 25 Feb 2020 08:51:13 +0000 (UTC) Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8D93C6E9C7 for ; Mon, 24 Feb 2020 23:21:44 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sre) with ESMTPSA id 61824293F4B Received: by earth.universe (Postfix, from userid 1000) id D35E23C0CBC; Tue, 25 Feb 2020 00:21:31 +0100 (CET) From: Sebastian Reichel To: Sebastian Reichel , Laurent Pinchart , Tomi Valkeinen Subject: [PATCHv2 55/56] drm/panel/panel-dsi-cm: support rotation property Date: Tue, 25 Feb 2020 00:21:25 +0100 Message-Id: <20200224232126.3385250-56-sebastian.reichel@collabora.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200224232126.3385250-1-sebastian.reichel@collabora.com> References: <20200224232126.3385250-1-sebastian.reichel@collabora.com> MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 25 Feb 2020 08:50:43 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel@collabora.com, Tony Lindgren , "H. Nikolaus Schaller" , Merlijn Wajer , Sebastian Reichel , dri-devel@lists.freedesktop.org, linux-omap@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add support for the rotation property described by the common panel bindings. The information is forwarded to userspace using the orientation property. Signed-off-by: Sebastian Reichel --- drivers/gpu/drm/panel/panel-dsi-cm.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-dsi-cm.c b/drivers/gpu/drm/panel/panel-dsi-cm.c index fef9ba5319c2..b043ebb9c247 100644 --- a/drivers/gpu/drm/panel/panel-dsi-cm.c +++ b/drivers/gpu/drm/panel/panel-dsi-cm.c @@ -58,6 +58,7 @@ struct panel_drv_data { int width_mm; int height_mm; + enum drm_panel_orientation panel_orientation; /* runtime variables */ bool enabled; @@ -458,6 +459,7 @@ static int dsicm_get_modes(struct drm_panel *panel, connector->display_info.width_mm = ddata->width_mm; connector->display_info.height_mm = ddata->height_mm; + connector->display_info.panel_orientation = ddata->panel_orientation; drm_mode_probed_add(connector, mode); @@ -479,7 +481,7 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi) struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi); struct display_timing timing; struct videomode vm; - int err; + int err, rotation; vm.hactive = 864; vm.vactive = 480; @@ -509,6 +511,26 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi) ddata->height_mm = 0; of_property_read_u32(node, "height-mm", &ddata->height_mm); + rotation = -1; + of_property_read_u32(node, "rotation", &rotation); + switch (rotation) { + case 0: + ddata->panel_orientation = DRM_MODE_PANEL_ORIENTATION_NORMAL; + break; + case 90: + ddata->panel_orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP; + break; + case 180: + ddata->panel_orientation = DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP; + break; + case 270: + ddata->panel_orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP; + break; + default: + ddata->panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN; + break; + } + ddata->supplies[0].supply = "vpnl"; ddata->supplies[1].supply = "vddi"; err = devm_regulator_bulk_get(&dsi->dev, DCS_REGULATOR_SUPPLY_NUM, -- 2.25.0 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel