From patchwork Thu Apr 13 10:09:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 82900 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp936271vqo; Thu, 13 Apr 2023 03:42:47 -0700 (PDT) X-Google-Smtp-Source: AKy350b5S0ofEWdGoMrVmj5IN+hRq8LOw/OIf3FCQw4EOLtxmr4I8wybiF64sdEbh6F9WEfSEr/1 X-Received: by 2002:a17:90a:550:b0:23a:87cf:de93 with SMTP id h16-20020a17090a055000b0023a87cfde93mr1626745pjf.15.1681382567590; Thu, 13 Apr 2023 03:42:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681382567; cv=none; d=google.com; s=arc-20160816; b=YTFJ2CZZ14izIoM4n40ZH0nWU076VXQ4GOPyxlrw33wAGVH371pveZjPDxdYSQMoSh yuf8N/HLbK4wv6U4CMtLSMdoxDESC34u8hxYTtzfq/S5vBF7oFpHcH6IQd7+W/jvNVey rALrT8k/YPyNOrluU/J4xEFY3A2LKFb+OlYVvfWMlwDez9gmByot6w11z2JdQ5+6ha9U u2WQ9ePvNEbOm/sYBccN75pEq42pdWmFuxhOf7iAS/HeWzZ6RE21CkvtiGcnIaHj+iFa S3eV9Iq37u67mV/JHTDQr0fvcuVceJpmoZgD1CaK67JOzjvqnKGJ4lcv/bmn0nfj/FeF 5Rtg== 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=vfZDVg8acR2SKXDmnGE2uGGT4RT4YcuN/C99IcV99uQ=; b=qo6ZPjxH0+lHhY0lbptyY6pBl75BAcCoVCngJUb6yAvkZuc2Za/QcomPk79upATxD+ JWMkBAhtV0sMmknUtBKY41A26HPfMuOZByECHMOM1Zjm1mexEQnkrd2Ogqh6agDVAybf c+fAgU6a3dKsrJJRStLVF+i2oqh/ug/iiRD7WTRaSYVSMNFEExdoSPAlnGSUhVQmGxxH mZP3DzkD6hzt9bmCYrB0TDOoKlMDUwTaerYSejl1SFBipbdWTlyLbPGTA6Mi1Q8YtFm1 C94j7i6yG3K+Zq2WAT0A6hZt59bOXEjv879cNDpyXz2g6+W2HcTFIK0rJBSj+Obz1dl8 RvPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yoIZyZsf; 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 my14-20020a17090b4c8e00b0022bbae722fcsi7030064pjb.1.2023.04.13.03.42.35; Thu, 13 Apr 2023 03:42:47 -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=yoIZyZsf; 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 S230265AbjDMKKW (ORCPT + 99 others); Thu, 13 Apr 2023 06:10:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230306AbjDMKKD (ORCPT ); Thu, 13 Apr 2023 06:10:03 -0400 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E8C5975D for ; Thu, 13 Apr 2023 03:09:54 -0700 (PDT) Received: by mail-lj1-x22d.google.com with SMTP id z26so14363726ljq.3 for ; Thu, 13 Apr 2023 03:09:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681380592; x=1683972592; 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=vfZDVg8acR2SKXDmnGE2uGGT4RT4YcuN/C99IcV99uQ=; b=yoIZyZsf2D48M0on5TQwKa4YD+zSyd27GfpCqwZLEslsnC5xR1+CAWvy4JxDSt3+Rr nMhmrRR3yV/xYyaaHllXKEP0RixpqM5Rz0d2xDlMV/CT3uXpFuQcfio6uQV6STeOb32n g2Ddfbmv+ssGXCaTM7plOi6U4hkLm/EeWbZAT8JqE3Cy7x4UTZB7MC0dmbup5+gqhpOK cC7j3GZC8CVl40Lj/uCdtEwKWA0bo8N9x4C/Ex7yczjy3RR4hxUtbXXMs+KkOjR+Nooy nJxog04TpTbI5oERIgGSjFZO4TiQuF7f7K3vjlmSRTublVe6J9gMumQm54NzF/TJkLKX X6mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681380592; x=1683972592; 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=vfZDVg8acR2SKXDmnGE2uGGT4RT4YcuN/C99IcV99uQ=; b=ikijrIavf/ttIfMCyMhGykMlFJn1RoMUI5Yc4/Yl7hIwlw1bAMWuvRR5PQEwLC78co aG9mtZAuW6HQozzLi0c4GyrcyckxWRaP/wwXmWx/RNNcg7zXdeoCzEPWmWuZyatYUkN3 BG8SfrskWituXRew6QmnJX80huTFvZJTLJAPkALJ+e4iFqdXqk/ojeEyrTNS1xmBrFyU 76xXklThH9KGRvjFYOAZAegS67MSbVEt+pi4ERMmTAEorEhfY1jkNjUXGZ5D08H1qOtA 9E0uwJ70z3HrQVuRyfW2DGlmJ5uYd2CtFsqHh7bghKOI3judTZx5qp0kL5Peb01nCllN wLkQ== X-Gm-Message-State: AAQBX9f2/AQHRsUsdGmh2BYqGUs8wJviEzKc5oX+zJJZdHQMRS5Fwi1E EqGEJp/VhNO5em6+v8bahrq+nA== X-Received: by 2002:a2e:81cb:0:b0:2a7:7493:9966 with SMTP id s11-20020a2e81cb000000b002a774939966mr495603ljg.24.1681380592573; Thu, 13 Apr 2023 03:09:52 -0700 (PDT) Received: from [192.168.1.101] (abyl123.neoplus.adsl.tpnet.pl. [83.9.31.123]) by smtp.gmail.com with ESMTPSA id t20-20020a2e9d14000000b002a2e931fc48sm200482lji.140.2023.04.13.03.09.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Apr 2023 03:09:52 -0700 (PDT) From: Konrad Dybcio Date: Thu, 13 Apr 2023 12:09:38 +0200 Subject: [PATCH v2 4/5] drm/panel: nt36523: Get orientation from OF MIME-Version: 1.0 Message-Id: <20230412-topic-lenovopanel-v2-4-055c3649788e@linaro.org> References: <20230412-topic-lenovopanel-v2-0-055c3649788e@linaro.org> In-Reply-To: <20230412-topic-lenovopanel-v2-0-055c3649788e@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 , Linus Walleij X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1681380585; l=2068; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=pdWLeHccDvo0CLmZJATdV9aHqMgeBmhMVIeYiCuYKCc=; b=J9jLVmM5Fmo3NkhY+AmFIW8debKry7SOp7UC2XycgFy9HPrtm6VIgt5CvlaTp8ztLNMed3i/i53X /XFPdc++Aqs2x94p5vy+Ed6jqzlhe0OrlR3YG8C9+uheXp6Oa1Ul 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=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?1763057407423678379?= X-GMAIL-MSGID: =?utf-8?q?1763057407423678379?= Some bright vendors mount their display panels upside down. Add the required pieces to allow for accounting for that. Reviewed-by: Linus Walleij Reviewed-by: Jianhua Lu Signed-off-by: Konrad Dybcio --- 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 b0466abae812..2c5712ac3037 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) @@ -785,6 +794,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))