Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1198244rda; Mon, 23 Oct 2023 05:49:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE/yWvSioADXSD2Hi09DPCPAk4lAymJOKkTtxVh1Gs62HsppLbAKk8SpbTCc+uHYiu3U7nk X-Received: by 2002:a17:902:c948:b0:1c9:e0f9:a676 with SMTP id i8-20020a170902c94800b001c9e0f9a676mr7172401pla.6.1698065371765; Mon, 23 Oct 2023 05:49:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698065371; cv=none; d=google.com; s=arc-20160816; b=a04ZN8UHir066jHgurL8cm15qasU9GKRDevPUOo8IkMd7gy2QN5szqnTzQbVD7mUlz 8ab1tFpvJoI8n0gcqQgrDDHPoPEk095B6coQ40jinGA8otblWytYh4ixYuUIm6Uq1d1H L79pC0623IxfjuwKYnJ7dzhkmO8H48C1VHLmyNnfsqfESrumSXOtK8vtWVwM1LtX4qHH 2jkhO9/6igbKXgl5DROOtZ3kBl6xKWfUQzaRYP0R4h9gTFexnMRBEbtbiRnRtJ+ICd0y s61k6Zg1i5EopTiarW3sFn492ZxjqTmSuPKBi7tcQl+N08jDyrNO4UZecL6cLTOj6i8z H6cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=5F2/b6x1LCbJBCL/hGp4wgBjwVGE9CeqqG2gwc9QLwU=; fh=+jQk3PeLFN3GvU/dWsfYDuws39dokjKN+56mob/fSsU=; b=DOgbUXK6M/MF4ROT9A9YggztcZbzQWy+++22B0qp4mfxpz5I4ygIiOBZbqBlw96MPN 7FY0S8RruJzLXRqDsZ5QJmFabVgBNYZKbMSapDUb5Sa+022K4DUsBTvJRiN4MglymF7t JIdVTS+7hQqrHurtj5+Nxt/ujcnYHo7xh5niFfmxYkvhgG/2jGovckJtGE+eXYki2x8G Cmymqg3S0aPhK3Y5akg5Cm8CMAEL7vkjka8p36aeihhjKZOYPr2HZK1x32dMXuBSndxU MgaDlJYv3522rlPuJqwEN+MqEpiOZwUcp9zf11yt49ieYEqRyc3aUyaYuJYUPdGfWD8e koWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=u39RIBv1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id y19-20020a170902ed5300b001c60c5726absi6319342plb.39.2023.10.23.05.49.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 05:49:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=u39RIBv1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 30EA380A28E1; Mon, 23 Oct 2023 05:49:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230140AbjJWMtR (ORCPT + 99 others); Mon, 23 Oct 2023 08:49:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229613AbjJWMtQ (ORCPT ); Mon, 23 Oct 2023 08:49:16 -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 69E47C4 for ; Mon, 23 Oct 2023 05:49:13 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2c4fdf94666so42635611fa.2 for ; Mon, 23 Oct 2023 05:49:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698065351; x=1698670151; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=5F2/b6x1LCbJBCL/hGp4wgBjwVGE9CeqqG2gwc9QLwU=; b=u39RIBv1Yj049P7EKDELlMkE6cGW3gTDyXQwBj2rcz0m6WyBqMjCkSanN+rhaIzljt +Pg3eXQT/4ew7gmEu2CRa6q5TxI+m0AZhmFGrAvazx91t02ZeWmIU6F7ptY+dxk56Bzc CTumJD39sqiuYB+8CFt/OvlkQsMIHraj549twqWRieHATy0pA6GxhDY5s36JIBxPhIdB CgQKsW4ogTIbVCbRyZq+iYecsQ7/BGdjuoQOKoTEGF6lO1Y7KIjSudYdvjmzWdW0WNgQ 3+MnSMXhjtjP0AUW3n5SbvY9PvUsqsfQ7BOamSutWUWHJavf46fplBbE9hSdJoO0TnvS ZZNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698065351; x=1698670151; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5F2/b6x1LCbJBCL/hGp4wgBjwVGE9CeqqG2gwc9QLwU=; b=Absc9WnC1izx4fb6l0+ApIJMGZtPuJ1CxS5Sb4SKCWae2QSNSthQU1WpZ6LCSbz9iz aWpYbGVXBm9Fe0mD6hicX5uZMPhmqCEjKkjk32kcOl2U3yropVjnLvunY4/wNPBmCMmf Y5m+fa+/6sc6jmnwnNDHjVZ48CR9L6v1F3xuFEbwatHrhcYVh4BNWF+Rf0NCUwvsm8A0 zUefJTUpbXA/2wWkQgzJ4J41cVBvn+l1REUbFSqJxZj0FQljU73NvBvBXckRJ2gqLXX5 OnffUxdyIfSMewuSkkAxMyBAqw1F+C7Wfq0Sag2jB79/2Ojnc8nUiC8vak0gO2S4IWka pVIA== X-Gm-Message-State: AOJu0Yyk0RPzMK6m9+Hs2A0CZ/A6o6k9IX6A4bITwnQMbv+X8NNsCmSO cWOw5uwkmzLHmRETg8Cllr54Hjxy3JEIsEqagsewBQ== X-Received: by 2002:a2e:7c15:0:b0:2c5:5926:de52 with SMTP id x21-20020a2e7c15000000b002c55926de52mr6031556ljc.53.1698065351491; Mon, 23 Oct 2023 05:49:11 -0700 (PDT) Received: from aspen.lan (aztw-34-b2-v4wan-166919-cust780.vm26.cable.virginm.net. [82.37.195.13]) by smtp.gmail.com with ESMTPSA id j6-20020a05600c488600b004080f0376a0sm9320997wmp.42.2023.10.23.05.49.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 05:49:11 -0700 (PDT) Date: Mon, 23 Oct 2023 13:49:09 +0100 From: Daniel Thompson To: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Cc: Philipp Zabel , Thierry Reding , Lee Jones , Jingoo Han , Helge Deller , linux-pwm@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: Re: [PATCH] backlight: pwm_bl: Avoid backlight flicker applying initial PWM state Message-ID: <20231023124909.GC49511@aspen.lan> References: <20230608-backlight-pwm-avoid-flicker-v1-1-afd380d50174@pengutronix.de> <20231018210741.6t3yfj6qgmpwhhlo@pengutronix.de> <20231020112727.GF23755@aspen.lan> <20231020121148.3g6t3v5uuyubifpb@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231020121148.3g6t3v5uuyubifpb@pengutronix.de> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 23 Oct 2023 05:49:29 -0700 (PDT) On Fri, Oct 20, 2023 at 02:11:48PM +0200, Uwe Kleine-K?nig wrote: > Hello Daniel, > > On Fri, Oct 20, 2023 at 12:27:27PM +0100, Daniel Thompson wrote: > > On Wed, Oct 18, 2023 at 11:07:41PM +0200, Uwe Kleine-K?nig wrote: > > > Hello Philipp, > > > > > > On Thu, Jun 08, 2023 at 04:11:14PM +0200, Philipp Zabel wrote: > > > > The initial PWM state returned by pwm_init_state() has a duty cycle > > > > of 0 ns. > > > > > > This is only true for drivers without a .get_state() callback, isn't it? > > > > pwm_init_state() explicitly zeros the duty-cycle in order to avoid > > problems when the default args have a different period to the currently > > applied config: > > https://elixir.bootlin.com/linux/latest/source/include/linux/pwm.h#L174 > > Ah right, pwm_init_state() is strange in a different way than I > remembered :-) pwm_get_state() is only called to get .enabled set > appropriately. > > Looking at the callers: > > > - drivers/video/backlight/lm3630a_bl.c > explictily sets .enabled before calling pwm_apply_state() > > - drivers/video/backlight/lp855x_bl.c > explictily sets .enabled before calling pwm_apply_state() > > - drivers/video/backlight/pwm_bl.c > This is the one we currently discuss. I think even with the patch > applied it uses the .enabled value returned by pwm_init_state() but > it shouldn't. Agreed. > So all consumers using pwm_init_state() either don't use the .enabled > value returned by pwm_init_state() or at least shouldn't do that. Looking a little deeper in the PWM code, it looks to me like pwm_bl.c could just use pwm_adjust_config() during probe to transition between bootloader settings and kernel settings! Daniel.