From patchwork Mon Apr 17 14:39:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 673977 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB697C77B7A for ; Mon, 17 Apr 2023 14:39:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229555AbjDQOjP (ORCPT ); Mon, 17 Apr 2023 10:39:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229988AbjDQOjN (ORCPT ); Mon, 17 Apr 2023 10:39:13 -0400 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 699FD1720 for ; Mon, 17 Apr 2023 07:39:12 -0700 (PDT) Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2a8c51ba511so6643331fa.1 for ; Mon, 17 Apr 2023 07:39:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681742350; x=1684334350; 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=mdXWnGN+qNaKraWMowQcC4c2XYV2qj6ZAg8aQ/wfVg8=; b=KE70/DF+2q+0fF/nJxKBvmnI7Wmms5EeVkDWdDNxeDaj0ZBUejawCRWxWx4vtZ+hNi BNAltsZoMzIIP6S83V1MS8G8bcXGKjlFxXpefTVQjc/WJeFiyfjIRbf79RxUMy8wob4C rkv1V4bhmS6XQMKd80T99g9JLZMHqsSGIC7DZ0vIAVKE/+my6RtalI2olaYyhqpz8ny7 ZuSaIBP2DAmdNI+lkz5tns1UtGAbmsgu3WRD6Mg13zExIhALtpdbyI+mqZtvnU0BpNBk 57NXLeXzLMes6TWNUn2xbBo9u/TXUsG+xsbqxewCH3LEJP5GRv/+y3BZ3PDNTI9CmwYN dMVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681742350; x=1684334350; 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=mdXWnGN+qNaKraWMowQcC4c2XYV2qj6ZAg8aQ/wfVg8=; b=GsJgJj/lElpl4Ba8fh+q4x/mxOiD/b+gpFjO5NkMnANX8PRwmn7z820dSlkXdwodjk nlocWhVqdnbJRpf1fG+cz4vpkLMajs5MIg6LMgalRfcngV9fzL/yPoRHqvhf5IzsVY5q MRAmklEAg+uCjNzE5g/A2TUGPk73khZ4dPdAz1XINabXdzRnGIuclggxJGwTsbmiou0a QxG4oFv6lgNDQ6+AlHjsF7I/QciWBGJy42gMupyCiuIC3QRlf9bo4lmydjeABRb6SUti B40Qfm+IKO9GepWPnvcBTm/B+JQ/5ICPAMCGF6KDO87PUDNpwUPj/tCGZySejzlhc40j yThw== X-Gm-Message-State: AAQBX9fhWoWD5T8Mhphx6ftfq5CuvKGwALR5Q7s/0coyMi9fc3NtceIP Loe438KXKr/XlUKrF0d59iEh/rUzj9kE8+S9Oxk= X-Google-Smtp-Source: AKy350ZZs22FrJ75JOjYRqIRCK5ZMCb8gc7SCMH/uKo6ba7IcawT04XjUUO0OH9a2hT83fV2phplbg== X-Received: by 2002:ac2:532c:0:b0:4ec:81c7:119a with SMTP id f12-20020ac2532c000000b004ec81c7119amr2299538lfh.3.1681742350540; Mon, 17 Apr 2023 07:39:10 -0700 (PDT) Received: from [192.168.1.101] (abyk99.neoplus.adsl.tpnet.pl. [83.9.30.99]) by smtp.gmail.com with ESMTPSA id 2-20020a2eb282000000b002a76b9e4058sm2235785ljx.43.2023.04.17.07.39.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 07:39:10 -0700 (PDT) From: Konrad Dybcio Date: Mon, 17 Apr 2023 16:39:03 +0200 Subject: [PATCH v3 1/4] dt-bindings: display: panel: nt36523: Add Lenovo J606F panel MIME-Version: 1.0 Message-Id: <20230412-topic-lenovopanel-v3-1-bcf9ba4de46f@linaro.org> References: <20230412-topic-lenovopanel-v3-0-bcf9ba4de46f@linaro.org> In-Reply-To: <20230412-topic-lenovopanel-v3-0-bcf9ba4de46f@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 , Krzysztof Kozlowski X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1681742347; l=1499; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=5bPMRcgvavoc74XIAisYDrKLugQRhZ6brU3zPRYWSG8=; b=8Wd1zOxpgSAgmNNf1jSBv9gwguB/pPBp0P3GyRFUcGuVf4OEOfeSOjuiWZ/h5dCaAGZRurmMd0nI IrUkd+9sBdHvzpkvq0tOp2pG1CVO3hl8uxjejsOk5B1345tRlXh2 X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Some Lenovo J606F tablets come with a 2K (2000x1200) 60Hz 11" 5:3 video mode display. Document it and allow rotation while at it (Lenovo mounted it upside down!). Reviewed-by: Linus Walleij Reviewed-by: Krzysztof Kozlowski Signed-off-by: Konrad Dybcio --- .../bindings/display/panel/novatek,nt36523.yaml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/display/panel/novatek,nt36523.yaml b/Documentation/devicetree/bindings/display/panel/novatek,nt36523.yaml index 0039561ef04c..5f7e4c486094 100644 --- a/Documentation/devicetree/bindings/display/panel/novatek,nt36523.yaml +++ b/Documentation/devicetree/bindings/display/panel/novatek,nt36523.yaml @@ -19,11 +19,16 @@ allOf: properties: compatible: - items: - - enum: - - xiaomi,elish-boe-nt36523 - - xiaomi,elish-csot-nt36523 - - const: novatek,nt36523 + oneOf: + - items: + - enum: + - xiaomi,elish-boe-nt36523 + - xiaomi,elish-csot-nt36523 + - const: novatek,nt36523 + - items: + - enum: + - lenovo,j606f-boe-nt36523w + - const: novatek,nt36523w reset-gpios: maxItems: 1 @@ -34,6 +39,7 @@ properties: reg: true ports: true + rotation: true backlight: true required: From patchwork Mon Apr 17 14:39:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 674777 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFC24C77B70 for ; Mon, 17 Apr 2023 14:39:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230453AbjDQOjY (ORCPT ); Mon, 17 Apr 2023 10:39:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230101AbjDQOjP (ORCPT ); Mon, 17 Apr 2023 10:39:15 -0400 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4DF592 for ; Mon, 17 Apr 2023 07:39:13 -0700 (PDT) Received: by mail-lj1-x22a.google.com with SMTP id e8so8521580ljn.2 for ; Mon, 17 Apr 2023 07:39:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681742352; x=1684334352; 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=8VxPnjG7Ga3tmIOUhMs54Sv+8hbNOJAgCnpbXzAxobQ=; b=cWWVykdxAAPEOQp1ZbmWCBdekcLthpzNRIBJ0OL9IqxWeOgEwmiJOXokKDa3PtB9t5 krOAF+aYZoK4lP0/5yZLFSEJNcuBWFAvj9ZWKt9kvysGz4Oxh9W3tbNNlTW9IXCp7DUM 2e29F2kkaEKqMWPLQUlAcaZWV7JcRBMGjW1BFJ4JjVtV6Cb84+TIZfSfjrgTiShRjksn 06s3Nu8O6KgxCzAWCapCPLaoHuvW9Xzl0HXKYAsNNObWL/I4RiU72v2f8UWfJ7Qzuj8V J0cWzQ3OFxvB6AVgwL3OQE6oM96zxgcrfFMwfa1yuzRDrtD3hjK986sJ0L7tFmASLV4d lhFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681742352; x=1684334352; 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=8VxPnjG7Ga3tmIOUhMs54Sv+8hbNOJAgCnpbXzAxobQ=; b=GkwCnMxd+7zwDT9ebW+2cY5YWWn1jIS5fHV3UH2X3+9kCcO4Xvpbq6k4bt0sZwDuwt 7HcK7lEjG+AxrF3UmzVazQN3McmUCrjW4pvSFh5mY/qfY/ok4505lGEILmQ0RMWJXwsp UBeDy47iCC9AR1LMgphNn6MfR9Fnq5kjBy/p1F0h9og49Y9RzPsOFG6Bjv8Wrh98r3Rq miUPmwSuH7n4evbtxwCDp+Zo97UkRYH7BANKKqnCQiJ3ZF8MQSIZwXiHsErya2eWcVCN xsGC3OIBfAPMaVhaMPDitvGPHqBV23wBnJIzu22ZCXOsY2BoMvNg9tYjbnveYer4Gu0o 7cVg== X-Gm-Message-State: AAQBX9fAOFSspol3j50J1HUJBZI1RL+nSopC9NbhPv5jfr6Kh8FtvCYQ fvvV8YKtQJhMYAL9uwJBNELbd0lWmu0PbhOlKj8= X-Google-Smtp-Source: AKy350ZlDi5eFUrDRQBiRDXvxsZvLAbEbyX5OrzW/dZYUJBFRSY0Gw+UnZZbd+FQhTsOt34FsiKANg== X-Received: by 2002:a05:651c:c2:b0:299:bb73:fcd4 with SMTP id 2-20020a05651c00c200b00299bb73fcd4mr3707650ljr.7.1681742351770; Mon, 17 Apr 2023 07:39:11 -0700 (PDT) Received: from [192.168.1.101] (abyk99.neoplus.adsl.tpnet.pl. [83.9.30.99]) by smtp.gmail.com with ESMTPSA id 2-20020a2eb282000000b002a76b9e4058sm2235785ljx.43.2023.04.17.07.39.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 07:39:11 -0700 (PDT) From: Konrad Dybcio Date: Mon, 17 Apr 2023 16:39:04 +0200 Subject: [PATCH v3 2/4] drm/panel: nt36523: Add DCS backlight support MIME-Version: 1.0 Message-Id: <20230412-topic-lenovopanel-v3-2-bcf9ba4de46f@linaro.org> References: <20230412-topic-lenovopanel-v3-0-bcf9ba4de46f@linaro.org> In-Reply-To: <20230412-topic-lenovopanel-v3-0-bcf9ba4de46f@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=1681742347; l=3553; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=dc/Dvzhn8dlfyxlg6IxeHxMIzNiaOkMG9FE6LJmww9g=; b=iM8VjNqLvv57texCYnh0YJE0n+lyfH7nI3h1sLGMBp5uzmqK5nevK+/zKLyan9hqEhpXADSCCpNY Kr3lrPXxCTakzdTzZCvraHB5JU34qFIOk97eRqpgYUzYMd/GpSel X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This chip supports controlling the backlight via DCS commands, on at least some panels. Add support for doing so. Note this may only concern the NT36523*W* variant. Nobody knows, really, there's no docs. Reviewed-by: Linus Walleij Reviewed-by: Jianhua Lu Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/panel/panel-novatek-nt36523.c | 68 +++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36523.c b/drivers/gpu/drm/panel/panel-novatek-nt36523.c index d30dbbfb67b1..b0466abae812 100644 --- a/drivers/gpu/drm/panel/panel-novatek-nt36523.c +++ b/drivers/gpu/drm/panel/panel-novatek-nt36523.c @@ -5,6 +5,7 @@ * Copyright (c) 2022, 2023 Jianhua Lu */ +#include #include #include #include @@ -53,6 +54,7 @@ struct panel_desc { int (*init_sequence)(struct panel_info *pinfo); bool is_dual_dsi; + bool has_dcs_backlight; }; static inline struct panel_info *to_panel_info(struct drm_panel *panel) @@ -679,6 +681,59 @@ static const struct drm_panel_funcs nt36523_panel_funcs = { .get_modes = nt36523_get_modes, }; +static int nt36523_bl_update_status(struct backlight_device *bl) +{ + struct mipi_dsi_device *dsi = bl_get_data(bl); + u16 brightness = backlight_get_brightness(bl); + int ret; + + dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; + + ret = mipi_dsi_dcs_set_display_brightness_large(dsi, brightness); + if (ret < 0) + return ret; + + dsi->mode_flags |= MIPI_DSI_MODE_LPM; + + return 0; +} + +static int nt36523_bl_get_brightness(struct backlight_device *bl) +{ + struct mipi_dsi_device *dsi = bl_get_data(bl); + u16 brightness; + int ret; + + dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; + + ret = mipi_dsi_dcs_get_display_brightness_large(dsi, &brightness); + if (ret < 0) + return ret; + + dsi->mode_flags |= MIPI_DSI_MODE_LPM; + + return brightness; +} + +static const struct backlight_ops nt36523_bl_ops = { + .update_status = nt36523_bl_update_status, + .get_brightness = nt36523_bl_get_brightness, +}; + +static struct backlight_device *nt36523_create_backlight(struct mipi_dsi_device *dsi) +{ + struct device *dev = &dsi->dev; + const struct backlight_properties props = { + .type = BACKLIGHT_RAW, + .brightness = 512, + .max_brightness = 4095, + .scale = BACKLIGHT_SCALE_NON_LINEAR, + }; + + return devm_backlight_device_register(dev, dev_name(dev), dev, dsi, + &nt36523_bl_ops, &props); +} + static int nt36523_probe(struct mipi_dsi_device *dsi) { struct device *dev = &dsi->dev; @@ -730,9 +785,16 @@ 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 = drm_panel_of_backlight(&pinfo->panel); - if (ret) - return dev_err_probe(dev, ret, "failed to get backlight\n"); + if (pinfo->desc->has_dcs_backlight) { + pinfo->panel.backlight = nt36523_create_backlight(dsi); + if (IS_ERR(pinfo->panel.backlight)) + return dev_err_probe(dev, PTR_ERR(pinfo->panel.backlight), + "Failed to create backlight\n"); + } else { + ret = drm_panel_of_backlight(&pinfo->panel); + if (ret) + return dev_err_probe(dev, ret, "Failed to get backlight\n"); + } drm_panel_add(&pinfo->panel); From patchwork Mon Apr 17 14:39:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 673976 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7DB3C77B70 for ; Mon, 17 Apr 2023 14:39:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230461AbjDQOjZ (ORCPT ); Mon, 17 Apr 2023 10:39:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230190AbjDQOjR (ORCPT ); Mon, 17 Apr 2023 10:39:17 -0400 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D5425FC4 for ; Mon, 17 Apr 2023 07:39:15 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id by8so26518125ljb.13 for ; Mon, 17 Apr 2023 07:39:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681742353; x=1684334353; 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=wiuTpFK+nWG3951r1qdKkM3efc1mIO0xc7L3tK1Rs7ECSqy5Wt3rrpaotfOfz5CJDK D41+M3aHs+cUv1SIa4rt/ubzWSAjrOjvIcyk9BT0kOiNmapG9P48KAGxl9av9mwWZQwG /MOMRiqPhsf6EnnkABW1UdHlaOceRhuiti+y7IvtJjruZKUzGA92drD+gUiEAEWUYI41 DV844hjjFtBamUAMbd+JusbFvq4IWI0BfLntwCbxKsuAR0u7LgcxlS6lWUoM/tOZlzgz Jq5lyiu3iUCjpVHOgm+iRDM47+12IxDtAEyARnW06F4PRHz9vZMy5FQQ972O/LbLLm2h WUFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681742353; x=1684334353; 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=XbTP/F1sRz81XgRgrl9bw+kYhN1oysWhYZtgQv9Hv3obVV5lO6zh8PbDuD/FoUwcou J4JbYEnC8mKqiJPNVX41Xv5b8K3wJSj37sLUx2x+irM62LH9wQN92uSHjbIq1LFBSu4X HAaaMRxwVPjIB7WHTMzhKdExJ0b05VASqn4Q2gccJTT10yD1HEHgI1SthaxeKYYox75c pY3c2mmy6ap032mOGvelHOPYXgp1Yb0z86HpKTrqB37AFsDqvZplW8YTrl53k+KGUYyR v0W8epFn5OZ2zje6mCw0yr75m/gUdnZ1jwxCU8+EEeYh9RWm0unLxJ0X2NSrl/Qe4E9A 4nCg== X-Gm-Message-State: AAQBX9cuSwrDaOj99CjWazedF6NaCguI1RIvwP+UV/xyZ3dWIZQij3wr lhyaYfv9c3rGdparkZZGwoI+GnsbaHCTr5H/XVs= X-Google-Smtp-Source: AKy350ZwJrsG8n19CsEttEydK+XkaaRhRbNiFoxesa/6Fz8OsxOddCHQZw63KQJPJlg9+X0bQL+7Jg== X-Received: by 2002:a2e:b16e:0:b0:2a7:a59c:8ad0 with SMTP id a14-20020a2eb16e000000b002a7a59c8ad0mr4192846ljm.2.1681742353572; Mon, 17 Apr 2023 07:39:13 -0700 (PDT) Received: from [192.168.1.101] (abyk99.neoplus.adsl.tpnet.pl. [83.9.30.99]) by smtp.gmail.com with ESMTPSA id 2-20020a2eb282000000b002a76b9e4058sm2235785ljx.43.2023.04.17.07.39.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 07:39:13 -0700 (PDT) From: Konrad Dybcio Date: Mon, 17 Apr 2023 16:39:05 +0200 Subject: [PATCH v3 3/4] drm/panel: nt36523: Get orientation from OF MIME-Version: 1.0 Message-Id: <20230412-topic-lenovopanel-v3-3-bcf9ba4de46f@linaro.org> References: <20230412-topic-lenovopanel-v3-0-bcf9ba4de46f@linaro.org> In-Reply-To: <20230412-topic-lenovopanel-v3-0-bcf9ba4de46f@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=1681742347; l=2068; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=pdWLeHccDvo0CLmZJATdV9aHqMgeBmhMVIeYiCuYKCc=; b=LUrTUaEn8X0twowhoCQRfIeIIMED6UchNvHwT4QrNhD6Vj+l42sWFzkIdE1jAYJGhdjTiiovJuiA fxUs8DR1CFaJIdN88iO7ynlRGQvMKmRLweI9zyKkaTC4X63lPAm7 X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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)) From patchwork Mon Apr 17 14:39:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 674776 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4951EC77B77 for ; Mon, 17 Apr 2023 14:39:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230101AbjDQOjY (ORCPT ); Mon, 17 Apr 2023 10:39:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230355AbjDQOjU (ORCPT ); Mon, 17 Apr 2023 10:39:20 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3011E9ED3 for ; Mon, 17 Apr 2023 07:39:17 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id x34so13232603ljq.1 for ; Mon, 17 Apr 2023 07:39:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681742355; x=1684334355; 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=EKbG0++H3xbVFVaOPyRrEAbbHRNYZ849A4wa8ugtNII=; b=pN366wTwu0+ztQLR0QYrHqKI4hmwEnaED2TGmsjGy4dRQ4fkBakoWiKQmQQnSpwIsv DifBTjk7IRTNrg1QcVCnTzl5Wz2ycTM+Fw9LtwP4SFXD4FzFtVsZQANx7T9sGhJG/gCZ tC1M1ZUnz8HNYpHA8VvUfGzGk538L9kjUSwyh/XwJrVxyfG2W3kVOD7Pz0N6Lb0cEfUj QpkRxlmvbOGnY+bQJ6y5PPo73qdkNV+iqFv41jiEH86AwOTFJ3kQ5Rkx0pu5zssWCxuD BXgnxlRryY220DqHPRUHnuAPsIg3AuOuwJAXt5dRkwdxx0ERshDXU2vH7U2dSbzy2Y5R 1l4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681742355; x=1684334355; 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=EKbG0++H3xbVFVaOPyRrEAbbHRNYZ849A4wa8ugtNII=; b=ZxyVtsUxeLpWyUY6m5O10qzv9+mL168ABOsyg3zMny6EWDZmrVJLmaVEyyR4F8bick cp97AAy/GP9fImVvUOaudJauT1XWLrX7P78HZQAIoEgYVL1N0lF4Sqvx3fldIkY0ROam 33JU/ooBzOjm1EqNKI0d5J/M5SumBCdZh1VcakLe/7vSlkdEJceSWpBXP0C9spU4lUdC 8DSpS76vf34CR5Ha5B8injYVjZ8c3D0dj5BYTLWiqh52/AjIf6tfAj3quVuQ77xqdpxT fhhXvPIuLC8cNZz1YrkRjxJdiw4oRDig3FAH9WMvfMNt0hc4ttRn8BxauB7PXj0VQajA Jprw== X-Gm-Message-State: AAQBX9cL7kyA0mmK4x/fnCOsJZhs64M7r1Ou5v5P1xfoKczNbOIoTZjS NXbBgTgLgnkLq2Dd5LLX6HBj5H6gKaj/xYk2Uzk= X-Google-Smtp-Source: AKy350Ys7432pfBMLLzz6dw68+mYOLdLdhmEsnM5AWFvKLwa3wj66GMhFh2CAoluNfj16VS8EXh3cw== X-Received: by 2002:a2e:930d:0:b0:2a7:a779:eae4 with SMTP id e13-20020a2e930d000000b002a7a779eae4mr4478436ljh.9.1681742354985; Mon, 17 Apr 2023 07:39:14 -0700 (PDT) Received: from [192.168.1.101] (abyk99.neoplus.adsl.tpnet.pl. [83.9.30.99]) by smtp.gmail.com with ESMTPSA id 2-20020a2eb282000000b002a76b9e4058sm2235785ljx.43.2023.04.17.07.39.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 07:39:14 -0700 (PDT) From: Konrad Dybcio Date: Mon, 17 Apr 2023 16:39:06 +0200 Subject: [PATCH v3 4/4] drm/panel: nt36523: Add Lenovo J606F panel MIME-Version: 1.0 Message-Id: <20230412-topic-lenovopanel-v3-4-bcf9ba4de46f@linaro.org> References: <20230412-topic-lenovopanel-v3-0-bcf9ba4de46f@linaro.org> In-Reply-To: <20230412-topic-lenovopanel-v3-0-bcf9ba4de46f@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=1681742347; l=22582; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=a+KroKy76h4Z+iWZU936x+V3O3+qF0O8kFg1bcYLy8k=; b=9DtjzXzjSrv/qSfPI3t1hQNOMc2jNtpJL0lr2A4kN6iYBbdLLyFclCrrcs+qpXA5jitq0nH3iKmp q/BS2vq0A14zuokiSc/NW7KU5NvYEVcxIRFY6KpVhVHxMhSEIRU/ X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Some Lenovo J606F tablets come with a 2K (2000x1200) 60Hz 11" 5:3 video mode display. Add support for these panels. Reviewed-by: Linus Walleij Reviewed-by: Jianhua Lu Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/panel/panel-novatek-nt36523.c | 486 ++++++++++++++++++++++++++ 1 file changed, 486 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36523.c b/drivers/gpu/drm/panel/panel-novatek-nt36523.c index 2c5712ac3037..c3befa7f253d 100644 --- a/drivers/gpu/drm/panel/panel-novatek-nt36523.c +++ b/drivers/gpu/drm/panel/panel-novatek-nt36523.c @@ -13,6 +13,8 @@ #include #include +#include