From patchwork Wed Apr 12 19:46:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 82662 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp570273vqo; Wed, 12 Apr 2023 13:00:12 -0700 (PDT) X-Google-Smtp-Source: AKy350Z2AN00aIdEPzAxMRksjmjrtWX2HQWJ/Jzy66yjYohduoDazWKrGLm+aH5YjgqvCz386x+A X-Received: by 2002:a17:90a:d155:b0:23d:3913:bc26 with SMTP id t21-20020a17090ad15500b0023d3913bc26mr484520pjw.2.1681329612046; Wed, 12 Apr 2023 13:00:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681329612; cv=none; d=google.com; s=arc-20160816; b=lTaLG5IpdLXo/XBxmZRn2q+Z0ou4YvqWJUK26adhS5/zAejld+K5uqXpJvOxIjiz4d T2ALFobGCEfkROR2QGt933AJ651hZhqL3gcIjzAW56dqpQtoifOj4tbzJ5dVtXteoVxH +eSmsGInRRWk7FhAsewtTXW7iOmNvq4BK8aBhlE9ipTFM4pegy9+ZrUnWmy8Voq3s/DK mKj7ytcSUW55BalWN+5TGvA6aS4JcdXJyASQUgBFMDaKIf1WZIOtTIHnXt33Luahk5Hu xJB2BhWco1NETdx8l+0sCibYMS3vbmTRpj8SUq22RGZftjaeGkJTJ0dG2zm1bea89F6O MLJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=iRmV3ZbptyRzjNEUKN3cUqrgquOQ4fNh4NEQv3SzN+Q=; b=nWZqin1V/yhJ+YA4gp6dx1UPmfymATxyi8GvmV6uQmspIxsGvAvgqO7kcNmGcaerxi FvWOxUlKAnbgjLDtwW/kQ2khoh3DoYSjoQ796OVEGirQy+niV/wXThsHWMiNQhpPtWAT zachUvrSHt20bKn3/Ub0po4iuZzzh4sX4Rx7rgRL9A9WQ2VucaUd2gelENZqX/aioreq ZA5Op9fIoGeaY1pk17OrFbJmeJO6NKtjB5ul0Qbycf2J2i9evzGazvrctgvVg/kDtmjF DXMYbCrpYLPim/paUiTEa2xwIh+Kap2Ra8DKn/Qdvq6bEOM3i5SuP1YulBEmjKn/VRfq yaQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GoQkyT6N; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t5-20020a17090a950500b0024664356ef7si2615253pjo.152.2023.04.12.12.59.58; Wed, 12 Apr 2023 13:00:11 -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=@linaro.org header.s=google header.b=GoQkyT6N; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229938AbjDLTqa (ORCPT + 99 others); Wed, 12 Apr 2023 15:46:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229517AbjDLTqY (ORCPT ); Wed, 12 Apr 2023 15:46:24 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D962A6E8F for ; Wed, 12 Apr 2023 12:46:17 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id t20so16111906lfd.5 for ; Wed, 12 Apr 2023 12:46:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681328776; x=1683920776; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=iRmV3ZbptyRzjNEUKN3cUqrgquOQ4fNh4NEQv3SzN+Q=; b=GoQkyT6N0Y6moHhgYdP68L9f+lKcTaod6XOvgbDDI0g9iwqIOBW7GWFmkp8nK1DKe7 0yW1GGSi9g74x8J7+QkDzghmWIQNzPNNnqJCAVmlZekK2PrLOd3bhq6vDcohjLffhwGC 5MgK8c2K7qkkO9gNjfjWWgby7xpo+LYJcGSSsZc3HO+1Bf69tfGyyGSLctMNZA/NFDSS gDIQFf6oUj4KKricwOXub2SkE2qyN0AfsbI9FvBwh5+lHEZmTu39f5KvPZISoV6D5h3z W2t/gicK62AJEXrPwL3xeAKvyUUrtGdCjidq8rGQYUwdZYB8/Q72f05e9FCLsnPceUQS /TrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681328776; x=1683920776; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iRmV3ZbptyRzjNEUKN3cUqrgquOQ4fNh4NEQv3SzN+Q=; b=Z+HfBb3+LDYoySrtrnC1sJ8FH3JntGLUJuButkRZ6/8XM9fpv/7WCU1q3EmKAgwrmt HnnLcbVvKYnpKKZMej/dwFYUZGC8JLq5O1SYOHB3PHUXgGZgGoyzmB9q/5oJj38JlHbp w2jJkAme1tHrzvg/eIvQKJdY57iVFA0IqM1H4fUYZcyvpKgrG/ka0z4s6drPNonOQlI+ VzkGImMn7edcjG6RJmoDsUmAThPXFCcPPIq6rgGn/VHTTmXZkWVJ5TavbWRo/t3qxuub xL19TKFa20ou6HP4FWBkCpCL2u8V0xE1kvw6d1ulchEeh4D088mtPpKP+FAJBHxc10Rs k3nw== X-Gm-Message-State: AAQBX9e03l0X3383s6hwOFjfP8XE57BEl8GfaGn5U/+t7vUB6G1MnJWn 3JZRDUBcxU88yLmjq59Mv1o7FQ== X-Received: by 2002:ac2:48ba:0:b0:4b5:649a:9105 with SMTP id u26-20020ac248ba000000b004b5649a9105mr7037lfg.65.1681328776198; Wed, 12 Apr 2023 12:46:16 -0700 (PDT) Received: from [192.168.1.101] (abxj23.neoplus.adsl.tpnet.pl. [83.9.3.23]) by smtp.gmail.com with ESMTPSA id x2-20020ac25dc2000000b004ec8de8ab3fsm1205865lfq.132.2023.04.12.12.46.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Apr 2023 12:46:15 -0700 (PDT) From: Konrad Dybcio Date: Wed, 12 Apr 2023 21:46:01 +0200 Subject: [PATCH 4/5] drm/panel: nt36523: Get orientation from OF MIME-Version: 1.0 Message-Id: <20230412-topic-lenovopanel-v1-4-00b25df46824@linaro.org> References: <20230412-topic-lenovopanel-v1-0-00b25df46824@linaro.org> In-Reply-To: <20230412-topic-lenovopanel-v1-0-00b25df46824@linaro.org> To: Jianhua Lu , Neil Armstrong , Sam Ravnborg , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski Cc: Marijn Suijten , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1681328765; l=1963; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=03x2QxCFOJ92tJUVDwn0/WKNOzd6yyjZ3Pdc9Flrqao=; b=bOzS7MQebAJyIKNBJY3A7fnCKU5niA9Qy5YrlRr2x0jODxMc3uyB2h2x7P0KnBW0UcoLPDYXQUe4 hhp5Aq77CF6aPHBYweuvlRFzFViGdpbDDMSpEjgLTDAOS8Bxu4bA X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= 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_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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?1763001879415843612?= X-GMAIL-MSGID: =?utf-8?q?1763001879415843612?= Some bright vendors mount their display panels upside down. Add the required pieces to allow for accounting for that. Signed-off-by: Konrad Dybcio Reviewed-by: Jianhua Lu Reviewed-by: Linus Walleij --- drivers/gpu/drm/panel/panel-novatek-nt36523.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36523.c b/drivers/gpu/drm/panel/panel-novatek-nt36523.c index 3c81ec014eef..db4b4af13ec1 100644 --- a/drivers/gpu/drm/panel/panel-novatek-nt36523.c +++ b/drivers/gpu/drm/panel/panel-novatek-nt36523.c @@ -31,6 +31,7 @@ struct panel_info { struct drm_panel panel; struct mipi_dsi_device *dsi[2]; const struct panel_desc *desc; + enum drm_panel_orientation orientation; struct gpio_desc *reset_gpio; struct backlight_device *backlight; @@ -674,11 +675,19 @@ static int nt36523_get_modes(struct drm_panel *panel, return pinfo->desc->num_modes; } +static enum drm_panel_orientation nt36523_get_orientation(struct drm_panel *panel) +{ + struct panel_info *pinfo = to_panel_info(panel); + + return pinfo->orientation; +} + static const struct drm_panel_funcs nt36523_panel_funcs = { .disable = nt36523_disable, .prepare = nt36523_prepare, .unprepare = nt36523_unprepare, .get_modes = nt36523_get_modes, + .get_orientation = nt36523_get_orientation, }; static int nt36523_bl_update_status(struct backlight_device *bl) @@ -784,6 +793,12 @@ static int nt36523_probe(struct mipi_dsi_device *dsi) mipi_dsi_set_drvdata(dsi, pinfo); drm_panel_init(&pinfo->panel, dev, &nt36523_panel_funcs, DRM_MODE_CONNECTOR_DSI); + ret = of_drm_get_panel_orientation(dev->of_node, &pinfo->orientation); + if (ret < 0) { + dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, ret); + return ret; + } + if (pinfo->desc->has_dcs_backlight) { pinfo->panel.backlight = nt36523_create_backlight(dsi); if (IS_ERR(pinfo->panel.backlight))