From patchwork Tue Mar 14 11:56:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerald Loacker X-Patchwork-Id: 69545 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1720137wrd; Tue, 14 Mar 2023 05:14:44 -0700 (PDT) X-Google-Smtp-Source: AK7set9m9lgorbBc9m4Y9jSPE7F/MianFWhMuAteCdsRJRo80yGiDi0t1+gQqUvCOk6jBBm7pTNu X-Received: by 2002:a05:6a20:1e4e:b0:d3:bce6:2224 with SMTP id cy14-20020a056a201e4e00b000d3bce62224mr9416299pzb.6.1678796084619; Tue, 14 Mar 2023 05:14:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1678796084; cv=pass; d=google.com; s=arc-20160816; b=cC8XyOLGyb+zbrg3xdUFzZHTfVAjdc/0j4A5MUHzoS9rmtaKDQxrNv6wcnLjdFlu51 C7jE9TP4EfEXXhYU+2thUo4lJNbXOjG4KAcaG+NmHhZtv+A7bCBzlvsnzqo6bm24+TCe DOSJ5CcnX34tqi2f38uRxaOufcZJBioVuhbwRTmLf9pM/j+jEdnlVfIWXMD6KwPP61kt 3RAFqU8YEaUSzfgT8n78U5f06IqNBQsLEIpnr/4V+bIYyd+QdI7OTz2XSaO2Dmp7hAda U1YVD6Mda4jxEyjowalvepVCE/zrz/GnBNP38ddHv9RL0vrB7vfkn7nPcmzKZpfMkapC SPsg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nSOgie7mzSW/z5IubJU1uAwPU0cFhDNi+ptEortSkMw=; b=Zwjq2ea4UUar7b37wupVWT2Zjt5AOZoAaKP+HhjaIvyiGPA08+djyveX/rOQchuc/s NbtuVMQiGrGsqjGJxmYbtqbpkFmhPgOTEhPrlJh9UJ0FkkW7cYiQbj7jQLEOjYnTjI/r eeX9WOYqCFOZNZxSSsztp3FVZk3p42VTJBo29E5l4U3HeA1VX3Ods80H29byVJFdRgmc q4cmahS+ZBhXnuolF0axfUIz5kmbuVRczW82CZ/OX2ypKKdOunKVtmXUj2mAkHzArBjC jZrcTzkaRx69Rks0GleZPjSBtzebV5DB3vsJ2wS20EEqpU0uN7bDP+Fr/3Nxu4FBArvG k9qA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=221ekHXN; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w18-20020aa79552000000b0062578d18ba1si648601pfq.54.2023.03.14.05.14.29; Tue, 14 Mar 2023 05:14:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=221ekHXN; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231527AbjCNL6Z (ORCPT + 99 others); Tue, 14 Mar 2023 07:58:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231500AbjCNL6X (ORCPT ); Tue, 14 Mar 2023 07:58:23 -0400 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on20629.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe13::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73FB99FE69; Tue, 14 Mar 2023 04:57:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H2dZ2FYim6z0S3kRVHl/VkB2jDg4STIDniHPr/XC+/+73xTNP2sbuLUicl2lP4OVw3+sKuiwRe2FM01iYSXvLmMCelvNszJBPvV1ifHlA6ZecvgweqjR9+fdI/kFSyLF47A/SPJdrZR35KIY7ulu8M8lu+5ryANaHA2vGDz2u1XYAPtUKGfkkRv8467L6vAgECNiCjLPkOen+H7ipFXkPES7XtI/f7ttNM7mAQ/RQuKylVA6qcHYPSHoEkVAewMSQ/l7REjg9bscj7HTem+OQ+tW8mBUSi0tAao6mNLkbRmeW5Dj1Xi5bVoeHTWUi4FVQ+XN7r34EtKRoyxF0+2/zg== 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=nSOgie7mzSW/z5IubJU1uAwPU0cFhDNi+ptEortSkMw=; b=Ci8lt+pVLyhO+jXYM1zOZzYzbPU/pjm5DYwfKYQgQZgAmnIo6akJUChDt031Ft7PRcxHteMJIqTYOZgTv5Sq9NUgAbIcJutC/FB8yTLyptmoYSEDhLizCkENxnZrAq1Si2raXNLJA1G6PAe24htgj5qwnUx+gDrXW8DV5tMhVogteK7p4E4T+WlbsuqeMLAPtlgatKXnDHs/1+zLz7JmRQSVETes9Mu/Fm5eq59jXx2Re8kjSi/SbAapjxu/kPoNPkODHYOu9/zaZlRvWDzL3nDUVuoHSMJiuz0tQ6dFwaQw8/EqQbK7/AoBq+mugvWpPyDy6fu+MuLfSCBy3aMBcQ== 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=nSOgie7mzSW/z5IubJU1uAwPU0cFhDNi+ptEortSkMw=; b=221ekHXNqHXXjtD9hDfK9m+AkjsFHhrDWdEwcMmywQZGuCeWrwcSZDT0j3LX9IRkujJAfLJtLrVlvjkoQBKVQFvcwpukKBUqMaE6y+E+JcIuFVXfA8kqPPyd2HPFjWTiFOeHXPvNm/rfgcUsEX4ATSMWLB5QeA2k+V+Be4OxvGE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from VI1PR08MB4544.eurprd08.prod.outlook.com (2603:10a6:803:100::13) by DU0PR08MB8811.eurprd08.prod.outlook.com (2603:10a6:10:478::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.24; Tue, 14 Mar 2023 11:57:06 +0000 Received: from VI1PR08MB4544.eurprd08.prod.outlook.com ([fe80::b094:4fd2:abe3:9f08]) by VI1PR08MB4544.eurprd08.prod.outlook.com ([fe80::b094:4fd2:abe3:9f08%4]) with mapi id 15.20.6178.024; Tue, 14 Mar 2023 11:57:05 +0000 From: Gerald Loacker To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Thierry Reding , Sam Ravnborg , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Maxime Ripard , Michael Riesch , Gerald Loacker Subject: [PATCH 2/7] drm/panel: sitronix-st7789v: add panel orientation support Date: Tue, 14 Mar 2023 12:56:39 +0100 Message-Id: <20230314115644.3775169-3-gerald.loacker@wolfvision.net> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230314115644.3775169-1-gerald.loacker@wolfvision.net> References: <20230314115644.3775169-1-gerald.loacker@wolfvision.net> X-ClientProxiedBy: VI1PR0802CA0032.eurprd08.prod.outlook.com (2603:10a6:800:a9::18) To VI1PR08MB4544.eurprd08.prod.outlook.com (2603:10a6:803:100::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR08MB4544:EE_|DU0PR08MB8811:EE_ X-MS-Office365-Filtering-Correlation-Id: 9a78a561-16e0-4845-d4d7-08db24833b4e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Y4OWF8LX2ETo/szfLzibUaNi3Oom6jFHn+ET1frFKgnOSuW92M9xwjRa3Btx1f0AZcbfYrOMDMCg53AWEnFPZ3BTowsoyAyTJquGj1CYu8YdUB6Cg4cCIJAR227krQgR36iVF3WvAFwJGgza2Kh05HbtEn3B9uUvAcS18VFASz6LoiOGQ9uSe9zyW6ylMmd64/4Xkkav9LPR3WZSX6HyN5UYqCa+KLcMSHlYYvh2nE9FYOUmuWXV1uJ7SXjU7K7WYTo6y227DbH8tsXgWzaUm+RSf+qzaJhoYnzuWS4EtdpwMg3gMMZCJJxIJzFKPm7cgqXzh7vL/tvXCLHFzIgHzfN+tKuhtK1ZffOPGSvhrTXLOz200+55tuITS92kc/MQq7/w6uhCAMbRqncUbZkwThAieKKejcGH5JSWphRKPOEvNJRhsuQtd3CoXMKStaGPWJpi8UxMVlrh2OQCV9UcJ//dAIfXUHUaEuXAVtQD8sV3f0HwsFEpI8QGXNJZyafhsraNdrxEQK+KifSFTQxPADOa85v2vfhKUnq6Ah3hbu4XnxBP0qbDxp8bbT4ifkO7W1T8NL0LyrS1LMEt3qjXcssAtg6BheAkVtzyQkKQQQOGZ7+8z7/JlQkqwKvv60SwlTrgoZ8RxhUi7yA8ZHV9pqiIHxh7rJvyBrYHvXj3b3VzPKrxYgd/ux4xttDPhKOXEkwnWXncQ14B4dMIULMMhw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR08MB4544.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(346002)(376002)(136003)(39850400004)(396003)(366004)(451199018)(4326008)(5660300002)(8936002)(186003)(2616005)(6512007)(26005)(41300700001)(7416002)(1076003)(6506007)(36756003)(86362001)(44832011)(2906002)(83380400001)(107886003)(66476007)(66556008)(8676002)(6486002)(38350700002)(66946007)(52116002)(316002)(54906003)(478600001)(38100700002)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QYa908kkTbzTbguBwc4FKaa6X4cegQhxRPCYoTBhnTuLcdEyu1fdC1gThmvIwlouA8lpuYS8h+k3cPI8AGEeoUt8t+KXrgWz+QVrPCHEnju2tc9dRjiVRCDFZ04AwpCybLbBr4yzVah9dHQ5oDzXogb93LOrckrJ5xoP9EHcxhl67mtt60EfCa26f1OGQ6TztQanhls+PGcgCLXpM71pjb6JY+oHHIeqzq8DZBhKSzfaBw4qxpEoyAT6qNKfmcxodY1KPO+QphDiTxEjCYYu/u6E+F1FJGFzFB/VyhPScJ1slfGEQfRq7h9k2oPoBlgQOUCWoLiIX9jbBmg+x731cgauJ1lFFwOgbk1onqCNgExBvhXHOlvH1dnNuOcP61JaNR+9h6Di8K6dAYHmjlZocE2IMJTbrGyz1HfPro+fnK3Ekru65XSmXiv6u2xxDpMeb138bbh9UVuw0/Cot+JvdPYlYi0ns/ys2sOFEHLFZ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JVJmbFk4q+RAU5gaGnAlx6PeTLbeAkkBLoguCWqkX4Xfzxl0Z2XhUptL/S91flPQO+NfOcE5PibfIciPCN8= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: 9a78a561-16e0-4845-d4d7-08db24833b4e X-MS-Exchange-CrossTenant-AuthSource: VI1PR08MB4544.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2023 11:57:05.8488 (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: 7ChySRemAmWA5388k3lGjCa2whxpBFXZGDbIZtDDNm2HmUxvjEjgzbmUwqxDeTWTwC97PHhr2Rd6GavdDsEl5BxazHVbcOGoTm/zGSZmqKU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB8811 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760345283308417263?= X-GMAIL-MSGID: =?utf-8?q?1760345283308417263?= From: Michael Riesch Determine the orientation of the display based on the device tree and propagate it. Signed-off-by: Michael Riesch Signed-off-by: Gerald Loacker --- .../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 9535437271d3..5d4542c12f44 100644 --- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c +++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c @@ -117,6 +117,7 @@ struct st7789v { struct spi_device *spi; struct gpio_desc *reset; struct regulator *power; + enum drm_panel_orientation orientation; }; enum st7789v_prefix { @@ -171,6 +172,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; u32 bus_format = MEDIA_BUS_FMT_RGB666_1X18; @@ -193,9 +195,22 @@ static int st7789v_get_modes(struct drm_panel *panel, drm_display_info_set_bus_formats(&connector->display_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); @@ -351,11 +366,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) @@ -387,6 +403,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;