From patchwork Tue Jan 30 11:10:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ladislav Michl X-Patchwork-Id: 10191709 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AD7E4601A0 for ; Tue, 30 Jan 2018 11:10:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A230828738 for ; Tue, 30 Jan 2018 11:10:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 93D772899D; Tue, 30 Jan 2018 11:10:59 +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=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY 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 C21D728738 for ; Tue, 30 Jan 2018 11:10:58 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 1846A2675BA; Tue, 30 Jan 2018 12:10:57 +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 7A7882675BD; Tue, 30 Jan 2018 12:10:55 +0100 (CET) Received: from cvs.linux-mips.org (eddie.linux-mips.org [148.251.95.138]) by alsa0.perex.cz (Postfix) with ESMTP id 0E21F2675B6 for ; Tue, 30 Jan 2018 12:10:40 +0100 (CET) Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23994711AbeA3LKknen80 (ORCPT ); Tue, 30 Jan 2018 12:10:40 +0100 Date: Tue, 30 Jan 2018 12:10:33 +0100 From: Ladislav Michl To: alsa-devel@alsa-project.org Message-ID: <20180130111033.GG18123@lenoch> References: <20180130110604.GA18123@lenoch> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180130110604.GA18123@lenoch> User-Agent: Mutt/1.9.3 (2018-01-21) Cc: Charles Keepax , Alexandre Belloni , Nicolas Ferre , Kuninori Morimoto , anish kumar Subject: [alsa-devel] [PATCH 6/7] ASoC: max9867: Fix BSEL value in master mode. 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 Signed-off-by: Ladislav Michl --- Note: It should be reconsidered where BSEL should be set. sound/soc/codecs/max9867.c | 43 +++---------------------------------------- 1 file changed, 3 insertions(+), 40 deletions(-) diff --git a/sound/soc/codecs/max9867.c b/sound/soc/codecs/max9867.c index 026b7cf94910..6272cf5df4a9 100644 --- a/sound/soc/codecs/max9867.c +++ b/sound/soc/codecs/max9867.c @@ -148,46 +148,6 @@ static int max9867_dai_hw_params(struct snd_pcm_substream *substream, MAX9867_RAPID_LOCK, MAX9867_RAPID_LOCK); regmap_update_bits(max9867->regmap, MAX9867_AUDIOCLKHIGH, MAX9867_PLL, MAX9867_PLL); - } else { - unsigned long int bclk_rate, pclk_bclk_ratio; - int bclk_value; - - bclk_rate = params_rate(params) * 2 * params_width(params); - pclk_bclk_ratio = max9867->pclk/bclk_rate; - switch (params_width(params)) { - case 8: - case 16: - switch (pclk_bclk_ratio) { - case 2: - bclk_value = MAX9867_IFC1B_PCLK_2; - break; - case 4: - bclk_value = MAX9867_IFC1B_PCLK_4; - break; - case 8: - bclk_value = MAX9867_IFC1B_PCLK_8; - break; - case 16: - bclk_value = MAX9867_IFC1B_PCLK_16; - break; - default: - dev_err(codec->dev, - "unsupported sampling rate\n"); - return -EINVAL; - } - break; - case 24: - bclk_value = MAX9867_IFC1B_24BIT; - break; - case 32: - bclk_value = MAX9867_IFC1B_32BIT; - break; - default: - dev_err(codec->dev, "unsupported sampling rate\n"); - return -EINVAL; - } - regmap_update_bits(max9867->regmap, MAX9867_IFC1B, - MAX9867_IFC1B_BCLK_MASK, bclk_value); } return 0; } @@ -244,6 +204,9 @@ static int max9867_set_dai_sysclk(struct snd_soc_dai *codec_dai, value &= ~MAX9867_FREQ_MASK; regmap_update_bits(max9867->regmap, MAX9867_SYSCLK, MAX9867_PSCLK_MASK, value); + regmap_update_bits(max9867->regmap, MAX9867_IFC1B, + MAX9867_IFC1B_BCLK_MASK, 0x010); + return 0; }