| .. | .. |
|---|
| 57 | 57 | |
|---|
| 58 | 58 | static int rk_dailink_init(struct snd_soc_pcm_runtime *rtd) |
|---|
| 59 | 59 | { |
|---|
| 60 | | - struct snd_soc_dai *codec_dai = rtd->codec_dai; |
|---|
| 60 | + struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); |
|---|
| 61 | 61 | struct snd_soc_card *card = rtd->card; |
|---|
| 62 | 62 | struct rk_hdmi_data *rk_data = snd_soc_card_get_drvdata(rtd->card); |
|---|
| 63 | 63 | struct device *dev = rtd->card->dev; |
|---|
| .. | .. |
|---|
| 104 | 104 | static int rk_hdmi_hw_params(struct snd_pcm_substream *substream, |
|---|
| 105 | 105 | struct snd_pcm_hw_params *params) |
|---|
| 106 | 106 | { |
|---|
| 107 | | - struct snd_soc_pcm_runtime *rtd = substream->private_data; |
|---|
| 108 | | - struct snd_soc_dai *codec_dai = rtd->codec_dai; |
|---|
| 109 | | - struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
|---|
| 107 | + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
|---|
| 108 | + struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); |
|---|
| 109 | + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); |
|---|
| 110 | 110 | struct rk_hdmi_data *rk_data = snd_soc_card_get_drvdata(rtd->card); |
|---|
| 111 | 111 | unsigned int mclk; |
|---|
| 112 | 112 | int ret; |
|---|
| .. | .. |
|---|
| 133 | 133 | |
|---|
| 134 | 134 | } |
|---|
| 135 | 135 | |
|---|
| 136 | | -static struct snd_soc_ops rk_ops = { |
|---|
| 136 | +static const struct snd_soc_ops rk_ops = { |
|---|
| 137 | 137 | .hw_params = rk_hdmi_hw_params, |
|---|
| 138 | 138 | }; |
|---|
| 139 | 139 | |
|---|
| .. | .. |
|---|
| 172 | 172 | { |
|---|
| 173 | 173 | struct device_node *np = pdev->dev.of_node; |
|---|
| 174 | 174 | struct snd_soc_dai_link_component *codecs; |
|---|
| 175 | + struct snd_soc_dai_link_component *platforms; |
|---|
| 176 | + struct snd_soc_dai_link_component *cpus; |
|---|
| 175 | 177 | struct of_phandle_args args; |
|---|
| 176 | 178 | struct device_node *cpu_np; |
|---|
| 177 | 179 | struct rk_hdmi_data *rk_data; |
|---|
| .. | .. |
|---|
| 183 | 185 | if (!rk_data) |
|---|
| 184 | 186 | return -ENOMEM; |
|---|
| 185 | 187 | |
|---|
| 188 | + cpus = devm_kzalloc(&pdev->dev, sizeof(*cpus), GFP_KERNEL); |
|---|
| 189 | + if (!cpus) |
|---|
| 190 | + return -ENOMEM; |
|---|
| 191 | + |
|---|
| 192 | + platforms = devm_kzalloc(&pdev->dev, sizeof(*platforms), GFP_KERNEL); |
|---|
| 193 | + if (!platforms) |
|---|
| 194 | + return -ENOMEM; |
|---|
| 195 | + |
|---|
| 186 | 196 | rk_data->card.dev = &pdev->dev; |
|---|
| 187 | 197 | rk_data->dai.init = &rk_dailink_init; |
|---|
| 188 | 198 | rk_data->dai.ops = &rk_ops; |
|---|
| 199 | + rk_data->dai.cpus = cpus; |
|---|
| 200 | + rk_data->dai.platforms = platforms; |
|---|
| 201 | + rk_data->dai.num_cpus = 1; |
|---|
| 202 | + rk_data->dai.num_platforms = 1; |
|---|
| 189 | 203 | /* Parse the card name from DT */ |
|---|
| 190 | 204 | ret = snd_soc_of_parse_card_name(&rk_data->card, "rockchip,card-name"); |
|---|
| 191 | 205 | if (ret < 0) |
|---|
| .. | .. |
|---|
| 213 | 227 | |
|---|
| 214 | 228 | codecs = devm_kcalloc(&pdev->dev, idx, |
|---|
| 215 | 229 | sizeof(*codecs), GFP_KERNEL); |
|---|
| 230 | + if (!codecs) |
|---|
| 231 | + return -ENOMEM; |
|---|
| 232 | + |
|---|
| 216 | 233 | rk_data->dai.codecs = codecs; |
|---|
| 217 | 234 | rk_data->dai.num_codecs = idx; |
|---|
| 218 | 235 | idx = 0; |
|---|
| .. | .. |
|---|
| 245 | 262 | rk_data->jack_det = |
|---|
| 246 | 263 | of_property_read_bool(np, "rockchip,jack-det"); |
|---|
| 247 | 264 | |
|---|
| 248 | | - rk_data->dai.cpu_of_node = cpu_np; |
|---|
| 249 | | - rk_data->dai.platform_of_node = cpu_np; |
|---|
| 265 | + rk_data->dai.cpus->of_node = cpu_np; |
|---|
| 266 | + rk_data->dai.platforms->of_node = cpu_np; |
|---|
| 250 | 267 | of_node_put(cpu_np); |
|---|
| 251 | 268 | |
|---|
| 252 | 269 | rk_data->hdmi_jack_pin.pin = rk_data->card.name; |
|---|