Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp593907rwb; Fri, 23 Sep 2022 01:06:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7r4WoYEcng2L8XX+MQ8pb+Dt4BD2RjlipgD7F4RabOM7UykadyImoa034+o3ZpsO/Xh3X1 X-Received: by 2002:a17:90a:ab91:b0:202:a520:56c9 with SMTP id n17-20020a17090aab9100b00202a52056c9mr20267020pjq.1.1663920410529; Fri, 23 Sep 2022 01:06:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663920410; cv=none; d=google.com; s=arc-20160816; b=xEB38WXS+hb6urdBsu4xqtV5EoSJCvEdOVbW1GvB0q8KrDmYzDwzhehgwviPCWXzCW iszuIRJf7Wl0VRQQhQd15OsfvowvTNddhNqn1L+Pp5xVTNd+8CgeT0vXWDWY+d5uDZH0 WWBWaXJn25sRqtNVNm40GGJdBiwXOBrK1g0pUlMWn5SI+xw6EhdHkhaUEJFh9IF6wr6d aOBXHylgM48vh6Tqs/KTQrcgIaxbU6ccFzIjotVAVto/M5rkWYK25gylYhCdEJh/VjJS rYAm47bikqlGqFYH009KgkYiTdf+kDZWOYI0HQeAdKlRPmhzOyJlRMzZ/WGgMCRmXdAE 6/lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nDjdT2/VAZHdeXBVDIyE/snX92o8+RhBhcOhfWyjFdE=; b=XUkcx2hjrwltjtligYfSovMjD/Mj+FvmcPNOJUoJ1tzFzeC2kDUZUhn0snDaXMK/wo erJuQtH8KH0llsSmUVy8IBsw0rVQUsilTuoBK/nYWW8bYr2sZ/kJZVM6d4UdGWWQL/cT A73udoPPth/q5spLdOKw1R9SqZTpTZH7jdPixBK2hCK9tjGJEqHUAwpMD9HLLnc97Rlk Vg6w5R6KBG6UrIMBSUs1b5Cjoyy5oIKq6OCM03M2UpJU8SAxHFGLTODH1C4gyJF7SPgB QGPVW6RAVSAyPNUrDBv80cFNXa6SCqi4sWFsC08AaYjEjxN50ucPCUmPtuvP+ehuYCCf IFYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=BJNa9Rd1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r1-20020a63fc41000000b0043bd846491csi8799832pgk.147.2022.09.23.01.06.39; Fri, 23 Sep 2022 01:06:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=BJNa9Rd1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229616AbiIWIBC (ORCPT + 99 others); Fri, 23 Sep 2022 04:01:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229844AbiIWIA6 (ORCPT ); Fri, 23 Sep 2022 04:00:58 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3C7411D636; Fri, 23 Sep 2022 01:00:55 -0700 (PDT) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28N5kr0c026528; Fri, 23 Sep 2022 07:49:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=nDjdT2/VAZHdeXBVDIyE/snX92o8+RhBhcOhfWyjFdE=; b=BJNa9Rd1ISZmc0uJ3W9VIJP2owso42o3MWVngZDDX8abBOHVGbPRVZTulpajEX+PQ9AZ +Zu0A2/GkSgIYm+NVNmhE7Xn1yMMfgSYRFFDO5bqAgu9Sx/HY8eST/JuPvkG4W0l522w AitAYXyl1g1YhfUP/M46l4evBrWyl9AIzvtpvGJoNobdVmQkXrNyWPkFpwXGQwZ2rScQ TZNugSWU1UAv8cdp3eyvviX2TvvwN3MRgqwPQeGJWsdRkRLhdZajZYvILwb5CUYJe4wH UY1a6IehtZT7n2sPE/Ru64lYUxNMA+p9YstBgvcW8+CxQO3TQBgULeAqZxzZ5QtmKI0n NA== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3jrdnmkw44-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Sep 2022 07:49:58 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 28N7nvJ6017005 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Sep 2022 07:49:57 GMT Received: from fenglinw2-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.986.29; Fri, 23 Sep 2022 00:49:55 -0700 From: Fenglin Wu To: , , CC: , , , David Collins Subject: [PATCH v1 2/2] spmi: pmic-arb: make interrupt support optional Date: Fri, 23 Sep 2022 15:49:39 +0800 Message-ID: <20220923074939.2592244-3-quic_fenglinw@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220923074939.2592244-1-quic_fenglinw@quicinc.com> References: <20220923074939.2592244-1-quic_fenglinw@quicinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: oEuKsuY2TsATBdsy5NornFCw5rcu0s_A X-Proofpoint-GUID: oEuKsuY2TsATBdsy5NornFCw5rcu0s_A X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-23_02,2022-09-22_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=366 lowpriorityscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 spamscore=0 impostorscore=0 phishscore=0 clxscore=1015 adultscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209230049 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 1e7f5a9ff4bc..c14cffd8a313 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -1490,10 +1490,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); @@ -1553,17 +1555,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; @@ -1571,8 +1578,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; @@ -1583,8 +1592,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.25.1