From patchwork Wed Jan 28 14:16:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 5728451 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2B54BBF440 for ; Wed, 28 Jan 2015 14:20:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 55CD0202D1 for ; Wed, 28 Jan 2015 14:20:43 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 3642E2027D for ; Wed, 28 Jan 2015 14:20:42 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 5ADBF2650D4; Wed, 28 Jan 2015 15:20:41 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id E8C7A262600; Wed, 28 Jan 2015 15:18:19 +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 25ED1262618; Wed, 28 Jan 2015 15:18:18 +0100 (CET) Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) by alsa0.perex.cz (Postfix) with ESMTP id CF261262634 for ; Wed, 28 Jan 2015 15:17:41 +0100 (CET) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 77C7A4003C; Wed, 28 Jan 2015 15:17:41 +0100 (CET) Received: from localhost.localdomain (217-210-101-82-no95.business.telia.com [217.210.101.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id 7CF2040004; Wed, 28 Jan 2015 15:17:40 +0100 (CET) From: Peter Rosin To: alsa-devel@alsa-project.org Date: Wed, 28 Jan 2015 15:16:12 +0100 Message-Id: <1422454572-7847-8-git-send-email-peda@lysator.liu.se> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1422454572-7847-1-git-send-email-peda@lysator.liu.se> References: <1422454572-7847-1-git-send-email-peda@lysator.liu.se> X-Virus-Scanned: ClamAV using ClamSMTP Cc: Mark Rutland , devicetree@vger.kernel.org, Lars-Peter Clausen , Pawel Moll , Ian Campbell , Takashi Iwai , linux-kernel@vger.kernel.org, Mark Brown , Clemens Ladisch , Liam Girdwood , Rob Herring , Kumar Gala , Peter Rosin Subject: [alsa-devel] [PATCH v2 7/7] ASoC: pcm512x: Support SND_SOC_DAIFMT_CBM_CFS 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Peter Rosin Signed-off-by: Peter Rosin --- sound/soc/codecs/pcm512x.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c index d46d6cdb6b87..64be85fb2748 100644 --- a/sound/soc/codecs/pcm512x.c +++ b/sound/soc/codecs/pcm512x.c @@ -464,6 +464,7 @@ static int pcm512x_dai_startup(struct snd_pcm_substream *substream, switch (pcm512x->fmt & SND_SOC_DAIFMT_MASTER_MASK) { case SND_SOC_DAIFMT_CBM_CFM: + case SND_SOC_DAIFMT_CBM_CFS: return pcm512x_dai_startup_master(substream, dai); case SND_SOC_DAIFMT_CBS_CFS: @@ -970,6 +971,8 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); int alen; int gpio; + int clock_output; + int master_mode; int ret; dev_dbg(codec->dev, "hw_params %u Hz, %u channels\n", @@ -1018,6 +1021,12 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, } return 0; case SND_SOC_DAIFMT_CBM_CFM: + clock_output = PCM512x_BCKO | PCM512x_LRKO; + master_mode = PCM512x_RLRK | PCM512x_RBCK; + break; + case SND_SOC_DAIFMT_CBM_CFS: + clock_output = PCM512x_BCKO; + master_mode = PCM512x_RBCK; break; default: return -EINVAL; @@ -1114,7 +1123,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, ret = regmap_update_bits(pcm512x->regmap, PCM512x_BCLK_LRCLK_CFG, PCM512x_BCKP | PCM512x_BCKO | PCM512x_LRKO, - PCM512x_BCKO | PCM512x_LRKO); + clock_output); if (ret != 0) { dev_err(codec->dev, "Failed to enable clock output: %d\n", ret); return ret; @@ -1122,7 +1131,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, ret = regmap_update_bits(pcm512x->regmap, PCM512x_MASTER_MODE, PCM512x_RLRK | PCM512x_RBCK, - PCM512x_RLRK | PCM512x_RBCK); + master_mode); if (ret != 0) { dev_err(codec->dev, "Failed to enable master mode: %d\n", ret); return ret;