Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4487431pxf; Tue, 23 Mar 2021 11:47:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFtPlU47Fu1EB9SCUICiCShk4v15zBe8hcdyAlI5g2jGZWGOhD6crB67dZ9FI4UkKyqxpa X-Received: by 2002:a17:906:ecf3:: with SMTP id qt19mr6109244ejb.467.1616525277529; Tue, 23 Mar 2021 11:47:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616525277; cv=none; d=google.com; s=arc-20160816; b=s+pe8WhapFELcuqqtG4f07WU3/gFqi+7n/HhU8ODM9YYu4egO5bVkUtOwOmVZ3fkkL 9x52LpZRQoM//D3v4RkrTxyoFla8Lev6gWfXxbgTrbzy/1EmO1tfPyZ3VV1thDnNOjgz ZHu3DRvR15wOpZBk+iMFppUtX1i1bbGoVuzIstkTddcMK6y+iT/41nuC2Qo22F3les2L i519w11tNgoTeZc9jx52oP7LZMUhVrX4xWMP8JXEs+auVaQBAXdBuaihCZteyVsmOJ9D FO9YptZqW6v+/F3faidb/t6bzAbX6zSzwK8EyVgImulvxnBlwAGieUFGzIuHnN2Wj9jZ LNDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:references:in-reply-to :message-id:date:subject:cc:to:from; bh=zr6TDrA5w1Bnu4VQC11Oxq01MVE0pMubj3D61e6PNuI=; b=sX9fNPru3l0eN5ur7zbv5ZxyWIlpczALpDu8ntxVsI80RLxT8KYkOPE5jJUpWIf57L Xk44QsioHSIwAkldIJYPodIO+kNYitmiaBW6Rl3fVhfGzs5eGsfqPM8d1Ly9yVaJuT10 8cNitHyFPnirCLIDKMpzTiLnf6zobb2yEAtwPhGGppure1aSlVP50nKzHbxlb62VW942 gh8q7DJh+m3JkGTWgRzmFgzTS5KMeCqPoBcuqEFRnyV0pDrWpfiGaPNSjJtRfLpakTa9 porImY70wTjJuorRD8KDzsWhJM2UCShkLMAHaeCnIlIgKmBRoRAWYRl4kCLvnjXspW9A XS2g== 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 i19si13886583ejd.152.2021.03.23.11.47.33; Tue, 23 Mar 2021 11:47:57 -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 S232498AbhCWSoJ (ORCPT + 99 others); Tue, 23 Mar 2021 14:44:09 -0400 Received: from alexa-out-sd-02.qualcomm.com ([199.106.114.39]:40219 "EHLO alexa-out-sd-02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232278AbhCWSnx (ORCPT ); Tue, 23 Mar 2021 14:43:53 -0400 Received: from unknown (HELO ironmsg05-sd.qualcomm.com) ([10.53.140.145]) by alexa-out-sd-02.qualcomm.com with ESMTP; 23 Mar 2021 11:43:53 -0700 X-QCInternal: smtphost Received: from gurus-linux.qualcomm.com (HELO gurus-linux.localdomain) ([10.46.162.81]) by ironmsg05-sd.qualcomm.com with ESMTP; 23 Mar 2021 11:43:52 -0700 Received: by gurus-linux.localdomain (Postfix, from userid 383780) id AA44A1939; Tue, 23 Mar 2021 11:43:52 -0700 (PDT) From: Guru Das Srinagesh To: Mark Brown , Markus Elfring , Lee Jones , Rob Herring Cc: 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, Guru Das Srinagesh Subject: [PATCH v4 2/2] regmap-irq: Add driver callback to configure virtual regs Date: Tue, 23 Mar 2021 11:43:51 -0700 Message-Id: <93e7e694e6dc26333a371a19b950919c3d80595e.1616488322.git.gurus@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Enable drivers to configure and modify "virtual" registers, which are non-standard registers that further configure irq type on some devices. Since they are non-standard, enable drivers to configure them according to their particular idiosyncrasies by specifying an optional callback function while registering with the framework. Signed-off-by: Guru Das Srinagesh --- drivers/base/regmap/regmap-irq.c | 5 +++++ include/linux/regmap.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c index d1ade76..e6343ccc 100644 --- a/drivers/base/regmap/regmap-irq.c +++ b/drivers/base/regmap/regmap-irq.c @@ -333,6 +333,11 @@ static int regmap_irq_set_type(struct irq_data *data, unsigned int type) default: return -EINVAL; } + + if (d->chip->set_type_virt) + return d->chip->set_type_virt(d->virt_buf, type, data->hwirq, + reg); + return 0; } diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 4c75717..7cf143ce 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -1426,6 +1426,8 @@ struct regmap_irq_sub_irq_map { * before regmap_irq_handler process the interrupts. * @handle_post_irq: Driver specific callback to handle interrupt from device * after handling the interrupts in regmap_irq_handler(). + * @set_type_virt: Driver specific callback to extend regmap_irq_set_type() + * and configure virt regs. * @irq_drv_data: Driver specific IRQ data which is passed as parameter when * driver specific pre/post interrupt handler is called. * @@ -1473,6 +1475,8 @@ struct regmap_irq_chip { int (*handle_pre_irq)(void *irq_drv_data); int (*handle_post_irq)(void *irq_drv_data); + int (*set_type_virt)(unsigned int **buf, unsigned int type, + unsigned long hwirq, int reg); void *irq_drv_data; }; -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project