diff options
Diffstat (limited to 'sound/soc/codecs/tscs454.c')
| -rw-r--r-- | sound/soc/codecs/tscs454.c | 58 |
1 files changed, 27 insertions, 31 deletions
diff --git a/sound/soc/codecs/tscs454.c b/sound/soc/codecs/tscs454.c index 43220bb36701..64d0da40fbaf 100644 --- a/sound/soc/codecs/tscs454.c +++ b/sound/soc/codecs/tscs454.c @@ -10,6 +10,7 @@ #include <linux/i2c.h> #include <linux/err.h> #include <linux/string.h> +#include <linux/string_choices.h> #include <linux/module.h> #include <linux/delay.h> #include <linux/mutex.h> @@ -57,7 +58,7 @@ struct internal_rate { struct aif { unsigned int id; - bool master; + bool provider; struct pll *pll; }; @@ -307,8 +308,7 @@ struct reg_setting { static int coeff_ram_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *component = - snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); struct tscs454 *tscs454 = snd_soc_component_get_drvdata(component); struct coeff_ram_ctl *ctl = (struct coeff_ram_ctl *)kcontrol->private_value; @@ -388,8 +388,7 @@ static int write_coeff_ram(struct snd_soc_component *component, u8 *coeff_ram, static int coeff_ram_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *component = - snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); struct tscs454 *tscs454 = snd_soc_component_get_drvdata(component); struct coeff_ram_ctl *ctl = (struct coeff_ram_ctl *)kcontrol->private_value; @@ -737,9 +736,7 @@ static int pll_power_event(struct snd_soc_dapm_widget *w, ret = snd_soc_component_update_bits(component, R_PLLCTL, msk, val); if (ret < 0) { dev_err(component->dev, "Failed to %s PLL %d (%d)\n", - enable ? "enable" : "disable", - pll1 ? 1 : 2, - ret); + str_enable_disable(enable), pll1 ? 1 : 2, ret); return ret; } @@ -756,8 +753,8 @@ static int pll_power_event(struct snd_soc_dapm_widget *w, return 0; } -static inline int aif_set_master(struct snd_soc_component *component, - unsigned int aif_id, bool master) +static inline int aif_set_provider(struct snd_soc_component *component, + unsigned int aif_id, bool provider) { unsigned int reg; unsigned int mask; @@ -780,12 +777,12 @@ static inline int aif_set_master(struct snd_soc_component *component, return ret; } mask = FM_I2SPCTL_PORTMS; - val = master ? FV_PORTMS_MASTER : FV_PORTMS_SLAVE; + val = provider ? FV_PORTMS_MASTER : FV_PORTMS_SLAVE; ret = snd_soc_component_update_bits(component, reg, mask, val); if (ret < 0) { dev_err(component->dev, "Failed to set DAI %d to %s (%d)\n", - aif_id, master ? "master" : "slave", ret); + aif_id, provider ? "provider" : "consumer", ret); return ret; } @@ -797,7 +794,7 @@ int aif_prepare(struct snd_soc_component *component, struct aif *aif) { int ret; - ret = aif_set_master(component, aif->id, aif->master); + ret = aif_set_provider(component, aif->id, aif->provider); if (ret < 0) return ret; @@ -820,7 +817,7 @@ static inline int aif_free(struct snd_soc_component *component, if (!aif_active(&tscs454->aifs_status, aif->id)) { /* Do config in slave mode */ - aif_set_master(component, aif->id, false); + aif_set_provider(component, aif->id, false); dev_dbg(component->dev, "Freeing pll %d from aif %d\n", aif->pll->id, aif->id); free_pll(aif->pll); @@ -2708,17 +2705,17 @@ static int tscs454_set_bclk_ratio(struct snd_soc_dai *dai, return 0; } -static inline int set_aif_master_from_fmt(struct snd_soc_component *component, +static inline int set_aif_provider_from_fmt(struct snd_soc_component *component, struct aif *aif, unsigned int fmt) { int ret; - switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { - case SND_SOC_DAIFMT_CBM_CFM: - aif->master = true; + switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) { + case SND_SOC_DAIFMT_CBP_CFP: + aif->provider = true; break; - case SND_SOC_DAIFMT_CBS_CFS: - aif->master = false; + case SND_SOC_DAIFMT_CBC_CFC: + aif->provider = false; break; default: ret = -EINVAL; @@ -2888,7 +2885,7 @@ static int tscs454_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) struct aif *aif = &tscs454->aifs[dai->id]; int ret; - ret = set_aif_master_from_fmt(component, aif, fmt); + ret = set_aif_provider_from_fmt(component, aif, fmt); if (ret < 0) return ret; @@ -3120,18 +3117,17 @@ static int set_aif_sample_format(struct snd_soc_component *component, unsigned int width; int ret; - switch (format) { - case SNDRV_PCM_FORMAT_S16_LE: + switch (snd_pcm_format_width(format)) { + case 16: width = FV_WL_16; break; - case SNDRV_PCM_FORMAT_S20_3LE: + case 20: width = FV_WL_20; break; - case SNDRV_PCM_FORMAT_S24_3LE: + case 24: width = FV_WL_24; break; - case SNDRV_PCM_FORMAT_S24_LE: - case SNDRV_PCM_FORMAT_S32_LE: + case 32: width = FV_WL_32; break; default: @@ -3326,6 +3322,7 @@ static const struct snd_soc_component_driver soc_component_dev_tscs454 = { .num_dapm_routes = ARRAY_SIZE(tscs454_intercon), .controls = tscs454_snd_controls, .num_controls = ARRAY_SIZE(tscs454_snd_controls), + .endianness = 1, }; #define TSCS454_RATES SNDRV_PCM_RATE_8000_96000 @@ -3400,8 +3397,7 @@ static struct snd_soc_dai_driver tscs454_dais[] = { static char const * const src_names[] = { "xtal", "mclk1", "mclk2", "bclk"}; -static int tscs454_i2c_probe(struct i2c_client *i2c, - const struct i2c_device_id *id) +static int tscs454_i2c_probe(struct i2c_client *i2c) { struct tscs454 *tscs454; int src; @@ -3458,7 +3454,7 @@ static int tscs454_i2c_probe(struct i2c_client *i2c, } static const struct i2c_device_id tscs454_i2c_id[] = { - { "tscs454", 0 }, + { "tscs454" }, { } }; MODULE_DEVICE_TABLE(i2c, tscs454_i2c_id); @@ -3474,7 +3470,7 @@ static struct i2c_driver tscs454_i2c_driver = { .name = "tscs454", .of_match_table = tscs454_of_match, }, - .probe = tscs454_i2c_probe, + .probe = tscs454_i2c_probe, .id_table = tscs454_i2c_id, }; |
