fixed all CHECK and WARNING for checkpatch --strict result removed MODULE_AUTHOR to make one maintainer.
Signed-off-by: George Song george.song@maximintegrated.com --- sound/soc/codecs/Kconfig | 7 +++ sound/soc/codecs/max98520.c | 121 +++++++++++++++++------------------- 2 files changed, 64 insertions(+), 64 deletions(-)
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 86b121d2f381..e8817029c671 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -926,6 +926,13 @@ config SND_SOC_MAX98927 config SND_SOC_MAX98520 tristate "Maxim Integrated MAX98520 Speaker Amplifier" depends on I2C + help + Enable support for Maxim Integrated MAX98520 audio + amplifier, which implements a tripler charge pump + based boost converter and support sample rates of + 8KHz to 192KHz. + + To compile this driver as a module, choose M here.
config SND_SOC_MAX98373 tristate diff --git a/sound/soc/codecs/max98520.c b/sound/soc/codecs/max98520.c index 1a5e0ceae362..163cc0f106af 100644 --- a/sound/soc/codecs/max98520.c +++ b/sound/soc/codecs/max98520.c @@ -90,9 +90,9 @@ static int max98520_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) }
regmap_update_bits(max98520->regmap, - MAX98520_R2041_PCM_CLK_SETUP, - MAX98520_PCM_MODE_CFG_PCM_BCLKEDGE, - invert); + MAX98520_R2041_PCM_CLK_SETUP, + MAX98520_PCM_MODE_CFG_PCM_BCLKEDGE, + invert);
/* interface format */ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { @@ -113,9 +113,9 @@ static int max98520_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) }
regmap_update_bits(max98520->regmap, - MAX98520_R2040_PCM_MODE_CFG, - MAX98520_PCM_MODE_CFG_FORMAT_MASK, - format << MAX98520_PCM_MODE_CFG_FORMAT_SHIFT); + MAX98520_R2040_PCM_MODE_CFG, + MAX98520_PCM_MODE_CFG_FORMAT_MASK, + format << MAX98520_PCM_MODE_CFG_FORMAT_SHIFT);
return 0; } @@ -137,7 +137,7 @@ static int max98520_get_bclk_sel(int bclk) }
static int max98520_set_clock(struct snd_soc_component *component, - struct snd_pcm_hw_params *params) + struct snd_pcm_hw_params *params) { struct max98520_priv *max98520 = snd_soc_component_get_drvdata(component); @@ -155,17 +155,17 @@ static int max98520_set_clock(struct snd_soc_component *component, }
regmap_update_bits(max98520->regmap, - MAX98520_R2041_PCM_CLK_SETUP, - MAX98520_PCM_CLK_SETUP_BSEL_MASK, - value); + MAX98520_R2041_PCM_CLK_SETUP, + MAX98520_PCM_CLK_SETUP_BSEL_MASK, + value); } dev_dbg(component->dev, "%s tdm_mode:%d out\n", __func__, max98520->tdm_mode); return 0; }
static int max98520_dai_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_component *component = dai->component; struct max98520_priv *max98520 = @@ -193,8 +193,8 @@ static int max98520_dai_hw_params(struct snd_pcm_substream *substream, max98520->ch_size = snd_pcm_format_width(params_format(params));
regmap_update_bits(max98520->regmap, - MAX98520_R2040_PCM_MODE_CFG, - MAX98520_PCM_MODE_CFG_CHANSZ_MASK, chan_sz); + MAX98520_R2040_PCM_MODE_CFG, + MAX98520_PCM_MODE_CFG_CHANSZ_MASK, chan_sz);
dev_dbg(component->dev, "format supported %d", params_format(params)); @@ -250,9 +250,9 @@ static int max98520_dai_hw_params(struct snd_pcm_substream *substream, snd_pcm_format_width(params_format(params)), params_rate(params)); /* set DAI_SR to correct LRCLK frequency */ regmap_update_bits(max98520->regmap, - MAX98520_R2042_PCM_SR_SETUP, - MAX98520_PCM_SR_MASK, - sampling_rate); + MAX98520_R2042_PCM_SR_SETUP, + MAX98520_PCM_SR_MASK, + sampling_rate);
return max98520_set_clock(component, params); err: @@ -261,8 +261,8 @@ static int max98520_dai_hw_params(struct snd_pcm_substream *substream, }
static int max98520_dai_tdm_slot(struct snd_soc_dai *dai, - unsigned int tx_mask, unsigned int rx_mask, - int slots, int slot_width) + unsigned int tx_mask, unsigned int rx_mask, + int slots, int slot_width) { struct snd_soc_component *component = dai->component; struct max98520_priv *max98520 = @@ -284,9 +284,9 @@ static int max98520_dai_tdm_slot(struct snd_soc_dai *dai, }
regmap_update_bits(max98520->regmap, - MAX98520_R2041_PCM_CLK_SETUP, - MAX98520_PCM_CLK_SETUP_BSEL_MASK, - bsel); + MAX98520_R2041_PCM_CLK_SETUP, + MAX98520_PCM_CLK_SETUP_BSEL_MASK, + bsel);
/* Channel size configuration */ switch (slot_width) { @@ -306,18 +306,18 @@ static int max98520_dai_tdm_slot(struct snd_soc_dai *dai, }
regmap_update_bits(max98520->regmap, - MAX98520_R2040_PCM_MODE_CFG, - MAX98520_PCM_MODE_CFG_CHANSZ_MASK, chan_sz); + MAX98520_R2040_PCM_MODE_CFG, + MAX98520_PCM_MODE_CFG_CHANSZ_MASK, chan_sz);
/* Rx slot configuration */ regmap_update_bits(max98520->regmap, - MAX98520_R2044_PCM_RX_SRC2, - MAX98520_PCM_DMIX_CH0_SRC_MASK, - rx_mask); + MAX98520_R2044_PCM_RX_SRC2, + MAX98520_PCM_DMIX_CH0_SRC_MASK, + rx_mask); regmap_update_bits(max98520->regmap, - MAX98520_R2044_PCM_RX_SRC2, - MAX98520_PCM_DMIX_CH1_SRC_MASK, - rx_mask << MAX98520_PCM_DMIX_CH1_SHIFT); + MAX98520_R2044_PCM_RX_SRC2, + MAX98520_PCM_DMIX_CH1_SRC_MASK, + rx_mask << MAX98520_PCM_DMIX_CH1_SHIFT);
return 0; } @@ -334,14 +334,13 @@ static const struct snd_soc_dai_ops max98520_dai_ops = { };
static int max98520_dac_event(struct snd_soc_dapm_widget *w, - struct snd_kcontrol *kcontrol, int event) + struct snd_kcontrol *kcontrol, int event) { struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); struct max98520_priv *max98520 = snd_soc_component_get_drvdata(component);
- switch (event) { case SND_SOC_DAPM_POST_PMU: dev_dbg(component->dev, " AMP ON\n"); @@ -367,14 +366,14 @@ static const char * const max98520_switch_text[] = {
static const struct soc_enum dai_sel_enum = SOC_ENUM_SINGLE(MAX98520_R2043_PCM_RX_SRC1, - 0, 3, max98520_switch_text); + 0, 3, max98520_switch_text);
static const struct snd_kcontrol_new max98520_dai_controls = SOC_DAPM_ENUM("DAI Sel", dai_sel_enum);
static const struct snd_soc_dapm_widget max98520_dapm_widgets[] = { SND_SOC_DAPM_DAC_E("Amp Enable", "HiFi Playback", - MAX98520_R209F_AMP_EN, 0, 0, max98520_dac_event, + MAX98520_R209F_AMP_EN, 0, 0, max98520_dac_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_MUX("DAI Sel Mux", SND_SOC_NOPM, 0, 0, &max98520_dai_controls), SND_SOC_DAPM_OUTPUT("BE_OUT"), @@ -472,14 +471,14 @@ static bool max98520_volatile_reg(struct device *dev, unsigned int reg) static const struct snd_kcontrol_new max98520_snd_controls[] = { /* Volume */ SOC_SINGLE_TLV("Digital Volume", MAX98520_R2090_AMP_VOL_CTRL, - 0, 0x7F, 1, max98520_digital_tlv), + 0, 0x7F, 1, max98520_digital_tlv), SOC_SINGLE_TLV("Speaker Volume", MAX98520_R2091_AMP_PATH_GAIN, - 0, 0x5, 0, max98520_spk_tlv), + 0, 0x5, 0, max98520_spk_tlv), /* Volume Ramp Up/Down Enable*/ SOC_SINGLE("Ramp Up Switch", MAX98520_R2092_AMP_DSP_CFG, - MAX98520_DSP_SPK_VOL_RMPUP_SHIFT, 1, 0), + MAX98520_DSP_SPK_VOL_RMPUP_SHIFT, 1, 0), SOC_SINGLE("Ramp Down Switch", MAX98520_R2092_AMP_DSP_CFG, - MAX98520_DSP_SPK_VOL_RMPDN_SHIFT, 1, 0), + MAX98520_DSP_SPK_VOL_RMPDN_SHIFT, 1, 0), /* Clock Monitor Enable */ SOC_SINGLE("CLK Monitor Switch", MAX98520_R2037_ERR_MON_CTRL, MAX98520_CTRL_CMON_EN_SHIFT, 1, 0), @@ -507,27 +506,25 @@ SOC_SINGLE("Speaker Mode Switch", MAX98520_R2095_AMP_CFG, /* Dynamic Headroom Tracking */ SOC_SINGLE("DHT Switch", MAX98520_R20D8_DHT_EN, 0, 1, 0), SOC_SINGLE("DHT Limiter Mode", MAX98520_R20D2_LIMITER_CFG2, - MAX98520_DHT_LIMITER_MODE_SHIFT, 1, 0), + MAX98520_DHT_LIMITER_MODE_SHIFT, 1, 0), SOC_SINGLE("DHT Hysteresis Switch", MAX98520_R20D6_DHT_HYSTERESIS_CFG, - MAX98520_DHT_HYSTERESIS_SWITCH_SHIFT, 1, 0), + MAX98520_DHT_HYSTERESIS_SWITCH_SHIFT, 1, 0), SOC_SINGLE_TLV("DHT Rot Pnt", MAX98520_R20D0_DHT_CFG1, - MAX98520_DHT_VROT_PNT_SHIFT, 10, 1, max98520_dht_rotation_point_tlv), + MAX98520_DHT_VROT_PNT_SHIFT, 10, 1, max98520_dht_rotation_point_tlv), SOC_SINGLE_TLV("DHT Supply Headroom", MAX98520_R20D1_LIMITER_CFG1, - MAX98520_DHT_SUPPLY_HR_SHIFT, 16, 0, max98520_dht_supply_hr_tlv), + MAX98520_DHT_SUPPLY_HR_SHIFT, 16, 0, max98520_dht_supply_hr_tlv), SOC_SINGLE_TLV("DHT Limiter Threshold", MAX98520_R20D2_LIMITER_CFG2, - MAX98520_DHT_LIMITER_THRESHOLD_SHIFT, 0xF, 1, max98520_dht_lim_thresh_tlv), + MAX98520_DHT_LIMITER_THRESHOLD_SHIFT, 0xF, 1, max98520_dht_lim_thresh_tlv), SOC_SINGLE_TLV("DHT Max Attenuation", MAX98520_R20D3_DHT_CFG2, - MAX98520_DHT_MAX_ATTEN_SHIFT, 20, 1, max98520_dht_max_atten_tlv), + MAX98520_DHT_MAX_ATTEN_SHIFT, 20, 1, max98520_dht_max_atten_tlv), SOC_SINGLE_TLV("DHT Hysteresis", MAX98520_R20D6_DHT_HYSTERESIS_CFG, - MAX98520_DHT_HYSTERESIS_SHIFT, 0x7, 0, max98520_dht_hysteresis_tlv), + MAX98520_DHT_HYSTERESIS_SHIFT, 0x7, 0, max98520_dht_hysteresis_tlv), SOC_ENUM("DHT Attack Rate", max98520_dht_attack_rate_enum), SOC_ENUM("DHT Release Rate", max98520_dht_release_rate_enum), /* ADC configuration */ SOC_SINGLE("ADC PVDD CH Switch", MAX98520_R20CF_MEAS_ADC_CFG, 0, 1, 0), -SOC_SINGLE("ADC PVDD FLT Switch", MAX98520_R20B2_ADC_PVDD0_CFG, - MAX98520_FLT_EN_SHIFT, 1, 0), -SOC_SINGLE("ADC TEMP FLT Switch", MAX98520_R20B3_ADC_THERMAL_CFG, - MAX98520_FLT_EN_SHIFT, 1, 0), +SOC_SINGLE("ADC PVDD FLT Switch", MAX98520_R20B2_ADC_PVDD0_CFG, MAX98520_FLT_EN_SHIFT, 1, 0), +SOC_SINGLE("ADC TEMP FLT Switch", MAX98520_R20B3_ADC_THERMAL_CFG, MAX98520_FLT_EN_SHIFT, 1, 0), SOC_SINGLE("ADC PVDD MSB", MAX98520_R20B6_ADC_PVDD_READBACK_MSB, 0, 0xFF, 0), SOC_SINGLE("ADC PVDD LSB", MAX98520_R20B7_ADC_PVDD_READBACK_LSB, 0, 0x01, 0), SOC_SINGLE("ADC TEMP MSB", MAX98520_R20B8_ADC_TEMP_READBACK_MSB, 0, 0xFF, 0), @@ -597,7 +594,7 @@ static int max98520_probe(struct snd_soc_component *component) regmap_update_bits(max98520->regmap, MAX98520_R2092_AMP_DSP_CFG, 1, 1); /* Disable Speaker Safe Mode */ regmap_update_bits(max98520->regmap, - MAX98520_R2092_AMP_DSP_CFG, MAX98520_SPK_SAFE_EN_MASK, 0); + MAX98520_R2092_AMP_DSP_CFG, MAX98520_SPK_SAFE_EN_MASK, 0); /* Enable Clock Monitor Auto-restart */ regmap_write(max98520->regmap, MAX98520_R2030_CLK_MON_CTRL, 0x1);
@@ -609,8 +606,9 @@ static int max98520_probe(struct snd_soc_component *component)
/* set Rx Enable */ regmap_update_bits(max98520->regmap, - MAX98520_R204F_PCM_RX_EN, - MAX98520_PCM_RX_EN_MASK, 1); + MAX98520_R204F_PCM_RX_EN, + MAX98520_PCM_RX_EN_MASK, + 1);
return 0; } @@ -624,6 +622,7 @@ static int max98520_suspend(struct device *dev) regcache_mark_dirty(max98520->regmap); return 0; } + static int max98520_resume(struct device *dev) { struct max98520_priv *max98520 = dev_get_drvdata(dev); @@ -664,18 +663,14 @@ static const struct regmap_config max98520_regmap = { .cache_type = REGCACHE_RBTREE, };
-static int max98520_i2c_probe(struct i2c_client *i2c, - const struct i2c_device_id *id) +static int max98520_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { - int ret = 0; int reg = 0; struct max98520_priv *max98520 = NULL; struct i2c_adapter *adapter = to_i2c_adapter(i2c->dev.parent);
- ret = i2c_check_functionality(adapter, - I2C_FUNC_SMBUS_BYTE - | I2C_FUNC_SMBUS_BYTE_DATA); + ret = i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE | I2C_FUNC_SMBUS_BYTE_DATA); if (!ret) { dev_err(&i2c->dev, "I2C check functionality failed\n"); return -ENXIO; @@ -690,8 +685,8 @@ static int max98520_i2c_probe(struct i2c_client *i2c, i2c_set_clientdata(i2c, max98520);
/* regmap initialization */ - max98520->regmap - = devm_regmap_init_i2c(i2c, &max98520_regmap); + max98520->regmap = + devm_regmap_init_i2c(i2c, &max98520_regmap); if (IS_ERR(max98520->regmap)) { ret = PTR_ERR(max98520->regmap); dev_err(&i2c->dev, @@ -715,8 +710,7 @@ static int max98520_i2c_probe(struct i2c_client *i2c, }
/* Check Revision ID */ - ret = regmap_read(max98520->regmap, - MAX98520_R21FF_REVISION_ID, ®); + ret = regmap_read(max98520->regmap, MAX98520_R21FF_REVISION_ID, ®); if (ret < 0) { dev_err(&i2c->dev, "Failed to read: 0x%02X\n", MAX98520_R21FF_REVISION_ID); @@ -771,7 +765,6 @@ static struct i2c_driver max98520_i2c_driver = { module_i2c_driver(max98520_i2c_driver)
MODULE_DESCRIPTION("ALSA SoC MAX98520 driver"); -MODULE_AUTHOR("Ryan Lee ryans.lee@analog.com"); -MODULE_AUTHOR("George Song george.song@analog.com"); +MODULE_AUTHOR("George Song george.song@maximintegrated.com"); MODULE_LICENSE("GPL");