Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp7784633rwn; Wed, 14 Sep 2022 04:35:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR7rdiBVGZDqZFFRBMXiSZFaKsWQu+BWQOtezxgmZWJCIXuCspsI8UFwgW2xDbMgCg3Cps83 X-Received: by 2002:a63:87c1:0:b0:438:d54c:f8bb with SMTP id i184-20020a6387c1000000b00438d54cf8bbmr16161203pge.210.1663155320187; Wed, 14 Sep 2022 04:35:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663155320; cv=none; d=google.com; s=arc-20160816; b=BotRmDjrlmgAnU459B0pi5/x/7YnF12LdERBB+R73VbI1/gQxccgGLoeC/gl29zP4w Dqw/em3Anb/ndRqPIYorutXOWQAndvpWB2oFToG3fA8LRINbq/2vUji2gS7RpuFILxyv SMh311Bi5YNd0y1RAoW+EZihSJ/bx31CgtSW+fSWdqupw5RG3ebTgOh3acdwP4Q1Tvgl BNuF/1YS0xj4hWVRItsWSobfEUI0tqM+CpjPDe3XcNu4NSL7e+LyRNWIO/kxRaZJOB2d qLjMSYyvUrAPAkHC6YD0rhX8SgDUv7HxXvUSZNvGe5UbcEBbbHtxnHELmdw3TgArUiPs +8PQ== 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=M+3+44F49oM4iIfwSY5dMxqTqeMQjRYAGFKRXH7fILM=; b=AYInIwmHwjhM0Rav6LUa6f+HK6slNB9x+rcoWE92xWkb+pr0MPQOuqd9pIsKLf3RcA BKag1exY8rjjTeFYHafHIkq0iFG1tMaVnK/4MHFqOZEXK9ewQ/YjXErnw44kAw71RGlY Kd9EQ0UdiPQmaAUzJzn7a/tV0+x9u3qpeMK1g+ZLi27A/aVtDeypu9X9mq1rTvGIdIGO 3cpeLQIrbvPRiDRkH50q5ghEyY2vBGW1Kw09dxRhhWovlyrTkwDZhULBnzvKy947KNT5 sDznhonQigocfbEh5O4AJxqAjF5DDT7FoUoIOYHeUnntFL7a+xR3TWiRaJFBZsCydRn2 jENw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RTLEH4tn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x18-20020a170902821200b00172cb948c68si14008604pln.227.2022.09.14.04.35.08; Wed, 14 Sep 2022 04:35:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RTLEH4tn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229893AbiINK6s (ORCPT + 99 others); Wed, 14 Sep 2022 06:58:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230152AbiINK6l (ORCPT ); Wed, 14 Sep 2022 06:58:41 -0400 Received: from mail-qv1-xf2d.google.com (mail-qv1-xf2d.google.com [IPv6:2607:f8b0:4864:20::f2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC424F41; Wed, 14 Sep 2022 03:58:39 -0700 (PDT) Received: by mail-qv1-xf2d.google.com with SMTP id w4so11412345qvp.2; Wed, 14 Sep 2022 03:58:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=M+3+44F49oM4iIfwSY5dMxqTqeMQjRYAGFKRXH7fILM=; b=RTLEH4tnLUxxsXkknByr7ORhaSy8nGD9iq/AmO+LcChD4YPbVPvGWZiCvCov8tQ+z2 4h+KkoaKLBdTpe37v0PWR3FO4PtZv6WGlsiZXhptlJk+AozlD83UWZ0FYn70OTI0l+HX pbHeM7l+xQ+O1VdCw7ZdA64xzwJrEIdsca1Xx8xyRHgOjqjEgtozGFoH5s6N9XuefYd6 eCDLt0QEhnQnPsluVawvJqdyNk5AKGXRXbrKugRwOQXUdxliujH2bnv/j/DlPW2qC+K7 W8VOoK+c7oVdtSKeSgvPyLM4O+qnMssoHvsRrr/PHOauVZpePuItlim0myb0CcNaEGMk rvuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=M+3+44F49oM4iIfwSY5dMxqTqeMQjRYAGFKRXH7fILM=; b=hfaXltxGPxu0UTvbHwSbQrTCAyPXHsF4P3QoptdyKV7KF4qXCXketnmwSEKqICPz+X mGsryw3Fb7KszSvyKSK3hFVyPNU8xfr92iZF/AK7UmDFD70OwCeaM5fUWYvfiA/OveOs rEOLGjljgftAzvE1NS7rVP95b8yHRwwscUBN3eVc135D1jIbZoevYaXfV/Fujs1XlBRR rS4u1GIIqI/w1q3LjbenbKvukiXc5m2egAQQ0Etz8hWYMwIywlwo7R2xh/1q8wgDOSX+ h81RCYdmTTrZkXgHU3W7YrnL+ai/D/+rJ3RIKVdgHixAg5jXA74Drp14usXdkPtZkG7b 4r3Q== X-Gm-Message-State: ACgBeo3zDRlzTuNFednYCJ8CfhNpUnXdzvmDDdUgUn0Xd2bo3lM+XElP tEmgqA4QTSWZsPi4ygRVG6vOROo9dbML0EN3YgRMlv2Z5hLROQ== X-Received: by 2002:a05:6214:19cf:b0:4a9:4241:2399 with SMTP id j15-20020a05621419cf00b004a942412399mr30621295qvc.64.1663153119083; Wed, 14 Sep 2022 03:58:39 -0700 (PDT) MIME-Version: 1.0 References: <20220912212743.37365-1-eajames@linux.ibm.com> In-Reply-To: <20220912212743.37365-1-eajames@linux.ibm.com> From: Andy Shevchenko Date: Wed, 14 Sep 2022 13:58:03 +0300 Message-ID: Subject: Re: [PATCH v7 0/2] iio: pressure: dps310: Reset chip if MEAS_CFG is corrupt To: Eddie James Cc: jic23@kernel.org, lars@metafoo.de, linux-iio@vger.kernel.org, joel@jms.id.au, linux-kernel@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 13, 2022 at 12:27 AM Eddie James wrote: > > The DPS310 chip has been observed to get "stuck" such that pressure > and temperature measurements are never indicated as "ready" in the > MEAS_CFG register. The only solution is to reset the device and try > again. In order to avoid continual failures, use a boolean flag to > only try the reset after timeout once if errors persist. Include a > patch to move the startup procedure into a function. Good enough, although having a couple of nit-picks. Reviewed-by: Andy Shevchenko > Changes since v6: > - Use helper instead of the lengthy regmap_read_poll_timeout twice > - Just return dps310_startup in dps310_reset_reinit > > Changes since v5: > - Completely rework the second patch to reset and reinit in any > timeout condition, if there haven't been previous timeouts that > failed to recover the chip. > > Changes since v4: > - Just check for rc rather than rc < 0 in some cases > - Split declaration and init of rc > > Changes since v3: > - Don't check regmap* return codes for < 0 > - Fix comment spelling > > Changes since v2: > - Add some comments > - Fix the clunky control flow > > Changes since v1: > - Separate into two patches > - Rename 'dps310_verify_meas_cfg' to 'dps310_check_reset_meas_cfg' > > Eddie James (2): > iio: pressure: dps310: Refactor startup procedure > iio: pressure: dps310: Reset chip after timeout > > drivers/iio/pressure/dps310.c | 266 +++++++++++++++++++++------------- > 1 file changed, 167 insertions(+), 99 deletions(-) > > -- > 2.31.1 > -- With Best Regards, Andy Shevchenko