From patchwork Mon Aug 1 16:07:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sameer Pujar X-Patchwork-Id: 594734 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BCDFBC00144 for ; Mon, 1 Aug 2022 16:09:38 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E17E486E; Mon, 1 Aug 2022 18:08:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E17E486E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1659370177; bh=TiJUW2VshZOE1g/imaJw3oSbqOF9sfBGC6MpWAhd5+8=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=CQ+A6DPM+zDGjEHpWa6wdD2p/0hWUo9eKTNdmtxSQHyO3ECLbk8UwfFQM4oV9bqf8 R4WCemI2ekIWqe6rl3v3OcbSXCVIa4bl4x3L2lrl472WLr1QpZCmObPHZszFuAxCcQ bnTlWGHF2l03Ui28n6GzYPQ/+ZsfAsoVyCdDGIwA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 32C7DF80246; Mon, 1 Aug 2022 18:08:27 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5EFE1F80543; Mon, 1 Aug 2022 18:08:26 +0200 (CEST) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2059.outbound.protection.outlook.com [40.107.95.59]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 4E5A7F80246 for ; Mon, 1 Aug 2022 18:08:18 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4E5A7F80246 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="eoeFs4CH" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LFPvHrYGCOmu8/UOzOBqO0hramqDMd8g3y4yp1TInhj+GbsrLzk3SQNLTckZfjLfKiKDM1cacTKKKajlDkdssBSmjevbLxsGQvidWw4sgyzBMwyj1dF/lWah0CIeumiO/OBexrKwf8ECbKgjPFPMEEIGgxn6MEPQsZekQYiYW9O1Ql/K665F/skeAmVlZOxo7nAZ3C7juOmqADXibDRgHQjQNjyIJgTJm8qdSQa+oOy6fgXHWZi8Rkd6pwxSNLlfAykd6f44D5RXUCK96jmC6yVevehhx+5ngiwj91+JfSNfKYOQny3EkbPVUG8nqD4RrV8a7Fp0rOvk9TbNq1i2Bw== 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=hJn2/y3pjA3KqyDdG8BjsB/xBYEtEzxQJb/xI+AsikE=; b=elUJDowmcLsG29HQUqzV+4Kzc4cI4EoQyLbVUjvuuKsGngn/Qu3jN3arcbm3oFC0Nity3TmEI8YIksjyFX7tlOfgNYJlL58xDCo3bjUImZ2z9TDg68MCzr9t3M5/LlyZeRdYAnqTa3nXNN1qdi8hLeKj3d4ai2s4dZgMCJy3oAqcQpKbHnS2aiNYuBCecu0B1m4Ej1W52pL5nGBaGt1MxWCIlmUoLsW/plDrDGd+ovcZhiq/DgXsJ1vDZRfSenLTAK6rplZEMGleOytNDNuWvpQMRcKQSfzC+lakTNNmxX7htVRUvCFA5h1GGnHIhQu9B+JxCmnIlPZfALk5wb+rcQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=renesas.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hJn2/y3pjA3KqyDdG8BjsB/xBYEtEzxQJb/xI+AsikE=; b=eoeFs4CHZXhOaoKTxuGQX4/L3efn8x7on0MeHURmxlcJvxN9w5a+vmeOFjoHNkmiZGBfIi1h2RSVRwKS9JVsy5ykLc+Dz/DKrv+32RCThpnJ5kpZXDhtu1Bj0RbXZIQNGtYrRAFGupx1PhYRxOyDBP45r7ICWXCWxBuhkwWjkktnVSEnI4wtnBcMBGsH9uRnvKNahM2o8CE0vodMuN3kCgI9PjSV6JHz4n69K7yXJCXEds+oR0OuMOx2sarUtHwMm4aR3rEJWadyqA6qcXKgLwO1OzXSAQJU9YwhOeRWwSVvuQqsxJFtqRNtM+Tk3Mf+j0Oi88cAQXo31wCH04ddUQ== Received: from BN0PR04CA0057.namprd04.prod.outlook.com (2603:10b6:408:e8::32) by SA0PR12MB4415.namprd12.prod.outlook.com (2603:10b6:806:70::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.11; Mon, 1 Aug 2022 16:08:15 +0000 Received: from BN8NAM11FT060.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e8:cafe::f) by BN0PR04CA0057.outlook.office365.com (2603:10b6:408:e8::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.24 via Frontend Transport; Mon, 1 Aug 2022 16:08:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.235) by BN8NAM11FT060.mail.protection.outlook.com (10.13.177.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5482.10 via Frontend Transport; Mon, 1 Aug 2022 16:08:14 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Mon, 1 Aug 2022 16:08:10 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Mon, 1 Aug 2022 09:08:10 -0700 Received: from audio.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.26 via Frontend Transport; Mon, 1 Aug 2022 09:08:07 -0700 From: Sameer Pujar To: , , , , , , Subject: [PATCH v2 1/3] ASoC: dt-bindings: Add schema for common DAI params Date: Mon, 1 Aug 2022 21:37:30 +0530 Message-ID: <1659370052-18966-2-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1659370052-18966-1-git-send-email-spujar@nvidia.com> References: <1659370052-18966-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2f4a4069-9512-4f10-cd84-08da73d80a1d X-MS-TrafficTypeDiagnostic: SA0PR12MB4415:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zvKd6exUM8/8UJ4okQ9VCZIDO4hOH1oNI7TWc4owuL6juDJc33R99/EvZngp1Mo/Onrxb551Np1qPJaxOq/b7GI2ASdAHlwXcEZY2ugwklnjLYHL9CT8ryRVOckey8iTNqxI5yfKWNxfjscp3mmkr0/wySi7Vb0ETqxhF52Jb1ixW94/iVXf9cJW1ISpW3MbEuhi5TigvtQPVcfqNKEu9SddLbsHI2knkyqXgJJc2dicsze4RS4hoAG+vm7t3rVwzUVKjmdziIP/p2vfvbPD+guvg/XUeeagWtsej1iqXkGDOTZsBGrYUfrKVvtLR3Eqmf24tqvVuGqNrjElrKbgvSKbjdZAxQjPjbzPe0tpuOYmYGnoX6Cd4j3mMrh4WO0gMkzK0rCILKDK6z5Spdpxa895IsERbT8c+DnCs3Inzyme8s27Pmu8X43+3u7ZIFj5vzyokkLq+6bR566g0qxARYO1vbc2GHg78rgyf/RW02K7sqjN3/VWMBbfl122GsTM7AO0V1q8E7GikZVqchtIoZ1fqJRvsS/TufFq9JOQn9hrsThrjq7B2o47+Ku/U8cryGJZpRAStJjmv1IHCBjezNl+kCNYBm1uJPDROhgpB6BrvnTW2IFNP8aU5I0ZASm7dcLKi5VNrSwGoePADhaAGm/9nwF8Jbc57Xz4KINWxNUUW/3bsOf52+HZmve7xGdTktG736cdE9inLkGwl3Hp+sf9AYq8vuIGA1y3w0wom2E/N4PcDptv0zlc1j37lBzWhCiN2rmW9npys38MI+X3BY4nOdJCgQIfE8Z1RDMxjA0Xu3jOaUkeX++dhZM4Ya1CcCWyfTbttwWT+UH7oLUga62/hdRAh/yZUO453ZXGUpqkmt3guRwGq24vX3tTXWTptoMedKE76WVDWe9CfXRVfmOj6iUFWF0yBV60cb8d4gcWmDvvMNP86wfxfOLFpmfiU8aRJ6qAbLJkhRyHV+kV/g== X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230016)(4636009)(136003)(376002)(396003)(39860400002)(346002)(40470700004)(46966006)(36840700001)(36860700001)(54906003)(316002)(41300700001)(7696005)(26005)(6666004)(86362001)(110136005)(82310400005)(40480700001)(36756003)(83380400001)(356005)(5660300002)(70206006)(70586007)(8676002)(4326008)(2906002)(2616005)(478600001)(336012)(966005)(107886003)(81166007)(8936002)(186003)(426003)(47076005)(40460700003)(82740400003)(7416002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2022 16:08:14.4170 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2f4a4069-9512-4f10-cd84-08da73d80a1d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT060.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4415 Cc: Sameer Pujar , devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The "convert-channels" and "convert-rate" bindings are provided for both simple-card and audio-graph-card. However these are separately defined in their respective schemas. For any new binding addition, which is common to both, there will be duplication. Introduce a new schema to have common DAI params properties and these can be re-used in other schemas wherever applicable. Signed-off-by: Sameer Pujar Cc: Kuninori Morimoto --- .../bindings/sound/audio-graph-port.yaml | 13 ++++------ .../devicetree/bindings/sound/audio-graph.yaml | 7 +++--- .../devicetree/bindings/sound/dai-params.yaml | 28 ++++++++++++++++++++++ .../devicetree/bindings/sound/simple-card.yaml | 16 ++++--------- 4 files changed, 40 insertions(+), 24 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/dai-params.yaml diff --git a/Documentation/devicetree/bindings/sound/audio-graph-port.yaml b/Documentation/devicetree/bindings/sound/audio-graph-port.yaml index 5c36867..30a644d9 100644 --- a/Documentation/devicetree/bindings/sound/audio-graph-port.yaml +++ b/Documentation/devicetree/bindings/sound/audio-graph-port.yaml @@ -19,11 +19,10 @@ properties: description: "device name prefix" $ref: /schemas/types.yaml#/definitions/string convert-rate: - description: CPU to Codec rate convert. - $ref: /schemas/types.yaml#/definitions/uint32 + $ref: "/schemas/sound/dai-params.yaml#/properties/dai-sample-rate" convert-channels: - description: CPU to Codec rate channels. - $ref: /schemas/types.yaml#/definitions/uint32 + $ref: "/schemas/sound/dai-params.yaml#/properties/dai-channels" + patternProperties: "^endpoint(@[0-9a-f]+)?": $ref: /schemas/graph.yaml#/$defs/endpoint-base @@ -65,11 +64,9 @@ patternProperties: - msb - lsb convert-rate: - description: CPU to Codec rate convert. - $ref: /schemas/types.yaml#/definitions/uint32 + $ref: "/schemas/sound/dai-params.yaml#/properties/dai-sample-rate" convert-channels: - description: CPU to Codec rate channels. - $ref: /schemas/types.yaml#/definitions/uint32 + $ref: "/schemas/sound/dai-params.yaml#/properties/dai-channels" dai-tdm-slot-width-map: description: Mapping of sample widths to slot widths. For hardware diff --git a/Documentation/devicetree/bindings/sound/audio-graph.yaml b/Documentation/devicetree/bindings/sound/audio-graph.yaml index 4b46794..a9cd52e 100644 --- a/Documentation/devicetree/bindings/sound/audio-graph.yaml +++ b/Documentation/devicetree/bindings/sound/audio-graph.yaml @@ -27,11 +27,10 @@ properties: description: User specified audio sound widgets. $ref: /schemas/types.yaml#/definitions/non-unique-string-array convert-rate: - description: CPU to Codec rate convert. - $ref: /schemas/types.yaml#/definitions/uint32 + $ref: "/schemas/sound/dai-params.yaml#/properties/dai-sample-rate" convert-channels: - description: CPU to Codec rate channels. - $ref: /schemas/types.yaml#/definitions/uint32 + $ref: "/schemas/sound/dai-params.yaml#/properties/dai-channels" + pa-gpios: maxItems: 1 hp-det-gpio: diff --git a/Documentation/devicetree/bindings/sound/dai-params.yaml b/Documentation/devicetree/bindings/sound/dai-params.yaml new file mode 100644 index 0000000..aae60cb --- /dev/null +++ b/Documentation/devicetree/bindings/sound/dai-params.yaml @@ -0,0 +1,28 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/dai-params.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Digital Audio Interface (DAI) Stream Parameters + +maintainers: + - Kuninori Morimoto + +select: false + +properties: + + dai-channels: + description: Number of audio channels used by DAI + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 1 + maximum: 32 + + dai-sample-rate: + description: Audio sample rate used by DAI + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 8000 + maximum: 192000 + +additionalProperties: true diff --git a/Documentation/devicetree/bindings/sound/simple-card.yaml b/Documentation/devicetree/bindings/sound/simple-card.yaml index b261d49..ab03a2b 100644 --- a/Documentation/devicetree/bindings/sound/simple-card.yaml +++ b/Documentation/devicetree/bindings/sound/simple-card.yaml @@ -69,14 +69,6 @@ definitions: as amplifiers, to be added to the sound card. $ref: /schemas/types.yaml#/definitions/phandle-array - convert-rate: - description: CPU to Codec rate convert. - $ref: /schemas/types.yaml#/definitions/uint32 - - convert-channels: - description: CPU to Codec rate channels. - $ref: /schemas/types.yaml#/definitions/uint32 - prefix: description: "device name prefix" $ref: /schemas/types.yaml#/definitions/string @@ -188,9 +180,9 @@ properties: simple-audio-card,aux-devs: $ref: "#/definitions/aux-devs" simple-audio-card,convert-rate: - $ref: "#/definitions/convert-rate" + $ref: "/schemas/sound/dai-params.yaml#/properties/dai-sample-rate" simple-audio-card,convert-channels: - $ref: "#/definitions/convert-channels" + $ref: "/schemas/sound/dai-params.yaml#/properties/dai-channels" simple-audio-card,prefix: $ref: "#/definitions/prefix" simple-audio-card,pin-switches: @@ -231,9 +223,9 @@ patternProperties: aux-devs: $ref: "#/definitions/aux-devs" convert-rate: - $ref: "#/definitions/convert-rate" + $ref: "/schemas/sound/dai-params.yaml#/properties/dai-sample-rate" convert-channels: - $ref: "#/definitions/convert-channels" + $ref: "/schemas/sound/dai-params.yaml#/properties/dai-channels" prefix: $ref: "#/definitions/prefix" pin-switches: From patchwork Mon Aug 1 16:07:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sameer Pujar X-Patchwork-Id: 594879 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 582F5C00144 for ; Mon, 1 Aug 2022 16:10:01 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 9101AE12; Mon, 1 Aug 2022 18:09:09 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9101AE12 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1659370199; bh=a8RbcVvM3EGPrHcIJ75BJszKjsOBZ326/M8gxtCIFxU=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=H7N0KLOn4RZSBOQtK6e1/fBi3X3WQXh34LJmJKpgM7e/4eIB96o8IY5CMI9AlDRpT +BZaIXQcDGBJEFpsUXjE2bhXpyCKKTR7o4QsdKsX8jUnKcBbk1WHzUQpnYqmMTkIMT r2e9etMSfN+7ImjMGu5fISWwvRgcwItq2TMHDv6M= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id DE756F80544; Mon, 1 Aug 2022 18:08:27 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6C014F80139; Mon, 1 Aug 2022 18:08:26 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2043.outbound.protection.outlook.com [40.107.220.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 7C5A1F802DB for ; Mon, 1 Aug 2022 18:08:19 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 7C5A1F802DB Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="C04ldufY" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f8ygqKmIWzJX8JSs1AQKqV+QuLWQcxaSGTW5Il9MEuiOXhJsvSxY+vQgTKy+2OlOZX+ZkJCpVUmiMHz6zvjvdN5GKQ+dgmMYahuN9YuO0KWTGCLTB2Kf2KROWn7KsY75oCLJonk/P8YGWv05MztN3ldLDPcDP0YTkBLYei8v5v/RWsl1lk1MPJIpe6fMBnOAe5PCo5p7ggCx31E0sT8RFSO9oFPuyOXsmMdeZHCGcXg4Fss5iUzE5ZtvWIboi8R1aFrSsilsH7V7bnOEvfpBuAe/99v3vW7oOHjCc/BzseYGn4AqJoC4SmbCQe4iqDOqrD7fyDej/WVXKd6b8HpTtA== 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=3fD3mig3DCyYWdwPJ2ne/4kIvNLm1ttgIinYcoBw9js=; b=PGSYWeANF774/ANh+b0lGYz/GZpasCvLEVjRJiK80zOb7HCJKfYrCkUau8z7H0EfY8PiOL/wwWHteGT0ptPmH+4DkxXHGoBGnuhbV1Dif6Tb3Ic2vW7jYQipG2591QWHUxf6R+mALp964W7Gc4e52aiH59QcMniv5H1MXR9B34X8HJgjItkq6PXFuumETvE7gyvgKSgtE7zx44QIqFFvNNxYXiwWCWsH0ygOn75y0JIwS9harBp5cCxEA2LFMCTXlsjwkADeLD/jF0nM3H778dKtOR3RI/W/uyDhf6rljiw3bNEPgfLEQdg06q8XVE5Um4MrFgAHAe/03T27VVJPkw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) smtp.rcpttodomain=renesas.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3fD3mig3DCyYWdwPJ2ne/4kIvNLm1ttgIinYcoBw9js=; b=C04ldufYtaUuZkV9+7BMPUQA8Lwa2PG0396IF6eRVRSqX0M8Hy0IXbpA2JUwy6d9aq/S6RhF+AISJB2BvYOH76OPR4k0w4O0wLBiHWq0zUF0ZBLxI3Mj0EkAYhWxDVSXNvnsoHsCLeLFrW1rSIJrdaj/FwAnLLIfrGITisNIsUyyMe1bbkK5q6Srb+Yd7V+BBUAeQYSJCUb2UZi28k3CAGxUYWAwun7Qd5YlNOhGThjSk0vKRx1rUVT6dCOFZ/NS5j1EVCQ+dj6mDk/xV9z6bouMLMvyShu1W6cZhUujDseDXZxWBcpd1GUotCUbsHrzkO9lP3D2WAAif4hVSHH/Kw== Received: from BL0PR02CA0092.namprd02.prod.outlook.com (2603:10b6:208:51::33) by MWHPR1201MB0095.namprd12.prod.outlook.com (2603:10b6:301:4e::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.12; Mon, 1 Aug 2022 16:08:15 +0000 Received: from CO1NAM11FT054.eop-nam11.prod.protection.outlook.com (2603:10b6:208:51:cafe::db) by BL0PR02CA0092.outlook.office365.com (2603:10b6:208:51::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.10 via Frontend Transport; Mon, 1 Aug 2022 16:08:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.234) by CO1NAM11FT054.mail.protection.outlook.com (10.13.174.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5482.10 via Frontend Transport; Mon, 1 Aug 2022 16:08:14 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Mon, 1 Aug 2022 16:08:13 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Mon, 1 Aug 2022 09:08:13 -0700 Received: from audio.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.26 via Frontend Transport; Mon, 1 Aug 2022 09:08:10 -0700 From: Sameer Pujar To: , , , , , , Subject: [PATCH v2 2/3] ASoC: dt-bindings: Add sample format conversion Date: Mon, 1 Aug 2022 21:37:31 +0530 Message-ID: <1659370052-18966-3-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1659370052-18966-1-git-send-email-spujar@nvidia.com> References: <1659370052-18966-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 018c11c1-1bb7-45b0-c63d-08da73d809f3 X-MS-TrafficTypeDiagnostic: MWHPR1201MB0095:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iBjPsp/GUUXWBzdycElROdABaAgBNWv5ROBYJrMpKt+bcohVhNUl91i3yPb5m49jZp52W1VCgGC0B62cE4Q62r8uuSzoHGra2z2pG2HgXPxxwwUwDOG9TMBkKwJYxJuPxSiBYj0widr3xcbFdsoibHE3tbV3mGOmlhuWYSeT7U8Luj3og9/T27/PXUwqHGX5T4oM43mynnYWwJf0a1wLLaPvtcL+H+Mcb4Z2Hev0nNopEXl3iZtiSemypNN0qSMbGraSDz65lXFp9XLpC+jwmP4EYoEFzP8+XWiIy7TYIRrmvMF6Pb0B9L2KE8ImCYGbTLWfILc1r71uDmpdc57X5ftEteJh9WqJ/NwprvIQCzOokdYcOpsetQEtxRrbRjBa5Yx8JaA6YSQAVjzzCSVKRxE1SZdHX1rX1bNrbDBtD9OrzyRQF79P+WAgNhkEZxIia/ghRRaM5Rh7+fAdrVe8YIDoQXPsvGfIPcCp/rP0zL45YNZ06OAJJ9fZFZ5IVTkrHNV0NKFI8NCUfjYMXbuiSUvx41YGlFqQqFr6hhGlZ3a3EN0KB19NOu2nIXu0IYA/JIOfvaOVchMWRtPMgR2XW3V6N5n/CWV1oyGUNsXAF3fv5zayIsSq46SS8ycT+YRRb2mxdSpu1eftkIQAK/ATHMn9dMisgLvhGwlFdshiPLZ6JUJvDl79Sb9C3C/FAL5z3AnYzuzN96L+FjcKEtjtbrMYnx66HH6+vetDkdxckS+kunfXVkFgkrE+pLIrhUt74bdEc8J/spUT82PsAd/06jvONNBL+8h1fronxuP3MrRGasfcIAeN4zGHRWXRniaQ3S2A6EPT2thFBPnpNxgUng== X-Forefront-Antispam-Report: CIP:12.22.5.234; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230016)(4636009)(39860400002)(136003)(346002)(396003)(376002)(46966006)(40470700004)(36840700001)(478600001)(2616005)(26005)(7696005)(41300700001)(6666004)(186003)(47076005)(107886003)(336012)(426003)(7416002)(5660300002)(82310400005)(2906002)(40460700003)(40480700001)(82740400003)(70206006)(110136005)(54906003)(8936002)(316002)(8676002)(70586007)(4326008)(36756003)(86362001)(81166007)(356005)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2022 16:08:14.2041 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 018c11c1-1bb7-45b0-c63d-08da73d809f3 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.234]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT054.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB0095 Cc: Sameer Pujar , devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Presently "convert-channels" and "convert-rate" DT bindings are available for channel and rate fixups respectively. Similarly add "convert-sample-format" binding to fixup DAI sample format as well. This is added to simple-card and audio-graph based sound cards. Signed-off-by: Sameer Pujar Cc: Kuninori Morimoto --- Documentation/devicetree/bindings/sound/audio-graph-port.yaml | 4 ++++ Documentation/devicetree/bindings/sound/audio-graph.yaml | 2 ++ Documentation/devicetree/bindings/sound/dai-params.yaml | 10 ++++++++++ Documentation/devicetree/bindings/sound/simple-card.yaml | 4 ++++ 4 files changed, 20 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/audio-graph-port.yaml b/Documentation/devicetree/bindings/sound/audio-graph-port.yaml index 30a644d9..8e64192 100644 --- a/Documentation/devicetree/bindings/sound/audio-graph-port.yaml +++ b/Documentation/devicetree/bindings/sound/audio-graph-port.yaml @@ -22,6 +22,8 @@ properties: $ref: "/schemas/sound/dai-params.yaml#/properties/dai-sample-rate" convert-channels: $ref: "/schemas/sound/dai-params.yaml#/properties/dai-channels" + convert-sample-format: + $ref: "/schemas/sound/dai-params.yaml#/properties/dai-sample-format" patternProperties: "^endpoint(@[0-9a-f]+)?": @@ -67,6 +69,8 @@ patternProperties: $ref: "/schemas/sound/dai-params.yaml#/properties/dai-sample-rate" convert-channels: $ref: "/schemas/sound/dai-params.yaml#/properties/dai-channels" + convert-sample-format: + $ref: "/schemas/sound/dai-params.yaml#/properties/dai-sample-format" dai-tdm-slot-width-map: description: Mapping of sample widths to slot widths. For hardware diff --git a/Documentation/devicetree/bindings/sound/audio-graph.yaml b/Documentation/devicetree/bindings/sound/audio-graph.yaml index a9cd52e..93ddd55 100644 --- a/Documentation/devicetree/bindings/sound/audio-graph.yaml +++ b/Documentation/devicetree/bindings/sound/audio-graph.yaml @@ -30,6 +30,8 @@ properties: $ref: "/schemas/sound/dai-params.yaml#/properties/dai-sample-rate" convert-channels: $ref: "/schemas/sound/dai-params.yaml#/properties/dai-channels" + convert-sample-format: + $ref: "/schemas/sound/dai-params.yaml#/properties/dai-sample-format" pa-gpios: maxItems: 1 diff --git a/Documentation/devicetree/bindings/sound/dai-params.yaml b/Documentation/devicetree/bindings/sound/dai-params.yaml index aae60cb..933957d 100644 --- a/Documentation/devicetree/bindings/sound/dai-params.yaml +++ b/Documentation/devicetree/bindings/sound/dai-params.yaml @@ -19,6 +19,16 @@ properties: minimum: 1 maximum: 32 + dai-sample-format: + description: Audio sample format used by DAI + $ref: /schemas/types.yaml#/definitions/string + enum: + - s8 + - s16_le + - s24_le + - s24_3le + - s32_le + dai-sample-rate: description: Audio sample rate used by DAI $ref: /schemas/types.yaml#/definitions/uint32 diff --git a/Documentation/devicetree/bindings/sound/simple-card.yaml b/Documentation/devicetree/bindings/sound/simple-card.yaml index ab03a2b..ec21190 100644 --- a/Documentation/devicetree/bindings/sound/simple-card.yaml +++ b/Documentation/devicetree/bindings/sound/simple-card.yaml @@ -183,6 +183,8 @@ properties: $ref: "/schemas/sound/dai-params.yaml#/properties/dai-sample-rate" simple-audio-card,convert-channels: $ref: "/schemas/sound/dai-params.yaml#/properties/dai-channels" + simple-audio-card,convert-sample-format: + $ref: "/schemas/sound/dai-params.yaml#/properties/dai-sample-format" simple-audio-card,prefix: $ref: "#/definitions/prefix" simple-audio-card,pin-switches: @@ -226,6 +228,8 @@ patternProperties: $ref: "/schemas/sound/dai-params.yaml#/properties/dai-sample-rate" convert-channels: $ref: "/schemas/sound/dai-params.yaml#/properties/dai-channels" + convert-sample-format: + $ref: "/schemas/sound/dai-params.yaml#/properties/dai-sample-format" prefix: $ref: "#/definitions/prefix" pin-switches: From patchwork Mon Aug 1 16:07:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sameer Pujar X-Patchwork-Id: 594733 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 30744C00144 for ; Mon, 1 Aug 2022 16:10:10 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 6C7B81635; Mon, 1 Aug 2022 18:09:18 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6C7B81635 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1659370208; bh=BTAJ/Pbd0FMo1Kk0QD0LcqOThSfZTyyWvEPzq0s0hj0=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=bXXiXubZqimmCpDik2sBvVf3aQemUc3ZgziY3ivah1DULWLQsoFgdOzrZtTmX/R6n dQ5EcPhxLK3m+/PR0UxT8aeZcuhVmy2Vk4fD0PzEny0DcUzPn2D911OcvY02Q4tdBe +qx4F18aeFfRnCXR1Ed83GXEWh1JMQ/ELBcdH9h0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E2F16F80558; Mon, 1 Aug 2022 18:08:29 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 110B9F8054A; Mon, 1 Aug 2022 18:08:28 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 486C0F804FA for ; Mon, 1 Aug 2022 18:08:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 486C0F804FA Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="NHCgvxkO" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WgoDaUXnX7PGheMfv/XGYdu3Yinu0LTiCe6JN9hbTHgwja1Vqez6v2j/2blQFbs3tiwJJN2T8VovmkJcNFBIdOqRj/1yPtQ44CHiIFso/pSDzviInOe5eAFarpQCvgv9WEAEim5paXkD5/qERiU9QXDfdxTOBveo0XYbwBxAk5ch0bQQIhHkLaBAzZdJ/vWdaBuLHIu4PDdxEMPaBvuZzAiA8RvZfd3Dqawf4TVQEIxhT5UGiqPlhbX9DF9dUpxmueLvV/Z4hrtdsd8M/BgTP1t8FnPySBVfd2SdbUDWJuXhEDtSqdBJEf7iOT2L16jyYFFDtyDZMnILgh3V9LAs0g== 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=cfNcRFaISfDrIFhYwQbPhX7g6U7B0ezGsuFF8+x9Fsc=; b=ZGEhaRoWkJUpTWAfODEhUe8mHf5TZujSoXjxu6j7tZkD9qFhoRYHPS8D+QutMioC6/sBmWBK5v9t5TQLux/1evDWLIzsmwRcL5RsXVUh1S7iyMF6UCWJp6Q0LDvk/TCpR69vUeHBIXaVK7do8QvDxBVBlTGhMYoZ20lAnfZUtYXg+j1+/vRI1cfrxNtrlcCzv1qmkvnsy+GZ62v4EeO2nlVCkkKg9pEO9wiJYrucK7C+/aXHYO+zEg7AlTf5Hm8i5twH+THCQGwdEWFXjQhIinfNJxfOkk7L+6OtCnEVDYALxausHJOH2R8WBapCrJe5aSGUJ2bJxh1c9SY31HB6Hw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) smtp.rcpttodomain=renesas.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cfNcRFaISfDrIFhYwQbPhX7g6U7B0ezGsuFF8+x9Fsc=; b=NHCgvxkOcClc59EjIPwYqIn18GJZokezHovm+YURjU5biyXLqqYXlSfBH0lLFPnKI6GW9VceNi80FTkUzRI34HOGqi4oox9cVE7ZhME7r2G164+XniKXkV4rOZONZwN3D00L4FlRJ+mW2HDqTzCWTjRDvX5FRQhlnPM0zf46JdTrNqC7xX2NseuSgg9fQZfKr2/hGh28jTuDXIcPN9SjgLz15zYJTVQ75ZIoBQHmNGVoiEK5yR2mb6vjuVPOXaMm1SHLX1kC7j1QbtnerFAuSxL27kD8egW3F9LMjWSsiYJGvYADxXCdomYxMyoRsjfd5Mu0KdK5QJ99COKo+ZKKzQ== Received: from BN9PR03CA0088.namprd03.prod.outlook.com (2603:10b6:408:fc::33) by BN6PR12MB1842.namprd12.prod.outlook.com (2603:10b6:404:fb::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.11; Mon, 1 Aug 2022 16:08:18 +0000 Received: from BN8NAM11FT019.eop-nam11.prod.protection.outlook.com (2603:10b6:408:fc:cafe::b) by BN9PR03CA0088.outlook.office365.com (2603:10b6:408:fc::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.16 via Frontend Transport; Mon, 1 Aug 2022 16:08:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.236) by BN8NAM11FT019.mail.protection.outlook.com (10.13.176.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5482.10 via Frontend Transport; Mon, 1 Aug 2022 16:08:17 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Mon, 1 Aug 2022 16:08:16 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Mon, 1 Aug 2022 09:08:16 -0700 Received: from audio.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.26 via Frontend Transport; Mon, 1 Aug 2022 09:08:13 -0700 From: Sameer Pujar To: , , , , , , Subject: [PATCH v2 3/3] ASoC: simple-card-utils: Fixup DAI sample format Date: Mon, 1 Aug 2022 21:37:32 +0530 Message-ID: <1659370052-18966-4-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1659370052-18966-1-git-send-email-spujar@nvidia.com> References: <1659370052-18966-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 08325247-eed8-46b3-4edc-08da73d80c13 X-MS-TrafficTypeDiagnostic: BN6PR12MB1842:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 93/Y91Yb5L4RQjgcyeMrIGxdE2mWRtSJ2RthzMpsdaZaPIFDKyUjmiUX679rx6IjhQdc/DGO7lhUVhHNtO9GLQ2H+U34II6uDwRK3dNlvHghZ1CxiysTV6XU7Y51EMHQPCf+5xUHivo/lhPRC6LkDVyiPr8ZVsc91URxJ7Bm7xBFVQ7OsmcyR1IT+hBERasCqirsEU5epVwpJcT37uClIr0psHa/hEOXfcgTnDhaMa2OVfyGyJn7KkNTAfq9+NsHfcMofAexGd5n7ZKllbILLQqL4f0/i8tVg7nkl4nO05NOQQJ1mrw1vkRCSCdGq3X7pabUO6AjMg1okgoBcA6AKT8T5j53FofQIaOeJ/FEv82rBGMyHG0lKoh05Kci0+qWTuBpMFUrgf+LAVHmmYtK6c9SRmC2AFu3UXIf+514jBUHE3WXVC8QgclQ4sUhduU9jxs3rQPdQFPQu1RLqnik+kLH1ewlvYt1K6b2N7SJExpWR+uc1mTAkygFgukBtV9NJufsctcrLhQDbp/h725w85byODP8kMn03D4yvWXTQNNAQWjdrRSITccvJGeayoChGkVKNHmRlG+gp/eMt1ZtJ+BtTab6LEO+SEqC/Gn4v+rOqJU/VsBVO4kdmcpJSceQ2XACf2VEhH5R3BkfSyCoA4t3OjnWZr0deNAugc+8vQwAij2a146NA9dNAnZ2QFk5CE+Go5VoaGbUDUfa5x1M0yXpQRTdHIAhQOaz6CjQNuiRmdcKCZKXYywv/9Ex0Exryx+kOeHren91TAHyLgoFpEtacqZXVdSVOcynMTc0bNH8wXxijPQHoj7EZEG0uyFbJ1AjtGj3ShJQjDGX3NJNuw== X-Forefront-Antispam-Report: CIP:12.22.5.236; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230016)(4636009)(346002)(376002)(136003)(39860400002)(396003)(40470700004)(36840700001)(46966006)(7696005)(6666004)(47076005)(426003)(336012)(41300700001)(186003)(2616005)(26005)(107886003)(82740400003)(81166007)(356005)(36860700001)(5660300002)(7416002)(8936002)(40480700001)(82310400005)(36756003)(40460700003)(478600001)(86362001)(70586007)(70206006)(4326008)(8676002)(316002)(54906003)(2906002)(110136005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2022 16:08:17.7193 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 08325247-eed8-46b3-4edc-08da73d80c13 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.236]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT019.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1842 Cc: Sameer Pujar , devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Parse "convert-sample-format" DT binding and fixup the sample format as applicable. This is similar to the existing "convert-channels" and "convert-rate" properties for channels and rate fixup respectively. Signed-off-by: Sameer Pujar Cc: Kuninori Morimoto --- include/sound/simple_card_utils.h | 1 + sound/soc/generic/simple-card-utils.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index ab55f40..a0b827f 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -39,6 +39,7 @@ struct asoc_simple_dai { struct asoc_simple_data { u32 convert_rate; u32 convert_channels; + const char *convert_sample_format; }; struct asoc_simple_jack { diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 4a29e31..1b201dd 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -15,6 +15,33 @@ #include #include +static void asoc_simple_fixup_sample_fmt(struct asoc_simple_data *data, + struct snd_pcm_hw_params *params) +{ + int i; + struct snd_mask *mask = hw_param_mask(params, + SNDRV_PCM_HW_PARAM_FORMAT); + struct { + char *fmt; + u32 val; + } of_sample_fmt_table[] = { + { "s8", SNDRV_PCM_FORMAT_S8}, + { "s16_le", SNDRV_PCM_FORMAT_S16_LE}, + { "s24_le", SNDRV_PCM_FORMAT_S24_LE}, + { "s24_3le", SNDRV_PCM_FORMAT_S24_3LE}, + { "s32_le", SNDRV_PCM_FORMAT_S32_LE}, + }; + + for (i = 0; i < ARRAY_SIZE(of_sample_fmt_table); i++) { + if (!strcmp(data->convert_sample_format, + of_sample_fmt_table[i].fmt)) { + snd_mask_none(mask); + snd_mask_set(mask, of_sample_fmt_table[i].val); + break; + } + } +} + void asoc_simple_convert_fixup(struct asoc_simple_data *data, struct snd_pcm_hw_params *params) { @@ -30,6 +57,9 @@ void asoc_simple_convert_fixup(struct asoc_simple_data *data, if (data->convert_channels) channels->min = channels->max = data->convert_channels; + + if (data->convert_sample_format) + asoc_simple_fixup_sample_fmt(data, params); } EXPORT_SYMBOL_GPL(asoc_simple_convert_fixup); @@ -49,6 +79,10 @@ void asoc_simple_parse_convert(struct device_node *np, /* channels transfer */ snprintf(prop, sizeof(prop), "%s%s", prefix, "convert-channels"); of_property_read_u32(np, prop, &data->convert_channels); + + /* convert sample format */ + snprintf(prop, sizeof(prop), "%s%s", prefix, "convert-sample-format"); + of_property_read_string(np, prop, &data->convert_sample_format); } EXPORT_SYMBOL_GPL(asoc_simple_parse_convert);