Skip to content

Commit ce7bd83

Browse files
agarwalvaibhavgregkh
authored andcommitted
staging: greybus: audio: Resolve compilation errors for GB codec module
Due to dependencies on ASoC framework changes, GB dummy codec module compilation is currently disabled. This patch updates codec driver as per the latest ASoC APIs. Signed-off-by: Vaibhav Agarwal <[email protected]> Reviewed-by: Dan Carpenter <[email protected]> Link: https://lore.kernel.org/r/dd66a960fca186da055600fe1e622b7a814cb543.1594290158.git.vaibhav.sr@gmail.com Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent ac40b4d commit ce7bd83

File tree

2 files changed

+44
-46
lines changed

2 files changed

+44
-46
lines changed

drivers/staging/greybus/audio_codec.c

Lines changed: 43 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ static int gbaudio_init_jack(struct gbaudio_module_info *module,
825825
int gbaudio_register_module(struct gbaudio_module_info *module)
826826
{
827827
int ret;
828-
struct snd_soc_codec *codec;
828+
struct snd_soc_component *comp;
829829
struct snd_card *card;
830830
struct gbaudio_jack *jack = NULL;
831831

@@ -834,8 +834,8 @@ int gbaudio_register_module(struct gbaudio_module_info *module)
834834
return -EAGAIN;
835835
}
836836

837-
codec = gbcodec->codec;
838-
card = codec->card->snd_card;
837+
comp = gbcodec->component;
838+
card = comp->card->snd_card;
839839

840840
down_write(&card->controls_rwsem);
841841

@@ -847,33 +847,33 @@ int gbaudio_register_module(struct gbaudio_module_info *module)
847847
return -EINVAL;
848848
}
849849

850-
ret = gbaudio_init_jack(module, component->card);
850+
ret = gbaudio_init_jack(module, comp->card);
851851
if (ret) {
852852
up_write(&card->controls_rwsem);
853853
return ret;
854854
}
855855

856856
if (module->dapm_widgets)
857-
snd_soc_dapm_new_controls(&codec->dapm, module->dapm_widgets,
857+
snd_soc_dapm_new_controls(&comp->dapm, module->dapm_widgets,
858858
module->num_dapm_widgets);
859859
if (module->controls)
860-
snd_soc_add_codec_controls(codec, module->controls,
861-
module->num_controls);
860+
snd_soc_add_component_controls(comp, module->controls,
861+
module->num_controls);
862862
if (module->dapm_routes)
863-
snd_soc_dapm_add_routes(&codec->dapm, module->dapm_routes,
863+
snd_soc_dapm_add_routes(&comp->dapm, module->dapm_routes,
864864
module->num_dapm_routes);
865865

866866
/* card already instantiated, create widgets here only */
867-
if (codec->card->instantiated) {
868-
snd_soc_dapm_link_component_dai_widgets(codec->card,
869-
&codec->dapm);
867+
if (comp->card->instantiated) {
868+
snd_soc_dapm_link_component_dai_widgets(comp->card,
869+
&comp->dapm);
870870
#ifdef CONFIG_SND_JACK
871871
/*
872872
* register jack devices for this module
873873
* from codec->jack_list
874874
*/
875875
list_for_each_entry(jack, &module->jack_list, list) {
876-
snd_device_register(codec->card->snd_card,
876+
snd_device_register(comp->card->snd_card,
877877
jack->jack.jack);
878878
}
879879
#endif
@@ -883,9 +883,9 @@ int gbaudio_register_module(struct gbaudio_module_info *module)
883883
list_add(&module->list, &gbcodec->module_list);
884884
mutex_unlock(&gbcodec->lock);
885885

886-
if (codec->card->instantiated)
887-
ret = snd_soc_dapm_new_widgets(&codec->dapm);
888-
dev_dbg(codec->dev, "Registered %s module\n", module->name);
886+
if (comp->card->instantiated)
887+
ret = snd_soc_dapm_new_widgets(comp->card);
888+
dev_dbg(comp->dev, "Registered %s module\n", module->name);
889889

890890
up_write(&card->controls_rwsem);
891891
return ret;
@@ -956,18 +956,18 @@ static void gbaudio_codec_cleanup(struct gbaudio_module_info *module)
956956

957957
void gbaudio_unregister_module(struct gbaudio_module_info *module)
958958
{
959-
struct snd_soc_codec *codec = gbcodec->codec;
960-
struct snd_card *card = codec->card->snd_card;
959+
struct snd_soc_component *comp = gbcodec->component;
960+
struct snd_card *card = comp->card->snd_card;
961961
struct gbaudio_jack *jack, *n;
962962
int mask;
963963

964-
dev_dbg(codec->dev, "Unregister %s module\n", module->name);
964+
dev_dbg(comp->dev, "Unregister %s module\n", module->name);
965965

966966
down_write(&card->controls_rwsem);
967967
mutex_lock(&gbcodec->lock);
968968
gbaudio_codec_cleanup(module);
969969
list_del(&module->list);
970-
dev_dbg(codec->dev, "Process Unregister %s module\n", module->name);
970+
dev_dbg(comp->dev, "Process Unregister %s module\n", module->name);
971971
mutex_unlock(&gbcodec->lock);
972972

973973
#ifdef CONFIG_SND_JACK
@@ -983,99 +983,97 @@ void gbaudio_unregister_module(struct gbaudio_module_info *module)
983983
dev_dbg(module->dev, "Report %s removal\n",
984984
jack->jack.jack->id);
985985
snd_soc_jack_report(&jack->jack, 0, mask);
986-
snd_device_free(codec->card->snd_card, jack->jack.jack);
986+
snd_device_free(comp->card->snd_card,
987+
jack->jack.jack);
987988
list_del(&jack->list);
988989
}
989990
}
990991
#endif
991992

992993
if (module->dapm_routes) {
993-
dev_dbg(codec->dev, "Removing %d routes\n",
994+
dev_dbg(comp->dev, "Removing %d routes\n",
994995
module->num_dapm_routes);
995-
snd_soc_dapm_del_routes(&codec->dapm, module->dapm_routes,
996+
snd_soc_dapm_del_routes(&comp->dapm, module->dapm_routes,
996997
module->num_dapm_routes);
997998
}
998999
if (module->controls) {
999-
dev_dbg(codec->dev, "Removing %d controls\n",
1000+
dev_dbg(comp->dev, "Removing %d controls\n",
10001001
module->num_controls);
1001-
snd_soc_remove_codec_controls(codec, module->controls,
1002+
snd_soc_remove_codec_controls(comp, module->controls,
10021003
module->num_controls);
10031004
}
10041005
if (module->dapm_widgets) {
1005-
dev_dbg(codec->dev, "Removing %d widgets\n",
1006+
dev_dbg(comp->dev, "Removing %d widgets\n",
10061007
module->num_dapm_widgets);
1007-
snd_soc_dapm_free_controls(&codec->dapm, module->dapm_widgets,
1008+
snd_soc_dapm_free_controls(&comp->dapm, module->dapm_widgets,
10081009
module->num_dapm_widgets);
10091010
}
10101011

1011-
dev_dbg(codec->dev, "Unregistered %s module\n", module->name);
1012+
dev_dbg(comp->dev, "Unregistered %s module\n", module->name);
10121013

10131014
up_write(&card->controls_rwsem);
10141015
}
10151016
EXPORT_SYMBOL(gbaudio_unregister_module);
10161017

10171018
/*
1018-
* codec driver ops
1019+
* component driver ops
10191020
*/
1020-
static int gbcodec_probe(struct snd_soc_codec *codec)
1021+
static int gbcodec_probe(struct snd_soc_component *comp)
10211022
{
10221023
int i;
10231024
struct gbaudio_codec_info *info;
10241025
struct gbaudio_codec_dai *dai;
10251026

1026-
info = devm_kzalloc(codec->dev, sizeof(*info), GFP_KERNEL);
1027+
info = devm_kzalloc(comp->dev, sizeof(*info), GFP_KERNEL);
10271028
if (!info)
10281029
return -ENOMEM;
10291030

1030-
info->dev = codec->dev;
1031+
info->dev = comp->dev;
10311032
INIT_LIST_HEAD(&info->module_list);
10321033
mutex_init(&info->lock);
10331034
INIT_LIST_HEAD(&info->dai_list);
10341035

10351036
/* init dai_list used to maintain runtime stream info */
10361037
for (i = 0; i < ARRAY_SIZE(gbaudio_dai); i++) {
1037-
dai = devm_kzalloc(codec->dev, sizeof(*dai), GFP_KERNEL);
1038+
dai = devm_kzalloc(comp->dev, sizeof(*dai), GFP_KERNEL);
10381039
if (!dai)
10391040
return -ENOMEM;
10401041
dai->id = gbaudio_dai[i].id;
10411042
list_add(&dai->list, &info->dai_list);
10421043
}
10431044

1044-
info->codec = codec;
1045-
snd_soc_codec_set_drvdata(codec, info);
1045+
info->component = comp;
1046+
snd_soc_component_set_drvdata(comp, info);
10461047
gbcodec = info;
10471048

1048-
device_init_wakeup(codec->dev, 1);
1049+
device_init_wakeup(comp->dev, 1);
10491050
return 0;
10501051
}
10511052

1052-
static int gbcodec_remove(struct snd_soc_codec *codec)
1053+
static void gbcodec_remove(struct snd_soc_component *comp)
10531054
{
10541055
/* Empty function for now */
1055-
return 0;
1056+
return;
10561057
}
10571058

1058-
static int gbcodec_write(struct snd_soc_codec *codec, unsigned int reg,
1059+
static int gbcodec_write(struct snd_soc_component *comp, unsigned int reg,
10591060
unsigned int value)
10601061
{
10611062
return 0;
10621063
}
10631064

1064-
static unsigned int gbcodec_read(struct snd_soc_codec *codec,
1065+
static unsigned int gbcodec_read(struct snd_soc_component *comp,
10651066
unsigned int reg)
10661067
{
10671068
return 0;
10681069
}
10691070

1070-
static struct snd_soc_codec_driver soc_codec_dev_gbaudio = {
1071+
static const struct snd_soc_component_driver soc_codec_dev_gbaudio = {
10711072
.probe = gbcodec_probe,
10721073
.remove = gbcodec_remove,
10731074

10741075
.read = gbcodec_read,
10751076
.write = gbcodec_write,
1076-
1077-
.idle_bias_off = true,
1078-
.ignore_pmdown_time = 1,
10791077
};
10801078

10811079
#ifdef CONFIG_PM
@@ -1099,13 +1097,13 @@ static const struct dev_pm_ops gbaudio_codec_pm_ops = {
10991097

11001098
static int gbaudio_codec_probe(struct platform_device *pdev)
11011099
{
1102-
return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_gbaudio,
1100+
return devm_snd_soc_register_component(&pdev->dev,
1101+
&soc_codec_dev_gbaudio,
11031102
gbaudio_dai, ARRAY_SIZE(gbaudio_dai));
11041103
}
11051104

11061105
static int gbaudio_codec_remove(struct platform_device *pdev)
11071106
{
1108-
snd_soc_unregister_codec(&pdev->dev);
11091107
return 0;
11101108
}
11111109

drivers/staging/greybus/audio_codec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ struct gbaudio_codec_dai {
6666

6767
struct gbaudio_codec_info {
6868
struct device *dev;
69-
struct snd_soc_codec *codec;
69+
struct snd_soc_component *component;
7070
struct list_head module_list;
7171
/* to maintain runtime stream params for each DAI */
7272
struct list_head dai_list;

0 commit comments

Comments
 (0)