mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
Merge remote-tracking branches 'asoc/topic/vc4_hdmi', 'asoc/topic/wl1273', 'asoc/topic/wm0010', 'asoc/topic/wm1250-ev1' and 'asoc/topic/wm2000' into asoc-next
This commit is contained in:
commit
32a6c5ab54
6 changed files with 199 additions and 227 deletions
|
@ -995,15 +995,17 @@ static const struct snd_soc_dapm_route vc4_hdmi_audio_routes[] = {
|
|||
{ "TX", NULL, "Playback" },
|
||||
};
|
||||
|
||||
static const struct snd_soc_codec_driver vc4_hdmi_audio_codec_drv = {
|
||||
.component_driver = {
|
||||
.controls = vc4_hdmi_audio_controls,
|
||||
.num_controls = ARRAY_SIZE(vc4_hdmi_audio_controls),
|
||||
.dapm_widgets = vc4_hdmi_audio_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(vc4_hdmi_audio_widgets),
|
||||
.dapm_routes = vc4_hdmi_audio_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(vc4_hdmi_audio_routes),
|
||||
},
|
||||
static const struct snd_soc_component_driver vc4_hdmi_audio_component_drv = {
|
||||
.controls = vc4_hdmi_audio_controls,
|
||||
.num_controls = ARRAY_SIZE(vc4_hdmi_audio_controls),
|
||||
.dapm_widgets = vc4_hdmi_audio_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(vc4_hdmi_audio_widgets),
|
||||
.dapm_routes = vc4_hdmi_audio_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(vc4_hdmi_audio_routes),
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static const struct snd_soc_dai_ops vc4_hdmi_audio_dai_ops = {
|
||||
|
@ -1101,11 +1103,11 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *hdmi)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* register codec and codec dai */
|
||||
ret = snd_soc_register_codec(dev, &vc4_hdmi_audio_codec_drv,
|
||||
/* register component and codec dai */
|
||||
ret = devm_snd_soc_register_component(dev, &vc4_hdmi_audio_component_drv,
|
||||
&vc4_hdmi_audio_codec_dai_drv, 1);
|
||||
if (ret) {
|
||||
dev_err(dev, "Could not register codec: %d\n", ret);
|
||||
dev_err(dev, "Could not register component: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1130,29 +1132,11 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *hdmi)
|
|||
*/
|
||||
snd_soc_card_set_drvdata(card, hdmi);
|
||||
ret = devm_snd_soc_register_card(dev, card);
|
||||
if (ret) {
|
||||
if (ret)
|
||||
dev_err(dev, "Could not register sound card: %d\n", ret);
|
||||
goto unregister_codec;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
unregister_codec:
|
||||
snd_soc_unregister_codec(dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void vc4_hdmi_audio_cleanup(struct vc4_hdmi *hdmi)
|
||||
{
|
||||
struct device *dev = &hdmi->pdev->dev;
|
||||
|
||||
/*
|
||||
* If drvdata is not set this means the audio card was not
|
||||
* registered, just skip codec unregistration in this case.
|
||||
*/
|
||||
if (dev_get_drvdata(dev))
|
||||
snd_soc_unregister_codec(dev);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DRM_VC4_HDMI_CEC
|
||||
|
@ -1480,7 +1464,6 @@ static void vc4_hdmi_unbind(struct device *dev, struct device *master,
|
|||
struct vc4_dev *vc4 = drm->dev_private;
|
||||
struct vc4_hdmi *hdmi = vc4->hdmi;
|
||||
|
||||
vc4_hdmi_audio_cleanup(hdmi);
|
||||
cec_unregister_adapter(hdmi->cec_adap);
|
||||
vc4_hdmi_connector_destroy(hdmi->connector);
|
||||
vc4_hdmi_encoder_destroy(hdmi->encoder);
|
||||
|
|
|
@ -172,8 +172,8 @@ static int snd_wl1273_fm_set_channel_number(struct wl1273_core *core,
|
|||
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;
|
||||
|
||||
|
@ -190,14 +190,14 @@ static const char * const wl1273_audio_route[] = { "Bt", "FmRx", "FmTx" };
|
|||
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))
|
||||
|
@ -213,10 +213,10 @@ static SOC_ENUM_SINGLE_EXT_DECL(wl1273_enum, 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;
|
||||
|
||||
|
@ -226,11 +226,11 @@ static int snd_wl1273_fm_audio_get(struct snd_kcontrol *kcontrol,
|
|||
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)
|
||||
|
@ -250,10 +250,10 @@ static SOC_ENUM_SINGLE_EXT_DECL(wl1273_audio_enum, wl1273_audio_strings);
|
|||
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;
|
||||
|
||||
|
@ -263,11 +263,11 @@ static int snd_wl1273_fm_volume_get(struct snd_kcontrol *kcontrol,
|
|||
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]);
|
||||
|
@ -301,8 +301,8 @@ static const struct snd_soc_dapm_route wl1273_dapm_routes[] = {
|
|||
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:
|
||||
|
@ -335,7 +335,7 @@ static int wl1273_hw_params(struct snd_pcm_substream *substream,
|
|||
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;
|
||||
|
||||
|
@ -415,14 +415,14 @@ static struct snd_soc_dai_driver wl1273_dai = {
|
|||
};
|
||||
|
||||
/* 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:
|
||||
|
@ -446,15 +446,15 @@ int wl1273_get_format(struct snd_soc_codec *codec, unsigned int *fmt)
|
|||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -465,44 +465,43 @@ static int wl1273_probe(struct snd_soc_codec *codec)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,6 @@
|
|||
#ifndef __WL1273_CODEC_H__
|
||||
#define __WL1273_CODEC_H__
|
||||
|
||||
int wl1273_get_format(struct snd_soc_codec *codec, unsigned int *fmt);
|
||||
int wl1273_get_format(struct snd_soc_component *component, unsigned int *fmt);
|
||||
|
||||
#endif /* End of __WL1273_CODEC_H__ */
|
||||
|
|
|
@ -90,7 +90,7 @@ enum wm0010_state {
|
|||
};
|
||||
|
||||
struct wm0010_priv {
|
||||
struct snd_soc_codec *codec;
|
||||
struct snd_soc_component *component;
|
||||
|
||||
struct mutex lock;
|
||||
struct device *dev;
|
||||
|
@ -157,9 +157,9 @@ static const char *wm0010_state_to_str(enum wm0010_state state)
|
|||
}
|
||||
|
||||
/* Called with wm0010->lock held */
|
||||
static void wm0010_halt(struct snd_soc_codec *codec)
|
||||
static void wm0010_halt(struct snd_soc_component *component)
|
||||
{
|
||||
struct wm0010_priv *wm0010 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm0010_priv *wm0010 = snd_soc_component_get_drvdata(component);
|
||||
unsigned long flags;
|
||||
enum wm0010_state state;
|
||||
|
||||
|
@ -193,7 +193,7 @@ static void wm0010_halt(struct snd_soc_codec *codec)
|
|||
|
||||
struct wm0010_boot_xfer {
|
||||
struct list_head list;
|
||||
struct snd_soc_codec *codec;
|
||||
struct snd_soc_component *component;
|
||||
struct completion *done;
|
||||
struct spi_message m;
|
||||
struct spi_transfer t;
|
||||
|
@ -218,13 +218,13 @@ static void wm0010_mark_boot_failure(struct wm0010_priv *wm0010)
|
|||
static void wm0010_boot_xfer_complete(void *data)
|
||||
{
|
||||
struct wm0010_boot_xfer *xfer = data;
|
||||
struct snd_soc_codec *codec = xfer->codec;
|
||||
struct wm0010_priv *wm0010 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = xfer->component;
|
||||
struct wm0010_priv *wm0010 = snd_soc_component_get_drvdata(component);
|
||||
u32 *out32 = xfer->t.rx_buf;
|
||||
int i;
|
||||
|
||||
if (xfer->m.status != 0) {
|
||||
dev_err(codec->dev, "SPI transfer failed: %d\n",
|
||||
dev_err(component->dev, "SPI transfer failed: %d\n",
|
||||
xfer->m.status);
|
||||
wm0010_mark_boot_failure(wm0010);
|
||||
if (xfer->done)
|
||||
|
@ -233,11 +233,11 @@ static void wm0010_boot_xfer_complete(void *data)
|
|||
}
|
||||
|
||||
for (i = 0; i < xfer->t.len / 4; i++) {
|
||||
dev_dbg(codec->dev, "%d: %04x\n", i, out32[i]);
|
||||
dev_dbg(component->dev, "%d: %04x\n", i, out32[i]);
|
||||
|
||||
switch (be32_to_cpu(out32[i])) {
|
||||
case 0xe0e0e0e0:
|
||||
dev_err(codec->dev,
|
||||
dev_err(component->dev,
|
||||
"%d: ROM error reported in stage 2\n", i);
|
||||
wm0010_mark_boot_failure(wm0010);
|
||||
break;
|
||||
|
@ -245,82 +245,82 @@ static void wm0010_boot_xfer_complete(void *data)
|
|||
case 0x55555555:
|
||||
if (wm0010->state < WM0010_STAGE2)
|
||||
break;
|
||||
dev_err(codec->dev,
|
||||
dev_err(component->dev,
|
||||
"%d: ROM bootloader running in stage 2\n", i);
|
||||
wm0010_mark_boot_failure(wm0010);
|
||||
break;
|
||||
|
||||
case 0x0fed0000:
|
||||
dev_dbg(codec->dev, "Stage2 loader running\n");
|
||||
dev_dbg(component->dev, "Stage2 loader running\n");
|
||||
break;
|
||||
|
||||
case 0x0fed0007:
|
||||
dev_dbg(codec->dev, "CODE_HDR packet received\n");
|
||||
dev_dbg(component->dev, "CODE_HDR packet received\n");
|
||||
break;
|
||||
|
||||
case 0x0fed0008:
|
||||
dev_dbg(codec->dev, "CODE_DATA packet received\n");
|
||||
dev_dbg(component->dev, "CODE_DATA packet received\n");
|
||||
break;
|
||||
|
||||
case 0x0fed0009:
|
||||
dev_dbg(codec->dev, "Download complete\n");
|
||||
dev_dbg(component->dev, "Download complete\n");
|
||||
break;
|
||||
|
||||
case 0x0fed000c:
|
||||
dev_dbg(codec->dev, "Application start\n");
|
||||
dev_dbg(component->dev, "Application start\n");
|
||||
break;
|
||||
|
||||
case 0x0fed000e:
|
||||
dev_dbg(codec->dev, "PLL packet received\n");
|
||||
dev_dbg(component->dev, "PLL packet received\n");
|
||||
wm0010->pll_running = true;
|
||||
break;
|
||||
|
||||
case 0x0fed0025:
|
||||
dev_err(codec->dev, "Device reports image too long\n");
|
||||
dev_err(component->dev, "Device reports image too long\n");
|
||||
wm0010_mark_boot_failure(wm0010);
|
||||
break;
|
||||
|
||||
case 0x0fed002c:
|
||||
dev_err(codec->dev, "Device reports bad SPI packet\n");
|
||||
dev_err(component->dev, "Device reports bad SPI packet\n");
|
||||
wm0010_mark_boot_failure(wm0010);
|
||||
break;
|
||||
|
||||
case 0x0fed0031:
|
||||
dev_err(codec->dev, "Device reports SPI read overflow\n");
|
||||
dev_err(component->dev, "Device reports SPI read overflow\n");
|
||||
wm0010_mark_boot_failure(wm0010);
|
||||
break;
|
||||
|
||||
case 0x0fed0032:
|
||||
dev_err(codec->dev, "Device reports SPI underclock\n");
|
||||
dev_err(component->dev, "Device reports SPI underclock\n");
|
||||
wm0010_mark_boot_failure(wm0010);
|
||||
break;
|
||||
|
||||
case 0x0fed0033:
|
||||
dev_err(codec->dev, "Device reports bad header packet\n");
|
||||
dev_err(component->dev, "Device reports bad header packet\n");
|
||||
wm0010_mark_boot_failure(wm0010);
|
||||
break;
|
||||
|
||||
case 0x0fed0034:
|
||||
dev_err(codec->dev, "Device reports invalid packet type\n");
|
||||
dev_err(component->dev, "Device reports invalid packet type\n");
|
||||
wm0010_mark_boot_failure(wm0010);
|
||||
break;
|
||||
|
||||
case 0x0fed0035:
|
||||
dev_err(codec->dev, "Device reports data before header error\n");
|
||||
dev_err(component->dev, "Device reports data before header error\n");
|
||||
wm0010_mark_boot_failure(wm0010);
|
||||
break;
|
||||
|
||||
case 0x0fed0038:
|
||||
dev_err(codec->dev, "Device reports invalid PLL packet\n");
|
||||
dev_err(component->dev, "Device reports invalid PLL packet\n");
|
||||
break;
|
||||
|
||||
case 0x0fed003a:
|
||||
dev_err(codec->dev, "Device reports packet alignment error\n");
|
||||
dev_err(component->dev, "Device reports packet alignment error\n");
|
||||
wm0010_mark_boot_failure(wm0010);
|
||||
break;
|
||||
|
||||
default:
|
||||
dev_err(codec->dev, "Unrecognised return 0x%x\n",
|
||||
dev_err(component->dev, "Unrecognised return 0x%x\n",
|
||||
be32_to_cpu(out32[i]));
|
||||
wm0010_mark_boot_failure(wm0010);
|
||||
break;
|
||||
|
@ -342,10 +342,10 @@ static void byte_swap_64(u64 *data_in, u64 *data_out, u32 len)
|
|||
data_out[i] = cpu_to_be64(le64_to_cpu(data_in[i]));
|
||||
}
|
||||
|
||||
static int wm0010_firmware_load(const char *name, struct snd_soc_codec *codec)
|
||||
static int wm0010_firmware_load(const char *name, struct snd_soc_component *component)
|
||||
{
|
||||
struct spi_device *spi = to_spi_device(codec->dev);
|
||||
struct wm0010_priv *wm0010 = snd_soc_codec_get_drvdata(codec);
|
||||
struct spi_device *spi = to_spi_device(component->dev);
|
||||
struct wm0010_priv *wm0010 = snd_soc_component_get_drvdata(component);
|
||||
struct list_head xfer_list;
|
||||
struct wm0010_boot_xfer *xfer;
|
||||
int ret;
|
||||
|
@ -359,9 +359,9 @@ static int wm0010_firmware_load(const char *name, struct snd_soc_codec *codec)
|
|||
|
||||
INIT_LIST_HEAD(&xfer_list);
|
||||
|
||||
ret = request_firmware(&fw, name, codec->dev);
|
||||
ret = request_firmware(&fw, name, component->dev);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Failed to request application(%s): %d\n",
|
||||
dev_err(component->dev, "Failed to request application(%s): %d\n",
|
||||
name, ret);
|
||||
return ret;
|
||||
}
|
||||
|
@ -377,25 +377,25 @@ static int wm0010_firmware_load(const char *name, struct snd_soc_codec *codec)
|
|||
|
||||
/* First record should be INFO */
|
||||
if (rec->command != DFW_CMD_INFO) {
|
||||
dev_err(codec->dev, "First record not INFO\r\n");
|
||||
dev_err(component->dev, "First record not INFO\r\n");
|
||||
ret = -EINVAL;
|
||||
goto abort;
|
||||
}
|
||||
|
||||
if (inforec->info_version != INFO_VERSION) {
|
||||
dev_err(codec->dev,
|
||||
dev_err(component->dev,
|
||||
"Unsupported version (%02d) of INFO record\r\n",
|
||||
inforec->info_version);
|
||||
ret = -EINVAL;
|
||||
goto abort;
|
||||
}
|
||||
|
||||
dev_dbg(codec->dev, "Version v%02d INFO record found\r\n",
|
||||
dev_dbg(component->dev, "Version v%02d INFO record found\r\n",
|
||||
inforec->info_version);
|
||||
|
||||
/* Check it's a DSP file */
|
||||
if (dsp != DEVICE_ID_WM0010) {
|
||||
dev_err(codec->dev, "Not a WM0010 firmware file.\r\n");
|
||||
dev_err(component->dev, "Not a WM0010 firmware file.\r\n");
|
||||
ret = -EINVAL;
|
||||
goto abort;
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ static int wm0010_firmware_load(const char *name, struct snd_soc_codec *codec)
|
|||
rec = (void *)&rec->data[rec->length];
|
||||
|
||||
while (offset < fw->size) {
|
||||
dev_dbg(codec->dev,
|
||||
dev_dbg(component->dev,
|
||||
"Packet: command %d, data length = 0x%x\r\n",
|
||||
rec->command, rec->length);
|
||||
len = rec->length + 8;
|
||||
|
@ -416,7 +416,7 @@ static int wm0010_firmware_load(const char *name, struct snd_soc_codec *codec)
|
|||
goto abort;
|
||||
}
|
||||
|
||||
xfer->codec = codec;
|
||||
xfer->component = component;
|
||||
list_add_tail(&xfer->list, &xfer_list);
|
||||
|
||||
out = kzalloc(len, GFP_KERNEL | GFP_DMA);
|
||||
|
@ -460,18 +460,18 @@ static int wm0010_firmware_load(const char *name, struct snd_soc_codec *codec)
|
|||
rec = (void *)&rec->data[rec->length];
|
||||
|
||||
if (offset >= fw->size) {
|
||||
dev_dbg(codec->dev, "All transfers scheduled\n");
|
||||
dev_dbg(component->dev, "All transfers scheduled\n");
|
||||
xfer->done = &done;
|
||||
}
|
||||
|
||||
ret = spi_async(spi, &xfer->m);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Write failed: %d\n", ret);
|
||||
dev_err(component->dev, "Write failed: %d\n", ret);
|
||||
goto abort1;
|
||||
}
|
||||
|
||||
if (wm0010->boot_failed) {
|
||||
dev_dbg(codec->dev, "Boot fail!\n");
|
||||
dev_dbg(component->dev, "Boot fail!\n");
|
||||
ret = -EINVAL;
|
||||
goto abort1;
|
||||
}
|
||||
|
@ -496,10 +496,10 @@ static int wm0010_firmware_load(const char *name, struct snd_soc_codec *codec)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int wm0010_stage2_load(struct snd_soc_codec *codec)
|
||||
static int wm0010_stage2_load(struct snd_soc_component *component)
|
||||
{
|
||||
struct spi_device *spi = to_spi_device(codec->dev);
|
||||
struct wm0010_priv *wm0010 = snd_soc_codec_get_drvdata(codec);
|
||||
struct spi_device *spi = to_spi_device(component->dev);
|
||||
struct wm0010_priv *wm0010 = snd_soc_component_get_drvdata(component);
|
||||
const struct firmware *fw;
|
||||
struct spi_message m;
|
||||
struct spi_transfer t;
|
||||
|
@ -508,14 +508,14 @@ static int wm0010_stage2_load(struct snd_soc_codec *codec)
|
|||
int i;
|
||||
int ret = 0;
|
||||
|
||||
ret = request_firmware(&fw, "wm0010_stage2.bin", codec->dev);
|
||||
ret = request_firmware(&fw, "wm0010_stage2.bin", component->dev);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Failed to request stage2 loader: %d\n",
|
||||
dev_err(component->dev, "Failed to request stage2 loader: %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
dev_dbg(codec->dev, "Downloading %zu byte stage 2 loader\n", fw->size);
|
||||
dev_dbg(component->dev, "Downloading %zu byte stage 2 loader\n", fw->size);
|
||||
|
||||
/* Copy to local buffer first as vmalloc causes problems for dma */
|
||||
img = kzalloc(fw->size, GFP_KERNEL | GFP_DMA);
|
||||
|
@ -541,19 +541,19 @@ static int wm0010_stage2_load(struct snd_soc_codec *codec)
|
|||
t.speed_hz = wm0010->sysclk / 10;
|
||||
spi_message_add_tail(&t, &m);
|
||||
|
||||
dev_dbg(codec->dev, "Starting initial download at %dHz\n",
|
||||
dev_dbg(component->dev, "Starting initial download at %dHz\n",
|
||||
t.speed_hz);
|
||||
|
||||
ret = spi_sync(spi, &m);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Initial download failed: %d\n", ret);
|
||||
dev_err(component->dev, "Initial download failed: %d\n", ret);
|
||||
goto abort;
|
||||
}
|
||||
|
||||
/* Look for errors from the boot ROM */
|
||||
for (i = 0; i < fw->size; i++) {
|
||||
if (out[i] != 0x55) {
|
||||
dev_err(codec->dev, "Boot ROM error: %x in %d\n",
|
||||
dev_err(component->dev, "Boot ROM error: %x in %d\n",
|
||||
out[i], i);
|
||||
wm0010_mark_boot_failure(wm0010);
|
||||
ret = -EBUSY;
|
||||
|
@ -570,10 +570,10 @@ static int wm0010_stage2_load(struct snd_soc_codec *codec)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int wm0010_boot(struct snd_soc_codec *codec)
|
||||
static int wm0010_boot(struct snd_soc_component *component)
|
||||
{
|
||||
struct spi_device *spi = to_spi_device(codec->dev);
|
||||
struct wm0010_priv *wm0010 = snd_soc_codec_get_drvdata(codec);
|
||||
struct spi_device *spi = to_spi_device(component->dev);
|
||||
struct wm0010_priv *wm0010 = snd_soc_component_get_drvdata(component);
|
||||
unsigned long flags;
|
||||
int ret;
|
||||
struct spi_message m;
|
||||
|
@ -590,7 +590,7 @@ static int wm0010_boot(struct snd_soc_codec *codec)
|
|||
spin_unlock_irqrestore(&wm0010->irq_lock, flags);
|
||||
|
||||
if (wm0010->sysclk > 26000000) {
|
||||
dev_err(codec->dev, "Max DSP clock frequency is 26MHz\n");
|
||||
dev_err(component->dev, "Max DSP clock frequency is 26MHz\n");
|
||||
ret = -ECANCELED;
|
||||
goto err;
|
||||
}
|
||||
|
@ -598,7 +598,7 @@ static int wm0010_boot(struct snd_soc_codec *codec)
|
|||
mutex_lock(&wm0010->lock);
|
||||
wm0010->pll_running = false;
|
||||
|
||||
dev_dbg(codec->dev, "max_spi_freq: %d\n", wm0010->max_spi_freq);
|
||||
dev_dbg(component->dev, "max_spi_freq: %d\n", wm0010->max_spi_freq);
|
||||
|
||||
ret = regulator_bulk_enable(ARRAY_SIZE(wm0010->core_supplies),
|
||||
wm0010->core_supplies);
|
||||
|
@ -623,19 +623,19 @@ static int wm0010_boot(struct snd_soc_codec *codec)
|
|||
|
||||
if (!wait_for_completion_timeout(&wm0010->boot_completion,
|
||||
msecs_to_jiffies(20)))
|
||||
dev_err(codec->dev, "Failed to get interrupt from DSP\n");
|
||||
dev_err(component->dev, "Failed to get interrupt from DSP\n");
|
||||
|
||||
spin_lock_irqsave(&wm0010->irq_lock, flags);
|
||||
wm0010->state = WM0010_BOOTROM;
|
||||
spin_unlock_irqrestore(&wm0010->irq_lock, flags);
|
||||
|
||||
ret = wm0010_stage2_load(codec);
|
||||
ret = wm0010_stage2_load(component);
|
||||
if (ret)
|
||||
goto abort;
|
||||
|
||||
if (!wait_for_completion_timeout(&wm0010->boot_completion,
|
||||
msecs_to_jiffies(20)))
|
||||
dev_err(codec->dev, "Failed to get interrupt from DSP loader.\n");
|
||||
dev_err(component->dev, "Failed to get interrupt from DSP loader.\n");
|
||||
|
||||
spin_lock_irqsave(&wm0010->irq_lock, flags);
|
||||
wm0010->state = WM0010_STAGE2;
|
||||
|
@ -676,14 +676,14 @@ static int wm0010_boot(struct snd_soc_codec *codec)
|
|||
|
||||
ret = spi_sync(spi, &m);
|
||||
if (ret) {
|
||||
dev_err(codec->dev, "First PLL write failed: %d\n", ret);
|
||||
dev_err(component->dev, "First PLL write failed: %d\n", ret);
|
||||
goto abort_swap;
|
||||
}
|
||||
|
||||
/* Use a second send of the message to get the return status */
|
||||
ret = spi_sync(spi, &m);
|
||||
if (ret) {
|
||||
dev_err(codec->dev, "Second PLL write failed: %d\n", ret);
|
||||
dev_err(component->dev, "Second PLL write failed: %d\n", ret);
|
||||
goto abort_swap;
|
||||
}
|
||||
|
||||
|
@ -692,7 +692,7 @@ static int wm0010_boot(struct snd_soc_codec *codec)
|
|||
/* Look for PLL active code from the DSP */
|
||||
for (i = 0; i < len / 4; i++) {
|
||||
if (*p == 0x0e00ed0f) {
|
||||
dev_dbg(codec->dev, "PLL packet received\n");
|
||||
dev_dbg(component->dev, "PLL packet received\n");
|
||||
wm0010->pll_running = true;
|
||||
break;
|
||||
}
|
||||
|
@ -702,9 +702,9 @@ static int wm0010_boot(struct snd_soc_codec *codec)
|
|||
kfree(img_swap);
|
||||
kfree(out);
|
||||
} else
|
||||
dev_dbg(codec->dev, "Not enabling DSP PLL.");
|
||||
dev_dbg(component->dev, "Not enabling DSP PLL.");
|
||||
|
||||
ret = wm0010_firmware_load("wm0010.dfw", codec);
|
||||
ret = wm0010_firmware_load("wm0010.dfw", component);
|
||||
|
||||
if (ret != 0)
|
||||
goto abort;
|
||||
|
@ -723,7 +723,7 @@ static int wm0010_boot(struct snd_soc_codec *codec)
|
|||
kfree(out);
|
||||
abort:
|
||||
/* Put the chip back into reset */
|
||||
wm0010_halt(codec);
|
||||
wm0010_halt(component);
|
||||
mutex_unlock(&wm0010->lock);
|
||||
return ret;
|
||||
|
||||
|
@ -735,22 +735,22 @@ static int wm0010_boot(struct snd_soc_codec *codec)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int wm0010_set_bias_level(struct snd_soc_codec *codec,
|
||||
static int wm0010_set_bias_level(struct snd_soc_component *component,
|
||||
enum snd_soc_bias_level level)
|
||||
{
|
||||
struct wm0010_priv *wm0010 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm0010_priv *wm0010 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
switch (level) {
|
||||
case SND_SOC_BIAS_ON:
|
||||
if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_PREPARE)
|
||||
wm0010_boot(codec);
|
||||
if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_PREPARE)
|
||||
wm0010_boot(component);
|
||||
break;
|
||||
case SND_SOC_BIAS_PREPARE:
|
||||
break;
|
||||
case SND_SOC_BIAS_STANDBY:
|
||||
if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_PREPARE) {
|
||||
if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_PREPARE) {
|
||||
mutex_lock(&wm0010->lock);
|
||||
wm0010_halt(codec);
|
||||
wm0010_halt(component);
|
||||
mutex_unlock(&wm0010->lock);
|
||||
}
|
||||
break;
|
||||
|
@ -761,10 +761,10 @@ static int wm0010_set_bias_level(struct snd_soc_codec *codec,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int wm0010_set_sysclk(struct snd_soc_codec *codec, int source,
|
||||
static int wm0010_set_sysclk(struct snd_soc_component *component, int source,
|
||||
int clk_id, unsigned int freq, int dir)
|
||||
{
|
||||
struct wm0010_priv *wm0010 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm0010_priv *wm0010 = snd_soc_component_get_drvdata(component);
|
||||
unsigned int i;
|
||||
|
||||
wm0010->sysclk = freq;
|
||||
|
@ -783,20 +783,19 @@ static int wm0010_set_sysclk(struct snd_soc_codec *codec, int source,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int wm0010_probe(struct snd_soc_codec *codec);
|
||||
static int wm0010_probe(struct snd_soc_component *component);
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_wm0010 = {
|
||||
.probe = wm0010_probe,
|
||||
.set_bias_level = wm0010_set_bias_level,
|
||||
.set_sysclk = wm0010_set_sysclk,
|
||||
.idle_bias_off = true,
|
||||
|
||||
.component_driver = {
|
||||
.dapm_widgets = wm0010_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(wm0010_dapm_widgets),
|
||||
.dapm_routes = wm0010_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(wm0010_dapm_routes),
|
||||
},
|
||||
static const struct snd_soc_component_driver soc_component_dev_wm0010 = {
|
||||
.probe = wm0010_probe,
|
||||
.set_bias_level = wm0010_set_bias_level,
|
||||
.set_sysclk = wm0010_set_sysclk,
|
||||
.dapm_widgets = wm0010_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(wm0010_dapm_widgets),
|
||||
.dapm_routes = wm0010_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(wm0010_dapm_routes),
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
#define WM0010_RATES (SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000)
|
||||
|
@ -860,11 +859,11 @@ static irqreturn_t wm0010_irq(int irq, void *data)
|
|||
return IRQ_NONE;
|
||||
}
|
||||
|
||||
static int wm0010_probe(struct snd_soc_codec *codec)
|
||||
static int wm0010_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct wm0010_priv *wm0010 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm0010_priv *wm0010 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
wm0010->codec = codec;
|
||||
wm0010->component = component;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -967,8 +966,8 @@ static int wm0010_spi_probe(struct spi_device *spi)
|
|||
else
|
||||
wm0010->board_max_spi_speed = 0;
|
||||
|
||||
ret = snd_soc_register_codec(&spi->dev,
|
||||
&soc_codec_dev_wm0010, wm0010_dai,
|
||||
ret = devm_snd_soc_register_component(&spi->dev,
|
||||
&soc_component_dev_wm0010, wm0010_dai,
|
||||
ARRAY_SIZE(wm0010_dai));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
@ -980,8 +979,6 @@ static int wm0010_spi_remove(struct spi_device *spi)
|
|||
{
|
||||
struct wm0010_priv *wm0010 = spi_get_drvdata(spi);
|
||||
|
||||
snd_soc_unregister_codec(&spi->dev);
|
||||
|
||||
gpio_set_value_cansleep(wm0010->gpio_reset,
|
||||
wm0010->gpio_reset_value);
|
||||
|
||||
|
|
|
@ -32,10 +32,10 @@ struct wm1250_priv {
|
|||
struct gpio gpios[WM1250_EV1_NUM_GPIOS];
|
||||
};
|
||||
|
||||
static int wm1250_ev1_set_bias_level(struct snd_soc_codec *codec,
|
||||
static int wm1250_ev1_set_bias_level(struct snd_soc_component *component,
|
||||
enum snd_soc_bias_level level)
|
||||
{
|
||||
struct wm1250_priv *wm1250 = dev_get_drvdata(codec->dev);
|
||||
struct wm1250_priv *wm1250 = dev_get_drvdata(component->dev);
|
||||
int ena;
|
||||
|
||||
if (wm1250)
|
||||
|
@ -81,7 +81,7 @@ static int wm1250_ev1_hw_params(struct snd_pcm_substream *substream,
|
|||
struct snd_pcm_hw_params *params,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct wm1250_priv *wm1250 = snd_soc_codec_get_drvdata(dai->codec);
|
||||
struct wm1250_priv *wm1250 = snd_soc_component_get_drvdata(dai->component);
|
||||
|
||||
switch (params_rate(params)) {
|
||||
case 8000:
|
||||
|
@ -141,15 +141,15 @@ static struct snd_soc_dai_driver wm1250_ev1_dai = {
|
|||
.ops = &wm1250_ev1_ops,
|
||||
};
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_wm1250_ev1 = {
|
||||
.component_driver = {
|
||||
.dapm_widgets = wm1250_ev1_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(wm1250_ev1_dapm_widgets),
|
||||
.dapm_routes = wm1250_ev1_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(wm1250_ev1_dapm_routes),
|
||||
},
|
||||
.set_bias_level = wm1250_ev1_set_bias_level,
|
||||
.idle_bias_off = true,
|
||||
static const struct snd_soc_component_driver soc_component_dev_wm1250_ev1 = {
|
||||
.dapm_widgets = wm1250_ev1_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(wm1250_ev1_dapm_widgets),
|
||||
.dapm_routes = wm1250_ev1_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(wm1250_ev1_dapm_routes),
|
||||
.set_bias_level = wm1250_ev1_set_bias_level,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static int wm1250_ev1_pdata(struct i2c_client *i2c)
|
||||
|
@ -224,7 +224,7 @@ static int wm1250_ev1_probe(struct i2c_client *i2c,
|
|||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm1250_ev1,
|
||||
ret = devm_snd_soc_register_component(&i2c->dev, &soc_component_dev_wm1250_ev1,
|
||||
&wm1250_ev1_dai, 1);
|
||||
if (ret != 0) {
|
||||
dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret);
|
||||
|
@ -237,7 +237,6 @@ static int wm1250_ev1_probe(struct i2c_client *i2c,
|
|||
|
||||
static int wm1250_ev1_remove(struct i2c_client *i2c)
|
||||
{
|
||||
snd_soc_unregister_codec(&i2c->dev);
|
||||
wm1250_ev1_free(i2c);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -607,8 +607,8 @@ static int wm2000_anc_set_mode(struct wm2000_priv *wm2000)
|
|||
static int wm2000_anc_mode_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev);
|
||||
|
||||
ucontrol->value.integer.value[0] = wm2000->anc_active;
|
||||
|
||||
|
@ -618,8 +618,8 @@ static int wm2000_anc_mode_get(struct snd_kcontrol *kcontrol,
|
|||
static int wm2000_anc_mode_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev);
|
||||
unsigned int anc_active = ucontrol->value.integer.value[0];
|
||||
int ret;
|
||||
|
||||
|
@ -640,8 +640,8 @@ static int wm2000_anc_mode_put(struct snd_kcontrol *kcontrol,
|
|||
static int wm2000_speaker_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev);
|
||||
|
||||
ucontrol->value.integer.value[0] = wm2000->spk_ena;
|
||||
|
||||
|
@ -651,8 +651,8 @@ static int wm2000_speaker_get(struct snd_kcontrol *kcontrol,
|
|||
static int wm2000_speaker_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev);
|
||||
unsigned int val = ucontrol->value.integer.value[0];
|
||||
int ret;
|
||||
|
||||
|
@ -683,8 +683,8 @@ static const struct snd_kcontrol_new wm2000_controls[] = {
|
|||
static int wm2000_anc_power_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 wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
|
||||
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||
struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev);
|
||||
int ret;
|
||||
|
||||
mutex_lock(&wm2000->lock);
|
||||
|
@ -724,16 +724,16 @@ static const struct snd_soc_dapm_route wm2000_audio_map[] = {
|
|||
};
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int wm2000_suspend(struct snd_soc_codec *codec)
|
||||
static int wm2000_suspend(struct snd_soc_component *component)
|
||||
{
|
||||
struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
|
||||
struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev);
|
||||
|
||||
return wm2000_anc_transition(wm2000, ANC_OFF);
|
||||
}
|
||||
|
||||
static int wm2000_resume(struct snd_soc_codec *codec)
|
||||
static int wm2000_resume(struct snd_soc_component *component)
|
||||
{
|
||||
struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
|
||||
struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev);
|
||||
|
||||
return wm2000_anc_set_mode(wm2000);
|
||||
}
|
||||
|
@ -782,9 +782,9 @@ static const struct regmap_config wm2000_regmap = {
|
|||
.readable_reg = wm2000_readable_reg,
|
||||
};
|
||||
|
||||
static int wm2000_probe(struct snd_soc_codec *codec)
|
||||
static int wm2000_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
|
||||
struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev);
|
||||
|
||||
/* This will trigger a transition to standby mode by default */
|
||||
wm2000_anc_set_mode(wm2000);
|
||||
|
@ -792,27 +792,28 @@ static int wm2000_probe(struct snd_soc_codec *codec)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int wm2000_remove(struct snd_soc_codec *codec)
|
||||
static void wm2000_remove(struct snd_soc_component *component)
|
||||
{
|
||||
struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
|
||||
struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev);
|
||||
|
||||
return wm2000_anc_transition(wm2000, ANC_OFF);
|
||||
wm2000_anc_transition(wm2000, ANC_OFF);
|
||||
}
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_wm2000 = {
|
||||
.probe = wm2000_probe,
|
||||
.remove = wm2000_remove,
|
||||
.suspend = wm2000_suspend,
|
||||
.resume = wm2000_resume,
|
||||
|
||||
.component_driver = {
|
||||
.controls = wm2000_controls,
|
||||
.num_controls = ARRAY_SIZE(wm2000_controls),
|
||||
.dapm_widgets = wm2000_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(wm2000_dapm_widgets),
|
||||
.dapm_routes = wm2000_audio_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(wm2000_audio_map),
|
||||
},
|
||||
static const struct snd_soc_component_driver soc_component_dev_wm2000 = {
|
||||
.probe = wm2000_probe,
|
||||
.remove = wm2000_remove,
|
||||
.suspend = wm2000_suspend,
|
||||
.resume = wm2000_resume,
|
||||
.controls = wm2000_controls,
|
||||
.num_controls = ARRAY_SIZE(wm2000_controls),
|
||||
.dapm_widgets = wm2000_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(wm2000_dapm_widgets),
|
||||
.dapm_routes = wm2000_audio_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(wm2000_audio_map),
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static int wm2000_i2c_probe(struct i2c_client *i2c,
|
||||
|
@ -916,7 +917,8 @@ static int wm2000_i2c_probe(struct i2c_client *i2c,
|
|||
|
||||
wm2000_reset(wm2000);
|
||||
|
||||
ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm2000, NULL, 0);
|
||||
ret = devm_snd_soc_register_component(&i2c->dev,
|
||||
&soc_component_dev_wm2000, NULL, 0);
|
||||
|
||||
err_supplies:
|
||||
regulator_bulk_disable(WM2000_NUM_SUPPLIES, wm2000->supplies);
|
||||
|
@ -926,13 +928,6 @@ static int wm2000_i2c_probe(struct i2c_client *i2c,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int wm2000_i2c_remove(struct i2c_client *i2c)
|
||||
{
|
||||
snd_soc_unregister_codec(&i2c->dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id wm2000_i2c_id[] = {
|
||||
{ "wm2000", 0 },
|
||||
{ }
|
||||
|
@ -944,7 +939,6 @@ static struct i2c_driver wm2000_i2c_driver = {
|
|||
.name = "wm2000",
|
||||
},
|
||||
.probe = wm2000_i2c_probe,
|
||||
.remove = wm2000_i2c_remove,
|
||||
.id_table = wm2000_i2c_id,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue