Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp376307rdb; Sat, 30 Sep 2023 07:53:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF75Ab529U3+vG+FTQNn73EgwVRy1caAjz2q5hCha6RCYvZsi26RS3mQf2ftRe6/k5Wfdo1 X-Received: by 2002:a17:90b:1d09:b0:273:4672:98b5 with SMTP id on9-20020a17090b1d0900b00273467298b5mr5641233pjb.42.1696085605298; Sat, 30 Sep 2023 07:53:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696085605; cv=none; d=google.com; s=arc-20160816; b=W4UeLqAqSMxDE9HOwMPD6Wnzr0DB7ox9F9Mk1vKk380zMJYTaCpmhBJ9RmyBCvJnoZ oV9oZLcgQno1kt5YvYKRSr50R7XooOb+3Vrh6Q5bfx0a0L7eDNgVPnsN56cxUMPMec9F QAB7SaL5lvawlP/F8nPln5pcCQ7c7DIHf4OmxqWYH6lPjEd3iiIyAMg08zHy97WKwPSv l2DkN3so0N1gJy0qbrOrzKxw+aY/RGwFVlD1Kz6A7B9MtRZVUhGYcmQFb8Ewnv3pwXXY CLjSZxviGHMKi5beeRId9wyGtP+2+HTYYFXyO5Pey3/nd7YgCbyFGxaq+vTEqStKlrDA Y/nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=RKtXIb5zEG/73wDL5rNTt2N4viLqDaKP+PMlbPbeV98=; fh=e9lXfbAZmLMG/YSSxlbXRgGopMc52ojan+iACBc5a/Y=; b=dPLZlQsWv/rmEV4ef3WbNXuik3i9+sAWDofVmxr42Y3uTMsd9ViskV9YAHIi6ZBtWm lXfhohssAjl6OZFoNjlLfNS6BRJGdxbNtralWsGwRKRSV5V0z9UKCuzV+WTrcxU/jJSz yU/VdxXcmASKwpIMMKjpnt53QBcUewv5kxhRu1B1j/Kid2olEK9b2pXeNHoVibhUOCh/ 8Ug7dCzSbAOjx2YmuhZnDdlOmOIT7dshn26Mc62uPfROpGixTzNElTEC+v5qVl6IFW9J E/iWBFhfzE+y41PNobPk/ocmZDCVu+VnLoDgc+jAPtHKX1wW4jYVMLwi9S2e86M0eOH9 41bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="H7Ws5/2q"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id f18-20020a17090ace1200b0025eeb3cc4b2si3746504pju.9.2023.09.30.07.53.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 07:53:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="H7Ws5/2q"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 7561A8082A4B; Sat, 30 Sep 2023 07:51:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234356AbjI3OvU (ORCPT + 99 others); Sat, 30 Sep 2023 10:51:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234361AbjI3OvM (ORCPT ); Sat, 30 Sep 2023 10:51:12 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A9AC1B2; Sat, 30 Sep 2023 07:51:09 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E70CC433AD; Sat, 30 Sep 2023 14:51:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696085469; bh=/lLYV8RvUqyUZptiSLATFeHJqg+Lsns2VaQMO9wB+FQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=H7Ws5/2qRmB4uJOVCDWKpwBIby8e0t3fSlOaRbpd0W9Oime3fkedtF/SqUSDLb1lt VgMJ5I7DOjAkfkUJ08GQY+H1U8a2xO90GwN+zhu1YgHHnjlj3NQvoPxiVqOFfDn+aW aVprqmb0HWfchE2Mbcx/pY4W8msSAbCeYdTt8plHDvRfb95swJFDjLYGzLwvDXgMfA 8v9YmAPNlwAcsLeJiB8vl+iP/DsQoPqJmIcFz39//YVkJezQtQEiv43rKUZipeggtf w/qozQ7+yUOgzjzDRndqSo2duYO8j6MX5m39r26ueTdqkZwM0WwbuvNOxvJEvE6bAM xY0dFIivHzzeA== Date: Sat, 30 Sep 2023 15:51:07 +0100 From: Jonathan Cameron To: David Lechner Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-staging@lists.linux.dev, David Lechner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michael Hennerich , Nuno =?UTF-8?B?U8Oh?= , Axel Haslam , Philip Molloy , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 10/27] staging: iio: resolver: ad2s1210: use regmap for config registers Message-ID: <20230930155107.47bf5b1d@jic23-huawei> In-Reply-To: <20230929-ad2s1210-mainline-v3-10-fa4364281745@baylibre.com> References: <20230929-ad2s1210-mainline-v3-0-fa4364281745@baylibre.com> <20230929-ad2s1210-mainline-v3-10-fa4364281745@baylibre.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sat, 30 Sep 2023 07:51:38 -0700 (PDT) On Fri, 29 Sep 2023 12:23:15 -0500 David Lechner wrote: > From: David Lechner > > From: David Lechner > > This makes use of the regmap API to read and write the configuration > registers. This simplifies code quite a bit and makes it safer > (previously, it was easy to write a bad value to the config registers > which causes the chip to lock up and need to be reset). > > This chip has multiple modes of operation. In normal mode, we do not use > regmap since there is no addressing - data is just bitshifted out during > the SPI read. In config mode, we use regmap since it requires writing > the address (with read/write flag) before reading and writing. > > We don't use the lock provided by the regmap because we need to also > synchronize with the normal mode SPI reads and with the various GPIOs. > > There is also a quirk when reading registers (other than the fault > register). If the address/data bit is set in the value read, then it > indicates there is a configuration parity error and the data is not > valid. Previously, this was checked in a few places, but not > consistently. Now, we always check it in the regmap read function. > > Signed-off-by: David Lechner This was a complex change, so I'm partly relying on the fact it clearly works after the change to be sure it is correct ;) Anyhow, code is much cleaner and probably right, so applied to the togreg branch of iio.git and pushed out as testing for all the normal reasons. Thanks, Jonathan