Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5444285pxb; Wed, 26 Jan 2022 12:07:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJzA9OSoQ8ECTqFD4tSCl006GpBWQSJw0JfrHjI+A2l6THRTwy8U7BZmQjCDab+NlDCm/AUe X-Received: by 2002:a05:6a00:1892:: with SMTP id x18mr124330pfh.20.1643227630261; Wed, 26 Jan 2022 12:07:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643227630; cv=none; d=google.com; s=arc-20160816; b=LUL56ePlg+lasf4u4J9bp38MMS8joJ+bWozXrTVAH3OELKvVkPLb7aaros75+wUcan KOv3ZIMVaofAhzQPvvLuNBpLG2UzOKbhZinHqW/z95MYFPo49ApkSv3O3DcrdjXJoGet tcPK1QseXZJEF/IUtTX1L+/hxM+tKvLIHqDf+Z2cDZLVg8jtQheyGkc0B/febLZVM8ji oiryKa2rKP9S/FMjke3D9iwvEMcxGRbR4XQrZ3IzxKggTkK8vQV+qZG6QjFlcZHoC8OD rp711CFBjrNChOXkf963RA8CPJg6klpUP/cCCHtK8XTRX5+ho/7FEZnRCC1e8Iw5RQ04 vMLg== 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=9W8MONWCB3nHa5cG39eCdoNQ68ZRf4zFDKZRUOobOfU=; b=mH2ypWOXn23Y3MYEY4rMh9Q7APxqRlS+U28bVmZl4PtZ1khKrC6rYp1yadG87dOu9j CL7RvatpMUHEzInjkT3gtuQ33dSKKM8xwYJGsNxSaVAqbdD0VZ7Zn+UbI4apXslKAoeA UpCJXjRDRtm8l213J6QhV5fGEbj7aBXEAdE/gPaAiJjPQ3c66lrgL6grQgGhjhY+hl2I u2lh4MTcK5W8GintREp/qJ5Dp8LFEQfNGhsfXymO8ZKhGB/cMHki73atgk0cXQOPGYAL N/Nx72OAdZScj78g0+N/CfX40FXvbydaJlTv/wgdR/IzGnIxEB/ibVkuvrZCqgEcE6y8 8pIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=uuZ5+aN6; 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=pass (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 br2si2027972pjb.6.2022.01.26.12.06.58; Wed, 26 Jan 2022 12:07:10 -0800 (PST) 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=pass header.i=@quicinc.com header.s=qcdkim header.b=uuZ5+aN6; 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=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236217AbiAZGdX (ORCPT + 99 others); Wed, 26 Jan 2022 01:33:23 -0500 Received: from alexa-out-sd-02.qualcomm.com ([199.106.114.39]:48613 "EHLO alexa-out-sd-02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236799AbiAZGdH (ORCPT ); Wed, 26 Jan 2022 01:33:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1643178787; x=1674714787; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=9W8MONWCB3nHa5cG39eCdoNQ68ZRf4zFDKZRUOobOfU=; b=uuZ5+aN6+FsJbxYJWtQYtXIEHW/+7GLYPByEi8zJWBYPDzSCgRXd1jIC QCeNCmI4+AlwxOZV6gE6RSBbr/FMbDA+6dUpsBO4NocU7hwe8Mv0GsUH0 0rz+X+iN5G56FshRIfeM5PuGP95VEP2j9GeHyTOIiCxDigXtbZFR4vK2r o=; Received: from unknown (HELO ironmsg03-sd.qualcomm.com) ([10.53.140.143]) by alexa-out-sd-02.qualcomm.com with ESMTP; 25 Jan 2022 22:33:06 -0800 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg03-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2022 22:33:03 -0800 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.922.19; Tue, 25 Jan 2022 22:33:02 -0800 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_GCM_SHA384) id 15.2.922.19; Tue, 25 Jan 2022 22:32:59 -0800 From: Fenglin Wu To: , , CC: , , , , Subject: [PATCH v5 09/10] spmi: pmic-arb: make interrupt support optional Date: Wed, 26 Jan 2022 14:31:51 +0800 Message-ID: <1643178713-17178-10-git-send-email-quic_fenglinw@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1643178713-17178-1-git-send-email-quic_fenglinw@quicinc.com> References: <1643178713-17178-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: nasanex01a.na.qualcomm.com (10.52.223.231) 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 39f25bc..0496e5d 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -1386,10 +1386,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-controller", 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); @@ -1449,17 +1451,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; @@ -1467,8 +1474,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; @@ -1479,8 +1488,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; } -- 2.7.4