Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp409417pxb; Wed, 1 Sep 2021 01:26:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrli/xqVTdoA+zwRUkN5/UJwNvk8zKRGrND8rtRj47z52YL/faI1zvetoBQQGcRPKep6rx X-Received: by 2002:a05:6402:1cb9:: with SMTP id cz25mr34721149edb.11.1630484764104; Wed, 01 Sep 2021 01:26:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630484764; cv=none; d=google.com; s=arc-20160816; b=hddfnKQOrSjIRDAc5XHyQS8JHf6DWodUSVKtrWsz2Y0Ytps0ovsT+5zD5PbvBgqRzq qo3RePDLcVxjLtn+Z975qAFnnswzkWO5YuajX7NLTPXWZMbatCbqto5qmZij3MDq4NYd ySTuYX5QuEFb+oGMZXL0hxcUgEn8PXfeXc7i5EylkyMVTB2jQ/pyVvnoADpj7YkhsLHd I3a9V2bf6+cpKNKXVruvJ8d+7OWz+sJxc6yuW9H5WAr+nVDH09w/IlLGD4fIxVY7fX1S ew1FjJosOPwbg6peL0VjWKTN2nD2m2re7f9PdoI9+vAoiBquVAZ9JmXGX46M2CXWLv0o w/pA== 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=hCWrDSqZz1/MJx0Y2r+Vv1EF0PQcvg19mxnobpT+a9s=; b=TeLDt9HtwdDY9PVPFJw1nIZBCe5pR4pPVcnAs1S6n78ooYeSCvGslwSyKdbLzaGkIC ZoudtdVTB3CscMVN2cFNlNBt4EcMfZqCyNIjV8eWDRalZNm+cxUbmexkcQr9au4RbZYG sZQFEaadeBr7gl9q7tfC5b/JQhugYmq550DKuO8JODF21N+ocEGQjRvOLVkI6WVaGgVD /lpim9YY6oGpuQNJBWzgzDte/v4H4FabYSlioJx1+o0AGoHJ9RCOsX+Iy0DD2H8ngSE/ 4wa9H9oJ/TptBTI2Y4eywDH/fGo2nrggpjFFxdNIyqyFph7iz65bjNVsFZO14Jh65ucW zb3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=uhrkqhUk; 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 r9si20511152edb.253.2021.09.01.01.25.28; Wed, 01 Sep 2021 01:26:04 -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=pass header.i=@quicinc.com header.s=qcdkim header.b=uhrkqhUk; 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 S243196AbhIAIUl (ORCPT + 99 others); Wed, 1 Sep 2021 04:20:41 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:52979 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243141AbhIAIU0 (ORCPT ); Wed, 1 Sep 2021 04:20:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1630484370; x=1662020370; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=hCWrDSqZz1/MJx0Y2r+Vv1EF0PQcvg19mxnobpT+a9s=; b=uhrkqhUkeRAVUL32niVbyzmqaSPKZbynwbcYEMTPtY8P3yP7VeuP6LOd X4C4dlaInxneMwqYSHsxvdCjcVNYldftaCSp8cvrZo3xnD+Do0ZH5IwYz tkXPJ1gw47/UlsL2ftwnGesbMTXzqjGgKLwjHpW3tpfhe4qMZXEtVwUOy k=; Received: from ironmsg07-lv.qualcomm.com ([10.47.202.151]) by alexa-out.qualcomm.com with ESMTP; 01 Sep 2021 01:19:29 -0700 X-QCInternal: smtphost Received: from nalasex01c.na.qualcomm.com ([10.47.97.35]) by ironmsg07-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Sep 2021 01:19:30 -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_GCM_SHA384) id 15.2.922.7; Wed, 1 Sep 2021 01:19:27 -0700 From: Fenglin Wu To: , , CC: , , Subject: [RESEND PATCH v1 8/9] spmi: pmic-arb: make interrupt support optional Date: Wed, 1 Sep 2021 16:18:09 +0800 Message-ID: <1630484290-28190-9-git-send-email-quic_fenglinw@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1630484290-28190-1-git-send-email-quic_fenglinw@quicinc.com> References: <1630484290-28190-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 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; } -- 2.7.4