Received: by 10.213.65.68 with SMTP id h4csp542076imn; Fri, 30 Mar 2018 10:20:56 -0700 (PDT) X-Google-Smtp-Source: AIpwx48ozT0Dho7+L2v2vKBqncsA8EK4Ik/ypO6nud64O23uJ1OuUalBvwNB9ghItJ/fMh/a9G29 X-Received: by 10.99.98.196 with SMTP id w187mr9110752pgb.307.1522430456617; Fri, 30 Mar 2018 10:20:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522430456; cv=none; d=google.com; s=arc-20160816; b=U7cyhZovioddU0n9wbGlgBd8BVa+IT0Tbz2/xoRXbbfGxO68I5ymd3p6iJqE8KL1QA 4WOf4QZ99ORRs6qyNPn2Ry9S3IoStBbub7ogQZzYM2OHbQpGlauc0N6PuBPtqoZLQOTr chcReyKe+VV2iLDAXphAu1gcZt2yMOQCPldj/gqTRwwo3SEvZBV55ECuJczSFgK7EDgs wC69AFYCs6hYsgAwHQlklzPgkkfbsD9F0bWaevK3ErIeFJvsVFWjy3EncU3VmPpGBY0a xDeTb8a1NPv3LycSbeqtQ3z1JjRkJYOXd1/NNNghhNN6OcZ++oYIzIHzejzFGl5bvyw6 sPnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=JYtwdKsFPv/S/6bn2R5wdaM3uDUKi/8665bWMxM+R/4=; b=nbmFi5jOZupPCVV+KZFtLOSpENT00ImniDbg2Z36jD7i5sI3klhSkwIuCdiqnU8NgI rPR2UJGlqG04ahcyLQQLIKtvg+D3Gt5FHdJoMSOLbUX+XCfBso6xuNwVvv7DrM5gZ91E GP9AgrYKxERI4asTlshiZnwA+WY7Z5dIZjckoccGzczWWA8XJek8xo7A1ly3rkoQWU+o DM6qW1MCdaK0pX3n2UZXgREW6iHbZmduxHgNIsGsNqQ38crA+Tpfjqn/VYthGcPoS+k6 fIi23XAmwfEHgAoAKfjtctp3fXmzkCbDJ0hhZmqgTGzYipZ/rp6p2NFaFT4LmYhpaKNF PKQA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.co.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g4-v6si5665160plb.522.2018.03.30.10.20.43; Fri, 30 Mar 2018 10:20:56 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.co.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752474AbeC3RSq (ORCPT + 99 others); Fri, 30 Mar 2018 13:18:46 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:58788 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752344AbeC3RSn (ORCPT ); Fri, 30 Mar 2018 13:18:43 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sre) with ESMTPSA id 291762601D5 From: Sebastian Reichel To: Sebastian Reichel , Tomi Valkeinen , Tony Lindgren , Pavel Machek Cc: Laurent Pinchart , Rob Herring , Mark Rutland , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@collabora.com, Sebastian Reichel Subject: [PATCHv3 6/8] drm/omap: add support for rotation hints from display drivers Date: Fri, 30 Mar 2018 19:18:20 +0200 Message-Id: <20180330171822.25896-7-sebastian.reichel@collabora.co.uk> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180330171822.25896-1-sebastian.reichel@collabora.co.uk> References: <20180330171822.25896-1-sebastian.reichel@collabora.co.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds support for setting DRM panel orientation property based on rotation information from the display driver. Signed-off-by: Sebastian Reichel --- drivers/gpu/drm/omapdrm/dss/omapdss.h | 2 ++ drivers/gpu/drm/omapdrm/omap_connector.c | 34 +++++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h index 14d74adb13fb..01a2a6638f70 100644 --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h @@ -554,6 +554,8 @@ struct omap_dss_driver { struct videomode *vm); void (*get_size)(struct omap_dss_device *dssdev, unsigned int *width, unsigned int *height); + void (*get_rotation)(struct omap_dss_device *dssdev, + int *rotation); int (*set_wss)(struct omap_dss_device *dssdev, u32 wss); u32 (*get_wss)(struct omap_dss_device *dssdev); diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c index a33b51484b2d..f8ae8bdf9211 100644 --- a/drivers/gpu/drm/omapdrm/omap_connector.c +++ b/drivers/gpu/drm/omapdrm/omap_connector.c @@ -249,6 +249,8 @@ struct drm_connector *omap_connector_init(struct drm_device *dev, struct drm_connector *connector = NULL; struct omap_connector *omap_connector; bool hpd_supported = false; + int rotation = -1; + int ret; DBG("%s", dssdev->name); @@ -267,7 +269,7 @@ struct drm_connector *omap_connector_init(struct drm_device *dev, drm_connector_helper_add(connector, &omap_connector_helper_funcs); if (dssdev->driver->register_hpd_cb) { - int ret = dssdev->driver->register_hpd_cb(dssdev, + ret = dssdev->driver->register_hpd_cb(dssdev, omap_connector_hpd_cb, omap_connector); if (!ret) @@ -288,6 +290,36 @@ struct drm_connector *omap_connector_init(struct drm_device *dev, connector->interlace_allowed = 1; connector->doublescan_allowed = 0; + if (dssdev->driver->get_rotation) + dssdev->driver->get_rotation(dssdev, &rotation); + + switch (rotation) { + case 0: + connector->display_info.panel_orientation = + DRM_MODE_PANEL_ORIENTATION_NORMAL; + break; + case 90: + connector->display_info.panel_orientation = + DRM_MODE_PANEL_ORIENTATION_RIGHT_UP; + break; + case 180: + connector->display_info.panel_orientation = + DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP; + break; + case 270: + connector->display_info.panel_orientation = + DRM_MODE_PANEL_ORIENTATION_LEFT_UP; + break; + default: + connector->display_info.panel_orientation = + DRM_MODE_PANEL_ORIENTATION_UNKNOWN; + break; + } + + ret = drm_connector_init_panel_orientation_property(connector, 0, 0); + if (ret) + DBG("%s: Failed to init orientation property (%d)", dssdev->name, ret); + return connector; fail: -- 2.16.2