From nobody Wed Nov 27 11:57:08 2024 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 028171E9068; Fri, 11 Oct 2024 00:07:47 +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=1728605272; cv=none; b=PitUQ3mMjoWQ8Q9eR47JPyhsSFtSgp67BnJQgM3YUqHNg/oWvMTFl8mGaNelPxNOeicP0Npgzd/7p9ickPj88vabS9apg+DBlAVR0qgHGQutY1SQHITrai5yjNJa2DlU3ADcn0zV4sfRXPrkRZZr+RUJKof9pr67eQOvNgjghFY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728605272; c=relaxed/simple; bh=9cdnbJPdjIkgUwVVDViOSctU4pwRwxYTjPMbwEvbRI8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NMcBBUnSO52HqgW7J2vH3AFoImt5uXfSdw8CIk4KSdqBxWKSWPqwRfngKuEaw8gltzwOi1T50Xt858OlD5ZXf8hx1/IoRKdJ+T/UyZI10mHYiH0uEwILAli4+toOPMHYQNfjU20QsLmOnaArEin8FmZM3QKtCN6qQ4RxqX4pikE= 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=KFiwVBZ2; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="KFiwVBZ2" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49ACPw2T000772; Fri, 11 Oct 2024 00:07:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= /iXWyJ+VSbDCGIDrA8mF4MYZ6p5L8xVjpkuwHayJnho=; b=KFiwVBZ2mn0jinFq nUaGqhRpqW/4m+8NGXf+H4Zz186RW2kpn9SZNTIKUtQtL0YGeiNOQTX2vLfuRrkh iAJQrvHdXdh4AFYnu9szT/TPJEr2W/viAupTEqEf547NPwFDSFcjkl4+I4AjCp81 RESpdLmyPBBOicCcQ33KDZ5VuS2mUfkTA+8jU8DKro41PvQ/2uTJqWD0N7eTyn1l Ex+LTob4WJjEFjcUB6HWy7MvIQbBYHQW6VGTLQB5x8S2LV+ZiwsG1U5fxn7HPKSF u9hXv5fc3a8aejddBCXbjQmej1wI2XomJjjt3FbLUspV0acs505X/S+L8Ra0zWft FNKB1w== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 424cy7mjyx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Oct 2024 00:07:19 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA04.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 49B07IL2003458 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Oct 2024 00:07:18 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.1544.9; Thu, 10 Oct 2024 17:07:17 -0700 From: Wesley Cheng To: , , , , , , , , , , , , , , CC: , , , , , , , , Wesley Cheng Subject: [PATCH v28 27/32] ALSA: usb-audio: qcom: Add USB QMI definitions Date: Thu, 10 Oct 2024 17:06:39 -0700 Message-ID: <20241011000650.2585600-55-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241011000650.2585600-1-quic_wcheng@quicinc.com> References: <20241011000650.2585600-1-quic_wcheng@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) 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: aFBJ3_dkUACOrqQfXXqGdZIPxCpM7v4q X-Proofpoint-GUID: aFBJ3_dkUACOrqQfXXqGdZIPxCpM7v4q X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 impostorscore=0 adultscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 spamscore=0 priorityscore=1501 clxscore=1015 bulkscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2410100159 Content-Type: text/plain; charset="utf-8" The Qualcomm USB audio offload driver utilizes the QMI protocol to communicate with the audio DSP. Add the necessary QMI header and field definitions, so the QMI interface driver is able to route the QMI packet received to the USB audio offload driver. Signed-off-by: Wesley Cheng --- sound/usb/qcom/usb_audio_qmi_v01.c | 863 +++++++++++++++++++++++++++++ sound/usb/qcom/usb_audio_qmi_v01.h | 164 ++++++ 2 files changed, 1027 insertions(+) create mode 100644 sound/usb/qcom/usb_audio_qmi_v01.c create mode 100644 sound/usb/qcom/usb_audio_qmi_v01.h diff --git a/sound/usb/qcom/usb_audio_qmi_v01.c b/sound/usb/qcom/usb_audio_= qmi_v01.c new file mode 100644 index 000000000000..5e8efbec3922 --- /dev/null +++ b/sound/usb/qcom/usb_audio_qmi_v01.c @@ -0,0 +1,863 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights res= erved. + */ + +#include + +#include "usb_audio_qmi_v01.h" + +static const struct qmi_elem_info mem_info_v01_ei[] =3D { + { + .data_type =3D QMI_UNSIGNED_8_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u64), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0, + .offset =3D offsetof(struct mem_info_v01, va), + }, + { + .data_type =3D QMI_UNSIGNED_8_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u64), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0, + .offset =3D offsetof(struct mem_info_v01, pa), + }, + { + .data_type =3D QMI_UNSIGNED_4_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u32), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0, + .offset =3D offsetof(struct mem_info_v01, size), + }, + { + .data_type =3D QMI_EOTI, + .array_type =3D NO_ARRAY, + .tlv_type =3D QMI_COMMON_TLV_TYPE, + }, +}; + +static const struct qmi_elem_info apps_mem_info_v01_ei[] =3D { + { + .data_type =3D QMI_STRUCT, + .elem_len =3D 1, + .elem_size =3D sizeof(struct mem_info_v01), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0, + .offset =3D offsetof(struct apps_mem_info_v01, evt_ring), + .ei_array =3D mem_info_v01_ei, + }, + { + .data_type =3D QMI_STRUCT, + .elem_len =3D 1, + .elem_size =3D sizeof(struct mem_info_v01), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0, + .offset =3D offsetof(struct apps_mem_info_v01, tr_data), + .ei_array =3D mem_info_v01_ei, + }, + { + .data_type =3D QMI_STRUCT, + .elem_len =3D 1, + .elem_size =3D sizeof(struct mem_info_v01), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0, + .offset =3D offsetof(struct apps_mem_info_v01, tr_sync), + .ei_array =3D mem_info_v01_ei, + }, + { + .data_type =3D QMI_STRUCT, + .elem_len =3D 1, + .elem_size =3D sizeof(struct mem_info_v01), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0, + .offset =3D offsetof(struct apps_mem_info_v01, xfer_buff), + .ei_array =3D mem_info_v01_ei, + }, + { + .data_type =3D QMI_STRUCT, + .elem_len =3D 1, + .elem_size =3D sizeof(struct mem_info_v01), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0, + .offset =3D offsetof(struct apps_mem_info_v01, dcba), + .ei_array =3D mem_info_v01_ei, + }, + { + .data_type =3D QMI_EOTI, + .array_type =3D NO_ARRAY, + .tlv_type =3D QMI_COMMON_TLV_TYPE, + }, +}; + +static const struct qmi_elem_info usb_endpoint_descriptor_v01_ei[] =3D { + { + .data_type =3D QMI_UNSIGNED_1_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0, + .offset =3D offsetof(struct usb_endpoint_descriptor_v01, + bLength), + }, + { + .data_type =3D QMI_UNSIGNED_1_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0, + .offset =3D offsetof(struct usb_endpoint_descriptor_v01, + bDescriptorType), + }, + { + .data_type =3D QMI_UNSIGNED_1_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0, + .offset =3D offsetof(struct usb_endpoint_descriptor_v01, + bEndpointAddress), + }, + { + .data_type =3D QMI_UNSIGNED_1_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0, + .offset =3D offsetof(struct usb_endpoint_descriptor_v01, + bmAttributes), + }, + { + .data_type =3D QMI_UNSIGNED_2_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u16), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0, + .offset =3D offsetof(struct usb_endpoint_descriptor_v01, + wMaxPacketSize), + }, + { + .data_type =3D QMI_UNSIGNED_1_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0, + .offset =3D offsetof(struct usb_endpoint_descriptor_v01, + bInterval), + }, + { + .data_type =3D QMI_UNSIGNED_1_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0, + .offset =3D offsetof(struct usb_endpoint_descriptor_v01, + bRefresh), + }, + { + .data_type =3D QMI_UNSIGNED_1_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0, + .offset =3D offsetof(struct usb_endpoint_descriptor_v01, + bSynchAddress), + }, + { + .data_type =3D QMI_EOTI, + .array_type =3D NO_ARRAY, + .tlv_type =3D QMI_COMMON_TLV_TYPE, + }, +}; + +static const struct qmi_elem_info usb_interface_descriptor_v01_ei[] =3D { + { + .data_type =3D QMI_UNSIGNED_1_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0, + .offset =3D offsetof(struct usb_interface_descriptor_v01, + bLength), + }, + { + .data_type =3D QMI_UNSIGNED_1_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0, + .offset =3D offsetof(struct usb_interface_descriptor_v01, + bDescriptorType), + }, + { + .data_type =3D QMI_UNSIGNED_1_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0, + .offset =3D offsetof(struct usb_interface_descriptor_v01, + bInterfaceNumber), + }, + { + .data_type =3D QMI_UNSIGNED_1_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0, + .offset =3D offsetof(struct usb_interface_descriptor_v01, + bAlternateSetting), + }, + { + .data_type =3D QMI_UNSIGNED_1_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0, + .offset =3D offsetof(struct usb_interface_descriptor_v01, + bNumEndpoints), + }, + { + .data_type =3D QMI_UNSIGNED_1_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0, + .offset =3D offsetof(struct usb_interface_descriptor_v01, + bInterfaceClass), + }, + { + .data_type =3D QMI_UNSIGNED_1_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0, + .offset =3D offsetof(struct usb_interface_descriptor_v01, + bInterfaceSubClass), + }, + { + .data_type =3D QMI_UNSIGNED_1_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0, + .offset =3D offsetof(struct usb_interface_descriptor_v01, + bInterfaceProtocol), + }, + { + .data_type =3D QMI_UNSIGNED_1_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0, + .offset =3D offsetof(struct usb_interface_descriptor_v01, + iInterface), + }, + { + .data_type =3D QMI_EOTI, + .array_type =3D NO_ARRAY, + .tlv_type =3D QMI_COMMON_TLV_TYPE, + }, +}; + +const struct qmi_elem_info qmi_uaudio_stream_req_msg_v01_ei[] =3D { + { + .data_type =3D QMI_UNSIGNED_1_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x01, + .offset =3D offsetof(struct qmi_uaudio_stream_req_msg_v01, + enable), + }, + { + .data_type =3D QMI_UNSIGNED_4_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u32), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x02, + .offset =3D offsetof(struct qmi_uaudio_stream_req_msg_v01, + usb_token), + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x10, + .offset =3D offsetof(struct qmi_uaudio_stream_req_msg_v01, + audio_format_valid), + }, + { + .data_type =3D QMI_UNSIGNED_4_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u32), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x10, + .offset =3D offsetof(struct qmi_uaudio_stream_req_msg_v01, + audio_format), + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x11, + .offset =3D offsetof(struct qmi_uaudio_stream_req_msg_v01, + number_of_ch_valid), + }, + { + .data_type =3D QMI_UNSIGNED_4_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u32), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x11, + .offset =3D offsetof(struct qmi_uaudio_stream_req_msg_v01, + number_of_ch), + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x12, + .offset =3D offsetof(struct qmi_uaudio_stream_req_msg_v01, + bit_rate_valid), + }, + { + .data_type =3D QMI_UNSIGNED_4_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u32), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x12, + .offset =3D offsetof(struct qmi_uaudio_stream_req_msg_v01, + bit_rate), + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x13, + .offset =3D offsetof(struct qmi_uaudio_stream_req_msg_v01, + xfer_buff_size_valid), + }, + { + .data_type =3D QMI_UNSIGNED_4_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u32), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x13, + .offset =3D offsetof(struct qmi_uaudio_stream_req_msg_v01, + xfer_buff_size), + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x14, + .offset =3D offsetof(struct qmi_uaudio_stream_req_msg_v01, + service_interval_valid), + }, + { + .data_type =3D QMI_UNSIGNED_4_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u32), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x14, + .offset =3D offsetof(struct qmi_uaudio_stream_req_msg_v01, + service_interval), + }, + { + .data_type =3D QMI_EOTI, + .array_type =3D NO_ARRAY, + .tlv_type =3D QMI_COMMON_TLV_TYPE, + }, +}; + +const struct qmi_elem_info qmi_uaudio_stream_resp_msg_v01_ei[] =3D { + { + .data_type =3D QMI_STRUCT, + .elem_len =3D 1, + .elem_size =3D sizeof(struct qmi_response_type_v01), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x02, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + resp), + .ei_array =3D qmi_response_type_v01_ei, + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x10, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + status_valid), + }, + { + .data_type =3D QMI_SIGNED_4_BYTE_ENUM, + .elem_len =3D 1, + .elem_size =3D sizeof(enum usb_qmi_audio_stream_status_enum_v01), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x10, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + status), + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x11, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + internal_status_valid), + }, + { + .data_type =3D QMI_UNSIGNED_4_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u32), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x11, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + internal_status), + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x12, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + slot_id_valid), + }, + { + .data_type =3D QMI_UNSIGNED_4_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u32), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x12, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + slot_id), + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x13, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + usb_token_valid), + }, + { + .data_type =3D QMI_UNSIGNED_4_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u32), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x13, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + usb_token), + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x14, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + std_as_opr_intf_desc_valid), + }, + { + .data_type =3D QMI_STRUCT, + .elem_len =3D 1, + .elem_size =3D sizeof(struct usb_interface_descriptor_v01), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x14, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + std_as_opr_intf_desc), + .ei_array =3D usb_interface_descriptor_v01_ei, + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x15, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + std_as_data_ep_desc_valid), + }, + { + .data_type =3D QMI_STRUCT, + .elem_len =3D 1, + .elem_size =3D sizeof(struct usb_endpoint_descriptor_v01), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x15, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + std_as_data_ep_desc), + .ei_array =3D usb_endpoint_descriptor_v01_ei, + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x16, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + std_as_sync_ep_desc_valid), + }, + { + .data_type =3D QMI_STRUCT, + .elem_len =3D 1, + .elem_size =3D sizeof(struct usb_endpoint_descriptor_v01), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x16, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + std_as_sync_ep_desc), + .ei_array =3D usb_endpoint_descriptor_v01_ei, + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x17, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + usb_audio_spec_revision_valid), + }, + { + .data_type =3D QMI_UNSIGNED_2_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u16), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x17, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + usb_audio_spec_revision), + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x18, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + data_path_delay_valid), + }, + { + .data_type =3D QMI_UNSIGNED_1_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x18, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + data_path_delay), + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x19, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + usb_audio_subslot_size_valid), + }, + { + .data_type =3D QMI_UNSIGNED_1_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x19, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + usb_audio_subslot_size), + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x1A, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + xhci_mem_info_valid), + }, + { + .data_type =3D QMI_STRUCT, + .elem_len =3D 1, + .elem_size =3D sizeof(struct apps_mem_info_v01), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x1A, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + xhci_mem_info), + .ei_array =3D apps_mem_info_v01_ei, + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x1B, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + interrupter_num_valid), + }, + { + .data_type =3D QMI_UNSIGNED_1_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x1B, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + interrupter_num), + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x1C, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + speed_info_valid), + }, + { + .data_type =3D QMI_SIGNED_4_BYTE_ENUM, + .elem_len =3D 1, + .elem_size =3D sizeof(enum usb_qmi_audio_device_speed_enum_v01), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x1C, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + speed_info), + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x1D, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + controller_num_valid), + }, + { + .data_type =3D QMI_UNSIGNED_1_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x1D, + .offset =3D offsetof(struct qmi_uaudio_stream_resp_msg_v01, + controller_num), + }, + { + .data_type =3D QMI_EOTI, + .array_type =3D NO_ARRAY, + .tlv_type =3D QMI_COMMON_TLV_TYPE, + }, +}; + +const struct qmi_elem_info qmi_uaudio_stream_ind_msg_v01_ei[] =3D { + { + .data_type =3D QMI_SIGNED_4_BYTE_ENUM, + .elem_len =3D 1, + .elem_size =3D sizeof( + enum usb_qmi_audio_device_indication_enum_v01), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x01, + .offset =3D offsetof(struct qmi_uaudio_stream_ind_msg_v01, + dev_event), + }, + { + .data_type =3D QMI_UNSIGNED_4_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u32), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x02, + .offset =3D offsetof(struct qmi_uaudio_stream_ind_msg_v01, + slot_id), + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x10, + .offset =3D offsetof(struct qmi_uaudio_stream_ind_msg_v01, + usb_token_valid), + }, + { + .data_type =3D QMI_UNSIGNED_4_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u32), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x10, + .offset =3D offsetof(struct qmi_uaudio_stream_ind_msg_v01, + usb_token), + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x11, + .offset =3D offsetof(struct qmi_uaudio_stream_ind_msg_v01, + std_as_opr_intf_desc_valid), + }, + { + .data_type =3D QMI_STRUCT, + .elem_len =3D 1, + .elem_size =3D sizeof(struct usb_interface_descriptor_v01), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x11, + .offset =3D offsetof(struct qmi_uaudio_stream_ind_msg_v01, + std_as_opr_intf_desc), + .ei_array =3D usb_interface_descriptor_v01_ei, + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x12, + .offset =3D offsetof(struct qmi_uaudio_stream_ind_msg_v01, + std_as_data_ep_desc_valid), + }, + { + .data_type =3D QMI_STRUCT, + .elem_len =3D 1, + .elem_size =3D sizeof(struct usb_endpoint_descriptor_v01), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x12, + .offset =3D offsetof(struct qmi_uaudio_stream_ind_msg_v01, + std_as_data_ep_desc), + .ei_array =3D usb_endpoint_descriptor_v01_ei, + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x13, + .offset =3D offsetof(struct qmi_uaudio_stream_ind_msg_v01, + std_as_sync_ep_desc_valid), + }, + { + .data_type =3D QMI_STRUCT, + .elem_len =3D 1, + .elem_size =3D sizeof(struct usb_endpoint_descriptor_v01), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x13, + .offset =3D offsetof(struct qmi_uaudio_stream_ind_msg_v01, + std_as_sync_ep_desc), + .ei_array =3D usb_endpoint_descriptor_v01_ei, + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x14, + .offset =3D offsetof(struct qmi_uaudio_stream_ind_msg_v01, + usb_audio_spec_revision_valid), + }, + { + .data_type =3D QMI_UNSIGNED_2_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u16), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x14, + .offset =3D offsetof(struct qmi_uaudio_stream_ind_msg_v01, + usb_audio_spec_revision), + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x15, + .offset =3D offsetof(struct qmi_uaudio_stream_ind_msg_v01, + data_path_delay_valid), + }, + { + .data_type =3D QMI_UNSIGNED_1_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x15, + .offset =3D offsetof(struct qmi_uaudio_stream_ind_msg_v01, + data_path_delay), + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x16, + .offset =3D offsetof(struct qmi_uaudio_stream_ind_msg_v01, + usb_audio_subslot_size_valid), + }, + { + .data_type =3D QMI_UNSIGNED_1_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x16, + .offset =3D offsetof(struct qmi_uaudio_stream_ind_msg_v01, + usb_audio_subslot_size), + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x17, + .offset =3D offsetof(struct qmi_uaudio_stream_ind_msg_v01, + xhci_mem_info_valid), + }, + { + .data_type =3D QMI_STRUCT, + .elem_len =3D 1, + .elem_size =3D sizeof(struct apps_mem_info_v01), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x17, + .offset =3D offsetof(struct qmi_uaudio_stream_ind_msg_v01, + xhci_mem_info), + .ei_array =3D apps_mem_info_v01_ei, + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x18, + .offset =3D offsetof(struct qmi_uaudio_stream_ind_msg_v01, + interrupter_num_valid), + }, + { + .data_type =3D QMI_UNSIGNED_1_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x18, + .offset =3D offsetof(struct qmi_uaudio_stream_ind_msg_v01, + interrupter_num), + }, + { + .data_type =3D QMI_OPT_FLAG, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x19, + .offset =3D offsetof(struct qmi_uaudio_stream_ind_msg_v01, + controller_num_valid), + }, + { + .data_type =3D QMI_UNSIGNED_1_BYTE, + .elem_len =3D 1, + .elem_size =3D sizeof(u8), + .array_type =3D NO_ARRAY, + .tlv_type =3D 0x19, + .offset =3D offsetof(struct qmi_uaudio_stream_ind_msg_v01, + controller_num), + }, + { + .data_type =3D QMI_EOTI, + .array_type =3D NO_ARRAY, + .tlv_type =3D QMI_COMMON_TLV_TYPE, + }, +}; diff --git a/sound/usb/qcom/usb_audio_qmi_v01.h b/sound/usb/qcom/usb_audio_= qmi_v01.h new file mode 100644 index 000000000000..b549b025fe67 --- /dev/null +++ b/sound/usb/qcom/usb_audio_qmi_v01.h @@ -0,0 +1,164 @@ +/* SPDX-License-Identifier: GPL-2.0 + * + * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights res= erved. + */ + +#ifndef USB_QMI_V01_H +#define USB_QMI_V01_H + +#define UAUDIO_STREAM_SERVICE_ID_V01 0x41D +#define UAUDIO_STREAM_SERVICE_VERS_V01 0x01 + +#define QMI_UAUDIO_STREAM_RESP_V01 0x0001 +#define QMI_UAUDIO_STREAM_REQ_V01 0x0001 +#define QMI_UAUDIO_STREAM_IND_V01 0x0001 + +struct mem_info_v01 { + u64 va; + u64 pa; + u32 size; +}; + +struct apps_mem_info_v01 { + struct mem_info_v01 evt_ring; + struct mem_info_v01 tr_data; + struct mem_info_v01 tr_sync; + struct mem_info_v01 xfer_buff; + struct mem_info_v01 dcba; +}; + +struct usb_endpoint_descriptor_v01 { + u8 bLength; + u8 bDescriptorType; + u8 bEndpointAddress; + u8 bmAttributes; + u16 wMaxPacketSize; + u8 bInterval; + u8 bRefresh; + u8 bSynchAddress; +}; + +struct usb_interface_descriptor_v01 { + u8 bLength; + u8 bDescriptorType; + u8 bInterfaceNumber; + u8 bAlternateSetting; + u8 bNumEndpoints; + u8 bInterfaceClass; + u8 bInterfaceSubClass; + u8 bInterfaceProtocol; + u8 iInterface; +}; + +enum usb_qmi_audio_stream_status_enum_v01 { + USB_QMI_STREAM_STATUS_ENUM_MIN_VAL_V01 =3D INT_MIN, + USB_QMI_STREAM_REQ_SUCCESS_V01 =3D 0, + USB_QMI_STREAM_REQ_FAILURE_V01 =3D 1, + USB_QMI_STREAM_REQ_FAILURE_NOT_FOUND_V01 =3D 2, + USB_QMI_STREAM_REQ_FAILURE_INVALID_PARAM_V01 =3D 3, + USB_QMI_STREAM_REQ_FAILURE_MEMALLOC_V01 =3D 4, + USB_QMI_STREAM_STATUS_ENUM_MAX_VAL_V01 =3D INT_MAX, +}; + +enum usb_qmi_audio_device_indication_enum_v01 { + USB_QMI_DEVICE_INDICATION_ENUM_MIN_VAL_V01 =3D INT_MIN, + USB_QMI_DEV_CONNECT_V01 =3D 0, + USB_QMI_DEV_DISCONNECT_V01 =3D 1, + USB_QMI_DEV_SUSPEND_V01 =3D 2, + USB_QMI_DEV_RESUME_V01 =3D 3, + USB_QMI_DEVICE_INDICATION_ENUM_MAX_VAL_V01 =3D INT_MAX, +}; + +enum usb_qmi_audio_device_speed_enum_v01 { + USB_QMI_DEVICE_SPEED_ENUM_MIN_VAL_V01 =3D INT_MIN, + USB_QMI_DEVICE_SPEED_INVALID_V01 =3D 0, + USB_QMI_DEVICE_SPEED_LOW_V01 =3D 1, + USB_QMI_DEVICE_SPEED_FULL_V01 =3D 2, + USB_QMI_DEVICE_SPEED_HIGH_V01 =3D 3, + USB_QMI_DEVICE_SPEED_SUPER_V01 =3D 4, + USB_QMI_DEVICE_SPEED_SUPER_PLUS_V01 =3D 5, + USB_QMI_DEVICE_SPEED_ENUM_MAX_VAL_V01 =3D INT_MAX, +}; + +struct qmi_uaudio_stream_req_msg_v01 { + u8 enable; + u32 usb_token; + u8 audio_format_valid; + u32 audio_format; + u8 number_of_ch_valid; + u32 number_of_ch; + u8 bit_rate_valid; + u32 bit_rate; + u8 xfer_buff_size_valid; + u32 xfer_buff_size; + u8 service_interval_valid; + u32 service_interval; +}; + +#define QMI_UAUDIO_STREAM_REQ_MSG_V01_MAX_MSG_LEN 46 +extern const struct qmi_elem_info qmi_uaudio_stream_req_msg_v01_ei[]; + +struct qmi_uaudio_stream_resp_msg_v01 { + struct qmi_response_type_v01 resp; + u8 status_valid; + enum usb_qmi_audio_stream_status_enum_v01 status; + u8 internal_status_valid; + u32 internal_status; + u8 slot_id_valid; + u32 slot_id; + u8 usb_token_valid; + u32 usb_token; + u8 std_as_opr_intf_desc_valid; + struct usb_interface_descriptor_v01 std_as_opr_intf_desc; + u8 std_as_data_ep_desc_valid; + struct usb_endpoint_descriptor_v01 std_as_data_ep_desc; + u8 std_as_sync_ep_desc_valid; + struct usb_endpoint_descriptor_v01 std_as_sync_ep_desc; + u8 usb_audio_spec_revision_valid; + u16 usb_audio_spec_revision; + u8 data_path_delay_valid; + u8 data_path_delay; + u8 usb_audio_subslot_size_valid; + u8 usb_audio_subslot_size; + u8 xhci_mem_info_valid; + struct apps_mem_info_v01 xhci_mem_info; + u8 interrupter_num_valid; + u8 interrupter_num; + u8 speed_info_valid; + enum usb_qmi_audio_device_speed_enum_v01 speed_info; + u8 controller_num_valid; + u8 controller_num; +}; + +#define QMI_UAUDIO_STREAM_RESP_MSG_V01_MAX_MSG_LEN 202 +extern const struct qmi_elem_info qmi_uaudio_stream_resp_msg_v01_ei[]; + +struct qmi_uaudio_stream_ind_msg_v01 { + enum usb_qmi_audio_device_indication_enum_v01 dev_event; + u32 slot_id; + u8 usb_token_valid; + u32 usb_token; + u8 std_as_opr_intf_desc_valid; + struct usb_interface_descriptor_v01 std_as_opr_intf_desc; + u8 std_as_data_ep_desc_valid; + struct usb_endpoint_descriptor_v01 std_as_data_ep_desc; + u8 std_as_sync_ep_desc_valid; + struct usb_endpoint_descriptor_v01 std_as_sync_ep_desc; + u8 usb_audio_spec_revision_valid; + u16 usb_audio_spec_revision; + u8 data_path_delay_valid; + u8 data_path_delay; + u8 usb_audio_subslot_size_valid; + u8 usb_audio_subslot_size; + u8 xhci_mem_info_valid; + struct apps_mem_info_v01 xhci_mem_info; + u8 interrupter_num_valid; + u8 interrupter_num; + u8 controller_num_valid; + u8 controller_num; +}; + +#define QMI_UAUDIO_STREAM_IND_MSG_V01_MAX_MSG_LEN 181 +extern const struct qmi_elem_info qmi_uaudio_stream_ind_msg_v01_ei[]; + +#endif