Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1196088 > unrolled thread

[PATCH 1/6] ASoC: fsl_ssi: enable IPG clock during AC'97 reg access

Started by"Maciej S. Szmigiero" <mail@maciej.szmigiero.name>
First post2015-07-30 16:40 +0200
Last post2015-07-30 17:30 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/6] ASoC: fsl_ssi: enable IPG clock during AC'97 reg access "Maciej S. Szmigiero" <mail@maciej.szmigiero.name> - 2015-07-30 16:40 +0200
    Re: [PATCH 1/6] ASoC: fsl_ssi: enable IPG clock during AC'97 reg  access "Maciej S. Szmigiero" <mail@maciej.szmigiero.name> - 2015-07-30 17:30 +0200
    Re: [PATCH 1/6] ASoC: fsl_ssi: enable IPG clock during AC'97 reg access Fabio Estevam <festevam@gmail.com> - 2015-07-30 17:30 +0200

#1196088 — [PATCH 1/6] ASoC: fsl_ssi: enable IPG clock during AC'97 reg access

From"Maciej S. Szmigiero" <mail@maciej.szmigiero.name>
Date2015-07-30 16:40 +0200
Subject[PATCH 1/6] ASoC: fsl_ssi: enable IPG clock during AC'97 reg access
Message-ID<pRXa2-19k-33@gated-at.bofh.it>
IPG clock have to be enabled during AC'97 CODEC register
access in fsl_ssi driver.

Signed-off-by: Maciej Szmigiero <mail@maciej.szmigiero.name>
---
 sound/soc/fsl/fsl_ssi.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 484ff20..8185edc 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -1127,10 +1127,17 @@ static void fsl_ssi_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
 	struct regmap *regs = fsl_ac97_data->regs;
 	unsigned int lreg;
 	unsigned int lval;
+	int ret;
 
 	if (reg > 0x7f)
 		return;
 
+	ret = clk_prepare_enable(fsl_ac97_data->clk);
+	if (ret) {
+		pr_err("ac97 write clk_prepare_enable failed: %d\n",
+			ret);
+		return;
+	}
 
 	lreg = reg <<  12;
 	regmap_write(regs, CCSR_SSI_SACADD, lreg);
@@ -1141,6 +1148,8 @@ static void fsl_ssi_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
 	regmap_update_bits(regs, CCSR_SSI_SACNT, CCSR_SSI_SACNT_RDWR_MASK,
 			CCSR_SSI_SACNT_WR);
 	udelay(100);
+
+	clk_disable_unprepare(fsl_ac97_data->clk);
 }
 
 static unsigned short fsl_ssi_ac97_read(struct snd_ac97 *ac97,
@@ -1151,6 +1160,14 @@ static unsigned short fsl_ssi_ac97_read(struct snd_ac97 *ac97,
 	unsigned short val = -1;
 	u32 reg_val;
 	unsigned int lreg;
+	int ret;
+
+	ret = clk_prepare_enable(fsl_ac97_data->clk);
+	if (ret) {
+		pr_err("ac97 read clk_prepare_enable failed: %d\n",
+			ret);
+		return -1;
+	}
 
 	lreg = (reg & 0x7f) <<  12;
 	regmap_write(regs, CCSR_SSI_SACADD, lreg);
@@ -1162,6 +1179,8 @@ static unsigned short fsl_ssi_ac97_read(struct snd_ac97 *ac97,
 	regmap_read(regs, CCSR_SSI_SACDAT, &reg_val);
 	val = (reg_val >> 4) & 0xffff;
 
+	clk_disable_unprepare(fsl_ac97_data->clk);
+
 	return val;
 }
 

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

[toc] | [next] | [standalone]


#1196127 — Re: [PATCH 1/6] ASoC: fsl_ssi: enable IPG clock during AC'97 reg access

From"Maciej S. Szmigiero" <mail@maciej.szmigiero.name>
Date2015-07-30 17:30 +0200
SubjectRe: [PATCH 1/6] ASoC: fsl_ssi: enable IPG clock during AC'97 reg access
Message-ID<pRXWq-2jR-9@gated-at.bofh.it>
In reply to#1196088
Hi Fabio,

On 30.07.2015 17:20, Fabio Estevam wrote:
> Hi Maciej,
> 
> On Thu, Jul 30, 2015 at 11:33 AM, Maciej S. Szmigiero
> <mail@maciej.szmigiero.name> wrote:
> 
>>  static unsigned short fsl_ssi_ac97_read(struct snd_ac97 *ac97,
>> @@ -1151,6 +1160,14 @@ static unsigned short fsl_ssi_ac97_read(struct snd_ac97 *ac97,
>>         unsigned short val = -1;
>>         u32 reg_val;
>>         unsigned int lreg;
>> +       int ret;
>> +
>> +       ret = clk_prepare_enable(fsl_ac97_data->clk);
>> +       if (ret) {
>> +               pr_err("ac97 read clk_prepare_enable failed: %d\n",
>> +                       ret);
>> +               return -1;
> 
> return ret, please.
> 

This function normal return value is an AC'97 register value,
so isn't more appropriate to return 0xffff in case of error
than linux error code?

Best regards,
Maciej Szmigiero

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

[toc] | [prev] | [next] | [standalone]


#1196132

FromFabio Estevam <festevam@gmail.com>
Date2015-07-30 17:30 +0200
Message-ID<pRXWq-2jR-11@gated-at.bofh.it>
In reply to#1196088
Hi Maciej,

On Thu, Jul 30, 2015 at 11:33 AM, Maciej S. Szmigiero
<mail@maciej.szmigiero.name> wrote:

>  static unsigned short fsl_ssi_ac97_read(struct snd_ac97 *ac97,
> @@ -1151,6 +1160,14 @@ static unsigned short fsl_ssi_ac97_read(struct snd_ac97 *ac97,
>         unsigned short val = -1;
>         u32 reg_val;
>         unsigned int lreg;
> +       int ret;
> +
> +       ret = clk_prepare_enable(fsl_ac97_data->clk);
> +       if (ret) {
> +               pr_err("ac97 read clk_prepare_enable failed: %d\n",
> +                       ret);
> +               return -1;

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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web