From patchwork Fri Oct 24 06:00:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Hsu X-Patchwork-Id: 39402 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A454820341 for ; Fri, 24 Oct 2014 06:00:55 +0000 (UTC) Received: by mail-la0-f70.google.com with SMTP id ge10sf1393419lab.5 for ; Thu, 23 Oct 2014 23:00:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=wNm1JyAw5neurUuDPDSVtX3TB3nipEkl0zblxZJ5S/8=; b=LX82bXByJqvJH6ss64cOdPmeHzp7TSekkc1GSwI2xiTedQ7q6G4Pi/AI2iRrA0CULh mdJS4Tf900rGP+OH/BXJgFUTxdU5Pcra3K5PeoKxbR24k9RewQolwENQf4NT2VfA7Hqp 6/ugMA9E+fhSTsgznghh+FkIsKvDWfCGW6WQeSDm4FCqgFg6RrLGDVv0IqkqxBal8Ien +i3ECrgNdjQiY7XJnz1VxdeTqz/I7T7Z817EW1/T0APqxSGJdPbLe8DVENACO9oo8SYX 5lnknSBS23BL138VfFpSQCuPa08zwOJSMxPYjlIu7J91bB+oUF4SCYOm/gKln5UZJzRB IRzg== X-Gm-Message-State: ALoCoQmZFr0+FNURO3Ad3FJTHy112S3Jpg0f8ibOEnblP6fvPJB7T41wP+W57gGKVNXx27772nfX X-Received: by 10.194.100.98 with SMTP id ex2mr15146wjb.6.1414130454123; Thu, 23 Oct 2014 23:00:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.28.133 with SMTP id b5ls366511lah.26.gmail; Thu, 23 Oct 2014 23:00:53 -0700 (PDT) X-Received: by 10.112.150.136 with SMTP id ui8mr2132594lbb.60.1414130453871; Thu, 23 Oct 2014 23:00:53 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id u5si5362333laj.135.2014.10.23.23.00.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Oct 2014 23:00:53 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by mail-lb0-f178.google.com with SMTP id w7so2028547lbi.9 for ; Thu, 23 Oct 2014 23:00:53 -0700 (PDT) X-Received: by 10.153.8.164 with SMTP id dl4mr2050070lad.29.1414130453419; Thu, 23 Oct 2014 23:00:53 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.84.229 with SMTP id c5csp374958lbz; Thu, 23 Oct 2014 23:00:52 -0700 (PDT) X-Received: by 10.70.128.239 with SMTP id nr15mr2585928pdb.32.1414130451683; Thu, 23 Oct 2014 23:00:51 -0700 (PDT) Received: from Kraken ([124.219.7.128]) by mx.google.com with ESMTP id z6si3487963pdo.4.2014.10.23.23.00.49 for ; Thu, 23 Oct 2014 23:00:51 -0700 (PDT) Received-SPF: temperror (google.com: error in processing during lookup of xavier@kraken: DNS timeout) client-ip=124.219.7.128; Received: by Kraken (Postfix, from userid 1011) id DE51B6A279F; Fri, 24 Oct 2014 14:00:39 +0800 (CST) From: Xavier Hsu To: alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com, patches@linaro.org Cc: lars@metafoo.de, ckeepax@opensource.wolfsonmicro.com, Xavier Hsu , Andy Green Subject: [PATCHv5 1/9] ASOC: wm8971: clean for checkpatch --strict Date: Fri, 24 Oct 2014 14:00:27 +0800 Message-Id: <1414130435-14183-1-git-send-email-xavier.hsu@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: xavier.hsu@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Before adding wm8973 support, clean up existing wm8971 style. Signed-off-by: Xavier Hsu Signed-off-by: Andy Green --- sound/soc/codecs/wm8971.c | 110 +++++++++++++++++++++++---------------------- sound/soc/codecs/wm8971.h | 30 ++++++------- 2 files changed, 72 insertions(+), 68 deletions(-) diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c index 39ddb9b..01c76a4 100644 --- a/sound/soc/codecs/wm8971.c +++ b/sound/soc/codecs/wm8971.c @@ -29,9 +29,9 @@ #include "wm8971.h" -#define WM8971_REG_COUNT 43 +#define WM8971_REG_COUNT 43 -static struct workqueue_struct *wm8971_workq = NULL; +static struct workqueue_struct *wm8971_workq; /* codec private data */ struct wm8971_priv { @@ -92,25 +92,28 @@ static const struct reg_default wm8971_reg_defaults[] = { #define wm8971_reset(c) snd_soc_write(c, WM8971_RESET, 0) /* WM8971 Controls */ -static const char *wm8971_bass[] = { "Linear Control", "Adaptive Boost" }; -static const char *wm8971_bass_filter[] = { "130Hz @ 48kHz", - "200Hz @ 48kHz" }; -static const char *wm8971_treble[] = { "8kHz", "4kHz" }; -static const char *wm8971_alc_func[] = { "Off", "Right", "Left", "Stereo" }; -static const char *wm8971_ng_type[] = { "Constant PGA Gain", - "Mute ADC Output" }; -static const char *wm8971_deemp[] = { "None", "32kHz", "44.1kHz", "48kHz" }; -static const char *wm8971_mono_mux[] = {"Stereo", "Mono (Left)", - "Mono (Right)", "Digital Mono"}; -static const char *wm8971_dac_phase[] = { "Non Inverted", "Inverted" }; -static const char *wm8971_lline_mux[] = {"Line", "NC", "NC", "PGA", - "Differential"}; -static const char *wm8971_rline_mux[] = {"Line", "Mic", "NC", "PGA", - "Differential"}; -static const char *wm8971_lpga_sel[] = {"Line", "NC", "NC", "Differential"}; -static const char *wm8971_rpga_sel[] = {"Line", "Mic", "NC", "Differential"}; -static const char *wm8971_adcpol[] = {"Normal", "L Invert", "R Invert", - "L + R Invert"}; +static const char const *wm8971_bass[] = {"Linear Control", "Adaptive Boost"}; +static const char const *wm8971_bass_filter[] = {"130Hz @ 48kHz", + "200Hz @ 48kHz"}; +static const char const *wm8971_treble[] = {"8kHz", "4kHz"}; +static const char const *wm8971_alc_func[] = {"Off", "Right", + "Left", "Stereo"}; +static const char const *wm8971_ng_type[] = {"Constant PGA Gain", + "Mute ADC Output"}; +static const char const *wm8971_deemp[] = {"None", "32kHz", "44.1kHz", "48kHz"}; +static const char const *wm8971_mono_mux[] = {"Stereo", "Mono (Left)", + "Mono (Right)", "Digital Mono"}; +static const char const *wm8971_dac_phase[] = {"Non Inverted", "Inverted"}; +static const char const *wm8971_lline_mux[] = {"Line", "NC", "NC", + "PGA", "Differential"}; +static const char const *wm8971_rline_mux[] = {"Line", "Mic", "NC", + "PGA", "Differential"}; +static const char const *wm8971_lpga_sel[] = {"Line", "NC", "NC", + "Differential"}; +static const char const *wm8971_rpga_sel[] = {"Line", "Mic", "NC", + "Differential"}; +static const char const *wm8971_adcpol[] = {"Normal", "L Invert", + "R Invert", "L + R Invert"}; static const struct soc_enum wm8971_enum[] = { SOC_ENUM_SINGLE(WM8971_BASS, 7, 2, wm8971_bass), /* 0 */ @@ -136,24 +139,24 @@ static const struct snd_kcontrol_new wm8971_snd_controls[] = { SOC_DOUBLE_R("Capture Switch", WM8971_LINVOL, WM8971_RINVOL, 7, 1, 1), SOC_DOUBLE_R("Headphone Playback ZC Switch", WM8971_LOUT1V, - WM8971_ROUT1V, 7, 1, 0), + WM8971_ROUT1V, 7, 1, 0), SOC_DOUBLE_R("Speaker Playback ZC Switch", WM8971_LOUT2V, - WM8971_ROUT2V, 7, 1, 0), + WM8971_ROUT2V, 7, 1, 0), SOC_SINGLE("Mono Playback ZC Switch", WM8971_MOUTV, 7, 1, 0), SOC_DOUBLE_R("PCM Volume", WM8971_LDAC, WM8971_RDAC, 0, 255, 0), SOC_DOUBLE_R("Bypass Left Playback Volume", WM8971_LOUTM1, - WM8971_LOUTM2, 4, 7, 1), + WM8971_LOUTM2, 4, 7, 1), SOC_DOUBLE_R("Bypass Right Playback Volume", WM8971_ROUTM1, - WM8971_ROUTM2, 4, 7, 1), + WM8971_ROUTM2, 4, 7, 1), SOC_DOUBLE_R("Bypass Mono Playback Volume", WM8971_MOUTM1, - WM8971_MOUTM2, 4, 7, 1), + WM8971_MOUTM2, 4, 7, 1), SOC_DOUBLE_R("Headphone Playback Volume", WM8971_LOUT1V, - WM8971_ROUT1V, 0, 127, 0), + WM8971_ROUT1V, 0, 127, 0), SOC_DOUBLE_R("Speaker Playback Volume", WM8971_LOUT2V, - WM8971_ROUT2V, 0, 127, 0), + WM8971_ROUT2V, 0, 127, 0), SOC_ENUM("Bass Boost", wm8971_enum[0]), SOC_ENUM("Bass Filter", wm8971_enum[1]), @@ -238,14 +241,14 @@ SOC_DAPM_ENUM("Route", wm8971_enum[13]); static const struct snd_soc_dapm_widget wm8971_dapm_widgets[] = { SND_SOC_DAPM_MIXER("Left Mixer", SND_SOC_NOPM, 0, 0, - &wm8971_left_mixer_controls[0], - ARRAY_SIZE(wm8971_left_mixer_controls)), + &wm8971_left_mixer_controls[0], + ARRAY_SIZE(wm8971_left_mixer_controls)), SND_SOC_DAPM_MIXER("Right Mixer", SND_SOC_NOPM, 0, 0, - &wm8971_right_mixer_controls[0], - ARRAY_SIZE(wm8971_right_mixer_controls)), + &wm8971_right_mixer_controls[0], + ARRAY_SIZE(wm8971_right_mixer_controls)), SND_SOC_DAPM_MIXER("Mono Mixer", WM8971_PWR2, 2, 0, - &wm8971_mono_mixer_controls[0], - ARRAY_SIZE(wm8971_mono_mixer_controls)), + &wm8971_mono_mixer_controls[0], + ARRAY_SIZE(wm8971_mono_mixer_controls)), SND_SOC_DAPM_PGA("Right Out 2", WM8971_PWR2, 3, 0, NULL, 0), SND_SOC_DAPM_PGA("Left Out 2", WM8971_PWR2, 4, 0, NULL, 0), @@ -260,18 +263,18 @@ static const struct snd_soc_dapm_widget wm8971_dapm_widgets[] = { SND_SOC_DAPM_ADC("Left ADC", "Left Capture", WM8971_PWR1, 3, 0), SND_SOC_DAPM_MUX("Left PGA Mux", WM8971_PWR1, 5, 0, - &wm8971_left_pga_controls), + &wm8971_left_pga_controls), SND_SOC_DAPM_MUX("Right PGA Mux", WM8971_PWR1, 4, 0, - &wm8971_right_pga_controls), + &wm8971_right_pga_controls), SND_SOC_DAPM_MUX("Left Line Mux", SND_SOC_NOPM, 0, 0, - &wm8971_left_line_controls), + &wm8971_left_line_controls), SND_SOC_DAPM_MUX("Right Line Mux", SND_SOC_NOPM, 0, 0, - &wm8971_right_line_controls), + &wm8971_right_line_controls), SND_SOC_DAPM_MUX("Left ADC Mux", SND_SOC_NOPM, 0, 0, - &wm8971_monomux_controls), + &wm8971_monomux_controls), SND_SOC_DAPM_MUX("Right ADC Mux", SND_SOC_NOPM, 0, 0, - &wm8971_monomux_controls), + &wm8971_monomux_controls), SND_SOC_DAPM_OUTPUT("LOUT1"), SND_SOC_DAPM_OUTPUT("ROUT1"), @@ -431,7 +434,7 @@ static int get_coeff(int mclk, int rate) } static int wm8971_set_dai_sysclk(struct snd_soc_dai *codec_dai, - int clk_id, unsigned int freq, int dir) + int clk_id, unsigned int freq, int dir) { struct snd_soc_codec *codec = codec_dai->codec; struct wm8971_priv *wm8971 = snd_soc_codec_get_drvdata(codec); @@ -449,7 +452,7 @@ static int wm8971_set_dai_sysclk(struct snd_soc_dai *codec_dai, } static int wm8971_set_dai_fmt(struct snd_soc_dai *codec_dai, - unsigned int fmt) + unsigned int fmt) { struct snd_soc_codec *codec = codec_dai->codec; u16 iface = 0; @@ -507,8 +510,8 @@ static int wm8971_set_dai_fmt(struct snd_soc_dai *codec_dai, } static int wm8971_pcm_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params, - struct snd_soc_dai *dai) + struct snd_pcm_hw_params *params, + struct snd_soc_dai *dai) { struct snd_soc_codec *codec = dai->codec; struct wm8971_priv *wm8971 = snd_soc_codec_get_drvdata(codec); @@ -553,7 +556,7 @@ static int wm8971_mute(struct snd_soc_dai *dai, int mute) } static int wm8971_set_bias_level(struct snd_soc_codec *codec, - enum snd_soc_bias_level level) + enum snd_soc_bias_level level) { u16 pwr_reg = snd_soc_read(codec, WM8971_PWR1) & 0xfe3e; @@ -580,11 +583,12 @@ static int wm8971_set_bias_level(struct snd_soc_codec *codec, } #define WM8971_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 WM8971_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ - SNDRV_PCM_FMTBIT_S24_LE) + SNDRV_PCM_FMTBIT_S24_LE) static const struct snd_soc_dai_ops wm8971_dai_ops = { .hw_params = wm8971_pcm_hw_params, @@ -616,6 +620,7 @@ static void wm8971_work(struct work_struct *work) container_of(work, struct snd_soc_dapm_context, delayed_work.work); struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm); + wm8971_set_bias_level(codec, codec->dapm.bias_level); } @@ -637,7 +642,7 @@ static int wm8971_resume(struct snd_soc_codec *codec) snd_soc_write(codec, WM8971_PWR1, reg | 0x01c0); codec->dapm.bias_level = SND_SOC_BIAS_ON; queue_delayed_work(wm8971_workq, &codec->dapm.delayed_work, - msecs_to_jiffies(1000)); + msecs_to_jiffies(1000)); } return 0; @@ -660,7 +665,7 @@ static int wm8971_probe(struct snd_soc_codec *codec) snd_soc_write(codec, WM8971_PWR1, reg | 0x01c0); codec->dapm.bias_level = SND_SOC_BIAS_STANDBY; queue_delayed_work(wm8971_workq, &codec->dapm.delayed_work, - msecs_to_jiffies(1000)); + msecs_to_jiffies(1000)); /* set the update bits */ snd_soc_update_bits(codec, WM8971_LDAC, 0x0100, 0x0100); @@ -675,7 +680,6 @@ static int wm8971_probe(struct snd_soc_codec *codec) return ret; } - /* power down chip */ static int wm8971_remove(struct snd_soc_codec *codec) { @@ -729,8 +733,8 @@ static int wm8971_i2c_probe(struct i2c_client *i2c, i2c_set_clientdata(i2c, wm8971); - ret = snd_soc_register_codec(&i2c->dev, - &soc_codec_dev_wm8971, &wm8971_dai, 1); + ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm8971, + &wm8971_dai, 1); return ret; } diff --git a/sound/soc/codecs/wm8971.h b/sound/soc/codecs/wm8971.h index f31c38f..dc38e21 100644 --- a/sound/soc/codecs/wm8971.h +++ b/sound/soc/codecs/wm8971.h @@ -22,25 +22,25 @@ #define WM8971_ADCDAC 0x05 #define WM8971_IFACE 0x07 #define WM8971_SRATE 0x08 -#define WM8971_LDAC 0x0a -#define WM8971_RDAC 0x0b -#define WM8971_BASS 0x0c +#define WM8971_LDAC 0x0a +#define WM8971_RDAC 0x0b +#define WM8971_BASS 0x0c #define WM8971_TREBLE 0x0d #define WM8971_RESET 0x0f -#define WM8971_ALC1 0x11 -#define WM8971_ALC2 0x12 -#define WM8971_ALC3 0x13 +#define WM8971_ALC1 0x11 +#define WM8971_ALC2 0x12 +#define WM8971_ALC3 0x13 #define WM8971_NGATE 0x14 -#define WM8971_LADC 0x15 -#define WM8971_RADC 0x16 -#define WM8971_ADCTL1 0x17 -#define WM8971_ADCTL2 0x18 -#define WM8971_PWR1 0x19 -#define WM8971_PWR2 0x1a -#define WM8971_ADCTL3 0x1b +#define WM8971_LADC 0x15 +#define WM8971_RADC 0x16 +#define WM8971_ADCTL1 0x17 +#define WM8971_ADCTL2 0x18 +#define WM8971_PWR1 0x19 +#define WM8971_PWR2 0x1a +#define WM8971_ADCTL3 0x1b #define WM8971_ADCIN 0x1f -#define WM8971_LADCIN 0x20 -#define WM8971_RADCIN 0x21 +#define WM8971_LADCIN 0x20 +#define WM8971_RADCIN 0x21 #define WM8971_LOUTM1 0x22 #define WM8971_LOUTM2 0x23 #define WM8971_ROUTM1 0x24