Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1653761pxj; Wed, 19 May 2021 10:42:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjUKh8mgyNVIzku8MTxEszqSTzkR3fHCOrNctJJ1J1lzknM+kTFukyBR68XCgMYpjhr7XC X-Received: by 2002:a17:906:3ed0:: with SMTP id d16mr354586ejj.16.1621446145533; Wed, 19 May 2021 10:42:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621446145; cv=none; d=google.com; s=arc-20160816; b=gQGw2kU8+B20QCB65bv1BrJ06wRI0Abnmi8ZwYwBY5LfRa7qPPJz1qkIIyMmsGRdh5 vZmMb1eyxDPFLyZoaoeIz6IKSrCVDUnM1SFfwciOmZd5lf6dCJFWz49eoH7QeptcagVK fQXxrUu2xerZBqz4eZuoAH3HKK8yJI9d4gB6Iwtdj7MoiyjZbhNiiT2IUoDirvHRs+2q mfd3DWxCp6k7q1zPGX5SVXQoku9Mu7W84OovZBlK3mbmoNE1TT5XL63Ws9MmjBRXVLJU i796K+Tn1L529ASl0lXFRSqWf4HJ9NmPt0AsOecXBnpZkc//FmWRSWEB7TaqQafRLDk/ zGXg== 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 :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=fDdirovG7VfsztAZ/ulDoNz8Tq6gRtuJ0uff/bbC/AA=; b=ARzB/0dNi8GbJIIGWZDZ+DVRkUEuN50y8c36+WiUFvd2Z6t92uptkqNThaj2S4wT3m QB6U/NW79AhmZL5/HbEZWJ7nQTGaICVCL62O/8JFSBFF71259h5e5cwqe1dd1QFYWtbp zSzb2BjsIyJPVYjJjbH+fO8kH0fcjmzT9o/zZ1UPGMpjoX+SbRXMiu/cLLgu9/19LUo/ SDhfkK1s53QglEOMkeTkoifQtTIioyBKNOguK8L6jZX0agV0v9Vfrd3kIKBBYEKre4r6 GKCcPvOj6TkiS5Oe6uODgePgTxrQ2AN2cwtVKRrxGNzZndIZPesfiALMiLl4vWUd72Rx xtvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@inbox.ru header.s=mail3 header.b=kImNuSxB; dkim=pass header.i=@inbox.ru header.s=mail3 header.b=Ys6XI2gY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=inbox.ru Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m12si8018508edr.335.2021.05.19.10.42.00; Wed, 19 May 2021 10:42:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@inbox.ru header.s=mail3 header.b=kImNuSxB; dkim=pass header.i=@inbox.ru header.s=mail3 header.b=Ys6XI2gY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=inbox.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347763AbhERJo2 (ORCPT + 99 others); Tue, 18 May 2021 05:44:28 -0400 Received: from fallback19.mail.ru ([185.5.136.251]:44584 "EHLO fallback19.mail.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243400AbhERJo1 (ORCPT ); Tue, 18 May 2021 05:44:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=inbox.ru; s=mail3; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From; bh=fDdirovG7VfsztAZ/ulDoNz8Tq6gRtuJ0uff/bbC/AA=; b=kImNuSxBOmF9ywqeMerANDaE423jxcV7mhpG/uIUq8bCz+ah2KKVaOWVWKZ9grC663H9SFqzDCmMWjIImUBLDMMXvxcNLCzMd0R3JRjAFJ1IPsS6/LBWGYgbQ0OtIBcqMI3bRyvrBcoGqBBzsRARqWvYOkfuT29w8ti1pkstVJo=; Received: from [10.161.64.54] (port=33352 helo=smtp46.i.mail.ru) by fallback19.m.smailru.net with esmtp (envelope-from ) id 1liwFn-0001dG-W4; Tue, 18 May 2021 12:43:08 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=inbox.ru; s=mail3; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From:From:Subject:Content-Type:Content-Transfer-Encoding:To:Cc; bh=fDdirovG7VfsztAZ/ulDoNz8Tq6gRtuJ0uff/bbC/AA=; b=Ys6XI2gY8cVOePKcy7okTqhJgg2akPlkZkaC8aeIED0E8OcjIKT0gHDYZOA4irNjJyXbdTjuKcCgh5+4qZWlyH2iJBftuWtrH3QUCWHRNb+nrA1ZlNKZpdyahuCR46j/bG62t+OSrUPhULFjgaNR2MKBPAE2DkNgjQn8Jl6IrnA=; Received: by smtp46.i.mail.ru with esmtpa (envelope-from ) id 1liwFk-0002GK-SP; Tue, 18 May 2021 12:43:05 +0300 From: Maxim Kochetkov To: linux-kernel@vger.kernel.org Cc: broonie@kernel.org, gregkh@linuxfoundation.org, rafael@kernel.org, Maxim Kochetkov Subject: [PATCH 1/1] regmap-irq: Introduce inverted status registers support Date: Tue, 18 May 2021 12:44:41 +0300 Message-Id: <20210518094441.142547-1-fido_max@inbox.ru> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD95978C26455E69BE022900C3053DBED76BEB47C8A8E1FDA50182A05F538085040DC9608E19AF7698DFF843EDB89C17C947F1A896DDFF21B83E6772CF1604344A7 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE70FFC2100EB7B6895EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637F91103FA893F53AB8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D815F13FC2657B809B6F37D6BA66CB22FC117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCC908CD1B87A134A2A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F4460429728776938767073520B1593CA6EC85F86D28451B159A507268D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE140C956E756FBB7AC43C4D2AE8146675D8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE365B78C30F681404D302FCEF25BFAB345C4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637BC13DA0749B57ECEEFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C97831EBD2AF536A582F177E6ED54993E2D80B X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975CA200E0309169BAAC51E93555FF0DAFC1D713CC715FF175B79C2B6934AE262D3EE7EAB7254005DCED4ED5B231F855E8739510FB958DCE06DB6ED91DBE5ABE359ADBCB5631A0A9D21FB129A6C9085D3B6193EDB24507CE13387DFF0A840B692CF8 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34D8FD11F74BDD6E8D70FAA43C631320E6273D7E91CADD75222BF713F680DDE6A065579133CE95824C1D7E09C32AA3244CC6B57057966D8656CD3745244BCB42FF51E887DA02A9F7BF83B48618A63566E0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojdWksWVKfsTCWvnnj3uxVgg== X-Mailru-Sender: 11C2EC085EDE56FA9C10FA2967F5AB24249FF93EAE8845A77DE819D4739D9DAFD0F277CC753E24A8EE9242D420CFEBFD3DDE9B364B0DF2891A624F84B2C74EDA4239CF2AF0A6D4F80DA7A0AF5A3A8387 X-Mras: Ok X-7564579A: 646B95376F6C166E X-77F55803: 6242723A09DB00B4A060E3D0EC9C207DDF702DCF032E481FFF97B15423F8F24D049FFFDB7839CE9EBCA0E525EC128904B0B33D750A945066B97D0F0EF6781E2C0998511F7AE6A3E1 X-7FA49CB5: 0D63561A33F958A53DFC07102AB7913FE8C5C9D0D7B0281546D6B543BA0FCC418941B15DA834481FA18204E546F3947C91E4BF118115E492F6B57BC7E64490618DEB871D839B7333395957E7521B51C2DFABB839C843B9C08941B15DA834481F8AA50765F79006370EEF3394CB8F4D0F389733CBF5DBD5E9B5C8C57E37DE458BD9DD9810294C998ED8FC6C240DEA76428AA50765F7900637126974E050CD86F0D81D268191BDAD3DBD4B6F7A4D31EC0BEA7A3FFF5B025636AAAE862A0553A39223F8577A6DFFEA7CE1AEB6AF2DA18B6243847C11F186F3C59DAA53EE0834AAEE X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975CA200E0309169BAAC95E2D17864C6FA1EBB931E461928DBD19C2B6934AE262D3EE7EAB7254005DCED4ED5B231F855E873DC48ACC2A39D04F89CDFB48F4795C241BDAD6C7F3747799A X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojdWksWVKfsTDckw/mWGDglw== X-Mailru-MI: 800 X-Mailru-Sender: A5480F10D64C9005C3FADA55C8765CC36329B46222EBA606453773FA6D1CFEBC199531D441672C9AC099ADC76E806A99D50E20E2BC48EF5A30D242760C51EA9CEAB4BC95F72C04283CDA0F3B3F5B9367 X-Mras: Ok Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some interrupt controllers have inverted status register: cleared bits is active interrupts and set bits is inactive interrupts, so add inverted status support to the framework. Signed-off-by: Maxim Kochetkov --- drivers/base/regmap/regmap-irq.c | 4 ++++ include/linux/regmap.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c index 760296a4b606..fbab3ff7b877 100644 --- a/drivers/base/regmap/regmap-irq.c +++ b/drivers/base/regmap/regmap-irq.c @@ -531,6 +531,10 @@ static irqreturn_t regmap_irq_thread(int irq, void *d) } } + if (chip->status_invert) + for (i = 0; i < data->chip->num_regs; i++) + data->status_buf[i] = ~data->status_buf[i]; + /* * Ignore masked IRQs and ack if we need to; we ack early so * there is no race between handling and acknowleding the diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 8c16e6fa0f66..c5b7c9c600a5 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -1413,6 +1413,7 @@ struct regmap_irq_sub_irq_map { * @not_fixed_stride: Used when chip peripherals are not laid out with fixed * stride. Must be used with sub_reg_offsets containing the * offsets to each peripheral. + * @status_invert: Inverted status register: cleared bits are active interrupts. * @runtime_pm: Hold a runtime PM lock on the device when accessing it. * * @num_regs: Number of registers in each control bank. @@ -1465,6 +1466,7 @@ struct regmap_irq_chip { bool type_in_mask:1; bool clear_on_unmask:1; bool not_fixed_stride:1; + bool status_invert:1; int num_regs; -- 2.31.1