Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5709578pxv; Wed, 28 Jul 2021 18:15:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfoXCROy83ieiFbosRuzu9qhk75l1MCYSWbFQKpUksV/0dvNB5+s4TbQuYiFskK2OajXkc X-Received: by 2002:a6b:ee16:: with SMTP id i22mr1870356ioh.37.1627521327498; Wed, 28 Jul 2021 18:15:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627521327; cv=none; d=google.com; s=arc-20160816; b=ixpr2xa82P1T3ABkmU1/zRubqpb1myxkpGZ6iEyTfx6D713Eqqm8ERrm1EfQ8Tcj72 the0l55Av26Usq16fdC90xAibX34uSH/Mh00kp1mPNRww4me7V23jsiPh9KTZgx12XeH 3soUM3lDpXseRycsaaf0ENDPeKYjssXsIXv+WmBzcQT00jExXFqOgFXrS8MruO+TBgeW YbbXQqPEUFy8zUMEyOM+gY4W6ETHmah+wHITLPi/qa5dzg9JP0g5OcixTmloBdVtF5zT jFmBZx3TazSH9wZGPG+FA/nf7ovsYAtXGjG02wmPKWcwX7LadoOGypj+78S6v5U8JHQA 2BjA== 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=xStq/Y13yur/OPLlTJEo76XT0xdOM9VUqe98PkvaiL9v4gmeth0X6TUW+kpEeUb4nF PpvZJkPrK+kCYYV9zVry21iAa0nVACk1Ux9ZIHEqwWjij7psTffSiCCf2kx0sqPGMkaf xN8x8aSl4t2WSQ2ES3TDzVrN6EimSJsih/OiO3WL8jVYxIFOv3EWdbxyh5TzgLIpNhPU ljjsVQT0zv5v1dVnZ5bRsNk0sCcKIgLowqh1YXkriM4DvKBheFDGDLmAaxc0M9p3Ly4V uk5hA8q8q+is0VAITHum2pKxfsUk6ci1kEzzrz+FdUoxBEGkTkxHJkzWFXYAdwdXkecv ThVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@quicinc.com header.s=qcdkim header.b=tJXBpRPx; 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 t25si1706148ios.38.2021.07.28.18.15.16; Wed, 28 Jul 2021 18:15:27 -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=tJXBpRPx; 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 S233548AbhG2BOJ (ORCPT + 99 others); Wed, 28 Jul 2021 21:14:09 -0400 Received: from alexa-out-sd-01.qualcomm.com ([199.106.114.38]:64173 "EHLO alexa-out-sd-01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233326AbhG2BOB (ORCPT ); Wed, 28 Jul 2021 21:14:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1627521239; x=1659057239; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=lXmE2bDOF4EwRGm8KjpM+LKJRtL4f/Jq6qA4zPZMTZY=; b=tJXBpRPxq17cnc4zvOFPUpp37i2XZLOS1LATgcls4aTsZoem6shMNaK1 pdNjTCPyjhTAdAnInWcDsJqijHID/iT6YwtiFtnx0hz3SyGkFujYgrCov JYcJFOVouIMG0lfR9hTVOExLI575v10NiESCFxtDCC6cqTLhNnJwi+xRe U=; Received: from unknown (HELO ironmsg-SD-alpha.qualcomm.com) ([10.53.140.30]) by alexa-out-sd-01.qualcomm.com with ESMTP; 28 Jul 2021 18:13:59 -0700 X-QCInternal: smtphost Received: from nasanexm03e.na.qualcomm.com ([10.85.0.48]) by ironmsg-SD-alpha.qualcomm.com with ESMTP/TLS/AES256-SHA; 28 Jul 2021 18:13:59 -0700 Received: from fenglinw-gv.qualcomm.com (10.80.80.8) by nasanexm03e.na.qualcomm.com (10.85.0.48) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Wed, 28 Jul 2021 18:13:57 -0700 From: Fenglin Wu To: , , CC: , , Subject: [PATCH V1 8/9] spmi: pmic-arb: make interrupt support optional Date: Thu, 29 Jul 2021 09:12:46 +0800 Message-ID: <1627521167-18848-9-git-send-email-quic_fenglinw@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1627521167-18848-1-git-send-email-quic_fenglinw@quicinc.com> References: <1627521167-18848-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: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanexm03e.na.qualcomm.com (10.85.0.48) 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.