Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1992858pxb; Fri, 29 Jan 2021 10:08:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJz7bSLaJW4PdHW9OiOdcA/omRWtPNpqIAp+MFJeuKryvHtBGT2Ena8OQFT8wDhHNbU3Zuj+ X-Received: by 2002:a17:906:705:: with SMTP id y5mr5866825ejb.83.1611943701240; Fri, 29 Jan 2021 10:08:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611943701; cv=none; d=google.com; s=arc-20160816; b=xhhkRy3WaMwK2eP4QLifGossckORPefy4oZztz7cg0GY/acQPW9xvV9WYbunoOxDEP FCOr7buG7AxeiUsRlVowyBr6Rd5Y7sVecUPt4KgJSdcvVfNPFBg+lDuuQsi4DkY3+JgR sUfaprCMdy/qdawLJnQfBQwe55C7ckIVXdg/A3dEUeeNSqmA8nTvZMWID2teKmB8P3IN Rj2DYLf9m0/veuHfyM+FA/IxDukJS08KM3WTkOanEBMw/Bea3kFPVzfsKcMHbmJ5CA8e gFSvgKzko1fRq0f9Y8sffJyf0cLON1Hc/bV81VxO8Lz3VHGnIDEBZaiuNNGa+GA/mflQ eiFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=1TUmFsIXMj99gpVwAwuKHWnYGYjhbCT8uRiqDmlEl0U=; b=uIfb4t9NAEbAUCCJQK7Sa7oeZZ+46hrTClu+M+CP0pHH86H3fphh0ki8luFvvKQpDs LWTlk08v0oONHO/fMF2grVVLElKsCs33tABOCeeUHV1R1ajQvaexxvCI2x93PIhbHfD0 Q1Je6kUOwf4zCqTqEhxNqwbCee/hGhwDl4vsDtmAamuA5FotKRt9Fm50Ip1Y0wv9Ef7+ Lo2FJ/FhQqc/OB0p7QIZwmRTzYyxCUmWB+HsNv+7Noi8j8+uo2id9Al7l5zmEyCfL5n0 6YYLuDyoVGM9qZ/8WID2f27T5IwqaVyaHXS8zzdksnEzhcrtdSFRytpE3mC027r1+fU9 k6UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=U+awAkYP; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i4si5197020ejy.94.2021.01.29.10.07.56; Fri, 29 Jan 2021 10:08:21 -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=@gmail.com header.s=20161025 header.b=U+awAkYP; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232401AbhA2SGK (ORCPT + 99 others); Fri, 29 Jan 2021 13:06:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231381AbhA2SGH (ORCPT ); Fri, 29 Jan 2021 13:06:07 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9861C061574; Fri, 29 Jan 2021 10:05:26 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id e15so7878937wme.0; Fri, 29 Jan 2021 10:05:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1TUmFsIXMj99gpVwAwuKHWnYGYjhbCT8uRiqDmlEl0U=; b=U+awAkYPZ/5PjCF3LZpLShMgbJhZ7YWMXxANLLBz+8ZPsdewtGhwFiAtFbNO8Wi0nL lr/1sE8CbeqbgBMKetYx7NdpBxuEj8RMzI7yc1cXvMQqN5m/Y+qG/YlQ2a72xMmJ+Cwy OsfPx3g0YlPUT56gyGoP9d4/fRjf7xCbXoudM23VRJAeCoMaOhtmcEjSnPRstMPEtNXA puCTpHmhfBlfXsbjyYmX0OdBuV6nFYU6zHdAu+O2DqRToYZtzUwSdBUtEJ/iolNoZ4N5 DDk1IloWN8RKiB41jzitmz6P11xXmWLEaKJVLmFt0Kp8Aw0m4ppoDC2Ca5BuExG2c7qw 5/og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1TUmFsIXMj99gpVwAwuKHWnYGYjhbCT8uRiqDmlEl0U=; b=jEFoiXlcqwSr+57aPaqYCBs0/If6NX7BPXfksO394WFHHMpeS0zFOaGi8dkqE/fjsD aMlHitgJHivZKCQ+HVbgghABXfglR454QfyTpsilUAXuYoU1kpPf2Xf0uM23bvJ84NW6 uTC+nXOiI/qA+KVAJJCYsknDuLrEzK710ZcNmqYnMRvRo/9vwBz/P+SBgmiVisN+3X+8 jFlp+0jnlCacSXWNixnZhl6JLkzgm+ubWUs/je74kPBxplwW96Gj6ppjcxspQulid2Ix E3KSyi0PbjlZPzA1TOBB2UlZnBTiiIOwW6r9b09qB3VOyTOUGSNMY1CQs6RjfTW9l4v0 wdHg== X-Gm-Message-State: AOAM531185YntYM67hiGVvH43uXlDQoQS+RhgmSMmKsKgW5my9jIjCOp Q+Lly6UGZ4rTMtX9mVNd5gblVqC92ggBOpgDMSY/6FRFZNU= X-Received: by 2002:a1c:4e:: with SMTP id 75mr5003263wma.150.1611943525234; Fri, 29 Jan 2021 10:05:25 -0800 (PST) MIME-Version: 1.0 References: <20201216125320.5277-1-clemens.gruber@pqgruber.com> <20201216125320.5277-2-clemens.gruber@pqgruber.com> <20210111203532.m3yvq6e5bcpjs7mc@pengutronix.de> In-Reply-To: From: Sven Van Asbroeck Date: Fri, 29 Jan 2021 13:05:14 -0500 Message-ID: Subject: Re: [PATCH v5 2/7] pwm: pca9685: Support hardware readout To: Clemens Gruber Cc: =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , Thierry Reding , Linux Kernel Mailing List , linux-pwm@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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. In short, it's a tradeoff between code complexity, and user friendliness/ features. Sven