linux/sound/soc/intel/boards/bxt_rt298.c
<<
>>
Prefs
   1// SPDX-License-Identifier: GPL-2.0-only
   2/*
   3 * Intel Broxton-P I2S Machine Driver
   4 *
   5 * Copyright (C) 2014-2016, Intel Corporation. All rights reserved.
   6 *
   7 * Modified from:
   8 *   Intel Skylake I2S Machine driver
   9 */
  10
  11#include <linux/module.h>
  12#include <linux/platform_device.h>
  13#include <sound/core.h>
  14#include <sound/pcm.h>
  15#include <sound/soc.h>
  16#include <sound/soc-acpi.h>
  17#include <sound/jack.h>
  18#include <sound/pcm_params.h>
  19#include "../../codecs/hdac_hdmi.h"
  20#include "../../codecs/rt298.h"
  21
  22/* Headset jack detection DAPM pins */
  23static struct snd_soc_jack broxton_headset;
  24static struct snd_soc_jack broxton_hdmi[3];
  25
  26struct bxt_hdmi_pcm {
  27        struct list_head head;
  28        struct snd_soc_dai *codec_dai;
  29        int device;
  30};
  31
  32struct bxt_rt286_private {
  33        struct list_head hdmi_pcm_list;
  34};
  35
  36enum {
  37        BXT_DPCM_AUDIO_PB = 0,
  38        BXT_DPCM_AUDIO_CP,
  39        BXT_DPCM_AUDIO_REF_CP,
  40        BXT_DPCM_AUDIO_DMIC_CP,
  41        BXT_DPCM_AUDIO_HDMI1_PB,
  42        BXT_DPCM_AUDIO_HDMI2_PB,
  43        BXT_DPCM_AUDIO_HDMI3_PB,
  44};
  45
  46static struct snd_soc_jack_pin broxton_headset_pins[] = {
  47        {
  48                .pin = "Mic Jack",
  49                .mask = SND_JACK_MICROPHONE,
  50        },
  51        {
  52                .pin = "Headphone Jack",
  53                .mask = SND_JACK_HEADPHONE,
  54        },
  55};
  56
  57static const struct snd_kcontrol_new broxton_controls[] = {
  58        SOC_DAPM_PIN_SWITCH("Speaker"),
  59        SOC_DAPM_PIN_SWITCH("Headphone Jack"),
  60        SOC_DAPM_PIN_SWITCH("Mic Jack"),
  61};
  62
  63static const struct snd_soc_dapm_widget broxton_widgets[] = {
  64        SND_SOC_DAPM_HP("Headphone Jack", NULL),
  65        SND_SOC_DAPM_SPK("Speaker", NULL),
  66        SND_SOC_DAPM_MIC("Mic Jack", NULL),
  67        SND_SOC_DAPM_MIC("DMIC2", NULL),
  68        SND_SOC_DAPM_MIC("SoC DMIC", NULL),
  69        SND_SOC_DAPM_SPK("HDMI1", NULL),
  70        SND_SOC_DAPM_SPK("HDMI2", NULL),
  71        SND_SOC_DAPM_SPK("HDMI3", NULL),
  72};
  73
  74static const struct snd_soc_dapm_route broxton_rt298_map[] = {
  75        /* speaker */
  76        {"Speaker", NULL, "SPOR"},
  77        {"Speaker", NULL, "SPOL"},
  78
  79        /* HP jack connectors - unknown if we have jack detect */
  80        {"Headphone Jack", NULL, "HPO Pin"},
  81
  82        /* other jacks */
  83        {"MIC1", NULL, "Mic Jack"},
  84
  85        /* digital mics */
  86        {"DMIC1 Pin", NULL, "DMIC2"},
  87        {"DMic", NULL, "SoC DMIC"},
  88
  89        {"HDMI1", NULL, "hif5-0 Output"},
  90        {"HDMI2", NULL, "hif6-0 Output"},
  91        {"HDMI2", NULL, "hif7-0 Output"},
  92
  93        /* CODEC BE connections */
  94        { "AIF1 Playback", NULL, "ssp5 Tx"},
  95        { "ssp5 Tx", NULL, "codec0_out"},
  96        { "ssp5 Tx", NULL, "codec1_out"},
  97
  98        { "codec0_in", NULL, "ssp5 Rx" },
  99        { "ssp5 Rx", NULL, "AIF1 Capture" },
 100
 101        { "dmic01_hifi", NULL, "DMIC01 Rx" },
 102        { "DMIC01 Rx", NULL, "Capture" },
 103
 104        { "hifi3", NULL, "iDisp3 Tx"},
 105        { "iDisp3 Tx", NULL, "iDisp3_out"},
 106        { "hifi2", NULL, "iDisp2 Tx"},
 107        { "iDisp2 Tx", NULL, "iDisp2_out"},
 108        { "hifi1", NULL, "iDisp1 Tx"},
 109        { "iDisp1 Tx", NULL, "iDisp1_out"},
 110};
 111
 112static const struct snd_soc_dapm_route geminilake_rt298_map[] = {
 113        /* speaker */
 114        {"Speaker", NULL, "SPOR"},
 115        {"Speaker", NULL, "SPOL"},
 116
 117        /* HP jack connectors - unknown if we have jack detect */
 118        {"Headphone Jack", NULL, "HPO Pin"},
 119
 120        /* other jacks */
 121        {"MIC1", NULL, "Mic Jack"},
 122
 123        /* digital mics */
 124        {"DMIC1 Pin", NULL, "DMIC2"},
 125        {"DMic", NULL, "SoC DMIC"},
 126
 127        {"HDMI1", NULL, "hif5-0 Output"},
 128        {"HDMI2", NULL, "hif6-0 Output"},
 129        {"HDMI2", NULL, "hif7-0 Output"},
 130
 131        /* CODEC BE connections */
 132        { "AIF1 Playback", NULL, "ssp2 Tx"},
 133        { "ssp2 Tx", NULL, "codec0_out"},
 134        { "ssp2 Tx", NULL, "codec1_out"},
 135
 136        { "codec0_in", NULL, "ssp2 Rx" },
 137        { "ssp2 Rx", NULL, "AIF1 Capture" },
 138
 139        { "dmic01_hifi", NULL, "DMIC01 Rx" },
 140        { "DMIC01 Rx", NULL, "Capture" },
 141
 142        { "dmic_voice", NULL, "DMIC16k Rx" },
 143        { "DMIC16k Rx", NULL, "Capture" },
 144
 145        { "hifi3", NULL, "iDisp3 Tx"},
 146        { "iDisp3 Tx", NULL, "iDisp3_out"},
 147        { "hifi2", NULL, "iDisp2 Tx"},
 148        { "iDisp2 Tx", NULL, "iDisp2_out"},
 149        { "hifi1", NULL, "iDisp1 Tx"},
 150        { "iDisp1 Tx", NULL, "iDisp1_out"},
 151};
 152
 153static int broxton_rt298_fe_init(struct snd_soc_pcm_runtime *rtd)
 154{
 155        struct snd_soc_dapm_context *dapm;
 156        struct snd_soc_component *component = rtd->cpu_dai->component;
 157
 158        dapm = snd_soc_component_get_dapm(component);
 159        snd_soc_dapm_ignore_suspend(dapm, "Reference Capture");
 160
 161        return 0;
 162}
 163
 164static int broxton_rt298_codec_init(struct snd_soc_pcm_runtime *rtd)
 165{
 166        struct snd_soc_component *component = rtd->codec_dai->component;
 167        int ret = 0;
 168
 169        ret = snd_soc_card_jack_new(rtd->card, "Headset",
 170                SND_JACK_HEADSET | SND_JACK_BTN_0,
 171                &broxton_headset,
 172                broxton_headset_pins, ARRAY_SIZE(broxton_headset_pins));
 173
 174        if (ret)
 175                return ret;
 176
 177        rt298_mic_detect(component, &broxton_headset);
 178
 179        snd_soc_dapm_ignore_suspend(&rtd->card->dapm, "SoC DMIC");
 180
 181        return 0;
 182}
 183
 184static int broxton_hdmi_init(struct snd_soc_pcm_runtime *rtd)
 185{
 186        struct bxt_rt286_private *ctx = snd_soc_card_get_drvdata(rtd->card);
 187        struct snd_soc_dai *dai = rtd->codec_dai;
 188        struct bxt_hdmi_pcm *pcm;
 189
 190        pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
 191        if (!pcm)
 192                return -ENOMEM;
 193
 194        pcm->device = BXT_DPCM_AUDIO_HDMI1_PB + dai->id;
 195        pcm->codec_dai = dai;
 196
 197        list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);
 198
 199        return 0;
 200}
 201
 202static int broxton_ssp5_fixup(struct snd_soc_pcm_runtime *rtd,
 203                        struct snd_pcm_hw_params *params)
 204{
 205        struct snd_interval *rate = hw_param_interval(params,
 206                                        SNDRV_PCM_HW_PARAM_RATE);
 207        struct snd_interval *channels = hw_param_interval(params,
 208                                        SNDRV_PCM_HW_PARAM_CHANNELS);
 209        struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
 210
 211        /* The ADSP will covert the FE rate to 48k, stereo */
 212        rate->min = rate->max = 48000;
 213        channels->min = channels->max = 2;
 214
 215        /* set SSP5 to 24 bit */
 216        snd_mask_none(fmt);
 217        snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
 218
 219        return 0;
 220}
 221
 222static int broxton_rt298_hw_params(struct snd_pcm_substream *substream,
 223        struct snd_pcm_hw_params *params)
 224{
 225        struct snd_soc_pcm_runtime *rtd = substream->private_data;
 226        struct snd_soc_dai *codec_dai = rtd->codec_dai;
 227        int ret;
 228
 229        ret = snd_soc_dai_set_sysclk(codec_dai, RT298_SCLK_S_PLL,
 230                                        19200000, SND_SOC_CLOCK_IN);
 231        if (ret < 0) {
 232                dev_err(rtd->dev, "can't set codec sysclk configuration\n");
 233                return ret;
 234        }
 235
 236        return ret;
 237}
 238
 239static const struct snd_soc_ops broxton_rt298_ops = {
 240        .hw_params = broxton_rt298_hw_params,
 241};
 242
 243static const unsigned int rates[] = {
 244        48000,
 245};
 246
 247static const struct snd_pcm_hw_constraint_list constraints_rates = {
 248        .count = ARRAY_SIZE(rates),
 249        .list  = rates,
 250        .mask = 0,
 251};
 252
 253static int broxton_dmic_fixup(struct snd_soc_pcm_runtime *rtd,
 254                                struct snd_pcm_hw_params *params)
 255{
 256        struct snd_interval *channels = hw_param_interval(params,
 257                                                SNDRV_PCM_HW_PARAM_CHANNELS);
 258        channels->min = channels->max = 4;
 259
 260        return 0;
 261}
 262
 263static const unsigned int channels_dmic[] = {
 264        1, 2, 3, 4,
 265};
 266
 267static const struct snd_pcm_hw_constraint_list constraints_dmic_channels = {
 268        .count = ARRAY_SIZE(channels_dmic),
 269        .list = channels_dmic,
 270        .mask = 0,
 271};
 272
 273static int broxton_dmic_startup(struct snd_pcm_substream *substream)
 274{
 275        struct snd_pcm_runtime *runtime = substream->runtime;
 276
 277        runtime->hw.channels_max = 4;
 278        snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
 279                                        &constraints_dmic_channels);
 280
 281        return snd_pcm_hw_constraint_list(substream->runtime, 0,
 282                                SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
 283}
 284
 285static const struct snd_soc_ops broxton_dmic_ops = {
 286        .startup = broxton_dmic_startup,
 287};
 288
 289static const unsigned int channels[] = {
 290        2,
 291};
 292
 293static const struct snd_pcm_hw_constraint_list constraints_channels = {
 294        .count = ARRAY_SIZE(channels),
 295        .list = channels,
 296        .mask = 0,
 297};
 298
 299static int bxt_fe_startup(struct snd_pcm_substream *substream)
 300{
 301        struct snd_pcm_runtime *runtime = substream->runtime;
 302
 303        /*
 304         * on this platform for PCM device we support:
 305         *      48Khz
 306         *      stereo
 307         *      16-bit audio
 308         */
 309
 310        runtime->hw.channels_max = 2;
 311        snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
 312                                &constraints_channels);
 313
 314        runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
 315        snd_pcm_hw_constraint_msbits(runtime, 0, 16, 16);
 316        snd_pcm_hw_constraint_list(runtime, 0,
 317                                SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
 318
 319        return 0;
 320}
 321
 322static const struct snd_soc_ops broxton_rt286_fe_ops = {
 323        .startup = bxt_fe_startup,
 324};
 325
 326/* broxton digital audio interface glue - connects codec <--> CPU */
 327static struct snd_soc_dai_link broxton_rt298_dais[] = {
 328        /* Front End DAI links */
 329        [BXT_DPCM_AUDIO_PB] =
 330        {
 331                .name = "Bxt Audio Port",
 332                .stream_name = "Audio",
 333                .cpu_dai_name = "System Pin",
 334                .platform_name = "0000:00:0e.0",
 335                .nonatomic = 1,
 336                .dynamic = 1,
 337                .codec_name = "snd-soc-dummy",
 338                .codec_dai_name = "snd-soc-dummy-dai",
 339                .init = broxton_rt298_fe_init,
 340                .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
 341                .dpcm_playback = 1,
 342                .ops = &broxton_rt286_fe_ops,
 343        },
 344        [BXT_DPCM_AUDIO_CP] =
 345        {
 346                .name = "Bxt Audio Capture Port",
 347                .stream_name = "Audio Record",
 348                .cpu_dai_name = "System Pin",
 349                .platform_name = "0000:00:0e.0",
 350                .nonatomic = 1,
 351                .dynamic = 1,
 352                .codec_name = "snd-soc-dummy",
 353                .codec_dai_name = "snd-soc-dummy-dai",
 354                .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
 355                .dpcm_capture = 1,
 356                .ops = &broxton_rt286_fe_ops,
 357        },
 358        [BXT_DPCM_AUDIO_REF_CP] =
 359        {
 360                .name = "Bxt Audio Reference cap",
 361                .stream_name = "refcap",
 362                .cpu_dai_name = "Reference Pin",
 363                .codec_name = "snd-soc-dummy",
 364                .codec_dai_name = "snd-soc-dummy-dai",
 365                .platform_name = "0000:00:0e.0",
 366                .init = NULL,
 367                .dpcm_capture = 1,
 368                .nonatomic = 1,
 369                .dynamic = 1,
 370        },
 371        [BXT_DPCM_AUDIO_DMIC_CP] =
 372        {
 373                .name = "Bxt Audio DMIC cap",
 374                .stream_name = "dmiccap",
 375                .cpu_dai_name = "DMIC Pin",
 376                .codec_name = "snd-soc-dummy",
 377                .codec_dai_name = "snd-soc-dummy-dai",
 378                .platform_name = "0000:00:0e.0",
 379                .init = NULL,
 380                .dpcm_capture = 1,
 381                .nonatomic = 1,
 382                .dynamic = 1,
 383                .ops = &broxton_dmic_ops,
 384        },
 385        [BXT_DPCM_AUDIO_HDMI1_PB] =
 386        {
 387                .name = "Bxt HDMI Port1",
 388                .stream_name = "Hdmi1",
 389                .cpu_dai_name = "HDMI1 Pin",
 390                .codec_name = "snd-soc-dummy",
 391                .codec_dai_name = "snd-soc-dummy-dai",
 392                .platform_name = "0000:00:0e.0",
 393                .dpcm_playback = 1,
 394                .init = NULL,
 395                .nonatomic = 1,
 396                .dynamic = 1,
 397        },
 398        [BXT_DPCM_AUDIO_HDMI2_PB] =
 399        {
 400                .name = "Bxt HDMI Port2",
 401                .stream_name = "Hdmi2",
 402                .cpu_dai_name = "HDMI2 Pin",
 403                .codec_name = "snd-soc-dummy",
 404                .codec_dai_name = "snd-soc-dummy-dai",
 405                .platform_name = "0000:00:0e.0",
 406                .dpcm_playback = 1,
 407                .init = NULL,
 408                .nonatomic = 1,
 409                .dynamic = 1,
 410        },
 411        [BXT_DPCM_AUDIO_HDMI3_PB] =
 412        {
 413                .name = "Bxt HDMI Port3",
 414                .stream_name = "Hdmi3",
 415                .cpu_dai_name = "HDMI3 Pin",
 416                .codec_name = "snd-soc-dummy",
 417                .codec_dai_name = "snd-soc-dummy-dai",
 418                .platform_name = "0000:00:0e.0",
 419                .dpcm_playback = 1,
 420                .init = NULL,
 421                .nonatomic = 1,
 422                .dynamic = 1,
 423        },
 424        /* Back End DAI links */
 425        {
 426                /* SSP5 - Codec */
 427                .name = "SSP5-Codec",
 428                .id = 0,
 429                .cpu_dai_name = "SSP5 Pin",
 430                .platform_name = "0000:00:0e.0",
 431                .no_pcm = 1,
 432                .codec_name = "i2c-INT343A:00",
 433                .codec_dai_name = "rt298-aif1",
 434                .init = broxton_rt298_codec_init,
 435                .dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF |
 436                                                SND_SOC_DAIFMT_CBS_CFS,
 437                .ignore_pmdown_time = 1,
 438                .be_hw_params_fixup = broxton_ssp5_fixup,
 439                .ops = &broxton_rt298_ops,
 440                .dpcm_playback = 1,
 441                .dpcm_capture = 1,
 442        },
 443        {
 444                .name = "dmic01",
 445                .id = 1,
 446                .cpu_dai_name = "DMIC01 Pin",
 447                .codec_name = "dmic-codec",
 448                .codec_dai_name = "dmic-hifi",
 449                .platform_name = "0000:00:0e.0",
 450                .be_hw_params_fixup = broxton_dmic_fixup,
 451                .ignore_suspend = 1,
 452                .dpcm_capture = 1,
 453                .no_pcm = 1,
 454        },
 455        {
 456                .name = "dmic16k",
 457                .id = 2,
 458                .cpu_dai_name = "DMIC16k Pin",
 459                .codec_name = "dmic-codec",
 460                .codec_dai_name = "dmic-hifi",
 461                .platform_name = "0000:00:0e.0",
 462                .be_hw_params_fixup = broxton_dmic_fixup,
 463                .ignore_suspend = 1,
 464                .dpcm_capture = 1,
 465                .no_pcm = 1,
 466        },
 467        {
 468                .name = "iDisp1",
 469                .id = 3,
 470                .cpu_dai_name = "iDisp1 Pin",
 471                .codec_name = "ehdaudio0D2",
 472                .codec_dai_name = "intel-hdmi-hifi1",
 473                .platform_name = "0000:00:0e.0",
 474                .init = broxton_hdmi_init,
 475                .dpcm_playback = 1,
 476                .no_pcm = 1,
 477        },
 478        {
 479                .name = "iDisp2",
 480                .id = 4,
 481                .cpu_dai_name = "iDisp2 Pin",
 482                .codec_name = "ehdaudio0D2",
 483                .codec_dai_name = "intel-hdmi-hifi2",
 484                .platform_name = "0000:00:0e.0",
 485                .init = broxton_hdmi_init,
 486                .dpcm_playback = 1,
 487                .no_pcm = 1,
 488        },
 489        {
 490                .name = "iDisp3",
 491                .id = 5,
 492                .cpu_dai_name = "iDisp3 Pin",
 493                .codec_name = "ehdaudio0D2",
 494                .codec_dai_name = "intel-hdmi-hifi3",
 495                .platform_name = "0000:00:0e.0",
 496                .init = broxton_hdmi_init,
 497                .dpcm_playback = 1,
 498                .no_pcm = 1,
 499        },
 500};
 501
 502#define NAME_SIZE       32
 503static int bxt_card_late_probe(struct snd_soc_card *card)
 504{
 505        struct bxt_rt286_private *ctx = snd_soc_card_get_drvdata(card);
 506        struct bxt_hdmi_pcm *pcm;
 507        struct snd_soc_component *component = NULL;
 508        int err, i = 0;
 509        char jack_name[NAME_SIZE];
 510
 511        list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) {
 512                component = pcm->codec_dai->component;
 513                snprintf(jack_name, sizeof(jack_name),
 514                        "HDMI/DP, pcm=%d Jack", pcm->device);
 515                err = snd_soc_card_jack_new(card, jack_name,
 516                                        SND_JACK_AVOUT, &broxton_hdmi[i],
 517                                        NULL, 0);
 518
 519                if (err)
 520                        return err;
 521
 522                err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device,
 523                                                &broxton_hdmi[i]);
 524                if (err < 0)
 525                        return err;
 526
 527                i++;
 528        }
 529
 530        if (!component)
 531                return -EINVAL;
 532
 533        return hdac_hdmi_jack_port_init(component, &card->dapm);
 534}
 535
 536
 537/* broxton audio machine driver for SPT + RT298S */
 538static struct snd_soc_card broxton_rt298 = {
 539        .name = "broxton-rt298",
 540        .dai_link = broxton_rt298_dais,
 541        .num_links = ARRAY_SIZE(broxton_rt298_dais),
 542        .controls = broxton_controls,
 543        .num_controls = ARRAY_SIZE(broxton_controls),
 544        .dapm_widgets = broxton_widgets,
 545        .num_dapm_widgets = ARRAY_SIZE(broxton_widgets),
 546        .dapm_routes = broxton_rt298_map,
 547        .num_dapm_routes = ARRAY_SIZE(broxton_rt298_map),
 548        .fully_routed = true,
 549        .late_probe = bxt_card_late_probe,
 550
 551};
 552
 553static struct snd_soc_card geminilake_rt298 = {
 554        .name = "geminilake-rt298",
 555        .dai_link = broxton_rt298_dais,
 556        .num_links = ARRAY_SIZE(broxton_rt298_dais),
 557        .controls = broxton_controls,
 558        .num_controls = ARRAY_SIZE(broxton_controls),
 559        .dapm_widgets = broxton_widgets,
 560        .num_dapm_widgets = ARRAY_SIZE(broxton_widgets),
 561        .dapm_routes = geminilake_rt298_map,
 562        .num_dapm_routes = ARRAY_SIZE(geminilake_rt298_map),
 563        .fully_routed = true,
 564        .late_probe = bxt_card_late_probe,
 565};
 566
 567static int broxton_audio_probe(struct platform_device *pdev)
 568{
 569        struct bxt_rt286_private *ctx;
 570        struct snd_soc_card *card =
 571                        (struct snd_soc_card *)pdev->id_entry->driver_data;
 572        struct snd_soc_acpi_mach *mach;
 573        const char *platform_name;
 574        int ret;
 575        int i;
 576
 577        for (i = 0; i < ARRAY_SIZE(broxton_rt298_dais); i++) {
 578                if (!strncmp(card->dai_link[i].codec_name, "i2c-INT343A:00",
 579                                                I2C_NAME_SIZE)) {
 580                        if (!strncmp(card->name, "broxton-rt298",
 581                                                PLATFORM_NAME_SIZE)) {
 582                                card->dai_link[i].name = "SSP5-Codec";
 583                                card->dai_link[i].cpu_dai_name = "SSP5 Pin";
 584                        } else if (!strncmp(card->name, "geminilake-rt298",
 585                                                PLATFORM_NAME_SIZE)) {
 586                                card->dai_link[i].name = "SSP2-Codec";
 587                                card->dai_link[i].cpu_dai_name = "SSP2 Pin";
 588                        }
 589                }
 590        }
 591
 592        ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
 593        if (!ctx)
 594                return -ENOMEM;
 595
 596        INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
 597
 598        card->dev = &pdev->dev;
 599        snd_soc_card_set_drvdata(card, ctx);
 600
 601        /* override plaform name, if required */
 602        mach = (&pdev->dev)->platform_data;
 603        platform_name = mach->mach_params.platform;
 604
 605        ret = snd_soc_fixup_dai_links_platform_name(card,
 606                                                    platform_name);
 607        if (ret)
 608                return ret;
 609
 610        return devm_snd_soc_register_card(&pdev->dev, card);
 611}
 612
 613static const struct platform_device_id bxt_board_ids[] = {
 614        { .name = "bxt_alc298s_i2s", .driver_data =
 615                                (unsigned long)&broxton_rt298 },
 616        { .name = "glk_alc298s_i2s", .driver_data =
 617                                (unsigned long)&geminilake_rt298 },
 618        {}
 619};
 620
 621static struct platform_driver broxton_audio = {
 622        .probe = broxton_audio_probe,
 623        .driver = {
 624                .name = "bxt_alc298s_i2s",
 625                .pm = &snd_soc_pm_ops,
 626        },
 627        .id_table = bxt_board_ids,
 628};
 629module_platform_driver(broxton_audio)
 630
 631/* Module information */
 632MODULE_AUTHOR("Ramesh Babu <Ramesh.Babu@intel.com>");
 633MODULE_AUTHOR("Senthilnathan Veppur <senthilnathanx.veppur@intel.com>");
 634MODULE_DESCRIPTION("Intel SST Audio for Broxton");
 635MODULE_LICENSE("GPL v2");
 636MODULE_ALIAS("platform:bxt_alc298s_i2s");
 637MODULE_ALIAS("platform:glk_alc298s_i2s");
 638