From patchwork Tue Apr 23 14:09:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wulff X-Patchwork-Id: 13640151 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 D26E513B286; Tue, 23 Apr 2024 14:09:27 +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=1713881370; cv=fail; b=AxbGSwx4Ch9Rv9rUb4OeXW75OK9uMidCnDEg9wKegvHnWrYNOCq3uR/BvN2gx6GsDHq7haD+Llx5+XINViusJs/OLPSgaIh9YEGLJAFBxJdmUjP7FsDki7u0dicnpkfbOXnFruxhQQkPgNpiVsHw9pM3v7C9N1sqnEJalss26wU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713881370; c=relaxed/simple; bh=JuIcPNGY3IvgTKmRNI0Se1MfHDRkx9DjI2G9vLjlLIU=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=qvnWdSiV0drBd7YQyB1YuqQX798HFZBJ0EYheWfgqitwPbqLvBsVPTz9A3admtecHJv+5sO6hZa1CUITRuktMf6hTeKsqnroamDoGRL+jtuHdAYYyqHB3Gf+efN5GY9Mdn555PXdGqDEtE4aTwsj6CPiWshs/0AIXSLUSwPH2M0= 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=N4BlnqDk; dkim=pass (2048-bit key) header.d=biamp.com header.i=@biamp.com header.b=UosnqRpV; 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="N4BlnqDk"; dkim=pass (2048-bit key) header.d=biamp.com header.i=@biamp.com header.b="UosnqRpV" 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 43NAP1Tm018143; Tue, 23 Apr 2024 07:09:09 -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=GcCShT tiynSN9CqavKOToS9NhpGDUVS7zrnrDe1ZuA0=; b=N4BlnqDkDpvGiHpwGsKQPJ 6W0GHv0L80oeHuraNS86eaqdKEv4h6WUuDbsUtBVSGNOYnKnMqPFLaLn4y4uLGxr ucCZLCSFxeS36aNNCkLW67eGzpcDjhihh9f58A3jlcEHN/dP8kiCVDffxcYVumNw D0/VoO/5O5rzMRdF4Jurqghjx8j0m4Yflsdcz8t/THIg92V88FXChoHcO4zpqhZk b7aNA6FBqY/OXDzIEcf3Y3aZRBarIVNgGkNOPhnDi3tPMjpq2EEXp7oV0A25XHsW hmxRKV8p6eALj5kB/Dq685Af3Y8zK0QBNihMvbMhyK1HSTnjBuWslio+844NDdAw == 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-2 (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=AZuaJX/0nIPOBCpZVXGI8nkG2GED4m1MdfXrLfxsP9tE0flK3GknZwIoT7aWcQVh0s6J2+5euD+rM6F1KJfTAq0sZeE5F1fmHaTGLfd87OTYPZXSQ4hN7qUVIqCPuffsPpQm0Ujy0xYhmxE5HMb9uA3ajDIKr+yAv/j5Bz67VO/XwkPIq7SQPxVWxXJ2/yNncnsPvC7+Msl/Q4lrctI+SD1zgygEGyF6mxk0HEKHqLnGJrSWDsqz1mJ//D4EqdOTtR0wX9V0oiB+YFpMN7j7yz/y3UMnJY6TXLKXikvTli4+xvrs83p+hir2r+hRfWU46G2RjNHGXpLQUM52R+FY7Q== 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=GcCShTtiynSN9CqavKOToS9NhpGDUVS7zrnrDe1ZuA0=; b=DL34iwBzFqq6jsZzknqXq7UB1hr0D+lnjzWq1qaHE2x9pETSEybsUiJ1zBCJDIuK4Q2toHhOZQq4W2v7rDJIs2TF23bAACDDAPLOjjNYX9Nh2WPHJX+WrqvwoEnrSOsa2A2sv1WibCy25uhhOjthpZS1iI/H1LBqvZjqJtnLSOKMomGHxr3mOYodGtyL8yxAk8Tu/Z3l6IJavMoS7MBLi7zoK7kVaN1FqoMHuX+jgu/+54Tu1/ZKBHgZtKX5HjPx6yTTDA042odAWyefk5HwdJcyqjHCWMGOO+wAtwa/8u3AAwiVSHa4Q3u2sS9GV7TujeenjEOSMwE/efrl7DNB1Q== 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=GcCShTtiynSN9CqavKOToS9NhpGDUVS7zrnrDe1ZuA0=; b=UosnqRpVofBgVyK/Bz846t2PLaP7d8ThwHozcjUQ84cXEGt8POjvCdECy5XcvoL3DK7uovr1mLDRI7DvZE9qhz4XcEPWWaMVQY5MEfmraVbEegzZjJSxFKF+XL55lPZW1/hWkfz6Dpfe5JVQ0pckFBc5h58u9nJeCnArnBYZphrS4z+DhPFAd6Yvv5rACnO7XMPgrpqktN/ORvLJNpxzXbzJMK8s0SOnyhr/8Y/wVOuHVDkvfIlqOwuaC9qrBTBhGJl8hkIEMkXXe0B1neJvG5kSHgZa/8KtNKua17EXrZtNOiIFJwvqj2Cs6czjto9osl1KU6TLDaVZ8dYjQQPk2Q== 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:07 +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:07 +0000 From: Chris Wulff To: "linux-usb@vger.kernel.org" CC: Greg Kroah-Hartman , James Gruber , Lee Jones , "linux-kernel@vger.kernel.org" , "linux-api@vger.kernel.org" , Chris Wulff Subject: [PATCH v2] usb: gadget: f_uac2: Expose all string descriptors through configfs. Thread-Topic: [PATCH v2] usb: gadget: f_uac2: Expose all string descriptors through configfs. Thread-Index: AQHalYdWgtu02BG/fUykcYHBF1kPmA== Date: Tue, 23 Apr 2024 14:09:07 +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: d3ab91fb-2273-4295-974e-08dc639ef09c 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?nYAce6earo2hy2ft9YZquuR8Mo?= =?iso-8859-1?q?7zwf5CV8YfF8cgmC157MxmRZCzhqcvKKJ92LwdeX8OKeWI7FLiErzFmVfsfk?= =?iso-8859-1?q?klUiO9yZnuSutvjfu84SkVBr0VrqPQZX63SCvFF+R0yf94pfCnG+euTeFB+H?= =?iso-8859-1?q?7yUQh1U4k3WTe8dCZORj6zTRt4vqMSR406D0txt9KHwMt+khF/CyILVsHahx?= =?iso-8859-1?q?21Do40LFeXyP64+qTKZYzlSi39yQZ1tZubmG51e2r4xAaEsrtLZsyTPB2BYU?= =?iso-8859-1?q?e2aGRoz/epRDrTTzjQyncbmN7ShgWEQ3HGQQ91bFaHNUS89wdMC7v7Kvoa7W?= =?iso-8859-1?q?4JkJbZoPlvV6XVhQa765LO7mVMNu9PGJ2fx49aTZryRN8TNxvo7iQlRy/DhM?= =?iso-8859-1?q?dO+xjN/IuTWh6hRjn0jhO5qwWxTlp5h0YsHth6fvECrau4JNzpRUdc41c+Mv?= =?iso-8859-1?q?LFTsMzkKx14iWUb+Nh+sVI4QcDBwmV9X8dfCcr0BNTnAp2DL90EttrsN8haT?= =?iso-8859-1?q?F84+01n6qcDtoO7u56dcC2RXVPjDwC+u7UvWwtJJk9AkKqKcqHt8XgdJ53+b?= =?iso-8859-1?q?cYdw7xeOn81eeN0ZqlEESOCqYYi6bXeHKeXfpd0zCfYCcTSjxU1KmOQr4LjZ?= =?iso-8859-1?q?UdDvBnWCz0y7xKrgSh/BN6e3G2/RvFml/fnuu+kOun2ZNwgHkw9vCHK+lCHt?= =?iso-8859-1?q?mFO4cQ/6M2fVhWji9IlPDel17dT5BHeVagXo+RxXGxOIl7Dg74qYJWXdTQuH?= =?iso-8859-1?q?okiDkLJlC8tD+lJEkm077r6zOawGEWYh8CfcfgPu45GAx0Z/Jw5TFej+v0hG?= =?iso-8859-1?q?ksauhobc4RWg4Z5+JQBP4/vkZj5jEcYEVr3hybQNPBryr5rfDovwL//8Ri7i?= =?iso-8859-1?q?lPCn2n6fYZfVk4ykObhKrK9R58XrJkJtCFR3ruKfLL5h7IOx8L2k/2E6IesJ?= =?iso-8859-1?q?0jJpyOiHb3v2xrc46Mu0w4anfMwmil/XtNAsWS1+Rl4il2lz9RCbx+l51LGF?= =?iso-8859-1?q?MiMtT0KbkVT30XSNn1wfAM1hmReG7NAU6u7CNDmxYH0GpYmh29IOzpdrDF2W?= =?iso-8859-1?q?/Rkfxbp5+ey0rHpfqxJz6QfRpKbRHa5MnsEbfSSviCd1ruCXof7+w4nUVYT/?= =?iso-8859-1?q?aZfA7QAAvIWXIxgQ3AX2T5ciw5Barthkay7rTwQGEp3wh31/tD+1OJXYG3Og?= =?iso-8859-1?q?53XSvhcuHYCN1ZPgUledfms4j+WizEC2KwuaEAuGTwnYCFi7GAGNsNtqt83L?= =?iso-8859-1?q?t8ZDcitV06LzU3JH+XnkAZM+Q30w/zeLZK3vb2/vyJgi8D1R3ZLK3zq9wG7j?= =?iso-8859-1?q?+E1xm6xJPyHu12X3sAUJ9GinZcr2aCOESwz7Pki4ObsKxIW8BTIL4QjZ9tRc?= =?iso-8859-1?q?kD8vegnSHGVfA4Y2m5jQ=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?2E9DXaM4GLnW4awmO1gv4eg?= =?iso-8859-1?q?QuYHEWf7XX08k6maYI8pap+pu0urq4+9AtZWoPf+wcPU8tKt3eIq/Zibano4?= =?iso-8859-1?q?Is/QPeiNYubScklta6Ui/50tdklJqWcbECSpDg33c2dJBw0To9nC3F9bDSIs?= =?iso-8859-1?q?eX8SkMUow/SLMONKb1IlKLHjVdcCwZ21IpD3I+CP9lYXwCPv5kBhFlYEQJPU?= =?iso-8859-1?q?6DRKGNrgSxzww1F1QlQ5XKomM11grUFgRcb/xNA16R51TGn2nYF4ap+FyOzp?= =?iso-8859-1?q?3xdd/rdvN53YWqtRcDJYWh0Vd5CuXfbjKHh9ry+9v9scrtwI/q4wk70d3y1C?= =?iso-8859-1?q?zeDEa40vxcDbCytwIMC/Owv/kwMtSryKxabphtJj7EpqRvMd1zqlv796XVKm?= =?iso-8859-1?q?KX1Y4DYV/r0tyjIL3Xr+FWjyo4FWVfbkCT7zsKdNgWkKkyLPWTGpLJ13v1cW?= =?iso-8859-1?q?TIa12BpRduVa2rToT2gFT5P0p9EfZj0UmcFcNwz3fNyRI9wFzcWpPad94tBh?= =?iso-8859-1?q?9abmdf/wAPUYpBu/9OQVLHZV/23cSmr/IzRlLg27Wm6CJp7p4UEeS8SSyRZy?= =?iso-8859-1?q?YxCYZ9rpwF9t7upPyUwJfL3DNoajInaFg4mCrN2y7ydlgFGY0GTAHu3d3qQj?= =?iso-8859-1?q?GKEr5fKmqBgkV2HMw7rJbGe84J7dlN14O+T659xHx/L+S85yUgMyJW9tg9ub?= =?iso-8859-1?q?OlLdVr6768r8b8JTN3W86s4OmLE606ZHgv8OigoMT9g+YKHUdpBLXLAugt/D?= =?iso-8859-1?q?x/BcQz9lyoaV/bqK5YZAQp/TiREhJMzO/43gSlnUIVVKnq6Q+FGO/+t2xbHK?= =?iso-8859-1?q?Xpm+EW2Asn+P8eLsvUB/k8BcCwqGK8ahIyiRyot0h7mrq/5lmf4zjphfk9ui?= =?iso-8859-1?q?/GWp87s1KsezGZeHhuJN/sD5uY3CFXDAk/crwA/vThcpBE+VWOSJo+dscAUh?= =?iso-8859-1?q?QZxhqtZ+q8ZqgNk60J4GZ7KT6XjoXS7JR9EgxAAe9WcfjxaozYAZ8OVUATAs?= =?iso-8859-1?q?OkivkVFlnPEjN2HQhDQcjvDRwv7fP3v/i7zT0Wo9In4/WiPDlPHYQoNcQPD5?= =?iso-8859-1?q?4y+chq8YE0VS2D8pX01wYvS+5fZD6KVoOOkdz0jPX0EWEcjMcI1x75sNCWDn?= =?iso-8859-1?q?bLGV1k/XTLBeroTLQC2qdk93MJdudw40hVTcYBi4//1jUEHq6ccWk2go8kbp?= =?iso-8859-1?q?4wO8BXXddMDJA2ii6JaUFUHyz+Z4t31Erb38NAw/GCdxvATJV8XLZooCzcCU?= =?iso-8859-1?q?OhvaibFRCfF8rm2eCDUtlPKblmw+S/xSLK5jGUmAhckEOFfSsVgyUBsSXjpt?= =?iso-8859-1?q?p8+ZxXr0wtyZ+7KCnvtO/rDQ2Qob1aOA3J/XPtKyxahdOnc7HiIsajxZjrzi?= =?iso-8859-1?q?P8ZbjChO3imXJw+6UP9H5MStEPHrVpoEmGOBTWUeuRcEhZdEeQU5gJVNz5zN?= =?iso-8859-1?q?p/pdCUTs6J4zU2QXgN5tDtfpGtq05j2QsvQ6wI1FYGNFnL9ncebcvXGp5uhL?= =?iso-8859-1?q?vf3tPSBzxvC8JIUWwVZ7Cm+AXMjyuLP+4OdKzmqKy5FkGRyyahrdf7mVG8m8?= =?iso-8859-1?q?ZjmZnu8mYGpHrWZY+Fc7IJNUB1qv3ZUMPAT0Q+yihlcAdJW+bcMJUzBa0UqW?= =?iso-8859-1?q?EDRYlG9Gu5BtmSVSX?= 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: d3ab91fb-2273-4295-974e-08dc639ef09c X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Apr 2024 14:09:07.2186 (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: yJ2gwEkBO4uOiKY0LceKXtwRpNuP5OJgBK+DIobFex6vnotuMu52gJqy+yUv+/5QU3lXxEN8VeynmYybBWe/TQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR17MB4945 X-Proofpoint-GUID: DIJidrXfjun4MtvnGtwCwFaA3X0Ed4j3 X-Proofpoint-ORIG-GUID: DIJidrXfjun4MtvnGtwCwFaA3X0Ed4j3 This makes all string descriptors configurable for the UAC2 gadget so the user can configure names of terminals/controls/alt modes. Signed-off-by: Chris Wulff Nacked-by: Pavel Hofman --- v2: Improved naming of parameters to be mode user friendly. Added documentation. v1: https://lore.kernel.org/linux-usb/CO1PR17MB5419B50F94A0014647542931E10D2@CO1PR17MB5419.namprd17.prod.outlook.com/ .../ABI/testing/configfs-usb-gadget-uac2 | 13 +++ Documentation/usb/gadget-testing.rst | 13 +++ drivers/usb/gadget/function/f_uac2.c | 80 +++++++++++++++---- drivers/usb/gadget/function/u_uac2.h | 17 +++- 4 files changed, 105 insertions(+), 18 deletions(-) diff --git a/Documentation/ABI/testing/configfs-usb-gadget-uac2 b/Documentation/ABI/testing/configfs-usb-gadget-uac2 index a2bf4fd82a5b..250f8eeb8eab 100644 --- a/Documentation/ABI/testing/configfs-usb-gadget-uac2 +++ b/Documentation/ABI/testing/configfs-usb-gadget-uac2 @@ -35,6 +35,19 @@ Description: req_number the number of pre-allocated requests for both capture and playback function_name name of the interface + if_ctrl_name topology control name + clksrc_in_name input clock name + clksrc_out_name output clock name + p_it_name playback input terminal name + p_ot_name playback output terminal name + p_fu_name playback function 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_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 c_terminal_type code of the capture terminal type p_terminal_type code of the playback terminal type ===================== ======================================= diff --git a/Documentation/usb/gadget-testing.rst b/Documentation/usb/gadget-testing.rst index b086c7ab72f0..1a11d3b3bb88 100644 --- a/Documentation/usb/gadget-testing.rst +++ b/Documentation/usb/gadget-testing.rst @@ -765,6 +765,19 @@ The uac2 function provides these attributes in its function directory: req_number the number of pre-allocated request for both capture and playback function_name name of the interface + if_ctrl_name topology control name + clksrc_in_name input clock name + clksrc_out_name output clock name + p_it_name playback input terminal name + p_ot_name playback output terminal name + p_fu_name playback function 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_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 c_terminal_type code of the capture terminal type p_terminal_type code of the playback terminal type ================ ==================================================== diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c index 383f6854cfec..5ca7ecdb6e60 100644 --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/f_uac2.c @@ -104,25 +104,10 @@ enum { STR_AS_OUT_ALT1, STR_AS_IN_ALT0, STR_AS_IN_ALT1, + NUM_STR_DESCRIPTORS, }; -static struct usb_string strings_fn[] = { - /* [STR_ASSOC].s = DYNAMIC, */ - [STR_IF_CTRL].s = "Topology Control", - [STR_CLKSRC_IN].s = "Input Clock", - [STR_CLKSRC_OUT].s = "Output Clock", - [STR_USB_IT].s = "USBH Out", - [STR_IO_IT].s = "USBD Out", - [STR_USB_OT].s = "USBH In", - [STR_IO_OT].s = "USBD In", - [STR_FU_IN].s = "Capture Volume", - [STR_FU_OUT].s = "Playback Volume", - [STR_AS_OUT_ALT0].s = "Playback Inactive", - [STR_AS_OUT_ALT1].s = "Playback Active", - [STR_AS_IN_ALT0].s = "Capture Inactive", - [STR_AS_IN_ALT1].s = "Capture Active", - { }, -}; +static struct usb_string strings_fn[NUM_STR_DESCRIPTORS + 1] = {}; static const char *const speed_names[] = { [USB_SPEED_UNKNOWN] = "UNKNOWN", @@ -1049,6 +1034,21 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn) return ret; strings_fn[STR_ASSOC].s = uac2_opts->function_name; + strings_fn[STR_IF_CTRL].s = uac2_opts->if_ctrl_name; + strings_fn[STR_CLKSRC_IN].s = uac2_opts->clksrc_in_name; + strings_fn[STR_CLKSRC_OUT].s = uac2_opts->clksrc_out_name; + + strings_fn[STR_USB_IT].s = uac2_opts->p_it_name; + strings_fn[STR_IO_OT].s = uac2_opts->p_ot_name; + strings_fn[STR_FU_OUT].s = uac2_opts->p_fu_name; + strings_fn[STR_AS_OUT_ALT0].s = uac2_opts->p_alt0_name; + strings_fn[STR_AS_OUT_ALT1].s = uac2_opts->p_alt1_name; + + strings_fn[STR_IO_IT].s = uac2_opts->c_it_name; + strings_fn[STR_USB_OT].s = uac2_opts->c_ot_name; + strings_fn[STR_FU_IN].s = uac2_opts->c_fu_name; + strings_fn[STR_AS_IN_ALT0].s = uac2_opts->c_alt0_name; + strings_fn[STR_AS_IN_ALT1].s = uac2_opts->c_alt1_name; us = usb_gstrings_attach(cdev, fn_strings, ARRAY_SIZE(strings_fn)); if (IS_ERR(us)) @@ -2097,10 +2097,26 @@ UAC2_ATTRIBUTE(s16, c_volume_max); UAC2_ATTRIBUTE(s16, c_volume_res); UAC2_ATTRIBUTE(u32, fb_max); UAC2_ATTRIBUTE_STRING(function_name); +UAC2_ATTRIBUTE_STRING(if_ctrl_name); +UAC2_ATTRIBUTE_STRING(clksrc_in_name); +UAC2_ATTRIBUTE_STRING(clksrc_out_name); + +UAC2_ATTRIBUTE_STRING(p_it_name); +UAC2_ATTRIBUTE_STRING(p_ot_name); +UAC2_ATTRIBUTE_STRING(p_fu_name); +UAC2_ATTRIBUTE_STRING(p_alt0_name); +UAC2_ATTRIBUTE_STRING(p_alt1_name); + +UAC2_ATTRIBUTE_STRING(c_it_name); +UAC2_ATTRIBUTE_STRING(c_ot_name); +UAC2_ATTRIBUTE_STRING(c_fu_name); +UAC2_ATTRIBUTE_STRING(c_alt0_name); +UAC2_ATTRIBUTE_STRING(c_alt1_name); UAC2_ATTRIBUTE(s16, p_terminal_type); UAC2_ATTRIBUTE(s16, c_terminal_type); + static struct configfs_attribute *f_uac2_attrs[] = { &f_uac2_opts_attr_p_chmask, &f_uac2_opts_attr_p_srate, @@ -2127,6 +2143,21 @@ static struct configfs_attribute *f_uac2_attrs[] = { &f_uac2_opts_attr_c_volume_res, &f_uac2_opts_attr_function_name, + &f_uac2_opts_attr_if_ctrl_name, + &f_uac2_opts_attr_clksrc_in_name, + &f_uac2_opts_attr_clksrc_out_name, + + &f_uac2_opts_attr_p_it_name, + &f_uac2_opts_attr_p_ot_name, + &f_uac2_opts_attr_p_fu_name, + &f_uac2_opts_attr_p_alt0_name, + &f_uac2_opts_attr_p_alt1_name, + + &f_uac2_opts_attr_c_it_name, + &f_uac2_opts_attr_c_ot_name, + &f_uac2_opts_attr_c_fu_name, + &f_uac2_opts_attr_c_alt0_name, + &f_uac2_opts_attr_c_alt1_name, &f_uac2_opts_attr_p_terminal_type, &f_uac2_opts_attr_c_terminal_type, @@ -2188,6 +2219,21 @@ static struct usb_function_instance *afunc_alloc_inst(void) opts->fb_max = FBACK_FAST_MAX; scnprintf(opts->function_name, sizeof(opts->function_name), "Source/Sink"); + scnprintf(opts->if_ctrl_name, sizeof(opts->if_ctrl_name), "Topology Control"); + scnprintf(opts->clksrc_in_name, sizeof(opts->clksrc_in_name), "Input Clock"); + scnprintf(opts->clksrc_out_name, sizeof(opts->clksrc_out_name), "Output Clock"); + + scnprintf(opts->p_it_name, sizeof(opts->p_it_name), "USBH Out"); + scnprintf(opts->p_ot_name, sizeof(opts->p_ot_name), "USBD In"); + 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), "USBD Out"); + scnprintf(opts->c_ot_name, sizeof(opts->c_ot_name), "USBH In"); + 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"); opts->p_terminal_type = UAC2_DEF_P_TERM_TYPE; opts->c_terminal_type = UAC2_DEF_C_TERM_TYPE; diff --git a/drivers/usb/gadget/function/u_uac2.h b/drivers/usb/gadget/function/u_uac2.h index 5e81bdd6c5fb..e697d35a1759 100644 --- a/drivers/usb/gadget/function/u_uac2.h +++ b/drivers/usb/gadget/function/u_uac2.h @@ -68,7 +68,22 @@ struct f_uac2_opts { int fb_max; bool bound; - char function_name[32]; + char function_name[USB_MAX_STRING_LEN]; + char if_ctrl_name[USB_MAX_STRING_LEN]; + char clksrc_in_name[USB_MAX_STRING_LEN]; + char clksrc_out_name[USB_MAX_STRING_LEN]; + + char p_it_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_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]; s16 p_terminal_type; s16 c_terminal_type;