cs47l24.c (d4da404f36b24b089d20db1fb27d8f99cb66f409) | cs47l24.c (7dd0f7ca5f23a9c8b4a5b69587b41b413b2ecc2d) |
---|---|
1/* 2 * cs47l24.h -- ALSA SoC Audio driver for Cirrus Logic CS47L24 3 * 4 * Copyright 2015 Cirrus Logic Inc. 5 * 6 * Author: Richard Fitzgerald <rf@opensource.wolfsonmicro.com> 7 * 8 * This program is free software; you can redistribute it and/or modify --- 19 unchanged lines hidden (view full) --- 28 29#include <linux/mfd/arizona/core.h> 30#include <linux/mfd/arizona/registers.h> 31 32#include "arizona.h" 33#include "wm_adsp.h" 34#include "cs47l24.h" 35 | 1/* 2 * cs47l24.h -- ALSA SoC Audio driver for Cirrus Logic CS47L24 3 * 4 * Copyright 2015 Cirrus Logic Inc. 5 * 6 * Author: Richard Fitzgerald <rf@opensource.wolfsonmicro.com> 7 * 8 * This program is free software; you can redistribute it and/or modify --- 19 unchanged lines hidden (view full) --- 28 29#include <linux/mfd/arizona/core.h> 30#include <linux/mfd/arizona/registers.h> 31 32#include "arizona.h" 33#include "wm_adsp.h" 34#include "cs47l24.h" 35 |
36#define DRV_NAME "cs47l24-codec" 37 |
|
36struct cs47l24_priv { 37 struct arizona_priv core; 38 struct arizona_fll fll[2]; 39}; 40 41static const struct wm_adsp_region cs47l24_dsp2_regions[] = { 42 { .type = WMFW_ADSP2_PM, .base = 0x200000 }, 43 { .type = WMFW_ADSP2_ZM, .base = 0x280000 }, --- 11 unchanged lines hidden (view full) --- 55static const struct wm_adsp_region *cs47l24_dsp_regions[] = { 56 cs47l24_dsp2_regions, 57 cs47l24_dsp3_regions, 58}; 59 60static int cs47l24_adsp_power_ev(struct snd_soc_dapm_widget *w, 61 struct snd_kcontrol *kcontrol, int event) 62{ | 38struct cs47l24_priv { 39 struct arizona_priv core; 40 struct arizona_fll fll[2]; 41}; 42 43static const struct wm_adsp_region cs47l24_dsp2_regions[] = { 44 { .type = WMFW_ADSP2_PM, .base = 0x200000 }, 45 { .type = WMFW_ADSP2_ZM, .base = 0x280000 }, --- 11 unchanged lines hidden (view full) --- 57static const struct wm_adsp_region *cs47l24_dsp_regions[] = { 58 cs47l24_dsp2_regions, 59 cs47l24_dsp3_regions, 60}; 61 62static int cs47l24_adsp_power_ev(struct snd_soc_dapm_widget *w, 63 struct snd_kcontrol *kcontrol, int event) 64{ |
63 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); 64 struct arizona *arizona = dev_get_drvdata(codec->dev->parent); | 65 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); 66 struct arizona *arizona = dev_get_drvdata(component->dev->parent); |
65 unsigned int v; 66 int ret; 67 68 ret = regmap_read(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1, &v); 69 if (ret != 0) { | 67 unsigned int v; 68 int ret; 69 70 ret = regmap_read(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1, &v); 71 if (ret != 0) { |
70 dev_err(codec->dev, "Failed to read SYSCLK state: %d\n", ret); | 72 dev_err(component->dev, "Failed to read SYSCLK state: %d\n", ret); |
71 return ret; 72 } 73 74 v = (v & ARIZONA_SYSCLK_FREQ_MASK) >> ARIZONA_SYSCLK_FREQ_SHIFT; 75 76 return wm_adsp2_early_event(w, kcontrol, event, v); 77} 78 --- 110 unchanged lines hidden (view full) --- 189ARIZONA_MIXER_CONTROLS("SPKOUT", ARIZONA_OUT4LMIX_INPUT_1_SOURCE), 190 191SOC_SINGLE("HPOUT1 SC Protect Switch", ARIZONA_HP1_SHORT_CIRCUIT_CTRL, 192 ARIZONA_HP1_SC_ENA_SHIFT, 1, 0), 193 194SOC_DOUBLE_R("HPOUT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_1L, 195 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_MUTE_SHIFT, 1, 1), 196SOC_SINGLE("Speaker Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_4L, | 73 return ret; 74 } 75 76 v = (v & ARIZONA_SYSCLK_FREQ_MASK) >> ARIZONA_SYSCLK_FREQ_SHIFT; 77 78 return wm_adsp2_early_event(w, kcontrol, event, v); 79} 80 --- 110 unchanged lines hidden (view full) --- 191ARIZONA_MIXER_CONTROLS("SPKOUT", ARIZONA_OUT4LMIX_INPUT_1_SOURCE), 192 193SOC_SINGLE("HPOUT1 SC Protect Switch", ARIZONA_HP1_SHORT_CIRCUIT_CTRL, 194 ARIZONA_HP1_SC_ENA_SHIFT, 1, 0), 195 196SOC_DOUBLE_R("HPOUT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_1L, 197 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_MUTE_SHIFT, 1, 1), 198SOC_SINGLE("Speaker Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_4L, |
197 ARIZONA_OUT4L_MUTE_SHIFT, 1, 1), | 199 ARIZONA_OUT4L_MUTE_SHIFT, 1, 1), |
198 199SOC_DOUBLE_R_TLV("HPOUT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_1L, 200 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_VOL_SHIFT, 201 0xbf, 0, digital_tlv), 202SOC_SINGLE_TLV("Speaker Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_4L, | 200 201SOC_DOUBLE_R_TLV("HPOUT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_1L, 202 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_VOL_SHIFT, 203 0xbf, 0, digital_tlv), 204SOC_SINGLE_TLV("Speaker Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_4L, |
203 ARIZONA_OUT4L_VOL_SHIFT, 204 0xbf, 0, digital_tlv), | 205 ARIZONA_OUT4L_VOL_SHIFT, 0xbf, 0, digital_tlv), |
205 206SOC_ENUM("Output Ramp Up", arizona_out_vi_ramp), 207SOC_ENUM("Output Ramp Down", arizona_out_vd_ramp), 208 209SOC_SINGLE("Noise Gate Switch", ARIZONA_NOISE_GATE_CONTROL, 210 ARIZONA_NGATE_ENA_SHIFT, 1, 0), 211SOC_SINGLE_TLV("Noise Gate Threshold Volume", ARIZONA_NOISE_GATE_CONTROL, 212 ARIZONA_NGATE_THR_SHIFT, 7, 1, ng_tlv), --- 274 unchanged lines hidden (view full) --- 487SND_SOC_DAPM_PGA("ISRC3DEC2", ARIZONA_ISRC_3_CTRL_3, 488 ARIZONA_ISRC3_DEC1_ENA_SHIFT, 0, NULL, 0), 489SND_SOC_DAPM_PGA("ISRC3DEC3", ARIZONA_ISRC_3_CTRL_3, 490 ARIZONA_ISRC3_DEC2_ENA_SHIFT, 0, NULL, 0), 491SND_SOC_DAPM_PGA("ISRC3DEC4", ARIZONA_ISRC_3_CTRL_3, 492 ARIZONA_ISRC3_DEC3_ENA_SHIFT, 0, NULL, 0), 493 494SND_SOC_DAPM_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1, | 206 207SOC_ENUM("Output Ramp Up", arizona_out_vi_ramp), 208SOC_ENUM("Output Ramp Down", arizona_out_vd_ramp), 209 210SOC_SINGLE("Noise Gate Switch", ARIZONA_NOISE_GATE_CONTROL, 211 ARIZONA_NGATE_ENA_SHIFT, 1, 0), 212SOC_SINGLE_TLV("Noise Gate Threshold Volume", ARIZONA_NOISE_GATE_CONTROL, 213 ARIZONA_NGATE_THR_SHIFT, 7, 1, ng_tlv), --- 274 unchanged lines hidden (view full) --- 488SND_SOC_DAPM_PGA("ISRC3DEC2", ARIZONA_ISRC_3_CTRL_3, 489 ARIZONA_ISRC3_DEC1_ENA_SHIFT, 0, NULL, 0), 490SND_SOC_DAPM_PGA("ISRC3DEC3", ARIZONA_ISRC_3_CTRL_3, 491 ARIZONA_ISRC3_DEC2_ENA_SHIFT, 0, NULL, 0), 492SND_SOC_DAPM_PGA("ISRC3DEC4", ARIZONA_ISRC_3_CTRL_3, 493 ARIZONA_ISRC3_DEC3_ENA_SHIFT, 0, NULL, 0), 494 495SND_SOC_DAPM_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1, |
495 ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0, 496 &cs47l24_aec_loopback_mux), | 496 ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0, &cs47l24_aec_loopback_mux), |
497 498SND_SOC_DAPM_AIF_OUT("AIF1TX1", NULL, 0, 499 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX1_ENA_SHIFT, 0), 500SND_SOC_DAPM_AIF_OUT("AIF1TX2", NULL, 0, 501 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX2_ENA_SHIFT, 0), 502SND_SOC_DAPM_AIF_OUT("AIF1TX3", NULL, 0, 503 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX3_ENA_SHIFT, 0), 504SND_SOC_DAPM_AIF_OUT("AIF1TX4", NULL, 0, --- 419 unchanged lines hidden (view full) --- 924 { "DRC2 Signal Activity", NULL, "DRC2L" }, 925 { "DRC2 Signal Activity", NULL, "DRC2R" }, 926 927 { "DSP Voice Trigger", NULL, "SYSCLK" }, 928 { "DSP Voice Trigger", NULL, "DSP3 Voice Trigger" }, 929 { "DSP3 Voice Trigger", "Switch", "DSP3" }, 930}; 931 | 497 498SND_SOC_DAPM_AIF_OUT("AIF1TX1", NULL, 0, 499 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX1_ENA_SHIFT, 0), 500SND_SOC_DAPM_AIF_OUT("AIF1TX2", NULL, 0, 501 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX2_ENA_SHIFT, 0), 502SND_SOC_DAPM_AIF_OUT("AIF1TX3", NULL, 0, 503 ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX3_ENA_SHIFT, 0), 504SND_SOC_DAPM_AIF_OUT("AIF1TX4", NULL, 0, --- 419 unchanged lines hidden (view full) --- 924 { "DRC2 Signal Activity", NULL, "DRC2L" }, 925 { "DRC2 Signal Activity", NULL, "DRC2R" }, 926 927 { "DSP Voice Trigger", NULL, "SYSCLK" }, 928 { "DSP Voice Trigger", NULL, "DSP3 Voice Trigger" }, 929 { "DSP3 Voice Trigger", "Switch", "DSP3" }, 930}; 931 |
932static int cs47l24_set_fll(struct snd_soc_codec *codec, int fll_id, int source, 933 unsigned int Fref, unsigned int Fout) | 932static int cs47l24_set_fll(struct snd_soc_component *component, int fll_id, 933 int source, unsigned int Fref, unsigned int Fout) |
934{ | 934{ |
935 struct cs47l24_priv *cs47l24 = snd_soc_codec_get_drvdata(codec); | 935 struct cs47l24_priv *cs47l24 = snd_soc_component_get_drvdata(component); |
936 937 switch (fll_id) { 938 case CS47L24_FLL1: 939 return arizona_set_fll(&cs47l24->fll[0], source, Fref, Fout); 940 case CS47L24_FLL2: 941 return arizona_set_fll(&cs47l24->fll[1], source, Fref, Fout); 942 case CS47L24_FLL1_REFCLK: 943 return arizona_set_fll_refclk(&cs47l24->fll[0], source, Fref, --- 120 unchanged lines hidden (view full) --- 1064 .formats = CS47L24_FORMATS, 1065 }, 1066 }, 1067}; 1068 1069static int cs47l24_open(struct snd_compr_stream *stream) 1070{ 1071 struct snd_soc_pcm_runtime *rtd = stream->private_data; | 936 937 switch (fll_id) { 938 case CS47L24_FLL1: 939 return arizona_set_fll(&cs47l24->fll[0], source, Fref, Fout); 940 case CS47L24_FLL2: 941 return arizona_set_fll(&cs47l24->fll[1], source, Fref, Fout); 942 case CS47L24_FLL1_REFCLK: 943 return arizona_set_fll_refclk(&cs47l24->fll[0], source, Fref, --- 120 unchanged lines hidden (view full) --- 1064 .formats = CS47L24_FORMATS, 1065 }, 1066 }, 1067}; 1068 1069static int cs47l24_open(struct snd_compr_stream *stream) 1070{ 1071 struct snd_soc_pcm_runtime *rtd = stream->private_data; |
1072 struct cs47l24_priv *priv = snd_soc_platform_get_drvdata(rtd->platform); | 1072 struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); 1073 struct cs47l24_priv *priv = snd_soc_component_get_drvdata(component); |
1073 struct arizona *arizona = priv->core.arizona; 1074 int n_adsp; 1075 1076 if (strcmp(rtd->codec_dai->name, "cs47l24-dsp-voicectrl") == 0) { 1077 n_adsp = 2; 1078 } else if (strcmp(rtd->codec_dai->name, "cs47l24-dsp-trace") == 0) { 1079 n_adsp = 1; 1080 } else { --- 29 unchanged lines hidden (view full) --- 1110 if (!serviced) { 1111 dev_err(arizona->dev, "Spurious compressed data IRQ\n"); 1112 return IRQ_NONE; 1113 } 1114 1115 return IRQ_HANDLED; 1116} 1117 | 1074 struct arizona *arizona = priv->core.arizona; 1075 int n_adsp; 1076 1077 if (strcmp(rtd->codec_dai->name, "cs47l24-dsp-voicectrl") == 0) { 1078 n_adsp = 2; 1079 } else if (strcmp(rtd->codec_dai->name, "cs47l24-dsp-trace") == 0) { 1080 n_adsp = 1; 1081 } else { --- 29 unchanged lines hidden (view full) --- 1111 if (!serviced) { 1112 dev_err(arizona->dev, "Spurious compressed data IRQ\n"); 1113 return IRQ_NONE; 1114 } 1115 1116 return IRQ_HANDLED; 1117} 1118 |
1118static int cs47l24_codec_probe(struct snd_soc_codec *codec) | 1119static int cs47l24_component_probe(struct snd_soc_component *component) |
1119{ | 1120{ |
1120 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); 1121 struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); 1122 struct cs47l24_priv *priv = snd_soc_codec_get_drvdata(codec); | 1121 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); 1122 struct cs47l24_priv *priv = snd_soc_component_get_drvdata(component); |
1123 struct arizona *arizona = priv->core.arizona; 1124 int ret; 1125 1126 arizona->dapm = dapm; | 1123 struct arizona *arizona = priv->core.arizona; 1124 int ret; 1125 1126 arizona->dapm = dapm; |
1127 snd_soc_codec_init_regmap(codec, arizona->regmap); | 1127 snd_soc_component_init_regmap(component, arizona->regmap); |
1128 | 1128 |
1129 ret = arizona_init_spk(codec); | 1129 ret = arizona_init_spk(component); |
1130 if (ret < 0) 1131 return ret; 1132 | 1130 if (ret < 0) 1131 return ret; 1132 |
1133 arizona_init_gpio(codec); 1134 arizona_init_mono(codec); | 1133 arizona_init_gpio(component); 1134 arizona_init_mono(component); |
1135 | 1135 |
1136 ret = wm_adsp2_codec_probe(&priv->core.adsp[1], codec); | 1136 ret = wm_adsp2_component_probe(&priv->core.adsp[1], component); |
1137 if (ret) 1138 goto err_adsp2_codec_probe; 1139 | 1137 if (ret) 1138 goto err_adsp2_codec_probe; 1139 |
1140 ret = wm_adsp2_codec_probe(&priv->core.adsp[2], codec); | 1140 ret = wm_adsp2_component_probe(&priv->core.adsp[2], component); |
1141 if (ret) 1142 goto err_adsp2_codec_probe; 1143 | 1141 if (ret) 1142 goto err_adsp2_codec_probe; 1143 |
1144 ret = snd_soc_add_codec_controls(codec, 1145 &arizona_adsp2_rate_controls[1], 2); | 1144 ret = snd_soc_add_component_controls(component, 1145 &arizona_adsp2_rate_controls[1], 1146 2); |
1146 if (ret) 1147 goto err_adsp2_codec_probe; 1148 1149 snd_soc_component_disable_pin(component, "HAPTICS"); 1150 1151 return 0; 1152 1153err_adsp2_codec_probe: | 1147 if (ret) 1148 goto err_adsp2_codec_probe; 1149 1150 snd_soc_component_disable_pin(component, "HAPTICS"); 1151 1152 return 0; 1153 1154err_adsp2_codec_probe: |
1154 wm_adsp2_codec_remove(&priv->core.adsp[1], codec); 1155 wm_adsp2_codec_remove(&priv->core.adsp[2], codec); | 1155 wm_adsp2_component_remove(&priv->core.adsp[1], component); 1156 wm_adsp2_component_remove(&priv->core.adsp[2], component); |
1156 1157 return ret; 1158} 1159 | 1157 1158 return ret; 1159} 1160 |
1160static int cs47l24_codec_remove(struct snd_soc_codec *codec) | 1161static void cs47l24_component_remove(struct snd_soc_component *component) |
1161{ | 1162{ |
1162 struct cs47l24_priv *priv = snd_soc_codec_get_drvdata(codec); | 1163 struct cs47l24_priv *priv = snd_soc_component_get_drvdata(component); |
1163 | 1164 |
1164 wm_adsp2_codec_remove(&priv->core.adsp[1], codec); 1165 wm_adsp2_codec_remove(&priv->core.adsp[2], codec); | 1165 wm_adsp2_component_remove(&priv->core.adsp[1], component); 1166 wm_adsp2_component_remove(&priv->core.adsp[2], component); |
1166 1167 priv->core.arizona->dapm = NULL; | 1167 1168 priv->core.arizona->dapm = NULL; |
1168 1169 return 0; | |
1170} 1171 1172#define CS47L24_DIG_VU 0x0200 1173 1174static unsigned int cs47l24_digital_vu[] = { 1175 ARIZONA_DAC_DIGITAL_VOLUME_1L, 1176 ARIZONA_DAC_DIGITAL_VOLUME_1R, 1177 ARIZONA_DAC_DIGITAL_VOLUME_4L, 1178}; 1179 | 1169} 1170 1171#define CS47L24_DIG_VU 0x0200 1172 1173static unsigned int cs47l24_digital_vu[] = { 1174 ARIZONA_DAC_DIGITAL_VOLUME_1L, 1175 ARIZONA_DAC_DIGITAL_VOLUME_1R, 1176 ARIZONA_DAC_DIGITAL_VOLUME_4L, 1177}; 1178 |
1180static const struct snd_soc_codec_driver soc_codec_dev_cs47l24 = { 1181 .probe = cs47l24_codec_probe, 1182 .remove = cs47l24_codec_remove, 1183 1184 .idle_bias_off = true, 1185 1186 .set_sysclk = arizona_set_sysclk, 1187 .set_pll = cs47l24_set_fll, 1188 1189 .component_driver = { 1190 .controls = cs47l24_snd_controls, 1191 .num_controls = ARRAY_SIZE(cs47l24_snd_controls), 1192 .dapm_widgets = cs47l24_dapm_widgets, 1193 .num_dapm_widgets = ARRAY_SIZE(cs47l24_dapm_widgets), 1194 .dapm_routes = cs47l24_dapm_routes, 1195 .num_dapm_routes = ARRAY_SIZE(cs47l24_dapm_routes), 1196 }, | 1179static struct snd_compr_ops cs47l24_compr_ops = { 1180 .open = cs47l24_open, 1181 .free = wm_adsp_compr_free, 1182 .set_params = wm_adsp_compr_set_params, 1183 .get_caps = wm_adsp_compr_get_caps, 1184 .trigger = wm_adsp_compr_trigger, 1185 .pointer = wm_adsp_compr_pointer, 1186 .copy = wm_adsp_compr_copy, |
1197}; 1198 | 1187}; 1188 |
1199static const struct snd_compr_ops cs47l24_compr_ops = { 1200 .open = cs47l24_open, 1201 .free = wm_adsp_compr_free, 1202 .set_params = wm_adsp_compr_set_params, 1203 .get_caps = wm_adsp_compr_get_caps, 1204 .trigger = wm_adsp_compr_trigger, 1205 .pointer = wm_adsp_compr_pointer, 1206 .copy = wm_adsp_compr_copy, | 1189static const struct snd_soc_component_driver soc_component_dev_cs47l24 = { 1190 .probe = cs47l24_component_probe, 1191 .remove = cs47l24_component_remove, 1192 .set_sysclk = arizona_set_sysclk, 1193 .set_pll = cs47l24_set_fll, 1194 .name = DRV_NAME, 1195 .compr_ops = &cs47l24_compr_ops, 1196 .controls = cs47l24_snd_controls, 1197 .num_controls = ARRAY_SIZE(cs47l24_snd_controls), 1198 .dapm_widgets = cs47l24_dapm_widgets, 1199 .num_dapm_widgets = ARRAY_SIZE(cs47l24_dapm_widgets), 1200 .dapm_routes = cs47l24_dapm_routes, 1201 .num_dapm_routes = ARRAY_SIZE(cs47l24_dapm_routes), 1202 .use_pmdown_time = 1, 1203 .endianness = 1, 1204 .non_legacy_dai_naming = 1, |
1207}; 1208 | 1205}; 1206 |
1209static const struct snd_soc_platform_driver cs47l24_compr_platform = { 1210 .compr_ops = &cs47l24_compr_ops, 1211}; 1212 | |
1213static int cs47l24_probe(struct platform_device *pdev) 1214{ 1215 struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); 1216 struct cs47l24_priv *cs47l24; 1217 int i, ret; 1218 1219 BUILD_BUG_ON(ARRAY_SIZE(cs47l24_dai) > ARIZONA_MAX_DAI); 1220 1221 cs47l24 = devm_kzalloc(&pdev->dev, sizeof(struct cs47l24_priv), | 1207static int cs47l24_probe(struct platform_device *pdev) 1208{ 1209 struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); 1210 struct cs47l24_priv *cs47l24; 1211 int i, ret; 1212 1213 BUILD_BUG_ON(ARRAY_SIZE(cs47l24_dai) > ARIZONA_MAX_DAI); 1214 1215 cs47l24 = devm_kzalloc(&pdev->dev, sizeof(struct cs47l24_priv), |
1222 GFP_KERNEL); | 1216 GFP_KERNEL); |
1223 if (!cs47l24) 1224 return -ENOMEM; 1225 1226 if (IS_ENABLED(CONFIG_OF)) { 1227 if (!dev_get_platdata(arizona->dev)) { 1228 ret = arizona_of_get_audio_pdata(arizona); 1229 if (ret < 0) 1230 return ret; --- 62 unchanged lines hidden (view full) --- 1293 1294 ret = arizona_init_vol_limit(arizona); 1295 if (ret < 0) 1296 goto err_dsp_irq; 1297 ret = arizona_init_spk_irqs(arizona); 1298 if (ret < 0) 1299 goto err_dsp_irq; 1300 | 1217 if (!cs47l24) 1218 return -ENOMEM; 1219 1220 if (IS_ENABLED(CONFIG_OF)) { 1221 if (!dev_get_platdata(arizona->dev)) { 1222 ret = arizona_of_get_audio_pdata(arizona); 1223 if (ret < 0) 1224 return ret; --- 62 unchanged lines hidden (view full) --- 1287 1288 ret = arizona_init_vol_limit(arizona); 1289 if (ret < 0) 1290 goto err_dsp_irq; 1291 ret = arizona_init_spk_irqs(arizona); 1292 if (ret < 0) 1293 goto err_dsp_irq; 1294 |
1301 ret = snd_soc_register_platform(&pdev->dev, &cs47l24_compr_platform); | 1295 ret = devm_snd_soc_register_component(&pdev->dev, 1296 &soc_component_dev_cs47l24, 1297 cs47l24_dai, 1298 ARRAY_SIZE(cs47l24_dai)); |
1302 if (ret < 0) { | 1299 if (ret < 0) { |
1303 dev_err(&pdev->dev, "Failed to register platform: %d\n", ret); | 1300 dev_err(&pdev->dev, "Failed to register component: %d\n", ret); |
1304 goto err_spk_irqs; 1305 } 1306 | 1301 goto err_spk_irqs; 1302 } 1303 |
1307 ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_cs47l24, 1308 cs47l24_dai, ARRAY_SIZE(cs47l24_dai)); 1309 if (ret < 0) { 1310 dev_err(&pdev->dev, "Failed to register codec: %d\n", ret); 1311 goto err_platform; 1312 } 1313 | |
1314 return ret; 1315 | 1304 return ret; 1305 |
1316err_platform: 1317 snd_soc_unregister_platform(&pdev->dev); | |
1318err_spk_irqs: 1319 arizona_free_spk_irqs(arizona); 1320err_dsp_irq: 1321 arizona_free_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, cs47l24); 1322 1323 return ret; 1324} 1325 1326static int cs47l24_remove(struct platform_device *pdev) 1327{ 1328 struct cs47l24_priv *cs47l24 = platform_get_drvdata(pdev); 1329 struct arizona *arizona = cs47l24->core.arizona; 1330 | 1306err_spk_irqs: 1307 arizona_free_spk_irqs(arizona); 1308err_dsp_irq: 1309 arizona_free_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, cs47l24); 1310 1311 return ret; 1312} 1313 1314static int cs47l24_remove(struct platform_device *pdev) 1315{ 1316 struct cs47l24_priv *cs47l24 = platform_get_drvdata(pdev); 1317 struct arizona *arizona = cs47l24->core.arizona; 1318 |
1331 snd_soc_unregister_platform(&pdev->dev); 1332 snd_soc_unregister_codec(&pdev->dev); | |
1333 pm_runtime_disable(&pdev->dev); 1334 1335 wm_adsp2_remove(&cs47l24->core.adsp[1]); 1336 wm_adsp2_remove(&cs47l24->core.adsp[2]); 1337 1338 arizona_free_spk_irqs(arizona); 1339 1340 arizona_free_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, cs47l24); --- 18 unchanged lines hidden --- | 1319 pm_runtime_disable(&pdev->dev); 1320 1321 wm_adsp2_remove(&cs47l24->core.adsp[1]); 1322 wm_adsp2_remove(&cs47l24->core.adsp[2]); 1323 1324 arizona_free_spk_irqs(arizona); 1325 1326 arizona_free_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, cs47l24); --- 18 unchanged lines hidden --- |