Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2943854imm; Thu, 17 May 2018 00:13:54 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqeBX+nBrE5APJkx6kZHBM3Ib8iHNP1Xf83JsIwhBT7BECi5nSUlM1RViAwG6yHxmapa8kN X-Received: by 2002:a63:91c4:: with SMTP id l187-v6mr3206286pge.261.1526541234301; Thu, 17 May 2018 00:13:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526541234; cv=none; d=google.com; s=arc-20160816; b=g8eOJXWeaciu+oUcogbN2hVOE5ENQHtOj1FGYjL6xCv3BEdO4OXO4KkzJGbXaCYTgy fs+HxShrUaXN07Yh1ZErcGA0mIegBqDQskF09zbK40HkqbkIIyrSAlJJVDQeRFg5bj4p OMoCfKz+HPamey9DXtWLfdjHAhbEebvFQyiDW/U4+wipavISjIRwy9m0R7prpNpJQK6I XnETVP+p1oWS1WtvUMS1vjXjfJH9lNjU+qQJXUHvEH21fSZ12bJ5XND2xfJJeTp/wclr oKGocwxrkGu07HB+Z9A3h5xDtK7PJip2t/8GxMxQaKfETwGfD0ZUmqgX5SLOqb7/u83I ZHhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=dYfh4IFeV+q4/WRMfHsNxk6D3psa+tkVOcy3PvmMnC4=; b=Q3rlW7biqsZNhjNhD93DMzspcgn8r/KY2UdXXPM+oM+8kOU68Z1mtur+DB27b3IERI KS+n2Es8zyeg5rPcNPtu2MKtoX3DLpisVKKEvVY98dc8ipgPtqTIah027R4WedHKQkJL UjrwBhZ5GLy4yfVzy6LzpEyh/Yl0rrDBZC/j2p4vsOQGTcTuNbqax0kdVVqSjRgm3Bsp Mtlfv9syWUKW2fFh3daqkZo8EWBh59TPQZYqbKrvDJvZzYc8J/Cb7Gma+EzSchnJu0V1 zwju9edrQ5hyYIk+AJszf7j62a0Izq7p9ScORkHCP+MY/nYEby8mkqQvTMysEBqbKf9i v/pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=K6vLNwOm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a1-v6si3610279pgn.425.2018.05.17.00.13.39; Thu, 17 May 2018 00:13:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=K6vLNwOm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752175AbeEQHMy (ORCPT + 99 others); Thu, 17 May 2018 03:12:54 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:37359 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750938AbeEQHMx (ORCPT ); Thu, 17 May 2018 03:12:53 -0400 Received: by mail-wm0-f68.google.com with SMTP id l1-v6so6989634wmb.2 for ; Thu, 17 May 2018 00:12:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=dYfh4IFeV+q4/WRMfHsNxk6D3psa+tkVOcy3PvmMnC4=; b=K6vLNwOmuhCh1yECll1E44Q+cfeyLRBaSIHxrAhat5yDpdTJKKmf/te99I5EmBv6MC nvoxX68YxBLYjL2S0QYUFxlHPW6SaHtgS525cRFRuHvMZa3Vw1SeeQ2z7T3oJ+aF04EI XZRidnBVDztbFGfIIz51LLgljrO6NhKALumw87J3vsW79OItA8ev7R62hxgE/Gl9TkIn Q1ov4JtgV8OHqnJuhKMJjJ2TM7i1N0Iv9DUmqFM8PqR11ICW+zyNT4f9TjkRIWVB1bWF eFfDvc2+XUviR7AKzaTBtSw+iifD0VS95oKx23bukWfHlI8SEJgjvDoYctvWWYNS4ejm jbkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=dYfh4IFeV+q4/WRMfHsNxk6D3psa+tkVOcy3PvmMnC4=; b=nMeBqXdUzY7vmwoHn7p3EEcNIh6FJaNi9ng9u4nREZiw80Tr8xEHTFfp7SEONS1vl5 kL7XpM/Maw7eBZfWi3xDCCM+FXE3Tm7/TP5uh5Rq5FXJwPdQ8qb+gtw2Xo2nj/+6NGn0 ltDTwlm13S+iuLG+n/nOXsn2I0zvfWbGHyFhNZOKk7YEOpFSETks454tbTFjKIRX5P0M AIo5LjpMMMo5v3ftgk/yIBY46RW2rM70BBv4Wjt13YcO0z/0Itpu9BBSu2b0fb+TxZbC 5tWlDQWVRJ7Z/C3Fzr5nIC491CTB4MLKdd7KeAllmyd1iW4sTRgapXrBXmjRyQ2Ic2VJ Ii3A== X-Gm-Message-State: ALKqPwdKmmfMSVColpmu89k+biGvpdSoKP1ZjrKRn5GqgxNRYYU1KwcM RXNLhTu+a5c2KBTAdOcIramB9G1TQeU= X-Received: by 2002:a1c:dc54:: with SMTP id t81-v6mr971177wmg.90.1526541171521; Thu, 17 May 2018 00:12:51 -0700 (PDT) Received: from [192.168.1.2] (141.pool85-51-114.dynamic.orange.es. [85.51.114.141]) by smtp.gmail.com with ESMTPSA id u69-v6sm5321193wma.37.2018.05.17.00.12.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 May 2018 00:12:51 -0700 (PDT) Subject: Re: [RFC] regmap: allow volatile register writes with cached only read maps To: Mark Brown Cc: linux-kernel@vger.kernel.org References: <1525817169-29233-1-git-send-email-jramirez@baylibre.com> <20180509083919.GU13402@sirena.org.uk> <65607fde-d0e9-0f08-3042-f6a58b760896@baylibre.com> <20180511020049.GD949@sirena.org.uk> <7cc158bb-3471-4d8e-d066-2e7f535812eb@baylibre.com> <20180513022202.GA17611@sirena.org.uk> From: Jorge Ramirez-Ortiz Message-ID: <201167c6-304c-138a-358f-bee096767527@baylibre.com> Date: Thu, 17 May 2018 09:12:49 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180513022202.GA17611@sirena.org.uk> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/13/2018 04:22 AM, Mark Brown wrote: > On Fri, May 11, 2018 at 12:29:42PM +0200, Jorge Ramirez-Ortiz wrote: >> On 05/11/2018 04:00 AM, Mark Brown wrote: >>> We don't currently suppress writes except when regmap_update_bits() >>> notices that the modification was a noop. You probably want to be using >>> regmap_write_bits() here instead of regmap_update_bits(), that will >>> always do the write. >> but isnt that interface at a different level? > It's at the level where we suppress writes - the write suppression isn't > a feature of the caching, it's something that regmap_update_bits() does > if it notices that it won't change anything. It'll happen even if > there's no cache at all. > >> I am not sure if you are asking me to review my patch or just discarding the >> RFC and highlighting that I have a configuration problem. > I don't understand your patch as-is. > >> In my use case and what triggered this RFC (config below), an 'amixer set' >> might never reach the driver's .reg_write interface even though the register >> is configured as volatile (to me this is not consistent since volatile_reg >> is being silently ignored). > I'm not seeing any inconsistency there. Volatility means the register > can't be cached as it might change underneath us, it doesn't have any > impact on writes and it's happening at a lower level. Like I say if you > absolutely need a write to happen you should be explicitly doing a > write, though if you need a write to happen for a noop control change it > sounds like there's something weird with that control that's possibly a > problem anyway. > >> So I dont see where/how your recommendation fits; maybe you could clarify a >> bit more please? > As I've been saying if you explicitly need a write to happen don't use > regmap_update_bits(), do something that guarantees you'll get a write > like regmap_write() or regmap_write_bits(). I do understand your point but Mark, that interface you mention sits above the user request (as a client the user does not call regmap_update_bits or regmap_write_bits or regmap_write(): none of those functions mean anything to the foo_regmap definition below - that is why we have an interface). The client just uses this request: static const struct regmap_config foo_regmap = { ??? .reg_write??? ?????? = foo_write_reg, ??? .reg_bits??? ??????? = 32, ??? .val_bits??? ??????? = 32, ??? .reg_stride??? ????? = 1, ??? .volatile_reg??? ??? = foo_volatile_reg, ??? .max_register??? ??? = CODEC_ENABLE_DEBUG_CTRL_REG, ??? .reg_defaults??? ??? = foo_reg_defaults, ??? .num_reg_defaults??? = ARRAY_SIZE(foo_reg_defaults), ??? .cache_type??? ????? = REGCACHE_RBTREE, }; and all this request means is that it expects foo_volatile_regs to be taken into consideration when accessing the reg_write callback: so whoever is calling the interface reg_write (be it regmap_update_bits or regmap_write_bits or whoever it is, I dont know) must make sure the volatile request applies. the RFC patch that I submitted achieves exactly that. does this make more sense now?