Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4210342iog; Tue, 21 Jun 2022 14:37:06 -0700 (PDT) X-Google-Smtp-Source: AGRyM1toQdK5Vkisj5yfKnAYrK7y3PhJWWohOpS3ps9nOb984AgX1uGhGvg/HSraPxePWW0sO2G/ X-Received: by 2002:a05:6402:448c:b0:435:9dcc:b8a5 with SMTP id er12-20020a056402448c00b004359dccb8a5mr139097edb.287.1655847425811; Tue, 21 Jun 2022 14:37:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655847425; cv=none; d=google.com; s=arc-20160816; b=uzYFx8DsMOBSVgp2TN1Gr3GLdjYWCLrZplQI3QbFOSzNREUaW2qkrC6tF5Q7xE2S5o mwyYTejMO3pbTy5i+bOK/GBLDzqeMnhgcDOP8QqMrrwmS3xB2ho4JqvrGpp0nD+fP021 cTcrMDZbdxkghJAqaoOzmwITZTscO+vk4LNOi8SWneCaCerUd2oATGCNSODNfYznVyyC fYPf5djaDJNIGA5dg3yRChpMVW7hts0AMF3XN0qdu8n7Eh+Q32/zO+UoUnr8C36abRf6 KSI/jTVIN17Bcr8INn8ke79c9LURsysRTB+0aULsgx2vaTtJerlTaAlzbkajpvVt3lDT MsqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:in-reply-to:subject :cc:to:from:references:dkim-signature; bh=5jGRxWa+Hik2xXu28OZInbUMDSK1LmZ28o9a5C6ustA=; b=OOxS5MU+yG+soSzdHO2OiY2qqvjlgSfFN8xU2aschKSjV7dv6KTratSE3N0rsFTuc0 a3xe5sndhIwsSQILytkGP1cBcb1r4o/P1G3tqYcfyvrRg8v/4Zu4kcGZBlro8BAsrQPI +EjA+0hMKRtaylQYM9ATyzY9UfVJP6bFgFO8Xr+Ga7yRPtt9sCdclT9srAzHAqNem5fa oLO0Td1MuwQXjlQ5qiTV5vEcV7U1doBwy7roh5zyiBydxstGpXjRk/qLGHWGzaD/B/Pi kYud2PkfeKM7usMLE5vVw97lxcWdJSYjptO4b9Hk5pyYxQeV+W/SSKNNTwtPsR3qVXW/ z1KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=dBkR+OXn; 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 e19-20020a056402191300b004316c7b2879si13696447edz.237.2022.06.21.14.36.40; Tue, 21 Jun 2022 14:37:05 -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=dBkR+OXn; 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 S1355345AbiFUVW6 (ORCPT + 99 others); Tue, 21 Jun 2022 17:22:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355893AbiFUVW3 (ORCPT ); Tue, 21 Jun 2022 17:22:29 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FBCDC45; Tue, 21 Jun 2022 14:11:59 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id i10so16879012wrc.0; Tue, 21 Jun 2022 14:11:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:from:to:cc:subject:in-reply-to:date:message-id :mime-version; bh=5jGRxWa+Hik2xXu28OZInbUMDSK1LmZ28o9a5C6ustA=; b=dBkR+OXnEaZPr9uoaZB+DI5wT1AXufYbc+9qN44d74R1jy7oOaP5glLLgc/hzh3E8m VEYB0O8O8TiK3K0KU8aR4nbUvWWFGE7uePKS5PELYCU4SnEeJA8EVcTkrM2DoduTme8M T2w+A4Oj1CabUPV/iQcD8tJhe3/0P4UoInCNfQd2pdDiq/qrgQ6JtX7yLUUFdykN73bM NtCtwLELefp/0JcgOX6hIfK1mCyMbjfNrGysmUUfiSDKIuEdhMG6diRPWKvISTwtHa9N kgrC4FpslcP3XTRRhPHg48OrMHfSCIL2fPrOOeRY9LvrBNjg8LF3SLUYHP6wXsVMRurd LPAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:references:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=5jGRxWa+Hik2xXu28OZInbUMDSK1LmZ28o9a5C6ustA=; b=GRmD+rEmXrMnUtW7IfBoAGKKPPN+YVnROxzkNjrqTB/oz9pEbFht7AMknO1tjHabtH TyfGnnqPnVsO6X4PwWyabx59vfmnikZO7mq5isr6P+Zj0wiV0y0EE1IVRIcdjKAV/8x+ 9IZQGI937lernsAAO5yuRjtIADETJF2BYtVShBsoH+k1pugq8/sdslg+3ZFOlqPs43iQ 44gKlfi++UfxdSIX5JU/d5d/eVhqdLeuYCGDE/VFeBg39klm7YBpg6GSNmJrphlF53D5 izCsU0mkxRSqxFnLWYIhXd9mYl656kdoT/MhptGVBbddFG0H66mT0VHttGBIanHBLbl+ 2Ffg== X-Gm-Message-State: AJIora9I2C5lWwottjfOMj0YGN8+wtusm1f1iLN/FZ6qin5yVDs3/Fk7 rfUByHCKM4FIdpQwygRl+3Q= X-Received: by 2002:adf:fb10:0:b0:207:af88:1eb9 with SMTP id c16-20020adffb10000000b00207af881eb9mr30853557wrr.238.1655845918233; Tue, 21 Jun 2022 14:11:58 -0700 (PDT) Received: from localhost (92.40.168.122.threembb.co.uk. [92.40.168.122]) by smtp.gmail.com with ESMTPSA id bv27-20020a0560001f1b00b0021b84ac7a05sm7979960wrb.0.2022.06.21.14.11.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 14:11:57 -0700 (PDT) References: <20220620200644.1961936-1-aidanmacdonald.0x0@gmail.com> <20220620200644.1961936-16-aidanmacdonald.0x0@gmail.com> From: Aidan MacDonald To: Andy Shevchenko Cc: Mark Brown , Andy Gross , Bjorn Andersson , Srinivas Kandagatla , Banajit Goswami , Greg Kroah-Hartman , "Rafael J. Wysocki" , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , MyungJoo Ham , Michael Walle , Linus Walleij , Bartosz Golaszewski , Thomas Gleixner , Marc Zyngier , Lee Jones , Manivannan Sadhasivam , Cristian Ciocaltea , Chen-Yu Tsai , tharvey@gateworks.com, rjones@gateworks.com, Matti Vaittinen , orsonzhai@gmail.com, baolin.wang7@gmail.com, zhang.lyra@gmail.com, Jernej Skrabec , Samuel Holland , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Linux Kernel Mailing List , "open list:GPIO SUBSYSTEM" , linux-actions@lists.infradead.org, linux-arm-msm , linux-arm Mailing List , linux-sunxi@lists.linux.dev, ALSA Development Mailing List Subject: Re: [PATCH 15/49] regmap-irq: Change the behavior of mask_writeonly In-reply-to: Date: Tue, 21 Jun 2022 22:13:03 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, 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 Andy Shevchenko writes: > On Mon, Jun 20, 2022 at 10:08 PM Aidan MacDonald > wrote: >> >> No drivers currently use mask_writeonly, and in its current form >> it seems a bit misleading. When set, mask registers will be >> updated with regmap_write_bits() instead of regmap_update_bits(), >> but regmap_write_bits() still does a read-modify-write under the >> hood. It's not a write-only operation. >> >> Performing a simple regmap_write() is probably more useful, since >> it can be used for chips that have separate set & clear registers >> for controlling mask bits. Such registers are normally volatile >> and read as 0, so avoiding a register read minimizes bus traffic. > > Reading your explanations and the code, I would rather think about > fixing the regmap_write_bits() to be writeonly op. That's impossible without special hardware support. > Otherwise it's unclear what's the difference between > regmap_write_bits() vs. regmap_update_bits(). This was not obvious to me either. They're the same except in how they issue the low-level write op -- regmap_update_bits() will only do the write if the new value differs from the current one. regmap_write_bits() will always do a write, even if the new value is the same. I think the problem is lack of documentation. I only figured this out by reading the implementation. >> if (d->chip->mask_writeonly) >> - return regmap_write_bits(d->map, reg, mask, val); >> + return regmap_write(d->map, reg, val & mask); >> else >> return regmap_update_bits(d->map, reg, mask, val);