Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3647836iog; Tue, 21 Jun 2022 03:06:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vlvwfwUI48NK/J6aeBTQNON6/qb3F4V5Vm7ifVtfQVbbYmJYsMJZAe5gPlUFQtfYE7/KXS X-Received: by 2002:a17:907:62a6:b0:6ef:8118:d3e2 with SMTP id nd38-20020a17090762a600b006ef8118d3e2mr24348827ejc.605.1655806012666; Tue, 21 Jun 2022 03:06:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655806012; cv=none; d=google.com; s=arc-20160816; b=YR8I1vKe4db1u/PeHYQzfyvSxXx2OSxiZK8NYOK2QDmaColjI4fPyGfAYoQkBjgEHt YYhpzhwN8YbSU0GgyA1ut3lpBpFoje0ZsT6Mj89vnhKPGIqqc29SWh6yKmIbDE6HDj00 VCpkpLrKYt2GOAJcnTEnI2jksConWWzD5gQ2YTOR3Qg2kHh+JXoFhTRze3BW6WZC7qjE QxntB/JoATZyYFGSXgTzL1h3VLorsEuSxpbqHlyb1nYewtVLGLeM05/aOE1c4yQiYeJ4 TcJnfZYGexqudQNCqpKp2DPkpDA8y5pHKax35sIbi05NpNvmfqimfcVYf5I4/pKBj0tR 160w== 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=nwSBD3PTloVRfceK56G2aCfoof4Hwc6nnq2tpaiVX1E=; b=wZXmyWruOZKublYErKfqnl0gOfLgyFkXKyowQId0ojePyNOf53lQ2wYZXzaecuPCVf 01hdHRZ5/VRE4UQfLZFDLtJEc2rKBCZd0n3UtODsIZedrgr1787or+9WR14KeD4x2qKP G3R7ypA6boDhR8SbMRU281qM2LJnHlV9rkBnYH6DwhHMMELVnHOblxl0GkCxb/yD2HE5 Bv7LH0kvrwB4ebBCKroE3miyARto1xP1kTlQhZrZCy+VD4IjMugspKV6h1kL6lcfaRFa BtqMlXUbgDMdE1WCiBcGSV4N9Na5wueiRB9iJr4I5/bqzx7fcs/jRX4wqj6pWjNAYiW7 N56Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SZC4AJow; 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 b14-20020a056402084e00b00427ba3579f5si20384371edz.26.2022.06.21.03.06.26; Tue, 21 Jun 2022 03:06:52 -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=SZC4AJow; 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 S1347222AbiFUJWy (ORCPT + 99 others); Tue, 21 Jun 2022 05:22:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347951AbiFUJWn (ORCPT ); Tue, 21 Jun 2022 05:22:43 -0400 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEC6A1FCCE; Tue, 21 Jun 2022 02:22:41 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id h23so26109904ejj.12; Tue, 21 Jun 2022 02:22:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nwSBD3PTloVRfceK56G2aCfoof4Hwc6nnq2tpaiVX1E=; b=SZC4AJowoOWLiXUnJNCXlRo+Fy21+43HuGqupG34NYAHev8FNX9LB4nFwui2g2ERc/ 2nAJjFE7gSxwK3AKqYoV1+xDYo3j7xKpCHwaEkBrfpjwItcvjJqbKZBmsBC6S6wk0LeP jECzrOFPrp+pM5SPwC+6kLb36nf+Eql2JHp+xmKVEp9KBopfkHCProz5vj1URUzLxuOc 2gtMsViSY39FbLby9xOKwyFIHQnssNg0xndDzN3H/27fb1evpypF3YvV3oswAKpp+Rdc 8SQN3kqU5KrBqva1r+R8tUi0Xkhp826IwLzXg6j6O1xwnr3vjRymNISR9wMWgtdGEpu5 ffSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nwSBD3PTloVRfceK56G2aCfoof4Hwc6nnq2tpaiVX1E=; b=cBgAbuZo65rfgvivd9KbCbX7qu+EESGr1UGiiZk3ZnMl+R9dP4aOT3+gt3e6+ijiHS 1MJB4SwoI4cjGTxh/iPsamTQmele4Ww2JgOS+YLpdL1/a3wFgkS8v7AP+CL2vxSIsLjr ITKolee/Z67GROdOPdnNV34NtnhAL+13UbHVyNvbLpZ3w2+UJZbWx9XhHWG0ABQNP4ve SVjk+IPj84C+TWF56A4WxdfUYgzShjBi0SIoHPiRBLcUnYC6o47IC0DFZpdSQjNEMpoE mWPfKm9h2cX3OMLiFG7LO7MizQ8OqTDEi8P/rz5VJAjl1B4bK83zCuaNauKrUYshIa0h hYnA== X-Gm-Message-State: AJIora99Yf/xDgksfJnGnPDpQcxiyEo6xvVwUcstPyQ2H+Dj6XlaMyg/ Nxo2yABJ2hmL+25WcWz+18KtjuB5rQbwXu0Prqo= X-Received: by 2002:a17:906:149:b0:711:fca6:bc2f with SMTP id 9-20020a170906014900b00711fca6bc2fmr25088970ejh.497.1655803360410; Tue, 21 Jun 2022 02:22:40 -0700 (PDT) MIME-Version: 1.0 References: <20220620200644.1961936-1-aidanmacdonald.0x0@gmail.com> <20220620200644.1961936-5-aidanmacdonald.0x0@gmail.com> In-Reply-To: <20220620200644.1961936-5-aidanmacdonald.0x0@gmail.com> From: Andy Shevchenko Date: Tue, 21 Jun 2022 11:22:03 +0200 Message-ID: Subject: Re: [PATCH 04/49] regmap-irq: Introduce config registers for irq types To: Aidan MacDonald 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 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 Mon, Jun 20, 2022 at 10:08 PM Aidan MacDonald wrote: > > Config registers provide a more uniform approach to handling irq type > registers. They are essentially an extension of the virtual registers > used by the qcom-pm8008 driver. > > Config registers can be represented as a 2D array: > > config_base[0] reg0,0 reg0,1 reg0,2 reg0,3 > config_base[1] reg1,0 reg1,1 reg1,2 reg1,3 > config_base[2] reg2,0 reg2,1 reg2,2 reg2,3 > > There are 'num_config_bases' base registers, each of which is used to > address 'num_config_regs' registers. The addresses are calculated in > the same way as for other bases. It is assumed that an irq's type is > controlled by one column of registers; that column is identified by > the irq's 'type_reg_offset'. > > The set_type_config() callback is responsible for updating the config > register contents. It receives an array of buffers (each represents a > row of registers) and the index of the column to update, along with > the 'struct regmap_irq' description and requested irq type. > > Buffered values are written to registers in regmap_irq_sync_unlock(). > Note that the entire register contents are overwritten, which is a > minor change in behavior from type registers via 'type_base'. ... > + ret = regmap_write(map, reg, d->config_buf[i][j]); > + if (ret != 0) if (ret) > + dev_err(d->map->dev, > + "Failed to write config %x: %d\n", > + reg, ret); > + } ... > + * regmap_irq_set_type_config_simple() - Simple IRQ type configuration callback. > + * Redundant line. ... > + d->config_buf = kcalloc(chip->num_config_bases, > + sizeof(*d->config_buf), GFP_KERNEL); > + if (!d->config_buf) > + goto err_alloc; > + > + for (i = 0; i < chip->num_config_regs; i++) { > + d->config_buf[i] = kcalloc(chip->num_config_regs, > + sizeof(unsigned int), Can it be sizeof(**d->config_buf) ? > + GFP_KERNEL); > + if (!d->config_buf[i]) > + goto err_alloc; > + } -- With Best Regards, Andy Shevchenko