From mboxrd@z Thu Jan 1 00:00:00 1970 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 DD1F6C3F6B0 for ; Thu, 28 Jul 2022 11:31:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234668AbiG1LbV (ORCPT ); Thu, 28 Jul 2022 07:31:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235569AbiG1LbR (ORCPT ); Thu, 28 Jul 2022 07:31:17 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F126D2714F for ; Thu, 28 Jul 2022 04:31:14 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id r1-20020a05600c35c100b003a326685e7cso3072914wmq.1 for ; Thu, 28 Jul 2022 04:31:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=SMC59iUGEUeIWikaYVLjy2odSUsf6J1BxrN5JwfwEpY=; b=I2LvfwRSLT0FBLkzKL97tXa0j3AxOgqK4JwBDMsSM+Z8HGBr1Hsl+SUU8HPYMLz66e 8uwZd7/fPyOTDqCE8CpYD1EB4BMYrqBICeOrQcRtAgtcyK1eE/L39avZt/VLlWPC4Uor LoRGhJiBQNR/hDNsANtNPDEqnDWOhfwEJTmwgA0Cv1jj23KAfdmGOY1sasEYVFjLX/YX ZlPZ2zhQiq7NYJ6LHAqKNcChUNlEupakqOtGb+CZPupdBgaFq1mBMgBamPwT1GZ2CiGh Xxn5YMmbVopGqmz+InpOVGDvq/m/bhIDEUtdkMhmWHk2Kp5mn0bff3ZHplSxHO3nCLJd f6Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=SMC59iUGEUeIWikaYVLjy2odSUsf6J1BxrN5JwfwEpY=; b=kJ9BEDRgNg2+7KRVxEWenoumZlskWVSLAfcaSQlrRNDkmf/xiCRDtgOj/UliiBJA7j cTGuIHvxREhB69Wc/ppOyoFaNlmQg94oHyy9pJL2pR1FIJzg7T4/razA7wo/cCFyi3C3 LAjGM/bro4a3nt1Wub1lhI6Nh8elYu6hpYMPmq2vM9CzNOhj/iWkYE9bIWb6Ss82aItQ vvuLMN2ajou4kTQipS8WdM/WSw3rxA1oDe69lZNrrQF6vEMbJhO6qQJvlGfFw7nLz/U2 fWM8d6yfmsIvViRuIO2/vBk9q9cv1Okqmab1upL5gKw9cuvM88gEBaIOfXVVmuCQrPNx k0nQ== X-Gm-Message-State: AJIora9PdtJ/ipKZRK9TF6LMF68avg60577WZVtiZMPVtLnKxGFuZRSS yCY0UfBsKFawOCFdun8PhH7HyA== X-Google-Smtp-Source: AGRyM1vjIPgxwYbMk8BsnZlSouB9NDyINH+vUJA52rfBsJa1/epNS6uEmdrCNjJkZQ9qNZQU8kklUA== X-Received: by 2002:a05:600c:3556:b0:3a3:2a9c:f26 with SMTP id i22-20020a05600c355600b003a32a9c0f26mr6221269wmq.58.1659007873312; Thu, 28 Jul 2022 04:31:13 -0700 (PDT) Received: from maple.lan (cpc141216-aztw34-2-0-cust174.18-1.cable.virginm.net. [80.7.220.175]) by smtp.gmail.com with ESMTPSA id z22-20020a1cf416000000b003a35516ccc3sm937306wma.26.2022.07.28.04.31.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jul 2022 04:31:12 -0700 (PDT) Date: Thu, 28 Jul 2022 12:31:09 +0100 From: Daniel Thompson To: ChiaEn Wu Cc: Lee Jones , Jingoo Han , Pavel Machek , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , Sebastian Reichel , Chunfeng Yun , Greg Kroah-Hartman , Jonathan Cameron , Lars-Peter Clausen , Liam Girdwood , Mark Brown , Guenter Roeck , "Krogerus, Heikki" , Helge Deller , Andy Shevchenko , ChiaEn Wu , Alice Chen , ChiYuan Huang , dri-devel , Linux LED Subsystem , devicetree , linux-arm Mailing List , "moderated list:ARM/Mediatek SoC support" , Linux Kernel Mailing List , Linux PM , USB , linux-iio , "open list:FRAMEBUFFER LAYER" , szuni chen Subject: Re: [PATCH v6 13/13] video: backlight: mt6370: Add MediaTek MT6370 support Message-ID: <20220728113109.7gf3b36mqjxlhcq3@maple.lan> References: <20220722102407.2205-1-peterwu.pub@gmail.com> <20220722102407.2205-14-peterwu.pub@gmail.com> <20220725103128.xtaw2c4y5fobowg7@maple.lan> <20220726093058.2fz2p2vg7xpfsnfe@maple.lan> <20220726115954.kpkmidrk3zo3dpbq@maple.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org On Wed, Jul 27, 2022 at 02:24:46PM +0800, ChiaEn Wu wrote: > On Tue, Jul 26, 2022 at 7:59 PM Daniel Thompson > wrote: > > > > > So should we make all 16384 steps of MT6372 available to users? > > > > > > > > Yes. > > > > > > > > > > > > > Does that mean the DTS needs to be modified as well? > > > > > > > > Yes... the property to set initial brightness needs a 14-bit range. > > > > > > > > It would also be a good idea to discuss with the DT maintainers whether > > > > you should introduce a second compatible string (ending 6372) in order > > > > to allow the DT validation checks to detect accidental use of MT6372 > > > > ranges on MT6370 hardware. [snip] > > > > I'd be curious what the compatiblity reasons are. In other words what > > > > software breaks? > > > > > > The reason is as above. We just hope the users who use this series SubPMIC can > > > directly apply this driver to drive the backlight device without > > > knowing the underlying hardware. > > > Not software breaks. > > > > As above, ignoring the max_brightness property is a bug in the > > userspace. I'm still unclear why sending faked ranges to userspace > > it a better solution than fixing the userspace. > > Ok, I got it! > If I add a second compatible string (like 'mediatek,mt6372-backlight') > in the DT section, > and append 'if-then-else' to determine the correct maximum value of > 'default-brightness' and 'max-brightness', > Also, I will append 'bled exponential mode' to make user control using > linear or exponential mode. I'd be very pleased to see support for exponential mode added: it's a much better way to control LEDs and backlights. > These changes I will explain to DT's maintainer again. Excellent. I know DT maintainers are copied into this thread but they will probably not be following this patch's thread so it is better to discuss in the mail thread for the DT bindings! > Back to the driver section, > do I still need to use the register to confirm again whether this > SubPMIC used now is MT6372 and record this information? (using > 'mt6370_check_vendor_info()') > I am afraid that the user who uses the MT6370 hardware, but the DT > compatible string is set to 'mediatek,mt6372-backlight'. > This may cause errors when update/get brightness values. > So I hope the driver here can check again to make sure the > 'default-brightness', 'max-brightness', can be updated/got correctly. > I don't know if this will make you feel redundant if I do this?? Yes, it's good idea to check the hardware model during probe. I'd suggest just reporting this as an error ("Buggy DT, wrong compatible string") rather than trying to re-intepret the parameters. Daniel. From mboxrd@z Thu Jan 1 00:00:00 1970 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EFD70C04A68 for ; Thu, 28 Jul 2022 11:31:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 28C8F12B972; Thu, 28 Jul 2022 11:31:18 +0000 (UTC) Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by gabe.freedesktop.org (Postfix) with ESMTPS id 21752997C7 for ; Thu, 28 Jul 2022 11:31:15 +0000 (UTC) Received: by mail-wm1-x32e.google.com with SMTP id v5so816651wmj.0 for ; Thu, 28 Jul 2022 04:31:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=SMC59iUGEUeIWikaYVLjy2odSUsf6J1BxrN5JwfwEpY=; b=I2LvfwRSLT0FBLkzKL97tXa0j3AxOgqK4JwBDMsSM+Z8HGBr1Hsl+SUU8HPYMLz66e 8uwZd7/fPyOTDqCE8CpYD1EB4BMYrqBICeOrQcRtAgtcyK1eE/L39avZt/VLlWPC4Uor LoRGhJiBQNR/hDNsANtNPDEqnDWOhfwEJTmwgA0Cv1jj23KAfdmGOY1sasEYVFjLX/YX ZlPZ2zhQiq7NYJ6LHAqKNcChUNlEupakqOtGb+CZPupdBgaFq1mBMgBamPwT1GZ2CiGh Xxn5YMmbVopGqmz+InpOVGDvq/m/bhIDEUtdkMhmWHk2Kp5mn0bff3ZHplSxHO3nCLJd f6Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=SMC59iUGEUeIWikaYVLjy2odSUsf6J1BxrN5JwfwEpY=; b=58RSR5jxB88uE4GNL8Jq/gam+AFKMwpKueyLAK0s6xQngXVAkkbsmzNoNanLO7Wx2z kh4bTqM3GZlEmePOTE3EKfzrdyuuAL0lAuI+aS+BWBycOUVVHXfCcxqgTF2sGYEaWK5/ hBQqC+MPHGs0IaX3O+DbDKIq09gbbaN4pKYBeaYPRvkRtPXZbuWxN2sFPdi4IxOqnB0R DS9r8zNjD+dpDstGL2K01sXsdqU8XW7xVv6t9oysy3W/DyGK15pfXN9fln3md9PV5aXv CO+9xaGRLLV8nZpqsomV/OG3b3e9wQIFyW9dTFV+P/pc6E7ABneRA3eyGiqYf9UJeXKU ctRQ== X-Gm-Message-State: AJIora+xmnkNeDn5aZ7GDHUI/HcS/GdULYU0gjmm+/rlbSXcIm9tsKVX tCZfvfLRWaYF0tdJh82enIyG2Q== X-Google-Smtp-Source: AGRyM1vjIPgxwYbMk8BsnZlSouB9NDyINH+vUJA52rfBsJa1/epNS6uEmdrCNjJkZQ9qNZQU8kklUA== X-Received: by 2002:a05:600c:3556:b0:3a3:2a9c:f26 with SMTP id i22-20020a05600c355600b003a32a9c0f26mr6221269wmq.58.1659007873312; Thu, 28 Jul 2022 04:31:13 -0700 (PDT) Received: from maple.lan (cpc141216-aztw34-2-0-cust174.18-1.cable.virginm.net. [80.7.220.175]) by smtp.gmail.com with ESMTPSA id z22-20020a1cf416000000b003a35516ccc3sm937306wma.26.2022.07.28.04.31.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jul 2022 04:31:12 -0700 (PDT) Date: Thu, 28 Jul 2022 12:31:09 +0100 From: Daniel Thompson To: ChiaEn Wu Subject: Re: [PATCH v6 13/13] video: backlight: mt6370: Add MediaTek MT6370 support Message-ID: <20220728113109.7gf3b36mqjxlhcq3@maple.lan> References: <20220722102407.2205-1-peterwu.pub@gmail.com> <20220722102407.2205-14-peterwu.pub@gmail.com> <20220725103128.xtaw2c4y5fobowg7@maple.lan> <20220726093058.2fz2p2vg7xpfsnfe@maple.lan> <20220726115954.kpkmidrk3zo3dpbq@maple.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:FRAMEBUFFER LAYER" , "Krogerus, Heikki" , Krzysztof Kozlowski , Alice Chen , linux-iio , dri-devel , Liam Girdwood , ChiYuan Huang , Pavel Machek , Lee Jones , Linux LED Subsystem , Helge Deller , Rob Herring , Andy Shevchenko , Chunfeng Yun , Guenter Roeck , devicetree , Linux PM , szuni chen , Mark Brown , "moderated list:ARM/Mediatek SoC support" , Matthias Brugger , linux-arm Mailing List , Jingoo Han , USB , Sebastian Reichel , Linux Kernel Mailing List , ChiaEn Wu , Greg Kroah-Hartman , Jonathan Cameron Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Wed, Jul 27, 2022 at 02:24:46PM +0800, ChiaEn Wu wrote: > On Tue, Jul 26, 2022 at 7:59 PM Daniel Thompson > wrote: > > > > > So should we make all 16384 steps of MT6372 available to users? > > > > > > > > Yes. > > > > > > > > > > > > > Does that mean the DTS needs to be modified as well? > > > > > > > > Yes... the property to set initial brightness needs a 14-bit range. > > > > > > > > It would also be a good idea to discuss with the DT maintainers whether > > > > you should introduce a second compatible string (ending 6372) in order > > > > to allow the DT validation checks to detect accidental use of MT6372 > > > > ranges on MT6370 hardware. [snip] > > > > I'd be curious what the compatiblity reasons are. In other words what > > > > software breaks? > > > > > > The reason is as above. We just hope the users who use this series SubPMIC can > > > directly apply this driver to drive the backlight device without > > > knowing the underlying hardware. > > > Not software breaks. > > > > As above, ignoring the max_brightness property is a bug in the > > userspace. I'm still unclear why sending faked ranges to userspace > > it a better solution than fixing the userspace. > > Ok, I got it! > If I add a second compatible string (like 'mediatek,mt6372-backlight') > in the DT section, > and append 'if-then-else' to determine the correct maximum value of > 'default-brightness' and 'max-brightness', > Also, I will append 'bled exponential mode' to make user control using > linear or exponential mode. I'd be very pleased to see support for exponential mode added: it's a much better way to control LEDs and backlights. > These changes I will explain to DT's maintainer again. Excellent. I know DT maintainers are copied into this thread but they will probably not be following this patch's thread so it is better to discuss in the mail thread for the DT bindings! > Back to the driver section, > do I still need to use the register to confirm again whether this > SubPMIC used now is MT6372 and record this information? (using > 'mt6370_check_vendor_info()') > I am afraid that the user who uses the MT6370 hardware, but the DT > compatible string is set to 'mediatek,mt6372-backlight'. > This may cause errors when update/get brightness values. > So I hope the driver here can check again to make sure the > 'default-brightness', 'max-brightness', can be updated/got correctly. > I don't know if this will make you feel redundant if I do this?? Yes, it's good idea to check the hardware model during probe. I'd suggest just reporting this as an error ("Buggy DT, wrong compatible string") rather than trying to re-intepret the parameters. Daniel. From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9135BC04A68 for ; Thu, 28 Jul 2022 11:32:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KBY/W6X9Z0/txjuDP36CDGa/XQLTKID492BtUavSE5M=; b=EV5xT/f0rAVh2M bCe06rg+CndCrfNELgiqsXbO1XNWaEsfdvFrQFd2bSP8o6yoSSwDJPtrsOEWu0hkwNOpjvuPe6ZUL IZyMsnVddJRBznoefrNx1zoGLbCgd4hUHX2s2MJpIQuS/oYRM1fG2juXLQh0ErOhWGo0OAmSPfNMI CiJ/jLqlsX+ux/8LzBkn3x3nWPEoOAyOkJGyYzvtiYH9tmTaP1yGWnQWUcPT8/Pqj/PLOnLx0qgqn kUo0eLXNXEhDVKqq62DW8WTqUojYYxRCulPsYfRu+3MjuZd9mHsUQQR9SHxOB3cTx5oSuiHaJS38a X5HlDWEn7We0ro3Rb00w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oH1je-008jWy-K9; Thu, 28 Jul 2022 11:31:22 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oH1jZ-008jTh-8N for linux-arm-kernel@lists.infradead.org; Thu, 28 Jul 2022 11:31:18 +0000 Received: by mail-wm1-x332.google.com with SMTP id a18-20020a05600c349200b003a30de68697so3229208wmq.0 for ; Thu, 28 Jul 2022 04:31:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=SMC59iUGEUeIWikaYVLjy2odSUsf6J1BxrN5JwfwEpY=; b=I2LvfwRSLT0FBLkzKL97tXa0j3AxOgqK4JwBDMsSM+Z8HGBr1Hsl+SUU8HPYMLz66e 8uwZd7/fPyOTDqCE8CpYD1EB4BMYrqBICeOrQcRtAgtcyK1eE/L39avZt/VLlWPC4Uor LoRGhJiBQNR/hDNsANtNPDEqnDWOhfwEJTmwgA0Cv1jj23KAfdmGOY1sasEYVFjLX/YX ZlPZ2zhQiq7NYJ6LHAqKNcChUNlEupakqOtGb+CZPupdBgaFq1mBMgBamPwT1GZ2CiGh Xxn5YMmbVopGqmz+InpOVGDvq/m/bhIDEUtdkMhmWHk2Kp5mn0bff3ZHplSxHO3nCLJd f6Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=SMC59iUGEUeIWikaYVLjy2odSUsf6J1BxrN5JwfwEpY=; b=DYYwceLOKI1VLJ23Vruyo8O2xWq8Xvs7Nw/hE2UTF0VwV+Cilduj19VWn/AgyiYdaZ S7oUieosExvGea2wntvcuFlYn3ZpqTrjoMyOoRzj+RUXYtJGzWKLD7/o1bP/NfI832nY 6W65VLqLQAkTULWlr1XOWXmitxWi1baq/I5Su/RZSOtIgyomHOvK4PbZk0Q64T0i5Kde 49+sAh3HAnLrZLSj9j4l43kmQX9AYasH1BURh+uliLb54XKx5NCNii6csuCoSSrCMBGz CT4VGwjHG4lUp8mVwWH5PMfiluTesFOXuK99GyNREl0R3Qv36pWyiBRdW6T83+jWVU1C bS1A== X-Gm-Message-State: AJIora+xSTjRyqRAE6HMkvqngC3X0+/4unU9o/w7c5bZ1HvjaWDjqoN6 TGgskVTCyn+/7cJnfEltg76Ing== X-Google-Smtp-Source: AGRyM1vjIPgxwYbMk8BsnZlSouB9NDyINH+vUJA52rfBsJa1/epNS6uEmdrCNjJkZQ9qNZQU8kklUA== X-Received: by 2002:a05:600c:3556:b0:3a3:2a9c:f26 with SMTP id i22-20020a05600c355600b003a32a9c0f26mr6221269wmq.58.1659007873312; Thu, 28 Jul 2022 04:31:13 -0700 (PDT) Received: from maple.lan (cpc141216-aztw34-2-0-cust174.18-1.cable.virginm.net. [80.7.220.175]) by smtp.gmail.com with ESMTPSA id z22-20020a1cf416000000b003a35516ccc3sm937306wma.26.2022.07.28.04.31.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jul 2022 04:31:12 -0700 (PDT) Date: Thu, 28 Jul 2022 12:31:09 +0100 From: Daniel Thompson To: ChiaEn Wu Cc: Lee Jones , Jingoo Han , Pavel Machek , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , Sebastian Reichel , Chunfeng Yun , Greg Kroah-Hartman , Jonathan Cameron , Lars-Peter Clausen , Liam Girdwood , Mark Brown , Guenter Roeck , "Krogerus, Heikki" , Helge Deller , Andy Shevchenko , ChiaEn Wu , Alice Chen , ChiYuan Huang , dri-devel , Linux LED Subsystem , devicetree , linux-arm Mailing List , "moderated list:ARM/Mediatek SoC support" , Linux Kernel Mailing List , Linux PM , USB , linux-iio , "open list:FRAMEBUFFER LAYER" , szuni chen Subject: Re: [PATCH v6 13/13] video: backlight: mt6370: Add MediaTek MT6370 support Message-ID: <20220728113109.7gf3b36mqjxlhcq3@maple.lan> References: <20220722102407.2205-1-peterwu.pub@gmail.com> <20220722102407.2205-14-peterwu.pub@gmail.com> <20220725103128.xtaw2c4y5fobowg7@maple.lan> <20220726093058.2fz2p2vg7xpfsnfe@maple.lan> <20220726115954.kpkmidrk3zo3dpbq@maple.lan> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220728_043117_308445_39165E9C X-CRM114-Status: GOOD ( 36.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jul 27, 2022 at 02:24:46PM +0800, ChiaEn Wu wrote: > On Tue, Jul 26, 2022 at 7:59 PM Daniel Thompson > wrote: > > > > > So should we make all 16384 steps of MT6372 available to users? > > > > > > > > Yes. > > > > > > > > > > > > > Does that mean the DTS needs to be modified as well? > > > > > > > > Yes... the property to set initial brightness needs a 14-bit range. > > > > > > > > It would also be a good idea to discuss with the DT maintainers whether > > > > you should introduce a second compatible string (ending 6372) in order > > > > to allow the DT validation checks to detect accidental use of MT6372 > > > > ranges on MT6370 hardware. [snip] > > > > I'd be curious what the compatiblity reasons are. In other words what > > > > software breaks? > > > > > > The reason is as above. We just hope the users who use this series SubPMIC can > > > directly apply this driver to drive the backlight device without > > > knowing the underlying hardware. > > > Not software breaks. > > > > As above, ignoring the max_brightness property is a bug in the > > userspace. I'm still unclear why sending faked ranges to userspace > > it a better solution than fixing the userspace. > > Ok, I got it! > If I add a second compatible string (like 'mediatek,mt6372-backlight') > in the DT section, > and append 'if-then-else' to determine the correct maximum value of > 'default-brightness' and 'max-brightness', > Also, I will append 'bled exponential mode' to make user control using > linear or exponential mode. I'd be very pleased to see support for exponential mode added: it's a much better way to control LEDs and backlights. > These changes I will explain to DT's maintainer again. Excellent. I know DT maintainers are copied into this thread but they will probably not be following this patch's thread so it is better to discuss in the mail thread for the DT bindings! > Back to the driver section, > do I still need to use the register to confirm again whether this > SubPMIC used now is MT6372 and record this information? (using > 'mt6370_check_vendor_info()') > I am afraid that the user who uses the MT6370 hardware, but the DT > compatible string is set to 'mediatek,mt6372-backlight'. > This may cause errors when update/get brightness values. > So I hope the driver here can check again to make sure the > 'default-brightness', 'max-brightness', can be updated/got correctly. > I don't know if this will make you feel redundant if I do this?? Yes, it's good idea to check the hardware model during probe. I'd suggest just reporting this as an error ("Buggy DT, wrong compatible string") rather than trying to re-intepret the parameters. Daniel. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel