From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27EEDC54EE9 for ; Thu, 8 Sep 2022 16:36:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229938AbiIHQgl (ORCPT ); Thu, 8 Sep 2022 12:36:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229505AbiIHQgi (ORCPT ); Thu, 8 Sep 2022 12:36:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFE10D570E; Thu, 8 Sep 2022 09:36:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 957A6B818B5; Thu, 8 Sep 2022 16:36:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D8FEC433C1; Thu, 8 Sep 2022 16:36:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662654994; bh=z+EAy5tr+0u3cXH5bl2QTwxzn2sBd84H77A80gvaElU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=alCtEdhdRgiGW9ouvPeAWzLHKBgiFcKflgrGN4umL8ZgvwlCt/vuOHyxMsZlaOknf 6r9awQI3KJ/7JMagoAP2TYbUZN+ihpRJrrqBzXa0775dC/zJbek88ugWWH8ijBKMDC SUC1n4tLJ6YaGJCuyYtOMcnKMI3iUxNLqChE4V+nIxwxlaG4jwtRkgHCczbCOAEqhJ JjMm9OSWn4KDv5OWHKig1nleHbxkCmn3AcoAW7Wg6MUXy6vvE+a8ecf7NZ12roYK26 S6toLc9x/ERxzgQLxng2NdgAf1E69bbExqT0yMCbsK+y0EZw6pF++kBtjsMRAhrnVB MjlSz3kQONVtA== Date: Thu, 8 Sep 2022 17:36:27 +0100 From: Mark Brown To: luca.ceresoli@bootlin.com Cc: alsa-devel@alsa-project.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Liam Girdwood , Rob Herring , Krzysztof Kozlowski , Heiko Stuebner , Jaroslav Kysela , Takashi Iwai , Nicolas Frattaroli , Philipp Zabel , Johan Jonker , Chris Morgan Subject: Re: [PATCH 5/8] ASoC: rockchip: i2s-tdm: Fix clk_id usage in .set_sysclk() Message-ID: References: <20220907142124.2532620-1-luca.ceresoli@bootlin.com> <20220907142124.2532620-6-luca.ceresoli@bootlin.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="n9PmSJv+Ru1ZxyoW" Content-Disposition: inline In-Reply-To: <20220907142124.2532620-6-luca.ceresoli@bootlin.com> X-Cookie: Metermaids eat their young. Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --n9PmSJv+Ru1ZxyoW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Sep 07, 2022 at 04:21:21PM +0200, luca.ceresoli@bootlin.com wrote: > -static int rockchip_i2s_tdm_set_sysclk(struct snd_soc_dai *cpu_dai, int stream, > +static int rockchip_i2s_tdm_set_sysclk(struct snd_soc_dai *cpu_dai, int clk_id, > unsigned int freq, int dir) > { > struct rk_i2s_tdm_dev *i2s_tdm = to_info(cpu_dai); > @@ -978,15 +981,18 @@ static int rockchip_i2s_tdm_set_sysclk(struct snd_soc_dai *cpu_dai, int stream, > if (i2s_tdm->clk_trcm) { > i2s_tdm->mclk_tx_freq = freq; > i2s_tdm->mclk_rx_freq = freq; > + > + dev_dbg(i2s_tdm->dev, "mclk freq: %u", freq); > } else { > - if (stream == SNDRV_PCM_STREAM_PLAYBACK) > + if (clk_id == CLK_IDX_MCLK_TX) > i2s_tdm->mclk_tx_freq = freq; > - else > + else if (clk_id == CLK_IDX_MCLK_RX) > i2s_tdm->mclk_rx_freq = freq; > - } > + else > + return -ENOTSUPP; This should be a switch statement for clarity and exensibility. --n9PmSJv+Ru1ZxyoW Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmMaGgoACgkQJNaLcl1U h9AUXwf/Ybq47bEk4QDfoPEAToGlvieUKHsFJ8BDFyusjrLmwXm1GWgzWOuF7VuB rAHrRYsRWOIXHMW6oVOf+Zlll9w1n292d2eyelotnTsvAAgBi/vG6g4OmOtTD3I9 W9rPB2x+xkR2rz/sQd/hbGxPxa6sU0ymEX5ScOuA9NejRSr3Y0t/GgY3LWOCKJsC 2U9Oj5P/qX4qPDo/6Qf7ybfVr7jXwWsatgIzX5DyRpbKbvk9JbDMv5dssp9VStUU Q998qqb8+Reec2p62tuZd8JpotC3OVhkiSTcHeO0UCgcuLCz+QQ3PPxgESe9BQWG wUSmVEs8J1Ushh+d+5shIT+ZQyBApA== =MFhn -----END PGP SIGNATURE----- --n9PmSJv+Ru1ZxyoW--