Now we can replace Codec to Component. Let's do it. Intel mfld_machine is using sn95031, but there is no compile method...
Note: xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 1 -> .idle_bias_on = 0 .ignore_pmdown_time = 0 -> .pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/codecs/sn95031.c | 219 ++++++++++++++++------------------ sound/soc/codecs/sn95031.h | 2 +- sound/soc/intel/boards/mfld_machine.c | 12 +- 3 files changed, 112 insertions(+), 121 deletions(-)
diff --git a/sound/soc/codecs/sn95031.c b/sound/soc/codecs/sn95031.c index 887923e..1a03088 100644 --- a/sound/soc/codecs/sn95031.c +++ b/sound/soc/codecs/sn95031.c @@ -46,16 +46,16 @@ /* adc helper functions */
/* enables mic bias voltage */ -static void sn95031_enable_mic_bias(struct snd_soc_codec *codec) +static void sn95031_enable_mic_bias(struct snd_soc_component *component) { - snd_soc_write(codec, SN95031_VAUD, BIT(2)|BIT(1)|BIT(0)); - snd_soc_update_bits(codec, SN95031_MICBIAS, BIT(2), BIT(2)); + snd_soc_component_write(component, SN95031_VAUD, BIT(2)|BIT(1)|BIT(0)); + snd_soc_component_update_bits(component, SN95031_MICBIAS, BIT(2), BIT(2)); }
/* Enable/Disable the ADC depending on the argument */ -static void configure_adc(struct snd_soc_codec *sn95031_codec, int val) +static void configure_adc(struct snd_soc_component *sn95031, int val) { - int value = snd_soc_read(sn95031_codec, SN95031_ADC1CNTL1); + int value = snd_soc_component_read32(sn95031, SN95031_ADC1CNTL1);
if (val) { /* Enable and start the ADC */ @@ -65,7 +65,7 @@ static void configure_adc(struct snd_soc_codec *sn95031_codec, int val) /* Just stop the ADC */ value &= (~SN95031_ADC_START); } - snd_soc_write(sn95031_codec, SN95031_ADC1CNTL1, value); + snd_soc_component_write(sn95031, SN95031_ADC1CNTL1, value); }
/* @@ -78,19 +78,19 @@ static void configure_adc(struct snd_soc_codec *sn95031_codec, int val) * Context: can sleep * */ -static int find_free_channel(struct snd_soc_codec *sn95031_codec) +static int find_free_channel(struct snd_soc_component *sn95031) { int i, value;
/* check whether ADC is enabled */ - value = snd_soc_read(sn95031_codec, SN95031_ADC1CNTL1); + value = snd_soc_component_read32(sn95031, SN95031_ADC1CNTL1);
if ((value & SN95031_ADC_ENBL) == 0) return 0;
/* ADC is already enabled; Looking for an empty channel */ for (i = 0; i < SN95031_ADC_CHANLS_MAX; i++) { - value = snd_soc_read(sn95031_codec, + value = snd_soc_component_read32(sn95031, SN95031_ADC_CHNL_START_ADDR + i); if (value & SN95031_STOPBIT_MASK) break; @@ -99,14 +99,14 @@ static int find_free_channel(struct snd_soc_codec *sn95031_codec) }
/* Initialize the ADC for reading micbias values. Can sleep. */ -static int sn95031_initialize_adc(struct snd_soc_codec *sn95031_codec) +static int sn95031_initialize_adc(struct snd_soc_component *sn95031) { int base_addr, chnl_addr; int value; int channel_index;
/* Index of the first channel in which the stop bit is set */ - channel_index = find_free_channel(sn95031_codec); + channel_index = find_free_channel(sn95031); if (channel_index < 0) { pr_err("No free ADC channels"); return channel_index; @@ -116,9 +116,9 @@ static int sn95031_initialize_adc(struct snd_soc_codec *sn95031_codec)
if (!(channel_index == 0 || channel_index == SN95031_ADC_LOOP_MAX)) { /* Reset stop bit for channels other than 0 and 12 */ - value = snd_soc_read(sn95031_codec, base_addr); + value = snd_soc_component_read32(sn95031, base_addr); /* Set the stop bit to zero */ - snd_soc_write(sn95031_codec, base_addr, value & 0xEF); + snd_soc_component_write(sn95031, base_addr, value & 0xEF); /* Index of the first free channel */ base_addr++; channel_index++; @@ -126,35 +126,35 @@ static int sn95031_initialize_adc(struct snd_soc_codec *sn95031_codec)
/* Since this is the last channel, set the stop bit to 1 by ORing the DIE_SENSOR_CODE with 0x10 */ - snd_soc_write(sn95031_codec, base_addr, + snd_soc_component_write(sn95031, base_addr, SN95031_AUDIO_DETECT_CODE | 0x10);
chnl_addr = SN95031_ADC_DATA_START_ADDR + 2 * channel_index; pr_debug("mid_initialize : %x", chnl_addr); - configure_adc(sn95031_codec, 1); + configure_adc(sn95031, 1); return chnl_addr; }
/* reads the ADC registers and gets the mic bias value in mV. */ -static unsigned int sn95031_get_mic_bias(struct snd_soc_codec *codec) +static unsigned int sn95031_get_mic_bias(struct snd_soc_component *component) { - u16 adc_adr = sn95031_initialize_adc(codec); + u16 adc_adr = sn95031_initialize_adc(component); u16 adc_val1, adc_val2; unsigned int mic_bias;
- sn95031_enable_mic_bias(codec); + sn95031_enable_mic_bias(component);
/* Enable the sound card for conversion before reading */ - snd_soc_write(codec, SN95031_ADC1CNTL3, 0x05); + snd_soc_component_write(component, SN95031_ADC1CNTL3, 0x05); /* Re-toggle the RRDATARD bit */ - snd_soc_write(codec, SN95031_ADC1CNTL3, 0x04); + snd_soc_component_write(component, SN95031_ADC1CNTL3, 0x04);
/* Read the higher bits of data */ msleep(1000); - adc_val1 = snd_soc_read(codec, adc_adr); + adc_val1 = snd_soc_component_read32(component, adc_adr); adc_adr++; - adc_val2 = snd_soc_read(codec, adc_adr); + adc_val2 = snd_soc_component_read32(component, adc_adr);
/* Adding lower two bits to the higher bits */ mic_bias = (adc_val1 << 2) + (adc_val2 & 3); @@ -186,7 +186,7 @@ static int sn95031_write(void *ctx, unsigned int reg, unsigned int value) .reg_write = sn95031_write, };
-static int sn95031_set_vaud_bias(struct snd_soc_codec *codec, +static int sn95031_set_vaud_bias(struct snd_soc_component *component, enum snd_soc_bias_level level) { switch (level) { @@ -194,30 +194,30 @@ static int sn95031_set_vaud_bias(struct snd_soc_codec *codec, break;
case SND_SOC_BIAS_PREPARE: - if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_STANDBY) { + if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_STANDBY) { pr_debug("vaud_bias powering up pll\n"); /* power up the pll */ - snd_soc_write(codec, SN95031_AUDPLLCTRL, BIT(5)); + snd_soc_component_write(component, SN95031_AUDPLLCTRL, BIT(5)); /* enable pcm 2 */ - snd_soc_update_bits(codec, SN95031_PCM2C2, + snd_soc_component_update_bits(component, SN95031_PCM2C2, BIT(0), BIT(0)); } break;
case SND_SOC_BIAS_STANDBY: - switch (snd_soc_codec_get_bias_level(codec)) { + switch (snd_soc_component_get_bias_level(component)) { case SND_SOC_BIAS_OFF: pr_debug("vaud_bias power up rail\n"); /* power up the rail */ - snd_soc_write(codec, SN95031_VAUD, + snd_soc_component_write(component, SN95031_VAUD, BIT(2)|BIT(1)|BIT(0)); msleep(1); break; case SND_SOC_BIAS_PREPARE: /* turn off pcm */ pr_debug("vaud_bias power dn pcm\n"); - snd_soc_update_bits(codec, SN95031_PCM2C2, BIT(0), 0); - snd_soc_write(codec, SN95031_AUDPLLCTRL, 0); + snd_soc_component_update_bits(component, SN95031_PCM2C2, BIT(0), 0); + snd_soc_component_write(component, SN95031_AUDPLLCTRL, 0); break; default: break; @@ -227,7 +227,7 @@ static int sn95031_set_vaud_bias(struct snd_soc_codec *codec,
case SND_SOC_BIAS_OFF: pr_debug("vaud_bias _OFF doing rail shutdown\n"); - snd_soc_write(codec, SN95031_VAUD, BIT(3)); + snd_soc_component_write(component, SN95031_VAUD, BIT(3)); break; }
@@ -237,18 +237,18 @@ static int sn95031_set_vaud_bias(struct snd_soc_codec *codec, static int sn95031_vhs_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { - struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
if (SND_SOC_DAPM_EVENT_ON(event)) { pr_debug("VHS SND_SOC_DAPM_EVENT_ON doing rail startup now\n"); /* power up the rail */ - snd_soc_write(codec, SN95031_VHSP, 0x3D); - snd_soc_write(codec, SN95031_VHSN, 0x3F); + snd_soc_component_write(component, SN95031_VHSP, 0x3D); + snd_soc_component_write(component, SN95031_VHSN, 0x3F); msleep(1); } else if (SND_SOC_DAPM_EVENT_OFF(event)) { pr_debug("VHS SND_SOC_DAPM_EVENT_OFF doing rail shutdown\n"); - snd_soc_write(codec, SN95031_VHSP, 0xC4); - snd_soc_write(codec, SN95031_VHSN, 0x04); + snd_soc_component_write(component, SN95031_VHSP, 0xC4); + snd_soc_component_write(component, SN95031_VHSN, 0x04); } return 0; } @@ -256,16 +256,16 @@ static int sn95031_vhs_event(struct snd_soc_dapm_widget *w, static int sn95031_vihf_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { - struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
if (SND_SOC_DAPM_EVENT_ON(event)) { pr_debug("VIHF SND_SOC_DAPM_EVENT_ON doing rail startup now\n"); /* power up the rail */ - snd_soc_write(codec, SN95031_VIHF, 0x27); + snd_soc_component_write(component, SN95031_VIHF, 0x27); msleep(1); } else if (SND_SOC_DAPM_EVENT_OFF(event)) { pr_debug("VIHF SND_SOC_DAPM_EVENT_OFF doing rail shutdown\n"); - snd_soc_write(codec, SN95031_VIHF, 0x24); + snd_soc_component_write(component, SN95031_VIHF, 0x24); } return 0; } @@ -273,7 +273,7 @@ static int sn95031_vihf_event(struct snd_soc_dapm_widget *w, static int sn95031_dmic12_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *k, int event) { - struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); unsigned int ldo = 0, clk_dir = 0, data_dir = 0;
if (SND_SOC_DAPM_EVENT_ON(event)) { @@ -282,16 +282,16 @@ static int sn95031_dmic12_event(struct snd_soc_dapm_widget *w, data_dir = BIT(7); } /* program DMIC LDO, clock and set clock */ - snd_soc_update_bits(codec, SN95031_MICBIAS, BIT(5)|BIT(4), ldo); - snd_soc_update_bits(codec, SN95031_DMICBUF0123, BIT(0), clk_dir); - snd_soc_update_bits(codec, SN95031_DMICBUF0123, BIT(7), data_dir); + snd_soc_component_update_bits(component, SN95031_MICBIAS, BIT(5)|BIT(4), ldo); + snd_soc_component_update_bits(component, SN95031_DMICBUF0123, BIT(0), clk_dir); + snd_soc_component_update_bits(component, SN95031_DMICBUF0123, BIT(7), data_dir); return 0; }
static int sn95031_dmic34_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *k, int event) { - struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); unsigned int ldo = 0, clk_dir = 0, data_dir = 0;
if (SND_SOC_DAPM_EVENT_ON(event)) { @@ -300,23 +300,23 @@ static int sn95031_dmic34_event(struct snd_soc_dapm_widget *w, data_dir = BIT(1); } /* program DMIC LDO, clock and set clock */ - snd_soc_update_bits(codec, SN95031_MICBIAS, BIT(5)|BIT(4), ldo); - snd_soc_update_bits(codec, SN95031_DMICBUF0123, BIT(2), clk_dir); - snd_soc_update_bits(codec, SN95031_DMICBUF45, BIT(1), data_dir); + snd_soc_component_update_bits(component, SN95031_MICBIAS, BIT(5)|BIT(4), ldo); + snd_soc_component_update_bits(component, SN95031_DMICBUF0123, BIT(2), clk_dir); + snd_soc_component_update_bits(component, SN95031_DMICBUF45, BIT(1), data_dir); return 0; }
static int sn95031_dmic56_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *k, int event) { - struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); unsigned int ldo = 0;
if (SND_SOC_DAPM_EVENT_ON(event)) ldo = BIT(7)|BIT(6);
/* program DMIC LDO */ - snd_soc_update_bits(codec, SN95031_MICBIAS, BIT(7)|BIT(6), ldo); + snd_soc_component_update_bits(component, SN95031_MICBIAS, BIT(7)|BIT(6), ldo); return 0; }
@@ -651,18 +651,18 @@ static SOC_ENUM_SINGLE_DECL(sn95031_dmic56_cfg_enum, /* speaker and headset mutes, for audio pops and clicks */ static int sn95031_pcm_hs_mute(struct snd_soc_dai *dai, int mute) { - snd_soc_update_bits(dai->codec, + snd_soc_component_update_bits(dai->component, SN95031_HSLVOLCTRL, BIT(7), (!mute << 7)); - snd_soc_update_bits(dai->codec, + snd_soc_component_update_bits(dai->component, SN95031_HSRVOLCTRL, BIT(7), (!mute << 7)); return 0; }
static int sn95031_pcm_spkr_mute(struct snd_soc_dai *dai, int mute) { - snd_soc_update_bits(dai->codec, + snd_soc_component_update_bits(dai->component, SN95031_IHFLVOLCTRL, BIT(7), (!mute << 7)); - snd_soc_update_bits(dai->codec, + snd_soc_component_update_bits(dai->component, SN95031_IHFRVOLCTRL, BIT(7), (!mute << 7)); return 0; } @@ -683,7 +683,7 @@ static int sn95031_pcm_hw_params(struct snd_pcm_substream *substream, default: return -EINVAL; } - snd_soc_update_bits(dai->codec, SN95031_PCM2C2, + snd_soc_component_update_bits(dai->component, SN95031_PCM2C2, BIT(4)|BIT(5), format);
switch (params_rate(params)) { @@ -701,7 +701,7 @@ static int sn95031_pcm_hw_params(struct snd_pcm_substream *substream, pr_err("ERR rate %d\n", params_rate(params)); return -EINVAL; } - snd_soc_update_bits(dai->codec, SN95031_PCM1C1, BIT(7), rate); + snd_soc_component_update_bits(dai->component, SN95031_PCM1C1, BIT(7), rate);
return 0; } @@ -776,31 +776,31 @@ static int sn95031_pcm_hw_params(struct snd_pcm_substream *substream, }, };
-static inline void sn95031_disable_jack_btn(struct snd_soc_codec *codec) +static inline void sn95031_disable_jack_btn(struct snd_soc_component *component) { - snd_soc_write(codec, SN95031_BTNCTRL2, 0x00); + snd_soc_component_write(component, SN95031_BTNCTRL2, 0x00); }
-static inline void sn95031_enable_jack_btn(struct snd_soc_codec *codec) +static inline void sn95031_enable_jack_btn(struct snd_soc_component *component) { - snd_soc_write(codec, SN95031_BTNCTRL1, 0x77); - snd_soc_write(codec, SN95031_BTNCTRL2, 0x01); + snd_soc_component_write(component, SN95031_BTNCTRL1, 0x77); + snd_soc_component_write(component, SN95031_BTNCTRL2, 0x01); }
-static int sn95031_get_headset_state(struct snd_soc_codec *codec, +static int sn95031_get_headset_state(struct snd_soc_component *component, struct snd_soc_jack *mfld_jack) { - int micbias = sn95031_get_mic_bias(codec); + int micbias = sn95031_get_mic_bias(component);
int jack_type = snd_soc_jack_get_type(mfld_jack, micbias);
pr_debug("jack type detected = %d\n", jack_type); if (jack_type == SND_JACK_HEADSET) - sn95031_enable_jack_btn(codec); + sn95031_enable_jack_btn(component); return jack_type; }
-void sn95031_jack_detection(struct snd_soc_codec *codec, +void sn95031_jack_detection(struct snd_soc_component *component, struct mfld_jack_data *jack_data) { unsigned int status; @@ -815,11 +815,11 @@ void sn95031_jack_detection(struct snd_soc_codec *codec, status = SND_JACK_HEADSET | SND_JACK_BTN_1; } else if (jack_data->intr_id & 0x4) { pr_debug("headset or headphones inserted\n"); - status = sn95031_get_headset_state(codec, jack_data->mfld_jack); + status = sn95031_get_headset_state(component, jack_data->mfld_jack); } else if (jack_data->intr_id & 0x8) { pr_debug("headset or headphones removed\n"); status = 0; - sn95031_disable_jack_btn(codec); + sn95031_disable_jack_btn(component); } else { pr_err("unidentified interrupt\n"); return; @@ -833,98 +833,89 @@ void sn95031_jack_detection(struct snd_soc_codec *codec, } EXPORT_SYMBOL_GPL(sn95031_jack_detection);
-/* codec registration */ -static int sn95031_codec_probe(struct snd_soc_codec *codec) +/* component registration */ +static int sn95031_component_probe(struct snd_soc_component *component) { - pr_debug("codec_probe called\n"); + pr_debug("component_probe called\n");
/* PCM interface config * This sets the pcm rx slot conguration to max 6 slots * for max 4 dais (2 stereo and 2 mono) */ - snd_soc_write(codec, SN95031_PCM2RXSLOT01, 0x10); - snd_soc_write(codec, SN95031_PCM2RXSLOT23, 0x32); - snd_soc_write(codec, SN95031_PCM2RXSLOT45, 0x54); - snd_soc_write(codec, SN95031_PCM2TXSLOT01, 0x10); - snd_soc_write(codec, SN95031_PCM2TXSLOT23, 0x32); + snd_soc_component_write(component, SN95031_PCM2RXSLOT01, 0x10); + snd_soc_component_write(component, SN95031_PCM2RXSLOT23, 0x32); + snd_soc_component_write(component, SN95031_PCM2RXSLOT45, 0x54); + snd_soc_component_write(component, SN95031_PCM2TXSLOT01, 0x10); + snd_soc_component_write(component, SN95031_PCM2TXSLOT23, 0x32); /* pcm port setting * This sets the pcm port to slave and clock at 19.2Mhz which * can support 6slots, sampling rate set per stream in hw-params */ - snd_soc_write(codec, SN95031_PCM1C1, 0x00); - snd_soc_write(codec, SN95031_PCM2C1, 0x01); - snd_soc_write(codec, SN95031_PCM2C2, 0x0A); - snd_soc_write(codec, SN95031_HSMIXER, BIT(0)|BIT(4)); + snd_soc_component_write(component, SN95031_PCM1C1, 0x00); + snd_soc_component_write(component, SN95031_PCM2C1, 0x01); + snd_soc_component_write(component, SN95031_PCM2C2, 0x0A); + snd_soc_component_write(component, SN95031_HSMIXER, BIT(0)|BIT(4)); /* vendor vibra workround, the vibras are muted by * custom register so unmute them */ - snd_soc_write(codec, SN95031_SSR5, 0x80); - snd_soc_write(codec, SN95031_SSR6, 0x80); - snd_soc_write(codec, SN95031_VIB1C5, 0x00); - snd_soc_write(codec, SN95031_VIB2C5, 0x00); + snd_soc_component_write(component, SN95031_SSR5, 0x80); + snd_soc_component_write(component, SN95031_SSR6, 0x80); + snd_soc_component_write(component, SN95031_VIB1C5, 0x00); + snd_soc_component_write(component, SN95031_VIB2C5, 0x00); /* configure vibras for pcm port */ - snd_soc_write(codec, SN95031_VIB1C3, 0x00); - snd_soc_write(codec, SN95031_VIB2C3, 0x00); + snd_soc_component_write(component, SN95031_VIB1C3, 0x00); + snd_soc_component_write(component, SN95031_VIB2C3, 0x00);
/* soft mute ramp time */ - snd_soc_write(codec, SN95031_SOFTMUTE, 0x3); + snd_soc_component_write(component, SN95031_SOFTMUTE, 0x3); /* fix the initial volume at 1dB, * default in +9dB, * 1dB give optimal swing on DAC, amps */ - snd_soc_write(codec, SN95031_HSLVOLCTRL, 0x08); - snd_soc_write(codec, SN95031_HSRVOLCTRL, 0x08); - snd_soc_write(codec, SN95031_IHFLVOLCTRL, 0x08); - snd_soc_write(codec, SN95031_IHFRVOLCTRL, 0x08); + snd_soc_component_write(component, SN95031_HSLVOLCTRL, 0x08); + snd_soc_component_write(component, SN95031_HSRVOLCTRL, 0x08); + snd_soc_component_write(component, SN95031_IHFLVOLCTRL, 0x08); + snd_soc_component_write(component, SN95031_IHFRVOLCTRL, 0x08); /* dac mode and lineout workaround */ - snd_soc_write(codec, SN95031_SSR2, 0x10); - snd_soc_write(codec, SN95031_SSR3, 0x40); + snd_soc_component_write(component, SN95031_SSR2, 0x10); + snd_soc_component_write(component, SN95031_SSR3, 0x40);
return 0; }
-static const struct snd_soc_codec_driver sn95031_codec = { - .probe = sn95031_codec_probe, - .set_bias_level = sn95031_set_vaud_bias, - .idle_bias_off = true, - - .component_driver = { - .controls = sn95031_snd_controls, - .num_controls = ARRAY_SIZE(sn95031_snd_controls), - .dapm_widgets = sn95031_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(sn95031_dapm_widgets), - .dapm_routes = sn95031_audio_map, - .num_dapm_routes = ARRAY_SIZE(sn95031_audio_map), - }, +static const struct snd_soc_component_driver sn95031_component = { + .probe = sn95031_component_probe, + .set_bias_level = sn95031_set_vaud_bias, + .controls = sn95031_snd_controls, + .num_controls = ARRAY_SIZE(sn95031_snd_controls), + .dapm_widgets = sn95031_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(sn95031_dapm_widgets), + .dapm_routes = sn95031_audio_map, + .num_dapm_routes = ARRAY_SIZE(sn95031_audio_map), + .pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, };
static int sn95031_device_probe(struct platform_device *pdev) { struct regmap *regmap;
- pr_debug("codec device probe called for %s\n", dev_name(&pdev->dev)); + pr_debug("component device probe called for %s\n", dev_name(&pdev->dev));
regmap = devm_regmap_init(&pdev->dev, NULL, NULL, &sn95031_regmap); if (IS_ERR(regmap)) return PTR_ERR(regmap);
- return snd_soc_register_codec(&pdev->dev, &sn95031_codec, + return devm_snd_soc_register_component(&pdev->dev, &sn95031_component, sn95031_dais, ARRAY_SIZE(sn95031_dais)); }
-static int sn95031_device_remove(struct platform_device *pdev) -{ - pr_debug("codec device remove called\n"); - snd_soc_unregister_codec(&pdev->dev); - return 0; -} - static struct platform_driver sn95031_codec_driver = { .driver = { .name = "sn95031", }, .probe = sn95031_device_probe, - .remove = sn95031_device_remove, };
module_platform_driver(sn95031_codec_driver); diff --git a/sound/soc/codecs/sn95031.h b/sound/soc/codecs/sn95031.h index 7651fe4..1e9fa62 100644 --- a/sound/soc/codecs/sn95031.h +++ b/sound/soc/codecs/sn95031.h @@ -127,7 +127,7 @@ struct mfld_jack_data { struct snd_soc_jack *mfld_jack; };
-extern void sn95031_jack_detection(struct snd_soc_codec *codec, +extern void sn95031_jack_detection(struct snd_soc_component *component, struct mfld_jack_data *jack_data);
#endif diff --git a/sound/soc/intel/boards/mfld_machine.c b/sound/soc/intel/boards/mfld_machine.c index 6f44acf..74f86d9 100644 --- a/sound/soc/intel/boards/mfld_machine.c +++ b/sound/soc/intel/boards/mfld_machine.c @@ -53,7 +53,7 @@ enum soc_mic_bias_zones {
static unsigned int hs_switch; static unsigned int lo_dac; -static struct snd_soc_codec *mfld_codec; +static struct snd_soc_component *mfld_codec;
struct mfld_mc_private { void __iomem *int_base; @@ -173,28 +173,28 @@ static int lo_set_switch(struct snd_kcontrol *kcontrol, pr_debug("set vibra path\n"); snd_soc_dapm_disable_pin_unlocked(dapm, "VIB1OUT"); snd_soc_dapm_disable_pin_unlocked(dapm, "VIB2OUT"); - snd_soc_update_bits(mfld_codec, SN95031_LOCTL, 0x66, 0); + snd_soc_component_update_bits(mfld_codec, SN95031_LOCTL, 0x66, 0); break;
case 1: pr_debug("set hs path\n"); snd_soc_dapm_disable_pin_unlocked(dapm, "Headphones"); snd_soc_dapm_disable_pin_unlocked(dapm, "EPOUT"); - snd_soc_update_bits(mfld_codec, SN95031_LOCTL, 0x66, 0x22); + snd_soc_component_update_bits(mfld_codec, SN95031_LOCTL, 0x66, 0x22); break;
case 2: pr_debug("set spkr path\n"); snd_soc_dapm_disable_pin_unlocked(dapm, "IHFOUTL"); snd_soc_dapm_disable_pin_unlocked(dapm, "IHFOUTR"); - snd_soc_update_bits(mfld_codec, SN95031_LOCTL, 0x66, 0x44); + snd_soc_component_update_bits(mfld_codec, SN95031_LOCTL, 0x66, 0x44); break;
case 3: pr_debug("set null path\n"); snd_soc_dapm_disable_pin_unlocked(dapm, "LINEOUTL"); snd_soc_dapm_disable_pin_unlocked(dapm, "LINEOUTR"); - snd_soc_update_bits(mfld_codec, SN95031_LOCTL, 0x66, 0x66); + snd_soc_component_update_bits(mfld_codec, SN95031_LOCTL, 0x66, 0x66); break; }
@@ -271,7 +271,7 @@ static int mfld_init(struct snd_soc_pcm_runtime *runtime) return ret_val; }
- mfld_codec = runtime->codec; + mfld_codec = runtime->codec_dai->component;
/* we want to check if anything is inserted at boot, * so send a fake event to codec and it will read adc