Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1710999ybb; Sat, 4 Apr 2020 10:36:20 -0700 (PDT) X-Google-Smtp-Source: APiQypKzXOToF687kv6dkePoWUke9JeLIvVHqlXQAAShUDtPkXWH/RiXLUb9kAWM3/+YS+CcY3f5 X-Received: by 2002:aca:bd0b:: with SMTP id n11mr6995833oif.90.1586021780061; Sat, 04 Apr 2020 10:36:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586021780; cv=none; d=google.com; s=arc-20160816; b=D1LUaMYj09ADT6mjr4Xt77EDwfa14O0J7v8lnX3aW0Et2UuC3iL1BQX77jV9LoUTeW QKk3km4S3UaE30PhrYgUUls0tQNYvMuaj7lTVygbo5TCh0ojk8pf89vMAacqD5b/W5Br ZgbvBuA3KRs6YZEJVjJnqQ6o4qKNg9xaaklaf3UJQbLjGMZs1rel4cEEDcQX9rbFvOde XAB3pJAonOJq7/rTbMvJJDoaTTCMFCdJrx09l46iX4rH3GcO9icvd0MSKHefoDGCAIZh Q0pBQ72Hs1XKU1+zhCjZ3PmoARiSoYRmAQSQde2XmkpRBBBLi+4ILlLZLUFxHcn/KpT5 jCMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=/fComAiMOskQAqf/UfIUYXWfRZk4X9H3xzWxUvkHj3g=; b=ms7ldSVYCK/O0OVHxuHeejsIcQuStYG7GYzmQcQqK+FwaraXURR1QA8SIVan7ieHPM FN/9HzD1YPZO5A2fnlezEb6GmMM6XGYCYj2Rqcpen16TIGrrUVVh0DhBmBXeaISm91kh T0SACKYjEJgdwc954CrsBsUsnkk7HpbCZyKLG9R7g1Ph+x2zpuKzUIjA4J0lyv0lhglH 0xklKNycz/40MVn8dYYi/rjeDU1etJJGsx/k4HKUwVYDZg+D/TZuy5+FLML5rV4sTKZN IsptoV8Zih2TR/sjWuI0DpnDebsAYDIng822xpi2VvWArkhdfit+2wrRHSvAbPGA1G2q IUxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pqgruber.com header.s=mail header.b=nKpFGX2x; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=pqgruber.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c2si6915590ots.188.2020.04.04.10.36.06; Sat, 04 Apr 2020 10:36:20 -0700 (PDT) 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; dkim=pass header.i=@pqgruber.com header.s=mail header.b=nKpFGX2x; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=pqgruber.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726258AbgDDRft (ORCPT + 99 others); Sat, 4 Apr 2020 13:35:49 -0400 Received: from mail.pqgruber.com ([52.59.78.55]:33482 "EHLO mail.pqgruber.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726207AbgDDRft (ORCPT ); Sat, 4 Apr 2020 13:35:49 -0400 Received: from workstation.tuxnet (213-47-165-233.cable.dynamic.surfer.at [213.47.165.233]) by mail.pqgruber.com (Postfix) with ESMTPSA id DC68DC726E3; Sat, 4 Apr 2020 19:35:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqgruber.com; s=mail; t=1586021748; bh=/fComAiMOskQAqf/UfIUYXWfRZk4X9H3xzWxUvkHj3g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nKpFGX2xzaf4wi4HV7XuaUHhbQe2RAKVpLKCzqAdur/qPj3Je/xLiqEXEbdWJUs8r 3Eh2cBzxyJhXDVccN5iSo3jdY56KDl0Zx5bStwmvIWMGrFJbtbXJ4wbCoOnYgedNfs izo4sOfJhTz+VXVJCjRd3WBWJATSlwYBnN19fI0M= Date: Sat, 4 Apr 2020 19:35:46 +0200 From: Clemens Gruber To: Sven Van Asbroeck Cc: Matthias Schiffer , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Thierry Reding , linux-pwm@vger.kernel.org, Linux Kernel Mailing List , Andy Shevchenko Subject: Re: (EXT) Re: [PATCH 1/4] pwm: pca9685: remove unused duty_cycle struct element Message-ID: <20200404173546.GA55833@workstation.tuxnet> References: <20200226135229.24929-1-matthias.schiffer@ew.tq-group.com> <20200226151034.7i3h5blmrwre2yzg@pengutronix.de> <32ec35c2b3da119dd2c7bc09742796a0d8a9607e.camel@ew.tq-group.com> <20200330151231.GA1650@workstation.tuxnet> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Fri, Apr 03, 2020 at 07:50:07PM -0400, Sven Van Asbroeck wrote: > On Mon, Mar 30, 2020 at 11:12 AM Clemens Gruber > wrote: > > > > On Wed, Feb 26, 2020 at 06:03:02PM +0100, Matthias Schiffer wrote: > > > As it turns out, this driver is broken in yet another way I didn't find > > > before: For changing the global prescaler the chip needs to be put into > > > sleep mode, but the driver doesn't follow the restart sequence > > > described in the datasheet when waking it back up. In consequence, > > > changing the period of one PWM does not only modify the period of all > > > PWMs (which is bad enough, but can't be avoided with this hardware), > > > but it also leaves all PWMs disabled... > > > > I am unable to reproduce this: If I set a specific duty cycle on a > > channel and then change the period, the channel stays active. > > I can see the brightness of an LED decrease if I increase the period. > > What happens when pwm channels 0 and 1 are both enabled, and > you change the pwm period of channel 0. Does channel 1 remain > on? Yes. Both channels remain on. Let's say I configure a period of 5ms for both channels 0 and 1, as well as a duty cycle of 4ms, meaning a relative duty cycle of 80%. If I then increase the period of channel 0 to 10ms, there will be a relative duty cycle of 40% on channel 0, but channel 1 will remain at a relative duty cycle of 80%. This is due to the relative nature of the internal ON/OFF times. For the channel with the period change however, we recalculate the duty_ns to period_ns ratio and reprogram the ON/OFF registers, because the user might have already given us a different duty cycle in .config / .apply. As the user is setting the duty cycle in nanoseconds, it makes sense that the relative duty cycle decreases in an absolute period increase. As for the behavior that the other channels remain at the same relative duty cycle: Not sure how we can avoid this, other than reprogramming all 15 other channels if one of them is changed and that's not really acceptable, I think. Clemens