soc - neo1973_wm8753.c cleanup checkpatch issues
PATCH 1/4 soc - neo1973_wm8753.c cleanup checkpatch issues
From: Graeme Gregory <[email protected]>
Clean up a few issues with the file that checkpatch noted, no functionality changes.
--- sound/soc/s3c24xx/neo1973_wm8753.c | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-)
sound/soc/s3c24xx/neo1973_wm8753.c +12 -12
@@ -33,7 +33,7 @@#include <asm/arch/regs-gpio.h> #include <asm/hardware.h> #include <asm/arch/audio.h> -#include <asm/io.h> +#include <linux/io.h> #include <asm/arch/spi-gpio.h> #include <asm/plat-s3c24xx/regs-iis.h>
@@ -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 = {
Signature · 1 line
1.5.5.1
PATCH 2/4 soc - neo1973_wm8753.c change maintainer contact info
From: Graeme Gregory <[email protected]>
I have moved workplaces since I originally wrote this driver so update the contact info for new employers.
--- sound/soc/s3c24xx/neo1973_wm8753.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/s3c24xx/neo1973_wm8753.c +1 -1
@@ -667,6 +667,6 @@ module_init(neo1973_init);module_exit (neo1973_exit);/* Module information */ -MODULE_AUTHOR ("Graeme Gregory, [email protected], www.wolfsonmicro.com" ); +MODULE_AUTHOR ("Graeme Gregory, [email protected], www.openmoko.org" );MODULE_DESCRIPTION ("ALSA SoC WM8753 Neo1973" );MODULE_LICENSE ("GPL" );
Signature · 1 line
1.5.5.1
PATCH 3/4 soc - neo1973_wm8753.c add suspend and shutdown hooks for lm4857 chip
From: Graeme Gregory <[email protected]>
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.
--- sound/soc/s3c24xx/neo1973_wm8753.c | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-)
sound/soc/s3c24xx/neo1973_wm8753.c +32 -0
@@ -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,
Signature · 1 line
1.5.5.1
PATCH 4/4 soc - DAPM - add hook to read state of DAPM widget
From: Graeme Gregory <[email protected]>
This adds a hook to read the power state of a DAPM widget, I use this in the gta02 driver to expose certain DAPM widgets in the mixer for ease of audio routing.
--- include/sound/soc-dapm.h | 2 ++ sound/soc/soc-dapm.c | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 0 deletions(-)
include/sound/soc-dapm.h +2 -0
@@ -223,6 +223,8 @@ int snd_soc_dapm_sys_add(struct device *dev);/* dapm audio endpoint control */ int snd_soc_dapm_set_endpoint (struct snd_soc_codec *codec,char *pin,int status); +int snd_soc_dapm_get_endpoint_status (struct snd_soc_codec *codec, +char *pin);int snd_soc_dapm_sync_endpoints (struct snd_soc_codec *codec);/* dapm widget types */
sound/soc/soc-dapm.c +23 -0
@@ -1343,6 +1343,29 @@ int snd_soc_dapm_set_endpoint(struct snd_soc_codec *codec,EXPORT_SYMBOL_GPL (snd_soc_dapm_set_endpoint);/** +* snd_soc_dapm_get_endpoint_status - get audio endpoint status +* @codec: audio codec +* @endpoint: audio signal endpoint (or start point) +* +* Get audio endpoint status - connected or disconnected. +* +* Returns status +*/ +int snd_soc_dapm_get_endpoint_status (struct snd_soc_codec *codec, +char *endpoint) +{ +struct snd_soc_dapm_widget *w; + +list_for_each_entry (w, &codec->dapm_widgets, list) { +if (!strcmp (w->name, endpoint)) +return w->connected; + } + +return 0 ; +} +EXPORT_SYMBOL_GPL (snd_soc_dapm_get_endpoint); + +/** * snd_soc_dapm_free - free dapm resources * @socdev: SoC device *
Signature · 1 line
1.5.5.1
At Wed, 30 Apr 2008 15:19:03 +0100,
Quoted 8 lines · Mark Brown
From: Graeme Gregory <[email protected]>
Clean up a few issues with the file that checkpatch noted, no functionality changes.
Signed-off-by Graeme Gregory <[email protected]>Signed-off-by Mark Brown <[email protected]>
Applied all 4 patches now.
I think we can push checkpatch clean-up patches to 2.6.26 if possible. In addition, neo1973_wm8753.c suspend/resume/shutdown hooks look OK for 2.6.26.
I'll keep Daniel's clock-setup change and GPIO support patches as post-2.6.26.
The addition of snd_soc_dapm_get_endpoint_status() appears to be a post-2.6.26, too, as there is no user yet on 2.6.26.
Takashi
Quoted 1 line · Takashi Iwai
Applied all 4 patches now.
Thanks.
Quoted 3 lines
I think we can push checkpatch clean-up patches to 2.6.26 if possible. In addition,
neo1973_wm8753.csuspend/resume/shutdown hooks look OK for 2.6.26.
Yes, and in fact this is a bug fix - without this code the device burns an excessive amount of power while suspended.
Quoted 2 lines
I'll keep Daniel's clock-setup change and GPIO support patches as post-2.6.26.
I agree.
Quoted 2 lines
The addition of
snd_soc_dapm_get_endpoint_status()appears to be a post-2.6.26, too, as there is no user yet on 2.6.26.
Yes, there's no user - the GTA02 is the only existing user and it can't be merged since the underlying machine support is not integrated yet. On the other hand, since there are no users it's very low risk :) Either way is fine by me, anyway.