Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1146978pxb; Thu, 19 Aug 2021 22:02:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytlrrX6ggQObsPauL3nduvD2eWeWDpJ7Y48zoPXHO/JuhTFyQqIWiPHgqjWmDyb9p8wpHd X-Received: by 2002:a02:c8cc:: with SMTP id q12mr16061915jao.93.1629435754099; Thu, 19 Aug 2021 22:02:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629435754; cv=none; d=google.com; s=arc-20160816; b=hyBgRsDK2xIp47iXIMKho9wPalL2Ouf34jgpvoAnNe2KmTWQ/MrbqJSHn5JuZ/WAW1 e620cT1viN7FFefR7OudesSCDxCtJbrbl1F8id5BQ3CkDIH/9sNSaVMtkGioUmJkYnAo kTQHJZQjTvwP67cskVdrhYzGxUgFuOcv81+06KlZzym0R9+cEAZcR9aziKkZnByde/1R QN6bgZ28XVC0tLPDO0/nL5d6SU3qF2kWMPyBELgrnv+D0yeGVnqiQswp90r9rGWJu32i 0OjzCsTlHsHiNP1hplYZ09luOWTOK0J7L4aZpPRfHWBAItfN/k+2lj2jP/WqYmP9AiIh wHLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=sFBL/jKr956+uroGzzRlOZ8eZSc55kDG/GIHq5SO1ck=; b=DDx/dBONjqYTOqqHgdofPW4KD1ChPxjL2+rjHnSUsBPsR1JKxnT9br3sl/6kCmp752 Z8hAY+dJDsrNgLgCadS5d9RDdpVXitkjI0DMy0/XvtxgeTlAiHHdJNfmLJ7z6T23BuoT 6hDC3oqvpBmiPMT6lJ2UDPcTAW+KNVUCRZ9CL7ZH22IDbaGKvPnMF5QwKBmRj5AaSMmu fmEHI2jQosXFh8YMKVgY5ZU/dbj90iBnwm5zct2u4J5eRmYPbp3622DgQz64RQaFuYDT SWooJNphVC/QTqZgSN0BDPDkX2n10PcbCEFC/bBBV8ePsWUHLb5lnx15lbWsE1grfU6y MIXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@quicinc.com header.s=qcdkim header.b=u5+5QaT+; 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=fail (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f7si6364865ila.78.2021.08.19.22.02.22; Thu, 19 Aug 2021 22:02:34 -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=fail header.i=@quicinc.com header.s=qcdkim header.b=u5+5QaT+; 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=fail (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238465AbhHTE7l (ORCPT + 99 others); Fri, 20 Aug 2021 00:59:41 -0400 Received: from alexa-out-sd-01.qualcomm.com ([199.106.114.38]:43454 "EHLO alexa-out-sd-01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233505AbhHTE7b (ORCPT ); Fri, 20 Aug 2021 00:59:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1629435534; x=1660971534; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=lXmE2bDOF4EwRGm8KjpM+LKJRtL4f/Jq6qA4zPZMTZY=; b=u5+5QaT+r952lCHxeR5viJ4iX3sZqgW4oMLcbj0rkUWQLjyc52+00iZE jS1pbJMRDj0pEIbpnGK3eV0dvV2mDWnQpfvE04bqLDDm3HdFHxx+RDM8M H6aTh+bjoqey39MdtOkSpVyGO66IKtk3dfUXNM7FU238ApN4k/+VZYGfo M=; Received: from unknown (HELO ironmsg04-sd.qualcomm.com) ([10.53.140.144]) by alexa-out-sd-01.qualcomm.com with ESMTP; 19 Aug 2021 21:58:54 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg04-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Aug 2021 21:58:53 -0700 Received: from nalasex01c.na.qualcomm.com (10.47.97.35) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.858.15; Thu, 19 Aug 2021 21:58:53 -0700 Received: from fenglinw-gv.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.858.15; Thu, 19 Aug 2021 21:58:51 -0700 From: Fenglin Wu To: , , CC: , , Subject: [PATCH V1 8/9] spmi: pmic-arb: make interrupt support optional Date: Fri, 20 Aug 2021 12:58:03 +0800 Message-ID: <1629435488-10228-9-git-send-email-quic_fenglinw@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1629435488-10228-1-git-send-email-quic_fenglinw@quicinc.com> References: <1629435488-10228-1-git-send-email-quic_fenglinw@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanexm03h.na.qualcomm.com (10.85.0.50) To nalasex01c.na.qualcomm.com (10.47.97.35) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Collins Make the support of PMIC peripheral interrupts optional for spmi-pmic-arb devices. This is useful in situations where SPMI address mapping is required without the need for IRQ support. Signed-off-by: David Collins Signed-off-by: Fenglin Wu --- drivers/spmi/spmi-pmic-arb.c | 45 +++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c index 988204c..55fa981 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -1280,10 +1280,12 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev) goto err_put_ctrl; } - pmic_arb->irq = platform_get_irq_byname(pdev, "periph_irq"); - if (pmic_arb->irq < 0) { - err = pmic_arb->irq; - goto err_put_ctrl; + if (of_find_property(pdev->dev.of_node, "interrupt-names", NULL)) { + pmic_arb->irq = platform_get_irq_byname(pdev, "periph_irq"); + if (pmic_arb->irq < 0) { + err = pmic_arb->irq; + goto err_put_ctrl; + } } err = of_property_read_u32(pdev->dev.of_node, "qcom,channel", &channel); @@ -1343,17 +1345,22 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev) } } - dev_dbg(&pdev->dev, "adding irq domain\n"); - pmic_arb->domain = irq_domain_add_tree(pdev->dev.of_node, - &pmic_arb_irq_domain_ops, pmic_arb); - if (!pmic_arb->domain) { - dev_err(&pdev->dev, "unable to create irq_domain\n"); - err = -ENOMEM; - goto err_put_ctrl; + if (pmic_arb->irq > 0) { + dev_dbg(&pdev->dev, "adding irq domain\n"); + pmic_arb->domain = irq_domain_add_tree(pdev->dev.of_node, + &pmic_arb_irq_domain_ops, pmic_arb); + if (!pmic_arb->domain) { + dev_err(&pdev->dev, "unable to create irq_domain\n"); + err = -ENOMEM; + goto err_put_ctrl; + } + + irq_set_chained_handler_and_data(pmic_arb->irq, + pmic_arb_chained_irq, pmic_arb); + } else { + dev_dbg(&pdev->dev, "not supporting PMIC interrupts\n"); } - irq_set_chained_handler_and_data(pmic_arb->irq, pmic_arb_chained_irq, - pmic_arb); err = spmi_controller_add(ctrl); if (err) goto err_domain_remove; @@ -1361,8 +1368,10 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev) return 0; err_domain_remove: - irq_set_chained_handler_and_data(pmic_arb->irq, NULL, NULL); - irq_domain_remove(pmic_arb->domain); + if (pmic_arb->irq > 0) { + irq_set_chained_handler_and_data(pmic_arb->irq, NULL, NULL); + irq_domain_remove(pmic_arb->domain); + } err_put_ctrl: spmi_controller_put(ctrl); return err; @@ -1373,8 +1382,10 @@ static int spmi_pmic_arb_remove(struct platform_device *pdev) struct spmi_controller *ctrl = platform_get_drvdata(pdev); struct spmi_pmic_arb *pmic_arb = spmi_controller_get_drvdata(ctrl); spmi_controller_remove(ctrl); - irq_set_chained_handler_and_data(pmic_arb->irq, NULL, NULL); - irq_domain_remove(pmic_arb->domain); + if (pmic_arb->irq > 0) { + irq_set_chained_handler_and_data(pmic_arb->irq, NULL, NULL); + irq_domain_remove(pmic_arb->domain); + } spmi_controller_put(ctrl); return 0; } -- Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.