lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <54D4AA3A.8010904@ti.com>
Date:	Fri, 6 Feb 2015 13:49:14 +0200
From:	Peter Ujfalusi <peter.ujfalusi@...com>
To:	Urs Fässler <urs.fassler@...esatwork.ch>,
	<perex@...ex.cz>, <tiwai@...e.de>
CC:	<lgirdwood@...il.com>, <broonie@...nel.org>, <jsarha@...com>,
	<misael.lopez@...com>, <alsa-devel@...a-project.org>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] davinci-mcasp: add option to use AHCLKX pin as clock
 in

On 02/06/2015 11:22 AM, Urs Fässler wrote:
> Signed-off-by: Urs Fässler <urs.fassler@...esatwork.ch>
> ---
>  .../bindings/sound/davinci-mcasp-audio.txt         |  1 +
>  sound/soc/davinci/davinci-mcasp.c                  | 26
> +++++++++++++++++++---
>  2 files changed, 24 insertions(+), 3 deletions(-)
> 
> diff --git
> a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
> b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
> index 46bc982..22a91d2 100644
> --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
> +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
> @@ -39,6 +39,7 @@ Optional properties:
>    		 please refer to pinctrl-bindings.txt
>  - fck_parent : Should contain a valid clock name which will be used as
> parent
>  	       for the McASP fck
> +- ahclkx-pin : if set use AHCLKX pin for clock in instead of ACLKX
>   Example:
>  diff --git a/sound/soc/davinci/davinci-mcasp.c
> b/sound/soc/davinci/davinci-mcasp.c
> index 396cdec..3730288 100644
> --- a/sound/soc/davinci/davinci-mcasp.c
> +++ b/sound/soc/davinci/davinci-mcasp.c
> @@ -85,6 +85,7 @@ struct davinci_mcasp {
>   	int	sysclk_freq;
>  	bool	bclk_master;
> +	bool	ahclkx_pin;
>   	/* McASP FIFO related */
>  	u8	txnumevt;
> @@ -429,7 +430,12 @@ static int davinci_mcasp_set_dai_fmt(struct
> snd_soc_dai *cpu_dai,
>  		break;
>  	case SND_SOC_DAIFMT_CBM_CFS:
>  		/* codec is clock master and frame slave */
> -		mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, ACLKXE);
> +		if (mcasp->ahclkx_pin)
> +			mcasp_set_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG,
> +				ACLKXE);
> +		else
> +			mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG,
> +				ACLKXE);

This is not correct. ACLKXE bit of ACLKXCTL register configures the transmit
bit clock source.
With CBM_CFx it has to be set to 0 (codec is providing the bit clock via ACLKX
pin)
and when CBS_CFx it need to be 1 (McASP will provide the bit clock)

>  		mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, AFSXE);
>   		mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, ACLKRE);
> @@ -441,7 +447,12 @@ static int davinci_mcasp_set_dai_fmt(struct
> snd_soc_dai *cpu_dai,
>  		break;
>  	case SND_SOC_DAIFMT_CBM_CFM:
>  		/* codec is clock and frame master */
> -		mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, ACLKXE);
> +		if (mcasp->ahclkx_pin)
> +			mcasp_set_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG,
> +				ACLKXE);
> +		else
> +			mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG,
> +				ACLKXE);

same here

>  		mcasp_clr_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, AFSXE);
>   		mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, ACLKRE);
> @@ -542,7 +553,12 @@ static int davinci_mcasp_set_sysclk(struct
> snd_soc_dai *dai, int clk_id,
>  	struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai);
>   	if (mcasp->bclk_master) {
> -		mcasp_set_bits(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG, AHCLKXE);
> +		if (mcasp->ahclkx_pin)
> +			mcasp_clr_bits(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG,
> +				AHCLKXE);
> +		else
> +			mcasp_set_bits(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG,
> +				AHCLKXE);

not sure why you need to do this...

You can just select the sysclk (AHCLKX) from the machine driver:
snd_soc_dai_set_sysclk(cpu_dai, 0, sysclk, SND_SOC_CLOCK_IN);


>  		mcasp_set_bits(mcasp, DAVINCI_MCASP_AHCLKRCTL_REG, AHCLKRE);
>  		mcasp_set_bits(mcasp, DAVINCI_MCASP_PDIR_REG, AHCLKX);
>  	} else {
> @@ -1340,6 +1356,8 @@ static struct davinci_mcasp_pdata
> *davinci_mcasp_set_pdata_from_of(
>  	if (ret >= 0)
>  		pdata->sram_size_capture = val;
>  +	pdata->clk_input_pin = of_property_read_bool(np, "ahclkx-pin");
> +
>  	return  pdata;
>   nodata:
> @@ -1412,6 +1430,8 @@ static int davinci_mcasp_probe(struct
> platform_device *pdev)
>  		goto err;
>  	}
>  +	mcasp->ahclkx_pin = pdata->clk_input_pin;
> +
>  	mcasp->op_mode = pdata->op_mode;
>  	/* sanity check for tdm slots parameter */
>  	if (mcasp->op_mode == DAVINCI_MCASP_IIS_MODE) {
> 


-- 
Péter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ