From patchwork Tue Jul 18 15:12:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Riesch X-Patchwork-Id: 13317390 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id B201DEB64DA for ; Tue, 18 Jul 2023 15:13:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7257E10E360; Tue, 18 Jul 2023 15:13:10 +0000 (UTC) Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2053.outbound.protection.outlook.com [40.107.241.53]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0EB3210E0ED for ; Tue, 18 Jul 2023 15:13:00 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oROhxqtESt8XNtiZp1Op04daozdROxuvB+ijyaYUtmwwd9Sl3ieGmbvZXlZhslpIiiE6sBzgaH559LHcq9bK3ecHL3lxOSvwqE0JTk48OoN/lNyke+doR8MWehWquMyddqPbeXsayX22mg5ANB9UGwyKeZ858rPJSkUvUxrqTxbQZ4C2s3LcsdzUbC5wZxjydQvn65VbHaO5K9amA6FLbcja8L0uQHecw+qz9x8Ivwa0KGer0Mcn2CCLmj/e5EkHhP821A+KiZDN498h3mkVtJtsx4re6W895Q3bU3pclpHLZzqNdaeqP6iFW3OF1DBO5b8M6nwBlVb2WwFK0IpiFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cQeBP0r5b6fH55JrpvHtQpom3OuX8C2X2z1qcYLDpao=; b=JKZkuL8A1Xmxy3pkxt5ZSiGHGWG9uvWogxX+N2X3lUmRq16lqngvFGRD5O6BMaKYbJgYaJ7YgID7AL67BMP6TzkpFqlWJ+90hM7Bv8UqzEpNSQxQCxQAg42l11DUc0J1Ls9KZLDkaG6DH3Av/kqHUTLTNYJNZGB1DzEj1mZ88fr4NHUFh2qfYKSBeFNfAMZPHfxSI/psL6iFY68GBSB/2o/fqIOFoKAypE/7lhOgb5fsWJSHPbt3UV4GYlA9avq/2j2Wt1liBbWBxiIJlVEyj2wH8rmkwlTQvMxGUkl62yKuHDpsQ9Kfa5xM6M4n8uhxmoWwSQQQpNn5bHdNiVgGTA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wolfvision.net; dmarc=pass action=none header.from=wolfvision.net; dkim=pass header.d=wolfvision.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cQeBP0r5b6fH55JrpvHtQpom3OuX8C2X2z1qcYLDpao=; b=GwpAIMmxmLtu5M3myi8uiHcwo1s+BcjXGpGCkXgcj3yd4GK7PrIYj/m+9ec9OjpPIP34oAqIWmgll5Z45AbCZ2ex6O0vslkvNrQGuqHYkNN6k8pOIl+Gvyaq/Q7cgXKqCyyX3BaTnlPheZvHVyeiwUnZkYHW+tlqQw9JobSrC3A= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from DU0PR08MB9155.eurprd08.prod.outlook.com (2603:10a6:10:416::5) by DB8PR08MB5482.eurprd08.prod.outlook.com (2603:10a6:10:116::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.31; Tue, 18 Jul 2023 15:12:57 +0000 Received: from DU0PR08MB9155.eurprd08.prod.outlook.com ([fe80::4fd7:91a9:a92b:295a]) by DU0PR08MB9155.eurprd08.prod.outlook.com ([fe80::4fd7:91a9:a92b:295a%4]) with mapi id 15.20.6588.031; Tue, 18 Jul 2023 15:12:57 +0000 From: Michael Riesch Date: Tue, 18 Jul 2023 17:12:45 +0200 Subject: [PATCH 1/2] drm/panel: sitronix-st7789v: add panel orientation support Message-Id: <20230718-feature-st7789v-v1-1-76d6ca9b31d8@wolfvision.net> References: <20230718-feature-st7789v-v1-0-76d6ca9b31d8@wolfvision.net> In-Reply-To: <20230718-feature-st7789v-v1-0-76d6ca9b31d8@wolfvision.net> To: Neil Armstrong , Sam Ravnborg , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Ripard , Miquel Raynal , Sebastian Reichel , Gerald Loacker X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1689693175; l=2588; i=michael.riesch@wolfvision.net; s=20230406; h=from:subject:message-id; bh=zXaxnG0Q2EtwQPM71/6274e9MYjrKlx+BpihRQedYDo=; b=EkH5JoMpUEk9bWa34uNJmoW/bFoz/L/s8n1ZwgEUEA6glX0pbUUDrYZBpfsWbNhdr/mp+DxLI hs5d7h2nWC/DQsnfgBa91EPZ0q/pbMNAaMTi+iAcaarPHwVAB3VKzy3 X-Developer-Key: i=michael.riesch@wolfvision.net; a=ed25519; pk=G03kuYHL670EcdsWaNfVA7KnHWmkSpj98XziQm/hjbk= X-ClientProxiedBy: VI1PR08CA0247.eurprd08.prod.outlook.com (2603:10a6:803:dc::20) To DU0PR08MB9155.eurprd08.prod.outlook.com (2603:10a6:10:416::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR08MB9155:EE_|DB8PR08MB5482:EE_ X-MS-Office365-Filtering-Correlation-Id: e11e0863-14bb-4f9c-4f27-08db87a177b9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WfniSOMw52X6/Vh/dvgAnbD07Rf6x8ChF2rwMRXb717irEK0Ap0fDBDW/aZ5k/0mO8SIENma4alWJgJqIYnbWycJG1zOeX1pvxOhqGFm+EMkyhWwLq9EJt76HLNfoUBifThqbgxOBojmeSE1rjdH3zfeno34l7GIDtB7f1B2KtNpOPWGyNFXGgRxu53waH3ENBv7awOQCT20jUN+kqWs9W0RQMKSKUva9RJUcDWflXmlKA4Tv6PFQqlxQI9/lblTb299KKW1sNnOdV7hCExGaTVGnyhJVDqmlp6LE44uIepN58z2eFrkGeqT7h5VPu1oGyIOLewrZSeak0C4VhJiZmDOfnOv+Ut8aG30jQEMODbQuBeSHEgooD1VKIEVQAeHU5Gqa6E5SU0ekndnujeGfK/87KaFRdjy7WSYriyfl6hzgEtP6c0e31UqNMjyb1hcZUEpe+hgLEUIzTE+9INaztd+y7peA1vs8bvFszCIfBxak1wqGQm6SG+u5vgn2L3/jGI3lS7XeCTxEYdFt63B+Skaj+00VPsBLR3L7IBG1jyRSgkgtxDjf1rD8XY62u72KmHY48fARsi3NKU1HWiupBePuNj9hd2jFUFFnj2ZtYnSgDAN+hZVprncFiUpOFQTlf5A2oTkyQALqa775hREbA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU0PR08MB9155.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39850400004)(136003)(376002)(346002)(366004)(396003)(451199021)(186003)(110136005)(478600001)(6506007)(26005)(107886003)(6666004)(6486002)(6512007)(83380400001)(2906002)(66476007)(2616005)(52116002)(6636002)(41300700001)(38350700002)(86362001)(5660300002)(4326008)(38100700002)(66946007)(316002)(66556008)(36756003)(8936002)(7416002)(8676002)(44832011)(921005);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2k3XkEXmSHBRw2YTKpJYnS9AW+5kvld/K3KEN2?= =?utf-8?q?Y3Z36/cJKnuk+zJbBGBsFlw2Ul6nF7TwsTQMudnHyWH3s9M6Z3X+GwzgJXicGqHvz?= =?utf-8?q?t4MOXnJGrPlBgJ2Sk4POesIiPTNzqS5XhfU0KFmjSn2kEoE4G8Oxi/9rVjtUOGPf8?= =?utf-8?q?n1b/qNrw+LhrwXs/kqck4YCe05p6U6jHIrVPCORVIENl9unKPhnEiUu8YGwYL4WU6?= =?utf-8?q?S4WCP/O8Im+otTDEeErzkO0XhNtTb0K2qaNRHgwX//lszQ66TF7EzyLj9oST4TeWV?= =?utf-8?q?H3/YC/bfzDU37asovh3V4F6qcV9qzuNAtDdH/r93cGNLpTncA8umAwvaleiGrrRx6?= =?utf-8?q?QN79MZgCpWO0JcOYOcGaLzz2LrtZvUvbEiIIMbZPKrONCRUVFsgdQ9I6+icytP/9o?= =?utf-8?q?FlD6t8WE8fBHMI3oFpbHDIe79NCZ0pNZ4xjHEheuN2LdHfviDYjOcDJVMgxJPib3a?= =?utf-8?q?JH2x+8DNTXfB1WZq7jOWVH06+PLIUPma8JsjtR8wXGtmbQSeYyXZHRo1qUHQQzlPf?= =?utf-8?q?1NilfYxuxU3keMiiIu4UzYFAOBHwafvCtdk8biolnj6A46RGvtQ2FwWWwcdIwSmOt?= =?utf-8?q?V6RnDD1Upj1wE395Z7meagn55FE7TyCgclnMukJv+T3QGgdScCF7Sx8R2bNJp3T2i?= =?utf-8?q?UiFjtfTcTLfnPHIElgLQ5xPJrDd79LTFa0ZDNNwnhwyxMdPuMrNvdmck3whDkCXn5?= =?utf-8?q?8O2LP7PB+amt9/Az0JPp0dsNYhBA77VXyw=3D=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: e11e0863-14bb-4f9c-4f27-08db87a177b9 X-MS-Exchange-CrossTenant-AuthSource: DU0PR08MB9155.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2023 15:12:57.2072 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e94ec9da-9183-471e-83b3-51baa8eb804f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Goa+gS/Gf1EV5ZumI1ouzhPSmzwdGHQyK4TMGzYlAyWaI0ge6Qbc/7EAV6U4r3dQOQmojgwL5TsAQcP9iLngqh9eMkPsIkgOGxxbvrGVhFg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB5482 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: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Michael Riesch Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Determine the orientation of the display based on the device tree and propagate it. While at it, fix the indentation in the struct drm_panel_funcs. Signed-off-by: Michael Riesch Reviewed-by: Neil Armstrong --- drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 28 +++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c index bbc4569cbcdc..6575f07d49e3 100644 --- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c +++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c @@ -116,6 +116,7 @@ struct st7789v { struct spi_device *spi; struct gpio_desc *reset; struct regulator *power; + enum drm_panel_orientation orientation; }; enum st7789v_prefix { @@ -170,6 +171,7 @@ static const struct drm_display_mode default_mode = { static int st7789v_get_modes(struct drm_panel *panel, struct drm_connector *connector) { + struct st7789v *ctx = panel_to_st7789v(panel); struct drm_display_mode *mode; mode = drm_mode_duplicate(connector->dev, &default_mode); @@ -188,9 +190,22 @@ static int st7789v_get_modes(struct drm_panel *panel, connector->display_info.width_mm = 61; connector->display_info.height_mm = 103; + /* + * TODO: Remove once all drm drivers call + * drm_connector_set_orientation_from_panel() + */ + drm_connector_set_panel_orientation(connector, ctx->orientation); + return 1; } +static enum drm_panel_orientation st7789v_get_orientation(struct drm_panel *p) +{ + struct st7789v *ctx = panel_to_st7789v(p); + + return ctx->orientation; +} + static int st7789v_prepare(struct drm_panel *panel) { struct st7789v *ctx = panel_to_st7789v(panel); @@ -346,11 +361,12 @@ static int st7789v_unprepare(struct drm_panel *panel) } static const struct drm_panel_funcs st7789v_drm_funcs = { - .disable = st7789v_disable, - .enable = st7789v_enable, - .get_modes = st7789v_get_modes, - .prepare = st7789v_prepare, - .unprepare = st7789v_unprepare, + .disable = st7789v_disable, + .enable = st7789v_enable, + .get_modes = st7789v_get_modes, + .get_orientation = st7789v_get_orientation, + .prepare = st7789v_prepare, + .unprepare = st7789v_unprepare, }; static int st7789v_probe(struct spi_device *spi) @@ -382,6 +398,8 @@ static int st7789v_probe(struct spi_device *spi) if (ret) return ret; + of_drm_get_panel_orientation(spi->dev.of_node, &ctx->orientation); + drm_panel_add(&ctx->panel); return 0;