From patchwork Tue Apr 23 14:09:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wulff X-Patchwork-Id: 13640150 Received: from mx0b-0068d901.pphosted.com (mx0b-0068d901.pphosted.com [205.220.180.35]) (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 BC62613AA36; Tue, 23 Apr 2024 14:09:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.180.35 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713881367; cv=fail; b=Mw+ZUmmrdFYbDAGEMutuGt49P3Wlcgvhtm//BwfdOGgprtPdJ2inZFMKfQlA1cND4w7/yO6M14+8O74B9OSKBJ9EBm2dc5T2eSQZixSeqJAP/2YLwT+RZLhv9Tao+A96tc91cSVLqR8Mc64q2PWXb1Ve4WUwZQi4H6+ELBlHoCk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713881367; c=relaxed/simple; bh=lT08faEU1pVJb/OL0xptd2pAyNkNwPK4UGbhPvzyq7E=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=nc9s4OV9RKLRLg2rvgYsHiwa7PwTUsN/ILhY37TMb+MU4abAqEqbNr1aMD+8Opou/+KFuk1m5RAXlr4l/Zn9qJFkxM4fB85P1BEnIKv0+PgW5h0sHJYSjKPa78NyC0DygjPszJLiGZK2y1/2Yr10IdVXFmouJuTKXh+Fpv+qB1c= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=biamp.com; spf=pass smtp.mailfrom=biamp.com; dkim=pass (2048-bit key) header.d=biamp.com header.i=@biamp.com header.b=UehHM7sW; dkim=pass (2048-bit key) header.d=biamp.com header.i=@biamp.com header.b=KpxAGmau; arc=fail smtp.client-ip=205.220.180.35 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=biamp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=biamp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=biamp.com header.i=@biamp.com header.b="UehHM7sW"; dkim=pass (2048-bit key) header.d=biamp.com header.i=@biamp.com header.b="KpxAGmau" Received: from pps.filterd (m0278265.ppops.net [127.0.0.1]) by mx0b-0068d901.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 43NAP1Tl018143; Tue, 23 Apr 2024 07:09:08 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=biamp.com; h= from:to:cc:subject:date:message-id:content-type :content-transfer-encoding:mime-version; s=proofpoint; bh=NQrGSb MA9RUPuqGbUVb8CT1KVSZDtPX3Hbw+ju4fmig=; b=UehHM7sWt6s62+hLRmSIAG fczROXftzluqIcsikZhRsLdaFcaSIUxrpgma/unoiDYqRq5Kl0DR6Wi8xUii8Ce8 BQbyjI49PyJYN5WABfgr1++VoTzuqlq6FbT02Xu4IZmecjzlHVNmzHRwjuAe3oyS zTpYG8OugXIcJ7vyqpMJPeSqHzyvbygkHk0nxplPXR4zpDmwfavOJeqCBfdQRjfz qXfAjbWcynIcW16uZNTwU00hRM/TPgCOUopkBHVqJWwrI6K3T7Ge4vzyc4sUQBYB Z6oXEt6Gb/z8IME8SciTs9itJwN3UtLPpfh5OxHmAly3Bv0sRCImeIUvRsFF85Xg == Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2169.outbound.protection.outlook.com [104.47.57.169]) by mx0b-0068d901.pphosted.com (PPS) with ESMTPS id 3xmadvj0ve-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 Apr 2024 07:09:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m6adfJ/m8LkXi3ElsWkDsXwz3PL+oPL0c2AcFje1o6gHUiCwdQmFfJoV2ZHFrPzvCBk20swRdIMbYGepyk64DbAd6u3YKE/XeQ7J8TqrQ1bgnB8tzlqQ+Y1s4O3Iy82hgtQ/8hp+ZIcFujZYfrntldbPuAgzYo5ygWSC6YhGiP1EkfPBLcG24WLpE0R0ZM0eMqkudOd65n5hLlbxuZlEimMOGlC48ifh6y0cqQZp13deY8xU/wuWnx9DLG/+VnGLL+5RYiKDi73y9oUGs/D9s0tGRmWoLH2QnwBgklbmGJ49+vUyKm7EZiXvKlAtjWapFdpNz0aL9Tjn4IM1C2xBpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NQrGSbMA9RUPuqGbUVb8CT1KVSZDtPX3Hbw+ju4fmig=; b=ISd8VwZ5VYpFx784ll7sAwOssY01JPecIPzZoJ1bJ0wUR7KYI3Yw2ji89JJoV+P1W10twFraRqT/q+rBty7gF9sZ68iJ5q57R5AHui4JpyavPOxgYnI5kEVdAFL4Eprp1jBIAr63p0S/jl0phlkglZP4RxTMWJRlA+RS94yHxVM5fGpPT1sJWLrx+sEvzYWTzwQpaUQVRXelfPV/n8ctPrEeB1mmcIQ96Fa5Hfc5UAPtMcsbu7k8qUnfLJXvpuL/QrHcqrtWvRWV11q+usG5iy+g17WnQHXcfVGcpEuhWDrwxGUFguOXPO04pwlvlESKvQtdp21O/DaVmNC5pybbog== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=biamp.com; dmarc=pass action=none header.from=biamp.com; dkim=pass header.d=biamp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=biamp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NQrGSbMA9RUPuqGbUVb8CT1KVSZDtPX3Hbw+ju4fmig=; b=KpxAGmauWJyfoCYa2ZbR2PCClzn3rtPgotufL9j18zRlHQrQKmfmPQ0cQuMzUBG5uHvDYXyHq95/3kWjzBbLFRPvEt0rycsQGSkE8tYtDSNNl/ex9MqBpWmlx+utCZ2k79+4wl1tqwNJ18OO/JoqvKQ074cB2tI4mrYXNBsGvKHQQQbE6a/ykxeCuRRk9bir2/38gNOvTxG3K1AystXm2+X25VQotFDxI/vkkQJIqlGSfXSN21pQ1bwV1OtCiZAx2kN6MjXe2/SG/Z8nBskw+rPUfVIzjDc8iqFtPuoUmiORv18J2kUxybOESTERszBaAgRUbnypo3aAufiqsWT1gg== Received: from CO1PR17MB5419.namprd17.prod.outlook.com (2603:10b6:303:ec::17) by CO6PR17MB4945.namprd17.prod.outlook.com (2603:10b6:5:35a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.44; Tue, 23 Apr 2024 14:09:04 +0000 Received: from CO1PR17MB5419.namprd17.prod.outlook.com ([fe80::f48:ee61:a81b:d555]) by CO1PR17MB5419.namprd17.prod.outlook.com ([fe80::f48:ee61:a81b:d555%4]) with mapi id 15.20.7472.044; Tue, 23 Apr 2024 14:09:04 +0000 From: Chris Wulff To: "linux-usb@vger.kernel.org" CC: Greg Kroah-Hartman , Perr Zhang , Lee Jones , "linux-kernel@vger.kernel.org" , "linux-api@vger.kernel.org" , Chris Wulff Subject: [PATCH v2] usb: gadget: f_uac1: Expose all string descriptors through configfs. Thread-Topic: [PATCH v2] usb: gadget: f_uac1: Expose all string descriptors through configfs. Thread-Index: AQHalYZyQqE3aI5pnkG1tqR3dQtakQ== Date: Tue, 23 Apr 2024 14:09:04 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CO1PR17MB5419:EE_|CO6PR17MB4945:EE_ x-ms-office365-filtering-correlation-id: 9d1d1696-c3a2-4586-1c56-08dc639eef0c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: =?iso-8859-1?q?GTsQmalXBs13moCB9+mCkEyS85?= =?iso-8859-1?q?+MutSFsjHMwgdR3nLKqrtc2BawwOGLTctJtnfRVeFHok6USgjo15p8XczYwS?= =?iso-8859-1?q?/GVuPrRlFk+fFfZVRqYO2MRwO1qpVVliOLK6juIcBDbY+4EqdU48P2dW44dr?= =?iso-8859-1?q?Kxfk1c2thEj3HKiBpCimsMeo8IPTSIsGnL0yMPDFekw1Mj4WUGF+tcOLk0JN?= =?iso-8859-1?q?4+wfkxr+LLHt2ZdmNsoip5HSxqJt/mdAntz97hjce97pC3KzhYnE7OgZsSqJ?= =?iso-8859-1?q?Iizk0HmNP/aND5WrejzVVs9m2rVliH3YXQ4WxUeSlwmdDWOm/tn/eiENnMw7?= =?iso-8859-1?q?I1mBVz0ZfK8xhS+J8l48C4G+9FVibgJbfB4wo2cfdNuC5VCMbMDELb17ihfW?= =?iso-8859-1?q?dBXo7YtzwF2VeI36c1QAPfWgvpQer53VmSH3TAWdh63jqOX0RntpJILrZ/sb?= =?iso-8859-1?q?x+l2tlqHAXvzVKHRlYo98DTrXow0wgaekLzk2CXLezmnN+m5vVbs3EccOj71?= =?iso-8859-1?q?tuF5ZdTZWEJydwHD3So7jtONTxT/yv1qRtlmCafKDUNeSx2bBjx5QSqZ2JqM?= =?iso-8859-1?q?AavImk88tkcsKHfCVDvw3xFDmcej2vKP/9ubdKuSWE7sw+jVUOeikmXcu8pZ?= =?iso-8859-1?q?vaRtTWgQKUPrpgoXFozc71CUAuOPBzNgJEtwIl1l+1bJ7URBMM3LcRPTkKrI?= =?iso-8859-1?q?bRjukVOAEwVaQU7OPtmAUwSe5Lk8LOUolFymcs4g7QnJvqvL3oZmFMYe/Fdm?= =?iso-8859-1?q?yDXKXr3hznUu/tID/DERLMv+2KiAY+OloAtoCTnkZKRXgBCqlsai0tV6fepp?= =?iso-8859-1?q?DWWD9EDLK1ALkEQ8Zq1qXTCZC9V/e+mZFQuqsxCM+IOf2AJVTT815Nm6oSMy?= =?iso-8859-1?q?OqmCtstRsll0a4PT744MEPHoNHmACHNv3onitzdMxYw+IQzi/Tw9xMafx0bZ?= =?iso-8859-1?q?8yz2H3h+Qno/QkpQQjVWWtBIaWWHbKlVKOhw58sBOQIyrTPhpzll6KkP+42s?= =?iso-8859-1?q?72uaGsr7+m9acFNs6j/cslG5yqx/OPSV18lBIlB3WaBElBURV09lqJMlbR66?= =?iso-8859-1?q?zjMACmL06Mwwlje+naD0WgQqfknMqjkLbrC+E+DJ3uxwhE312rBmQzlSCr4Y?= =?iso-8859-1?q?zwiWjIQhK9NiS17CEmgjJYJlxkKIBn8dl6uttwD/9Sxy9I+ChifyN5zV8nyb?= =?iso-8859-1?q?l/UcG7NFbxhak0qYt6zpk0/V+AwX5HJp1XOtbHCxi5Ck3NvCRcXLS9ep4fxw?= =?iso-8859-1?q?ytbfEG0HUg1Zlk4j20Y4f72XSGdLBEuolcHTghRkfxOe9Ou/kB02f9ppzcUF?= =?iso-8859-1?q?XEu40RyMgcHJY1oZNejxOucRDBjszZv3jEuWyUmd8sZ+kUf/IUUEu6PQXVQB?= =?iso-8859-1?q?37QKpcTyI8fmoKo/k3sA=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO1PR17MB5419.namprd17.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(376005)(1800799015)(38070700009);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?h2aRjOXWXfHSOfKG4AA0If0?= =?iso-8859-1?q?S4vasg2iJj8lujkseXLBootcgzhIupsxJ4l545e8ZU7Wk9moa5GwM7716XQq?= =?iso-8859-1?q?+SLiRP7sZZ++twSg6ywBPO3ybUiaZrXjV3CJYfiDT6BvpRoIdESEp1IjOgoI?= =?iso-8859-1?q?qk6w+/4mRIj4eA2Lme1uuMQ7Xjj3i0mFM1wh24JJedYu1/WmrpaoP7FxicmC?= =?iso-8859-1?q?ZcgXo7Eptwm62R6n+uYHV7VXaKoVEsgtb9BTB8KNfXc+jW10E3ybiBpKOafa?= =?iso-8859-1?q?JfovTAqImyaQwVcFq4qn5BNC35ZjWk1isUYUkUB9zgGUmJ6wKDtBUfoWwO3P?= =?iso-8859-1?q?f3PKga8b+0lTp+M1hIwfxjzWIFxMY/+/n2vn/bQ7Y0DIFRBLtBntYrAzOMH+?= =?iso-8859-1?q?9z6G8yxT7PXQVKeeDPKGJyYc4dvADcE9oiP629/rDRiKkT5pXmVJG9/Bsdhi?= =?iso-8859-1?q?wUs8oa1cXvXiU7LReug4RMlxoTb8qhCy6S3/uorfahPkLNz1b7hjT14nCKZF?= =?iso-8859-1?q?66qiBIDJcOOn1v+0IqN2HZYUzH7yNzEu38aZuMhK38PUMZ7gItfiabEiFV3F?= =?iso-8859-1?q?dNOoQ5NFjkavPw5fbBEpEghogmRdORl0BPQDCNyKFTQDJ11sV9qH6tYnF5P0?= =?iso-8859-1?q?wMsBJN8Ji1ODO/eQINNoLRaxTWPqUKBcMn27h5NXMxwLTSeR9aLZceuLfZz4?= =?iso-8859-1?q?Uq9142e4z6yHPveIu4KyXP8vEuOiQDZ9/0hu83h19eS4ObigA/6Whl0rXvix?= =?iso-8859-1?q?q1PO+WzQgI00zTzE6si8DloF7quX+6q8PUWZJNOA8jj6Q5Ea3+F+37thDEMH?= =?iso-8859-1?q?bUBGpUUcHVtejayThRMSWjwUSi6BipUd1HtHMtXvpBlwKq4ScDCnhfMnaEj8?= =?iso-8859-1?q?XQ6+N5CncGkvArF5v8aSGdMkAiwCxJKfYiyYNaVIxpdxEYmIDeBfGrEt7FLS?= =?iso-8859-1?q?WHTKtvFyjigb+8ECagEQd+NOzr+QSTBMly2mmmZEPY0twaHkcZL1bmx478ja?= =?iso-8859-1?q?vOoLy5ShWLfw+YGcuxMNybasOZk4PkQ0Q0cb2VXsOmWQmXXwKfkdsZmR9Zno?= =?iso-8859-1?q?oToCtYCOxv9Vqs84qwd5FPP+ehwK8ud4OWmTCwbe41X6l1ss3v+c+h45SV3F?= =?iso-8859-1?q?Yxd4L5hzo9DX4w37FbF4CybNa016h/maKYvZ3njXgX3qow+Jy5q6by6XUNqr?= =?iso-8859-1?q?k/kkzFRhm30PflqRdBi7mQ+5lgXvEBP0iXBmTFac/5KjPLfiaDuNNzjDzNO8?= =?iso-8859-1?q?MDuMB1TsGTvguWkvAP7P/GCEYnfUMwPmymSG+KV4C0RK6SlZBrj1g/Ppn5kF?= =?iso-8859-1?q?1Xa4TONZG18HgpMn8EbuKY3DcbuIaFxryT4g3bC8DCfC9mWbD4TnXw77PKYY?= =?iso-8859-1?q?mLJUy0GqygsbzwpWiCEb0X1lIsYQvdy7E3EgqisvNO6YakLb+X7oUq3/pNsp?= =?iso-8859-1?q?04wQ1IFl/ubM/46s17cjhIB7dnW7Z15mXo9LPTI7IfwMQC+96isYTttOAo7D?= =?iso-8859-1?q?RXcYDAK61oksvFzMxV1C6wxVodDx2oxspg1RMLctIb+HA0J4v5ATSIqH6w7w?= =?iso-8859-1?q?qkoCb8TgBuYYOsrxFZb+IzyfU1Uee5O064abCKgzWV3AOcnflpYSv+Q0I18x?= =?iso-8859-1?q?DNtx3mnUiXPm/WCcS?= Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-OriginatorOrg: biamp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO1PR17MB5419.namprd17.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9d1d1696-c3a2-4586-1c56-08dc639eef0c X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Apr 2024 14:09:04.5927 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 341ac572-066c-46f6-bf06-b2d0c7ddf1be X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 4JGpO/AKVvD1nRV+WvbyaK26y2J1srjUZ8fOlmzvcpWbNzCwUweSCFikblMDb3Zh3l+8Ma5PPbRQzOUfPTo9mw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR17MB4945 X-Proofpoint-GUID: cAl9Qxof-MytdD6K0dddTJA2by58X8Oa X-Proofpoint-ORIG-GUID: cAl9Qxof-MytdD6K0dddTJA2by58X8Oa This makes all string descriptors configurable for the UAC1 gadget so the user can configure names of terminals/controls/alt modes. Signed-off-by: Chris Wulff --- v2: Improved naming of parameters to be mode user friendly. Added documentation. v1: https://lore.kernel.org/linux-usb/CO1PR17MB54198F836C3ED1B4FA5F14A9E10D2@CO1PR17MB5419.namprd17.prod.outlook.com/ .../ABI/testing/configfs-usb-gadget-uac1 | 12 +++ Documentation/usb/gadget-testing.rst | 12 +++ drivers/usb/gadget/function/f_uac1.c | 75 +++++++++++++++---- drivers/usb/gadget/function/u_uac1.h | 16 +++- 4 files changed, 98 insertions(+), 17 deletions(-) diff --git a/Documentation/ABI/testing/configfs-usb-gadget-uac1 b/Documentation/ABI/testing/configfs-usb-gadget-uac1 index c4ba92f004c3..cf93b98b274d 100644 --- a/Documentation/ABI/testing/configfs-usb-gadget-uac1 +++ b/Documentation/ABI/testing/configfs-usb-gadget-uac1 @@ -30,4 +30,16 @@ Description: req_number the number of pre-allocated requests for both capture and playback function_name name of the interface + p_it_name playback input terminal name + p_it_ch_name playback channels name + p_ot_name playback output terminal name + p_fu_name playback functional unit name + p_alt0_name playback alt mode 0 name + p_alt1_name playback alt mode 1 name + c_it_name capture input terminal name + c_it_ch_name capture channels name + c_ot_name capture output terminal name + c_fu_name capture functional unit name + c_alt0_name capture alt mode 0 name + c_alt1_name capture alt mode 1 name ===================== ======================================= diff --git a/Documentation/usb/gadget-testing.rst b/Documentation/usb/gadget-testing.rst index b086c7ab72f0..a89b49e639c3 100644 --- a/Documentation/usb/gadget-testing.rst +++ b/Documentation/usb/gadget-testing.rst @@ -957,6 +957,18 @@ The uac1 function provides these attributes in its function directory: req_number the number of pre-allocated requests for both capture and playback function_name name of the interface + p_it_name playback input terminal name + p_it_ch_name playback channels name + p_ot_name playback output terminal name + p_fu_name playback functional unit name + p_alt0_name playback alt mode 0 name + p_alt1_name playback alt mode 1 name + c_it_name capture input terminal name + c_it_ch_name capture channels name + c_ot_name capture output terminal name + c_fu_name capture functional unit name + c_alt0_name capture alt mode 0 name + c_alt1_name capture alt mode 1 name ================ ==================================================== The attributes have sane default values. diff --git a/drivers/usb/gadget/function/f_uac1.c b/drivers/usb/gadget/function/f_uac1.c index 7de74a3dd392..f7dd6a2466b0 100644 --- a/drivers/usb/gadget/function/f_uac1.c +++ b/drivers/usb/gadget/function/f_uac1.c @@ -377,24 +377,10 @@ enum { STR_AS_OUT_IF_ALT1, STR_AS_IN_IF_ALT0, STR_AS_IN_IF_ALT1, + NUM_STR_DESCRIPTORS, }; -static struct usb_string strings_uac1[] = { - /* [STR_AC_IF].s = DYNAMIC, */ - [STR_USB_OUT_IT].s = "Playback Input terminal", - [STR_USB_OUT_IT_CH_NAMES].s = "Playback Channels", - [STR_IO_OUT_OT].s = "Playback Output terminal", - [STR_IO_IN_IT].s = "Capture Input terminal", - [STR_IO_IN_IT_CH_NAMES].s = "Capture Channels", - [STR_USB_IN_OT].s = "Capture Output terminal", - [STR_FU_IN].s = "Capture Volume", - [STR_FU_OUT].s = "Playback Volume", - [STR_AS_OUT_IF_ALT0].s = "Playback Inactive", - [STR_AS_OUT_IF_ALT1].s = "Playback Active", - [STR_AS_IN_IF_ALT0].s = "Capture Inactive", - [STR_AS_IN_IF_ALT1].s = "Capture Active", - { }, -}; +static struct usb_string strings_uac1[NUM_STR_DESCRIPTORS + 1] = {}; static struct usb_gadget_strings str_uac1 = { .language = 0x0409, /* en-us */ @@ -1265,6 +1251,20 @@ static int f_audio_bind(struct usb_configuration *c, struct usb_function *f) strings_uac1[STR_AC_IF].s = audio_opts->function_name; + strings_uac1[STR_USB_OUT_IT].s = audio_opts->p_it_name; + strings_uac1[STR_USB_OUT_IT_CH_NAMES].s = audio_opts->p_it_ch_name; + strings_uac1[STR_IO_OUT_OT].s = audio_opts->p_ot_name; + strings_uac1[STR_FU_OUT].s = audio_opts->p_fu_name; + strings_uac1[STR_AS_OUT_IF_ALT0].s = audio_opts->p_alt0_name; + strings_uac1[STR_AS_OUT_IF_ALT1].s = audio_opts->p_alt1_name; + + strings_uac1[STR_IO_IN_IT].s = audio_opts->c_it_name; + strings_uac1[STR_IO_IN_IT_CH_NAMES].s = audio_opts->c_it_ch_name; + strings_uac1[STR_USB_IN_OT].s = audio_opts->c_ot_name; + strings_uac1[STR_FU_IN].s = audio_opts->c_fu_name; + strings_uac1[STR_AS_IN_IF_ALT0].s = audio_opts->c_alt0_name; + strings_uac1[STR_AS_IN_IF_ALT1].s = audio_opts->c_alt1_name; + us = usb_gstrings_attach(cdev, uac1_strings, ARRAY_SIZE(strings_uac1)); if (IS_ERR(us)) return PTR_ERR(us); @@ -1681,8 +1681,23 @@ UAC1_ATTRIBUTE(bool, c_volume_present); UAC1_ATTRIBUTE(s16, c_volume_min); UAC1_ATTRIBUTE(s16, c_volume_max); UAC1_ATTRIBUTE(s16, c_volume_res); + UAC1_ATTRIBUTE_STRING(function_name); +UAC1_ATTRIBUTE_STRING(p_it_name); +UAC1_ATTRIBUTE_STRING(p_it_ch_name); +UAC1_ATTRIBUTE_STRING(p_ot_name); +UAC1_ATTRIBUTE_STRING(p_fu_name); +UAC1_ATTRIBUTE_STRING(p_alt0_name); +UAC1_ATTRIBUTE_STRING(p_alt1_name); + +UAC1_ATTRIBUTE_STRING(c_it_name); +UAC1_ATTRIBUTE_STRING(c_it_ch_name); +UAC1_ATTRIBUTE_STRING(c_ot_name); +UAC1_ATTRIBUTE_STRING(c_fu_name); +UAC1_ATTRIBUTE_STRING(c_alt0_name); +UAC1_ATTRIBUTE_STRING(c_alt1_name); + static struct configfs_attribute *f_uac1_attrs[] = { &f_uac1_opts_attr_c_chmask, &f_uac1_opts_attr_c_srate, @@ -1706,6 +1721,20 @@ static struct configfs_attribute *f_uac1_attrs[] = { &f_uac1_opts_attr_function_name, + &f_uac1_opts_attr_p_it_name, + &f_uac1_opts_attr_p_it_ch_name, + &f_uac1_opts_attr_p_ot_name, + &f_uac1_opts_attr_p_fu_name, + &f_uac1_opts_attr_p_alt0_name, + &f_uac1_opts_attr_p_alt1_name, + + &f_uac1_opts_attr_c_it_name, + &f_uac1_opts_attr_c_it_ch_name, + &f_uac1_opts_attr_c_ot_name, + &f_uac1_opts_attr_c_fu_name, + &f_uac1_opts_attr_c_alt0_name, + &f_uac1_opts_attr_c_alt1_name, + NULL, }; @@ -1760,6 +1789,20 @@ static struct usb_function_instance *f_audio_alloc_inst(void) scnprintf(opts->function_name, sizeof(opts->function_name), "AC Interface"); + scnprintf(opts->p_it_name, sizeof(opts->p_it_name), "Playback Input terminal"); + scnprintf(opts->p_it_ch_name, sizeof(opts->p_it_ch_name), "Playback Channels"); + scnprintf(opts->p_ot_name, sizeof(opts->p_ot_name), "Playback Output terminal"); + scnprintf(opts->p_fu_name, sizeof(opts->p_fu_name), "Playback Volume"); + scnprintf(opts->p_alt0_name, sizeof(opts->p_alt0_name), "Playback Inactive"); + scnprintf(opts->p_alt1_name, sizeof(opts->p_alt1_name), "Playback Active"); + + scnprintf(opts->c_it_name, sizeof(opts->c_it_name), "Capture Input terminal"); + scnprintf(opts->c_it_ch_name, sizeof(opts->c_it_ch_name), "Capture Channels"); + scnprintf(opts->c_ot_name, sizeof(opts->c_ot_name), "Capture Output terminal"); + scnprintf(opts->c_fu_name, sizeof(opts->c_fu_name), "Capture Volume"); + scnprintf(opts->c_alt0_name, sizeof(opts->c_alt0_name), "Capture Inactive"); + scnprintf(opts->c_alt1_name, sizeof(opts->c_alt1_name), "Capture Active"); + return &opts->func_inst; } diff --git a/drivers/usb/gadget/function/u_uac1.h b/drivers/usb/gadget/function/u_uac1.h index f7a616760e31..67784de9782b 100644 --- a/drivers/usb/gadget/function/u_uac1.h +++ b/drivers/usb/gadget/function/u_uac1.h @@ -52,7 +52,21 @@ struct f_uac1_opts { int req_number; unsigned bound:1; - char function_name[32]; + char function_name[USB_MAX_STRING_LEN]; + + char p_it_name[USB_MAX_STRING_LEN]; + char p_it_ch_name[USB_MAX_STRING_LEN]; + char p_ot_name[USB_MAX_STRING_LEN]; + char p_fu_name[USB_MAX_STRING_LEN]; + char p_alt0_name[USB_MAX_STRING_LEN]; + char p_alt1_name[USB_MAX_STRING_LEN]; + + char c_it_name[USB_MAX_STRING_LEN]; + char c_it_ch_name[USB_MAX_STRING_LEN]; + char c_ot_name[USB_MAX_STRING_LEN]; + char c_fu_name[USB_MAX_STRING_LEN]; + char c_alt0_name[USB_MAX_STRING_LEN]; + char c_alt1_name[USB_MAX_STRING_LEN]; struct mutex lock; int refcnt;