Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2082756pxb; Fri, 29 Jan 2021 12:40:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJxeVmMq5kM4oYMc4/gmBOvZO3ed9+6npX44RsbHIoAxIb2yuJwKVGA15ak+8DnZbLr13tx0 X-Received: by 2002:a05:6402:28e:: with SMTP id l14mr7437168edv.19.1611952852596; Fri, 29 Jan 2021 12:40:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611952852; cv=none; d=google.com; s=arc-20160816; b=ll4un4Spn+FjIusoxaKwA9HuL8RX50mxS5aVCMgJuEKle1TtdXN9K4o4C4zfcjfxqX XoHaLyQJU6D4n/Keplj/XOYANsyxngUT2ubcnWv1lEvu5uRHcV6GVJEjAGyaBfmgA5FO ymI+AQlZRh7t4Doo8DZdjIPUJx8uDRUPHkRl+5n7UMynkmBMQNHijz3Wd2EPSSXvp89m FzBaner4k0T6978+E+K/3wF9pZtdEMQwkUIDITNq9JsBlxR0zEJggxwC6CYsBfSz/2op AoQgL3S1t0H9r6glRNn6R9rWUrMfhXcLHkJfSrJ6Tjcp84WmzAd8Bckqb971f87V5Tb5 369g== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=M77IeiI3LvLSKSlLTtriV575WwpoQQQ6BC6g1xaE4bw=; b=kDQ7evnXoD4NosPyCO1ojw1uDadrhehKCwftWGAALuXAyfQvO/YsAD3iQHzkzn+aiE I/HeA5Yat1kv4FEOxYuI8c2GPNftEHh94B83jmB81t1ks/hDS8mqmZgyUOPvVM6eGdRx wr0pjjBVm5rghwmuRuRP635LB0IODlagLuQa1pn1Ef5MFNIwTwt1002N31CefbsiBVPb iNQxhmxUT+sMadfenSOweI+kFdhjl0P4czE4bxxVZuV4vXO/q1PRhh2omfZpmrBISuZu OG09JwegVXKmW7wK/8pDvv43KawjBUhmdr5T1Ty32dGwQEgp9z/lYthuVEzV/QGD3XpQ iWyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pqgruber.com header.s=mail header.b=w0xNUbE6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=pqgruber.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ga8si5510007ejb.614.2021.01.29.12.40.27; Fri, 29 Jan 2021 12:40:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@pqgruber.com header.s=mail header.b=w0xNUbE6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=pqgruber.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233200AbhA2Uie (ORCPT + 99 others); Fri, 29 Jan 2021 15:38:34 -0500 Received: from mail.pqgruber.com ([52.59.78.55]:57998 "EHLO mail.pqgruber.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231485AbhA2Uia (ORCPT ); Fri, 29 Jan 2021 15:38:30 -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 55628C6B26F; Fri, 29 Jan 2021 21:37:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqgruber.com; s=mail; t=1611952668; bh=M77IeiI3LvLSKSlLTtriV575WwpoQQQ6BC6g1xaE4bw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=w0xNUbE6qYayxulO8c/Jz7MWooXrxEyeZRUOk1v0bPhzt5bpcGm0F21WrgyMtxLiZ oRcEXbD6RyApswoXvRG9HPdmvg2K6jzJoSRVSvoWgZhMfmEs+AxtDlyom636a+O+ZT 4/EjuGjie34HOl6HMvZ2gCk90nZ5g92ca3RdXvEE= Date: Fri, 29 Jan 2021 21:37:47 +0100 From: Clemens Gruber To: Sven Van Asbroeck Cc: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Thierry Reding , Linux Kernel Mailing List , linux-pwm@vger.kernel.org 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 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