From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [92.198.50.35]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id F2DA21A005A for ; Wed, 10 Sep 2014 16:21:40 +1000 (EST) Date: Wed, 10 Sep 2014 08:21:18 +0200 From: Markus Pargmann To: Nicolin Chen Subject: Re: [PATCH V1] ASoC: fsl_ssi: refine ipg clock usage in this module Message-ID: <20140910062118.GA26348@pengutronix.de> References: <20140909183804.GA6944@Asurada> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="OXfL5xGRrasGEqWY" In-Reply-To: <20140909183804.GA6944@Asurada> Cc: Shengjiu Wang , alsa-devel@alsa-project.org, lgirdwood@gmail.com, tiwai@suse.de, linux-kernel@vger.kernel.org, broonie@kernel.org, timur@tabi.org, perex@perex.cz, Li.Xiubo@freescale.com, linuxppc-dev@lists.ozlabs.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , --OXfL5xGRrasGEqWY Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 09, 2014 at 11:38:05AM -0700, Nicolin Chen wrote: > On Tue, Sep 09, 2014 at 05:18:07PM +0800, Shengjiu Wang wrote: > > @@ -1321,7 +1333,11 @@ static int fsl_ssi_probe(struct platform_device = *pdev) > > return -ENOMEM; > > } > > =20 > > - ssi_private->regs =3D devm_regmap_init_mmio(&pdev->dev, iomem, > > + if (ssi_private->soc->imx) > > + ssi_private->regs =3D devm_regmap_init_mmio_clk(&pdev->dev, > > + "ipg", iomem, &fsl_ssi_regconfig); > > + else > > + ssi_private->regs =3D devm_regmap_init_mmio(&pdev->dev, iomem, >=20 > As Markus mentioned, the key point here is to be compatible with those > non-clock-name platforms. >=20 > I think it would be safer to keep the current code while adding an extra > clk_disable_unprepare() at the end of probe() as a common routine. And > meantime, make sure to have the call for imx only because it seems that > the other platforms do not depend on the clock. //a bit guessing here :) >=20 > Then we can get a patch like: > open() { > + clk_prepare_enable(); > .... > } >=20 > close() { > .... > + clk_disable_unprepare() > } >=20 > probe() { > clk_get(); > clk_prepare_enable(); > .... > if (xxx) > - goto err_xx; > + return ret; > .... > + clk_disable_unprepare(); > return 0; > -err_xx: > - clk_disable_unprepare() > } >=20 > remove() { > .... > - clk_disable_unprepare() > } If I remember correctly, there may be AC97 communication with the codec before any substream is created. That's why we enable the SSI unit right at the beginning for AC97 in fsl_ssi_setup_reg_vals(). So we need to check for AC97 before disabling clocks. Best regards, Markus --=20 Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | --OXfL5xGRrasGEqWY Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAEBAgAGBQJUD+3eAAoJEEpcgKtcEGQQpIwP/13uS6ra+9yDsKky0JK7ndGC Rh2J1DaRbJLJ3xw0iDbY9FzccLVUCfhyxc1fRtkr4o2fjPztA5fBKv9lj1j0cWpk LhsW4ceHxZECUNOFIq+ZzW8C7dEk9fVYTVGsMeC5phbrGrg0C860B5Sa0S0ZbF8u wRxpKr1GElW0+Z5fXlzhWbORxO5oqKQhMYJoyM9hPdmM51olzI4AtqylgddmbURO jjebQv6XG25rbYdlHgWxjwJ7QjePEdmKC1lATApANItTEZtMtEG9Swm37PS+D+Yf efLXDhWYyw9cj/vSxBoze0cBG90SUaHn10rbjOSlYyYm7of78uisyeG7IFL0h20e +dOaT5YbxC/JDLpjCWOo77aMdrfYmkU9hKlaZXs2XM1N0Eour1zVjPB4TUZVAa0a foE6+66vOkM8XfmHQBEH4z/L7yq/8PIJBtTVBYdN+41/0Ql3cu70OHFKzoXdW+QG GEffwkIOJYts0SAtVRUSb2ZIvIdU8U8SEM335zqOwOy1iPKDtBQa40WAWYJFz/Sy hZyqsb68uW7TZENSh5m24JCwzpxUOg3C7YDoQCmpKTxWjeSIwdhnsMO+0k4C9aXT d1xXFaHh9+mPjmJ+AngG+U2b6Vbd7lxkxcbteGE35XuFHA6+wj5KL43XQmKympFT P4R0PBncjKGHy82hV++M =KAho -----END PGP SIGNATURE----- --OXfL5xGRrasGEqWY--