Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5015215ybv; Wed, 26 Feb 2020 07:01:34 -0800 (PST) X-Google-Smtp-Source: APXvYqxGD+qd8fV5QCdq4YIEXt2GZMPjDnhXg4Z37DuA+LhK3tCiL2zKu5tAYBxqQixHl6UyP5LW X-Received: by 2002:a9d:6a4f:: with SMTP id h15mr3412041otn.86.1582729294320; Wed, 26 Feb 2020 07:01:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582729294; cv=none; d=google.com; s=arc-20160816; b=VVSXPgKvu3HDoLwDdZrRcsoQS+uesfy4+i+sfWiLf+Ja/vvuuVGgbGnqxR9ekYDtMs CyOwYYM6Ylc/HvBPZMPKS1kjfcPhljDn6I9nYx9ZSmEsA4hgAnQJl9UXg8uodrZxTocJ rmQyjze4F7UEvNShxuC4RV00dLObAphufn7816NGAGvvR2oeH6a0E0SwcGOPbmUjamOZ XSerTgS+XIU9G2tukRhkaVMhHwLWmKqnWRY1H7XQxNIP0APrYvWU4LMPeD9zNq1cYzzB zKw2/tGKPrb76pfWYMdy+vpBOQvhTYn1LD/tfKY+l3lloSL6VIAmO2tZ3miTuT1iCdvw 4+rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=y06OePhzl/x+isaKfmOEUzJZuDFskw3+kbDEHbSY3Io=; b=vH1CP9BXA2KxeipGDmCgB8wvTGRartRQTlLoJA+Zv6dw7hHRPmmykiOq1UH5mX6bLU n9OYEUVfnAj09uNsI1378P+YGW5BfryBfbSHoMP9gyjnDeOZFc2KgawGsqTtP3YRCIjK VApInEBuH1PfClPgZ4B4qz8evepuo0BnvB/aDW1NAcEukp6r3rT+wX1DAoZSIAHV/EHr /p4LqlQrtiPmAb85oeHI/efSqfdKadZzpP7aOe1ItDY1QkRXfqzXLNLA4QCfi2vQncjZ dFv7uLg+N6mC8i4zv4GnY49axTOXihvXKOhAIjofk//NE3JHyZSPHdNsGqD9ak7XpO75 oQqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l6si1511370otk.134.2020.02.26.07.01.21; Wed, 26 Feb 2020 07:01:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727560AbgBZPA4 (ORCPT + 99 others); Wed, 26 Feb 2020 10:00:56 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:36363 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727368AbgBZPAz (ORCPT ); Wed, 26 Feb 2020 10:00:55 -0500 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j6yBA-0003Nd-C9; Wed, 26 Feb 2020 16:00:52 +0100 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1j6yB9-0006Vz-EO; Wed, 26 Feb 2020 16:00:51 +0100 Date: Wed, 26 Feb 2020 16:00:51 +0100 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Matthias Schiffer Cc: thierry.reding@gmail.com, linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/4] pwm: pca9685: initialize all LED registers during probe Message-ID: <20200226150051.sbopz7uzbdhtccba@pengutronix.de> References: <20200226135229.24929-1-matthias.schiffer@ew.tq-group.com> <20200226135229.24929-3-matthias.schiffer@ew.tq-group.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200226135229.24929-3-matthias.schiffer@ew.tq-group.com> User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 26, 2020 at 02:52:28PM +0100, Matthias Schiffer wrote: > Initialize all ON delays to 0 during probe, rather than doing it in > pca9685_pwm_enable. > > Signed-off-by: Matthias Schiffer > --- > drivers/pwm/pwm-pca9685.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/drivers/pwm/pwm-pca9685.c b/drivers/pwm/pwm-pca9685.c > index 393ab92aa945..370691b21107 100644 > --- a/drivers/pwm/pwm-pca9685.c > +++ b/drivers/pwm/pwm-pca9685.c > @@ -289,13 +289,6 @@ static int pca9685_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) > { > struct pca9685 *pca = to_pca(chip); > > - /* > - * The PWM subsystem does not support a pre-delay. > - * So, set the ON-timeout to 0 > - */ > - regmap_write(pca->regmap, LED_N_ON_L(pwm->hwpwm), 0); > - regmap_write(pca->regmap, LED_N_ON_H(pwm->hwpwm), 0); > - > /* > * Clear the full-off bit. > * It has precedence over the others and must be off. > @@ -388,6 +381,13 @@ static int pca9685_pwm_probe(struct i2c_client *client, > regmap_write(pca->regmap, PCA9685_ALL_LED_OFF_L, 0); > regmap_write(pca->regmap, PCA9685_ALL_LED_OFF_H, 0); > > + /* > + * The PWM subsystem does not support a pre-delay. > + * So, set the ON-timeout to 0 > + */ > + regmap_write(pca->regmap, PCA9685_ALL_LED_ON_H, 0); > + regmap_write(pca->regmap, PCA9685_ALL_LED_ON_L, 0); > + What is a pre-delay: Something like: _________ ______ _____/ \_________________/ ^ ^ Where ^ marks the period start and then the time between period start and the rising signal is the pre-delay? If so, the IMHO more right approach is to keep the pre-delay until a new setting is applied and in .get_state ignore the pre-delay. This way you don't modify the output in .probe() which sounds right. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | https://www.pengutronix.de/ |