mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-06 08:46:46 +00:00
staging: greybus: audio: Resolve compilation error in topology parser
Fix compilation errors for GB Audio topology parser code with recent kernel versions. Signed-off-by: Vaibhav Agarwal <vaibhav.sr@gmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/2542330352ae1d01469a616ea45edb461615e072.1594290158.git.vaibhav.sr@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
ce7bd8325d
commit
c4bb7dcf14
1 changed files with 57 additions and 66 deletions
|
@ -5,8 +5,8 @@
|
||||||
* Copyright 2015-2016 Linaro Ltd.
|
* Copyright 2015-2016 Linaro Ltd.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <linux/greybus.h>
|
||||||
#include "audio_codec.h"
|
#include "audio_codec.h"
|
||||||
#include "greybus_protocols.h"
|
|
||||||
|
|
||||||
#define GBAUDIO_INVALID_ID 0xFF
|
#define GBAUDIO_INVALID_ID 0xFF
|
||||||
|
|
||||||
|
@ -165,15 +165,15 @@ static int gbcodec_mixer_ctl_info(struct snd_kcontrol *kcontrol,
|
||||||
struct gbaudio_ctl_pvt *data;
|
struct gbaudio_ctl_pvt *data;
|
||||||
struct gb_audio_ctl_elem_info *info;
|
struct gb_audio_ctl_elem_info *info;
|
||||||
struct gbaudio_module_info *module;
|
struct gbaudio_module_info *module;
|
||||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct gbaudio_codec_info *gbcodec = snd_soc_codec_get_drvdata(codec);
|
struct gbaudio_codec_info *gbcodec = snd_soc_component_get_drvdata(comp);
|
||||||
|
|
||||||
dev_dbg(codec->dev, "Entered %s:%s\n", __func__, kcontrol->id.name);
|
dev_dbg(comp->dev, "Entered %s:%s\n", __func__, kcontrol->id.name);
|
||||||
data = (struct gbaudio_ctl_pvt *)kcontrol->private_value;
|
data = (struct gbaudio_ctl_pvt *)kcontrol->private_value;
|
||||||
info = (struct gb_audio_ctl_elem_info *)data->info;
|
info = (struct gb_audio_ctl_elem_info *)data->info;
|
||||||
|
|
||||||
if (!info) {
|
if (!info) {
|
||||||
dev_err(codec->dev, "NULL info for %s\n", uinfo->id.name);
|
dev_err(comp->dev, "NULL info for %s\n", uinfo->id.name);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ static int gbcodec_mixer_ctl_info(struct snd_kcontrol *kcontrol,
|
||||||
strlcpy(uinfo->value.enumerated.name, name, NAME_SIZE);
|
strlcpy(uinfo->value.enumerated.name, name, NAME_SIZE);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dev_err(codec->dev, "Invalid type: %d for %s:kcontrol\n",
|
dev_err(comp->dev, "Invalid type: %d for %s:kcontrol\n",
|
||||||
info->type, kcontrol->id.name);
|
info->type, kcontrol->id.name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -216,11 +216,11 @@ static int gbcodec_mixer_ctl_get(struct snd_kcontrol *kcontrol,
|
||||||
struct gbaudio_ctl_pvt *data;
|
struct gbaudio_ctl_pvt *data;
|
||||||
struct gb_audio_ctl_elem_value gbvalue;
|
struct gb_audio_ctl_elem_value gbvalue;
|
||||||
struct gbaudio_module_info *module;
|
struct gbaudio_module_info *module;
|
||||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct gbaudio_codec_info *gb = snd_soc_codec_get_drvdata(codec);
|
struct gbaudio_codec_info *gb = snd_soc_component_get_drvdata(comp);
|
||||||
struct gb_bundle *bundle;
|
struct gb_bundle *bundle;
|
||||||
|
|
||||||
dev_dbg(codec->dev, "Entered %s:%s\n", __func__, kcontrol->id.name);
|
dev_dbg(comp->dev, "Entered %s:%s\n", __func__, kcontrol->id.name);
|
||||||
module = find_gb_module(gb, kcontrol->id.name);
|
module = find_gb_module(gb, kcontrol->id.name);
|
||||||
if (!module)
|
if (!module)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -239,7 +239,7 @@ static int gbcodec_mixer_ctl_get(struct snd_kcontrol *kcontrol,
|
||||||
gb_pm_runtime_put_autosuspend(bundle);
|
gb_pm_runtime_put_autosuspend(bundle);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err_ratelimited(codec->dev, "%d:Error in %s for %s\n", ret,
|
dev_err_ratelimited(comp->dev, "%d:Error in %s for %s\n", ret,
|
||||||
__func__, kcontrol->id.name);
|
__func__, kcontrol->id.name);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,7 @@ static int gbcodec_mixer_ctl_get(struct snd_kcontrol *kcontrol,
|
||||||
le32_to_cpu(gbvalue.value.enumerated_item[1]);
|
le32_to_cpu(gbvalue.value.enumerated_item[1]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dev_err(codec->dev, "Invalid type: %d for %s:kcontrol\n",
|
dev_err(comp->dev, "Invalid type: %d for %s:kcontrol\n",
|
||||||
info->type, kcontrol->id.name);
|
info->type, kcontrol->id.name);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
break;
|
break;
|
||||||
|
@ -278,11 +278,11 @@ static int gbcodec_mixer_ctl_put(struct snd_kcontrol *kcontrol,
|
||||||
struct gbaudio_ctl_pvt *data;
|
struct gbaudio_ctl_pvt *data;
|
||||||
struct gb_audio_ctl_elem_value gbvalue;
|
struct gb_audio_ctl_elem_value gbvalue;
|
||||||
struct gbaudio_module_info *module;
|
struct gbaudio_module_info *module;
|
||||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct gbaudio_codec_info *gb = snd_soc_codec_get_drvdata(codec);
|
struct gbaudio_codec_info *gb = snd_soc_component_get_drvdata(comp);
|
||||||
struct gb_bundle *bundle;
|
struct gb_bundle *bundle;
|
||||||
|
|
||||||
dev_dbg(codec->dev, "Entered %s:%s\n", __func__, kcontrol->id.name);
|
dev_dbg(comp->dev, "Entered %s:%s\n", __func__, kcontrol->id.name);
|
||||||
module = find_gb_module(gb, kcontrol->id.name);
|
module = find_gb_module(gb, kcontrol->id.name);
|
||||||
if (!module)
|
if (!module)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -309,7 +309,7 @@ static int gbcodec_mixer_ctl_put(struct snd_kcontrol *kcontrol,
|
||||||
cpu_to_le32(ucontrol->value.enumerated.item[1]);
|
cpu_to_le32(ucontrol->value.enumerated.item[1]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dev_err(codec->dev, "Invalid type: %d for %s:kcontrol\n",
|
dev_err(comp->dev, "Invalid type: %d for %s:kcontrol\n",
|
||||||
info->type, kcontrol->id.name);
|
info->type, kcontrol->id.name);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
break;
|
break;
|
||||||
|
@ -328,7 +328,7 @@ static int gbcodec_mixer_ctl_put(struct snd_kcontrol *kcontrol,
|
||||||
gb_pm_runtime_put_autosuspend(bundle);
|
gb_pm_runtime_put_autosuspend(bundle);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err_ratelimited(codec->dev, "%d:Error in %s for %s\n", ret,
|
dev_err_ratelimited(comp->dev, "%d:Error in %s for %s\n", ret,
|
||||||
__func__, kcontrol->id.name);
|
__func__, kcontrol->id.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,11 +352,7 @@ static int gbcodec_mixer_dapm_ctl_info(struct snd_kcontrol *kcontrol,
|
||||||
int platform_max, platform_min;
|
int platform_max, platform_min;
|
||||||
struct gbaudio_ctl_pvt *data;
|
struct gbaudio_ctl_pvt *data;
|
||||||
struct gb_audio_ctl_elem_info *info;
|
struct gb_audio_ctl_elem_info *info;
|
||||||
struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol);
|
|
||||||
struct snd_soc_dapm_widget *widget = wlist->widgets[0];
|
|
||||||
struct snd_soc_codec *codec = widget->codec;
|
|
||||||
|
|
||||||
dev_dbg(codec->dev, "Entered %s:%s\n", __func__, kcontrol->id.name);
|
|
||||||
data = (struct gbaudio_ctl_pvt *)kcontrol->private_value;
|
data = (struct gbaudio_ctl_pvt *)kcontrol->private_value;
|
||||||
info = (struct gb_audio_ctl_elem_info *)data->info;
|
info = (struct gb_audio_ctl_elem_info *)data->info;
|
||||||
|
|
||||||
|
@ -387,11 +383,11 @@ static int gbcodec_mixer_dapm_ctl_get(struct snd_kcontrol *kcontrol,
|
||||||
struct gbaudio_module_info *module;
|
struct gbaudio_module_info *module;
|
||||||
struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol);
|
struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol);
|
||||||
struct snd_soc_dapm_widget *widget = wlist->widgets[0];
|
struct snd_soc_dapm_widget *widget = wlist->widgets[0];
|
||||||
struct snd_soc_codec *codec = widget->codec;
|
struct device *codec_dev = widget->dapm->dev;
|
||||||
struct gbaudio_codec_info *gb = snd_soc_codec_get_drvdata(codec);
|
struct gbaudio_codec_info *gb = dev_get_drvdata(codec_dev);
|
||||||
struct gb_bundle *bundle;
|
struct gb_bundle *bundle;
|
||||||
|
|
||||||
dev_dbg(codec->dev, "Entered %s:%s\n", __func__, kcontrol->id.name);
|
dev_dbg(codec_dev, "Entered %s:%s\n", __func__, kcontrol->id.name);
|
||||||
module = find_gb_module(gb, kcontrol->id.name);
|
module = find_gb_module(gb, kcontrol->id.name);
|
||||||
if (!module)
|
if (!module)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -415,7 +411,7 @@ static int gbcodec_mixer_dapm_ctl_get(struct snd_kcontrol *kcontrol,
|
||||||
gb_pm_runtime_put_autosuspend(bundle);
|
gb_pm_runtime_put_autosuspend(bundle);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err_ratelimited(codec->dev, "%d:Error in %s for %s\n", ret,
|
dev_err_ratelimited(codec_dev, "%d:Error in %s for %s\n", ret,
|
||||||
__func__, kcontrol->id.name);
|
__func__, kcontrol->id.name);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -437,11 +433,11 @@ static int gbcodec_mixer_dapm_ctl_put(struct snd_kcontrol *kcontrol,
|
||||||
struct gbaudio_module_info *module;
|
struct gbaudio_module_info *module;
|
||||||
struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol);
|
struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol);
|
||||||
struct snd_soc_dapm_widget *widget = wlist->widgets[0];
|
struct snd_soc_dapm_widget *widget = wlist->widgets[0];
|
||||||
struct snd_soc_codec *codec = widget->codec;
|
struct device *codec_dev = widget->dapm->dev;
|
||||||
struct gbaudio_codec_info *gb = snd_soc_codec_get_drvdata(codec);
|
struct gbaudio_codec_info *gb = dev_get_drvdata(codec_dev);
|
||||||
struct gb_bundle *bundle;
|
struct gb_bundle *bundle;
|
||||||
|
|
||||||
dev_dbg(codec->dev, "Entered %s:%s\n", __func__, kcontrol->id.name);
|
dev_dbg(codec_dev, "Entered %s:%s\n", __func__, kcontrol->id.name);
|
||||||
module = find_gb_module(gb, kcontrol->id.name);
|
module = find_gb_module(gb, kcontrol->id.name);
|
||||||
if (!module)
|
if (!module)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -464,11 +460,8 @@ static int gbcodec_mixer_dapm_ctl_put(struct snd_kcontrol *kcontrol,
|
||||||
if (gbvalue.value.integer_value[0] != val) {
|
if (gbvalue.value.integer_value[0] != val) {
|
||||||
for (wi = 0; wi < wlist->num_widgets; wi++) {
|
for (wi = 0; wi < wlist->num_widgets; wi++) {
|
||||||
widget = wlist->widgets[wi];
|
widget = wlist->widgets[wi];
|
||||||
|
snd_soc_dapm_mixer_update_power(widget->dapm, kcontrol,
|
||||||
widget->value = val;
|
connect, NULL);
|
||||||
widget->dapm->update = NULL;
|
|
||||||
snd_soc_dapm_mixer_update_power(widget, kcontrol,
|
|
||||||
connect);
|
|
||||||
}
|
}
|
||||||
gbvalue.value.integer_value[0] =
|
gbvalue.value.integer_value[0] =
|
||||||
cpu_to_le32(ucontrol->value.integer.value[0]);
|
cpu_to_le32(ucontrol->value.integer.value[0]);
|
||||||
|
@ -484,7 +477,7 @@ static int gbcodec_mixer_dapm_ctl_put(struct snd_kcontrol *kcontrol,
|
||||||
gb_pm_runtime_put_autosuspend(bundle);
|
gb_pm_runtime_put_autosuspend(bundle);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err_ratelimited(codec->dev,
|
dev_err_ratelimited(codec_dev,
|
||||||
"%d:Error in %s for %s\n", ret,
|
"%d:Error in %s for %s\n", ret,
|
||||||
__func__, kcontrol->id.name);
|
__func__, kcontrol->id.name);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -553,11 +546,11 @@ static int gbcodec_enum_ctl_get(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
int ret, ctl_id;
|
int ret, ctl_id;
|
||||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
|
||||||
|
struct gbaudio_codec_info *gb = snd_soc_component_get_drvdata(comp);
|
||||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||||
struct gb_audio_ctl_elem_value gbvalue;
|
struct gb_audio_ctl_elem_value gbvalue;
|
||||||
struct gbaudio_module_info *module;
|
struct gbaudio_module_info *module;
|
||||||
struct gbaudio_codec_info *gb = snd_soc_codec_get_drvdata(codec);
|
|
||||||
struct gb_bundle *bundle;
|
struct gb_bundle *bundle;
|
||||||
|
|
||||||
module = find_gb_module(gb, kcontrol->id.name);
|
module = find_gb_module(gb, kcontrol->id.name);
|
||||||
|
@ -580,7 +573,7 @@ static int gbcodec_enum_ctl_get(struct snd_kcontrol *kcontrol,
|
||||||
gb_pm_runtime_put_autosuspend(bundle);
|
gb_pm_runtime_put_autosuspend(bundle);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err_ratelimited(codec->dev, "%d:Error in %s for %s\n", ret,
|
dev_err_ratelimited(comp->dev, "%d:Error in %s for %s\n", ret,
|
||||||
__func__, kcontrol->id.name);
|
__func__, kcontrol->id.name);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -598,11 +591,11 @@ static int gbcodec_enum_ctl_put(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
int ret, ctl_id;
|
int ret, ctl_id;
|
||||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
|
||||||
|
struct gbaudio_codec_info *gb = snd_soc_component_get_drvdata(comp);
|
||||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||||
struct gb_audio_ctl_elem_value gbvalue;
|
struct gb_audio_ctl_elem_value gbvalue;
|
||||||
struct gbaudio_module_info *module;
|
struct gbaudio_module_info *module;
|
||||||
struct gbaudio_codec_info *gb = snd_soc_codec_get_drvdata(codec);
|
|
||||||
struct gb_bundle *bundle;
|
struct gb_bundle *bundle;
|
||||||
|
|
||||||
module = find_gb_module(gb, kcontrol->id.name);
|
module = find_gb_module(gb, kcontrol->id.name);
|
||||||
|
@ -613,13 +606,13 @@ static int gbcodec_enum_ctl_put(struct snd_kcontrol *kcontrol,
|
||||||
if (ctl_id < 0)
|
if (ctl_id < 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (ucontrol->value.enumerated.item[0] > e->max - 1)
|
if (ucontrol->value.enumerated.item[0] > e->items - 1)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
gbvalue.value.enumerated_item[0] =
|
gbvalue.value.enumerated_item[0] =
|
||||||
cpu_to_le32(ucontrol->value.enumerated.item[0]);
|
cpu_to_le32(ucontrol->value.enumerated.item[0]);
|
||||||
|
|
||||||
if (e->shift_l != e->shift_r) {
|
if (e->shift_l != e->shift_r) {
|
||||||
if (ucontrol->value.enumerated.item[1] > e->max - 1)
|
if (ucontrol->value.enumerated.item[1] > e->items - 1)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
gbvalue.value.enumerated_item[1] =
|
gbvalue.value.enumerated_item[1] =
|
||||||
cpu_to_le32(ucontrol->value.enumerated.item[1]);
|
cpu_to_le32(ucontrol->value.enumerated.item[1]);
|
||||||
|
@ -637,8 +630,8 @@ static int gbcodec_enum_ctl_put(struct snd_kcontrol *kcontrol,
|
||||||
gb_pm_runtime_put_autosuspend(bundle);
|
gb_pm_runtime_put_autosuspend(bundle);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err_ratelimited(codec->dev, "%d:Error in %s for %s\n", ret,
|
dev_err_ratelimited(comp->dev, "%d:Error in %s for %s\n",
|
||||||
__func__, kcontrol->id.name);
|
ret, __func__, kcontrol->id.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -659,13 +652,13 @@ static int gbaudio_tplg_create_enum_kctl(struct gbaudio_module_info *gb,
|
||||||
gb_enum = &ctl->info.value.enumerated;
|
gb_enum = &ctl->info.value.enumerated;
|
||||||
|
|
||||||
/* since count=1, and reg is dummy */
|
/* since count=1, and reg is dummy */
|
||||||
gbe->max = le32_to_cpu(gb_enum->items);
|
gbe->items = le32_to_cpu(gb_enum->items);
|
||||||
gbe->texts = gb_generate_enum_strings(gb, gb_enum);
|
gbe->texts = gb_generate_enum_strings(gb, gb_enum);
|
||||||
|
|
||||||
/* debug enum info */
|
/* debug enum info */
|
||||||
dev_dbg(gb->dev, "Max:%d, name_length:%d\n", gbe->max,
|
dev_dbg(gb->dev, "Max:%d, name_length:%d\n", gbe->items,
|
||||||
le16_to_cpu(gb_enum->names_length));
|
le16_to_cpu(gb_enum->names_length));
|
||||||
for (i = 0; i < gbe->max; i++)
|
for (i = 0; i < gbe->items; i++)
|
||||||
dev_dbg(gb->dev, "src[%d]: %s\n", i, gbe->texts[i]);
|
dev_dbg(gb->dev, "src[%d]: %s\n", i, gbe->texts[i]);
|
||||||
|
|
||||||
*kctl = (struct snd_kcontrol_new)
|
*kctl = (struct snd_kcontrol_new)
|
||||||
|
@ -720,8 +713,8 @@ static int gbcodec_enum_dapm_ctl_get(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_soc_dapm_widget *widget = wlist->widgets[0];
|
struct snd_soc_dapm_widget *widget = wlist->widgets[0];
|
||||||
struct gbaudio_module_info *module;
|
struct gbaudio_module_info *module;
|
||||||
struct gb_audio_ctl_elem_value gbvalue;
|
struct gb_audio_ctl_elem_value gbvalue;
|
||||||
struct snd_soc_codec *codec = widget->codec;
|
struct device *codec_dev = widget->dapm->dev;
|
||||||
struct gbaudio_codec_info *gb = snd_soc_codec_get_drvdata(codec);
|
struct gbaudio_codec_info *gb = dev_get_drvdata(codec_dev);
|
||||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||||
struct gb_bundle *bundle;
|
struct gb_bundle *bundle;
|
||||||
|
|
||||||
|
@ -745,7 +738,7 @@ static int gbcodec_enum_dapm_ctl_get(struct snd_kcontrol *kcontrol,
|
||||||
gb_pm_runtime_put_autosuspend(bundle);
|
gb_pm_runtime_put_autosuspend(bundle);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err_ratelimited(codec->dev, "%d:Error in %s for %s\n", ret,
|
dev_err_ratelimited(codec_dev, "%d:Error in %s for %s\n", ret,
|
||||||
__func__, kcontrol->id.name);
|
__func__, kcontrol->id.name);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -768,12 +761,12 @@ static int gbcodec_enum_dapm_ctl_put(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_soc_dapm_widget *widget = wlist->widgets[0];
|
struct snd_soc_dapm_widget *widget = wlist->widgets[0];
|
||||||
struct gb_audio_ctl_elem_value gbvalue;
|
struct gb_audio_ctl_elem_value gbvalue;
|
||||||
struct gbaudio_module_info *module;
|
struct gbaudio_module_info *module;
|
||||||
struct snd_soc_codec *codec = widget->codec;
|
struct device *codec_dev = widget->dapm->dev;
|
||||||
struct gbaudio_codec_info *gb = snd_soc_codec_get_drvdata(codec);
|
struct gbaudio_codec_info *gb = dev_get_drvdata(codec_dev);
|
||||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||||
struct gb_bundle *bundle;
|
struct gb_bundle *bundle;
|
||||||
|
|
||||||
if (ucontrol->value.enumerated.item[0] > e->max - 1)
|
if (ucontrol->value.enumerated.item[0] > e->items - 1)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
module = find_gb_module(gb, kcontrol->id.name);
|
module = find_gb_module(gb, kcontrol->id.name);
|
||||||
|
@ -797,7 +790,7 @@ static int gbcodec_enum_dapm_ctl_put(struct snd_kcontrol *kcontrol,
|
||||||
gb_pm_runtime_put_autosuspend(bundle);
|
gb_pm_runtime_put_autosuspend(bundle);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err_ratelimited(codec->dev, "%d:Error in %s for %s\n", ret,
|
dev_err_ratelimited(codec_dev, "%d:Error in %s for %s\n", ret,
|
||||||
__func__, kcontrol->id.name);
|
__func__, kcontrol->id.name);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -814,7 +807,7 @@ static int gbcodec_enum_dapm_ctl_put(struct snd_kcontrol *kcontrol,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e->shift_l != e->shift_r) {
|
if (e->shift_l != e->shift_r) {
|
||||||
if (ucontrol->value.enumerated.item[1] > e->max - 1)
|
if (ucontrol->value.enumerated.item[1] > e->items - 1)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
val |= ucontrol->value.enumerated.item[1] << e->shift_r;
|
val |= ucontrol->value.enumerated.item[1] << e->shift_r;
|
||||||
mask |= e->mask << e->shift_r;
|
mask |= e->mask << e->shift_r;
|
||||||
|
@ -837,16 +830,14 @@ static int gbcodec_enum_dapm_ctl_put(struct snd_kcontrol *kcontrol,
|
||||||
gb_pm_runtime_put_autosuspend(bundle);
|
gb_pm_runtime_put_autosuspend(bundle);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err_ratelimited(codec->dev,
|
dev_err_ratelimited(codec_dev,
|
||||||
"%d:Error in %s for %s\n", ret,
|
"%d:Error in %s for %s\n", ret,
|
||||||
__func__, kcontrol->id.name);
|
__func__, kcontrol->id.name);
|
||||||
}
|
}
|
||||||
for (wi = 0; wi < wlist->num_widgets; wi++) {
|
for (wi = 0; wi < wlist->num_widgets; wi++) {
|
||||||
widget = wlist->widgets[wi];
|
widget = wlist->widgets[wi];
|
||||||
|
snd_soc_dapm_mux_update_power(widget->dapm, kcontrol,
|
||||||
widget->value = val;
|
val, e, NULL);
|
||||||
widget->dapm->update = NULL;
|
|
||||||
snd_soc_dapm_mux_update_power(widget, kcontrol, mux, e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -868,13 +859,13 @@ static int gbaudio_tplg_create_enum_ctl(struct gbaudio_module_info *gb,
|
||||||
gb_enum = &ctl->info.value.enumerated;
|
gb_enum = &ctl->info.value.enumerated;
|
||||||
|
|
||||||
/* since count=1, and reg is dummy */
|
/* since count=1, and reg is dummy */
|
||||||
gbe->max = le32_to_cpu(gb_enum->items);
|
gbe->items = le32_to_cpu(gb_enum->items);
|
||||||
gbe->texts = gb_generate_enum_strings(gb, gb_enum);
|
gbe->texts = gb_generate_enum_strings(gb, gb_enum);
|
||||||
|
|
||||||
/* debug enum info */
|
/* debug enum info */
|
||||||
dev_dbg(gb->dev, "Max:%d, name_length:%d\n", gbe->max,
|
dev_dbg(gb->dev, "Max:%d, name_length:%d\n", gbe->items,
|
||||||
le16_to_cpu(gb_enum->names_length));
|
le16_to_cpu(gb_enum->names_length));
|
||||||
for (i = 0; i < gbe->max; i++)
|
for (i = 0; i < gbe->items; i++)
|
||||||
dev_dbg(gb->dev, "src[%d]: %s\n", i, gbe->texts[i]);
|
dev_dbg(gb->dev, "src[%d]: %s\n", i, gbe->texts[i]);
|
||||||
|
|
||||||
*kctl = (struct snd_kcontrol_new)
|
*kctl = (struct snd_kcontrol_new)
|
||||||
|
@ -935,12 +926,12 @@ static int gbaudio_widget_event(struct snd_soc_dapm_widget *w,
|
||||||
{
|
{
|
||||||
int wid;
|
int wid;
|
||||||
int ret;
|
int ret;
|
||||||
struct snd_soc_codec *codec = w->codec;
|
struct device *codec_dev = w->dapm->dev;
|
||||||
struct gbaudio_codec_info *gbcodec = snd_soc_codec_get_drvdata(codec);
|
struct gbaudio_codec_info *gbcodec = dev_get_drvdata(codec_dev);
|
||||||
struct gbaudio_module_info *module;
|
struct gbaudio_module_info *module;
|
||||||
struct gb_bundle *bundle;
|
struct gb_bundle *bundle;
|
||||||
|
|
||||||
dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);
|
dev_dbg(codec_dev, "%s %s %d\n", __func__, w->name, event);
|
||||||
|
|
||||||
/* Find relevant module */
|
/* Find relevant module */
|
||||||
module = find_gb_module(gbcodec, w->name);
|
module = find_gb_module(gbcodec, w->name);
|
||||||
|
@ -950,7 +941,7 @@ static int gbaudio_widget_event(struct snd_soc_dapm_widget *w,
|
||||||
/* map name to widget id */
|
/* map name to widget id */
|
||||||
wid = gbaudio_map_widgetname(module, w->name);
|
wid = gbaudio_map_widgetname(module, w->name);
|
||||||
if (wid < 0) {
|
if (wid < 0) {
|
||||||
dev_err(codec->dev, "Invalid widget name:%s\n", w->name);
|
dev_err(codec_dev, "Invalid widget name:%s\n", w->name);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -973,7 +964,7 @@ static int gbaudio_widget_event(struct snd_soc_dapm_widget *w,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ret)
|
if (ret)
|
||||||
dev_err_ratelimited(codec->dev,
|
dev_err_ratelimited(codec_dev,
|
||||||
"%d: widget, event:%d failed:%d\n", wid,
|
"%d: widget, event:%d failed:%d\n", wid,
|
||||||
event, ret);
|
event, ret);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue