From: Mark Brown Subject: Re: [PATCHv2 1/8] ALSA: Add SAI SoC Digital Audio Interface driver. Date: Mon, 4 Nov 2013 08:15:37 -0800 Message-ID: <20131104161537.GI2493@sirena.org.uk> References: <1383289495-24523-1-git-send-email-Li.Xiubo@freescale.com> <1383289495-24523-2-git-send-email-Li.Xiubo@freescale.com> <20131101182514.GE2493@sirena.org.uk> <1DD289F6464F0949A2FCA5AA6DC23F8287439D@039-SN2MPN1-013.039d.mgd.msft.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4958729407327593446==" Return-path: In-Reply-To: <1DD289F6464F0949A2FCA5AA6DC23F8287439D@039-SN2MPN1-013.039d.mgd.msft.net> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Li Xiubo Cc: "mark.rutland@arm.com" , "alsa-devel@alsa-project.org" , "linux-doc@vger.kernel.org" , "tiwai@suse.de" , Huan Wang , "timur@tabi.org" , "perex@perex.cz" , Shawn Guo , "LW@KARO-electronics.de" , "linux@arm.linux.org.uk" , Guangyu Chen , "linux-arm-kernel@lists.infradead.org" , "grant.likely@linaro.org" , "devicetree@vger.kernel.org" , "ian.campbell@citrix.com" , "pawel.moll@arm.com" , "swarren@wwwdotorg.org" , "rob.herring@calxeda.com" , oskar@scara.com List-Id: alsa-devel@alsa-project.org --===============4958729407327593446== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="9jVH9MMcXWLfwoO6" Content-Disposition: inline --9jVH9MMcXWLfwoO6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Nov 04, 2013 at 07:35:12AM +0000, Li Xiubo wrote: > From the ASoC subsystem comments we can see that: > ++++++ > Configures the clock dividers. This is used to derive the best DAI bit and > frame clocks from the system or master clock. It's best to set the DAI bit > and frame clocks as low as possible to save system power. > ------ You should never use this unless you have to, there is no point in every single machine driver using your driver having to duplicate the same calculations. >=20 > > > +static int fsl_sai_dai_probe(struct snd_soc_dai *dai) { > > > + int ret; > > > + struct fsl_sai *sai =3D dev_get_drvdata(dai->dev); > > > + > > > + ret =3D clk_prepare_enable(sai->clk); > > > + if (ret) > > > + return ret; > > It'd be nicer to only enable the clock while the device is in active us= e. > While if the module clock is not enabled here, the followed registers can= not read/write in the same function. > And this _probe function is the _dai_probe not the driver's module _probe. So you can enable the clock when you explicitly need to write to the registers... > If the clk_prepare_enable(sai->clk) is not here, where should it be will = be nicer ? > One of the following functions ? > .set_sysclk =3D fsl_sai_set_dai_sysclk, > .set_clkdiv =3D fsl_sai_set_dai_clkdiv, > .set_fmt =3D fsl_sai_set_dai_fmt, > .set_tdm_slot =3D fsl_sai_set_dai_tdm_slot, > .hw_params =3D fsl_sai_hw_params, > .trigger =3D fsl_sai_trigger, It could be in any or all of them except trigger (where the core should hold a runtime PM reference anyway). You can always take a reference for the duration of the function if you're concerned it may be called when the referent isn't otherwise held. > > > + ret =3D snd_dmaengine_pcm_register(&pdev->dev, NULL, > > > + SND_DMAENGINE_PCM_FLAG_NO_RESIDUE); > > > + if (ret) > > > + return ret; > > We should have a devm_ version of this. > Sorry, is there one patch for adding the devm_ version of snd_dmaengine_p= cm_register() already ? > In the -next and other topics branches I could not find it. No, there isn't one but there should be one. --9jVH9MMcXWLfwoO6 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJSd8gmAAoJELSic+t+oim9AZMQAIefObmkvnzc13/Qx9sJCNa0 47Mt+0tfJFdjadPL6ocKpX0tYxvxdeY30L/zOL7mq8Ehdvdp3PXQHWret3dHovwI w4CYGja+2GenT711PAFfz9jYqlTEj17NhPMsfDc7gf4TSNSt+MztlejKcIpsXO+3 Mcbhl9n4j++Tr2p3PcT60KJEArAJSYxdu0JybxEdSv04dQcLCm3atqnMjJx8/C6W w3HTaHtggsa6fa/hlgMGH9cGghtSPnISCtr60mc8/Kp9xa6p6RHNJx+DMYsDfgf2 OFA84thNFynw6hh54NaBhelaAGGydM2BuybD7C+Tik5V0mS2quFgTVS28EU6YlL8 xzCnt7CgmieVHwsKJ7Aq4tKrAvCf+ojub5mlXJAMnrv3Sp77i9rU94ICu7wGw+UG vQ5bcmeYfLgrfxTtGjo/bp/mhvpI9/oNFJn/8NbiZ++XIjEsLp8VpZoPhMp3orI/ zuK8cfR5oSNVmYvn8xrQCqge1sUziYEJvANqDI3XiqOm5t9LIdrO/1Uc3x2vy7g1 VCcEk14w8HZWKZqu4zBKkiE9ezXSD5ZI1IEGLAM+1o0V1B1+bUuZv8olcPyS0XSq m2j/ch+sbCR6MaHB817WVyICYDS85pOB4VeB1Fk7R5frmiWajqqsyPipZKZT/Kw2 Z3AO4y0D8GQT16dJL1a0 =YZgo -----END PGP SIGNATURE----- --9jVH9MMcXWLfwoO6-- --===============4958729407327593446== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============4958729407327593446==--