Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3833029pxf; Mon, 15 Mar 2021 21:37:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOWgLlBSI4EM0ntelXtvCaEWCtVNfVyVPIdDyxlEjDjWFzGGmuCX7AyQBiYPOKw3KqNyNS X-Received: by 2002:a17:906:d554:: with SMTP id cr20mr27497075ejc.61.1615869479599; Mon, 15 Mar 2021 21:37:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615869479; cv=none; d=google.com; s=arc-20160816; b=aiP9CucOyNYMtU8VU/Meg73Pl0ZWAM1pk6n+8kkpCyRTaZGnogFJ+/ynQujN4q3KI2 tZ9TEPZCj1HjlOJqMu5wDme80VJau4eNhHwTUMGxbES+dPUGjid7wK4L+yIVHc1MKWO0 HriiAP1xzUcLKvbBwqAEJFo616uTNm3OqUK1QnrCe93+HG7I0vHS3gc1pSpzjOkYP9uo xouMq3DCgLkTPWlVl8Pt4Rw8N2a0/Gv/znZBnZJhO1i3AAiJqwxrDJPdjry11HgWpBvd nvqOvGFsVV/JiscfivLjSKMSI3mhMg247m8byqLVeEjw04Q0c3WMDtphPKml6WJ/dyez MvBQ== 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=Kx5SmDU1MaDRcSwy0QshsS0TcYmQ21rBVo08maGag/U=; b=khfXW55gDry0SbVXIlos+hWvnm3LOsUtQ9JNUoQCmxG1DLDVnliCOX4cv/SV7+YUDg OF6slNa13iVlyWf3i+0FkhCFvqBP6/ByIwmW/yOS9qTqjUDQ7CzGBBRRNfb4U+q3XNiZ 4DJdlVB4OSjNMAuIO2gm61a2IKQkU4vbFDl6bBp2NApd/WXENafYiXcz0AiCowayI3oM CmQnE44tpI8XcY91VthZUjCs2qn507ZOsdois3Uw83QV11MGYSEwuuaa/UQdTM2vL55H 9GuU5f/99FYZR+PjB8bwIkwasde2z40bCfRDyfFS7fBkPN2sC00DtbGyXQZrjQjisX11 CZ9A== 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 m2si12203743edr.104.2021.03.15.21.37.37; Mon, 15 Mar 2021 21:37:59 -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 S230307AbhCOUeF (ORCPT + 99 others); Mon, 15 Mar 2021 16:34:05 -0400 Received: from alexa-out-sd-02.qualcomm.com ([199.106.114.39]:60459 "EHLO alexa-out-sd-02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231249AbhCOUdi (ORCPT ); Mon, 15 Mar 2021 16:33:38 -0400 Received: from unknown (HELO ironmsg01-sd.qualcomm.com) ([10.53.140.141]) by alexa-out-sd-02.qualcomm.com with ESMTP; 15 Mar 2021 13:33:38 -0700 X-QCInternal: smtphost Received: from gurus-linux.qualcomm.com (HELO gurus-linux.localdomain) ([10.46.162.81]) by ironmsg01-sd.qualcomm.com with ESMTP; 15 Mar 2021 13:33:37 -0700 Received: by gurus-linux.localdomain (Postfix, from userid 383780) id 0224B19B3; Mon, 15 Mar 2021 13:33:37 -0700 (PDT) Date: Mon, 15 Mar 2021 13:33:37 -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: <20210315203336.GA8977@codeaurora.org> References: <4b77a308ccdabbe96ed68623bd6eead9510e1fc9.1615423027.git.gurus@codeaurora.org> <20210312121916.GE5348@sirena.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210312121916.GE5348@sirena.org.uk> User-Agent: Mutt/1.5.24 (2015-08-30) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? Thank you. Guru Das.