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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB03CC433E6 for ; Sun, 14 Feb 2021 14:47:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9D21B64E56 for ; Sun, 14 Feb 2021 14:47:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229759AbhBNOri (ORCPT ); Sun, 14 Feb 2021 09:47:38 -0500 Received: from mail.pqgruber.com ([52.59.78.55]:50520 "EHLO mail.pqgruber.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229563AbhBNOrd (ORCPT ); Sun, 14 Feb 2021 09:47:33 -0500 Received: from workstation.tuxnet (213-47-165-233.cable.dynamic.surfer.at [213.47.165.233]) by mail.pqgruber.com (Postfix) with ESMTPSA id 2B2B9C727E0; Sun, 14 Feb 2021 15:46:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqgruber.com; s=mail; t=1613314011; bh=sxi7a6E8cRH4ZwXVlJ0++ebboH+ZCqj50zgHlBOdnPA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=xw3sdAsHZOtda3rZh7oPB+C/nGMt6R03OGoXlhK5VwQYhvW1mZdbmFcF2dTAwYNlf J+sIYMEjkhYj8wXKclccHIlliuTxLidO7c7MghieT0yS8E5VtBloE3cS7Kappk1MCn 9CIOnrVoEDC48W8yi1vucbOEdJ2t+MKK/hIGebps= Date: Sun, 14 Feb 2021 15:46:49 +0100 From: Clemens Gruber To: linux-pwm@vger.kernel.org Cc: Sven Van Asbroeck , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Thierry Reding , Linux Kernel Mailing List Subject: Re: [PATCH v5 2/7] pwm: pca9685: Support hardware readout Message-ID: References: <20201216125320.5277-1-clemens.gruber@pqgruber.com> <20201216125320.5277-2-clemens.gruber@pqgruber.com> <20210111203532.m3yvq6e5bcpjs7mc@pengutronix.de> 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-kernel@vger.kernel.org Hi all, On Fri, Jan 29, 2021 at 09:37:47PM +0100, Clemens Gruber wrote: > Hi Sven, > > On Fri, Jan 29, 2021 at 01:05:14PM -0500, Sven Van Asbroeck wrote: > > Hi Clemens, > > > > On Fri, Jan 29, 2021 at 11:31 AM Clemens Gruber > > wrote: > > > > > > Ok, so you suggest we extend our get_state logic to deal with cases > > > like the following: > > > > Kind of. We can't control how other actors (bootloaders etc) program the > > chip. As far as I know, there are many, many different register settings that > > result in the same physical chip outputs. So if .probe() wants to preserve the > > existing chip settings, .get_state() has to be able to deal with every possible > > setting. Even invalid ones. > > Is the driver really responsible for bootloaders that program the chip > with invalid values? > The chip comes out of PoR with sane default values. If the bootloader of > a user messes them up, isn't that a bootloader problem instead of a > Linux kernel driver problem? > > > In addition, .apply() cannot make any assumptions as to which bits are > > already set/cleared on the chip. Including preserved, invalid settings. > > > > This might get quite complex. > > > > However if we reset the chip in .probe() to a known state (a normalized state, > > in the mathematical sense), then both .get_state() and .apply() become > > much simpler. because they only need to deal with known, normalized states. > > Yes, I agree. This would however make it impossible to do a flicker-free > transition from bootloader to kernel, but that's not really a usecase I > have so I can live without it. > > Another point in favor of resetting is that the driver already does it. > Removing the reset of the OFF register may break some boards who rely on > that behaviour. > My version only extended the reset to include the ON register. > > > > > In short, it's a tradeoff between code complexity, and user friendliness/ > > features. > > > > Sven > > Thierry, Uwe, what's your take on this? > > Thierry: Would you accept it if we continue to reset the registers in > .probe? > > Thanks, > Clemens I realize that it is a difficult time at the moment, but it is a little bit frustrating not getting any response from the maintainer. I think the best way forward is to just keep the register resets in probe as they are. If this is to be changed, I think it should be done in a separate patchset and by someone who has a usecase requiring it. Best regards, Clemens