From patchwork Thu Apr 13 10:09:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 674246 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 EC47DC77B6E for ; Thu, 13 Apr 2023 10:10:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230110AbjDMKKF (ORCPT ); Thu, 13 Apr 2023 06:10:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230265AbjDMKKB (ORCPT ); Thu, 13 Apr 2023 06:10:01 -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 331979754 for ; Thu, 13 Apr 2023 03:09:50 -0700 (PDT) Received: by mail-lj1-x22d.google.com with SMTP id a29so15588244ljq.0 for ; Thu, 13 Apr 2023 03:09:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681380588; x=1683972588; 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=DEAnat5PSJjsxQAWB7/SpZ+xwfK/Fj2JlbHtk3HNvoA=; b=ltTzPvxhvo3ZlgIQh10MfEpSaxyzcEAkSMAeImGiz864Hk+fEhbQ0LBYTl2tPSAMzv ab1LF0jIAHCyWSFQHQAPE5RsNQrBf7QUL10601PtdgwXHZgXZX6SmagLER5KjFeycGbU Tn1zqwIgboWmT5uTM98zj+zv1iLv4EQv3BV3StMfIXzzjTyE/rb3qRcf8zYfu6JtIPSk zSZ7/Jy0lHHCEV12vsYu00BDiERMME3VWk+g53uOSCfATYHP4XEKxgzEMZqCPinFLuSr QkXOAnq24uM2s1mGb3lQYwPpkeH1uS6wRGzzQeqmXaHWp9Czo7eQ2hzQ8vxjX6l4hEmf Rnug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681380588; x=1683972588; 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=DEAnat5PSJjsxQAWB7/SpZ+xwfK/Fj2JlbHtk3HNvoA=; b=YtSVU1mX6Cwwr6rSxaZeH62tWZX/jsreDck2LUhhpYd841ZDl1LBYKp0+UNX+TXPC3 P6nRWRtvEFYzeqXs1TpKwQ0ONl8jSBMopgbnQkDTIz+KqGEcd1it9U2nYsRiQtQgbNGy Hz35010POhXtR34BuyCMt6Y5ms8BHFz6wEC2szlhR0URvJhcQ4wgGaBzzv9jamJ+jMmv gjNoEr3AlkWsqbBb4U5LDl1owFguyP+Porg3qvvU4LMEv1HscOt8y6j1a/WnJB/1vPGu kr7f/F3eC7WDUyoNk1arg9y6bPY20dc60i0B25NrhssbJv3by7jcUtNxCFIyuODIAvpd H6bA== X-Gm-Message-State: AAQBX9fYOiFdVFzX4i11B8CowYloXV0xh7dwFRqtr5cXOJgBYK+EYGyn l9U0X1VF+BHxP/gNcpXmgKAFNCZ97dBZB7maiDQ= X-Google-Smtp-Source: AKy350asL51EeQDLbOK2ZbUFavRJIn/bPYE8P0PHMi+LSEUZ/Jv99YCh3KyhcP4BfchERSh094e26A== X-Received: by 2002:a2e:9e19:0:b0:29b:d471:c80f with SMTP id e25-20020a2e9e19000000b0029bd471c80fmr907501ljk.36.1681380588424; Thu, 13 Apr 2023 03:09:48 -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.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Apr 2023 03:09:48 -0700 (PDT) From: Konrad Dybcio Date: Thu, 13 Apr 2023 12:09:35 +0200 Subject: [PATCH v2 1/5] dt-bindings: display: panel: nt36523: Allow 'port' instead of 'ports' MIME-Version: 1.0 Message-Id: <20230412-topic-lenovopanel-v2-1-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 X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1681380585; l=1187; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=FMgShhUTMaYzSy2Me7Gv1xSXp92sIQsWFZ0aqhhoJn8=; b=9J88Z5LuF95gqkV+HSGcOJ5UC/2WCV8vVvuzNlssYzVIvrv/8ehvUa53oIMtzftb/pqyOx/rHMmu dOWMlYA7DWmYNYzxksbhUTQJ36XooRkA8E19xmPb9BFG36Q4wp1V X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Using 'port' instead of 'ports' for single-DSI usecases allows for saving a couple of DTS LoC, including a level of indentation. Allow that. Signed-off-by: Konrad Dybcio --- .../bindings/display/panel/novatek,nt36523.yaml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/display/panel/novatek,nt36523.yaml b/Documentation/devicetree/bindings/display/panel/novatek,nt36523.yaml index 0039561ef04c..38f4f986aef1 100644 --- a/Documentation/devicetree/bindings/display/panel/novatek,nt36523.yaml +++ b/Documentation/devicetree/bindings/display/panel/novatek,nt36523.yaml @@ -33,15 +33,26 @@ properties: description: regulator that supplies the I/O voltage reg: true - ports: true backlight: true +oneOf: + - allOf: + - properties: + ports: true + - required: + - ports + + - allOf: + - properties: + port: true + - required: + - port + required: - compatible - reg - vddio-supply - reset-gpios - - ports unevaluatedProperties: false From patchwork Thu Apr 13 10:09:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 672943 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 7BA6DC77B61 for ; Thu, 13 Apr 2023 10:10:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230324AbjDMKKG (ORCPT ); Thu, 13 Apr 2023 06:10:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230266AbjDMKKB (ORCPT ); Thu, 13 Apr 2023 06:10:01 -0400 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B6AC2729 for ; Thu, 13 Apr 2023 03:09:51 -0700 (PDT) Received: by mail-lj1-x231.google.com with SMTP id r9so1056902ljp.9 for ; Thu, 13 Apr 2023 03:09:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681380589; x=1683972589; 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=bSIW3m6ouiUh4MBy/iPcO3038yiahaw6SCZrZmXoL8c=; b=s2aepwa18IqdU0SyKMtM8jAoCQnaWRTpqSkvN7201r1i0T84x5U2A//m+sbAcDUY/h bIiDy6rekYmG6rNaS1GUtUrLIjmERQ/aWcasLBXJrb3f5xP8+Cy2JScNMxy6od9iC/MB 7i/0wMUpzGXDxnO7SaEBTv90z1Cm00CrZurSL82Rv1xj8WW/tvrrzwI6fX0vsYxaSdNe eIDmzsQiVKeVrX9UKxSMxtZNcln6avoeEn11sokQ6rOTBf1YjXPvJbKZzmmmCBIAOk2F oLv2O4sjH9mOq8ymbTMucigojP13caE7qM32yysFQDphq2hC8KNebM8DwDCcJu1oF3tH Nkaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681380589; x=1683972589; 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=bSIW3m6ouiUh4MBy/iPcO3038yiahaw6SCZrZmXoL8c=; b=a2uslKHML3puqGvDnuhFm2Hyduhcv+SjvT0WM3QdXQhFkwwKrNN64iKekXcaVcHwvs 9kJJmK/jernYQJUrZdv6jrwl1cmKDyPaV7EW8YRSA8x/7xCwxJU6UN1oe9UnlgUHlkiv J3AeJCrPMVED1S668clfzdaEKsccoELMuHwKIO3uPeCPU+fsM8kdDj6vFlT/gQfSo94C vggCz8mmdSMoo3Ebt1Ve5tnuq9wNqqHT+m3MWP0PYwFza2ITwYLV/T9WzKrIv6P9yplS 7JZJjyHxCM522bUbdTthd16pKAHz0Q1wfsqe1k7W0mvlpCC21jl/+K13Dt7TmC8g/7Fo P/Qw== X-Gm-Message-State: AAQBX9d3ITk+2niztj5eb9ZlSaRbNYGA4Wz/Rxp3GspqkukWWB4DMFmm JvTrKLPpDzjKeD6sX+Ffzdx2BA== X-Google-Smtp-Source: AKy350akt3tf+m5dnagc6WlGIUG8b2dlWdEiOD0/YEcV1QE/n9GCXFU+ey43oGfBADr3OnNThMPwMQ== X-Received: by 2002:a2e:2418:0:b0:2a6:8a:d0f5 with SMTP id k24-20020a2e2418000000b002a6008ad0f5mr578207ljk.23.1681380589691; Thu, 13 Apr 2023 03:09:49 -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.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Apr 2023 03:09:49 -0700 (PDT) From: Konrad Dybcio Date: Thu, 13 Apr 2023 12:09:36 +0200 Subject: [PATCH v2 2/5] dt-bindings: display: panel: nt36523: Add Lenovo J606F panel MIME-Version: 1.0 Message-Id: <20230412-topic-lenovopanel-v2-2-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=1472; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=n3Ug6o2RQm9MRwfNsS0ku9LYCJEX/SEVYNXH8b0uEzs=; b=7k3RzLmzF5mXo80xwIEgbS38OpViZfugrSV/p8xZjzFY6LLzX8bSGoCa5fzFIkaUzU3qAqdZhOrL xZd5o7mhAfUxWxAQTY7QYr+XMn+hZJmlPjzk32hAPTHJlIpKfczq 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 Signed-off-by: Konrad Dybcio Reviewed-by: Krzysztof Kozlowski --- .../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 38f4f986aef1..fda74d5bd89e 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 @@ -33,6 +38,7 @@ properties: description: regulator that supplies the I/O voltage reg: true + rotation: true backlight: true oneOf: From patchwork Thu Apr 13 10:09:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 674245 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 513AAC77B6C for ; Thu, 13 Apr 2023 10:10:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230354AbjDMKKP (ORCPT ); Thu, 13 Apr 2023 06:10:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230231AbjDMKKC (ORCPT ); Thu, 13 Apr 2023 06:10:02 -0400 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A370A975A for ; Thu, 13 Apr 2023 03:09:52 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id q15so11238486ljp.5 for ; Thu, 13 Apr 2023 03:09:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681380591; x=1683972591; 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=gkNHMjZtMFbejwqHO8md1YUCsEy0fYS+RJS3bjUxHlw0snRh4wvU8AUxIGsEsMLnKa 10et6J2RG6qAOAU1ZLvwzNAADG1ZVdTRZ8LuFsMrwPPvRhVqJ+A16dHEQwnOliK8l2jS QNF+uoFhI+XWvwmi4Dme6LksLIZ1uRlnXMqIxmjTQ8ucJMdJqmJRf+EonV7c1izxks0d 8uzCwK+i2pGFbSngVB/Pu0oelXFgd5MyuGt8hk+MM22/okasA9WDelKwqvFbOWbfk8yl nex5srBTm3qTyHgNJiqlIFbJQ4SXUhW508wun5OiUN7TyZs16fx6YiC87mRDUmiCfiMj XzVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681380591; x=1683972591; 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=Iz/lFHuQf0cpK9wKCmIiexLo+kGb+3q8LzvxLgb3AeoZio4ZrFB+eoh6gEixCcOtcK zGOuQAYIEX8Jsa3+KuHGHrAuVopDTFR3zoUhZi0Q4Q3F3wEDajLoXn25I/pH9PbNGrC4 KvIAqy1pHbbYJNIz5bd8hNcpbo4iDFuYc3NYuo9aYnAIJUtwSQVBegObEChXorHcf7GA sAGqehMkiVXzJMbQ0hmEbSXF0l5Qylq8QQxSpUP7o/CeshLEzc7SlvZMvX56AQKjkeEp rt3ROBiVoUWLnpK0zPcTolh4xujrii1T3lewC1wElK0VfSuoLmrcAPU2DWiQvnJ7GE6d L4yA== X-Gm-Message-State: AAQBX9eK3ZUXh5sgI4N4yjQIhDIJLQ9L3N4BLXynCGHdAKFiaxBvzaCs ZjyQnAz99h4gJOdkeHa8S0W/Pg== X-Google-Smtp-Source: AKy350az83SRGEXISdkGaf4esD2bKF7/wkQ6o6zZO+wzeNhiP2LfMNi57V3An2zNWdJRkLqJSjz4xQ== X-Received: by 2002:a2e:7303:0:b0:2a3:3b80:509b with SMTP id o3-20020a2e7303000000b002a33b80509bmr786082ljc.19.1681380590987; Thu, 13 Apr 2023 03:09:50 -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.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Apr 2023 03:09:50 -0700 (PDT) From: Konrad Dybcio Date: Thu, 13 Apr 2023 12:09:37 +0200 Subject: [PATCH v2 3/5] drm/panel: nt36523: Add DCS backlight support MIME-Version: 1.0 Message-Id: <20230412-topic-lenovopanel-v2-3-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=3553; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=dc/Dvzhn8dlfyxlg6IxeHxMIzNiaOkMG9FE6LJmww9g=; b=/V/o7X0Ghnkvl0ZAqJzTcC2sDHw0LtDECLQxC6YaVBgZ1QbjHDaQryqxaoyjqtl7NFzPGPAzzXSJ BXCzY5/qBRM/zoLHtArYov4YGep8+aN5xLG+Q+CtClnBrSautTux 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 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: 672942 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 144F5C77B6F for ; Thu, 13 Apr 2023 10:10:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230373AbjDMKKR (ORCPT ); Thu, 13 Apr 2023 06:10:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230218AbjDMKKD (ORCPT ); Thu, 13 Apr 2023 06:10:03 -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 52D749760 for ; Thu, 13 Apr 2023 03:09:54 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id a29so15588430ljq.0 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=k/HgZhGQKgn/gNFBjwJ3VoUJfHjp9GLWcIHkUkosd+Z7xNbx6OflbPwh2YKk7bC7Qx eN6nws17eyhqoU79VujIX1yi6y0J6HFsFWs/8++BW8nou8TxH4AYRC6g7ZB4bWXPc3vo y3BGHacqyYRYkStFsb0NEwsLaAjrkk+G6jrti8P+7hlbRhuDcDsqCtnWQ3l+ICs0NikS 9bCURgpJc1rHOPIAbvynrKSYAOPfV+ETNLvh+tU7XMlp3/4H3LLEBNd8pfdBMTaU5W2E UF64IwQVQq8+D5FfaL0pZbZC7nwqwKv2XoZG3OqWlJmb89Jc0StlAuGjX3udTB/PHH25 NHLw== X-Gm-Message-State: AAQBX9dR4LCGT68ThKez9xdKUbuO1UjXXvgq/aQHiCHw3oo2EJUb9CcB zt6t5Bx5eFjYY2PNjsRA/f0aNg== X-Google-Smtp-Source: AKy350Z4phXW2MjbdziUGEXYYMVHQ5u8gvGegNDKhCzPZj1+Z/99Tg9rAJsY4QTp9es8I+bm3+zzwA== 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= 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 Thu Apr 13 10:09:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 674244 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 4A45CC77B61 for ; Thu, 13 Apr 2023 10:10:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230135AbjDMKKU (ORCPT ); Thu, 13 Apr 2023 06:10:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230259AbjDMKKF (ORCPT ); Thu, 13 Apr 2023 06:10:05 -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 E4B889ED3 for ; Thu, 13 Apr 2023 03:09:55 -0700 (PDT) Received: by mail-lj1-x22d.google.com with SMTP id bz25so398087ljb.12 for ; Thu, 13 Apr 2023 03:09:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681380594; x=1683972594; 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=ThO1LzD5GUl5+TgJbsoVcKM/qNLCB/hqoha+v0ORbBzy1YDDbKE8aMFehj3J9adsTK qVdtpAbstd1R6qNnunfTJlGwxOb+MhGcfiEwIHvrXSCw4UauAdYkxlFBCUU1sd75M0pq v2KmiV6DEVPpOEJgmzCHgh29f0EbJ/wS/85TcunFSh1ekjlibM99nIo2KcTbxvrSAnh+ ddulP/WvLkAcUw+iRMgvs89tiKzKiEl1s4K+pNO0psyKCBJ7rB+8FtmtKI61us6kfKR7 bhKyh7IuDextmjYVbzaftyA21T6Qw1sRqyFF4zzB7nN1tDlE3I00lOk37hiAgXoR1tAT XJJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681380594; x=1683972594; 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=QzOZuWXaCX+3IB6+46leaScp1iti97qtCpMePBXCHECYmO8S2DcieKvY8jp96wUhtk 04KlJ0xn5X29GGnWLbYMFnabEq6fMjZ8qsp1VFTVVcAHPRH4x4p0Eiwate9hK4VHyt8t wHIPtAfThTRfsE4LPeOrHlcY5Wblle5JYAMfHIOlmZqxy1nZTgDjwX5pNAkF14cCnkFd wKlViuhsmiwjGOyI97ubuuZfdA3RXXvX9R5YAoNO4xPiWqYFKNptvDEPL0qqkOAfYdt2 tdJxCyXqxoJGDONPz1x4PqUtqmr6fI/MX4fUTDP+NM9FsVQtuB9Nknh1Nf0Tg1ejtN6u vx1g== X-Gm-Message-State: AAQBX9dla+xvxJ4hURLJQU3n31nFjw+TN9z+GBexiol3ETFAcsNfr537 8suQ79mL4jiclgxp+vNkvrUmow== X-Google-Smtp-Source: AKy350b42GDYnVhw2CmyLCK8DYMC6jVDMfzA4N2X4+qbw2p5e5RsIjjuNI+6tnJn8lc3iN6XZzdTnA== X-Received: by 2002:a2e:b173:0:b0:2a2:d541:5d34 with SMTP id a19-20020a2eb173000000b002a2d5415d34mr477068ljm.17.1681380594000; Thu, 13 Apr 2023 03:09:54 -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.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Apr 2023 03:09:53 -0700 (PDT) From: Konrad Dybcio Date: Thu, 13 Apr 2023 12:09:39 +0200 Subject: [PATCH v2 5/5] drm/panel: nt36523: Add Lenovo J606F panel MIME-Version: 1.0 Message-Id: <20230412-topic-lenovopanel-v2-5-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=22582; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=a+KroKy76h4Z+iWZU936x+V3O3+qF0O8kFg1bcYLy8k=; b=5UhufzRL+Mw2BPxERcEopM+ykXt8KXnuM/h+5eueYbv/mFXmhsetOixMyZIcBN3rWcwmjMFI0mdA f3dp/vwUAqdhE8ONDujDv7q4afGc5S/UBtUK1E64vTPFW27sjsWN 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