Message ID | 20230705190324.355282-3-andreas@kemnade.info |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp2096711vqx; Wed, 5 Jul 2023 12:43:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7S5sG2S6FQGq7LteljSwQuC7ZqqLRCWsuSZf9nN66ophdN7ZQ5GxNmU/1/MBiOrlBsN/fk X-Received: by 2002:a9d:741a:0:b0:6b5:ed7a:1769 with SMTP id n26-20020a9d741a000000b006b5ed7a1769mr17016326otk.16.1688586189818; Wed, 05 Jul 2023 12:43:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688586189; cv=none; d=google.com; s=arc-20160816; b=vOc/niy9nCmJccVV42utEroGChJdMMEsLBciyx20tCfkURBHdRGz3C4juq7zeSolci ixPYqHb9PtbSBFVcgpV4cRlZBawYfkXjBTPPBrflcCZ97iYE5Nx992qmWwDbXZrGpA2K feUcBMETCTz9CVnymgNtA5IR9b83AEY1mXo4sL8zovxM6O/wGeRHnZJAezAommqduG0O BSGV2BX3PxSwbyz3ZTcVtuZCWTrM4Zsz+VoNOp5hJX4aME4TdiRHA+jx8A7LW2ezf/x7 tJ3TLuZNUYXI+jX4ZaVai3rdR6glHaSkeuX7DCJdOKnohp+5PNUoQM0S+S5rxc0RYJ9d Uv+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from; bh=dwMzYE2He4immy06bKLKQcEG7R9QEjZEQ8H5giGhVsM=; fh=k7VoT2L8jBkp/srhzriYpHmGaQcD33boGmUYQ969TJw=; b=gJ++81mV7Kvwo1mKpvMyWqH7uitZBZa2rjXXNhTuIbXE2rYaz38CiZcWNaEIPF9N7A UPAlxJFc3ub9H9sZ/kPPfo7a/bv4x62UX3QXXCc/vEZwjlPo1REhbjJNeAQAkPKMiKpL lzvgezAOjqubPBaRkT3QUJyD+AofQGQCsHMIY2i+VFFDQO37b1kM09C0sms1qAsiWITT WPnXeJL07cdXqX+0FF86a39PmkOlcFGJibCglZMgkZBRAg7LzAkFqxa+xtMy271IYjcg XfL1bGfncgSLqSdgUswH6M+sp/BPPd+9xN+enkBSLDHAa/wj/YiPHsTxHvWeXQoGOuve rGOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g124-20020a636b82000000b0055acc9229a4si20308557pgc.803.2023.07.05.12.42.57; Wed, 05 Jul 2023 12:43:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233413AbjGETFE (ORCPT <rfc822;tebrre53rla2o@gmail.com> + 99 others); Wed, 5 Jul 2023 15:05:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233635AbjGETED (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 5 Jul 2023 15:04:03 -0400 Received: from mail.andi.de1.cc (mail.andi.de1.cc [IPv6:2a02:c205:3004:2154::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8182C1FEC; Wed, 5 Jul 2023 12:03:40 -0700 (PDT) Received: from p200300ccff0adc001a3da2fffebfd33a.dip0.t-ipconnect.de ([2003:cc:ff0a:dc00:1a3d:a2ff:febf:d33a] helo=aktux) by mail.andi.de1.cc with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from <andreas@kemnade.info>) id 1qH7mi-0017Xs-Te; Wed, 05 Jul 2023 21:03:28 +0200 Received: from andi by aktux with local (Exim 4.96) (envelope-from <andreas@kemnade.info>) id 1qH7mi-001UQp-1o; Wed, 05 Jul 2023 21:03:28 +0200 From: Andreas Kemnade <andreas@kemnade.info> To: bcousson@baylibre.com, tony@atomide.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, peter.ujfalusi@gmail.com, jarkko.nikula@bitmer.com, dmitry.torokhov@gmail.com, andreas@kemnade.info, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH 2/3] ASoC: tlv320aic3x: use BCLK instead of MCLK if not in master mode Date: Wed, 5 Jul 2023 21:03:23 +0200 Message-Id: <20230705190324.355282-3-andreas@kemnade.info> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230705190324.355282-1-andreas@kemnade.info> References: <20230705190324.355282-1-andreas@kemnade.info> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770610850031986484?= X-GMAIL-MSGID: =?utf-8?q?1770610952406110673?= |
Series |
ARM: omap4: embt2ws: Add audio support
|
|
Commit Message
Andreas Kemnade
July 5, 2023, 7:03 p.m. UTC
Required to have audio output on Epson Moverio BT-200.
Audio chip there is marked with AC31051. Audio output is silent there
without that clock register set.
Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
sound/soc/codecs/tlv320aic3x.c | 4 ++++
1 file changed, 4 insertions(+)
Comments
On Wed, 5 Jul 2023 20:21:58 +0100 Mark Brown <broonie@kernel.org> wrote: > On Wed, Jul 05, 2023 at 09:03:23PM +0200, Andreas Kemnade wrote: > > > + /* probably no mclk if not master, so rely on bitclk */ > > + if (!aic3x->master) > > + clk_id = 2; > > + > > This is fairly clearly a massive hack, we're just silently ignoring the > clock we were asked to configure and choosing another one which is > likely at a different rate to that we were expecting and sadly the > driver didn't provide an automatic mode due to how old it is. We also > appear to try to use the configured clock rate during PLL setup which > still happens in hw_params() even with this change which is a bit of a > concern here. Are you sure hw_params ends up doing the right thing, and > that there are no other systems that get broken by this (perhaps ones > sending a lower BCLK for example)? Yes, I am not that happy myself with that one. Possible victim is keystone-k2g-evm.dts. I looked for if (master) things and found the pll enable/disable connected to it. But that is not the whole story... > > It would be nicer to set the clock via the DT bindings, ideally with the > clock bindings... I found no path from these simple-audio-card things to provide a clk_id to set_dai_sysclk. I would of course prefer such a thing. Do I have overlooked something? Regards, Andreas
On Wed, Jul 05, 2023 at 09:56:11PM +0200, Andreas Kemnade wrote: > Mark Brown <broonie@kernel.org> wrote: > > It would be nicer to set the clock via the DT bindings, ideally with the > > clock bindings... > I found no path from these simple-audio-card things to provide a clk_id > to set_dai_sysclk. I would of course prefer such a thing. Do I have overlooked > something? Since we already have clock bindings we should use those to configure the clocks, there's several drivers that have added this support already - look for clock providers.
Hi, On Thu, 6 Jul 2023 13:02:36 +0100 Mark Brown <broonie@kernel.org> wrote: > On Wed, Jul 05, 2023 at 09:56:11PM +0200, Andreas Kemnade wrote: > > Mark Brown <broonie@kernel.org> wrote: > > > > It would be nicer to set the clock via the DT bindings, ideally with the > > > clock bindings... > > > I found no path from these simple-audio-card things to provide a clk_id > > to set_dai_sysclk. I would of course prefer such a thing. Do I have overlooked > > something? > > Since we already have clock bindings we should use those to configure > the clocks, there's several drivers that have added this support already > - look for clock providers. ok, looking around: Just to make sure I am not running in a bad direction: Do you think tlv320aic32x4{,-clk}.c is a good example? It is ignoring clk_id. I was mentally bound to have to use clk_id there, so I did not found a good solution. So I guess I have to configure the chip as a master and using mclk and compare register dumps with the state we have now and the state after the changes, additionally to check bclk functionality directly. Regards, Andreas
On Sat, Jul 08, 2023 at 03:03:19PM +0200, Andreas Kemnade wrote: > Mark Brown <broonie@kernel.org> wrote: > > Since we already have clock bindings we should use those to configure > > the clocks, there's several drivers that have added this support already > > - look for clock providers. > ok, looking around: > Just to make sure I am not running in a bad direction: Do you think > tlv320aic32x4{,-clk}.c is a good example? It is ignoring clk_id. > I was mentally bound to have to use clk_id there, so I did not found a good > solution. Yes, that looks like a good example - the whole thing here is to move away from using clk_id and to using the clock API to specify clocks. > So I guess I have to configure the chip as a master and using mclk and compare > register dumps with the state we have now and the state after the changes, > additionally to check bclk functionality directly. You can probably get away with less but it's goot to be thorough.
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index 56e795a00e22f..87929e210b55e 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c @@ -1234,6 +1234,10 @@ static int aic3x_set_dai_sysclk(struct snd_soc_dai *codec_dai, struct snd_soc_component *component = codec_dai->component; struct aic3x_priv *aic3x = snd_soc_component_get_drvdata(component); + /* probably no mclk if not master, so rely on bitclk */ + if (!aic3x->master) + clk_id = 2; + /* set clock on MCLK or GPIO2 or BCLK */ snd_soc_component_update_bits(component, AIC3X_CLKGEN_CTRL_REG, PLLCLK_IN_MASK, clk_id << PLLCLK_IN_SHIFT);