From 60fc684adfed810fc36b41778aca8de467fc3206 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 30 Apr 2008 17:18:43 +0200 Subject: [ALSA] soc - wm8753 - Clean up checkpatch warnings Signed-off-by: Mark Brown Signed-off-by: Takashi Iwai --- sound/soc/codecs/wm8753.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index 76a5c7b05df..fb41826c4c4 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c @@ -150,7 +150,7 @@ static int wm8753_write(struct snd_soc_codec *codec, unsigned int reg, data[0] = (reg << 1) | ((value >> 8) & 0x0001); data[1] = value & 0x00ff; - wm8753_write_reg_cache (codec, reg, value); + wm8753_write_reg_cache(codec, reg, value); if (codec->hw_write(codec->control_data, data, 2) == 2) return 0; else @@ -249,7 +249,7 @@ static int wm8753_set_dai(struct snd_kcontrol *kcontrol, struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); int mode = wm8753_read_reg_cache(codec, WM8753_IOCTL); - if (((mode &0xc) >> 2) == ucontrol->value.integer.value[0]) + if (((mode & 0xc) >> 2) == ucontrol->value.integer.value[0]) return 0; mode &= 0xfff3; @@ -342,7 +342,8 @@ static int wm8753_add_controls(struct snd_soc_codec *codec) for (i = 0; i < ARRAY_SIZE(wm8753_snd_controls); i++) { err = snd_ctl_add(codec->card, - snd_soc_cnew(&wm8753_snd_controls[i],codec, NULL)); + snd_soc_cnew(&wm8753_snd_controls[i], + codec, NULL)); if (err < 0) return err; } @@ -722,7 +723,7 @@ static void pll_factors(struct _pll_div *pll_div, unsigned int target, if ((Ndiv < 6) || (Ndiv > 12)) printk(KERN_WARNING - "WM8753 N value outwith recommended range! N = %d\n",Ndiv); + "wm8753: unsupported N = %d\n", Ndiv); pll_div->n = Ndiv; Nmod = target % source; @@ -1300,8 +1301,9 @@ static int wm8753_dapm_event(struct snd_soc_codec *codec, int event) } #define WM8753_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\ - SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | \ - SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000) + SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 |\ + SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |\ + SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000) #define WM8753_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE) @@ -1507,9 +1509,9 @@ static int wm8753_suspend(struct platform_device *pdev, pm_message_t state) struct snd_soc_codec *codec = socdev->codec; /* we only need to suspend if we are a valid card */ - if(!codec->card) + if (!codec->card) return 0; - + wm8753_dapm_event(codec, SNDRV_CTL_POWER_D3cold); return 0; } @@ -1523,7 +1525,7 @@ static int wm8753_resume(struct platform_device *pdev) u16 *cache = codec->reg_cache; /* we only need to resume if we are a valid card */ - if(!codec->card) + if (!codec->card) return 0; /* Sync reg_cache with the hardware */ @@ -1613,9 +1615,10 @@ static int wm8753_init(struct snd_soc_device *socdev) wm8753_add_widgets(codec); ret = snd_soc_register_card(socdev); if (ret < 0) { - printk(KERN_ERR "wm8753: failed to register card\n"); + printk(KERN_ERR "wm8753: failed to register card\n"); goto card_err; - } + } + return ret; card_err: @@ -1630,7 +1633,7 @@ pcm_err: around */ static struct snd_soc_device *wm8753_socdev; -#if defined (CONFIG_I2C) || defined (CONFIG_I2C_MODULE) +#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) /* * WM8753 2 wire address is determined by GPIO5 @@ -1661,7 +1664,7 @@ static int wm8753_codec_probe(struct i2c_adapter *adap, int addr, int kind) client_template.addr = addr; i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL); - if (i2c == NULL){ + if (!i2c) { kfree(codec); return -ENOMEM; } @@ -1749,7 +1752,7 @@ static int wm8753_probe(struct platform_device *pdev) wm8753_socdev = socdev; INIT_DELAYED_WORK(&codec->delayed_work, wm8753_work); -#if defined (CONFIG_I2C) || defined (CONFIG_I2C_MODULE) +#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) if (setup->i2c_address) { normal_i2c[0] = setup->i2c_address; codec->hw_write = (hw_write_t)i2c_master_send; @@ -1793,7 +1796,7 @@ static int wm8753_remove(struct platform_device *pdev) run_delayed_work(&codec->delayed_work); snd_soc_free_pcms(socdev); snd_soc_dapm_free(socdev); -#if defined (CONFIG_I2C) || defined (CONFIG_I2C_MODULE) +#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) i2c_del_driver(&wm8753_i2c_driver); #endif kfree(codec->private_data); @@ -1808,7 +1811,6 @@ struct snd_soc_codec_device soc_codec_dev_wm8753 = { .suspend = wm8753_suspend, .resume = wm8753_resume, }; - EXPORT_SYMBOL_GPL(soc_codec_dev_wm8753); MODULE_DESCRIPTION("ASoC WM8753 driver"); -- cgit v1.2.3 From ccfdd6c2b2ad3f32c02175007a66c82e2233b75c Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 30 Apr 2008 17:19:07 +0200 Subject: [ALSA] soc - s3c2443-ac97 - Fix checkpatch warnings Signed-off-by: Mark Brown Signed-off-by: Takashi Iwai --- sound/soc/s3c24xx/s3c2443-ac97.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sound/soc/s3c24xx/s3c2443-ac97.c b/sound/soc/s3c24xx/s3c2443-ac97.c index 1c1ddbf7f3c..e81d9a6c83d 100644 --- a/sound/soc/s3c24xx/s3c2443-ac97.c +++ b/sound/soc/s3c24xx/s3c2443-ac97.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -30,7 +31,6 @@ #include #include -#include #include #include #include @@ -47,7 +47,7 @@ struct s3c24xx_ac97_info { }; static struct s3c24xx_ac97_info s3c24xx_ac97; -DECLARE_COMPLETION(ac97_completion); +static DECLARE_COMPLETION(ac97_completion); static u32 codec_ready; static DECLARE_MUTEX(ac97_mutex); @@ -290,7 +290,7 @@ static int s3c2443_ac97_trigger(struct snd_pcm_substream *substream, int cmd) u32 ac_glbctrl; ac_glbctrl = readl(s3c24xx_ac97.regs + S3C_AC97_GLBCTRL); - switch(cmd) { + switch (cmd) { case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: @@ -333,7 +333,7 @@ static int s3c2443_ac97_mic_trigger(struct snd_pcm_substream *substream, u32 ac_glbctrl; ac_glbctrl = readl(s3c24xx_ac97.regs + S3C_AC97_GLBCTRL); - switch(cmd) { + switch (cmd) { case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: @@ -391,7 +391,6 @@ struct snd_soc_cpu_dai s3c2443_ac97_dai[] = { .trigger = s3c2443_ac97_mic_trigger,}, }, }; - EXPORT_SYMBOL_GPL(s3c2443_ac97_dai); EXPORT_SYMBOL_GPL(soc_ac97_ops); -- cgit v1.2.3 From 5111c0753486fffde14de2b207e46760b9c05fd0 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 30 Apr 2008 17:19:32 +0200 Subject: [ALSA] soc - s3c24xx-pcm - Fix checkpatch warnings Signed-off-by: Mark Brown Signed-off-by: Takashi Iwai --- sound/soc/s3c24xx/s3c24xx-pcm.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/sound/soc/s3c24xx/s3c24xx-pcm.c b/sound/soc/s3c24xx/s3c24xx-pcm.c index 49580fb481d..6c70a81c730 100644 --- a/sound/soc/s3c24xx/s3c24xx-pcm.c +++ b/sound/soc/s3c24xx/s3c24xx-pcm.c @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -30,7 +31,6 @@ #include #include -#include #include #include #include @@ -93,7 +93,7 @@ static void s3c24xx_pcm_enqueue(struct snd_pcm_substream *substream) while (prtd->dma_loaded < prtd->dma_limit) { unsigned long len = prtd->dma_period; - DBG("dma_loaded: %d\n",prtd->dma_loaded); + DBG("dma_loaded: %d\n", prtd->dma_loaded); if ((pos + len) > prtd->dma_end) { len = prtd->dma_end - pos; @@ -101,7 +101,7 @@ static void s3c24xx_pcm_enqueue(struct snd_pcm_substream *substream) __func__, len); } - ret = s3c2410_dma_enqueue(prtd->params->channel, + ret = s3c2410_dma_enqueue(prtd->params->channel, substream, pos, len); if (ret == 0) { @@ -129,7 +129,7 @@ static void s3c24xx_audio_buffdone(struct s3c2410_dma_chan *channel, return; prtd = substream->runtime->private_data; - + if (substream) snd_pcm_period_elapsed(substream); @@ -150,7 +150,7 @@ static int s3c24xx_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_soc_pcm_runtime *rtd = substream->private_data; struct s3c24xx_pcm_dma_params *dma = rtd->dai->cpu_dai->dma_data; unsigned long totbytes = params_buffer_bytes(params); - int ret=0; + int ret = 0; DBG("Entered %s\n", __func__); @@ -223,7 +223,7 @@ static int s3c24xx_pcm_prepare(struct snd_pcm_substream *substream) /* return if this is a bufferless transfer e.g. * codec <--> BT codec or GSM modem -- lg FIXME */ if (!prtd->params) - return 0; + return 0; /* channel needs configuring for mem=>device, increment memory addr, * sync to pclk, half-word transfers to the IIS-FIFO. */ @@ -293,8 +293,8 @@ static int s3c24xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) return ret; } -static snd_pcm_uframes_t - s3c24xx_pcm_pointer(struct snd_pcm_substream *substream) +static snd_pcm_uframes_t +s3c24xx_pcm_pointer(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; struct s3c24xx_runtime_data *prtd = runtime->private_data; @@ -313,7 +313,7 @@ static snd_pcm_uframes_t spin_unlock(&prtd->lock); - DBG("Pointer %x %x\n",src,dst); + DBG("Pointer %x %x\n", src, dst); /* we seem to be getting the odd error from the pcm library due * to out-of-bounds pointers. this is maybe due to the dma engine @@ -355,11 +355,11 @@ static int s3c24xx_pcm_close(struct snd_pcm_substream *substream) DBG("Entered %s\n", __func__); - if (prtd) - kfree(prtd); - else + if (!prtd) DBG("s3c24xx_pcm_close called with prtd == NULL\n"); + kfree(prtd); + return 0; } @@ -371,9 +371,9 @@ static int s3c24xx_pcm_mmap(struct snd_pcm_substream *substream, DBG("Entered %s\n", __func__); return dma_mmap_writecombine(substream->pcm->card->dev, vma, - runtime->dma_area, - runtime->dma_addr, - runtime->dma_bytes); + runtime->dma_area, + runtime->dma_addr, + runtime->dma_bytes); } static struct snd_pcm_ops s3c24xx_pcm_ops = { @@ -432,7 +432,7 @@ static void s3c24xx_pcm_free_dma_buffers(struct snd_pcm *pcm) static u64 s3c24xx_pcm_dmamask = DMA_32BIT_MASK; -static int s3c24xx_pcm_new(struct snd_card *card, +static int s3c24xx_pcm_new(struct snd_card *card, struct snd_soc_codec_dai *dai, struct snd_pcm *pcm) { int ret = 0; @@ -467,7 +467,6 @@ struct snd_soc_platform s3c24xx_soc_platform = { .pcm_new = s3c24xx_pcm_new, .pcm_free = s3c24xx_pcm_free_dma_buffers, }; - EXPORT_SYMBOL_GPL(s3c24xx_soc_platform); MODULE_AUTHOR("Ben Dooks, "); -- cgit v1.2.3 From 854e4af258e214345d675dc406d24769e32a04c8 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 30 Apr 2008 17:19:57 +0200 Subject: [ALSA] soc - ln2440sbc_alc650 - Fix checkpatch warnings Signed-off-by: Mark Brown Signed-off-by: Takashi Iwai --- sound/soc/s3c24xx/ln2440sbc_alc650.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/s3c24xx/ln2440sbc_alc650.c b/sound/soc/s3c24xx/ln2440sbc_alc650.c index 9ed8f2e8da1..4eab2c19c45 100644 --- a/sound/soc/s3c24xx/ln2440sbc_alc650.c +++ b/sound/soc/s3c24xx/ln2440sbc_alc650.c @@ -1,10 +1,10 @@ /* * SoC audio for ln2440sbc - * + * * Copyright 2007 KonekTel, a.s. * Author: Ivan Kuten * ivan.kuten@promwad.com - * + * * Heavily based on smdk2443_wm9710.c * Copyright 2007 Wolfson Microelectronics PLC. * Author: Graeme Gregory -- cgit v1.2.3 From 8ba02ace943ce956606d1f6f2a5aad9498798c31 Mon Sep 17 00:00:00 2001 From: Graeme Gregory Date: Wed, 30 Apr 2008 20:24:54 +0200 Subject: [ALSA] soc - neo1973_wm8753.c cleanup checkpatch issues Clean up a few issues with the file that checkpatch noted, no functionality changes. Signed-off-by: Graeme Gregory Signed-off-by: Mark Brown Signed-off-by: Takashi Iwai --- sound/soc/s3c24xx/neo1973_wm8753.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sound/soc/s3c24xx/neo1973_wm8753.c b/sound/soc/s3c24xx/neo1973_wm8753.c index 962cc20b1af..e2339b9f0b3 100644 --- a/sound/soc/s3c24xx/neo1973_wm8753.c +++ b/sound/soc/s3c24xx/neo1973_wm8753.c @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include @@ -122,7 +122,7 @@ static int neo1973_hifi_hw_params(struct snd_pcm_substream *substream, /* set MCLK division for sample rate */ ret = cpu_dai->dai_ops.set_clkdiv(cpu_dai, S3C24XX_DIV_MCLK, - S3C2410_IISMOD_32FS ); + S3C2410_IISMOD_32FS); if (ret < 0) return ret; @@ -133,7 +133,7 @@ static int neo1973_hifi_hw_params(struct snd_pcm_substream *substream, /* set prescaler division for sample rate */ ret = cpu_dai->dai_ops.set_clkdiv(cpu_dai, S3C24XX_DIV_PRESCALER, - S3C24XX_PRESCALE(4,4)); + S3C24XX_PRESCALE(4, 4)); if (ret < 0) return ret; @@ -222,7 +222,7 @@ static struct snd_soc_ops neo1973_voice_ops = { .hw_free = neo1973_voice_hw_free, }; -static int neo1973_scenario = 0; +static int neo1973_scenario; static int neo1973_get_scenario(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) @@ -233,7 +233,7 @@ static int neo1973_get_scenario(struct snd_kcontrol *kcontrol, static int set_scenario_endpoints(struct snd_soc_codec *codec, int scenario) { - switch(neo1973_scenario) { + switch (neo1973_scenario) { case NEO_AUDIO_OFF: snd_soc_dapm_set_endpoint(codec, "Audio Out", 0); snd_soc_dapm_set_endpoint(codec, "GSM Line Out", 0); @@ -334,7 +334,7 @@ static void lm4857_write_regs(void) static int lm4857_get_reg(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - int reg=kcontrol->private_value & 0xFF; + int reg = kcontrol->private_value & 0xFF; int shift = (kcontrol->private_value >> 8) & 0x0F; int mask = (kcontrol->private_value >> 16) & 0xFF; @@ -349,11 +349,11 @@ static int lm4857_set_reg(struct snd_kcontrol *kcontrol, int shift = (kcontrol->private_value >> 8) & 0x0F; int mask = (kcontrol->private_value >> 16) & 0xFF; - if (((lm4857_regs[reg] >> shift ) & mask) == + if (((lm4857_regs[reg] >> shift) & mask) == ucontrol->value.integer.value[0]) return 0; - lm4857_regs[reg] &= ~ (mask << shift); + lm4857_regs[reg] &= ~(mask << shift); lm4857_regs[reg] |= ucontrol->value.integer.value[0] << shift; lm4857_write_regs(); return 1; @@ -398,7 +398,7 @@ static const struct snd_soc_dapm_widget wm8753_dapm_widgets[] = { /* example machine audio_mapnections */ -static const char* audio_map[][3] = { +static const char *audio_map[][3] = { /* Connections to the lm4857 amp */ {"Audio Out", NULL, "LOUT1"}, @@ -450,7 +450,7 @@ static const char *neo_scenarios[] = { }; static const struct soc_enum neo_scenario_enum[] = { - SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(neo_scenarios),neo_scenarios), + SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(neo_scenarios), neo_scenarios), }; static const struct snd_kcontrol_new wm8753_neo1973_controls[] = { @@ -521,8 +521,8 @@ static int neo1973_wm8753_init(struct snd_soc_codec *codec) /* * BT Codec DAI */ -static struct snd_soc_cpu_dai bt_dai = -{ .name = "Bluetooth", +static struct snd_soc_cpu_dai bt_dai = { + .name = "Bluetooth", .id = 0, .type = SND_SOC_DAI_PCM, .playback = { -- cgit v1.2.3 From 443590e6f1823cd4bc1199cc658074bc3e30acbf Mon Sep 17 00:00:00 2001 From: Graeme Gregory Date: Wed, 30 Apr 2008 20:25:23 +0200 Subject: [ALSA] soc - neo1973_wm8753.c change maintainer contact info I have moved workplaces since I originally wrote this driver so update the contact info for new employers. Signed-off-by: Graeme Gregory Signed-off-by: Mark Brown Signed-off-by: Takashi Iwai --- sound/soc/s3c24xx/neo1973_wm8753.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/s3c24xx/neo1973_wm8753.c b/sound/soc/s3c24xx/neo1973_wm8753.c index e2339b9f0b3..c8caddffc42 100644 --- a/sound/soc/s3c24xx/neo1973_wm8753.c +++ b/sound/soc/s3c24xx/neo1973_wm8753.c @@ -667,6 +667,6 @@ module_init(neo1973_init); module_exit(neo1973_exit); /* Module information */ -MODULE_AUTHOR("Graeme Gregory, graeme.gregory@wolfsonmicro.com, www.wolfsonmicro.com"); +MODULE_AUTHOR("Graeme Gregory, graeme@openmoko.org, www.openmoko.org"); MODULE_DESCRIPTION("ALSA SoC WM8753 Neo1973"); MODULE_LICENSE("GPL"); -- cgit v1.2.3 From fd403dc84f29aee613d13bde5656ba74cdee1e7b Mon Sep 17 00:00:00 2001 From: Graeme Gregory Date: Wed, 30 Apr 2008 20:26:45 +0200 Subject: [ALSA] soc - neo1973_wm8753.c add suspend and shutdown hooks for lm4857 chip Patch taken from the openmoko bugtracker http://bugzilla.openmoko.org/cgi-bin/bugzilla/show_bug.cgi?id=781 This patch adds Suspend/Resume and Shutdown support for the lm4857 to the driver. Signed-off-by: Graeme Gregory Signed-off-by: Mark Brown Signed-off-by: Takashi Iwai --- sound/soc/s3c24xx/neo1973_wm8753.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/sound/soc/s3c24xx/neo1973_wm8753.c b/sound/soc/s3c24xx/neo1973_wm8753.c index c8caddffc42..0e9d1c5f248 100644 --- a/sound/soc/s3c24xx/neo1973_wm8753.c +++ b/sound/soc/s3c24xx/neo1973_wm8753.c @@ -616,6 +616,35 @@ static int lm4857_i2c_attach(struct i2c_adapter *adap) return i2c_probe(adap, &addr_data, lm4857_amp_probe); } +static u8 lm4857_state; + +static int lm4857_suspend(struct i2c_client *dev, pm_message_t state) +{ + dev_dbg(&dev->dev, "lm4857_suspend\n"); + lm4857_state = lm4857_regs[LM4857_CTRL] & 0xf; + if (lm4857_state) { + lm4857_regs[LM4857_CTRL] &= 0xf0; + lm4857_write_regs(); + } + return 0; +} + +static int lm4857_resume(struct i2c_client *dev) +{ + if (lm4857_state) { + lm4857_regs[LM4857_CTRL] |= (lm4857_state & 0x0f); + lm4857_write_regs(); + } + return 0; +} + +static void lm4857_shutdown(struct i2c_client *dev) +{ + dev_dbg(&dev->dev, "lm4857_shutdown\n"); + lm4857_regs[LM4857_CTRL] &= 0xf0; + lm4857_write_regs(); +} + /* corgi i2c codec control layer */ static struct i2c_driver lm4857_i2c_driver = { .driver = { @@ -623,6 +652,9 @@ static struct i2c_driver lm4857_i2c_driver = { .owner = THIS_MODULE, }, .id = I2C_DRIVERID_LM4857, + .suspend = lm4857_suspend, + .resume = lm4857_resume, + .shutdown = lm4857_shutdown, .attach_adapter = lm4857_i2c_attach, .detach_client = lm4857_i2c_detach, .command = NULL, -- cgit v1.2.3