Merge remote-tracking branches 'asoc/topic/jack', 'asoc/topic/max98357a', 'asoc/topic...
authorMark Brown <broonie@kernel.org>
Thu, 5 Mar 2015 01:07:23 +0000 (01:07 +0000)
committerMark Brown <broonie@kernel.org>
Thu, 5 Mar 2015 01:07:23 +0000 (01:07 +0000)
1  2  3  4  5 
include/sound/soc.h
sound/soc/generic/simple-card.c
sound/soc/intel/broadwell.c
sound/soc/intel/cht_bsw_rt5645.c
sound/soc/omap/omap-pcm.c

diff --combined include/sound/soc.h
index a8ccc1de9dfc3c9d869210415df3326f7142fbe3,40b3ee96f3177a2299faf760fae9e65e5f74c93e,0d1ade19562857c7b65157636ac37b2f0222e202,b4fca9aed2a2b00296ce040428b830b93095d562,0d1ade19562857c7b65157636ac37b2f0222e202..bc6cfabc0e357cc129b20007364dc30a174bfbc3
@@@@@@ -429,9 -429,9 -429,9 -429,6 -429,9 +429,9 @@@@@@ bool snd_soc_runtime_ignore_pmdown_time
     void snd_soc_runtime_activate(struct snd_soc_pcm_runtime *rtd, int stream);
     void snd_soc_runtime_deactivate(struct snd_soc_pcm_runtime *rtd, int stream);
     
   + int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd,
   +    unsigned int dai_fmt);
   + 
     /* Utility functions to get clock rates from various things */
     int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots);
     int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params);
@@@@@@ -450,8 -450,10 -450,8 -447,8 -450,8 +450,10 @@@@@@ int soc_dai_hw_params(struct snd_pcm_su
                      struct snd_soc_dai *dai);
     
     /* Jack reporting */
- ---int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type,
- ---                struct snd_soc_jack *jack);
+ +++int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type,
+ +++   struct snd_soc_jack *jack, struct snd_soc_jack_pin *pins,
+ +++   unsigned int num_pins);
+ +++
     void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask);
     int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
                          struct snd_soc_jack_pin *pins);
@@@@@@ -501,7 -503,7 -501,7 -498,6 -501,7 +503,7 @@@@@@ int snd_soc_test_bits(struct snd_soc_co
                                unsigned int mask, unsigned int value);
     
     #ifdef CONFIG_SND_SOC_AC97_BUS
   + struct snd_ac97 *snd_soc_alloc_ac97_codec(struct snd_soc_codec *codec);
     struct snd_ac97 *snd_soc_new_ac97_codec(struct snd_soc_codec *codec);
     void snd_soc_free_ac97_codec(struct snd_ac97 *ac97);
     
@@@@@@ -659,7 -661,7 -659,7 -655,7 -659,7 +661,7 @@@@@@ struct snd_soc_jack_gpio 
     struct snd_soc_jack {
        struct mutex mutex;
        struct snd_jack *jack;
- ---   struct snd_soc_codec *codec;
+ +++   struct snd_soc_card *card;
        struct list_head pins;
        int status;
        struct blocking_notifier_head notifier;
@@@@@@ -954,9 -956,6 -954,6 -950,6 -954,6 +956,9 @@@@@@ struct snd_soc_dai_link 
        unsigned int symmetric_channels:1;
        unsigned int symmetric_samplebits:1;
     
 ++++   /* Mark this pcm with non atomic ops */
 ++++   bool nonatomic;
 ++++
        /* Do not create a PCM for this DAI link (Backend link) */
        unsigned int no_pcm:1;
     
@@@@@@ -1074,16 -1073,11 -1071,11 -1067,11 -1071,11 +1076,16 @@@@@@ struct snd_soc_card 
     
        /*
         * Card-specific routes and widgets.
 ++++    * Note: of_dapm_xxx for Device Tree; Otherwise for driver build-in.
         */
        const struct snd_soc_dapm_widget *dapm_widgets;
        int num_dapm_widgets;
        const struct snd_soc_dapm_route *dapm_routes;
        int num_dapm_routes;
 ++++   const struct snd_soc_dapm_widget *of_dapm_widgets;
 ++++   int num_of_dapm_widgets;
 ++++   const struct snd_soc_dapm_route *of_dapm_routes;
 ++++   int num_of_dapm_routes;
        bool fully_routed;
     
        struct work_struct deferred_resume_work;
index fb550b5869d21f73307d36d2edc88ebcffa61f0c,b8ee47b7ba9c0b15330f87098b2b8a74096181da,f7c6734bd5daee1dafd76ba8b6feafa05b2a6c52,fb9240fdc9b70095d364e3e90e14c16653ca4aff,f7c6734bd5daee1dafd76ba8b6feafa05b2a6c52..c49a408fc7a6a267e4a9d106d1019547b558c3ed
@@@@@@ -39,37 -39,37 -39,37 -39,6 -39,37 +39,37 @@@@@@ struct simple_card_data 
     #define simple_priv_to_link(priv, i) ((priv)->snd_card.dai_link + i)
     #define simple_priv_to_props(priv, i) ((priv)->dai_props + i)
     
   + static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
   + {
   +    struct snd_soc_pcm_runtime *rtd = substream->private_data;
   +    struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
   +    struct simple_dai_props *dai_props =
   +            &priv->dai_props[rtd - rtd->card->rtd];
   +    int ret;
   + 
   +    ret = clk_prepare_enable(dai_props->cpu_dai.clk);
   +    if (ret)
   +            return ret;
   +    
   +    ret = clk_prepare_enable(dai_props->codec_dai.clk);
   +    if (ret)
   +            clk_disable_unprepare(dai_props->cpu_dai.clk);
   + 
   +    return ret;
   + }
   + 
   + static void asoc_simple_card_shutdown(struct snd_pcm_substream *substream)
   + {
   +    struct snd_soc_pcm_runtime *rtd = substream->private_data;
   +    struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
   +    struct simple_dai_props *dai_props =
   +            &priv->dai_props[rtd - rtd->card->rtd];
   + 
   +    clk_disable_unprepare(dai_props->cpu_dai.clk);
   + 
   +    clk_disable_unprepare(dai_props->codec_dai.clk);
   + }
   + 
     static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream,
                                      struct snd_pcm_hw_params *params)
     {
     }
     
     static struct snd_soc_ops asoc_simple_card_ops = {
   +    .startup = asoc_simple_card_startup,
   +    .shutdown = asoc_simple_card_shutdown,
        .hw_params = asoc_simple_card_hw_params,
     };
     
@@@@@@ -176,11 -176,11 -176,11 -143,11 -176,11 +176,11 @@@@@@ static int asoc_simple_card_dai_init(st
                return ret;
     
        if (gpio_is_valid(priv->gpio_hp_det)) {
- ---           snd_soc_jack_new(codec->codec, "Headphones", SND_JACK_HEADPHONE,
- ---                            &simple_card_hp_jack);
- ---           snd_soc_jack_add_pins(&simple_card_hp_jack,
- ---                                 ARRAY_SIZE(simple_card_hp_jack_pins),
- ---                                 simple_card_hp_jack_pins);
+ +++           snd_soc_card_jack_new(rtd->card, "Headphones",
+ +++                                 SND_JACK_HEADPHONE,
+ +++                                 &simple_card_hp_jack,
+ +++                                 simple_card_hp_jack_pins,
+ +++                                 ARRAY_SIZE(simple_card_hp_jack_pins));
     
                simple_card_hp_jack_gpio.gpio = priv->gpio_hp_det;
                simple_card_hp_jack_gpio.invert = priv->gpio_hp_det_invert;
        }
     
        if (gpio_is_valid(priv->gpio_mic_det)) {
- ---           snd_soc_jack_new(codec->codec, "Mic Jack", SND_JACK_MICROPHONE,
- ---                            &simple_card_mic_jack);
- ---           snd_soc_jack_add_pins(&simple_card_mic_jack,
- ---                                 ARRAY_SIZE(simple_card_mic_jack_pins),
- ---                                 simple_card_mic_jack_pins);
+ +++           snd_soc_card_jack_new(rtd->card, "Mic Jack",
+ +++                                 SND_JACK_MICROPHONE,
+ +++                                 &simple_card_mic_jack,
+ +++                                 simple_card_mic_jack_pins,
+ +++                                 ARRAY_SIZE(simple_card_mic_jack_pins));
                simple_card_mic_jack_gpio.gpio = priv->gpio_mic_det;
                simple_card_mic_jack_gpio.invert = priv->gpio_mic_det_invert;
                snd_soc_jack_add_gpios(&simple_card_mic_jack, 1,
@@@@@@ -252,7 -252,7 -252,7 -219,6 -252,7 +252,7 @@@@@@ asoc_simple_card_sub_parse_of(struct de
                }
     
                dai->sysclk = clk_get_rate(clk);
   +            dai->clk = clk;
        } else if (!of_property_read_u32(np, "system-clock-frequency", &val)) {
                dai->sysclk = val;
        } else {
@@@@@@ -372,11 -372,6 -372,6 -338,6 -372,6 +372,11 @@@@@@ static int asoc_simple_card_dai_link_of
                            strlen(dai_link->cpu_dai_name)   +
                            strlen(dai_link->codec_dai_name) + 2,
                            GFP_KERNEL);
 ++++   if (!name) {
 ++++           ret = -ENOMEM;
 ++++           goto dai_link_of_err;
 ++++   }
 ++++
        sprintf(name, "%s-%s", dai_link->cpu_dai_name,
                                dai_link->codec_dai_name);
        dai_link->name = dai_link->stream_name = name;
@@@@@@ -491,8 -486,8 -486,8 -452,9 -486,8 +491,8 @@@@@@ static int asoc_simple_card_parse_of(st
     }
     
     /* Decrease the reference count of the device nodes */
   - static int asoc_simple_card_unref(struct platform_device *pdev)
   + static int asoc_simple_card_unref(struct snd_soc_card *card)
     {
   -    struct snd_soc_card *card = platform_get_drvdata(pdev);
        struct snd_soc_dai_link *dai_link;
        int num_links;
     
@@@@@@ -594,7 -589,7 -589,7 -556,7 -589,7 +594,7 @@@@@@ static int asoc_simple_card_probe(struc
                return ret;
     
     err:
   -    asoc_simple_card_unref(pdev);
   +    asoc_simple_card_unref(&priv->snd_card);
        return ret;
     }
     
@@@@@@ -610,7 -605,7 -605,7 -572,7 -605,7 +610,7 @@@@@@ static int asoc_simple_card_remove(stru
                snd_soc_jack_free_gpios(&simple_card_mic_jack, 1,
                                        &simple_card_mic_jack_gpio);
     
   -    return asoc_simple_card_unref(pdev);
   +    return asoc_simple_card_unref(card);
     }
     
     static const struct of_device_id asoc_simple_of_match[] = {
index fba2ef5dac4280d9e4c200352743999bc64eb562,9effa3da982f46621e94dd8623186038a3ac8933,9cf7d01479adcbd82661c70344b5f5d4ad0969fe,7cf95d5d5d808f77d0558ecb8a521bdd1e26f541,9cf7d01479adcbd82661c70344b5f5d4ad0969fe..fc5542034b9bf5a38afbbc1383e56c104a074781
@@@@@@ -80,15 -80,9 -80,15 -80,15 -80,15 +80,9 @@@@@@ static int broadwell_rt286_codec_init(s
     {
        struct snd_soc_codec *codec = rtd->codec;
        int ret = 0;
- ---   ret = snd_soc_jack_new(codec, "Headset",
- ---           SND_JACK_HEADSET | SND_JACK_BTN_0, &broadwell_headset);
- ---
- ---   if (ret)
- ---           return ret;
- ---
- ---   ret = snd_soc_jack_add_pins(&broadwell_headset,
- ---           ARRAY_SIZE(broadwell_headset_pins),
- ---           broadwell_headset_pins);
+ +++   ret = snd_soc_card_jack_new(rtd->card, "Headset",
+ +++           SND_JACK_HEADSET | SND_JACK_BTN_0, &broadwell_headset,
+ +++           broadwell_headset_pins, ARRAY_SIZE(broadwell_headset_pins));
        if (ret)
                return ret;
     
@@@@@@ -110,7 -104,9 -110,9 -110,9 -110,9 +104,7 @@@@@@ static int broadwell_ssp0_fixup(struct 
        channels->min = channels->max = 2;
     
        /* set SSP0 to 16 bit */
 ----   snd_mask_set(&params->masks[SNDRV_PCM_HW_PARAM_FORMAT -
 ----                               SNDRV_PCM_HW_PARAM_FIRST_MASK],
 ----                               SNDRV_PCM_FORMAT_S16_LE);
 ++++   params_set_format(params, SNDRV_PCM_FORMAT_S16_LE);
        return 0;
     }
     
@@@@@@ -138,6 -134,6 -140,6 -140,8 -140,6 +132,6 @@@@@@ static struct snd_soc_ops broadwell_rt2
     
     static int broadwell_rtd_init(struct snd_soc_pcm_runtime *rtd)
     {
   -    struct snd_soc_codec *codec = rtd->codec;
   -    struct snd_soc_dapm_context *dapm = &codec->dapm;
        struct sst_pdata *pdata = dev_get_platdata(rtd->platform->dev);
        struct sst_hsw *broadwell = pdata->dsp;
        int ret;
                return ret;
        }
     
   -    /* always connected - check HP for jack detect */
   -    snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
   -    snd_soc_dapm_enable_pin(dapm, "Speaker");
   -    snd_soc_dapm_enable_pin(dapm, "Mic Jack");
   -    snd_soc_dapm_enable_pin(dapm, "Line Jack");
   -    snd_soc_dapm_enable_pin(dapm, "DMIC1");
   -    snd_soc_dapm_enable_pin(dapm, "DMIC2");
   - 
        return 0;
     }
     
index dd935255a0206f8e123e881c34eb94a8ac5be561,0bfca2192ca095cd82404e156b22e9fe8250fbac,bd29617a9ab9d2a2c396b05e25a858855529bb45,0000000000000000000000000000000000000000,bd29617a9ab9d2a2c396b05e25a858855529bb45..012227997ed9ca07a64311597fb07aeeeaa4199a
mode 100644,100644,100644,000000,100644..100644
--- /dev/null
@@@@@@ -1,324 -1,326 -1,326 -1,0 -1,326 +1,324 @@@@@@
- - -   ret = snd_soc_jack_new(codec, "Headphone Jack",
- - -                           SND_JACK_HEADPHONE,
- - -                           &ctx->hp_jack);
   + /*
   +  *  cht-bsw-rt5645.c - ASoc Machine driver for Intel Cherryview-based platforms
   +  *                     Cherrytrail and Braswell, with RT5645 codec.
   +  *
   +  *  Copyright (C) 2015 Intel Corp
   +  *  Author: Fang, Yang A <yang.a.fang@intel.com>
   +  *         N,Harshapriya <harshapriya.n@intel.com>
   +  *  This file is modified from cht_bsw_rt5672.c
   +  *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   +  *
   +  *  This program is free software; you can redistribute it and/or modify
   +  *  it under the terms of the GNU General Public License as published by
   +  *  the Free Software Foundation; version 2 of the License.
   +  *
   +  *  This program is distributed in the hope that it will be useful, but
   +  *  WITHOUT ANY WARRANTY; without even the implied warranty of
   +  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   +  *  General Public License for more details.
   +  *
   +  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   +  */
   + 
   + #include <linux/module.h>
   + #include <linux/platform_device.h>
   + #include <linux/slab.h>
   + #include <sound/pcm.h>
   + #include <sound/pcm_params.h>
   + #include <sound/soc.h>
   + #include <sound/jack.h>
   + #include "../codecs/rt5645.h"
   + #include "sst-atom-controls.h"
   + 
   + #define CHT_PLAT_CLK_3_HZ  19200000
   + #define CHT_CODEC_DAI      "rt5645-aif1"
   + 
   + struct cht_mc_private {
   +    struct snd_soc_jack hp_jack;
   +    struct snd_soc_jack mic_jack;
   + };
   + 
   + static inline struct snd_soc_dai *cht_get_codec_dai(struct snd_soc_card *card)
   + {
   +    int i;
   + 
   +    for (i = 0; i < card->num_rtd; i++) {
   +            struct snd_soc_pcm_runtime *rtd;
   + 
   +            rtd = card->rtd + i;
   +            if (!strncmp(rtd->codec_dai->name, CHT_CODEC_DAI,
   +                         strlen(CHT_CODEC_DAI)))
   +                    return rtd->codec_dai;
   +    }
   +    return NULL;
   + }
   + 
   + static int platform_clock_control(struct snd_soc_dapm_widget *w,
   +            struct snd_kcontrol *k, int  event)
   + {
   +    struct snd_soc_dapm_context *dapm = w->dapm;
   +    struct snd_soc_card *card = dapm->card;
   +    struct snd_soc_dai *codec_dai;
   +    int ret;
   + 
   +    codec_dai = cht_get_codec_dai(card);
   +    if (!codec_dai) {
   +            dev_err(card->dev, "Codec dai not found; Unable to set platform clock\n");
   +            return -EIO;
   +    }
   + 
   +    if (!SND_SOC_DAPM_EVENT_OFF(event))
   +            return 0;
   + 
   +    /* Set codec sysclk source to its internal clock because codec PLL will
   +     * be off when idle and MCLK will also be off by ACPI when codec is
   +     * runtime suspended. Codec needs clock for jack detection and button
   +     * press.
   +     */
   +    ret = snd_soc_dai_set_sysclk(codec_dai, RT5645_SCLK_S_RCCLK,
   +                    0, SND_SOC_CLOCK_IN);
   +    if (ret < 0) {
   +            dev_err(card->dev, "can't set codec sysclk: %d\n", ret);
   +            return ret;
   +    }
   + 
   +    return 0;
   + }
   + 
   + static const struct snd_soc_dapm_widget cht_dapm_widgets[] = {
   +    SND_SOC_DAPM_HP("Headphone", NULL),
   +    SND_SOC_DAPM_MIC("Headset Mic", NULL),
   +    SND_SOC_DAPM_MIC("Int Mic", NULL),
   +    SND_SOC_DAPM_SPK("Ext Spk", NULL),
   +    SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0,
   +                    platform_clock_control, SND_SOC_DAPM_POST_PMD),
   + };
   + 
   + static const struct snd_soc_dapm_route cht_audio_map[] = {
   +    {"IN1P", NULL, "Headset Mic"},
   +    {"IN1N", NULL, "Headset Mic"},
   +    {"DMIC L1", NULL, "Int Mic"},
   +    {"DMIC R1", NULL, "Int Mic"},
   +    {"Headphone", NULL, "HPOL"},
   +    {"Headphone", NULL, "HPOR"},
   +    {"Ext Spk", NULL, "SPOL"},
   +    {"Ext Spk", NULL, "SPOR"},
   +    {"AIF1 Playback", NULL, "ssp2 Tx"},
   +    {"ssp2 Tx", NULL, "codec_out0"},
   +    {"ssp2 Tx", NULL, "codec_out1"},
   +    {"codec_in0", NULL, "ssp2 Rx" },
   +    {"codec_in1", NULL, "ssp2 Rx" },
   +    {"ssp2 Rx", NULL, "AIF1 Capture"},
   +    {"Headphone", NULL, "Platform Clock"},
   +    {"Headset Mic", NULL, "Platform Clock"},
   +    {"Int Mic", NULL, "Platform Clock"},
   +    {"Ext Spk", NULL, "Platform Clock"},
   + };
   + 
   + static const struct snd_kcontrol_new cht_mc_controls[] = {
   +    SOC_DAPM_PIN_SWITCH("Headphone"),
   +    SOC_DAPM_PIN_SWITCH("Headset Mic"),
   +    SOC_DAPM_PIN_SWITCH("Int Mic"),
   +    SOC_DAPM_PIN_SWITCH("Ext Spk"),
   + };
   + 
   + static int cht_aif1_hw_params(struct snd_pcm_substream *substream,
   +                         struct snd_pcm_hw_params *params)
   + {
   +    struct snd_soc_pcm_runtime *rtd = substream->private_data;
   +    struct snd_soc_dai *codec_dai = rtd->codec_dai;
   +    int ret;
   + 
   +    /* set codec PLL source to the 19.2MHz platform clock (MCLK) */
   +    ret = snd_soc_dai_set_pll(codec_dai, 0, RT5645_PLL1_S_MCLK,
   +                              CHT_PLAT_CLK_3_HZ, params_rate(params) * 512);
   +    if (ret < 0) {
   +            dev_err(rtd->dev, "can't set codec pll: %d\n", ret);
   +            return ret;
   +    }
   + 
   +    ret = snd_soc_dai_set_sysclk(codec_dai, RT5645_SCLK_S_PLL1,
   +                            params_rate(params) * 512, SND_SOC_CLOCK_IN);
   +    if (ret < 0) {
   +            dev_err(rtd->dev, "can't set codec sysclk: %d\n", ret);
   +            return ret;
   +    }
   + 
   +    return 0;
   + }
   + 
   + static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
   + {
   +    int ret;
   +    struct snd_soc_codec *codec = runtime->codec;
   +    struct snd_soc_dai *codec_dai = runtime->codec_dai;
   +    struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card);
   + 
   +    /* Select clk_i2s1_asrc as ASRC clock source */
   +    rt5645_sel_asrc_clk_src(codec,
   +                            RT5645_DA_STEREO_FILTER |
   +                            RT5645_DA_MONO_L_FILTER |
   +                            RT5645_DA_MONO_R_FILTER |
   +                            RT5645_AD_STEREO_FILTER,
   +                            RT5645_CLK_SEL_I2S1_ASRC);
   + 
   +    /* TDM 4 slots 24 bit, set Rx & Tx bitmask to 4 active slots */
   +    ret = snd_soc_dai_set_tdm_slot(codec_dai, 0xF, 0xF, 4, 24);
   +    if (ret < 0) {
   +            dev_err(runtime->dev, "can't set codec TDM slot %d\n", ret);
   +            return ret;
   +    }
   + 
- - -   ret = snd_soc_jack_new(codec, "Mic Jack",
- - -                           SND_JACK_MICROPHONE,
- - -                           &ctx->mic_jack);
+ +++   ret = snd_soc_card_jack_new(runtime->card, "Headphone Jack",
+ +++                               SND_JACK_HEADPHONE, &ctx->hp_jack,
+ +++                               NULL, 0);
   +    if (ret) {
   +            dev_err(runtime->dev, "HP jack creation failed %d\n", ret);
   +            return ret;
   +    }
   + 
 -- -   snd_mask_set(&params->masks[SNDRV_PCM_HW_PARAM_FORMAT -
 -- -                               SNDRV_PCM_HW_PARAM_FIRST_MASK],
 -- -                               SNDRV_PCM_FORMAT_S24_LE);
+ +++   ret = snd_soc_card_jack_new(runtime->card, "Mic Jack",
+ +++                               SND_JACK_MICROPHONE, &ctx->mic_jack,
+ +++                               NULL, 0);
   +    if (ret) {
   +            dev_err(runtime->dev, "Mic jack creation failed %d\n", ret);
   +            return ret;
   +    }
   + 
   +    rt5645_set_jack_detect(codec, &ctx->hp_jack, &ctx->mic_jack);
   + 
   +    return ret;
   + }
   + 
   + static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
   +                        struct snd_pcm_hw_params *params)
   + {
   +    struct snd_interval *rate = hw_param_interval(params,
   +                    SNDRV_PCM_HW_PARAM_RATE);
   +    struct snd_interval *channels = hw_param_interval(params,
   +                                            SNDRV_PCM_HW_PARAM_CHANNELS);
   + 
   +    /* The DSP will covert the FE rate to 48k, stereo, 24bits */
   +    rate->min = rate->max = 48000;
   +    channels->min = channels->max = 2;
   + 
   +    /* set SSP2 to 24-bit */
 ++++   params_set_format(params, SNDRV_PCM_FORMAT_S24_LE);
   +    return 0;
   + }
   + 
   + static unsigned int rates_48000[] = {
   +    48000,
   + };
   + 
   + static struct snd_pcm_hw_constraint_list constraints_48000 = {
   +    .count = ARRAY_SIZE(rates_48000),
   +    .list  = rates_48000,
   + };
   + 
   + static int cht_aif1_startup(struct snd_pcm_substream *substream)
   + {
   +    return snd_pcm_hw_constraint_list(substream->runtime, 0,
   +                    SNDRV_PCM_HW_PARAM_RATE,
   +                    &constraints_48000);
   + }
   + 
   + static struct snd_soc_ops cht_aif1_ops = {
   +    .startup = cht_aif1_startup,
   + };
   + 
   + static struct snd_soc_ops cht_be_ssp2_ops = {
   +    .hw_params = cht_aif1_hw_params,
   + };
   + 
   + static struct snd_soc_dai_link cht_dailink[] = {
   +    [MERR_DPCM_AUDIO] = {
   +            .name = "Audio Port",
   +            .stream_name = "Audio",
   +            .cpu_dai_name = "media-cpu-dai",
   +            .codec_dai_name = "snd-soc-dummy-dai",
   +            .codec_name = "snd-soc-dummy",
   +            .platform_name = "sst-mfld-platform",
   +            .ignore_suspend = 1,
   +            .dynamic = 1,
   +            .dpcm_playback = 1,
   +            .dpcm_capture = 1,
   +            .ops = &cht_aif1_ops,
   +    },
   +    [MERR_DPCM_COMPR] = {
   +            .name = "Compressed Port",
   +            .stream_name = "Compress",
   +            .cpu_dai_name = "compress-cpu-dai",
   +            .codec_dai_name = "snd-soc-dummy-dai",
   +            .codec_name = "snd-soc-dummy",
   +            .platform_name = "sst-mfld-platform",
   +    },
   +    /* CODEC<->CODEC link */
   +    /* back ends */
   +    {
   +            .name = "SSP2-Codec",
   +            .be_id = 1,
   +            .cpu_dai_name = "ssp2-port",
   +            .platform_name = "sst-mfld-platform",
   +            .no_pcm = 1,
   +            .codec_dai_name = "rt5645-aif1",
   +            .codec_name = "i2c-10EC5645:00",
   +            .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_IB_NF
   +                                    | SND_SOC_DAIFMT_CBS_CFS,
   +            .init = cht_codec_init,
   +            .be_hw_params_fixup = cht_codec_fixup,
   +            .ignore_suspend = 1,
   +            .dpcm_playback = 1,
   +            .dpcm_capture = 1,
   +            .ops = &cht_be_ssp2_ops,
   +    },
   + };
   + 
   + /* SoC card */
   + static struct snd_soc_card snd_soc_card_cht = {
   +    .name = "chtrt5645",
   +    .dai_link = cht_dailink,
   +    .num_links = ARRAY_SIZE(cht_dailink),
   +    .dapm_widgets = cht_dapm_widgets,
   +    .num_dapm_widgets = ARRAY_SIZE(cht_dapm_widgets),
   +    .dapm_routes = cht_audio_map,
   +    .num_dapm_routes = ARRAY_SIZE(cht_audio_map),
   +    .controls = cht_mc_controls,
   +    .num_controls = ARRAY_SIZE(cht_mc_controls),
   + };
   + 
   + static int snd_cht_mc_probe(struct platform_device *pdev)
   + {
   +    int ret_val = 0;
   +    struct cht_mc_private *drv;
   + 
   +    drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_ATOMIC);
   +    if (!drv)
   +            return -ENOMEM;
   + 
   +    snd_soc_card_cht.dev = &pdev->dev;
   +    snd_soc_card_set_drvdata(&snd_soc_card_cht, drv);
   +    ret_val = devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_cht);
   +    if (ret_val) {
   +            dev_err(&pdev->dev,
   +                    "snd_soc_register_card failed %d\n", ret_val);
   +            return ret_val;
   +    }
   +    platform_set_drvdata(pdev, &snd_soc_card_cht);
   +    return ret_val;
   + }
   + 
   + static struct platform_driver snd_cht_mc_driver = {
   +    .driver = {
   +            .name = "cht-bsw-rt5645",
   +            .pm = &snd_soc_pm_ops,
   +    },
   +    .probe = snd_cht_mc_probe,
   + };
   + 
   + module_platform_driver(snd_cht_mc_driver)
   + 
   + MODULE_DESCRIPTION("ASoC Intel(R) Braswell Machine driver");
   + MODULE_AUTHOR("Fang, Yang A,N,Harshapriya");
   + MODULE_LICENSE("GPL v2");
   + MODULE_ALIAS("platform:cht-bsw-rt5645");
index 1343ecbf0bd5ee307d78d05f8a2e44abadc6c877,f4b05bc23e4bfb4d27adf8dea4702539c2696609,f4b05bc23e4bfb4d27adf8dea4702539c2696609,e49ee2383a884145fb60881c019efa8840a3cfae,f4b05bc23e4bfb4d27adf8dea4702539c2696609..6bb623a2a4dfcfa3cda744ca8bef18575baec2d9
     #define pcm_omap1510()     0
     #endif
     
--- -static const struct snd_pcm_hardware omap_pcm_hardware = {
+++ +static struct snd_pcm_hardware omap_pcm_hardware = {
        .info                   = SNDRV_PCM_INFO_MMAP |
                                  SNDRV_PCM_INFO_MMAP_VALID |
                                  SNDRV_PCM_INFO_INTERLEAVED |
        .buffer_bytes_max       = 128 * 1024,
     };
     
+++ +/* sDMA supports only 1, 2, and 4 byte transfer elements. */
+++ +static void omap_pcm_limit_supported_formats(void)
+++ +{
+++ +   int i;
+++ +
+++ +   for (i = 0; i < SNDRV_PCM_FORMAT_LAST; i++) {
+++ +           switch (snd_pcm_format_physical_width(i)) {
+++ +           case 8:
+++ +           case 16:
+++ +           case 32:
+++ +                   omap_pcm_hardware.formats |= (1LL << i);
+++ +                   break;
+++ +           default:
+++ +                   break;
+++ +           }
+++ +   }
+++ +}
+++ +
     /* this may get called several times by oss emulation */
     static int omap_pcm_hw_params(struct snd_pcm_substream *substream,
                              struct snd_pcm_hw_params *params)
@@@@@@ -201,7 -201,7 -201,7 -219,7 -201,7 +219,7 @@@@@@ static int omap_pcm_new(struct snd_soc_
        struct snd_pcm *pcm = rtd->pcm;
        int ret;
     
 ----   ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(64));
 ++++   ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32));
        if (ret)
                return ret;
     
@@@@@@ -235,6 -235,6 -235,6 -253,7 -235,6 +253,7 @@@@@@ static struct snd_soc_platform_driver o
     
     int omap_pcm_platform_register(struct device *dev)
     {
+++ +   omap_pcm_limit_supported_formats();
        return devm_snd_soc_register_platform(dev, &omap_soc_platform);
     }
     EXPORT_SYMBOL_GPL(omap_pcm_platform_register);