From patchwork Thu May 4 04:59:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 89920 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp69498vqo; Wed, 3 May 2023 22:29:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5DyykFZ0W8jiuS6pYOw4u0aZxiclW6NTf+1YR6wAhcBgVhzRTyEHuYDGbq0AZ4/0baw3Pj X-Received: by 2002:a05:6a00:170e:b0:63d:254a:3909 with SMTP id h14-20020a056a00170e00b0063d254a3909mr1116209pfc.32.1683178169194; Wed, 03 May 2023 22:29:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683178169; cv=none; d=google.com; s=arc-20160816; b=BY9WQNk8HpRo+04zoYdKVZMu6GZ+wUl2j5jbhkyktciBUxYoNCoYmyVa6TxCARzjeU m5zUHQrJAcLvwgZGks1XU/NQHHjrplmzjV5iftEwXY5viNm/ngUgA1p3O9WNNNXv8To1 hgjZ+Ypu8bDmc4JSuPsq11BACMKos7uIypD8NkcXkb2Ai29MRxzOldfqRs9Bi7U6ZnNr iCdj7K49ScN3SkIl9VmzNCUM6zczXGqVAc4ezyeUqCL5S0jHMaSL6/fXEg/ijyQw+TWc eIVpBm0sK08KmXkielXjeuspZ5Wj8NLGpiZRPHwVZ+/HoXy5g8Z+HmQI5x4VbE2aIUxI N06Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=3ErlKNWxBynVKO1TxiPrcdtE3Y8hGtnJhFEqGtEQkc8=; b=wZlxw1PF4vqFV73x8y6hOg9VJBY13+ZZcw4y+/sQLCS8+aGA1VDclh/0Br9Fh3BK3q wVEWEOpnROqb96S3S+04KDImnxjQINTS+ppn5JPhgMLO1VX2nsRuN9S8r4mNqyv3qRPX Oz4m5xhTRF5/kLIYydBRUTCizepWx+8NKJGVKWppMTfAP75vHmDokyz8LtcW6g2cjk/K xwdWE6rqpBIcrrfAHrW3UGaRh85OMfdWsrQZ/8WbRGmvZS97qvF1qTPVo8C+f5M7hI9V tjdZnnhDj5pfX8jB68kGBcxvrEJ/IKHAQCHIFhb+MUq0XdiYqb6AYGoCRHQESBIGsUxp 321A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=soIwOFlS; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w68-20020a626247000000b0063b87f60f7bsi34570655pfb.48.2023.05.03.22.29.06; Wed, 03 May 2023 22:29:29 -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=20221208 header.b=soIwOFlS; 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 S229610AbjEDE7P (ORCPT + 99 others); Thu, 4 May 2023 00:59:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229553AbjEDE7N (ORCPT ); Thu, 4 May 2023 00:59:13 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97EA31BCC; Wed, 3 May 2023 21:59:12 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-4f11d267d8bso26487e87.2; Wed, 03 May 2023 21:59:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683176351; x=1685768351; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=3ErlKNWxBynVKO1TxiPrcdtE3Y8hGtnJhFEqGtEQkc8=; b=soIwOFlSuDbixg2p6QtdSv5cD/tBfMNtUK26BEhWsrzI1LyhraH1IP/7pkVKQNhxHs HUIJgYKti/U32k8lDHufVq5ADib5F02en5QQvxvNpYP8aJzrvoggy1I+YUu1tViv2LnK NL0KfxYalHS7fqsfbvsS8UK65BCMmtRkb8ufoAHy2r36w7gq82xc+mwsq8X6cS5Vi4MA VufyakMl7lhWek/zQLsSdAAE4a0H4/bPZ0rWmiVDp1KwCSWqLXvyb6EHoaRbZftbnYU6 PlYmFCq57kaeltIRilTngjqhGubBKB9ehrBtcUBxwuGep2/pRTyDH0kZEIlpJLclS8kv BIUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683176351; x=1685768351; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3ErlKNWxBynVKO1TxiPrcdtE3Y8hGtnJhFEqGtEQkc8=; b=OYRuxPuY5zaVy/7G/MO90gmWw0PNt5nHxOt0kzFlr2KuwqSzqZfzD9b8Zru79GZcVY bB+30zIYUfXQfAwE8GrY0+2dHnEiJ1TeDuw+Hyz9v9nkHcCrUAefnffgxT2+WTYO/TdE JxC43wP624nEa6yYxxag2P3SyRFb1c7N/PHQ9I0nrRLw+byyB69Seutm2K2Ejo3hhbAa npeIXa2ADY7EEYacqTdiJGGER/U3ZSLNqVTdCiz7WQ/uUGxueFTS0gJTGbGcGEg0Mc7L Wwrnb0r+ih3aZEBrqC4TzA21CE6l6pNFtpDBgdobpMY64lAB1f6QzIvhJh8tjI9R7qru T1Qg== X-Gm-Message-State: AC+VfDysYPJpRbbldxhpPg6GY2iHHmh0MG0CPOS8oTK8MlxhoeJftLh+ MfuBXV1K36HRQKzbQTXzZppCArkADP0= X-Received: by 2002:a2e:97c5:0:b0:2aa:43cd:57c9 with SMTP id m5-20020a2e97c5000000b002aa43cd57c9mr497393ljj.36.1683176350423; Wed, 03 May 2023 21:59:10 -0700 (PDT) Received: from fedora (62-78-225-252.bb.dnainternet.fi. [62.78.225.252]) by smtp.gmail.com with ESMTPSA id v1-20020a2e9901000000b002ab4ceea005sm3242194lji.136.2023.05.03.21.59.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 May 2023 21:59:09 -0700 (PDT) Date: Thu, 4 May 2023 07:59:00 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Matti Vaittinen , Jonathan Cameron , Lars-Peter Clausen , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] iio: bu27034: Reinit regmap cache after reset Message-ID: MIME-Version: 1.0 Content-Disposition: inline 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764940231852817141?= X-GMAIL-MSGID: =?utf-8?q?1764940231852817141?= When BU27034 restores the default register values when SWRESET is issued. This can cause register cache to be outdated. Rebuild register cache after SWRESET. Signed-off-by: Matti Vaittinen Fixes: e52afbd61039 ("iio: light: ROHM BU27034 Ambient Light Sensor") --- I noticed this was missing while writing driver for another light sensor. The change is not tested in hardware as I don't have the BU27034 at my hands right now. Careful review would be highly appreciated. This change is built on top of the https://lore.kernel.org/all/ZFIw%2FKdApZe1euN8@fedora/ and could probably be squashed with it. Unfortunately I spotted the missing cache re-init only after sending the fix linked above. Please, let me know if you want me to squash and respin. --- drivers/iio/light/rohm-bu27034.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/iio/light/rohm-bu27034.c b/drivers/iio/light/rohm-bu27034.c index 740ebd86b6e5..f85194fda6b0 100644 --- a/drivers/iio/light/rohm-bu27034.c +++ b/drivers/iio/light/rohm-bu27034.c @@ -1281,6 +1281,13 @@ static int bu27034_chip_init(struct bu27034_data *data) return dev_err_probe(data->dev, ret, "Sensor reset failed\n"); msleep(1); + + ret = regmap_reinit_cache(data->regmap, &bu27034_regmap); + if (ret) { + dev_err(data->dev, "Failed to reinit reg cache\n"); + return ret; + } + /* * Read integration time here to ensure it is in regmap cache. We do * this to speed-up the int-time acquisition in the start of the buffer