From patchwork Mon Feb 18 16:10:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Codrin Ciubotariu X-Patchwork-Id: 10818455 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D22636CB for ; Mon, 18 Feb 2019 16:49:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B803B29D1C for ; Mon, 18 Feb 2019 16:49:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A6A8E29CCD; Mon, 18 Feb 2019 16:49:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 91B4D29CCD for ; Mon, 18 Feb 2019 16:49:10 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 6DE9426555C; Mon, 18 Feb 2019 17:11:10 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id E4473265550; Mon, 18 Feb 2019 17:11:06 +0100 (CET) Received: from esa4.microchip.iphmx.com (esa4.microchip.iphmx.com [68.232.154.123]) by alsa0.perex.cz (Postfix) with ESMTP id BE05926553F for ; Mon, 18 Feb 2019 17:11:01 +0100 (CET) X-IronPort-AV: E=Sophos;i="5.58,385,1544511600"; d="scan'208";a="26476886" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 18 Feb 2019 09:10:42 -0700 Received: from NAM04-CO1-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.105) with Microsoft SMTP Server (TLS) id 14.3.352.0; Mon, 18 Feb 2019 09:10:42 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=B3vACndhHznrL0TehhaEpBgute3q4UvGqaVmr38xUM0=; b=jZ6mIc93R6itx2ESbLZc49LWVCPsO0CoqXiGBTN/imLdOVIrxD0bBWz6cqtZtNoio6rNsibi+5FtAab+CxupPTFIGoc7R7UnpJ0Zj68gF9LYCa4ZXuPabgrSr6pvQvESQuA8Fg+mC1VCHnHQQjCgvmDUpo+oWNoclx/ptnPAYPc= Received: from CY4PR11MB1256.namprd11.prod.outlook.com (10.169.252.10) by CY4PR11MB1448.namprd11.prod.outlook.com (10.172.69.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1622.16; Mon, 18 Feb 2019 16:10:34 +0000 Received: from CY4PR11MB1256.namprd11.prod.outlook.com ([fe80::d9cc:7741:4930:cda3]) by CY4PR11MB1256.namprd11.prod.outlook.com ([fe80::d9cc:7741:4930:cda3%7]) with mapi id 15.20.1622.018; Mon, 18 Feb 2019 16:10:34 +0000 From: To: , , Thread-Topic: [PATCH 4/5] ASoC: codecs: ad193x: Add runtime support for DSP_A and I2S modes Thread-Index: AQHUx6R64TVvlpVi4U2qyYqN379Pew== Date: Mon, 18 Feb 2019 16:10:34 +0000 Message-ID: <20190218160954.13929-5-codrin.ciubotariu@microchip.com> References: <20190218160954.13929-1-codrin.ciubotariu@microchip.com> In-Reply-To: <20190218160954.13929-1-codrin.ciubotariu@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: LO2P123CA0020.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:a6::32) To CY4PR11MB1256.namprd11.prod.outlook.com (2603:10b6:903:25::10) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Codrin.Ciubotariu@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [94.177.32.154] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 109e64c2-a0bc-4c40-5310-08d695bb9ceb x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:CY4PR11MB1448; x-ms-traffictypediagnostic: CY4PR11MB1448: x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; CY4PR11MB1448; 23:MZb6FE7TEQEqskLXroH4mUMThapeAk3zVibVP/H?= =?iso-8859-1?q?ymthO/wLAa3HO7c?= =?iso-8859-1?q?SU5ewi+XaBfqzRG8+VzbNFMa+M3b8GRPETkg85bA2/M8TKRffs87J4crTxMp?= =?iso-8859-1?q?JfRqwlJdWG62ZlyTvudqvyvhCjjtM/U6ZcSbK5OolWS8A3OWj7TAq3estBOy?= =?iso-8859-1?q?IJ/mRt8bgJRv3nAVOg0c8fGsuheAU6zw2qWnV5mvSeAyoNVwdOvGtcA+5rop?= =?iso-8859-1?q?Dbs0qQKnKmq5gwqBUcNuG82eGEO4G4BVlENgF+VU2tBYkTkuXyvf8F26hbOj?= =?iso-8859-1?q?o7bvODS8j2qkzp+b7p4x85F2Ag4Fz0CF8nWAFxc2A1ZSSmoq9/urTYhA+z6S?= =?iso-8859-1?q?KIBQQpnfmqMwueBaOUTjmBV+wH02m5LAxwiQjYV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so-8859-1?q?iVhCG/sRD+01JKDp0c1DhYZR53/o4cHy2UufT8APlQhAEvthzDI8Xdt+rxc1?= =?iso-8859-1?q?SoLt5glv8=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 09525C61DB x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(396003)(346002)(136003)(376002)(39860400002)(199004)(189003)(110136005)(256004)(11346002)(52116002)(446003)(76176011)(386003)(8936002)(99286004)(54906003)(1076003)(316002)(2616005)(14444005)(106356001)(305945005)(186003)(97736004)(105586002)(476003)(36756003)(26005)(486006)(53936002)(107886003)(66066001)(71200400001)(71190400001)(6506007)(81166006)(6436002)(81156014)(25786009)(8676002)(2201001)(478600001)(6512007)(4326008)(2501003)(14454004)(50226002)(2906002)(6116002)(3846002)(86362001)(68736007)(6486002)(7736002)(102836004)(72206003)(5660300002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR11MB1448; H:CY4PR11MB1256.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: TDEUE6BnMxVsHn1K80eItr+Xmr8KVl4LKJ3FA0Ndwaxrvh8m67XVayB1wy0G6vFOvRLjGtve+bDHSh/TPi7IazH3zujSMKF2V1Z69lfehoOycuLcCJhsr6V9f4KcQ2v/iB3HE/NeWDEXIZR81650PGKYV6hblcOyHN6Urd6BzxdRyCHCA6vFkRBNMSmp9fNrwTZV596BkRHj8VYLEJeGd7Np1xWfvCpk59WgEv9amvXkxE0lFK4V9nLeOAyjIqI4c6epVQGvuBDll4JRmww8eUX7ctUkGJJLuC0ZufGG8p9M9dyJCNT9Q9FHWkBkB0G1N3BD2uYnHG1oXHa2TN+1Gl87DWIgXJFmIzJ38BTGLEsLiqpSEHKIvF/4afx0x4bZCLhNoKVTEVHe445z9cxh1WnJlZsqS6YJpLaJXBCj6A0= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 109e64c2-a0bc-4c40-5310-08d695bb9ceb X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Feb 2019 16:10:32.7681 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1448 X-OriginatorOrg: microchip.com Cc: alsa-devel@alsa-project.org, Codrin.Ciubotariu@microchip.com, linux-kernel@vger.kernel.org Subject: [alsa-devel] [PATCH 4/5] ASoC: codecs: ad193x: Add runtime support for DSP_A and I2S modes X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 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-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Codrin Ciubotariu The driver only supports DPS_A for DAC, which is configured at probe. This patch adds support for DSP_A and I2S modes by using the set_fmt() callback. A trivial break is also removed from a case's default branch. Signed-off-by: Codrin Ciubotariu --- sound/soc/codecs/ad193x.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/ad193x.c b/sound/soc/codecs/ad193x.c index 315ec9775118..f8cf182518a3 100644 --- a/sound/soc/codecs/ad193x.c +++ b/sound/soc/codecs/ad193x.c @@ -188,23 +188,26 @@ static int ad193x_set_dai_fmt(struct snd_soc_dai *codec_dai, { struct ad193x_priv *ad193x = snd_soc_component_get_drvdata(codec_dai->component); unsigned int adc_serfmt = 0; + unsigned int dac_serfmt = 0; unsigned int adc_fmt = 0; unsigned int dac_fmt = 0; /* At present, the driver only support AUX ADC mode(SND_SOC_DAIFMT_I2S - * with TDM) and ADC&DAC TDM mode(SND_SOC_DAIFMT_DSP_A) + * with TDM), ADC&DAC TDM mode(SND_SOC_DAIFMT_DSP_A) and DAC I2S mode + * (SND_SOC_DAIFMT_I2S) */ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_I2S: adc_serfmt |= AD193X_ADC_SERFMT_TDM; + dac_serfmt |= AD193X_DAC_SERFMT_STEREO; break; case SND_SOC_DAIFMT_DSP_A: adc_serfmt |= AD193X_ADC_SERFMT_AUX; + dac_serfmt |= AD193X_DAC_SERFMT_TDM; break; default: if (ad193x_has_adc(ad193x)) return -EINVAL; - break; } switch (fmt & SND_SOC_DAIFMT_INV_MASK) { @@ -261,6 +264,8 @@ static int ad193x_set_dai_fmt(struct snd_soc_dai *codec_dai, regmap_update_bits(ad193x->regmap, AD193X_ADC_CTRL2, AD193X_ADC_FMT_MASK, adc_fmt); } + regmap_update_bits(ad193x->regmap, AD193X_DAC_CTRL0, + AD193X_DAC_SERFMT_MASK, dac_serfmt); regmap_update_bits(ad193x->regmap, AD193X_DAC_CTRL1, AD193X_DAC_FMT_MASK, dac_fmt);