From patchwork Mon Feb 18 16:10:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Codrin Ciubotariu X-Patchwork-Id: 10818465 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 226606CB for ; Mon, 18 Feb 2019 16:49:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0CFEB29CCD for ; Mon, 18 Feb 2019 16:49:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0195B29CDA; Mon, 18 Feb 2019 16:49:13 +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 9DD2E29CF2 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 4F9EE265531; Mon, 18 Feb 2019 17:10:48 +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 50B00265532; Mon, 18 Feb 2019 17:10:45 +0100 (CET) Received: from esa1.microchip.iphmx.com (esa1.microchip.iphmx.com [68.232.147.91]) by alsa0.perex.cz (Postfix) with ESMTP id 6320E26552A for ; Mon, 18 Feb 2019 17:10:42 +0100 (CET) X-IronPort-AV: E=Sophos;i="5.58,385,1544511600"; d="scan'208";a="27906383" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 18 Feb 2019 09:10:41 -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:41 -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=7Ez82SpYZyAIQ5xL0qCMe79umRSp3574m5ZKRTm5DPk=; b=nBW1xAQ3Pc1bJxvTDeja+tMdONE/odlp2LyfX1tC4tk2M5hUwe9qfb7G3Jjhuzmv0X1zsrkeOjg+fbwk7UDKu0QdhQUIdnTN3SEBt+7sCOf6D0LXOHJz6Z7AeUnGi0YZ0/d/VAzz5D+Sert0mgvVSLksAEQ4YNq+S0nfB8leDqg= 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:32 +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:32 +0000 From: To: , , Thread-Topic: [PATCH 3/5] ASoC: codecs: ad193x: Fix frame polarity for DSP_A format Thread-Index: AQHUx6R5fns+sZxD40mSbyebg3U5XQ== Date: Mon, 18 Feb 2019 16:10:32 +0000 Message-ID: <20190218160954.13929-4-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: 8290a2d5-538f-4403-6029-08d695bb9b83 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:lhzKQUJi6lLKWihKRtSSxi6B6pB1BI4ipbEsOQS?= =?iso-8859-1?q?p5PeouybyVlp5+x?= =?iso-8859-1?q?l3/UVWSgPmiuK25mfzLeVm7jUfbkFkR7NS98fWbvQb37iKM8bSysSjztt7B6?= =?iso-8859-1?q?6xv2xOLeIFg2MMGMVtu4gKLhPHkLkyQI/8rEXIDwqRsPgQeNYhGwq6RgUZNp?= =?iso-8859-1?q?KDFWA/DG5j4gxopugXWIME7LO7nC1peapejQvuEw80hp3+lwVLHHrSYo8ysU?= =?iso-8859-1?q?ao4jGZzmYngg3BtyZIHWoiW6maJmnuKXZEZBxsvjX0bpRtdo5EU4Ki8MjmKu?= =?iso-8859-1?q?iLZUiG4DM6c31USFGmwBI1OLfzGS/1iZEkGmPqXDlqi8u30MvgG4Dvc6OnvQ?= =?iso-8859-1?q?XnCxEP3PgyK/A3RembkRuZXcU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WcP?= =?iso-8859-1?q?taX7az4cqIItSOjbGSwn25TzuE02ajrum/Gh11GE5LM5o4MKLFB9oA9T2HM6?= =?iso-8859-1?q?HtCU3CTCs=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)(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)(4744005)(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: e8wmC1igKJ9cJX1Pd1eOmfRUu9c3QPCqjh+IqA5Bah/DYKpP4m1dkRScn5VCE0stXZH9DX3zglytvHJYaZy5XqxVQDj48vmhlaDZMbUy98Cgi2I6siLt+bk8w1Cs3epUvjD01p07y/a4cRhPiU/GDAAkidqX4fWhCjvpvvKH+3vrqlO6pO6I12vo+UTVyF7bMT8Ni5vQ5WVLTxCwkPkDvVDw/BDX0YL+deKzjRD0ME/b5iSSWyLneILfZcTBFIcNeOYZXjOnW1PyXDbhnN+cI9yWyp4sp4SFggOrEIVZ8XOtMy6FTIIGAybaNOp0cr9CA+hZ1bnLDZcGIYsbEYCo9l7oYdL2D/HFmo17PVyx/5Hg64a0WOBCjuSqXOVVxJgwK+hWyjswV4cfyY4qlgAyvc8lnVTnefYegDMOJJLqTWk= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 8290a2d5-538f-4403-6029-08d695bb9b83 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Feb 2019 16:10:30.6003 (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 3/5] ASoC: codecs: ad193x: Fix frame polarity for DSP_A format 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 By default, the codec starts to interpret the left (first) channel on the falling edge (low polarity) of LRCLK. However, for DSP_A, the left channel needs to start on the rising edge of LRCLK. This patch fixes this channel swap by toggling the bit which selects the LRCLK polarity. Signed-off-by: Codrin Ciubotariu --- sound/soc/codecs/ad193x.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sound/soc/codecs/ad193x.c b/sound/soc/codecs/ad193x.c index c16c9969d1a0..315ec9775118 100644 --- a/sound/soc/codecs/ad193x.c +++ b/sound/soc/codecs/ad193x.c @@ -228,6 +228,12 @@ static int ad193x_set_dai_fmt(struct snd_soc_dai *codec_dai, return -EINVAL; } + /* For DSP_*, LRCLK's polarity must be inverted */ + if (fmt & SND_SOC_DAIFMT_DSP_A) { + change_bit(ffs(AD193X_DAC_LEFT_HIGH) - 1, + (unsigned long *)&dac_fmt); + } + switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { case SND_SOC_DAIFMT_CBM_CFM: /* codec clk & frm master */ adc_fmt |= AD193X_ADC_LCR_MASTER;