From patchwork Thu May 26 03:16:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ChiYuan Huang X-Patchwork-Id: 12861977 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 9FBAEC433FE for ; Thu, 26 May 2022 03:16:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238573AbiEZDQu (ORCPT ); Wed, 25 May 2022 23:16:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237961AbiEZDQt (ORCPT ); Wed, 25 May 2022 23:16:49 -0400 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AE04EE3C; Wed, 25 May 2022 20:16:48 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id c14so650202pfn.2; Wed, 25 May 2022 20:16:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gJkpAY5J5OYSDURsc529cHvymHUqP4kRqRfmka6ZmsE=; b=Jk45dUi05epNEnQ36gijQX1NTzUXD12rkoFLcqm8oqmaTFnvBHCdCZQAy96Z4Npq46 VMh8/2W+NmJGoOdR93zVjJIt+Gz7u4CIaB1V1vt2/Vh9Q8BrZa1eINivIkxRaiWCxYJO pGC3vPyFzs5ynmUKlCRC9AziQLPA/A3T4t1gjD50EIw8jOjMBYlQGrgDkpmhpNkyzlZm pOQeHmTtiYZCIWi0N8EQVWLKlut/jMETw/Rf13/zJTpEbZUc6YzhhnJ4wYVrviup8E9G Qd6EiTalyqlocZCiiHk6Y23sjKQ8rAW/P+ImhKqmvBrmMhxiAS086hmv0rtsER8+VQnF cP5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gJkpAY5J5OYSDURsc529cHvymHUqP4kRqRfmka6ZmsE=; b=NUQArnDgSyt61lFKwv6razIjyvWP+SMThIP7DTG/XJFOciesFZ8DAGcwL7m/AROSml 8XM0ryr8okkeQhM36K9dmv8OuYbM85G+WQN9kRq2cOr+HT9KA38DxWXaOaa+TBlYNrwU 5Fyra5Qmp97E75bLuvSDw0jEA5aPGqcFrl3yNg1oxgnxsDn5+yaHLFdwwIpKTX42F+wJ oQk5aPlPXN6QULNDHdvKucIQ38k1NGTJhHaVYyGHVSuEIBOXg2lb0v16aZBo16Idc25H mqRSQaSFV215qclvC4KADsUueg+dipsFEwDSvjL6euVdHxwF1iXKbS3irsbBz5ctI44r n7Zg== X-Gm-Message-State: AOAM532QdAeAN37dZDyCHYeab063gftvU0DcI8HR0T3flULjD6tXVnmL O/oNI84PEDGyk/csoSahOnXHvyw+eLEKNg== X-Google-Smtp-Source: ABdhPJwX32UAU3Bp3W9+y/lNWbYLb1ZL1Eord0ZY0yd4gzpVlC3AhrFJI1Wn7OP4oyRPTLFJD4K8vA== X-Received: by 2002:a63:28c:0:b0:3c1:6f72:7288 with SMTP id 134-20020a63028c000000b003c16f727288mr30961365pgc.564.1653535007427; Wed, 25 May 2022 20:16:47 -0700 (PDT) Received: from localhost.localdomain ([2402:7500:569:6b12:f420:101e:bfc0:b57c]) by smtp.gmail.com with ESMTPSA id t25-20020aa79479000000b0050dc7628181sm152964pfq.91.2022.05.25.20.16.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 May 2022 20:16:47 -0700 (PDT) From: cy_huang To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, lee.jones@linaro.org, daniel.thompson@linaro.org, jingoohan1@gmail.com Cc: pavel@ucw.cz, deller@gmx.de, cy_huang@richtek.com, lucas_tsai@richtek.com, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] dt-bindings: backlight: rt4831: Add the new property for ocp level selection Date: Thu, 26 May 2022 11:16:34 +0800 Message-Id: <1653534995-30794-2-git-send-email-u0084500@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1653534995-30794-1-git-send-email-u0084500@gmail.com> References: <1653534995-30794-1-git-send-email-u0084500@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org From: ChiYuan Huang Add the new property for ocp level selection. Signed-off-by: ChiYuan Huang --- .../bindings/leds/backlight/richtek,rt4831-backlight.yaml | 8 ++++++++ include/dt-bindings/leds/rt4831-backlight.h | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/Documentation/devicetree/bindings/leds/backlight/richtek,rt4831-backlight.yaml b/Documentation/devicetree/bindings/leds/backlight/richtek,rt4831-backlight.yaml index e0ac686..c1c59de 100644 --- a/Documentation/devicetree/bindings/leds/backlight/richtek,rt4831-backlight.yaml +++ b/Documentation/devicetree/bindings/leds/backlight/richtek,rt4831-backlight.yaml @@ -47,6 +47,14 @@ properties: minimum: 0 maximum: 3 + richtek,bled-ocp-sel: + description: | + Backlight OCP level selection, currently support 0.9A/1.2A/1.5A/1.8A + $ref: /schemas/types.yaml#/definitions/uint8 + default: 1 + minimum: 0 + maximum: 3 + richtek,channel-use: description: | Backlight LED channel to be used. diff --git a/include/dt-bindings/leds/rt4831-backlight.h b/include/dt-bindings/leds/rt4831-backlight.h index 125c635..e8b8609 100644 --- a/include/dt-bindings/leds/rt4831-backlight.h +++ b/include/dt-bindings/leds/rt4831-backlight.h @@ -14,6 +14,11 @@ #define RT4831_BLOVPLVL_25V 2 #define RT4831_BLOVPLVL_29V 3 +#define RT4831_BLOCPLVL_0P9A 0 +#define RT4831_BLOCPLVL_1P2A 1 +#define RT4831_BLOCPLVL_1P5A 2 +#define RT4831_BLOCPLVL_1P8A 3 + #define RT4831_BLED_CH1EN (1 << 0) #define RT4831_BLED_CH2EN (1 << 1) #define RT4831_BLED_CH3EN (1 << 2) From patchwork Thu May 26 03:16:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ChiYuan Huang X-Patchwork-Id: 12861978 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 57755C433F5 for ; Thu, 26 May 2022 03:17:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237961AbiEZDQ7 (ORCPT ); Wed, 25 May 2022 23:16:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239527AbiEZDQ4 (ORCPT ); Wed, 25 May 2022 23:16:56 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09C0D101E4; Wed, 25 May 2022 20:16:52 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id a17so392624plb.4; Wed, 25 May 2022 20:16:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UThOTLkpL6r0PfLYsEVVStjdxypFZ/KqJ5dVvlv45cQ=; b=TwvS3CSU4878l6qtnM6vjb91z+ZtHsGsRArRPglugXj1iIcrUot9+RP/7cVVUlboRH J/dJb7DHUGzCH5PXT5F7+FACbuPaPhozVRUKNFEKkfY/UzDoQgTwTUq2DwuUhOZV5FJD VGUHUVM+ZUt0okEKD6G8gHCqtLzE1EFzYi34hzKSu1Epue0KIxYLCXwxLyN3cd3SSkJM h0N5VIzySFDCKa1TXC0dfBWlTmsnDqEwQmX8mK61ruF44VsN0pYma9ckDd67YWRtRxqs NrSU/zhbjbZnUPQ4uZYlvheq0H5Y++27HZhiQ93dealVKz+LLtHvNf6PvYTHNZKv0ydH 9hhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UThOTLkpL6r0PfLYsEVVStjdxypFZ/KqJ5dVvlv45cQ=; b=wuWtke46iBVhC6RDba7a5V23esfepzFDTxMUg2N3g4cpaEelpuTUe8yO5hxFyhR+Tz +OpBf5cQeFCzsaNIxYGwdzTaQsevNggGyLFwf4iGptEwClu3W0G00u6NbdTaQaaWpMSt oKfq5uE50dr5APy8xCharH4J0n/2WLMwGYBt1b/Ap97dYQtN8gnbTJJBvbULhinbXiuD S2ztvSAGxrHUxyfy+Kl6WAkHfEbVpHviYFzd3z63zGmXoilIbMn+XetuLmbvGttUXdJi wGQoQk17uiqcXiNFBR/mj4FjaWmcjForBSqR/hqT/JS22Y+0qhgQeKo77sa1twL3HSJK pOhg== X-Gm-Message-State: AOAM533f0AiYPR9SqwUgun1aQBWHnQges94vhk0pXJrLCQ/h2TfwA/7s NaRT4mJ40vY2FLV0M7orEzk= X-Google-Smtp-Source: ABdhPJw4OWJucWjDO/OgkBgn3Kd7o4a82L1xaZs86EKdpB+JzlecBZUX/jxImhdjaEDiYy8UQCJd3g== X-Received: by 2002:a17:90a:e7c6:b0:1e0:9cf7:d042 with SMTP id kb6-20020a17090ae7c600b001e09cf7d042mr354429pjb.234.1653535011416; Wed, 25 May 2022 20:16:51 -0700 (PDT) Received: from localhost.localdomain ([2402:7500:569:6b12:f420:101e:bfc0:b57c]) by smtp.gmail.com with ESMTPSA id t25-20020aa79479000000b0050dc7628181sm152964pfq.91.2022.05.25.20.16.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 May 2022 20:16:51 -0700 (PDT) From: cy_huang To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, lee.jones@linaro.org, daniel.thompson@linaro.org, jingoohan1@gmail.com Cc: pavel@ucw.cz, deller@gmx.de, cy_huang@richtek.com, lucas_tsai@richtek.com, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] backlight: rt4831: Add the property parsing for ocp level selection Date: Thu, 26 May 2022 11:16:35 +0800 Message-Id: <1653534995-30794-3-git-send-email-u0084500@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1653534995-30794-1-git-send-email-u0084500@gmail.com> References: <1653534995-30794-1-git-send-email-u0084500@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org From: ChiYuan Huang Add the property parsing for ocp level selection. Reported-by: Lucas Tsai Signed-off-by: ChiYuan Huang --- drivers/video/backlight/rt4831-backlight.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/video/backlight/rt4831-backlight.c b/drivers/video/backlight/rt4831-backlight.c index 42155c7..c81f7d9 100644 --- a/drivers/video/backlight/rt4831-backlight.c +++ b/drivers/video/backlight/rt4831-backlight.c @@ -12,6 +12,7 @@ #define RT4831_REG_BLCFG 0x02 #define RT4831_REG_BLDIML 0x04 #define RT4831_REG_ENABLE 0x08 +#define RT4831_REG_BLOPT2 0x11 #define RT4831_BLMAX_BRIGHTNESS 2048 @@ -23,6 +24,8 @@ #define RT4831_BLDIML_MASK GENMASK(2, 0) #define RT4831_BLDIMH_MASK GENMASK(10, 3) #define RT4831_BLDIMH_SHIFT 3 +#define RT4831_BLOCP_MASK GENMASK(1, 0) +#define RT4831_BLOCP_SHIFT 0 struct rt4831_priv { struct device *dev; @@ -120,6 +123,16 @@ static int rt4831_parse_backlight_properties(struct rt4831_priv *priv, if (ret) return ret; + ret = device_property_read_u8(dev, "richtek,bled-ocp-sel", &propval); + if (ret) + propval = RT4831_BLOCPLVL_1P2A; + + propval = min_t(u8, propval, RT4831_BLOCPLVL_1P8A); + ret = regmap_update_bits(priv->regmap, RT4831_REG_BLOPT2, RT4831_BLOCP_MASK, + propval << RT4831_BLOCP_SHIFT); + if (ret) + return ret; + ret = device_property_read_u8(dev, "richtek,channel-use", &propval); if (ret) { dev_err(dev, "richtek,channel-use DT property missing\n");