From patchwork Fri Aug 4 11:23:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Riesch X-Patchwork-Id: 710378 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43E5BC00528 for ; Fri, 4 Aug 2023 11:23:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230148AbjHDLXZ (ORCPT ); Fri, 4 Aug 2023 07:23:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229680AbjHDLXY (ORCPT ); Fri, 4 Aug 2023 07:23:24 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2041.outbound.protection.outlook.com [40.107.20.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06E37128; Fri, 4 Aug 2023 04:23:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JYtss5FUF1v+/cGdQHTINZ3MWhXoD46jgUQqmE1vCZ13aegRQXm1IyGyFL30ouQA1//mzum56Gj/tVPwoOLWruFS0LuutwuyjSP4I3UYYoGAnLMi6iSRIxYcH01OPUdS8R4Nln4e+Kha89YqDHkxRo0DfJE+cNl6YahIoJCKmWkewBlue9vecVH9nypfA7U1Yuly0BD6V9YizwFPQnhOk6h6vxwUcxIZ9nKbp1e9QlohNCIxEpS9VfvPYGvMbaN+KdniUmJT74hQLjI3ux42QuHhK5LcOe73C+6pcYhpojt+GWZRWULL3nHlJiX6d2xHOEacO5j2ucCr0Btbz24JYg== 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=b9VBwqeIfG64Bdp5SOwixYwqJZmxKloYIiJ7xGDWDnY=; b=hydYNJyIJe/Em6InLBj6j2UyYGDzB+C/3YPyHtPf1Oc0R0tGRayHYg7U0xDK3Rsr+epx1R1/E+6L3IWPo5IMSJHhPBaTjsDbUPejQfut67c3rAzwp8uuhBoyP0loFF95bzNT+eroNtCfp0/+JFmb+3Ut2dXmEev+9w2/QFnPCR9gpSfGjiT3e0Gy60q/sy6NIFKkvnz1L8+kmRPeZMta3fdGX4Qen0l2GsP1ey8b1uBZ5mtCCKOIky84lxQe1Vp1LsCG8NcL7ElGUZbj432krR9CFkfUBriFjdsygow8UVnfUY4YJN134QlwvbnpA96pgxblBm20LWRG/0CKw3bBBQ== 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=b9VBwqeIfG64Bdp5SOwixYwqJZmxKloYIiJ7xGDWDnY=; b=EKZSj7MuKxLEy7hwT53J/gHcEKvnQqFTewZBHZzxssxf1FVdGkeC1VNVS3K5c6uTZ4eTUy22MPzZXEdOy/SfxLEhBM+mTM9/bLNxr7yeGGvAA7gNTh0YxoBdxE1p5abcK2vJ6mjJiCCnmOvTsY2K8Fva2vTAUKTceUn0k9fqi+k= 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 DB5PR08MB10214.eurprd08.prod.outlook.com (2603:10a6:10:4a9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.21; Fri, 4 Aug 2023 11:23:20 +0000 Received: from DU0PR08MB9155.eurprd08.prod.outlook.com ([fe80::9d1a:4539:a8f8:dd60]) by DU0PR08MB9155.eurprd08.prod.outlook.com ([fe80::9d1a:4539:a8f8:dd60%7]) with mapi id 15.20.6631.046; Fri, 4 Aug 2023 11:23:20 +0000 From: Michael Riesch Date: Fri, 04 Aug 2023 13:23:09 +0200 Subject: [PATCH v3 2/3] drm/panel: sitronix-st7789v: add panel orientation support Message-Id: <20230718-feature-st7789v-v3-2-157d68fb63e2@wolfvision.net> References: <20230718-feature-st7789v-v3-0-157d68fb63e2@wolfvision.net> In-Reply-To: <20230718-feature-st7789v-v3-0-157d68fb63e2@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 Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Michael Riesch X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691148197; l=2056; i=michael.riesch@wolfvision.net; s=20230425; h=from:subject:message-id; bh=vuZDK/ATsMHht5Q8uxKOQjXxmrTzLm7WsFyZBdFz4Po=; b=MmLlCwJPinoPV99u+Qk32aTdLZGbhhohfqn0Ub7warC/lM9pxEbUHuHvLUWKm5JT8Z2kSgDKa c2q7er0Q92JAaQcQ1qjpQ0vbcudaQZGwDsJNI1HIsz5CGnSqSeVYU9b X-Developer-Key: i=michael.riesch@wolfvision.net; a=ed25519; pk=1QQdXA2QbwdxaQn/VQK0hz04C8IBYhDowbK0hlNU4Ng= X-ClientProxiedBy: VI1PR07CA0281.eurprd07.prod.outlook.com (2603:10a6:803:b4::48) To DU0PR08MB9155.eurprd08.prod.outlook.com (2603:10a6:10:416::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR08MB9155:EE_|DB5PR08MB10214:EE_ X-MS-Office365-Filtering-Correlation-Id: e1fd9a35-6e8f-440c-a37e-08db94dd353f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yxDhC3Wt3cLTz2+yqk+VjX581y1Y3giK1sbnBWIxhZ36Yj9uuzB80okkdbYijJNjxrVlxBQjUDLaYXf19S+hL+yDeZvvrwRhywHq4DD3gva6STfV6RPZ7Kc8mV61Fheh5t0KEOoo5qVaB/cvOtk1dxwM1WViW8kc1L29AHdhMoP3ZS3Hf97lPNRY6WTJnBiTt0BsKQqfzMihX+b+rMfNGP2GCjtFo9L2IUpkk8BRhU0XLo0q6RrQ8jLpWcCGLZQep5ku9rklwumkQUsbqIYlDrDYcA9dijS3W2RxKJcNwJ9OpVgEkkRRo5nXIuLdhWf/IST738HE+qZ3MOmSstyBCXSPlkBECjNrjMBwOmd96LGaTSXKbGCbuajfm3j0cz3ekXKroZ/TdgtJK3vESd5ipv5pjhqcZ1IZdUThv6mk/e1/UbD0F/LAH5gkWgZ4naFkyFJoOUKNwJlSQR75XTMKG2T3o/Y2mHP2/hpRVFkpyjei0dh/KNb7RULpQvT+KtYAziXf0KopMdikvPGgXDuoXb0qD+irEEGYXitzluyDyd5kxSvToGCBPD9LuKWKwXK7UdgsHJWYbDmV8GaGitvoeKaciBQKxXNdbDAis5yCVL/2tA9DI1HRil29q7+804KiShHrSLs2lDA6DSiXwss6qw== 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)(136003)(376002)(39840400004)(366004)(346002)(396003)(451199021)(186006)(1800799003)(52116002)(6666004)(6486002)(6512007)(86362001)(6506007)(26005)(107886003)(36756003)(2616005)(38100700002)(38350700002)(921005)(5660300002)(41300700001)(8936002)(8676002)(6636002)(4326008)(2906002)(66556008)(66476007)(66946007)(316002)(7416002)(478600001)(44832011)(110136005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?wIM/EwnGLDCftp7IGD4Y0roVp2ZV?= =?utf-8?q?TRurEXZeFfQOgdHSQGVu8twFhJDptyOxRPwVdOZwNdywhC0aIFPhmcl/bxgyGptet?= =?utf-8?q?1ulUzwXBtupEC8LiZZakAIjlPLmixxQOE3eyaZLnmGkXLND7aVEbGASMNWYWCD/DI?= =?utf-8?q?idTyNM1gaBCOVDqF12ZEwZDgGa0S7OGNRHAzP98RV5hwMhkPEk5gQP1Us1RkEhR7H?= =?utf-8?q?q4FXtOERAKpG6UOBjVJ/9iDXLjcVukk55PeXN0at+8xWMLrc4ezppZori0baTJWnC?= =?utf-8?q?nD3ITZ/JO37P7WhJR40PIjx4EMsmiiIEuoatQMu1YT7PzDfbyYiRkGaLAYUb5/8v8?= =?utf-8?q?4mWRA47PUvkdhdIFrRd1Y/Qg5qEr1BfU8/6uOjPXAkYwMSHq/lD/zjzLK/kisNdGT?= =?utf-8?q?0kqp3c2sTJp61+HqVYpZJh5uFSYqeI4s2GdA0SUXxSFpC5sd8TojjIpY58gF86gPd?= =?utf-8?q?F4LZtxZ9MCKEI/NH4e//EX6GViwL2NR6F9Ass7Sw2wEBt/Ew4nsQGyYKnxTIJlHi6?= =?utf-8?q?VUk+vdvq/sbxEtnB+voBn37eIGHHRli5jAPoeKvdKvRP02sqXZihufnB6U9llbg7Z?= =?utf-8?q?rw4Zn3HTkGXlzjzfGoYRapF0TiOl3DOxQMWrpLkN1uT+Y7NrD3BDpQSfaDmZuKfqK?= =?utf-8?q?hLzG5eg2ibxP5msdgq7GrQiD08cK7Vm4qNl0LF3KkuQLBUmw6im4THZhDlk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X-MS-Exchange-CrossTenant-Network-Message-Id: e1fd9a35-6e8f-440c-a37e-08db94dd353f X-MS-Exchange-CrossTenant-AuthSource: DU0PR08MB9155.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2023 11:23:20.6284 (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: BuLR83R44fcr0aQ4KZW0NlSJwy4T8H8/CWCHnQKFyhN7GmAKwij0y/RD8qCL0ulMEWOEWIWKfK291d7c97ygZh3zFs6/+SQ4pWj6NHhAlI8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR08MB10214 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Determine the orientation of the display based on the device tree and propagate it. Reviewed-by: Neil Armstrong Reviewed-by: Sebastian Reichel Signed-off-by: Michael Riesch --- drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c index bc8df51224de..0ded72ed2fcd 100644 --- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c +++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c @@ -126,6 +126,7 @@ struct st7789v { struct spi_device *spi; struct gpio_desc *reset; struct regulator *power; + enum drm_panel_orientation orientation; }; enum st7789v_prefix { @@ -325,9 +326,22 @@ static int st7789v_get_modes(struct drm_panel *panel, drm_display_info_set_bus_formats(&connector->display_info, &ctx->info->bus_format, 1); + /* + * 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); @@ -522,6 +536,7 @@ static const struct drm_panel_funcs st7789v_drm_funcs = { .disable = st7789v_disable, .enable = st7789v_enable, .get_modes = st7789v_get_modes, + .get_orientation = st7789v_get_orientation, .prepare = st7789v_prepare, .unprepare = st7789v_unprepare, }; @@ -563,6 +578,8 @@ static int st7789v_probe(struct spi_device *spi) if (ret) return dev_err_probe(dev, ret, "Failed to get backlight\n"); + of_drm_get_panel_orientation(spi->dev.of_node, &ctx->orientation); + drm_panel_add(&ctx->panel); return 0;