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 51DBBC54EBC for ; Tue, 10 Jan 2023 16:26:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238618AbjAJQ0h (ORCPT ); Tue, 10 Jan 2023 11:26:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238975AbjAJQ0T (ORCPT ); Tue, 10 Jan 2023 11:26:19 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81DC26458 for ; Tue, 10 Jan 2023 08:26:18 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id w1so12373088wrt.8 for ; Tue, 10 Jan 2023 08:26:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=Th71AAKmDZ5QLm9LWP/MGYPBbhSZ+FFSLF2yOB7TE2s=; b=kpE4Zcq1gu13wpwafvb2i6Z0u9wBYGLLWrrhNQIKxDPIa5C1OHDMXC+fFg9Vu2BrEr 1PGdJR28gVhSlvWiEupF5gfHOtFmFyF3/bxbr8A4SsNB4iJx+Uc5zgTbvfWhZnZyPJgV RHWeGs3TluEjF9qgDAf/+Ep2OxX3pkfMwvpwxyET8qdO/srKqwBN5JkwS1/btNLI/zHU i2yK9CbkM6JOHGJk6tz/+HNRHD+x4G9z3uy+r+tlxqOQ0QreXtqutMDmEx+1mpgbkbfo B4svbjnliFLjKrCGEzdh5UjV8mY8nhKK7EAO7dbLjtokxu4kAjAzybqMu4XnJ2nYg9wd papA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=Th71AAKmDZ5QLm9LWP/MGYPBbhSZ+FFSLF2yOB7TE2s=; b=BX43sB82Zbhcb8g8il6GBbCVDuTWJyo7PPzEcpOqpfNi0MzkraNXMclF7O2HwM8OPI QyZRkNchFDRfmKjoKo4AdBfBkcOwAqY+flwAyAzPcNqSWorP3Eb1pOVWEotMbs2+zDId Tx7LMLeKgg3pM8uP+NxN38gdcfupn292a1h501UtbzzBVZpBV67q7jXQaAj57SiDLLO+ /qdHM8dag73lZNIPE6JEN90Vhtz6Qs6kyOFj/0qKF4JSryCTF+KnpBC/DkW46aCwXEmu d3bDnRBjItDFvAQquMSqLNKQTbfaN2rILPza/27XDCQSUQwTYYMryY5vf2+YsGNxQb3i kd5A== X-Gm-Message-State: AFqh2kpQ6s6cX8b48A3fxxpGsiJMSrk+dckvIA/R67PNM2UD4QvOzUh5 plvCWZG4kgbn7GvRxTulpwJfj1U+wHp60DKeR0Y= X-Google-Smtp-Source: AMrXdXv5EJHECoPiR0GtM9s69kjB61W0jLB4YsP0QuX7myrYiYxMtrdgJv+azKjI26FYQwGZ3348mw== X-Received: by 2002:a05:6000:a19:b0:2b1:c393:cbe with SMTP id co25-20020a0560000a1900b002b1c3930cbemr14799719wrb.11.1673367977022; Tue, 10 Jan 2023 08:26:17 -0800 (PST) Received: from aspen.lan (cpc141216-aztw34-2-0-cust174.18-1.cable.virginm.net. [80.7.220.175]) by smtp.gmail.com with ESMTPSA id n16-20020a5d4010000000b002bbed1388a5sm6276513wrp.15.2023.01.10.08.26.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 08:26:16 -0800 (PST) Date: Tue, 10 Jan 2023 16:26:14 +0000 From: Daniel Thompson To: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Cc: Thierry Reding , Lee Jones , Jingoo Han , linux-pwm@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, kernel@pengutronix.de Subject: Re: [PATCH 2/2] backlight: pwm_bl: Don't disable the PWM to disable the backlight Message-ID: References: <20230109204758.610400-1-u.kleine-koenig@pengutronix.de> <20230109204758.610400-2-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230109204758.610400-2-u.kleine-koenig@pengutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org On Mon, Jan 09, 2023 at 09:47:58PM +0100, Uwe Kleine-König wrote: > Most but not all PWMs drive the PWM pin to its inactive state when > disabled. Rely on the lowlevel PWM implementation to implement > duty_cycle = 0 in an energy efficient way and don't disable the PWM. I'm a little worried about this one. I thought the PWM APIs allow the duty cycle to be rounded up or down slightly during the apply. So when you say "rely on the lowlevel to implement duty_cycle = 0 to..." is it confirmed that this is true (and that all PWMs *can* implement a duty_cycle of 0 without rounding up)? Daniel. > This fixes backlight disabling e.g. on i.MX6 when an inverted PWM is > used. > > Signed-off-by: Uwe Kleine-König > --- > drivers/video/backlight/pwm_bl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c > index 0509fecd5715..7bdc5d570a12 100644 > --- a/drivers/video/backlight/pwm_bl.c > +++ b/drivers/video/backlight/pwm_bl.c > @@ -109,7 +109,7 @@ static int pwm_backlight_update_status(struct backlight_device *bl) > pwm_backlight_power_off(pb); > > pwm_get_state(pb->pwm, &state); > - state.enabled = false; > + state.enabled = true; > state.duty_cycle = 0; > pwm_apply_state(pb->pwm, &state); > } > -- > 2.39.0 > 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 26420C54EBC for ; Tue, 10 Jan 2023 16:26:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 699D610E094; Tue, 10 Jan 2023 16:26:19 +0000 (UTC) Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8F93910E094 for ; Tue, 10 Jan 2023 16:26:18 +0000 (UTC) Received: by mail-wr1-x42b.google.com with SMTP id d17so12377429wrs.2 for ; Tue, 10 Jan 2023 08:26:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=Th71AAKmDZ5QLm9LWP/MGYPBbhSZ+FFSLF2yOB7TE2s=; b=kpE4Zcq1gu13wpwafvb2i6Z0u9wBYGLLWrrhNQIKxDPIa5C1OHDMXC+fFg9Vu2BrEr 1PGdJR28gVhSlvWiEupF5gfHOtFmFyF3/bxbr8A4SsNB4iJx+Uc5zgTbvfWhZnZyPJgV RHWeGs3TluEjF9qgDAf/+Ep2OxX3pkfMwvpwxyET8qdO/srKqwBN5JkwS1/btNLI/zHU i2yK9CbkM6JOHGJk6tz/+HNRHD+x4G9z3uy+r+tlxqOQ0QreXtqutMDmEx+1mpgbkbfo B4svbjnliFLjKrCGEzdh5UjV8mY8nhKK7EAO7dbLjtokxu4kAjAzybqMu4XnJ2nYg9wd papA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=Th71AAKmDZ5QLm9LWP/MGYPBbhSZ+FFSLF2yOB7TE2s=; b=psmav3gDX825H0rPLY93i9PNbIWwMjHKFg7K2SNbhRRBi7qm+2RkWtanDiS5GAPDfy 1MD/5dViKsqur+FAFvDKj6gJjIGSzTZeB1N0EujwdJYzI6ZlnIpZ6LygWI0br8oWF3Ng 0JNArP5j3y1n4v8cJJNxZR+AzerrhKYDdzpfE3qXbV4EsrRZxR2VXe7pWcRVKzaZWpg1 +c7alZ1Ze3JgkthVLV1Ycn8z5IxHC2CJi/t1I4oqkkKaiGne8VqvP1l1Ab+O2lCONc1P F1a1Qqxm09bC2qevXRB/phfKv8mpMmZ67jEjOE6dU0XwUx3wlSNKpEXkuPte4vrjPMnC TLUg== X-Gm-Message-State: AFqh2kp+r2eWT0i4JHBRN6R7UNCFg4f4Ei6zvtBSHe8yYAjVgksDfXOO eSGCSsakpi8OBtlhwDgWyb/Qxg== X-Google-Smtp-Source: AMrXdXv5EJHECoPiR0GtM9s69kjB61W0jLB4YsP0QuX7myrYiYxMtrdgJv+azKjI26FYQwGZ3348mw== X-Received: by 2002:a05:6000:a19:b0:2b1:c393:cbe with SMTP id co25-20020a0560000a1900b002b1c3930cbemr14799719wrb.11.1673367977022; Tue, 10 Jan 2023 08:26:17 -0800 (PST) Received: from aspen.lan (cpc141216-aztw34-2-0-cust174.18-1.cable.virginm.net. [80.7.220.175]) by smtp.gmail.com with ESMTPSA id n16-20020a5d4010000000b002bbed1388a5sm6276513wrp.15.2023.01.10.08.26.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 08:26:16 -0800 (PST) Date: Tue, 10 Jan 2023 16:26:14 +0000 From: Daniel Thompson To: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Subject: Re: [PATCH 2/2] backlight: pwm_bl: Don't disable the PWM to disable the backlight Message-ID: References: <20230109204758.610400-1-u.kleine-koenig@pengutronix.de> <20230109204758.610400-2-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230109204758.610400-2-u.kleine-koenig@pengutronix.de> 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: linux-pwm@vger.kernel.org, linux-fbdev@vger.kernel.org, Jingoo Han , Lee Jones , dri-devel@lists.freedesktop.org, Thierry Reding , kernel@pengutronix.de Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Mon, Jan 09, 2023 at 09:47:58PM +0100, Uwe Kleine-König wrote: > Most but not all PWMs drive the PWM pin to its inactive state when > disabled. Rely on the lowlevel PWM implementation to implement > duty_cycle = 0 in an energy efficient way and don't disable the PWM. I'm a little worried about this one. I thought the PWM APIs allow the duty cycle to be rounded up or down slightly during the apply. So when you say "rely on the lowlevel to implement duty_cycle = 0 to..." is it confirmed that this is true (and that all PWMs *can* implement a duty_cycle of 0 without rounding up)? Daniel. > This fixes backlight disabling e.g. on i.MX6 when an inverted PWM is > used. > > Signed-off-by: Uwe Kleine-König > --- > drivers/video/backlight/pwm_bl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c > index 0509fecd5715..7bdc5d570a12 100644 > --- a/drivers/video/backlight/pwm_bl.c > +++ b/drivers/video/backlight/pwm_bl.c > @@ -109,7 +109,7 @@ static int pwm_backlight_update_status(struct backlight_device *bl) > pwm_backlight_power_off(pb); > > pwm_get_state(pb->pwm, &state); > - state.enabled = false; > + state.enabled = true; > state.duty_cycle = 0; > pwm_apply_state(pb->pwm, &state); > } > -- > 2.39.0 >