static int snd_wl1273_get_audio_route(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+ struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(component);
ucontrol->value.enumerated.item[0] = wl1273->mode;
static int snd_wl1273_set_audio_route(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+ struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(component);
if (wl1273->mode == ucontrol->value.enumerated.item[0])
return 0;
/* Do not allow changes while stream is running */
- if (snd_soc_codec_is_active(codec))
+ if (snd_soc_component_is_active(component))
return -EPERM;
if (ucontrol->value.enumerated.item[0] >= ARRAY_SIZE(wl1273_audio_route))
static int snd_wl1273_fm_audio_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+ struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(component);
- dev_dbg(codec->dev, "%s: enter.\n", __func__);
+ dev_dbg(component->dev, "%s: enter.\n", __func__);
ucontrol->value.enumerated.item[0] = wl1273->core->audio_mode;
static int snd_wl1273_fm_audio_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+ struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(component);
int val, r = 0;
- dev_dbg(codec->dev, "%s: enter.\n", __func__);
+ dev_dbg(component->dev, "%s: enter.\n", __func__);
val = ucontrol->value.enumerated.item[0];
if (wl1273->core->audio_mode == val)
static int snd_wl1273_fm_volume_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+ struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(component);
- dev_dbg(codec->dev, "%s: enter.\n", __func__);
+ dev_dbg(component->dev, "%s: enter.\n", __func__);
ucontrol->value.integer.value[0] = wl1273->core->volume;
static int snd_wl1273_fm_volume_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+ struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(component);
int r;
- dev_dbg(codec->dev, "%s: enter.\n", __func__);
+ dev_dbg(component->dev, "%s: enter.\n", __func__);
r = wl1273->core->set_volume(wl1273->core,
ucontrol->value.integer.value[0]);
static int wl1273_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
- struct snd_soc_codec *codec = dai->codec;
- struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component = dai->component;
+ struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(component);
switch (wl1273->mode) {
case WL1273_MODE_BT:
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{
- struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(dai->codec);
+ struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(dai->component);
struct wl1273_core *core = wl1273->core;
unsigned int rate, width, r;
};
/* Audio interface format for the soc_card driver */
-int wl1273_get_format(struct snd_soc_codec *codec, unsigned int *fmt)
+int wl1273_get_format(struct snd_soc_component *component, unsigned int *fmt)
{
struct wl1273_priv *wl1273;
- if (codec == NULL || fmt == NULL)
+ if (component == NULL || fmt == NULL)
return -EINVAL;
- wl1273 = snd_soc_codec_get_drvdata(codec);
+ wl1273 = snd_soc_component_get_drvdata(component);
switch (wl1273->mode) {
case WL1273_MODE_FM_RX:
}
EXPORT_SYMBOL_GPL(wl1273_get_format);
-static int wl1273_probe(struct snd_soc_codec *codec)
+static int wl1273_probe(struct snd_soc_component *component)
{
- struct wl1273_core **core = codec->dev->platform_data;
+ struct wl1273_core **core = component->dev->platform_data;
struct wl1273_priv *wl1273;
- dev_dbg(codec->dev, "%s.\n", __func__);
+ dev_dbg(component->dev, "%s.\n", __func__);
if (!core) {
- dev_err(codec->dev, "Platform data is missing.\n");
+ dev_err(component->dev, "Platform data is missing.\n");
return -EINVAL;
}
wl1273->mode = WL1273_MODE_BT;
wl1273->core = *core;
- snd_soc_codec_set_drvdata(codec, wl1273);
+ snd_soc_component_set_drvdata(component, wl1273);
return 0;
}
-static int wl1273_remove(struct snd_soc_codec *codec)
+static void wl1273_remove(struct snd_soc_component *component)
{
- struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec);
+ struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(component);
- dev_dbg(codec->dev, "%s\n", __func__);
+ dev_dbg(component->dev, "%s\n", __func__);
kfree(wl1273);
-
- return 0;
}
-static const struct snd_soc_codec_driver soc_codec_dev_wl1273 = {
- .probe = wl1273_probe,
- .remove = wl1273_remove,
-
- .component_driver = {
- .controls = wl1273_controls,
- .num_controls = ARRAY_SIZE(wl1273_controls),
- .dapm_widgets = wl1273_dapm_widgets,
- .num_dapm_widgets = ARRAY_SIZE(wl1273_dapm_widgets),
- .dapm_routes = wl1273_dapm_routes,
- .num_dapm_routes = ARRAY_SIZE(wl1273_dapm_routes),
- },
+static const struct snd_soc_component_driver soc_component_dev_wl1273 = {
+ .probe = wl1273_probe,
+ .remove = wl1273_remove,
+ .controls = wl1273_controls,
+ .num_controls = ARRAY_SIZE(wl1273_controls),
+ .dapm_widgets = wl1273_dapm_widgets,
+ .num_dapm_widgets = ARRAY_SIZE(wl1273_dapm_widgets),
+ .dapm_routes = wl1273_dapm_routes,
+ .num_dapm_routes = ARRAY_SIZE(wl1273_dapm_routes),
+ .idle_bias_on = 1,
+ .use_pmdown_time = 1,
+ .endianness = 1,
+ .non_legacy_dai_naming = 1,
};
static int wl1273_platform_probe(struct platform_device *pdev)
{
- return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wl1273,
+ return devm_snd_soc_register_component(&pdev->dev,
+ &soc_component_dev_wl1273,
&wl1273_dai, 1);
}
static int wl1273_platform_remove(struct platform_device *pdev)
{
- snd_soc_unregister_codec(&pdev->dev);
return 0;
}