All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: rsnd: Protect register accesses with a spinlock instead of a mutex
@ 2014-07-23 21:19 ` Laurent Pinchart
  0 siblings, 0 replies; 16+ messages in thread
From: Laurent Pinchart @ 2014-07-23 21:19 UTC (permalink / raw)
  To: alsa-devel; +Cc: linux-sh, Kuninori Morimoto

The hardware registers are accessed from atomic contexts (the
rsnd_soc_dai_trigger function, for instance, is called with the PCM
substream spinlock held). They thus can't be protected by a mutex.

Protect regmap register accesses with a spinlock instead of a mutex by
setting the fast_io flag.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 sound/soc/sh/rcar/gen.c | 1 +
 1 file changed, 1 insertion(+)

An even better solution might be to use regmap-mmio instead of a custom bus.
Morimoto-san, is there anything that would prevent the driver from switching
to regmap-mmio ?

diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index 73ce4c9..ec9ac5e 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -66,6 +66,7 @@ static int rsnd_regmap_read32(void *context,
 }
 
 static struct regmap_bus rsnd_regmap_bus = {
+	.fast_io			= true,
 	.write				= rsnd_regmap_write32,
 	.read				= rsnd_regmap_read32,
 	.reg_format_endian_default	= REGMAP_ENDIAN_NATIVE,
-- 
Regards,

Laurent Pinchart


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH] ASoC: rsnd: Protect register accesses with a spinlock instead of a mutex
@ 2014-07-23 21:19 ` Laurent Pinchart
  0 siblings, 0 replies; 16+ messages in thread
From: Laurent Pinchart @ 2014-07-23 21:19 UTC (permalink / raw)
  To: alsa-devel; +Cc: linux-sh, Kuninori Morimoto

The hardware registers are accessed from atomic contexts (the
rsnd_soc_dai_trigger function, for instance, is called with the PCM
substream spinlock held). They thus can't be protected by a mutex.

Protect regmap register accesses with a spinlock instead of a mutex by
setting the fast_io flag.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 sound/soc/sh/rcar/gen.c | 1 +
 1 file changed, 1 insertion(+)

An even better solution might be to use regmap-mmio instead of a custom bus.
Morimoto-san, is there anything that would prevent the driver from switching
to regmap-mmio ?

diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index 73ce4c9..ec9ac5e 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -66,6 +66,7 @@ static int rsnd_regmap_read32(void *context,
 }
 
 static struct regmap_bus rsnd_regmap_bus = {
+	.fast_io			= true,
 	.write				= rsnd_regmap_write32,
 	.read				= rsnd_regmap_read32,
 	.reg_format_endian_default	= REGMAP_ENDIAN_NATIVE,
-- 
Regards,

Laurent Pinchart


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [alsa-devel] [PATCH] ASoC: rsnd: Protect register accesses with a spinlock instead of a mutex
  2014-07-23 21:19 ` Laurent Pinchart
@ 2014-07-24  0:15   ` Kuninori Morimoto
  -1 siblings, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2014-07-24  0:15 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: alsa-devel, linux-sh


Hi Laurent

> The hardware registers are accessed from atomic contexts (the
> rsnd_soc_dai_trigger function, for instance, is called with the PCM
> substream spinlock held). They thus can't be protected by a mutex.
> 
> Protect regmap register accesses with a spinlock instead of a mutex by
> setting the fast_io flag.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
>  sound/soc/sh/rcar/gen.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> An even better solution might be to use regmap-mmio instead of a custom bus.
> Morimoto-san, is there anything that would prevent the driver from switching
> to regmap-mmio ?

I guess it is possilbe to use regmap-mmio.
I check it.

> 
> diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
> index 73ce4c9..ec9ac5e 100644
> --- a/sound/soc/sh/rcar/gen.c
> +++ b/sound/soc/sh/rcar/gen.c
> @@ -66,6 +66,7 @@ static int rsnd_regmap_read32(void *context,
>  }
>  
>  static struct regmap_bus rsnd_regmap_bus = {
> +	.fast_io			= true,
>  	.write				= rsnd_regmap_write32,
>  	.read				= rsnd_regmap_read32,
>  	.reg_format_endian_default	= REGMAP_ENDIAN_NATIVE,
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [alsa-devel] [PATCH] ASoC: rsnd: Protect register accesses with a spinlock instead of a mutex
@ 2014-07-24  0:15   ` Kuninori Morimoto
  0 siblings, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2014-07-24  0:15 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: alsa-devel, linux-sh


Hi Laurent

> The hardware registers are accessed from atomic contexts (the
> rsnd_soc_dai_trigger function, for instance, is called with the PCM
> substream spinlock held). They thus can't be protected by a mutex.
> 
> Protect regmap register accesses with a spinlock instead of a mutex by
> setting the fast_io flag.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
>  sound/soc/sh/rcar/gen.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> An even better solution might be to use regmap-mmio instead of a custom bus.
> Morimoto-san, is there anything that would prevent the driver from switching
> to regmap-mmio ?

I guess it is possilbe to use regmap-mmio.
I check it.

> 
> diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
> index 73ce4c9..ec9ac5e 100644
> --- a/sound/soc/sh/rcar/gen.c
> +++ b/sound/soc/sh/rcar/gen.c
> @@ -66,6 +66,7 @@ static int rsnd_regmap_read32(void *context,
>  }
>  
>  static struct regmap_bus rsnd_regmap_bus = {
> +	.fast_io			= true,
>  	.write				= rsnd_regmap_write32,
>  	.read				= rsnd_regmap_read32,
>  	.reg_format_endian_default	= REGMAP_ENDIAN_NATIVE,
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [alsa-devel] [PATCH] ASoC: rsnd: Protect register accesses with a spinlock instead of a mutex
  2014-07-24  0:15   ` Kuninori Morimoto
@ 2014-07-24  2:16     ` Kuninori Morimoto
  -1 siblings, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2014-07-24  2:16 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Laurent Pinchart, alsa-devel, linux-sh


Hi Laurent

> > The hardware registers are accessed from atomic contexts (the
> > rsnd_soc_dai_trigger function, for instance, is called with the PCM
> > substream spinlock held). They thus can't be protected by a mutex.
> > 
> > Protect regmap register accesses with a spinlock instead of a mutex by
> > setting the fast_io flag.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> >  sound/soc/sh/rcar/gen.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > An even better solution might be to use regmap-mmio instead of a custom bus.
> > Morimoto-san, is there anything that would prevent the driver from switching
> > to regmap-mmio ?
> 
> I guess it is possilbe to use regmap-mmio.
> I check it.

Hmm... rsnd driver is using "regmap_field".
regmap-mmio  requests "offset"  on "reg"
regmap-filed requests "address" on "reg"

So, if rsnd driver uses regmap-mmio,
then, it needs tricky initialize like...

      regmap_init_mmio(dev, 0, config)

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [alsa-devel] [PATCH] ASoC: rsnd: Protect register accesses with a spinlock instead of a mutex
@ 2014-07-24  2:16     ` Kuninori Morimoto
  0 siblings, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2014-07-24  2:16 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Laurent Pinchart, alsa-devel, linux-sh


Hi Laurent

> > The hardware registers are accessed from atomic contexts (the
> > rsnd_soc_dai_trigger function, for instance, is called with the PCM
> > substream spinlock held). They thus can't be protected by a mutex.
> > 
> > Protect regmap register accesses with a spinlock instead of a mutex by
> > setting the fast_io flag.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> >  sound/soc/sh/rcar/gen.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > An even better solution might be to use regmap-mmio instead of a custom bus.
> > Morimoto-san, is there anything that would prevent the driver from switching
> > to regmap-mmio ?
> 
> I guess it is possilbe to use regmap-mmio.
> I check it.

Hmm... rsnd driver is using "regmap_field".
regmap-mmio  requests "offset"  on "reg"
regmap-filed requests "address" on "reg"

So, if rsnd driver uses regmap-mmio,
then, it needs tricky initialize like...

      regmap_init_mmio(dev, 0, config)

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] ASoC: rsnd: Protect register accesses with a spinlock instead of a mutex
  2014-07-23 21:19 ` Laurent Pinchart
@ 2014-07-27 10:36   ` Ben Dooks
  -1 siblings, 0 replies; 16+ messages in thread
From: Ben Dooks @ 2014-07-27 10:36 UTC (permalink / raw)
  To: Laurent Pinchart, alsa-devel; +Cc: linux-sh, Kuninori Morimoto

On 23/07/14 22:19, Laurent Pinchart wrote:
> The hardware registers are accessed from atomic contexts (the
> rsnd_soc_dai_trigger function, for instance, is called with the PCM
> substream spinlock held). They thus can't be protected by a mutex.
> 
> Protect regmap register accesses with a spinlock instead of a mutex by
> setting the fast_io flag.

I reported this ages ago.

I ended up removing regmap entirely, it just locks the machine
solid and provides no useful functionality for the driver.

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] ASoC: rsnd: Protect register accesses with a spinlock instead of a mutex
@ 2014-07-27 10:36   ` Ben Dooks
  0 siblings, 0 replies; 16+ messages in thread
From: Ben Dooks @ 2014-07-27 10:36 UTC (permalink / raw)
  To: Laurent Pinchart, alsa-devel; +Cc: linux-sh, Kuninori Morimoto

On 23/07/14 22:19, Laurent Pinchart wrote:
> The hardware registers are accessed from atomic contexts (the
> rsnd_soc_dai_trigger function, for instance, is called with the PCM
> substream spinlock held). They thus can't be protected by a mutex.
> 
> Protect regmap register accesses with a spinlock instead of a mutex by
> setting the fast_io flag.

I reported this ages ago.

I ended up removing regmap entirely, it just locks the machine
solid and provides no useful functionality for the driver.

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [alsa-devel] [PATCH] ASoC: rsnd: Protect register accesses with a spinlock instead of a mutex
  2014-07-24  2:16     ` Kuninori Morimoto
@ 2014-07-28  5:59       ` Lars-Peter Clausen
  -1 siblings, 0 replies; 16+ messages in thread
From: Lars-Peter Clausen @ 2014-07-28  5:59 UTC (permalink / raw)
  To: Kuninori Morimoto, Kuninori Morimoto
  Cc: alsa-devel, Laurent Pinchart, linux-sh

On 07/24/2014 04:16 AM, Kuninori Morimoto wrote:
>
> Hi Laurent
>
>>> The hardware registers are accessed from atomic contexts (the
>>> rsnd_soc_dai_trigger function, for instance, is called with the PCM
>>> substream spinlock held). They thus can't be protected by a mutex.
>>>
>>> Protect regmap register accesses with a spinlock instead of a mutex by
>>> setting the fast_io flag.
>>>
>>> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
>>> ---
>>>   sound/soc/sh/rcar/gen.c | 1 +
>>>   1 file changed, 1 insertion(+)
>>>
>>> An even better solution might be to use regmap-mmio instead of a custom bus.
>>> Morimoto-san, is there anything that would prevent the driver from switching
>>> to regmap-mmio ?
>>
>> I guess it is possilbe to use regmap-mmio.
>> I check it.
>
> Hmm... rsnd driver is using "regmap_field".
> regmap-mmio  requests "offset"  on "reg"
> regmap-filed requests "address" on "reg"
>
> So, if rsnd driver uses regmap-mmio,
> then, it needs tricky initialize like...
>
>        regmap_init_mmio(dev, 0, config)
>

Create one regmap instance per base address and in the regmap_fields use an 
relative offset to the base address rather than the absolute address. That's 
how the API is intended to be used, the current implementation is quite a hack.

- Lars


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [alsa-devel] [PATCH] ASoC: rsnd: Protect register accesses with a spinlock instead of a mutex
@ 2014-07-28  5:59       ` Lars-Peter Clausen
  0 siblings, 0 replies; 16+ messages in thread
From: Lars-Peter Clausen @ 2014-07-28  5:59 UTC (permalink / raw)
  To: Kuninori Morimoto, Kuninori Morimoto
  Cc: alsa-devel, Laurent Pinchart, linux-sh

On 07/24/2014 04:16 AM, Kuninori Morimoto wrote:
>
> Hi Laurent
>
>>> The hardware registers are accessed from atomic contexts (the
>>> rsnd_soc_dai_trigger function, for instance, is called with the PCM
>>> substream spinlock held). They thus can't be protected by a mutex.
>>>
>>> Protect regmap register accesses with a spinlock instead of a mutex by
>>> setting the fast_io flag.
>>>
>>> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
>>> ---
>>>   sound/soc/sh/rcar/gen.c | 1 +
>>>   1 file changed, 1 insertion(+)
>>>
>>> An even better solution might be to use regmap-mmio instead of a custom bus.
>>> Morimoto-san, is there anything that would prevent the driver from switching
>>> to regmap-mmio ?
>>
>> I guess it is possilbe to use regmap-mmio.
>> I check it.
>
> Hmm... rsnd driver is using "regmap_field".
> regmap-mmio  requests "offset"  on "reg"
> regmap-filed requests "address" on "reg"
>
> So, if rsnd driver uses regmap-mmio,
> then, it needs tricky initialize like...
>
>        regmap_init_mmio(dev, 0, config)
>

Create one regmap instance per base address and in the regmap_fields use an 
relative offset to the base address rather than the absolute address. That's 
how the API is intended to be used, the current implementation is quite a hack.

- Lars


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [alsa-devel] [PATCH] ASoC: rsnd: Protect register accesses with a spinlock instead of a mutex
  2014-07-28  5:59       ` Lars-Peter Clausen
@ 2014-07-28  7:40         ` Kuninori Morimoto
  -1 siblings, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2014-07-28  7:40 UTC (permalink / raw)
  To: Mark Brown, Lars-Peter Clausen
  Cc: Linux-SH, Linux-ALSA, Laurent Pinchart, Kuninori Morimoto


Hi Lars
# added Mark

> > Hmm... rsnd driver is using "regmap_field".
> > regmap-mmio  requests "offset"  on "reg"
> > regmap-filed requests "address" on "reg"
> >
> > So, if rsnd driver uses regmap-mmio,
> > then, it needs tricky initialize like...
> >
> >        regmap_init_mmio(dev, 0, config)
> >
> 
> Create one regmap instance per base address and in the regmap_fields use an 
> relative offset to the base address rather than the absolute address. That's 
> how the API is intended to be used, the current implementation is quite a hack.

Hmm...
But it (= base address mapping was not fixed between Gen1 and Gen2)
was the reason why I was asked to use regmap_fields


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [alsa-devel] [PATCH] ASoC: rsnd: Protect register accesses with a spinlock instead of a mutex
@ 2014-07-28  7:40         ` Kuninori Morimoto
  0 siblings, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2014-07-28  7:40 UTC (permalink / raw)
  To: Mark Brown, Lars-Peter Clausen
  Cc: Linux-SH, Linux-ALSA, Laurent Pinchart, Kuninori Morimoto


Hi Lars
# added Mark

> > Hmm... rsnd driver is using "regmap_field".
> > regmap-mmio  requests "offset"  on "reg"
> > regmap-filed requests "address" on "reg"
> >
> > So, if rsnd driver uses regmap-mmio,
> > then, it needs tricky initialize like...
> >
> >        regmap_init_mmio(dev, 0, config)
> >
> 
> Create one regmap instance per base address and in the regmap_fields use an 
> relative offset to the base address rather than the absolute address. That's 
> how the API is intended to be used, the current implementation is quite a hack.

Hmm...
But it (= base address mapping was not fixed between Gen1 and Gen2)
was the reason why I was asked to use regmap_fields


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [alsa-devel] [PATCH] ASoC: rsnd: Protect register accesses with a spinlock instead of a mutex
  2014-07-28  7:40         ` Kuninori Morimoto
@ 2014-07-28  8:03           ` Lars-Peter Clausen
  -1 siblings, 0 replies; 16+ messages in thread
From: Lars-Peter Clausen @ 2014-07-28  8:03 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown
  Cc: Linux-SH, Linux-ALSA, Laurent Pinchart, Kuninori Morimoto

On 07/28/2014 09:40 AM, Kuninori Morimoto wrote:
>
> Hi Lars
> # added Mark
>
>>> Hmm... rsnd driver is using "regmap_field".
>>> regmap-mmio  requests "offset"  on "reg"
>>> regmap-filed requests "address" on "reg"
>>>
>>> So, if rsnd driver uses regmap-mmio,
>>> then, it needs tricky initialize like...
>>>
>>>         regmap_init_mmio(dev, 0, config)
>>>
>>
>> Create one regmap instance per base address and in the regmap_fields use an
>> relative offset to the base address rather than the absolute address. That's
>> how the API is intended to be used, the current implementation is quite a hack.
>
> Hmm...
> But it (= base address mapping was not fixed between Gen1 and Gen2)
> was the reason why I was asked to use regmap_fields
>

I think that is fine. But you are only using a single regmap instance even 
though there are multiple unrelated register maps used and then you specify 
the offset in the regmap_fields as a absolute address. This is supposed to 
be a relative offset to the base address.

So basically use: ".reg = offset" instead of ".reg = (unsigned 
int)gen->base[reg_id] + offset" and when creating the field instead of 
passing a global regmap instance pass the regmap instance for the register 
map in who's range the register falls.


- Lars

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [alsa-devel] [PATCH] ASoC: rsnd: Protect register accesses with a spinlock instead of a mutex
@ 2014-07-28  8:03           ` Lars-Peter Clausen
  0 siblings, 0 replies; 16+ messages in thread
From: Lars-Peter Clausen @ 2014-07-28  8:03 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown
  Cc: Linux-SH, Linux-ALSA, Laurent Pinchart, Kuninori Morimoto

On 07/28/2014 09:40 AM, Kuninori Morimoto wrote:
>
> Hi Lars
> # added Mark
>
>>> Hmm... rsnd driver is using "regmap_field".
>>> regmap-mmio  requests "offset"  on "reg"
>>> regmap-filed requests "address" on "reg"
>>>
>>> So, if rsnd driver uses regmap-mmio,
>>> then, it needs tricky initialize like...
>>>
>>>         regmap_init_mmio(dev, 0, config)
>>>
>>
>> Create one regmap instance per base address and in the regmap_fields use an
>> relative offset to the base address rather than the absolute address. That's
>> how the API is intended to be used, the current implementation is quite a hack.
>
> Hmm...
> But it (= base address mapping was not fixed between Gen1 and Gen2)
> was the reason why I was asked to use regmap_fields
>

I think that is fine. But you are only using a single regmap instance even 
though there are multiple unrelated register maps used and then you specify 
the offset in the regmap_fields as a absolute address. This is supposed to 
be a relative offset to the base address.

So basically use: ".reg = offset" instead of ".reg = (unsigned 
int)gen->base[reg_id] + offset" and when creating the field instead of 
passing a global regmap instance pass the regmap instance for the register 
map in who's range the register falls.


- Lars

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [alsa-devel] [PATCH] ASoC: rsnd: Protect register accesses with a spinlock instead of a mutex
  2014-07-28  8:03           ` Lars-Peter Clausen
@ 2014-07-28  8:33             ` Kuninori Morimoto
  -1 siblings, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2014-07-28  8:33 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Mark Brown, Linux-SH, Linux-ALSA, Laurent Pinchart, Kuninori Morimoto


Hi Lars

> > But it (= base address mapping was not fixed between Gen1 and Gen2)
> > was the reason why I was asked to use regmap_fields
> >
> 
> I think that is fine. But you are only using a single regmap instance even 
> though there are multiple unrelated register maps used and then you specify 
> the offset in the regmap_fields as a absolute address. This is supposed to 
> be a relative offset to the base address.
> 
> So basically use: ".reg = offset" instead of ".reg = (unsigned 
> int)gen->base[reg_id] + offset" and when creating the field instead of 
> passing a global regmap instance pass the regmap instance for the register 
> map in who's range the register falls.

Hmm... I re-checked it, and I could understand.
And, indeed it was hackish.
OK, I try to modify it, then, it seems can use regmap-mmio.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [alsa-devel] [PATCH] ASoC: rsnd: Protect register accesses with a spinlock instead of a mutex
@ 2014-07-28  8:33             ` Kuninori Morimoto
  0 siblings, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2014-07-28  8:33 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Mark Brown, Linux-SH, Linux-ALSA, Laurent Pinchart, Kuninori Morimoto


Hi Lars

> > But it (= base address mapping was not fixed between Gen1 and Gen2)
> > was the reason why I was asked to use regmap_fields
> >
> 
> I think that is fine. But you are only using a single regmap instance even 
> though there are multiple unrelated register maps used and then you specify 
> the offset in the regmap_fields as a absolute address. This is supposed to 
> be a relative offset to the base address.
> 
> So basically use: ".reg = offset" instead of ".reg = (unsigned 
> int)gen->base[reg_id] + offset" and when creating the field instead of 
> passing a global regmap instance pass the regmap instance for the register 
> map in who's range the register falls.

Hmm... I re-checked it, and I could understand.
And, indeed it was hackish.
OK, I try to modify it, then, it seems can use regmap-mmio.


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2014-07-28  8:33 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-23 21:19 [PATCH] ASoC: rsnd: Protect register accesses with a spinlock instead of a mutex Laurent Pinchart
2014-07-23 21:19 ` Laurent Pinchart
2014-07-24  0:15 ` [alsa-devel] " Kuninori Morimoto
2014-07-24  0:15   ` Kuninori Morimoto
2014-07-24  2:16   ` Kuninori Morimoto
2014-07-24  2:16     ` Kuninori Morimoto
2014-07-28  5:59     ` Lars-Peter Clausen
2014-07-28  5:59       ` Lars-Peter Clausen
2014-07-28  7:40       ` Kuninori Morimoto
2014-07-28  7:40         ` Kuninori Morimoto
2014-07-28  8:03         ` Lars-Peter Clausen
2014-07-28  8:03           ` Lars-Peter Clausen
2014-07-28  8:33           ` Kuninori Morimoto
2014-07-28  8:33             ` Kuninori Morimoto
2014-07-27 10:36 ` Ben Dooks
2014-07-27 10:36   ` Ben Dooks

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.