Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3645799pxf; Mon, 15 Mar 2021 14:52:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyogK8xlpuoL0PmV1iB+yhPd7mNLJECt+19OlLhDFbc3qa5EcFEKbsf8kH9Bu7IJ1CkoyfN X-Received: by 2002:a17:906:d790:: with SMTP id pj16mr25611783ejb.255.1615845157840; Mon, 15 Mar 2021 14:52:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615845157; cv=none; d=google.com; s=arc-20160816; b=LO9Hrt5HGFuobcVbxVi+QDwMz4d72GOEVeHMy5C67DjJ+/0hMgOgJD1N679bRRg9DS 3ZpjchVqKdVmTHGh+COLvQ9a930U3cQWRwpK7msWix2tSJ6RPrudUJXUnlW1nldiQc6T VZ4w50jLPrrTkrRgz54h5ST0jv0xdRmc4Q1QuPUDsSQE1IrJkDcNc1vwnsvRFAufn/wA uRzEj0Vr+jrpkS0syYg4IyscVT33fWg1PUV01AwoSTC76lOPex3XJML5bETdJCH5xC3T xIaBxknTf3aB0tTrgxuWNca8+fRyCx1De62jPxuUyIHHbN789ZsPPTpDCiRCzLnDneUB jlRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=8PNJylxyhJWx3YwOoop1dNPNLfxfVkH4fKm0DVoygqs=; b=YfylQUkZuOZ3bN4UVF7Eabfq4qQFL8zQ2MnrRTILJcXKuyBdSIXJ2itUQn7t2cT3uh Nd4KDx9b+Kki4mW8aNRI7ojJXI2zovIFYXmXQXZJ8uvFp/EFjmJSQHTwkIUaPtYJvWsd 4Rr3fED+jmriocrzmJGGkAk9GPYw+vOUjtEnHySVzZDvXAyINh/f4MAkBVxqwu5sGSoO Qj+6l9OitgRrm02kYtMJGzLjGADM38UyOq42+1p2kaBJfvnEmwOhIZv3cAFcrH+k89py L0URgmXUg35rAGticOOiB0vJ6b5OQuTWgtlSTFfwlfSYuqIgOpJUYKU3oNra83bec2Fh ZEWA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eb10si11932844ejc.273.2021.03.15.14.52.15; Mon, 15 Mar 2021 14:52:37 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232373AbhCOUgO (ORCPT + 99 others); Mon, 15 Mar 2021 16:36:14 -0400 Received: from alexa-out-sd-01.qualcomm.com ([199.106.114.38]:12593 "EHLO alexa-out-sd-01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231981AbhCOUgJ (ORCPT ); Mon, 15 Mar 2021 16:36:09 -0400 Received: from unknown (HELO ironmsg04-sd.qualcomm.com) ([10.53.140.144]) by alexa-out-sd-01.qualcomm.com with ESMTP; 15 Mar 2021 13:36:09 -0700 X-QCInternal: smtphost Received: from gurus-linux.qualcomm.com (HELO gurus-linux.localdomain) ([10.46.162.81]) by ironmsg04-sd.qualcomm.com with ESMTP; 15 Mar 2021 13:36:08 -0700 Received: by gurus-linux.localdomain (Postfix, from userid 383780) id BF4D719B3; Mon, 15 Mar 2021 13:36:08 -0700 (PDT) Date: Mon, 15 Mar 2021 13:36:08 -0700 From: Guru Das Srinagesh To: Mark Brown Cc: Markus Elfring , Lee Jones , Rob Herring , Bjorn Andersson , Greg KH , Guenter Roeck , Joe Perches , Subbaraman Narayanamurthy , David Collins , Anirudh Ghayal , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [RFC PATCH v3 2/3] regmap-irq: Add support for POLARITY_HI and POLARITY_LO config regs Message-ID: <20210315203608.GB8977@codeaurora.org> References: <4b77a308ccdabbe96ed68623bd6eead9510e1fc9.1615423027.git.gurus@codeaurora.org> <20210312121916.GE5348@sirena.org.uk> <20210315203336.GA8977@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210315203336.GA8977@codeaurora.org> User-Agent: Mutt/1.5.24 (2015-08-30) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 15, 2021 at 01:33:36PM -0700, Guru Das Srinagesh wrote: > On Fri, Mar 12, 2021 at 12:19:16PM +0000, Mark Brown wrote: > > On Wed, Mar 10, 2021 at 04:39:53PM -0800, Guru Das Srinagesh wrote: > > > If an interrupt is already configured as either edge- or > > > level-triggered, setting the corresponding bit for it in the POLARITY_HI > > > register further configures it as rising-edge or level-high triggered > > > (as the case may be), while setting the same bit in POLARITY_LO further > > > configures it as falling-edge or level-low triggered. > > > > I think you probably need to bring these three fields together into a > > single virtual field and then map the values within that field using > > the existing type stuff. > > Sure, how about this scheme then, for patches 2 and 3 in this series? > (Patch 1 will remain the same, pending your review of it.) > > Since I do need to write to two extra registers, I'll need two > register_base's and two buffers to hold their data. This can be > generalized to "extra config registers" in the framework as follows: > > - Add these two fields to `struct regmap_irq_chip`: > > unsigned int *extra_config_base; /* Points to array of extra regs */ > int num_extra_config_regs; /* = ARRAY_SIZE(array above) */ > > - Add this field to `struct regmap_irq_chip_data`: > > unsigned int **extra_config_buf; > /* Will be dynamically allocated to size of: > * [chip->num_extra_config_regs][chip->num_regs] > */ > > - Add a new function callback in `struct regmap_irq_chip`: > > int (*configure_extra_regs)(void *irq_drv_data, unsigned int > type) > > This callback will be called at the end of regmap_irq_set_type(): > > if (d->chip->configure_extra_regs) > d->chip->configure_extra_regs(); > > The callback, defined in the client driver, will specifically address > the changes to regmap_irq_set_type() made in patches 2 and 3 of this > series, viz. overriding how type_buf is to be handled, plus the > populating of polarity_*_buf's (rechristened as extra_config_bufs in > this proposed new scheme). > > This new scheme thus makes v2 more generic. I thought I'd discuss this > with you before implementing it as v3 RFC. Could you please let me know > your thoughts? Typo. I meant: This new scheme thus makes *v3* more generic. I thought I'd discuss this with you before implementing it as *v4* RFC. Guru Das.