From patchwork Thu Aug 3 20:13:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Riesch X-Patchwork-Id: 130867 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp1423007vqx; Thu, 3 Aug 2023 14:45:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlG+GCTB71/8SLrbFLqu4wHCFLxpZ9yYAUAcWL3YkgIFBsluLUM1tEWUfv19SX+g5F9/criH X-Received: by 2002:a17:90a:3d84:b0:268:40b:2e03 with SMTP id i4-20020a17090a3d8400b00268040b2e03mr16174724pjc.4.1691099138746; Thu, 03 Aug 2023 14:45:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691099138; cv=pass; d=google.com; s=arc-20160816; b=k/yMmsexUNCghu6mz6QNVyqo3P9adZ0yWUu/w/UZRHD7XpyyGJqtYTHnF1Oe3wZ421 HiQsTslWJuWtyfwPw316qcrX9ehJbagYxK0GzxZf9VLSle2mjq5gzoTfYm6zpemdLe/Y P5nhKyExo/fsHxRgjwLHrJ9xnkXWkM1kLsiA2hf/d0zDvhK73b606Z5KfaZtWrHRcsFz CG89RjuevuKjRa5CoCFM1omupAiLeCU3UgkFdwva+Fh2Udklg6VxUe0uP81S7jp8FQ2x 9ROAeCB7z60j9zMPlGeDkeS+lW2mP+CRKbNs6nKJcyglOo15gqg7bOf4VkuzdeZaV2VM lzUA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:cc:to:in-reply-to:references :message-id:content-transfer-encoding:subject:date:from :dkim-signature; bh=l6/2iniA8O0andcTwDOuMihh4iRLN0psaXlKy0CoB64=; fh=uBQ/eZ/jRuUMDwMCxYwGBCKZ7zdnORoPmoAmJnmuwpU=; b=ksYKvgNxo6nFjmK9uQec5x7r8J1NTRicRSDYn2wPLKc03geVPw8Mm/TmGcBqqEFLUH t1E+gbtlNwQdkN0sm5ifiRira0vhJMTGdjHReH9VvHr6bmJr3t73yMJeHT6tX6scvruu mo9JJblx0q5RYVxIe5RoWKIOmozamZRql706rKx/j1hHqFcSwZCLBAkAInTSzewykl7n yCazrsH6Ccm680TLIwLbcLUw4tx43jCcSRDoOCrhThI5z/sRC0VdkryO66odhaRB17GB zNKVCGHuMKh2j++mpIT+qhs9L1FtlbOs6V4XSMbm0zrBrXmXZSX0ttF6pVJA1AkUWpIa Im4g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=0idcW0Rn; 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 m4-20020a170902db0400b001bb3316f71dsi641256plx.481.2023.08.03.14.45.23; Thu, 03 Aug 2023 14:45:38 -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=0idcW0Rn; 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 S231960AbjHCUOO (ORCPT + 99 others); Thu, 3 Aug 2023 16:14:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231859AbjHCUOG (ORCPT ); Thu, 3 Aug 2023 16:14:06 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2044.outbound.protection.outlook.com [40.107.8.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 946651712; Thu, 3 Aug 2023 13:14:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NAVApeQy4zKnEZVY5wk3ZBqBJdLCbBTah5Q4znYvvR60h1yMZL8bt302r2IVNyPUKCaKWqn8euzhak8Q7JXvyzjUcp2Z8pN3Bddu0ZHuPlnPwZYOukwnQg/9WWeBNEyWJBE2EXpQZg75XHipCkXWt04VeICTvnqStgTUoIZq/fxwbiCHnioc6+oULzwaP3F7XjQxW1PC+MT4hSShGbdq+JvuLKNMpvX+9wtjSHevPZSoDnwuU1ojOXLA4VE9KLZIJFwMxhM7d+O8irzk8S7+yk+/sUhVN4A98JhwljEUcLEp4I1/z/A2KltU/NqviFiEOwu0McRAYhMxmZG5A6tEeA== 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=l6/2iniA8O0andcTwDOuMihh4iRLN0psaXlKy0CoB64=; b=nmMysDniKINo2bfuUONaGgHkdBrb/zMM9s7kPzD9ESj4PislrMTQJlOXiroO7eqKjbxMSHoA9Z8mAvLtFgWqZwlTN4gmcVq/l5wOKPqBQubjgN5iD9nc6v9bl68fDHF5aQeMVMf65xDaz7FWCkSvs4ouVIpA0NDWpW/NoXZnLFDn5mMow1rDzNGd1Bp7BW3PvJzOxn4XPkq4V5FaGglblP/dxmxJvQkWxoKJ13mIC642+rGZYkXRESbTEu9mdQK0a30UcYl+NH/MfBNJMuAlwvj7J+miVoTpajJPcRuDJ3LA9nM3YdUgYXN8j6FkL9IKvsMv0rhBDfLXGEG2//+paQ== 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=l6/2iniA8O0andcTwDOuMihh4iRLN0psaXlKy0CoB64=; b=0idcW0RnxIC6rGzXe8D3tao0d3cmHYK4RtoUH59fsUCFrYhSXJLsNpcCuC71wbFQo2NgqsuOv0rKVuF+fBUiimUwx+Iq/pStP6EVTKSh29PNIS8RuKUr42wWIVXDUGW1/GhBDmhwawEiJr86Sw3IW1gjPsIodnj6HLK7BsMZkXo= 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 DU0PR08MB8277.eurprd08.prod.outlook.com (2603:10a6:10:40f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.47; Thu, 3 Aug 2023 20:14:02 +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; Thu, 3 Aug 2023 20:14:02 +0000 From: Michael Riesch Date: Thu, 03 Aug 2023 22:13:49 +0200 Subject: [PATCH v2 2/3] drm/panel: sitronix-st7789v: add panel orientation support Message-Id: <20230718-feature-st7789v-v2-2-207cb1baea0f@wolfvision.net> References: <20230718-feature-st7789v-v2-0-207cb1baea0f@wolfvision.net> In-Reply-To: <20230718-feature-st7789v-v2-0-207cb1baea0f@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=1691093639; l=2273; i=michael.riesch@wolfvision.net; s=20230425; h=from:subject:message-id; bh=eiS9/88u4XxZT6MMZeo59P5+V2nbWgGsv8Uu0rvAgNk=; b=Qt8Jb3TGp4g6yriM2yjgA5uc12NKd5fgcKaOXAFjAknYqpxuHxxHD5naj5OlKOCT+fTRj36A1 C6DInwu9HGlBQsPgr+zvCbhkkw73M8GF8CWZ6a1CMIQcat22VlfP3D7 X-Developer-Key: i=michael.riesch@wolfvision.net; a=ed25519; pk=1QQdXA2QbwdxaQn/VQK0hz04C8IBYhDowbK0hlNU4Ng= X-ClientProxiedBy: VI1PR06CA0212.eurprd06.prod.outlook.com (2603:10a6:802:2c::33) To DU0PR08MB9155.eurprd08.prod.outlook.com (2603:10a6:10:416::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR08MB9155:EE_|DU0PR08MB8277:EE_ X-MS-Office365-Filtering-Correlation-Id: e648029e-8b94-4918-5baa-08db945e2dde X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qBDoy4rqgNBvvQk0DXTFZh3Y1FcelufOC91QXJ/jK9lfNhQHjMP1tWMdLSKiR5JQHcY1HAZboZe8lrXPK6TeuCB7BFubfOdjtEJYJrghyD3A3mFr7RsX69Y6kX73KlWqUCdNyiOX0GhhELl4EI+2f8WQASEkqlJqj1HxZNEGVxBmUrSLgjmIyvTavpoIZWZ2zNBLZ+G/1r8XTopa2wKvRb02GJ4R5AyuOfTq0DqshAnqBuAh1E+GWShLuQX56VIyjvXEdEp6s2KEFBCuPkSTlq8hd1IQ5ewhH1eOTPDQaC7JjjFqmBeueF0rTSnsUvEDXG6v0Fg87Lb9JOgftoRuoJh3JGFGcgFdbv5sbEEJ8AZ9nM+Q0lsO2WI/CUvq3QhtNmf6abjnHpcybHVR4M4VevjaF10nyIPv85ulPj3eqZmJ1gE38JnCZbB2YqLg+dpFhOZCQabo+rg3TW0wLmmKLOnVizrlCvWPgmlC/2qaf85kJul6jpuA5/tpLY3sklv32rwkBAzgWQERaZC+HeuDCr+KmzgWh3iLcEFP+TPkw16TjtIg9ei2Usl4xWaNjOqjbGocNN44BUFr5EvpLvJ+mKwCMv0avqb3Ox6PParu6aN0e2M3TqddAQeNm4g3QYQlhU+YbGeCq0fwc+v0YhMdtA== 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)(376002)(396003)(366004)(39840400004)(136003)(346002)(451199021)(2616005)(107886003)(6506007)(186003)(8676002)(26005)(66476007)(2906002)(316002)(66556008)(6636002)(4326008)(66946007)(5660300002)(7416002)(44832011)(8936002)(41300700001)(6666004)(6486002)(6512007)(52116002)(110136005)(478600001)(38350700002)(921005)(38100700002)(36756003)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?0M0lrx2CBLOhhASLz76Xfe9LxcSX?= =?utf-8?q?XvEiluoMEqGgVUvrO21fgDAO1YURy4DK61y7zms6yFXgVyV4XK9x80zdFcQs103u3?= =?utf-8?q?P9NRYL7Dpc/WhUVQbMIbRa3mkz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85ZZ2jQtTKS0mf28y3sSFH8ZvandHvO1k3j5DLWAm9fjRYcx?= =?utf-8?q?pzUmKbqEuEjcrFVGXwrSQmhZWu+uzequX08PYKNYdGz3tnBJRYtA6nq07REF5scQ9?= =?utf-8?q?UCDVmCtvGxhgfWubt4MCX19n1yh3GRE/Qe+uW2YcYLTKbprQfeRLi+LhRDbpmmrHY?= =?utf-8?q?5rR7mCE48/quVp000kbftfPPL+Sn3wnchRFRmzIYoidBHSLa3KPyO9ArB0V6xOh84?= =?utf-8?q?Os7VNzMUYI84LvDVeUkC04GWwg3NxLgzeyz3XaLZiX0trG00HeCzX/zJHpVIY0GXd?= =?utf-8?q?Nv21z0pc628ih7s76nk9jDxpny0glKmMRCDlrEgtjU35PM3e5UfYZgHa3QfKSBPVi?= =?utf-8?q?06nA6A3x7jIxMrD3c5mjYMlSuzFv5hL1KlMyb678IOwf3SwLJ+X0GbhZkEPBjsjNu?= =?utf-8?q?+ybohvUq4I6O5dVPykEMusx32kYveOOABFwWOEG8YNcIa+Xj5fe18UyjKGh/F85aw?= =?utf-8?q?LxDePgbm9JJy1u2JNObzls1z1U/LHKsR2e3LTcxptw5VtTRNyyowMKTwV0B7QqAiF?= =?utf-8?q?rAvQ0aYK3mthOMPMgMJUp/iX+zd2/gZRWg=3D=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: e648029e-8b94-4918-5baa-08db945e2dde X-MS-Exchange-CrossTenant-AuthSource: DU0PR08MB9155.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Aug 2023 20:14:02.1358 (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: +9QVD71lflZ6IhpCt68rvQwNiQAQoXbJjz3FjJ0af85TFdFuhhXU3GAUo1dxIDApLJoFX+XjLcb6iWSTcNs1a4jXHcsDzREMZ/JZQ/U8FjY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB8277 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1773243995283965611 X-GMAIL-MSGID: 1773245970661757967 Determine the orientation of the display based on the device tree and propagate it. Reviewed-by: Neil Armstrong Signed-off-by: Michael Riesch Reviewed-by: Sebastian Reichel --- drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c index c7cbfe6ca82c..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); @@ -349,6 +364,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, }; @@ -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;