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: 13340821 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 86C95C001DB for ; Thu, 3 Aug 2023 20:14:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3157C10E21D; Thu, 3 Aug 2023 20:14:13 +0000 (UTC) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2079.outbound.protection.outlook.com [40.107.8.79]) by gabe.freedesktop.org (Postfix) with ESMTPS id D715010E0E8 for ; Thu, 3 Aug 2023 20:14:04 +0000 (UTC) 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 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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RGDc9d7xX7CNuC023MzYEWEyuVjpLPy5Rx1qpb/ZB3K7?= =?utf-8?q?ykVcEvwjdQoTrsCCfJX+I1wYrMvXeOpTGpN5iF0ndI97YwopCpewqebvXT70shH97?= =?utf-8?q?wb6i7mld10xQaCJ4MFqbI/R8Cr1an9gQ4wf27m1DZtsdqddF41cMm4f7EyNL6EFyQ?= =?utf-8?q?MDYao9gN2jRfI5DkK85ZZ2jQtTKS0mf28y3sSFH8ZvandHvO1k3j5DLWAm9fjRYcx?= =?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-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. 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;