From patchwork Fri Feb 16 00:57:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Kurapati X-Patchwork-Id: 201864 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp226426dyb; Thu, 15 Feb 2024 17:11:25 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUZy+N3qX70RRRExu9CQ3rgPcKpoG3ZjM8D+rkYb4Vdz6Kx4HGGcDoFDAQzSYcKoTh2P549zu4WAynvnJP65u/eTAIaaQ== X-Google-Smtp-Source: AGHT+IGCQu5JNKsfSHZwPm9MXq6nrC/49y+pwl+9fVKUNUruOSZm0/mZcHXraVy+odPs3O5EOYeh X-Received: by 2002:a05:6a00:d5c:b0:6e0:df2d:e7fe with SMTP id n28-20020a056a000d5c00b006e0df2de7femr4117676pfv.11.1708045885132; Thu, 15 Feb 2024 17:11:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708045885; cv=pass; d=google.com; s=arc-20160816; b=FdckWs8DgsUOTZY/qouywJoiZcoRwwS9lxxv5F8jaJd/DITdWbgJdiwX1jLZXWM0to ppzDZf1wU9B4eRSWFiNtogG0p/FwM1Nc5sIhSCH8e3Xqoke7fFFMzU6ZsSTG1p9ELhWq IaEZLB1dn5rdsoi87sVlJu0QAUqzHhs8yvGAA6EIdaEEoQkveILRmfdUqyCMLkkSZfHc eGqssnUobQ1473BYsxhgJgWk9gEUinrLds4n4FyPJstDAvQlkqkK0vwKdCgey0T1+ZWN 4IHCN3JpCmJuCCTC3fBG+yVV7++YK4UjoM21QlnOyyPei+uRjqmler8zA6K7EaMwERDQ r8jw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=YBL6RfIICPWsz3SJ2ooj1M90QUk7ahuLlrso6UxkTJE=; fh=wj4fpoitfUuT9lnmxYpjWQofo4DRhMPmJ4OckgOzWCU=; b=A3ddFB5qR/0GJQCZuTvng7TK5yEIaCrgctS0Af3oCiuHTbyQMRh0CeGEw/m6AUQQyX wgiangliKwFJ7nqR/blngGXyM25fJku1AbqNmM1VHEBptOB0xpHtkbAevl9b3DKs5pDU olx8rqT02n/kEVzX5bmEfWCxhsOyyrx4UuqQhEUfdhiwqOW0NwLNfECVSwaX5m0mDpWM InD/mq52cGfOAK9m+TQVuQrq+8EXLGbBhuLacB3YdFJwDD72CeplXfndxQmwo7GYuDrh M1Wbx58MhKvy+U+2Tm/Ia41arOXNTfKmlZSHdvjKcTAte6xY43YyZzsESBxzS1agg08j aXCA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=VcTIveCh; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-67926-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67926-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id bq16-20020a056a02045000b005dc8585a03dsi2072171pgb.607.2024.02.15.17.11.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 17:11:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67926-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=VcTIveCh; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-67926-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67926-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 0EB85B22853 for ; Fri, 16 Feb 2024 01:09:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 749F31B946; Fri, 16 Feb 2024 00:59:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="VcTIveCh" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ECFA31B803; Fri, 16 Feb 2024 00:59:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708045177; cv=none; b=cIjXAgpETXHgACYVWIvezKxdKgnvL/dowRihtt1GFcionTx3HacNv5DAJjQZXwVogh4mPYyl1FgjeuwJYTpApT/CAXSdjYybGS5789ELqs5U8FDBXc6UwW+em4s209yksBI2kStFQgymLcYsdAm8uEBhWTeOu/oTk8ElXRRaBCc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708045177; c=relaxed/simple; bh=39A/xiTKQauSSJ8A4yn+0yojQ14leyJe5VSWz1gzLh8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OcTLkDU1x0Xjabx3lFpM+0+y3c9lCPwicjIbBbolZFyvzRS3OuNgCdmA76Mn/S03M6cocuwgZI8Fjc4BuF7U4r8EeTwfjJhQH6BDAhmOF1BveNjLVKROFzrdoSuRrI7iNMDTynFFEQd8NtZ2nEg7NnHfpJyKK7En/F2Aowm6vYA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=VcTIveCh; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41G0ltnK019880; Fri, 16 Feb 2024 00:59:30 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=YBL6RfIICPWsz3SJ2ooj1M90QUk7ahuLlrso6UxkTJE=; b=Vc TIveChnsiIzkGMrr81edteIWPv53EFcXNnUtsQccVUYsQq8WWHUHie5FI49Lihxc XpSLKGpAK6qivrMI4BJSlc5Y7unJbGhLHtyMoWiSdvq0iqP/vSz/Rt3407T5fAnS RloqcZIxHTfsPoC4uWVw28wTXa5DRCUO4c2bdy+GVln13PZcm2tie35O5B0klrdG johSvcjumnxPA8bjVd9zCA2Q7/dKy3LY8ij4xoaB2KhVGVbWz7OvzHWo/WARNd7f TgSkrx1Iznf13Ipc1I3vnFj9eBq0i9Pu1bZQPBkNICCQW8pWLDem9f5J9suk9EBx 3jotmovvfsVLCEo3NyTw== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3w9cudjq3r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Feb 2024 00:59:29 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41G0wmqG029211 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Feb 2024 00:58:48 GMT Received: from hu-kriskura-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Thu, 15 Feb 2024 16:58:43 -0800 From: Krishna Kurapati To: Krzysztof Kozlowski , Rob Herring , Bjorn Andersson , Wesley Cheng , Konrad Dybcio , "Greg Kroah-Hartman" , Conor Dooley , Thinh Nguyen , Felipe Balbi , Johan Hovold CC: , , , , , , Krishna Kurapati Subject: [PATCH v15 6/9] usb: dwc3: qcom: Add helper function to request wakeup interrupts Date: Fri, 16 Feb 2024 06:27:53 +0530 Message-ID: <20240216005756.762712-7-quic_kriskura@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240216005756.762712-1-quic_kriskura@quicinc.com> References: <20240216005756.762712-1-quic_kriskura@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: gCIWrzbUwCkicjeNN7KcMdHli-kPupDH X-Proofpoint-ORIG-GUID: gCIWrzbUwCkicjeNN7KcMdHli-kPupDH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_24,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxlogscore=852 priorityscore=1501 spamscore=0 suspectscore=0 phishscore=0 bulkscore=0 lowpriorityscore=0 malwarescore=0 mlxscore=0 clxscore=1015 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402160005 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791015922275074849 X-GMAIL-MSGID: 1791015922275074849 The logic for requesting interrupts is duplicated for each interrupt. In the upcoming patches that introduces support for multiport, it would be better to clean up the duplication before reading mulitport related interrupts. Refactor interrupt setup call by adding a new helper function for requesting the wakeup interrupts. To simplify implementation, make the display name same as the interrupt name expected in DT. Signed-off-by: Krishna Kurapati Reviewed-by: Bjorn Andersson Acked-by: Thinh Nguyen --- drivers/usb/dwc3/dwc3-qcom.c | 53 ++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c index dbd6a5b2b289..08df29584366 100644 --- a/drivers/usb/dwc3/dwc3-qcom.c +++ b/drivers/usb/dwc3/dwc3-qcom.c @@ -535,6 +535,22 @@ static int dwc3_qcom_get_irq(struct platform_device *pdev, return ret; } +static int dwc3_qcom_request_irq(struct dwc3_qcom *qcom, int irq, + const char *name) +{ + int ret; + + /* Keep wakeup interrupts disabled until suspend */ + ret = devm_request_threaded_irq(qcom->dev, irq, NULL, + qcom_dwc3_resume_irq, + IRQF_ONESHOT | IRQF_NO_AUTOEN, + name, qcom); + if (ret) + dev_err(qcom->dev, "failed to request irq %s: %d\n", name, ret); + + return ret; +} + static int dwc3_qcom_setup_irq(struct platform_device *pdev) { struct dwc3_qcom *qcom = platform_get_drvdata(pdev); @@ -545,57 +561,36 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev) irq = dwc3_qcom_get_irq(pdev, "qusb2_phy", pdata ? pdata->qusb2_phy_irq_index : -1); if (irq > 0) { - /* Keep wakeup interrupts disabled until suspend */ - ret = devm_request_threaded_irq(qcom->dev, irq, NULL, - qcom_dwc3_resume_irq, - IRQF_ONESHOT | IRQF_NO_AUTOEN, - "qcom_dwc3 QUSB2", qcom); - if (ret) { - dev_err(qcom->dev, "qusb2_phy_irq failed: %d\n", ret); + ret = dwc3_qcom_request_irq(qcom, irq, "hs_phy_irq"); + if (ret) return ret; - } qcom->qusb2_phy_irq = irq; } irq = dwc3_qcom_get_irq(pdev, "dp_hs_phy_irq", pdata ? pdata->dp_hs_phy_irq_index : -1); if (irq > 0) { - ret = devm_request_threaded_irq(qcom->dev, irq, NULL, - qcom_dwc3_resume_irq, - IRQF_ONESHOT | IRQF_NO_AUTOEN, - "qcom_dwc3 DP_HS", qcom); - if (ret) { - dev_err(qcom->dev, "dp_hs_phy_irq failed: %d\n", ret); + ret = dwc3_qcom_request_irq(qcom, irq, "dp_hs_phy_irq"); + if (ret) return ret; - } qcom->dp_hs_phy_irq = irq; } irq = dwc3_qcom_get_irq(pdev, "dm_hs_phy_irq", pdata ? pdata->dm_hs_phy_irq_index : -1); if (irq > 0) { - ret = devm_request_threaded_irq(qcom->dev, irq, NULL, - qcom_dwc3_resume_irq, - IRQF_ONESHOT | IRQF_NO_AUTOEN, - "qcom_dwc3 DM_HS", qcom); - if (ret) { - dev_err(qcom->dev, "dm_hs_phy_irq failed: %d\n", ret); + ret = dwc3_qcom_request_irq(qcom, irq, "dm_hs_phy_irq"); + if (ret) return ret; - } qcom->dm_hs_phy_irq = irq; } irq = dwc3_qcom_get_irq(pdev, "ss_phy_irq", pdata ? pdata->ss_phy_irq_index : -1); if (irq > 0) { - ret = devm_request_threaded_irq(qcom->dev, irq, NULL, - qcom_dwc3_resume_irq, - IRQF_ONESHOT | IRQF_NO_AUTOEN, - "qcom_dwc3 SS", qcom); - if (ret) { - dev_err(qcom->dev, "ss_phy_irq failed: %d\n", ret); + ret = dwc3_qcom_request_irq(qcom, irq, "ss_phy_irq"); + if (ret) return ret; - } qcom->ss_phy_irq = irq; }