From patchwork Wed Jul 10 02:16:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Basehore X-Patchwork-Id: 11037729 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0077314C0 for ; Wed, 10 Jul 2019 02:17:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E5B9B28746 for ; Wed, 10 Jul 2019 02:17:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D890F288F7; Wed, 10 Jul 2019 02:17:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8041028746 for ; Wed, 10 Jul 2019 02:17:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rOttsZ48zoCOjGGDLrpF5LMDhZnNzAScJY4I0ARjFlM=; b=HhtBinMBzCKY9z IoIQ4GImAkZYMMMeXATW/gBwu6DQcW2dGZZt7l+/LmFYh+fi6vACA7+MDsnYIZw3vRtlXgGQjIMA2 gvNqRKPH1GyFVr0NhplNtzPnYMPp76hIDQUy4i4B+SfZOw9FWA+6K6mLn2UTWUrA1GH/IYYWELEko QLuELg+pDKO4gnswVSJpng+WNS2niui66dD/T+AoMOeR4Lsxyz/JbWCCqTJUovJkKP7A+6mNY6gOw yq1FLBBXeYC5nAfzIF0D44OmbwZZ/kAOJqrbJVjylo1wiiHAuFUYKfUcFctUJAfB6QtRqJSWIDnw+ TGm3oKyD+a/1Wj//hfxw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hl2Au-0004be-4r; Wed, 10 Jul 2019 02:17:40 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hl2AL-00046g-Jw for linux-mediatek@lists.infradead.org; Wed, 10 Jul 2019 02:17:07 +0000 Received: by mail-pl1-x644.google.com with SMTP id t14so357473plr.11 for ; Tue, 09 Jul 2019 19:17:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rpikIMJnjn17ow7nT90ZsAW62vVzq/828AzyTgXxFns=; b=KDpUaR2GTnyrc5bMH+RZ/Ty7EpO7D4yGQhOPGklSvXA9LczGYZw1cMR+dqYMR5AAdG ZbEaUkfCibKP8V3y0H0AWCmawTAQw5ugJghD1xH7RRRwlvMMGZYwabADa4uDkEe4MDuF obGD2zMEp0B0zxe1cgmuCzYJCFFvIeiP12Fqs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rpikIMJnjn17ow7nT90ZsAW62vVzq/828AzyTgXxFns=; b=sPDN7mXD2vZx1SvMzDS1Zzcv09f9MA0LgTbmdHG37oJu+ZiuuZTvGST7LZ+K+xYNn5 c7Jy8acUL9oN6jWir3a5ryfNH9l5AQecFP7F/a4Q168FtgZIufJ67l0qWjmUixKQWImE UcfnVZZfp3Ks3WmGqVoV/hX2M9BdkS+IzuIoKKdn6ha3fZmQia46btdRXphFZqoHxbQU YPNwVQLfw/RjZI//FOUINLY37ODTFZE3Xqk0CdgmdK40psrVovFAPSjutBDj5+o9wyyz aXzctLDee/X2ZiSB3rI4BNlMo4hJSTXP2f4U1ppvRfJAFis1c81D1Y8NsjULHyusRi1x 9M+w== X-Gm-Message-State: APjAAAUqmnGksqiInH8CbbCqLSTcZ9uH2mwNussCHqHZX+UWH5EfQ1X7 FZn5IZYmoH3cWoxBUBvmEdOCQg== X-Google-Smtp-Source: APXvYqy+kaD+8WCvx1z34bavMVVvQyXcArFU8CdZkcpUOI22pNIsEQGjP5EZMCNZD72F1EBpskCOOg== X-Received: by 2002:a17:902:788e:: with SMTP id q14mr36255101pll.234.1562725024955; Tue, 09 Jul 2019 19:17:04 -0700 (PDT) Received: from exogeni.mtv.corp.google.com ([2620:15c:202:1:5be8:f2a6:fd7b:7459]) by smtp.gmail.com with ESMTPSA id f17sm326296pgv.16.2019.07.09.19.17.03 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 09 Jul 2019 19:17:04 -0700 (PDT) From: Derek Basehore To: linux-kernel@vger.kernel.org Subject: [PATCH v7 1/4] drm/panel: Add helper for reading DT rotation Date: Tue, 9 Jul 2019 19:16:56 -0700 Message-Id: <20190710021659.177950-2-dbasehore@chromium.org> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190710021659.177950-1-dbasehore@chromium.org> References: <20190710021659.177950-1-dbasehore@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190709_191705_651024_ADEE48AC X-CRM114-Status: GOOD ( 14.45 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Derek Basehore , Philipp Zabel , Maxime Ripard , Sam Ravnborg , intel-gfx@lists.freedesktop.org, Joonas Lahtinen , Maarten Lankhorst , Jani Nikula , David Airlie , Thierry Reding , Matthias Brugger , dri-devel@lists.freedesktop.org, Daniel Vetter , Rodrigo Vivi , CK Hu , linux-mediatek@lists.infradead.org, Sean Paul , linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This adds a helper function for reading the rotation (panel orientation) from the device tree. Signed-off-by: Derek Basehore --- 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 dbd5b873e8f2..169bab54d52d 100644 --- a/drivers/gpu/drm/drm_panel.c +++ b/drivers/gpu/drm/drm_panel.c @@ -172,6 +172,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 8c738c0e6e9f..fc7da55f41d9 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -33,6 +33,8 @@ struct drm_device; struct drm_panel; struct display_timing; +enum drm_panel_orientation; + /** * struct drm_panel_funcs - perform operations on a given panel * @disable: disable panel (turn off back light, etc.) @@ -197,11 +199,18 @@ int drm_panel_detach(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 From patchwork Wed Jul 10 02:16:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Basehore X-Patchwork-Id: 11037731 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4243C14DB for ; Wed, 10 Jul 2019 02:17:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 35D6B28882 for ; Wed, 10 Jul 2019 02:17:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 266D728746; Wed, 10 Jul 2019 02:17:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B40A928746 for ; Wed, 10 Jul 2019 02:17:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ABiNhNqXtvDADwlrP92FS7Lz0GAxnaHE9jBUV78/S08=; b=JZvD4CwifgnQE6 1uOSED9SXD2oqGAGeuH9QUFuLrS4BOthQsnG/9BbTSX9NIIBzAIMFBdfAUSZpZpHgd8xzdXyac74P sy8C2E/aqVNWNgxPnWGP/BA9VzEremSC1F32jGZakHotNLeosjh4dDwdl4Rmpvu2prNRYyvoekfAW CYlRKXgqKxjUbCxnW+Fcp+ASGrTIl74oxqDsA1UBvjLJAjOUf3ccL74EHbMf62xsfd3KwYwT+VCrD CmhYRE1bCZ7AD9M9fQJ6doks2mmyQqTlrCpAFG01e93WCdm8cIsLisJLExJg6B1pDShfD5tNvTkAF LZOxO4mSPi7zLqMcYnFQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hl2Aw-0004dt-DF; Wed, 10 Jul 2019 02:17:42 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hl2AM-00047J-Go for linux-mediatek@lists.infradead.org; Wed, 10 Jul 2019 02:17:07 +0000 Received: by mail-pl1-x644.google.com with SMTP id cl9so362696plb.10 for ; Tue, 09 Jul 2019 19:17:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rfx+Gd8oVEa1XPLGf6Uhcr6PQLb7UV/+SVQIxm9mxvM=; b=aawXa+LkTbucerXg4L9n9gF1KFbcTg+H2OKkFWI4ygUbxZGVqYGqbRu/syViUnFP/X js9OUUiu6Qrs1VAmsVJgu59Kwr3zqoUllfexi7fhUZBJh8s8sVGlQqkts+qdDLeR6FrU j3PeApwXk/eCwD6juKRGXxL5SfIacGIpfm3cM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rfx+Gd8oVEa1XPLGf6Uhcr6PQLb7UV/+SVQIxm9mxvM=; b=Z7oglUo99jqS+YUrgYaxQuwKrzvD+cSKyGE5l18uQb8QlqmWLFDsiTioscT4dkmWDG 6BET4B8/Ohj9uUP94Scf59bepyMH3oPXH/zAJbjTEMBJy4aaHVbzg9yUAn/8O0gH524h wTL25hNvWFhZhgT5LSUYUPnHwWUdJeEt6/2MMBILaGjjvtsVbUUNF6SllR9TmDgs7bAv Zgvrjb3sfLlJ9GURnDVsUkQka3To98yI4HtW7TtUQcetIKVfRBJUTYAwwUlU92vXEaJr hsj2bl3yuN0nrXJZe56b2NolHn8JBYlrKFYDY5RJnSD0ARcKnK33YvQHN/yttI7ML12f 8T7A== X-Gm-Message-State: APjAAAV/f1fAsLbZpa84vXbX1P9hbf5v3W/BcBIP8xxZjK2USGzZbPd7 qIT6GVCIwhgbNv7r4+OoptxnDQ== X-Google-Smtp-Source: APXvYqzd1kRHOtV+IgvJ0sC2iehhxo+KzXVpBYGiYr1K/o2l7WgEbrPY6S8Q5QQoxGtZBQ6/rKc14A== X-Received: by 2002:a17:902:42d:: with SMTP id 42mr34536201ple.228.1562725026148; Tue, 09 Jul 2019 19:17:06 -0700 (PDT) Received: from exogeni.mtv.corp.google.com ([2620:15c:202:1:5be8:f2a6:fd7b:7459]) by smtp.gmail.com with ESMTPSA id f17sm326296pgv.16.2019.07.09.19.17.05 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 09 Jul 2019 19:17:05 -0700 (PDT) From: Derek Basehore To: linux-kernel@vger.kernel.org Subject: [PATCH v7 2/4] drm/panel: set display info in panel attach Date: Tue, 9 Jul 2019 19:16:57 -0700 Message-Id: <20190710021659.177950-3-dbasehore@chromium.org> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190710021659.177950-1-dbasehore@chromium.org> References: <20190710021659.177950-1-dbasehore@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190709_191706_556169_420ADC83 X-CRM114-Status: GOOD ( 12.81 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Derek Basehore , Philipp Zabel , Maxime Ripard , Sam Ravnborg , intel-gfx@lists.freedesktop.org, Joonas Lahtinen , Maarten Lankhorst , Jani Nikula , David Airlie , Thierry Reding , Matthias Brugger , dri-devel@lists.freedesktop.org, Daniel Vetter , Rodrigo Vivi , CK Hu , linux-mediatek@lists.infradead.org, Sean Paul , linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/gpu/drm/drm_panel.c | 28 ++++++++++++++++++++++++++++ include/drm/drm_panel.h | 14 ++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c index 169bab54d52d..ca01095470a9 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; } @@ -128,6 +140,22 @@ EXPORT_SYMBOL(drm_panel_attach); */ int 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 fc7da55f41d9..a6a881b987dd 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -39,6 +39,8 @@ enum drm_panel_orientation; * struct drm_panel_funcs - perform operations on a given panel * @disable: disable panel (turn off back light, etc.) * @unprepare: turn off panel + * @detach: detach panel->connector (clear internal state, etc.) + * @attach: attach panel->connector (update internal state, etc.) * @prepare: turn on panel and perform set up * @enable: enable panel (turn on back light, etc.) * @get_modes: add modes to the connector that the panel is attached to and @@ -95,6 +97,18 @@ struct drm_panel { const struct drm_panel_funcs *funcs; + /* + * panel information to be set in the connector when the panel is + * attached. + */ + unsigned int width_mm; + unsigned int height_mm; + unsigned int bpc; + int orientation; + const u32 *bus_formats; + unsigned int num_bus_formats; + u32 bus_flags; + struct list_head list; }; From patchwork Wed Jul 10 02:16:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Basehore X-Patchwork-Id: 11037737 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1CAE9138D for ; Wed, 10 Jul 2019 02:18:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C49428746 for ; Wed, 10 Jul 2019 02:18:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F39F1288F7; Wed, 10 Jul 2019 02:18:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 82EE928746 for ; Wed, 10 Jul 2019 02:18:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lf0+ZJGVwGN/jdWTgRAX8K9HNsrh/KS3kjfONgyK8T4=; b=uA8C+WumcMhpnB i8nnQ6Iq5kSWlaOw09PiqmFfDNO5DEdO1sno2GaflngQ2q/51eVC3oau+Ye0Wl04rnniMNgHt/ph2 9TJaCmUzZbt0tt0EmMP21be5lprtEx/lZo74Xm+2GE/lzqqWPgV790v61gajXh8J9oKu60lLkR3dW QG5vDalPwLE55lyA9LVv29Y3vqnmCJqZJhsUNpo3AStjyujLgk3FkIFPZPF7IrcUXJVA/L6Gioe1Y ZAu3yi8Bd0CaY/nQDu8Tid+bxOhpwDd5D4R0e2sSLxKMQ5aDITNkDDEwKZ7z6jKQ3ZH83ui771B4/ sJMg5Vb1dB151RhOhXHQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hl2BU-00057Z-4G; Wed, 10 Jul 2019 02:18:16 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hl2AN-00047x-Nk for linux-mediatek@lists.infradead.org; Wed, 10 Jul 2019 02:17:10 +0000 Received: by mail-pl1-x643.google.com with SMTP id b3so377732plr.4 for ; Tue, 09 Jul 2019 19:17:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2pjfsy9rhDDSQLRF2c0ELoxpFQi0Wl/hYf+k+fsHKXE=; b=KnyvSEptEQBRJwTGRUTY8PGPYjnCYLeEBEvkphUgK6mwTu5SWaCLT43F8rzZhqtQQJ L/uNfZBv5wq2d8G3BLF283g2RVF3ZId0+nDz66B2y6vGllJU0T3/yHpOowc6abM3ybKO 1zcaQFtSDYujVUFfRDhzMbdHWwpy2xD/qgKf0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2pjfsy9rhDDSQLRF2c0ELoxpFQi0Wl/hYf+k+fsHKXE=; b=rsZESafP34AMdGPzsY/WIu5CK4jaGK+4WBs/85QU3F3QbsSouv+e+n11E0ASi+3Y5x HQvW98EHT7yK3tWLODAK9GS6Zklv+zzdE3cKglF3ixOjX9+l1WKCWoNUhRWWsNB53JdV 00xdZ6k3RsEIoa6is0d/Le47E9rxh9pnnJE3uxV40I9WgkoOTlnSPej8818uMck2FiDq KVp+c3jYwkBYPU2IgRnH1niQ1Tuyrn5J8zUucKDIqOdyM06g8uV3d1BLeNjxP0It3ahD Pp0Sa4c/5uq07cT5rW1gaNVCYMmv5qqMRYJRHgSGJdLCkGEubAtS5oewqw2j5NBKqBUD Wg9A== X-Gm-Message-State: APjAAAUjv+cxkvCItaGT9vKsKohTx6nc4zZMx2gd3jEdEsUdOuPDHKBF /RnyiHuxA0wJIpfX+rKEMFwNuA== X-Google-Smtp-Source: APXvYqwF3S1BnldvZbLiGWX8z/EpBjWWQ5qhe7Uy3EG5dlfo3/q6v/vfgLPA9f62WGcPr7Ec4W8GLA== X-Received: by 2002:a17:902:61:: with SMTP id 88mr34203286pla.50.1562725027336; Tue, 09 Jul 2019 19:17:07 -0700 (PDT) Received: from exogeni.mtv.corp.google.com ([2620:15c:202:1:5be8:f2a6:fd7b:7459]) by smtp.gmail.com with ESMTPSA id f17sm326296pgv.16.2019.07.09.19.17.06 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 09 Jul 2019 19:17:06 -0700 (PDT) From: Derek Basehore To: linux-kernel@vger.kernel.org Subject: [PATCH v7 3/4] drm/connector: Split out orientation quirk detection Date: Tue, 9 Jul 2019 19:16:58 -0700 Message-Id: <20190710021659.177950-4-dbasehore@chromium.org> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190710021659.177950-1-dbasehore@chromium.org> References: <20190710021659.177950-1-dbasehore@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190709_191707_855975_53CB1707 X-CRM114-Status: GOOD ( 15.17 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Derek Basehore , Philipp Zabel , Maxime Ripard , Sam Ravnborg , intel-gfx@lists.freedesktop.org, Joonas Lahtinen , Maarten Lankhorst , Jani Nikula , David Airlie , Thierry Reding , Matthias Brugger , dri-devel@lists.freedesktop.org, Daniel Vetter , Rodrigo Vivi , CK Hu , linux-mediatek@lists.infradead.org, Sean Paul , linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Not every platform needs quirk detection for panel orientation, so split the drm_connector_init_panel_orientation_property into two functions. One for platforms without the need for quirks, and the other for platforms that need quirks. Signed-off-by: Derek Basehore --- drivers/gpu/drm/drm_connector.c | 45 ++++++++++++++++++------- drivers/gpu/drm/i915/display/intel_dp.c | 4 +-- drivers/gpu/drm/i915/display/vlv_dsi.c | 2 +- include/drm/drm_connector.h | 2 ++ 4 files changed, 38 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index b3f2cf7eae9c..52777d647494 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -1892,31 +1892,23 @@ EXPORT_SYMBOL(drm_connector_set_vrr_capable_property); * drm_connector_init_panel_orientation_property - * initialize the connecters panel_orientation property * @connector: connector for which to init the panel-orientation property. - * @width: width in pixels of the panel, used for panel quirk detection - * @height: height in pixels of the panel, used for panel quirk detection * * This function should only be called for built-in panels, after setting * connector->display_info.panel_orientation first (if known). * - * This function will check for platform specific (e.g. DMI based) quirks - * overriding display_info.panel_orientation first, then if panel_orientation - * is not DRM_MODE_PANEL_ORIENTATION_UNKNOWN it will attach the - * "panel orientation" property to the connector. + * This function will check if the panel_orientation is not + * DRM_MODE_PANEL_ORIENTATION_UNKNOWN. If not, it will attach the "panel + * orientation" property to the connector. * * Returns: * Zero on success, negative errno on failure. */ int drm_connector_init_panel_orientation_property( - struct drm_connector *connector, int width, int height) + struct drm_connector *connector) { struct drm_device *dev = connector->dev; struct drm_display_info *info = &connector->display_info; struct drm_property *prop; - int orientation_quirk; - - orientation_quirk = drm_get_panel_orientation_quirk(width, height); - if (orientation_quirk != DRM_MODE_PANEL_ORIENTATION_UNKNOWN) - info->panel_orientation = orientation_quirk; if (info->panel_orientation == DRM_MODE_PANEL_ORIENTATION_UNKNOWN) return 0; @@ -1939,6 +1931,35 @@ int drm_connector_init_panel_orientation_property( } EXPORT_SYMBOL(drm_connector_init_panel_orientation_property); +/** + * drm_connector_init_panel_orientation_property_quirk - + * initialize the connecters panel_orientation property with a quirk + * override + * @connector: connector for which to init the panel-orientation property. + * @width: width in pixels of the panel, used for panel quirk detection + * @height: height in pixels of the panel, used for panel quirk detection + * + * This function will check for platform specific (e.g. DMI based) quirks + * overriding display_info.panel_orientation first, then if panel_orientation + * is not DRM_MODE_PANEL_ORIENTATION_UNKNOWN it will attach the + * "panel orientation" property to the connector. + * + * Returns: + * Zero on success, negative errno on failure. + */ +int drm_connector_init_panel_orientation_property_quirk( + struct drm_connector *connector, int width, int height) +{ + int orientation_quirk; + + orientation_quirk = drm_get_panel_orientation_quirk(width, height); + if (orientation_quirk != DRM_MODE_PANEL_ORIENTATION_UNKNOWN) + connector->display_info.panel_orientation = orientation_quirk; + + return drm_connector_init_panel_orientation_property(connector); +} +EXPORT_SYMBOL(drm_connector_init_panel_orientation_property_quirk); + int drm_connector_set_obj_prop(struct drm_mode_object *obj, struct drm_property *property, uint64_t value) diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index 0bdb7ecc5a81..975196c86e50 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -7063,8 +7063,8 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, intel_panel_setup_backlight(connector, pipe); if (fixed_mode) - drm_connector_init_panel_orientation_property( - connector, fixed_mode->hdisplay, fixed_mode->vdisplay); + drm_connector_init_panel_orientation_property_quirk(connector, + fixed_mode->hdisplay, fixed_mode->vdisplay); return true; diff --git a/drivers/gpu/drm/i915/display/vlv_dsi.c b/drivers/gpu/drm/i915/display/vlv_dsi.c index e272d826210a..dd7fa806f95c 100644 --- a/drivers/gpu/drm/i915/display/vlv_dsi.c +++ b/drivers/gpu/drm/i915/display/vlv_dsi.c @@ -1662,7 +1662,7 @@ static void intel_dsi_add_properties(struct intel_connector *connector) connector->base.display_info.panel_orientation = vlv_dsi_get_panel_orientation(connector); - drm_connector_init_panel_orientation_property( + drm_connector_init_panel_orientation_property_quirk( &connector->base, connector->panel.fixed_mode->hdisplay, connector->panel.fixed_mode->vdisplay); diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index ca745d9feaf5..940254b06767 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -1512,6 +1512,8 @@ void drm_connector_set_link_status_property(struct drm_connector *connector, void drm_connector_set_vrr_capable_property( struct drm_connector *connector, bool capable); int drm_connector_init_panel_orientation_property( + struct drm_connector *connector); +int drm_connector_init_panel_orientation_property_quirk( struct drm_connector *connector, int width, int height); int drm_connector_attach_max_bpc_property(struct drm_connector *connector, int min, int max); From patchwork Wed Jul 10 02:16:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Basehore X-Patchwork-Id: 11037741 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 93C8C14C0 for ; Wed, 10 Jul 2019 02:18:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 86CEE28746 for ; Wed, 10 Jul 2019 02:18:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79437288F7; Wed, 10 Jul 2019 02:18:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2D96828746 for ; Wed, 10 Jul 2019 02:18:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Bas+h8VL9+lab4WfIhKMU1D9PIYoTRTjcToRu9eaiBg=; b=hjmU0zTDehn4AD h5ZP8xc8VQefgFRSZSO7upgFYPNCQ4Dz47IJxOE7zL5cjtxmBbwH8q2RtLZYdku4KHzyvCQfFdsTV 6cTZnmIS4g3Tg83iffs9MewUj7gw5KapDHViqSQgFcSev4GQ/F0MIYnkJ2ZkDER4IywuFUiRwv+Pk L6/02EkOkdYDpDdmeyROeKjrceWfBy2N8Po5/0/BbToAEcpdVGMh+Smc+ZcoaNBSgQqVBkzXLWKEv srGoSsXfp/osn37OkSfSSB+1nEtZaqpsdIdVTGsS2geLtpBb3RFV98Kp8r5J1LEJLYA29x4qXvZLO Kmy82vVE5ExuAgclUcGg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hl2Bl-0005NY-RS; Wed, 10 Jul 2019 02:18:33 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hl2AP-00049F-7I for linux-mediatek@lists.infradead.org; Wed, 10 Jul 2019 02:17:11 +0000 Received: by mail-pl1-x643.google.com with SMTP id y8so358038plr.12 for ; Tue, 09 Jul 2019 19:17:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vxC6cpJeD3A10tWWsNE37FjIALjzLREnlwwa6KDygFo=; b=cOH8q2NXyovDSMUi7Xd+oHt9KadYcDoTUvRMkD/0Uf41BGCgaVcf7ZDlhSjXFXm6Lu ESTtRPTKtFghn8CC6QIqS7fRiHEAAJ+mCfoZNe3O8zcvXAT3weo6V4fimDAF1Z3n145Z 2ghQAYXOmiz9HHA0Iybxqrs5iV+2A4uq9ZIHE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vxC6cpJeD3A10tWWsNE37FjIALjzLREnlwwa6KDygFo=; b=JXr3c8vUvk1EdioxxY5eRgO2ZpqKZHxw5D1whT+z2Nnrino/8bSdv0lYTl4KPsdhp5 uuql64RKFBzrzfX3WCsJHKSI/os8kK5VMuZ/7KBPgijMdaWeY8J5xFmZdd15PFU5wg9E C1zeajywrre6RasHdzTCOaWeuJqKFEQpKJyPhgokewJrMJHGI9jOp2DdNjmbtRnPvn+E KhG3tfq7Kdi42Li2Xp4oNBhs2czqc3cpZUQgA2RHxFTqjRjczaqGZ0BwbjY3tqCeohQ4 8dNSr4GFC/tfNXLnRnvaA04zPfmAvtFtb1EWbLYemrMKCSbE5xGHqY0GTKgtyYg2nOXh D/Aw== X-Gm-Message-State: APjAAAUXLeLiZ3Mbk3qgyTPnGEXJfnuuTYB6Er7RhERCx1c3Sg3LdI2p DCazOvX1f7A7iclFp9O0IXp8Ow== X-Google-Smtp-Source: APXvYqyqOasWPK4ZpeQARWIZEdPGz1HraSAZfsyOpQz9qUNv7Z9acXIyi2h1oPo/iq/+u18NZCadrQ== X-Received: by 2002:a17:902:100a:: with SMTP id b10mr35190007pla.338.1562725028674; Tue, 09 Jul 2019 19:17:08 -0700 (PDT) Received: from exogeni.mtv.corp.google.com ([2620:15c:202:1:5be8:f2a6:fd7b:7459]) by smtp.gmail.com with ESMTPSA id f17sm326296pgv.16.2019.07.09.19.17.07 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 09 Jul 2019 19:17:08 -0700 (PDT) From: Derek Basehore To: linux-kernel@vger.kernel.org Subject: [PATCH v7 4/4] drm/mtk: add panel orientation property Date: Tue, 9 Jul 2019 19:16:59 -0700 Message-Id: <20190710021659.177950-5-dbasehore@chromium.org> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190710021659.177950-1-dbasehore@chromium.org> References: <20190710021659.177950-1-dbasehore@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190709_191709_335718_9CA9028E X-CRM114-Status: GOOD ( 10.52 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Derek Basehore , Philipp Zabel , Maxime Ripard , Sam Ravnborg , intel-gfx@lists.freedesktop.org, Joonas Lahtinen , Maarten Lankhorst , Jani Nikula , David Airlie , Thierry Reding , Matthias Brugger , dri-devel@lists.freedesktop.org, Daniel Vetter , Rodrigo Vivi , CK Hu , linux-mediatek@lists.infradead.org, Sean Paul , linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This inits the panel orientation property for the mediatek dsi driver if the panel orientation (connector.display_info.panel_orientation) is not DRM_MODE_PANEL_ORIENTATION_UNKNOWN. Signed-off-by: Derek Basehore Reviewed-by: CK Hu --- drivers/gpu/drm/mediatek/mtk_dsi.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c index b91c4616644a..2920458ae2fb 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -790,10 +790,18 @@ static int mtk_dsi_create_connector(struct drm_device *drm, struct mtk_dsi *dsi) DRM_ERROR("Failed to attach panel to drm\n"); goto err_connector_cleanup; } + + ret = drm_connector_init_panel_orientation_property(&dsi->conn); + if (ret) { + DRM_ERROR("Failed to init panel orientation\n"); + goto err_panel_detach; + } } return 0; +err_panel_detach: + drm_panel_detach(dsi->panel); err_connector_cleanup: drm_connector_cleanup(&dsi->conn); return ret;