Message ID | 20240216035923.23392-35-quic_wcheng@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-68017-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp287165dyb; Thu, 15 Feb 2024 20:12:45 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU1IZhuZc2cfzTZDfvLxHhOQCVHqt2WTiHcdJHV0nCrkU2F2mfIWN6LobKynMn+FVJoGUb2xOdwqWFKIGeRg0IeASX73g== X-Google-Smtp-Source: AGHT+IFc98eFy+JviwLEXSKQn2EQmuQY4spegJveTk6A528cNzO9JUfC3iLI++n9xnCsSnsSGdWK X-Received: by 2002:a25:c553:0:b0:dcd:551f:1e2 with SMTP id v80-20020a25c553000000b00dcd551f01e2mr3636883ybe.34.1708056765096; Thu, 15 Feb 2024 20:12:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708056765; cv=pass; d=google.com; s=arc-20160816; b=SpGquAX6Gl+iANAuTtETEa0jWmUfxVcdUZwNVogFSKCmDWmuYxf7Cw5mnco8q+cliN tEjzoKlCQzWIhWbRRyAQENX2MF6JIS4nL+dBBMM27+rmF+JBfLUUB1XlA2UAqkH0xyoO sQEEdH505ffMrIERyUkJ8cYL+Os4HLV3Bzescta111ZGAV5cO2z7EFRIWPAw7FDen5Fh 4nsi678/a8fUzvGTpW9JJDCNcu/2o2zMw3fEqBV+MzU3v0JIBPQKaKVFmgdMq5QOSiqd KzXBUa2efwDGHM02dnpewj6q25CIjV2RWCq+/mi8NkKSrc7nPcb40Pt2hcEaSL44AjDk A8dw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=aA9Sn9ac+ss4/YHti4kXTkt33x1iW/bm3208DFzCqrg=; fh=VKrp0Y7I/+wT36BfKZ6oI/4N9BIwFCn9zerObkOrgGw=; b=Qn9Qtbr4S7/i8WmAJ757qgb12cwZ9RsvlDBLY5xHBpyy+trx3HKPINOFHs5lM2uOqD xO6s8xo7zcOXRLfWnk7QRyfM2b5pm3HZafkuk8BRVxCSYF5tzaQ0gwQ12vysbjgnDF3Y Lt0C8Jf1/zHpNPABNoajEgheMe+VQQw1bzDlZ6NPV+mu7FrEA7qRjrLlPlEoSO0LoQuC HA9iH2iYoeuVL6J3YuvxtNwX5hk7MHCqtEg3JLsxSeCSEFcLZc2Ne4TWwlg3CMhKOWya +Ty8ZusGm+KjooLbeuxZoomcNcFWgsAJM6DpSUuNGtERurXfQt8ecHIvxxaH0ipaCgsn SbzQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=hZqMQuIv; 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-68017-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68017-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id k25-20020ac86059000000b0042dc85873dasi2923175qtm.182.2024.02.15.20.12.44 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 20:12:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68017-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=hZqMQuIv; 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-68017-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68017-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id DD4471C21835 for <ouuuleilei@gmail.com>; Fri, 16 Feb 2024 04:12:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 505214D109; Fri, 16 Feb 2024 04:00:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="hZqMQuIv" 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 2419C182A7; Fri, 16 Feb 2024 04:00:00 +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=1708056003; cv=none; b=ZxYxbtMkvPVVuxx4wieafJUPJrZ7F6vmQyP3N9xSojoHB6IfeOFndgDri/nYFBJ4MILy6WrU2+fw/+86aq1c/dOkqg5H3VAeA9C5b2+cZ5iYfM9fkmGMAYLeDt3gZGqPSUuW5sJ35vjjCyco0wkM2NtjXyFYjMnR+VZo3twPthQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708056003; c=relaxed/simple; bh=Sg6n3U8klBs5yu1OmkNOQ0RsxbG3uphWptIrINoskvI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=llfbgePtt/fwgMXGvk0/aE/eCaXcwGtzmJTi8kb9ciBDPH5OayqrQIXsKwUrofT2ouwxyzKqYCvWXs4c+kDiDaPmLV8GzXaISC9TcKiu9DxAKzLpeInfaNXCDaA36cYW4zFfDkRLu3UG2vXBcYlFvh6IGnaV4/FCq8iDJFH+JE0= 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=hZqMQuIv; 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 (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41G3G4fa018788; Fri, 16 Feb 2024 03:59:43 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-type; s=qcppdkim1; bh=aA9Sn9ac+ss4/YHti4kX Tkt33x1iW/bm3208DFzCqrg=; b=hZqMQuIvXkGZUSuljBxg2ZXR1S2qrvO3jYJO Lrz5LCqEZBQycDY+JDcQyuUu2rpVC2BqEKI1vfTuCJkYkeGy+kfxXMUQgZp0RA+I xOc8bCUby+wrBmaKCaqMZ8zU0L/2n7hsLTc6mR/QyszblJK4VFgVp4FaoiQ3627t v+pLZuTdoZbPLpfooreRAvwOL42v8kuj6c+ZWqOQpbaG6oqrvnulkA8HM06Hu9ZL xPRAAkFXzgG33NJPd8sQfbM4rY3Uk3EPdP0TTgYujNjHazounTg3IWD7mI+QWZV5 bZSh66Lo5uG6bXt0O27iPncjqEffD7na1cpDZn30R44AD4cH3Q== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3w9fkfap30-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Feb 2024 03:59:43 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41G3xgL0020555 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Feb 2024 03:59:42 GMT Received: from hu-wcheng-lv.qualcomm.com (10.49.16.6) by nalasex01b.na.qualcomm.com (10.47.209.197) 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 19:59:42 -0800 From: Wesley Cheng <quic_wcheng@quicinc.com> To: <srinivas.kandagatla@linaro.org>, <mathias.nyman@intel.com>, <perex@perex.cz>, <conor+dt@kernel.org>, <corbet@lwn.net>, <lgirdwood@gmail.com>, <andersson@kernel.org>, <krzysztof.kozlowski+dt@linaro.org>, <gregkh@linuxfoundation.org>, <Thinh.Nguyen@synopsys.com>, <broonie@kernel.org>, <bgoswami@quicinc.com>, <tiwai@suse.com>, <robh+dt@kernel.org>, <konrad.dybcio@linaro.org> CC: <linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>, <linux-sound@vger.kernel.org>, <linux-usb@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>, <linux-doc@vger.kernel.org>, <alsa-devel@alsa-project.org>, Wesley Cheng <quic_wcheng@quicinc.com> Subject: [PATCH v16 34/50] ALSA: usb-audio: Do not allow USB offload path if PCM device is in use Date: Thu, 15 Feb 2024 19:59:07 -0800 Message-ID: <20240216035923.23392-35-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240216035923.23392-1-quic_wcheng@quicinc.com> References: <20240216035923.23392-1-quic_wcheng@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: pJgMSwmOEVwoXVxKr7F9-kkRDF2cs_x9 X-Proofpoint-GUID: pJgMSwmOEVwoXVxKr7F9-kkRDF2cs_x9 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-16_02,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 malwarescore=0 adultscore=0 lowpriorityscore=0 impostorscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402160029 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791027330459940852 X-GMAIL-MSGID: 1791027330459940852 |
Series |
Introduce QC USB SND audio offloading support
|
|
Commit Message
Wesley Cheng
Feb. 16, 2024, 3:59 a.m. UTC
Add proper checks and updates to the USB substream once receiving a USB QMI
stream enable request. If the substream is already in use from the non
offload path, reject the stream enable request. In addition, update the
USB substream opened parameter when enabling the offload path, so the
non offload path can be blocked.
Change-Id: Ie97bbe5bc0e6e069682c63e4f880e21786ed4b7d
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
---
sound/usb/qcom/qc_audio_offload.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/sound/usb/qcom/qc_audio_offload.c b/sound/usb/qcom/qc_audio_offload.c index 3b7780cb288a..db68c6c605eb 100644 --- a/sound/usb/qcom/qc_audio_offload.c +++ b/sound/usb/qcom/qc_audio_offload.c @@ -1460,12 +1460,17 @@ static void handle_uaudio_stream_req(struct qmi_handle *handle, goto response; } + mutex_lock(&chip->mutex); if (req_msg->enable) { - if (info_idx < 0 || chip->system_suspend) { + if (info_idx < 0 || chip->system_suspend || subs->opened) { ret = -EBUSY; + mutex_unlock(&chip->mutex); + goto response; } + subs->opened = 1; } + mutex_unlock(&chip->mutex); if (req_msg->service_interval_valid) { ret = get_data_interval_from_si(subs, @@ -1487,6 +1492,11 @@ static void handle_uaudio_stream_req(struct qmi_handle *handle, if (!ret) ret = prepare_qmi_response(subs, req_msg, &resp, info_idx); + if (ret < 0) { + mutex_lock(&chip->mutex); + subs->opened = 0; + mutex_unlock(&chip->mutex); + } } else { info = &uadev[pcm_card_num].info[info_idx]; if (info->data_ep_pipe) { @@ -1510,6 +1520,9 @@ static void handle_uaudio_stream_req(struct qmi_handle *handle, } disable_audio_stream(subs); + mutex_lock(&chip->mutex); + subs->opened = 0; + mutex_unlock(&chip->mutex); } response: