mfd: mc13xxx: Don't require lock for simple register I/O
Subsystems (3)
Mark Brown
maintainerPATCH 1/3 mfd: mc13xxx: Don't require lock for simple register I/O
From: Mark Brown <[email protected]>
Since the conversion to regmap there has been no need for device level locking for I/O as regmap provides locking so remove the locks.
--- drivers/mfd/mc13xxx-core.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/mfd/mc13xxx-core.c +0 -5
@@ -158,8 +158,6 @@ int mc13xxx_reg_read(struct mc13xxx *mc13xxx, unsigned int offset, u32 *val) {int ret; -BUG_ON (!mutex_is_locked (&mc13xxx->lock)); -if (offset >MC13XXX_NUMREGS )return -EINVAL ;
@@ -172,8 +170,6 @@ EXPORT_SYMBOL(mc13xxx_reg_read);int mc13xxx_reg_write (struct mc13xxx *mc13xxx,unsigned int offset,u32 val) { -BUG_ON (!mutex_is_locked (&mc13xxx->lock)); -dev_vdbg (mc13xxx->dev,"[0x%02x] <- 0x%06x\n" , offset, val);if (offset >MC13XXX_NUMREGS || val >0xffffff )
@@ -186,7 +182,6 @@ EXPORT_SYMBOL(mc13xxx_reg_write);int mc13xxx_reg_rmw (struct mc13xxx *mc13xxx,unsigned int offset,u32 mask,u32 val) { -BUG_ON (!mutex_is_locked (&mc13xxx->lock));BUG_ON (val & ~mask);dev_vdbg (mc13xxx->dev,"[0x%02x] <- 0x%06x (mask: 0x%06x)\n" , offset, val, mask);
Signature · 1 line
1.8.4.rc3
Mark Brown
maintainerPATCH 2/3 mfd: mc13xxx: Move SPI erratum workaround into SPI I/O function
From: Mark Brown <[email protected]>
Move the workaround for double sending AUDIO_CODEC and AUDIO_DAC writes into the SPI core, aiding refactoring to eliminate the ASoC custom I/O functions and avoiding the extra writes for I2C.
--- drivers/mfd/mc13xxx-spi.c | 5 +++++ include/linux/mfd/mc13xxx.h | 7 +++++++ sound/soc/codecs/mc13783.c | 4 ---- 3 files changed, 12 insertions(+), 4 deletions(-)
drivers/mfd/mc13xxx-spi.c +5 -0
@@ -94,10 +94,15 @@ static int mc13xxx_spi_write(void *context, const void *data, size_t count) {struct device *dev = context;struct spi_device *spi =to_spi_device (dev); +const char *reg = data;if (count !=4 )return -ENOTSUPP ; +/* include errata fix for spi audio problems */ +if (*reg ==MC13783_AUDIO_CODEC || *reg ==MC13783_AUDIO_DAC ) +spi_write (spi, data, count); +return spi_write (spi, data, count); }
include/linux/mfd/mc13xxx.h +7 -0
@@ -41,6 +41,13 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, unsigned int mode, unsigned int channel, u8 ato, bool atox, unsigned int *sample); +#define MC13783_AUDIO_RX0 36 +#define MC13783_AUDIO_RX1 37 +#define MC13783_AUDIO_TX 38 +#define MC13783_SSI_NETWORK 39 +#define MC13783_AUDIO_CODEC 40 +#define MC13783_AUDIO_DAC 41 +#define MC13XXX_IRQ_ADCDONE 0#define MC13XXX_IRQ_ADCBISDONE 1#define MC13XXX_IRQ_TS 2
sound/soc/codecs/mc13783.c +0 -4
@@ -125,10 +125,6 @@ static int mc13783_write(struct snd_soc_codec *codec, ret =mc13xxx_reg_write (priv->mc13xxx, reg, value); -/* include errata fix for spi audio problems */ -if (reg ==MC13783_AUDIO_CODEC || reg ==MC13783_AUDIO_DAC ) - ret =mc13xxx_reg_write (priv->mc13xxx, reg, value); -mc13xxx_unlock (priv->mc13xxx);return ret;
Signature · 1 line
1.8.4.rc3
Re: [PATCH 2/3] mfd: mc13xxx: Move SPI erratum workaround into SPI I/O function
Quoted 6 lines · Mark Brown
From: Mark Brown <[email protected]>
Move the workaround for double sending
AUDIO_CODECandAUDIO_DACwrites into the SPI core, aiding refactoring to eliminate the ASoC custom I/O functions and avoiding the extra writes for I2C.
Quoted 6 lines
Signed-off-by Mark Brown <[email protected]>--- drivers/mfd/mc13xxx-spi.c | 5 +++++ include/linux/mfd/mc13xxx.h | 7 +++++++ sound/soc/codecs/mc13783.c | 4 ---- 3 files changed, 12 insertions(+), 4 deletions(-)
I assume this is okay to go in via the MFD tree.
I've applied it until you say otherwise.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Mark Brown
maintainerRe: [PATCH 2/3] mfd: mc13xxx: Move SPI erratum workaround into SPI I/O function
Quoted 3 lines · Lee Jones
I assume this is okay to go in via the MFD tree.
I've applied it until you say otherwise.
Can you please put it on a branch I can pull into ASoC in case we manage to get rid of all the other users this cycle?
Re: [PATCH 2/3] mfd: mc13xxx: Move SPI erratum workaround into SPI I/O function
Quoted 8 lines · Mark Brown
Quoted 3 lines · Lee Jones
I assume this is okay to go in via the MFD tree.
I've applied it until you say otherwise.
Can you please put it on a branch I can pull into ASoC in case we manage to get rid of all the other users this cycle?
Yes, I can do that.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH 2/3] mfd: mc13xxx: Move SPI erratum workaround into SPI I/O function
Quoted 4 lines · Lee Jones
Quoted 2 lines · Mark Brown
On Wed, Sep 25, 2013 at 12:19:54PM +0100, Lee Jones wrote:
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
I assume this is okay to go in via the MFD tree.
I've applied it until you say otherwise.
Can you please put it on a branch I can pull into ASoC in case we manage to get rid of all the other users this cycle?
Yes, I can do that.
https://git.linaro.org/gitweb?p=people/ljones/mfd.git mfd-asoc
Signature · 8 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainerRe: [PATCH 2/3] mfd: mc13xxx: Move SPI erratum workaround into SPI I/O function
Quoted 1 line · Lee Jones
https://git.linaro.org/gitweb?p=people/ljones/mfd.git mfd-asoc
Thanks, could you include the first patch as well please (there's a dependency for bisection due to the BUG_ONs)?
Re: [PATCH 2/3] mfd: mc13xxx: Move SPI erratum workaround into SPI I/O function
Quoted 6 lines · Mark Brown
Quoted 1 line · Lee Jones
https://git.linaro.org/gitweb?p=people/ljones/mfd.git mfd-asoc
Thanks, could you include the first patch as well please (there's a dependency for bisection due to the
BUG_ONs)?
Okay, done. Same branch.
Signature · 8 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainerRe: [PATCH 2/3] mfd: mc13xxx: Move SPI erratum workaround into SPI I/O function
Quoted 9 lines · Lee Jones
Quoted 6 lines · Mark Brown
Quoted 1 line · Lee Jones
https://git.linaro.org/gitweb?p=people/ljones/mfd.git mfd-asoc
Thanks, could you include the first patch as well please (there's a dependency for bisection due to the
BUG_ONs)?Okay, done. Same branch.
Pulled, thanks. That URI isn't directly pullable BTW.
Re: [PATCH 2/3] mfd: mc13xxx: Move SPI erratum workaround into SPI I/O function
Quoted 4 lines · Mark Brown
Quoted 2 lines · Lee Jones
Quoted 1 line · Mark Brown
On Wed, Sep 25, 2013 at 12:55:02PM +0100, Lee Jones wrote:
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
https://git.linaro.org/gitweb?p=people/ljones/mfd.git mfd-asoc
Thanks, could you include the first patch as well please (there's a dependency for bisection due to the
BUG_ONs)?Okay, done. Same branch.
Pulled, thanks. That URI isn't directly pullable BTW.
I know.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Mark Brown
maintainerPATCH 3/3 ASoC: mc13783: Use regmap directly from ASoC
In reply to Mark BrownFrom: Mark Brown <[email protected]>
As part of a push to remove the register I/O functionality from ASoC (since it is now duplicated in the regmap API) convert the mc13783 driver to use regmap directly.
--- sound/soc/codecs/mc13783.c | 55 ++++++++-------------------------------------- 1 file changed, 9 insertions(+), 46 deletions(-)
sound/soc/codecs/mc13783.c +9 -46
@@ -30,16 +30,10 @@#include <sound/soc.h> #include <sound/initval.h> #include <sound/soc-dapm.h> +#include <linux/regmap.h> #include "mc13783.h" -#define MC13783_AUDIO_RX0 36 -#define MC13783_AUDIO_RX1 37 -#define MC13783_AUDIO_TX 38 -#define MC13783_SSI_NETWORK 39 -#define MC13783_AUDIO_CODEC 40 -#define MC13783_AUDIO_DAC 41 -#define AUDIO_RX0_ALSPEN (1 << 5)#define AUDIO_RX0_ALSPSEL (1 << 7)#define AUDIO_RX0_ADDCDC (1 << 21)
@@ -95,41 +89,12 @@struct mc13783_priv {struct mc13xxx *mc13xxx; +struct regmap *regmap;enum mc13783_ssi_port adc_ssi_port;enum mc13783_ssi_port dac_ssi_port; }; -static unsigned int mc13783_read (struct snd_soc_codec *codec, -unsigned int reg) -{ -struct mc13783_priv *priv =snd_soc_codec_get_drvdata (codec); -unsigned int value =0 ; - -mc13xxx_lock (priv->mc13xxx); - -mc13xxx_reg_read (priv->mc13xxx, reg, &value); - -mc13xxx_unlock (priv->mc13xxx); - -return value; -} - -static int mc13783_write (struct snd_soc_codec *codec, -unsigned int reg,unsigned int value) -{ -struct mc13783_priv *priv =snd_soc_codec_get_drvdata (codec); -int ret; - -mc13xxx_lock (priv->mc13xxx); - - ret =mc13xxx_reg_write (priv->mc13xxx, reg, value); - -mc13xxx_unlock (priv->mc13xxx); - -return ret; -} -/* Mapping between sample rates and register value */ static unsigned int mc13783_rates[] = {8000 ,11025 ,12000 ,16000 ,
@@ -583,8 +548,14 @@ static struct snd_kcontrol_new mc13783_control_list[] = {static int mc13783_probe (struct snd_soc_codec *codec) {struct mc13783_priv *priv =snd_soc_codec_get_drvdata (codec); +int ret; -mc13xxx_lock (priv->mc13xxx); + codec->control_data =dev_get_regmap (codec->dev->parent,NULL ); + ret =snd_soc_codec_set_cache_io (codec,8 ,24 ,SND_SOC_REGMAP ); +if (ret !=0 ) { +dev_err (codec->dev,"Failed to set cache I/O: %d\n" , ret); +return ret; + }/* these are the reset values */ mc13xxx_reg_write (priv->mc13xxx,MC13783_AUDIO_RX0 ,0x25893 );
@@ -608,8 +579,6 @@ static int mc13783_probe(struct snd_soc_codec *codec)mc13xxx_reg_rmw (priv->mc13xxx,MC13783_AUDIO_DAC ,0 ,AUDIO_SSI_SEL ); -mc13xxx_unlock (priv->mc13xxx); -return 0 ; }
@@ -617,13 +586,9 @@ static int mc13783_remove(struct snd_soc_codec *codec) {struct mc13783_priv *priv =snd_soc_codec_get_drvdata (codec); -mc13xxx_lock (priv->mc13xxx); -/* Make sure VAUDIOON is off */ mc13xxx_reg_rmw (priv->mc13xxx,MC13783_AUDIO_RX0 ,0x3 ,0 ); -mc13xxx_unlock (priv->mc13xxx); -return 0 ; }
@@ -713,8 +678,6 @@ static struct snd_soc_dai_driver mc13783_dai_sync[] = {static struct snd_soc_codec_driver soc_codec_dev_mc13783 = { .probe = mc13783_probe, .remove = mc13783_remove, - .read = mc13783_read, - .write = mc13783_write, .controls = mc13783_control_list, .num_controls =ARRAY_SIZE (mc13783_control_list), .dapm_widgets = mc13783_dapm_widgets,
Signature · 1 line
1.8.4.rc3
Lee Jones
AppliedQuoted 9 lines · Mark Brown
From: Mark Brown <[email protected]>
Since the conversion to regmap there has been no need for device level locking for I/O as regmap provides locking so remove the locks.
Signed-off-by Mark Brown <[email protected]>--- drivers/mfd/mc13xxx-core.c | 5 ----- 1 file changed, 5 deletions(-)
Applied, thanks.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog