Commit 7b2f32cc authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branch 'asoc/topic/intel' into asoc-next

parents b7f08d29 fe09dd8e
...@@ -55,6 +55,7 @@ enum sst_audio_device_id_mrfld { ...@@ -55,6 +55,7 @@ enum sst_audio_device_id_mrfld {
PIPE_MEDIA0_IN = 0x8F, PIPE_MEDIA0_IN = 0x8F,
PIPE_MEDIA1_IN = 0x90, PIPE_MEDIA1_IN = 0x90,
PIPE_MEDIA2_IN = 0x91, PIPE_MEDIA2_IN = 0x91,
PIPE_MEDIA3_IN = 0x9C,
PIPE_RSVD = 0xFF, PIPE_RSVD = 0xFF,
}; };
......
...@@ -233,6 +233,15 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; ...@@ -233,6 +233,15 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
#define AZX_MLCTL_SPA (1<<16) #define AZX_MLCTL_SPA (1<<16)
#define AZX_MLCTL_CPA 23 #define AZX_MLCTL_CPA 23
/* registers for DMA Resume Capability Structure */
#define AZX_DRSM_CAP_ID 0x5
#define AZX_REG_DRSM_CTL 0x4
/* Base used to calculate the iterating register offset */
#define AZX_DRSM_BASE 0x08
/* Interval used to calculate the iterating register offset */
#define AZX_DRSM_INTERVAL 0x08
/* /*
* helpers to read the stream position * helpers to read the stream position
*/ */
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
* @spbcap: SPIB capabilities pointer * @spbcap: SPIB capabilities pointer
* @mlcap: MultiLink capabilities pointer * @mlcap: MultiLink capabilities pointer
* @gtscap: gts capabilities pointer * @gtscap: gts capabilities pointer
* @drsmcap: dma resume capabilities pointer
* @hlink_list: link list of HDA links * @hlink_list: link list of HDA links
*/ */
struct hdac_ext_bus { struct hdac_ext_bus {
...@@ -23,6 +24,7 @@ struct hdac_ext_bus { ...@@ -23,6 +24,7 @@ struct hdac_ext_bus {
void __iomem *spbcap; void __iomem *spbcap;
void __iomem *mlcap; void __iomem *mlcap;
void __iomem *gtscap; void __iomem *gtscap;
void __iomem *drsmcap;
struct list_head hlink_list; struct list_head hlink_list;
}; };
...@@ -72,6 +74,9 @@ enum hdac_ext_stream_type { ...@@ -72,6 +74,9 @@ enum hdac_ext_stream_type {
* @pplc_addr: processing pipe link stream pointer * @pplc_addr: processing pipe link stream pointer
* @spib_addr: software position in buffers stream pointer * @spib_addr: software position in buffers stream pointer
* @fifo_addr: software position Max fifos stream pointer * @fifo_addr: software position Max fifos stream pointer
* @dpibr_addr: DMA position in buffer resume pointer
* @dpib: DMA position in buffer
* @lpib: Linear position in buffer
* @decoupled: stream host and link is decoupled * @decoupled: stream host and link is decoupled
* @link_locked: link is locked * @link_locked: link is locked
* @link_prepared: link is prepared * @link_prepared: link is prepared
...@@ -86,6 +91,10 @@ struct hdac_ext_stream { ...@@ -86,6 +91,10 @@ struct hdac_ext_stream {
void __iomem *spib_addr; void __iomem *spib_addr;
void __iomem *fifo_addr; void __iomem *fifo_addr;
void __iomem *dpibr_addr;
u32 dpib;
u32 lpib;
bool decoupled:1; bool decoupled:1;
bool link_locked:1; bool link_locked:1;
bool link_prepared; bool link_prepared;
...@@ -116,6 +125,11 @@ int snd_hdac_ext_stream_set_spib(struct hdac_ext_bus *ebus, ...@@ -116,6 +125,11 @@ int snd_hdac_ext_stream_set_spib(struct hdac_ext_bus *ebus,
struct hdac_ext_stream *stream, u32 value); struct hdac_ext_stream *stream, u32 value);
int snd_hdac_ext_stream_get_spbmaxfifo(struct hdac_ext_bus *ebus, int snd_hdac_ext_stream_get_spbmaxfifo(struct hdac_ext_bus *ebus,
struct hdac_ext_stream *stream); struct hdac_ext_stream *stream);
void snd_hdac_ext_stream_drsm_enable(struct hdac_ext_bus *ebus,
bool enable, int index);
int snd_hdac_ext_stream_set_dpibr(struct hdac_ext_bus *ebus,
struct hdac_ext_stream *stream, u32 value);
int snd_hdac_ext_stream_set_lpib(struct hdac_ext_stream *stream, u32 value);
void snd_hdac_ext_link_stream_start(struct hdac_ext_stream *hstream); void snd_hdac_ext_link_stream_start(struct hdac_ext_stream *hstream);
void snd_hdac_ext_link_stream_clear(struct hdac_ext_stream *hstream); void snd_hdac_ext_link_stream_clear(struct hdac_ext_stream *hstream);
...@@ -133,6 +147,7 @@ struct hdac_ext_link { ...@@ -133,6 +147,7 @@ struct hdac_ext_link {
int snd_hdac_ext_bus_link_power_up(struct hdac_ext_link *link); int snd_hdac_ext_bus_link_power_up(struct hdac_ext_link *link);
int snd_hdac_ext_bus_link_power_down(struct hdac_ext_link *link); int snd_hdac_ext_bus_link_power_down(struct hdac_ext_link *link);
int snd_hdac_ext_bus_link_power_up_all(struct hdac_ext_bus *ebus);
int snd_hdac_ext_bus_link_power_down_all(struct hdac_ext_bus *ebus); int snd_hdac_ext_bus_link_power_down_all(struct hdac_ext_bus *ebus);
void snd_hdac_ext_link_set_stream_id(struct hdac_ext_link *link, void snd_hdac_ext_link_set_stream_id(struct hdac_ext_link *link,
int stream); int stream);
...@@ -186,9 +201,15 @@ struct hdac_ext_device { ...@@ -186,9 +201,15 @@ struct hdac_ext_device {
/* codec ops */ /* codec ops */
struct hdac_ext_codec_ops ops; struct hdac_ext_codec_ops ops;
struct snd_card *card;
void *scodec;
void *private_data; void *private_data;
}; };
struct hdac_ext_dma_params {
u32 format;
u8 stream_tag;
};
#define to_ehdac_device(dev) (container_of((dev), \ #define to_ehdac_device(dev) (container_of((dev), \
struct hdac_ext_device, hdac)) struct hdac_ext_device, hdac))
/* /*
......
...@@ -49,6 +49,9 @@ struct device; ...@@ -49,6 +49,9 @@ struct device;
#define SND_SOC_DAPM_SIGGEN(wname) \ #define SND_SOC_DAPM_SIGGEN(wname) \
{ .id = snd_soc_dapm_siggen, .name = wname, .kcontrol_news = NULL, \ { .id = snd_soc_dapm_siggen, .name = wname, .kcontrol_news = NULL, \
.num_kcontrols = 0, .reg = SND_SOC_NOPM } .num_kcontrols = 0, .reg = SND_SOC_NOPM }
#define SND_SOC_DAPM_SINK(wname) \
{ .id = snd_soc_dapm_sink, .name = wname, .kcontrol_news = NULL, \
.num_kcontrols = 0, .reg = SND_SOC_NOPM }
#define SND_SOC_DAPM_INPUT(wname) \ #define SND_SOC_DAPM_INPUT(wname) \
{ .id = snd_soc_dapm_input, .name = wname, .kcontrol_news = NULL, \ { .id = snd_soc_dapm_input, .name = wname, .kcontrol_news = NULL, \
.num_kcontrols = 0, .reg = SND_SOC_NOPM } .num_kcontrols = 0, .reg = SND_SOC_NOPM }
...@@ -485,6 +488,7 @@ enum snd_soc_dapm_type { ...@@ -485,6 +488,7 @@ enum snd_soc_dapm_type {
snd_soc_dapm_aif_in, /* audio interface input */ snd_soc_dapm_aif_in, /* audio interface input */
snd_soc_dapm_aif_out, /* audio interface output */ snd_soc_dapm_aif_out, /* audio interface output */
snd_soc_dapm_siggen, /* signal generator */ snd_soc_dapm_siggen, /* signal generator */
snd_soc_dapm_sink,
snd_soc_dapm_dai_in, /* link to DAI structure */ snd_soc_dapm_dai_in, /* link to DAI structure */
snd_soc_dapm_dai_out, snd_soc_dapm_dai_out,
snd_soc_dapm_dai_link, /* link between two DAI structures */ snd_soc_dapm_dai_link, /* link between two DAI structures */
......
...@@ -1106,7 +1106,7 @@ struct snd_soc_card { ...@@ -1106,7 +1106,7 @@ struct snd_soc_card {
/* CPU <--> Codec DAI links */ /* CPU <--> Codec DAI links */
struct snd_soc_dai_link *dai_link; struct snd_soc_dai_link *dai_link;
int num_links; int num_links;
struct snd_soc_pcm_runtime *rtd; struct list_head rtd_list;
int num_rtd; int num_rtd;
/* optional codec specific configuration */ /* optional codec specific configuration */
...@@ -1201,6 +1201,9 @@ struct snd_soc_pcm_runtime { ...@@ -1201,6 +1201,9 @@ struct snd_soc_pcm_runtime {
struct dentry *debugfs_dpcm_root; struct dentry *debugfs_dpcm_root;
struct dentry *debugfs_dpcm_state; struct dentry *debugfs_dpcm_state;
#endif #endif
unsigned int num; /* 0-based and monotonic increasing */
struct list_head list; /* rtd list of the soc card */
}; };
/* mixer control */ /* mixer control */
......
...@@ -77,6 +77,12 @@ int snd_hdac_ext_bus_parse_capabilities(struct hdac_ext_bus *ebus) ...@@ -77,6 +77,12 @@ int snd_hdac_ext_bus_parse_capabilities(struct hdac_ext_bus *ebus)
ebus->spbcap = bus->remap_addr + offset; ebus->spbcap = bus->remap_addr + offset;
break; break;
case AZX_DRSM_CAP_ID:
/* DMA resume capability found, handler function */
dev_dbg(bus->dev, "Found DRSM capability\n");
ebus->drsmcap = bus->remap_addr + offset;
break;
default: default:
dev_dbg(bus->dev, "Unknown capability %d\n", cur_cap); dev_dbg(bus->dev, "Unknown capability %d\n", cur_cap);
break; break;
...@@ -240,7 +246,7 @@ static int check_hdac_link_power_active(struct hdac_ext_link *link, bool enable) ...@@ -240,7 +246,7 @@ static int check_hdac_link_power_active(struct hdac_ext_link *link, bool enable)
int mask = (1 << AZX_MLCTL_CPA); int mask = (1 << AZX_MLCTL_CPA);
udelay(3); udelay(3);
timeout = 50; timeout = 150;
do { do {
val = readl(link->ml_addr + AZX_REG_ML_LCTL); val = readl(link->ml_addr + AZX_REG_ML_LCTL);
...@@ -281,6 +287,27 @@ int snd_hdac_ext_bus_link_power_down(struct hdac_ext_link *link) ...@@ -281,6 +287,27 @@ int snd_hdac_ext_bus_link_power_down(struct hdac_ext_link *link)
} }
EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_power_down); EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_power_down);
/**
* snd_hdac_ext_bus_link_power_up_all -power up all hda link
* @ebus: HD-audio extended bus
*/
int snd_hdac_ext_bus_link_power_up_all(struct hdac_ext_bus *ebus)
{
struct hdac_ext_link *hlink = NULL;
int ret;
list_for_each_entry(hlink, &ebus->hlink_list, list) {
snd_hdac_updatel(hlink->ml_addr,
AZX_REG_ML_LCTL, 0, AZX_MLCTL_SPA);
ret = check_hdac_link_power_active(hlink, true);
if (ret < 0)
return ret;
}
return 0;
}
EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_power_up_all);
/** /**
* snd_hdac_ext_bus_link_power_down_all -power down all hda link * snd_hdac_ext_bus_link_power_down_all -power down all hda link
* @ebus: HD-audio extended bus * @ebus: HD-audio extended bus
......
...@@ -59,6 +59,10 @@ void snd_hdac_ext_stream_init(struct hdac_ext_bus *ebus, ...@@ -59,6 +59,10 @@ void snd_hdac_ext_stream_init(struct hdac_ext_bus *ebus,
AZX_SPB_MAXFIFO; AZX_SPB_MAXFIFO;
} }
if (ebus->drsmcap)
stream->dpibr_addr = ebus->drsmcap + AZX_DRSM_BASE +
AZX_DRSM_INTERVAL * idx;
stream->decoupled = false; stream->decoupled = false;
snd_hdac_stream_init(bus, &stream->hstream, idx, direction, tag); snd_hdac_stream_init(bus, &stream->hstream, idx, direction, tag);
} }
...@@ -107,6 +111,7 @@ void snd_hdac_stream_free_all(struct hdac_ext_bus *ebus) ...@@ -107,6 +111,7 @@ void snd_hdac_stream_free_all(struct hdac_ext_bus *ebus)
while (!list_empty(&bus->stream_list)) { while (!list_empty(&bus->stream_list)) {
s = list_first_entry(&bus->stream_list, struct hdac_stream, list); s = list_first_entry(&bus->stream_list, struct hdac_stream, list);
stream = stream_to_hdac_ext_stream(s); stream = stream_to_hdac_ext_stream(s);
snd_hdac_ext_stream_decouple(ebus, stream, false);
list_del(&s->list); list_del(&s->list);
kfree(stream); kfree(stream);
} }
...@@ -497,3 +502,70 @@ void snd_hdac_ext_stop_streams(struct hdac_ext_bus *ebus) ...@@ -497,3 +502,70 @@ void snd_hdac_ext_stop_streams(struct hdac_ext_bus *ebus)
} }
} }
EXPORT_SYMBOL_GPL(snd_hdac_ext_stop_streams); EXPORT_SYMBOL_GPL(snd_hdac_ext_stop_streams);
/**
* snd_hdac_ext_stream_drsm_enable - enable DMA resume for a stream
* @ebus: HD-audio ext core bus
* @enable: flag to enable/disable DRSM
* @index: stream index for which DRSM need to be enabled
*/
void snd_hdac_ext_stream_drsm_enable(struct hdac_ext_bus *ebus,
bool enable, int index)
{
u32 mask = 0;
u32 register_mask = 0;
struct hdac_bus *bus = &ebus->bus;
if (!ebus->drsmcap) {
dev_err(bus->dev, "Address of DRSM capability is NULL");
return;
}
mask |= (1 << index);
register_mask = readl(ebus->drsmcap + AZX_REG_SPB_SPBFCCTL);
mask |= register_mask;
if (enable)
snd_hdac_updatel(ebus->drsmcap, AZX_REG_DRSM_CTL, 0, mask);
else
snd_hdac_updatel(ebus->drsmcap, AZX_REG_DRSM_CTL, mask, 0);
}
EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_drsm_enable);
/**
* snd_hdac_ext_stream_set_dpibr - sets the dpibr value of a stream
* @ebus: HD-audio ext core bus
* @stream: hdac_ext_stream
* @value: dpib value to set
*/
int snd_hdac_ext_stream_set_dpibr(struct hdac_ext_bus *ebus,
struct hdac_ext_stream *stream, u32 value)
{
struct hdac_bus *bus = &ebus->bus;
if (!ebus->drsmcap) {
dev_err(bus->dev, "Address of DRSM capability is NULL");
return -EINVAL;
}
writel(value, stream->dpibr_addr);
return 0;
}
EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_set_dpibr);
/**
* snd_hdac_ext_stream_set_lpib - sets the lpib value of a stream
* @ebus: HD-audio ext core bus
* @stream: hdac_ext_stream
* @value: lpib value to set
*/
int snd_hdac_ext_stream_set_lpib(struct hdac_ext_stream *stream, u32 value)
{
snd_hdac_stream_writel(&stream->hstream, SD_LPIB, value);
return 0;
}
EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_set_lpib);
...@@ -66,6 +66,7 @@ config SND_SOC_ALL_CODECS ...@@ -66,6 +66,7 @@ config SND_SOC_ALL_CODECS
select SND_SOC_ES8328_SPI if SPI_MASTER select SND_SOC_ES8328_SPI if SPI_MASTER
select SND_SOC_ES8328_I2C if I2C select SND_SOC_ES8328_I2C if I2C
select SND_SOC_GTM601 select SND_SOC_GTM601
select SND_SOC_HDAC_HDMI
select SND_SOC_ICS43432 select SND_SOC_ICS43432
select SND_SOC_ISABELLE if I2C select SND_SOC_ISABELLE if I2C
select SND_SOC_JZ4740_CODEC select SND_SOC_JZ4740_CODEC
...@@ -468,6 +469,11 @@ config SND_SOC_ES8328_SPI ...@@ -468,6 +469,11 @@ config SND_SOC_ES8328_SPI
config SND_SOC_GTM601 config SND_SOC_GTM601
tristate 'GTM601 UMTS modem audio codec' tristate 'GTM601 UMTS modem audio codec'
config SND_SOC_HDAC_HDMI
tristate
select SND_HDA_EXT_CORE
select HDMI
config SND_SOC_ICS43432 config SND_SOC_ICS43432
tristate tristate
......
...@@ -59,6 +59,7 @@ snd-soc-es8328-objs := es8328.o ...@@ -59,6 +59,7 @@ snd-soc-es8328-objs := es8328.o
snd-soc-es8328-i2c-objs := es8328-i2c.o snd-soc-es8328-i2c-objs := es8328-i2c.o
snd-soc-es8328-spi-objs := es8328-spi.o snd-soc-es8328-spi-objs := es8328-spi.o
snd-soc-gtm601-objs := gtm601.o snd-soc-gtm601-objs := gtm601.o
snd-soc-hdac-hdmi-objs := hdac_hdmi.o
snd-soc-ics43432-objs := ics43432.o snd-soc-ics43432-objs := ics43432.o
snd-soc-isabelle-objs := isabelle.o snd-soc-isabelle-objs := isabelle.o
snd-soc-jz4740-codec-objs := jz4740.o snd-soc-jz4740-codec-objs := jz4740.o
...@@ -254,6 +255,7 @@ obj-$(CONFIG_SND_SOC_ES8328) += snd-soc-es8328.o ...@@ -254,6 +255,7 @@ obj-$(CONFIG_SND_SOC_ES8328) += snd-soc-es8328.o
obj-$(CONFIG_SND_SOC_ES8328_I2C)+= snd-soc-es8328-i2c.o obj-$(CONFIG_SND_SOC_ES8328_I2C)+= snd-soc-es8328-i2c.o
obj-$(CONFIG_SND_SOC_ES8328_SPI)+= snd-soc-es8328-spi.o obj-$(CONFIG_SND_SOC_ES8328_SPI)+= snd-soc-es8328-spi.o
obj-$(CONFIG_SND_SOC_GTM601) += snd-soc-gtm601.o obj-$(CONFIG_SND_SOC_GTM601) += snd-soc-gtm601.o
obj-$(CONFIG_SND_SOC_HDAC_HDMI) += snd-soc-hdac-hdmi.o
obj-$(CONFIG_SND_SOC_ICS43432) += snd-soc-ics43432.o obj-$(CONFIG_SND_SOC_ICS43432) += snd-soc-ics43432.o
obj-$(CONFIG_SND_SOC_ISABELLE) += snd-soc-isabelle.o obj-$(CONFIG_SND_SOC_ISABELLE) += snd-soc-isabelle.o
obj-$(CONFIG_SND_SOC_JZ4740_CODEC) += snd-soc-jz4740-codec.o obj-$(CONFIG_SND_SOC_JZ4740_CODEC) += snd-soc-jz4740-codec.o
......
This diff is collapsed.
...@@ -488,6 +488,18 @@ static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source, ...@@ -488,6 +488,18 @@ static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,
return 0; return 0;
} }
static int is_using_asrc(struct snd_soc_dapm_widget *source,
struct snd_soc_dapm_widget *sink)
{
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
if (!rt5640->asrc_en)
return 0;
return 1;
}
/* Digital Mixer */ /* Digital Mixer */
static const struct snd_kcontrol_new rt5640_sto_adc_l_mix[] = { static const struct snd_kcontrol_new rt5640_sto_adc_l_mix[] = {
SOC_DAPM_SINGLE("ADC1 Switch", RT5640_STO_ADC_MIXER, SOC_DAPM_SINGLE("ADC1 Switch", RT5640_STO_ADC_MIXER,
...@@ -1059,6 +1071,20 @@ static int rt5640_hp_post_event(struct snd_soc_dapm_widget *w, ...@@ -1059,6 +1071,20 @@ static int rt5640_hp_post_event(struct snd_soc_dapm_widget *w,
static const struct snd_soc_dapm_widget rt5640_dapm_widgets[] = { static const struct snd_soc_dapm_widget rt5640_dapm_widgets[] = {
SND_SOC_DAPM_SUPPLY("PLL1", RT5640_PWR_ANLG2, SND_SOC_DAPM_SUPPLY("PLL1", RT5640_PWR_ANLG2,
RT5640_PWR_PLL_BIT, 0, NULL, 0), RT5640_PWR_PLL_BIT, 0, NULL, 0),
/* ASRC */
SND_SOC_DAPM_SUPPLY_S("Stereo Filter ASRC", 1, RT5640_ASRC_1,
15, 0, NULL, 0),
SND_SOC_DAPM_SUPPLY_S("I2S2 Filter ASRC", 1, RT5640_ASRC_1,
12, 0, NULL, 0),
SND_SOC_DAPM_SUPPLY_S("I2S2 ASRC", 1, RT5640_ASRC_1,
11, 0, NULL, 0),
SND_SOC_DAPM_SUPPLY_S("DMIC1 ASRC", 1, RT5640_ASRC_1,
9, 0, NULL, 0),
SND_SOC_DAPM_SUPPLY_S("DMIC2 ASRC", 1, RT5640_ASRC_1,
8, 0, NULL, 0),
/* Input Side */ /* Input Side */
/* micbias */ /* micbias */
SND_SOC_DAPM_SUPPLY("LDO2", RT5640_PWR_ANLG1, SND_SOC_DAPM_SUPPLY("LDO2", RT5640_PWR_ANLG1,
...@@ -1319,6 +1345,12 @@ static const struct snd_soc_dapm_widget rt5639_specific_dapm_widgets[] = { ...@@ -1319,6 +1345,12 @@ static const struct snd_soc_dapm_widget rt5639_specific_dapm_widgets[] = {
}; };
static const struct snd_soc_dapm_route rt5640_dapm_routes[] = { static const struct snd_soc_dapm_route rt5640_dapm_routes[] = {
{ "I2S1", NULL, "Stereo Filter ASRC", is_using_asrc },
{ "I2S2", NULL, "I2S2 ASRC", is_using_asrc },
{ "I2S2", NULL, "I2S2 Filter ASRC", is_using_asrc },
{ "DMIC1", NULL, "DMIC1 ASRC", is_using_asrc },
{ "DMIC2", NULL, "DMIC2 ASRC", is_using_asrc },
{"IN1P", NULL, "LDO2"}, {"IN1P", NULL, "LDO2"},
{"IN2P", NULL, "LDO2"}, {"IN2P", NULL, "LDO2"},
{"IN3P", NULL, "LDO2"}, {"IN3P", NULL, "LDO2"},
...@@ -1981,6 +2013,76 @@ int rt5640_dmic_enable(struct snd_soc_codec *codec, ...@@ -1981,6 +2013,76 @@ int rt5640_dmic_enable(struct snd_soc_codec *codec,
} }
EXPORT_SYMBOL_GPL(rt5640_dmic_enable); EXPORT_SYMBOL_GPL(rt5640_dmic_enable);
int rt5640_sel_asrc_clk_src(struct snd_soc_codec *codec,
unsigned int filter_mask, unsigned int clk_src)
{
struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
unsigned int asrc2_mask = 0;
unsigned int asrc2_value = 0;
switch (clk_src) {
case RT5640_CLK_SEL_SYS:
case RT5640_CLK_SEL_ASRC:
break;
default:
return -EINVAL;
}
if (!filter_mask)
return -EINVAL;
if (filter_mask & RT5640_DA_STEREO_FILTER) {
asrc2_mask |= RT5640_STO_DAC_M_MASK;
asrc2_value = (asrc2_value & ~RT5640_STO_DAC_M_MASK)
| (clk_src << RT5640_STO_DAC_M_SFT);
}
if (filter_mask & RT5640_DA_MONO_L_FILTER) {
asrc2_mask |= RT5640_MDA_L_M_MASK;
asrc2_value = (asrc2_value & ~RT5640_MDA_L_M_MASK)
| (clk_src << RT5640_MDA_L_M_SFT);
}
if (filter_mask & RT5640_DA_MONO_R_FILTER) {
asrc2_mask |= RT5640_MDA_R_M_MASK;
asrc2_value = (asrc2_value & ~RT5640_MDA_R_M_MASK)
| (clk_src << RT5640_MDA_R_M_SFT);
}
if (filter_mask & RT5640_AD_STEREO_FILTER) {
asrc2_mask |= RT5640_ADC_M_MASK;
asrc2_value = (asrc2_value & ~RT5640_ADC_M_MASK)
| (clk_src << RT5640_ADC_M_SFT);
}
if (filter_mask & RT5640_AD_MONO_L_FILTER) {
asrc2_mask |= RT5640_MAD_L_M_MASK;
asrc2_value = (asrc2_value & ~RT5640_MAD_L_M_MASK)
| (clk_src << RT5640_MAD_L_M_SFT);
}
if (filter_mask & RT5640_AD_MONO_R_FILTER) {
asrc2_mask |= RT5640_MAD_R_M_MASK;
asrc2_value = (asrc2_value & ~RT5640_MAD_R_M_MASK)
| (clk_src << RT5640_MAD_R_M_SFT);
}
snd_soc_update_bits(codec, RT5640_ASRC_2,
asrc2_mask, asrc2_value);
if (snd_soc_read(codec, RT5640_ASRC_2)) {
rt5640->asrc_en = true;
snd_soc_update_bits(codec, RT5640_JD_CTRL, 0x3, 0x3);
} else {
rt5640->asrc_en = false;
snd_soc_update_bits(codec, RT5640_JD_CTRL, 0x3, 0x0);
}
return 0;
}
EXPORT_SYMBOL_GPL(rt5640_sel_asrc_clk_src);
static int rt5640_probe(struct snd_soc_codec *codec) static int rt5640_probe(struct snd_soc_codec *codec)
{ {
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
...@@ -2175,6 +2277,7 @@ static const struct acpi_device_id rt5640_acpi_match[] = { ...@@ -2175,6 +2277,7 @@ static const struct acpi_device_id rt5640_acpi_match[] = {
{ "INT33CA", 0 }, { "INT33CA", 0 },
{ "10EC5640", 0 }, { "10EC5640", 0 },
{ "10EC5642", 0 }, { "10EC5642", 0 },
{ "INTCCFFD", 0 },
{ }, { },
}; };
MODULE_DEVICE_TABLE(acpi, rt5640_acpi_match); MODULE_DEVICE_TABLE(acpi, rt5640_acpi_match);
......
...@@ -1033,6 +1033,10 @@ ...@@ -1033,6 +1033,10 @@
#define RT5640_DMIC_2_M_NOR (0x0 << 8) #define RT5640_DMIC_2_M_NOR (0x0 << 8)
#define RT5640_DMIC_2_M_ASYN (0x1 << 8) #define RT5640_DMIC_2_M_ASYN (0x1 << 8)
/* ASRC clock source selection (0x84) */
#define RT5640_CLK_SEL_SYS (0x0)
#define RT5640_CLK_SEL_ASRC (0x1)
/* ASRC Control 2 (0x84) */ /* ASRC Control 2 (0x84) */
#define RT5640_MDA_L_M_MASK (0x1 << 15) #define RT5640_MDA_L_M_MASK (0x1 << 15)
#define RT5640_MDA_L_M_SFT 15 #define RT5640_MDA_L_M_SFT 15
...@@ -2079,6 +2083,16 @@ enum { ...@@ -2079,6 +2083,16 @@ enum {
RT5640_DMIC2, RT5640_DMIC2,
}; };
/* filter mask */
enum {
RT5640_DA_STEREO_FILTER = 0x1,
RT5640_DA_MONO_L_FILTER = (0x1 << 1),
RT5640_DA_MONO_R_FILTER = (0x1 << 2),
RT5640_AD_STEREO_FILTER = (0x1 << 3),
RT5640_AD_MONO_L_FILTER = (0x1 << 4),
RT5640_AD_MONO_R_FILTER = (0x1 << 5),
};
struct rt5640_priv { struct rt5640_priv {
struct snd_soc_codec *codec; struct snd_soc_codec *codec;
struct rt5640_platform_data pdata; struct rt5640_platform_data pdata;
...@@ -2095,9 +2109,12 @@ struct rt5640_priv { ...@@ -2095,9 +2109,12 @@ struct rt5640_priv {
int pll_out; int pll_out;
bool hp_mute; bool hp_mute;
bool asrc_en;
}; };
int rt5640_dmic_enable(struct snd_soc_codec *codec, int rt5640_dmic_enable(struct snd_soc_codec *codec,
bool dmic1_data_pin, bool dmic2_data_pin); bool dmic1_data_pin, bool dmic2_data_pin);
int rt5640_sel_asrc_clk_src(struct snd_soc_codec *codec,
unsigned int filter_mask, unsigned int clk_src);
#endif #endif
...@@ -222,12 +222,15 @@ static int fsl_asoc_card_set_bias_level(struct snd_soc_card *card, ...@@ -222,12 +222,15 @@ static int fsl_asoc_card_set_bias_level(struct snd_soc_card *card,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
{ {
struct fsl_asoc_card_priv *priv = snd_soc_card_get_drvdata(card); struct fsl_asoc_card_priv *priv = snd_soc_card_get_drvdata(card);
struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; struct snd_soc_pcm_runtime *rtd;
struct snd_soc_dai *codec_dai;
struct codec_priv *codec_priv = &priv->codec_priv; struct codec_priv *codec_priv = &priv->codec_priv;
struct device *dev = card->dev; struct device *dev = card->dev;
unsigned int pll_out; unsigned int pll_out;
int ret; int ret;
rtd = snd_soc_get_pcm_runtime(card, card->dai_link[0].name);
codec_dai = rtd->codec_dai;
if (dapm->dev != codec_dai->dev) if (dapm->dev != codec_dai->dev)
return 0; return 0;
......
...@@ -69,13 +69,16 @@ static int imx_wm8962_set_bias_level(struct snd_soc_card *card, ...@@ -69,13 +69,16 @@ static int imx_wm8962_set_bias_level(struct snd_soc_card *card,
struct snd_soc_dapm_context *dapm, struct snd_soc_dapm_context *dapm,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
{ {
struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; struct snd_soc_pcm_runtime *rtd;
struct snd_soc_dai *codec_dai;
struct imx_priv *priv = &card_priv; struct imx_priv *priv = &card_priv;
struct imx_wm8962_data *data = snd_soc_card_get_drvdata(card); struct imx_wm8962_data *data = snd_soc_card_get_drvdata(card);
struct device *dev = &priv->pdev->dev; struct device *dev = &priv->pdev->dev;
unsigned int pll_out; unsigned int pll_out;
int ret; int ret;
rtd = snd_soc_get_pcm_runtime(card, card->dai_link[0].name);
codec_dai = rtd->codec_dai;
if (dapm->dev != codec_dai->dev) if (dapm->dev != codec_dai->dev)
return 0; return 0;
...@@ -135,12 +138,15 @@ static int imx_wm8962_set_bias_level(struct snd_soc_card *card, ...@@ -135,12 +138,15 @@ static int imx_wm8962_set_bias_level(struct snd_soc_card *card,
static int imx_wm8962_late_probe(struct snd_soc_card *card) static int imx_wm8962_late_probe(struct snd_soc_card *card)
{ {
struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; struct snd_soc_pcm_runtime *rtd;
struct snd_soc_dai *codec_dai;
struct imx_priv *priv = &card_priv; struct imx_priv *priv = &card_priv;
struct imx_wm8962_data *data = snd_soc_card_get_drvdata(card); struct imx_wm8962_data *data = snd_soc_card_get_drvdata(card);
struct device *dev = &priv->pdev->dev; struct device *dev = &priv->pdev->dev;
int ret; int ret;
rtd = snd_soc_get_pcm_runtime(card, card->dai_link[0].name);
codec_dai = rtd->codec_dai;
ret = snd_soc_dai_set_sysclk(codec_dai, WM8962_SYSCLK_MCLK, ret = snd_soc_dai_set_sysclk(codec_dai, WM8962_SYSCLK_MCLK,
data->clk_frequency, SND_SOC_CLOCK_IN); data->clk_frequency, SND_SOC_CLOCK_IN);
if (ret < 0) if (ret < 0)
......
...@@ -45,7 +45,7 @@ static int asoc_simple_card_startup(struct snd_pcm_substream *substream) ...@@ -45,7 +45,7 @@ static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card); struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
struct simple_dai_props *dai_props = struct simple_dai_props *dai_props =
&priv->dai_props[rtd - rtd->card->rtd]; &priv->dai_props[rtd->num];
int ret; int ret;
ret = clk_prepare_enable(dai_props->cpu_dai.clk); ret = clk_prepare_enable(dai_props->cpu_dai.clk);
...@@ -64,7 +64,7 @@ static void asoc_simple_card_shutdown(struct snd_pcm_substream *substream) ...@@ -64,7 +64,7 @@ static void asoc_simple_card_shutdown(struct snd_pcm_substream *substream)
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card); struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
struct simple_dai_props *dai_props = struct simple_dai_props *dai_props =
&priv->dai_props[rtd - rtd->card->rtd]; &priv->dai_props[rtd->num];
clk_disable_unprepare(dai_props->cpu_dai.clk); clk_disable_unprepare(dai_props->cpu_dai.clk);
...@@ -78,8 +78,7 @@ static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream, ...@@ -78,8 +78,7 @@ static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card); struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
struct simple_dai_props *dai_props = struct simple_dai_props *dai_props = &priv->dai_props[rtd->num];
&priv->dai_props[rtd - rtd->card->rtd];
unsigned int mclk, mclk_fs = 0; unsigned int mclk, mclk_fs = 0;
int ret = 0; int ret = 0;
...@@ -174,10 +173,9 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd) ...@@ -174,10 +173,9 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
struct snd_soc_dai *codec = rtd->codec_dai; struct snd_soc_dai *codec = rtd->codec_dai;
struct snd_soc_dai *cpu = rtd->cpu_dai; struct snd_soc_dai *cpu = rtd->cpu_dai;
struct simple_dai_props *dai_props; struct simple_dai_props *dai_props;
int num, ret; int ret;
num = rtd - rtd->card->rtd; dai_props = &priv->dai_props[rtd->num];
dai_props = &priv->dai_props[num];
ret = __asoc_simple_card_dai_init(codec, &dai_props->codec_dai); ret = __asoc_simple_card_dai_init(codec, &dai_props->codec_dai);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -24,6 +24,7 @@ config SND_SST_IPC_PCI ...@@ -24,6 +24,7 @@ config SND_SST_IPC_PCI
config SND_SST_IPC_ACPI config SND_SST_IPC_ACPI
tristate tristate
select SND_SST_IPC select SND_SST_IPC
select SND_SOC_INTEL_SST
depends on ACPI depends on ACPI
config SND_SOC_INTEL_SST config SND_SOC_INTEL_SST
...@@ -43,7 +44,7 @@ config SND_SOC_INTEL_BAYTRAIL ...@@ -43,7 +44,7 @@ config SND_SOC_INTEL_BAYTRAIL
config SND_SOC_INTEL_HASWELL_MACH config SND_SOC_INTEL_HASWELL_MACH
tristate "ASoC Audio DSP support for Intel Haswell Lynxpoint" tristate "ASoC Audio DSP support for Intel Haswell Lynxpoint"
depends on X86_INTEL_LPSS && I2C && I2C_DESIGNWARE_PLATFORM depends on X86_INTEL_LPSS && I2C && I2C_DESIGNWARE_PLATFORM
depends on DW_DMAC_CORE depends on DW_DMAC_CORE=y
select SND_SOC_INTEL_SST select SND_SOC_INTEL_SST
select SND_SOC_INTEL_HASWELL select SND_SOC_INTEL_HASWELL
select SND_SOC_RT5640 select SND_SOC_RT5640
...@@ -56,18 +57,19 @@ config SND_SOC_INTEL_HASWELL_MACH ...@@ -56,18 +57,19 @@ config SND_SOC_INTEL_HASWELL_MACH
config SND_SOC_INTEL_BYT_RT5640_MACH config SND_SOC_INTEL_BYT_RT5640_MACH
tristate "ASoC Audio driver for Intel Baytrail with RT5640 codec" tristate "ASoC Audio driver for Intel Baytrail with RT5640 codec"
depends on X86_INTEL_LPSS && I2C depends on X86_INTEL_LPSS && I2C
depends on DW_DMAC_CORE depends on DW_DMAC_CORE=y && (SND_SOC_INTEL_BYTCR_RT5640_MACH = n)
select SND_SOC_INTEL_SST select SND_SOC_INTEL_SST
select SND_SOC_INTEL_BAYTRAIL select SND_SOC_INTEL_BAYTRAIL
select SND_SOC_RT5640 select SND_SOC_RT5640
help help
This adds audio driver for Intel Baytrail platform based boards This adds audio driver for Intel Baytrail platform based boards
with the RT5640 audio codec. with the RT5640 audio codec. This driver is deprecated, use
SND_SOC_INTEL_BYTCR_RT5640_MACH instead for better functionality
config SND_SOC_INTEL_BYT_MAX98090_MACH config SND_SOC_INTEL_BYT_MAX98090_MACH
tristate "ASoC Audio driver for Intel Baytrail with MAX98090 codec" tristate "ASoC Audio driver for Intel Baytrail with MAX98090 codec"
depends on X86_INTEL_LPSS && I2C depends on X86_INTEL_LPSS && I2C
depends on DW_DMAC_CORE depends on DW_DMAC_CORE=y
select SND_SOC_INTEL_SST select SND_SOC_INTEL_SST
select SND_SOC_INTEL_BAYTRAIL select SND_SOC_INTEL_BAYTRAIL
select SND_SOC_MAX98090 select SND_SOC_MAX98090
...@@ -79,7 +81,7 @@ config SND_SOC_INTEL_BROADWELL_MACH ...@@ -79,7 +81,7 @@ config SND_SOC_INTEL_BROADWELL_MACH
tristate "ASoC Audio DSP support for Intel Broadwell Wildcatpoint" tristate "ASoC Audio DSP support for Intel Broadwell Wildcatpoint"
depends on X86_INTEL_LPSS && I2C && DW_DMAC && \ depends on X86_INTEL_LPSS && I2C && DW_DMAC && \
I2C_DESIGNWARE_PLATFORM I2C_DESIGNWARE_PLATFORM
depends on DW_DMAC_CORE depends on DW_DMAC_CORE=y
select SND_SOC_INTEL_SST select SND_SOC_INTEL_SST
select SND_SOC_INTEL_HASWELL select SND_SOC_INTEL_HASWELL
select SND_SOC_RT286 select SND_SOC_RT286
...@@ -90,14 +92,26 @@ config SND_SOC_INTEL_BROADWELL_MACH ...@@ -90,14 +92,26 @@ config SND_SOC_INTEL_BROADWELL_MACH
If unsure select "N". If unsure select "N".
config SND_SOC_INTEL_BYTCR_RT5640_MACH config SND_SOC_INTEL_BYTCR_RT5640_MACH
tristate "ASoC Audio DSP Support for MID BYT Platform" tristate "ASoC Audio driver for Intel Baytrail and Baytrail-CR with RT5640 codec"
depends on X86 && I2C depends on X86 && I2C
select SND_SOC_RT5640 select SND_SOC_RT5640
select SND_SST_MFLD_PLATFORM select SND_SST_MFLD_PLATFORM
select SND_SST_IPC_ACPI select SND_SST_IPC_ACPI
help help
This adds support for ASoC machine driver for Intel(R) MID Baytrail platform This adds support for ASoC machine driver for Intel(R) Baytrail and Baytrail-CR
used as alsa device in audio substem in Intel(R) MID devices platforms with RT5640 audio codec.
Say Y if you have such a device
If unsure select "N".
config SND_SOC_INTEL_BYTCR_RT5651_MACH
tristate "ASoC Audio driver for Intel Baytrail and Baytrail-CR with RT5651 codec"
depends on X86 && I2C
select SND_SOC_RT5651
select SND_SST_MFLD_PLATFORM
select SND_SST_IPC_ACPI
help
This adds support for ASoC machine driver for Intel(R) Baytrail and Baytrail-CR
platforms with RT5651 audio codec.
Say Y if you have such a device Say Y if you have such a device
If unsure select "N". If unsure select "N".
...@@ -154,3 +168,31 @@ config SND_SOC_INTEL_SKL_RT286_MACH ...@@ -154,3 +168,31 @@ config SND_SOC_INTEL_SKL_RT286_MACH
with RT286 I2S audio codec. with RT286 I2S audio codec.
Say Y if you have such a device Say Y if you have such a device
If unsure select "N". If unsure select "N".
config SND_SOC_INTEL_SKL_NAU88L25_SSM4567_MACH
tristate "ASoC Audio driver for SKL with NAU88L25 and SSM4567 in I2S Mode"
depends on X86_INTEL_LPSS && I2C
select SND_SOC_INTEL_SST
select SND_SOC_INTEL_SKYLAKE
select SND_SOC_NAU8825
select SND_SOC_SSM4567
select SND_SOC_DMIC
help
This adds support for ASoC Onboard Codec I2S machine driver. This will
create an alsa sound card for NAU88L25 + SSM4567.
Say Y if you have such a device
If unsure select "N".
config SND_SOC_INTEL_SKL_NAU88L25_MAX98357A_MACH
tristate "ASoC Audio driver for SKL with NAU88L25 and MAX98357A in I2S Mode"
depends on X86_INTEL_LPSS && I2C
select SND_SOC_INTEL_SST
select SND_SOC_INTEL_SKYLAKE
select SND_SOC_NAU8825
select SND_SOC_MAX98357A
select SND_SOC_DMIC
help
This adds support for ASoC Onboard Codec I2S machine driver. This will
create an alsa sound card for NAU88L25 + MAX98357A.
Say Y if you have such a device
If unsure select "N".
...@@ -443,7 +443,7 @@ static int sst_gain_get(struct snd_kcontrol *kcontrol, ...@@ -443,7 +443,7 @@ static int sst_gain_get(struct snd_kcontrol *kcontrol,
break; break;
case SST_GAIN_MUTE: case SST_GAIN_MUTE:
ucontrol->value.integer.value[0] = gv->mute ? 1 : 0; ucontrol->value.integer.value[0] = gv->mute ? 0 : 1;
break; break;
case SST_GAIN_RAMP_DURATION: case SST_GAIN_RAMP_DURATION:
...@@ -479,7 +479,7 @@ static int sst_gain_put(struct snd_kcontrol *kcontrol, ...@@ -479,7 +479,7 @@ static int sst_gain_put(struct snd_kcontrol *kcontrol,
break; break;
case SST_GAIN_MUTE: case SST_GAIN_MUTE:
gv->mute = !!ucontrol->value.integer.value[0]; gv->mute = !ucontrol->value.integer.value[0];
dev_dbg(cmpnt->dev, "%s: Mute %d\n", mc->pname, gv->mute); dev_dbg(cmpnt->dev, "%s: Mute %d\n", mc->pname, gv->mute);
break; break;
...@@ -1109,6 +1109,7 @@ static const struct snd_soc_dapm_route intercon[] = { ...@@ -1109,6 +1109,7 @@ static const struct snd_soc_dapm_route intercon[] = {
{"media0_in", NULL, "Compress Playback"}, {"media0_in", NULL, "Compress Playback"},
{"media1_in", NULL, "Headset Playback"}, {"media1_in", NULL, "Headset Playback"},
{"media2_in", NULL, "pcm0_out"}, {"media2_in", NULL, "pcm0_out"},
{"media3_in", NULL, "Deepbuffer Playback"},
{"media0_out mix 0", "media0_in Switch", "media0_in"}, {"media0_out mix 0", "media0_in Switch", "media0_in"},
{"media0_out mix 0", "media1_in Switch", "media1_in"}, {"media0_out mix 0", "media1_in Switch", "media1_in"},
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
enum { enum {
MERR_DPCM_AUDIO = 0, MERR_DPCM_AUDIO = 0,
MERR_DPCM_DEEP_BUFFER,
MERR_DPCM_COMPR, MERR_DPCM_COMPR,
}; };
......
...@@ -98,6 +98,7 @@ static struct sst_dev_stream_map dpcm_strm_map[] = { ...@@ -98,6 +98,7 @@ static struct sst_dev_stream_map dpcm_strm_map[] = {
{MERR_DPCM_AUDIO, 0, SNDRV_PCM_STREAM_PLAYBACK, PIPE_MEDIA1_IN, SST_TASK_ID_MEDIA, 0}, {MERR_DPCM_AUDIO, 0, SNDRV_PCM_STREAM_PLAYBACK, PIPE_MEDIA1_IN, SST_TASK_ID_MEDIA, 0},
{MERR_DPCM_COMPR, 0, SNDRV_PCM_STREAM_PLAYBACK, PIPE_MEDIA0_IN, SST_TASK_ID_MEDIA, 0}, {MERR_DPCM_COMPR, 0, SNDRV_PCM_STREAM_PLAYBACK, PIPE_MEDIA0_IN, SST_TASK_ID_MEDIA, 0},
{MERR_DPCM_AUDIO, 0, SNDRV_PCM_STREAM_CAPTURE, PIPE_PCM1_OUT, SST_TASK_ID_MEDIA, 0}, {MERR_DPCM_AUDIO, 0, SNDRV_PCM_STREAM_CAPTURE, PIPE_PCM1_OUT, SST_TASK_ID_MEDIA, 0},
{MERR_DPCM_DEEP_BUFFER, 0, SNDRV_PCM_STREAM_PLAYBACK, PIPE_MEDIA3_IN, SST_TASK_ID_MEDIA, 0},
}; };
static int sst_media_digital_mute(struct snd_soc_dai *dai, int mute, int stream) static int sst_media_digital_mute(struct snd_soc_dai *dai, int mute, int stream)
...@@ -500,14 +501,25 @@ static struct snd_soc_dai_driver sst_platform_dai[] = { ...@@ -500,14 +501,25 @@ static struct snd_soc_dai_driver sst_platform_dai[] = {
.channels_min = SST_STEREO, .channels_min = SST_STEREO,
.channels_max = SST_STEREO, .channels_max = SST_STEREO,
.rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000, .rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000,
.formats = SNDRV_PCM_FMTBIT_S16_LE, .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE,
}, },
.capture = { .capture = {
.stream_name = "Headset Capture", .stream_name = "Headset Capture",
.channels_min = 1, .channels_min = 1,
.channels_max = 2, .channels_max = 2,
.rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000, .rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000,
.formats = SNDRV_PCM_FMTBIT_S16_LE, .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE,
},
},
{
.name = "deepbuffer-cpu-dai",
.ops = &sst_media_dai_ops,
.playback = {
.stream_name = "Deepbuffer Playback",
.channels_min = SST_STEREO,
.channels_max = SST_STEREO,
.rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000,
.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE,
}, },
}, },
{ {
...@@ -516,10 +528,6 @@ static struct snd_soc_dai_driver sst_platform_dai[] = { ...@@ -516,10 +528,6 @@ static struct snd_soc_dai_driver sst_platform_dai[] = {
.ops = &sst_compr_dai_ops, .ops = &sst_compr_dai_ops,
.playback = { .playback = {
.stream_name = "Compress Playback", .stream_name = "Compress Playback",
.channels_min = SST_STEREO,
.channels_max = SST_STEREO,
.rates = SNDRV_PCM_RATE_48000,
.formats = SNDRV_PCM_FMTBIT_S16_LE,
}, },
}, },
/* BE CPU Dais */ /* BE CPU Dais */
...@@ -760,15 +768,15 @@ static int sst_platform_remove(struct platform_device *pdev) ...@@ -760,15 +768,15 @@ static int sst_platform_remove(struct platform_device *pdev)
static int sst_soc_prepare(struct device *dev) static int sst_soc_prepare(struct device *dev)
{ {
struct sst_data *drv = dev_get_drvdata(dev); struct sst_data *drv = dev_get_drvdata(dev);
int i; struct snd_soc_pcm_runtime *rtd;
/* suspend all pcms first */ /* suspend all pcms first */
snd_soc_suspend(drv->soc_card->dev); snd_soc_suspend(drv->soc_card->dev);
snd_soc_poweroff(drv->soc_card->dev); snd_soc_poweroff(drv->soc_card->dev);
/* set the SSPs to idle */ /* set the SSPs to idle */
for (i = 0; i < drv->soc_card->num_rtd; i++) { list_for_each_entry(rtd, &drv->soc_card->rtd_list, list) {
struct snd_soc_dai *dai = drv->soc_card->rtd[i].cpu_dai; struct snd_soc_dai *dai = rtd->cpu_dai;
if (dai->active) { if (dai->active) {
send_ssp_cmd(dai, dai->name, 0); send_ssp_cmd(dai, dai->name, 0);
...@@ -782,11 +790,11 @@ static int sst_soc_prepare(struct device *dev) ...@@ -782,11 +790,11 @@ static int sst_soc_prepare(struct device *dev)
static void sst_soc_complete(struct device *dev) static void sst_soc_complete(struct device *dev)
{ {
struct sst_data *drv = dev_get_drvdata(dev); struct sst_data *drv = dev_get_drvdata(dev);
int i; struct snd_soc_pcm_runtime *rtd;
/* restart SSPs */ /* restart SSPs */
for (i = 0; i < drv->soc_card->num_rtd; i++) { list_for_each_entry(rtd, &drv->soc_card->rtd_list, list) {
struct snd_soc_dai *dai = drv->soc_card->rtd[i].cpu_dai; struct snd_soc_dai *dai = rtd->cpu_dai;
if (dai->active) { if (dai->active) {
sst_handle_vb_timer(dai, true); sst_handle_vb_timer(dai, true);
......
...@@ -40,18 +40,9 @@ ...@@ -40,18 +40,9 @@
#include <acpi/acpi_bus.h> #include <acpi/acpi_bus.h>
#include "../sst-mfld-platform.h" #include "../sst-mfld-platform.h"
#include "../../common/sst-dsp.h" #include "../../common/sst-dsp.h"
#include "../../common/sst-acpi.h"
#include "sst.h" #include "sst.h"
struct sst_machines {
char *codec_id;
char board[32];
char machine[32];
void (*machine_quirk)(void);
char firmware[FW_NAME_SIZE];
struct sst_platform_info *pdata;
};
/* LPE viewpoint addresses */ /* LPE viewpoint addresses */
#define SST_BYT_IRAM_PHY_START 0xff2c0000 #define SST_BYT_IRAM_PHY_START 0xff2c0000
#define SST_BYT_IRAM_PHY_END 0xff2d4000 #define SST_BYT_IRAM_PHY_END 0xff2d4000
...@@ -223,37 +214,16 @@ static int sst_platform_get_resources(struct intel_sst_drv *ctx) ...@@ -223,37 +214,16 @@ static int sst_platform_get_resources(struct intel_sst_drv *ctx)
return 0; return 0;
} }
static acpi_status sst_acpi_mach_match(acpi_handle handle, u32 level,
void *context, void **ret)
{
*(bool *)context = true;
return AE_OK;
}
static struct sst_machines *sst_acpi_find_machine(
struct sst_machines *machines)
{
struct sst_machines *mach;
bool found = false;
for (mach = machines; mach->codec_id; mach++)
if (ACPI_SUCCESS(acpi_get_devices(mach->codec_id,
sst_acpi_mach_match,
&found, NULL)) && found)
return mach;
return NULL;
}
static int sst_acpi_probe(struct platform_device *pdev) static int sst_acpi_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
int ret = 0; int ret = 0;
struct intel_sst_drv *ctx; struct intel_sst_drv *ctx;
const struct acpi_device_id *id; const struct acpi_device_id *id;
struct sst_machines *mach; struct sst_acpi_mach *mach;
struct platform_device *mdev; struct platform_device *mdev;
struct platform_device *plat_dev; struct platform_device *plat_dev;
struct sst_platform_info *pdata;
unsigned int dev_id; unsigned int dev_id;
id = acpi_match_device(dev->driver->acpi_match_table, dev); id = acpi_match_device(dev->driver->acpi_match_table, dev);
...@@ -261,12 +231,13 @@ static int sst_acpi_probe(struct platform_device *pdev) ...@@ -261,12 +231,13 @@ static int sst_acpi_probe(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
dev_dbg(dev, "for %s", id->id); dev_dbg(dev, "for %s", id->id);
mach = (struct sst_machines *)id->driver_data; mach = (struct sst_acpi_mach *)id->driver_data;
mach = sst_acpi_find_machine(mach); mach = sst_acpi_find_machine(mach);
if (mach == NULL) { if (mach == NULL) {
dev_err(dev, "No matching machine driver found\n"); dev_err(dev, "No matching machine driver found\n");
return -ENODEV; return -ENODEV;
} }
pdata = mach->pdata;
ret = kstrtouint(id->id, 16, &dev_id); ret = kstrtouint(id->id, 16, &dev_id);
if (ret < 0) { if (ret < 0) {
...@@ -276,16 +247,23 @@ static int sst_acpi_probe(struct platform_device *pdev) ...@@ -276,16 +247,23 @@ static int sst_acpi_probe(struct platform_device *pdev)
dev_dbg(dev, "ACPI device id: %x\n", dev_id); dev_dbg(dev, "ACPI device id: %x\n", dev_id);
plat_dev = platform_device_register_data(dev, mach->pdata->platform, -1, NULL, 0); plat_dev = platform_device_register_data(dev, pdata->platform, -1,
NULL, 0);
if (IS_ERR(plat_dev)) { if (IS_ERR(plat_dev)) {
dev_err(dev, "Failed to create machine device: %s\n", mach->pdata->platform); dev_err(dev, "Failed to create machine device: %s\n",
pdata->platform);
return PTR_ERR(plat_dev); return PTR_ERR(plat_dev);
} }
/* Create platform device for sst machine driver */ /*
mdev = platform_device_register_data(dev, mach->machine, -1, NULL, 0); * Create platform device for sst machine driver,
* pass machine info as pdata
*/
mdev = platform_device_register_data(dev, mach->drv_name, -1,
(const void *)mach, sizeof(*mach));
if (IS_ERR(mdev)) { if (IS_ERR(mdev)) {
dev_err(dev, "Failed to create machine device: %s\n", mach->machine); dev_err(dev, "Failed to create machine device: %s\n",
mach->drv_name);
return PTR_ERR(mdev); return PTR_ERR(mdev);
} }
...@@ -294,8 +272,8 @@ static int sst_acpi_probe(struct platform_device *pdev) ...@@ -294,8 +272,8 @@ static int sst_acpi_probe(struct platform_device *pdev)
return ret; return ret;
/* Fill sst platform data */ /* Fill sst platform data */
ctx->pdata = mach->pdata; ctx->pdata = pdata;
strcpy(ctx->firmware_name, mach->firmware); strcpy(ctx->firmware_name, mach->fw_filename);
ret = sst_platform_get_resources(ctx); ret = sst_platform_get_resources(ctx);
if (ret) if (ret)
...@@ -342,22 +320,28 @@ static int sst_acpi_remove(struct platform_device *pdev) ...@@ -342,22 +320,28 @@ static int sst_acpi_remove(struct platform_device *pdev)
return 0; return 0;
} }
static struct sst_machines sst_acpi_bytcr[] = { static struct sst_acpi_mach sst_acpi_bytcr[] = {
{"10EC5640", "T100", "bytt100_rt5640", NULL, "intel/fw_sst_0f28.bin", {"10EC5640", "bytcr_rt5640", "intel/fw_sst_0f28.bin", "bytcr_rt5640", NULL,
&byt_rvp_platform_data },
{"10EC5642", "bytcr_rt5640", "intel/fw_sst_0f28.bin", "bytcr_rt5640", NULL,
&byt_rvp_platform_data },
{"INTCCFFD", "bytcr_rt5640", "intel/fw_sst_0f28.bin", "bytcr_rt5640", NULL,
&byt_rvp_platform_data },
{"10EC5651", "bytcr_rt5651", "intel/fw_sst_0f28.bin", "bytcr_rt5651", NULL,
&byt_rvp_platform_data }, &byt_rvp_platform_data },
{}, {},
}; };
/* Cherryview-based platforms: CherryTrail and Braswell */ /* Cherryview-based platforms: CherryTrail and Braswell */
static struct sst_machines sst_acpi_chv[] = { static struct sst_acpi_mach sst_acpi_chv[] = {
{"10EC5670", "cht-bsw", "cht-bsw-rt5672", NULL, "intel/fw_sst_22a8.bin", {"10EC5670", "cht-bsw-rt5672", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
&chv_platform_data },
{"10EC5645", "cht-bsw-rt5645", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
&chv_platform_data }, &chv_platform_data },
{"10EC5645", "cht-bsw", "cht-bsw-rt5645", NULL, "intel/fw_sst_22a8.bin", {"10EC5650", "cht-bsw-rt5645", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
&chv_platform_data }, &chv_platform_data },
{"10EC5650", "cht-bsw", "cht-bsw-rt5645", NULL, "intel/fw_sst_22a8.bin", {"193C9890", "cht-bsw-max98090", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
&chv_platform_data }, &chv_platform_data },
{"193C9890", "cht-bsw", "cht-bsw-max98090", NULL,
"intel/fw_sst_22a8.bin", &chv_platform_data },
{}, {},
}; };
......
...@@ -108,7 +108,7 @@ int sst_alloc_stream_mrfld(struct intel_sst_drv *sst_drv_ctx, void *params) ...@@ -108,7 +108,7 @@ int sst_alloc_stream_mrfld(struct intel_sst_drv *sst_drv_ctx, void *params)
str_id, pipe_id); str_id, pipe_id);
ret = sst_prepare_and_post_msg(sst_drv_ctx, task_id, IPC_CMD, ret = sst_prepare_and_post_msg(sst_drv_ctx, task_id, IPC_CMD,
IPC_IA_ALLOC_STREAM_MRFLD, pipe_id, sizeof(alloc_param), IPC_IA_ALLOC_STREAM_MRFLD, pipe_id, sizeof(alloc_param),
&alloc_param, data, true, true, false, true); &alloc_param, &data, true, true, false, true);
if (ret < 0) { if (ret < 0) {
dev_err(sst_drv_ctx->dev, "FW alloc failed ret %d\n", ret); dev_err(sst_drv_ctx->dev, "FW alloc failed ret %d\n", ret);
......
...@@ -3,17 +3,23 @@ snd-soc-sst-byt-rt5640-mach-objs := byt-rt5640.o ...@@ -3,17 +3,23 @@ snd-soc-sst-byt-rt5640-mach-objs := byt-rt5640.o
snd-soc-sst-byt-max98090-mach-objs := byt-max98090.o snd-soc-sst-byt-max98090-mach-objs := byt-max98090.o
snd-soc-sst-broadwell-objs := broadwell.o snd-soc-sst-broadwell-objs := broadwell.o
snd-soc-sst-bytcr-rt5640-objs := bytcr_rt5640.o snd-soc-sst-bytcr-rt5640-objs := bytcr_rt5640.o
snd-soc-sst-bytcr-rt5651-objs := bytcr_rt5651.o
snd-soc-sst-cht-bsw-rt5672-objs := cht_bsw_rt5672.o snd-soc-sst-cht-bsw-rt5672-objs := cht_bsw_rt5672.o
snd-soc-sst-cht-bsw-rt5645-objs := cht_bsw_rt5645.o snd-soc-sst-cht-bsw-rt5645-objs := cht_bsw_rt5645.o
snd-soc-sst-cht-bsw-max98090_ti-objs := cht_bsw_max98090_ti.o snd-soc-sst-cht-bsw-max98090_ti-objs := cht_bsw_max98090_ti.o
snd-soc-skl_rt286-objs := skl_rt286.o snd-soc-skl_rt286-objs := skl_rt286.o
snd-skl_nau88l25_max98357a-objs := skl_nau88l25_max98357a.o
snd-soc-skl_nau88l25_ssm4567-objs := skl_nau88l25_ssm4567.o
obj-$(CONFIG_SND_SOC_INTEL_HASWELL_MACH) += snd-soc-sst-haswell.o obj-$(CONFIG_SND_SOC_INTEL_HASWELL_MACH) += snd-soc-sst-haswell.o
obj-$(CONFIG_SND_SOC_INTEL_BYT_RT5640_MACH) += snd-soc-sst-byt-rt5640-mach.o obj-$(CONFIG_SND_SOC_INTEL_BYT_RT5640_MACH) += snd-soc-sst-byt-rt5640-mach.o
obj-$(CONFIG_SND_SOC_INTEL_BYT_MAX98090_MACH) += snd-soc-sst-byt-max98090-mach.o obj-$(CONFIG_SND_SOC_INTEL_BYT_MAX98090_MACH) += snd-soc-sst-byt-max98090-mach.o
obj-$(CONFIG_SND_SOC_INTEL_BROADWELL_MACH) += snd-soc-sst-broadwell.o obj-$(CONFIG_SND_SOC_INTEL_BROADWELL_MACH) += snd-soc-sst-broadwell.o
obj-$(CONFIG_SND_SOC_INTEL_BYTCR_RT5640_MACH) += snd-soc-sst-bytcr-rt5640.o obj-$(CONFIG_SND_SOC_INTEL_BYTCR_RT5640_MACH) += snd-soc-sst-bytcr-rt5640.o
obj-$(CONFIG_SND_SOC_INTEL_BYTCR_RT5651_MACH) += snd-soc-sst-bytcr-rt5651.o
obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_RT5672_MACH) += snd-soc-sst-cht-bsw-rt5672.o obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_RT5672_MACH) += snd-soc-sst-cht-bsw-rt5672.o
obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_RT5645_MACH) += snd-soc-sst-cht-bsw-rt5645.o obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_RT5645_MACH) += snd-soc-sst-cht-bsw-rt5645.o
obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_MAX98090_TI_MACH) += snd-soc-sst-cht-bsw-max98090_ti.o obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_MAX98090_TI_MACH) += snd-soc-sst-cht-bsw-max98090_ti.o
obj-$(CONFIG_SND_SOC_INTEL_SKL_RT286_MACH) += snd-soc-skl_rt286.o obj-$(CONFIG_SND_SOC_INTEL_SKL_RT286_MACH) += snd-soc-skl_rt286.o
obj-$(CONFIG_SND_SOC_INTEL_SKL_NAU88L25_MAX98357A_MACH) += snd-skl_nau88l25_max98357a.o
obj-$(CONFIG_SND_SOC_INTEL_SKL_NAU88L25_SSM4567_MACH) += snd-soc-skl_nau88l25_ssm4567.o
This diff is collapsed.
/*
* bytcr_rt5651.c - ASoc Machine driver for Intel Byt CR platform
* (derived from bytcr_rt5640.c)
*
* Copyright (C) 2015 Intel Corp
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* 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/init.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/acpi.h>
#include <linux/device.h>
#include <linux/dmi.h>
#include <linux/slab.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/jack.h>
#include "../../codecs/rt5651.h"
#include "../atom/sst-atom-controls.h"
static const struct snd_soc_dapm_widget byt_rt5651_widgets[] = {
SND_SOC_DAPM_HP("Headphone", NULL),
SND_SOC_DAPM_MIC("Headset Mic", NULL),
SND_SOC_DAPM_MIC("Internal Mic", NULL),
SND_SOC_DAPM_SPK("Speaker", NULL),
};
static const struct snd_soc_dapm_route byt_rt5651_audio_map[] = {
{"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"},
{"Headset Mic", NULL, "micbias1"}, /* lowercase for rt5651 */
{"IN2P", NULL, "Headset Mic"},
{"Headphone", NULL, "HPOL"},
{"Headphone", NULL, "HPOR"},
{"Speaker", NULL, "LOUTL"},
{"Speaker", NULL, "LOUTR"},
};
static const struct snd_soc_dapm_route byt_rt5651_intmic_dmic1_map[] = {
{"DMIC1", NULL, "Internal Mic"},
};
static const struct snd_soc_dapm_route byt_rt5651_intmic_dmic2_map[] = {
{"DMIC2", NULL, "Internal Mic"},
};
static const struct snd_soc_dapm_route byt_rt5651_intmic_in1_map[] = {
{"Internal Mic", NULL, "micbias1"},
{"IN1P", NULL, "Internal Mic"},
};
enum {
BYT_RT5651_DMIC1_MAP,
BYT_RT5651_DMIC2_MAP,
BYT_RT5651_IN1_MAP,
};
#define BYT_RT5651_MAP(quirk) ((quirk) & 0xff)
#define BYT_RT5651_DMIC_EN BIT(16)
static unsigned long byt_rt5651_quirk = BYT_RT5651_DMIC1_MAP |
BYT_RT5651_DMIC_EN;
static const struct snd_kcontrol_new byt_rt5651_controls[] = {
SOC_DAPM_PIN_SWITCH("Headphone"),
SOC_DAPM_PIN_SWITCH("Headset Mic"),
SOC_DAPM_PIN_SWITCH("Internal Mic"),
SOC_DAPM_PIN_SWITCH("Speaker"),
};
static int byt_rt5651_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;
snd_soc_dai_set_bclk_ratio(codec_dai, 50);
ret = snd_soc_dai_set_sysclk(codec_dai, RT5651_SCLK_S_PLL1,
params_rate(params) * 512,
SND_SOC_CLOCK_IN);
if (ret < 0) {
dev_err(rtd->dev, "can't set codec clock %d\n", ret);
return ret;
}
ret = snd_soc_dai_set_pll(codec_dai, 0, RT5651_PLL1_S_BCLK1,
params_rate(params) * 50,
params_rate(params) * 512);
if (ret < 0) {
dev_err(rtd->dev, "can't set codec pll: %d\n", ret);
return ret;
}
return 0;
}
static const struct dmi_system_id byt_rt5651_quirk_table[] = {
{}
};
static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
{
int ret;
struct snd_soc_card *card = runtime->card;
const struct snd_soc_dapm_route *custom_map;
int num_routes;
card->dapm.idle_bias_off = true;
dmi_check_system(byt_rt5651_quirk_table);
switch (BYT_RT5651_MAP(byt_rt5651_quirk)) {
case BYT_RT5651_IN1_MAP:
custom_map = byt_rt5651_intmic_in1_map;
num_routes = ARRAY_SIZE(byt_rt5651_intmic_in1_map);
break;
case BYT_RT5651_DMIC2_MAP:
custom_map = byt_rt5651_intmic_dmic2_map;
num_routes = ARRAY_SIZE(byt_rt5651_intmic_dmic2_map);
break;
default:
custom_map = byt_rt5651_intmic_dmic1_map;
num_routes = ARRAY_SIZE(byt_rt5651_intmic_dmic1_map);
}
ret = snd_soc_add_card_controls(card, byt_rt5651_controls,
ARRAY_SIZE(byt_rt5651_controls));
if (ret) {
dev_err(card->dev, "unable to add card controls\n");
return ret;
}
snd_soc_dapm_ignore_suspend(&card->dapm, "Headphone");
snd_soc_dapm_ignore_suspend(&card->dapm, "Speaker");
return ret;
}
static const struct snd_soc_pcm_stream byt_rt5651_dai_params = {
.formats = SNDRV_PCM_FMTBIT_S24_LE,
.rate_min = 48000,
.rate_max = 48000,
.channels_min = 2,
.channels_max = 2,
};
static int byt_rt5651_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);
int ret;
/* 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);
/*
* Default mode for SSP configuration is TDM 4 slot, override config
* with explicit setting to I2S 2ch 24-bit. The word length is set with
* dai_set_tdm_slot() since there is no other API exposed
*/
ret = snd_soc_dai_set_fmt(rtd->cpu_dai,
SND_SOC_DAIFMT_I2S |
SND_SOC_DAIFMT_NB_IF |
SND_SOC_DAIFMT_CBS_CFS
);
if (ret < 0) {
dev_err(rtd->dev, "can't set format to I2S, err %d\n", ret);
return ret;
}
ret = snd_soc_dai_set_tdm_slot(rtd->cpu_dai, 0x3, 0x3, 2, 24);
if (ret < 0) {
dev_err(rtd->dev, "can't set I2S config, err %d\n", ret);
return ret;
}
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 byt_rt5651_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 byt_rt5651_aif1_ops = {
.startup = byt_rt5651_aif1_startup,
};
static struct snd_soc_ops byt_rt5651_be_ssp2_ops = {
.hw_params = byt_rt5651_aif1_hw_params,
};
static struct snd_soc_dai_link byt_rt5651_dais[] = {
[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,
.nonatomic = true,
.dynamic = 1,
.dpcm_playback = 1,
.dpcm_capture = 1,
.ops = &byt_rt5651_aif1_ops,
},
[MERR_DPCM_DEEP_BUFFER] = {
.name = "Deep-Buffer Audio Port",
.stream_name = "Deep-Buffer Audio",
.cpu_dai_name = "deepbuffer-cpu-dai",
.codec_dai_name = "snd-soc-dummy-dai",
.codec_name = "snd-soc-dummy",
.platform_name = "sst-mfld-platform",
.ignore_suspend = 1,
.nonatomic = true,
.dynamic = 1,
.dpcm_playback = 1,
.ops = &byt_rt5651_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 = "rt5651-aif1",
.codec_name = "i2c-10EC5651:00",
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
| SND_SOC_DAIFMT_CBS_CFS,
.be_hw_params_fixup = byt_rt5651_codec_fixup,
.ignore_suspend = 1,
.nonatomic = true,
.dpcm_playback = 1,
.dpcm_capture = 1,
.init = byt_rt5651_init,
.ops = &byt_rt5651_be_ssp2_ops,
},
};
/* SoC card */
static struct snd_soc_card byt_rt5651_card = {
.name = "bytcr-rt5651",
.owner = THIS_MODULE,
.dai_link = byt_rt5651_dais,
.num_links = ARRAY_SIZE(byt_rt5651_dais),
.dapm_widgets = byt_rt5651_widgets,
.num_dapm_widgets = ARRAY_SIZE(byt_rt5651_widgets),
.dapm_routes = byt_rt5651_audio_map,
.num_dapm_routes = ARRAY_SIZE(byt_rt5651_audio_map),
.fully_routed = true,
};
static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
{
int ret_val = 0;
/* register the soc card */
byt_rt5651_card.dev = &pdev->dev;
ret_val = devm_snd_soc_register_card(&pdev->dev, &byt_rt5651_card);
if (ret_val) {
dev_err(&pdev->dev, "devm_snd_soc_register_card failed %d\n",
ret_val);
return ret_val;
}
platform_set_drvdata(pdev, &byt_rt5651_card);
return ret_val;
}
static struct platform_driver snd_byt_rt5651_mc_driver = {
.driver = {
.name = "bytcr_rt5651",
.pm = &snd_soc_pm_ops,
},
.probe = snd_byt_rt5651_mc_probe,
};
module_platform_driver(snd_byt_rt5651_mc_driver);
MODULE_DESCRIPTION("ASoC Intel(R) Baytrail CR Machine driver for RT5651");
MODULE_AUTHOR("Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>");
MODULE_LICENSE("GPL v2");
MODULE_ALIAS("platform:bytcr_rt5651");
...@@ -41,12 +41,9 @@ struct cht_mc_private { ...@@ -41,12 +41,9 @@ struct cht_mc_private {
static inline struct snd_soc_dai *cht_get_codec_dai(struct snd_soc_card *card) static inline struct snd_soc_dai *cht_get_codec_dai(struct snd_soc_card *card)
{ {
int i; struct snd_soc_pcm_runtime *rtd;
for (i = 0; i < card->num_rtd; i++) { list_for_each_entry(rtd, &card->rtd_list, list) {
struct snd_soc_pcm_runtime *rtd;
rtd = card->rtd + i;
if (!strncmp(rtd->codec_dai->name, CHT_CODEC_DAI, if (!strncmp(rtd->codec_dai->name, CHT_CODEC_DAI,
strlen(CHT_CODEC_DAI))) strlen(CHT_CODEC_DAI)))
return rtd->codec_dai; return rtd->codec_dai;
...@@ -235,6 +232,18 @@ static struct snd_soc_dai_link cht_dailink[] = { ...@@ -235,6 +232,18 @@ static struct snd_soc_dai_link cht_dailink[] = {
.dpcm_capture = 1, .dpcm_capture = 1,
.ops = &cht_aif1_ops, .ops = &cht_aif1_ops,
}, },
[MERR_DPCM_DEEP_BUFFER] = {
.name = "Deep-Buffer Audio Port",
.stream_name = "Deep-Buffer Audio",
.cpu_dai_name = "deepbuffer-cpu-dai",
.codec_dai_name = "snd-soc-dummy-dai",
.codec_name = "snd-soc-dummy",
.platform_name = "sst-mfld-platform",
.nonatomic = true,
.dynamic = 1,
.dpcm_playback = 1,
.ops = &cht_aif1_ops,
},
[MERR_DPCM_COMPR] = { [MERR_DPCM_COMPR] = {
.name = "Compressed Port", .name = "Compressed Port",
.stream_name = "Compress", .stream_name = "Compress",
......
...@@ -47,12 +47,9 @@ struct cht_mc_private { ...@@ -47,12 +47,9 @@ struct cht_mc_private {
static inline struct snd_soc_dai *cht_get_codec_dai(struct snd_soc_card *card) static inline struct snd_soc_dai *cht_get_codec_dai(struct snd_soc_card *card)
{ {
int i; struct snd_soc_pcm_runtime *rtd;
for (i = 0; i < card->num_rtd; i++) {
struct snd_soc_pcm_runtime *rtd;
rtd = card->rtd + i; list_for_each_entry(rtd, &card->rtd_list, list) {
if (!strncmp(rtd->codec_dai->name, CHT_CODEC_DAI, if (!strncmp(rtd->codec_dai->name, CHT_CODEC_DAI,
strlen(CHT_CODEC_DAI))) strlen(CHT_CODEC_DAI)))
return rtd->codec_dai; return rtd->codec_dai;
...@@ -263,6 +260,18 @@ static struct snd_soc_dai_link cht_dailink[] = { ...@@ -263,6 +260,18 @@ static struct snd_soc_dai_link cht_dailink[] = {
.dpcm_capture = 1, .dpcm_capture = 1,
.ops = &cht_aif1_ops, .ops = &cht_aif1_ops,
}, },
[MERR_DPCM_DEEP_BUFFER] = {
.name = "Deep-Buffer Audio Port",
.stream_name = "Deep-Buffer Audio",
.cpu_dai_name = "deepbuffer-cpu-dai",
.codec_dai_name = "snd-soc-dummy-dai",
.codec_name = "snd-soc-dummy",
.platform_name = "sst-mfld-platform",
.nonatomic = true,
.dynamic = 1,
.dpcm_playback = 1,
.ops = &cht_aif1_ops,
},
[MERR_DPCM_COMPR] = { [MERR_DPCM_COMPR] = {
.name = "Compressed Port", .name = "Compressed Port",
.stream_name = "Compress", .stream_name = "Compress",
......
...@@ -46,12 +46,9 @@ static struct snd_soc_jack_pin cht_bsw_headset_pins[] = { ...@@ -46,12 +46,9 @@ static struct snd_soc_jack_pin cht_bsw_headset_pins[] = {
static inline struct snd_soc_dai *cht_get_codec_dai(struct snd_soc_card *card) static inline struct snd_soc_dai *cht_get_codec_dai(struct snd_soc_card *card)
{ {
int i; struct snd_soc_pcm_runtime *rtd;
for (i = 0; i < card->num_rtd; i++) { list_for_each_entry(rtd, &card->rtd_list, list) {
struct snd_soc_pcm_runtime *rtd;
rtd = card->rtd + i;
if (!strncmp(rtd->codec_dai->name, CHT_CODEC_DAI, if (!strncmp(rtd->codec_dai->name, CHT_CODEC_DAI,
strlen(CHT_CODEC_DAI))) strlen(CHT_CODEC_DAI)))
return rtd->codec_dai; return rtd->codec_dai;
...@@ -251,6 +248,18 @@ static struct snd_soc_dai_link cht_dailink[] = { ...@@ -251,6 +248,18 @@ static struct snd_soc_dai_link cht_dailink[] = {
.dpcm_capture = 1, .dpcm_capture = 1,
.ops = &cht_aif1_ops, .ops = &cht_aif1_ops,
}, },
[MERR_DPCM_DEEP_BUFFER] = {
.name = "Deep-Buffer Audio Port",
.stream_name = "Deep-Buffer Audio",
.cpu_dai_name = "deepbuffer-cpu-dai",
.codec_dai_name = "snd-soc-dummy-dai",
.codec_name = "snd-soc-dummy",
.platform_name = "sst-mfld-platform",
.nonatomic = true,
.dynamic = 1,
.dpcm_playback = 1,
.ops = &cht_aif1_ops,
},
[MERR_DPCM_COMPR] = { [MERR_DPCM_COMPR] = {
.name = "Compressed Port", .name = "Compressed Port",
.stream_name = "Compress", .stream_name = "Compress",
......
This diff is collapsed.
This diff is collapsed.
...@@ -52,6 +52,7 @@ static const struct snd_soc_dapm_widget skylake_widgets[] = { ...@@ -52,6 +52,7 @@ static const struct snd_soc_dapm_widget skylake_widgets[] = {
SND_SOC_DAPM_MIC("Mic Jack", NULL), SND_SOC_DAPM_MIC("Mic Jack", NULL),
SND_SOC_DAPM_MIC("DMIC2", NULL), SND_SOC_DAPM_MIC("DMIC2", NULL),
SND_SOC_DAPM_MIC("SoC DMIC", NULL), SND_SOC_DAPM_MIC("SoC DMIC", NULL),
SND_SOC_DAPM_SINK("WoV Sink"),
}; };
static const struct snd_soc_dapm_route skylake_rt286_map[] = { static const struct snd_soc_dapm_route skylake_rt286_map[] = {
...@@ -67,7 +68,9 @@ static const struct snd_soc_dapm_route skylake_rt286_map[] = { ...@@ -67,7 +68,9 @@ static const struct snd_soc_dapm_route skylake_rt286_map[] = {
/* digital mics */ /* digital mics */
{"DMIC1 Pin", NULL, "DMIC2"}, {"DMIC1 Pin", NULL, "DMIC2"},
{"DMIC AIF", NULL, "SoC DMIC"}, {"DMic", NULL, "SoC DMIC"},
{"WoV Sink", NULL, "hwd_in sink"},
/* CODEC BE connections */ /* CODEC BE connections */
{ "AIF1 Playback", NULL, "ssp0 Tx"}, { "AIF1 Playback", NULL, "ssp0 Tx"},
...@@ -79,13 +82,24 @@ static const struct snd_soc_dapm_route skylake_rt286_map[] = { ...@@ -79,13 +82,24 @@ static const struct snd_soc_dapm_route skylake_rt286_map[] = {
{ "ssp0 Rx", NULL, "AIF1 Capture" }, { "ssp0 Rx", NULL, "AIF1 Capture" },
{ "dmic01_hifi", NULL, "DMIC01 Rx" }, { "dmic01_hifi", NULL, "DMIC01 Rx" },
{ "DMIC01 Rx", NULL, "Capture" }, { "DMIC01 Rx", NULL, "DMIC AIF" },
{ "hif1", NULL, "iDisp Tx"}, { "hif1", NULL, "iDisp Tx"},
{ "iDisp Tx", NULL, "iDisp_out"}, { "iDisp Tx", NULL, "iDisp_out"},
}; };
static int skylake_rt286_fe_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_dapm_context *dapm;
struct snd_soc_component *component = rtd->cpu_dai->component;
dapm = snd_soc_component_get_dapm(component);
snd_soc_dapm_ignore_suspend(dapm, "Reference Capture");
return 0;
}
static int skylake_rt286_codec_init(struct snd_soc_pcm_runtime *rtd) static int skylake_rt286_codec_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_codec *codec = rtd->codec; struct snd_soc_codec *codec = rtd->codec;
...@@ -101,9 +115,59 @@ static int skylake_rt286_codec_init(struct snd_soc_pcm_runtime *rtd) ...@@ -101,9 +115,59 @@ static int skylake_rt286_codec_init(struct snd_soc_pcm_runtime *rtd)
rt286_mic_detect(codec, &skylake_headset); rt286_mic_detect(codec, &skylake_headset);
snd_soc_dapm_ignore_suspend(&rtd->card->dapm, "SoC DMIC");
snd_soc_dapm_ignore_suspend(&rtd->card->dapm, "WoV Sink");
return 0; return 0;
} }
static unsigned int rates[] = {
48000,
};
static struct snd_pcm_hw_constraint_list constraints_rates = {
.count = ARRAY_SIZE(rates),
.list = rates,
.mask = 0,
};
static unsigned int channels[] = {
2,
};
static struct snd_pcm_hw_constraint_list constraints_channels = {
.count = ARRAY_SIZE(channels),
.list = channels,
.mask = 0,
};
static int skl_fe_startup(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
/*
* on this platform for PCM device we support,
* 48Khz
* stereo
* 16 bit audio
*/
runtime->hw.channels_max = 2;
snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
&constraints_channels);
runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
snd_pcm_hw_constraint_msbits(runtime, 0, 16, 16);
snd_pcm_hw_constraint_list(runtime, 0,
SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
return 0;
}
static const struct snd_soc_ops skylake_rt286_fe_ops = {
.startup = skl_fe_startup,
};
static int skylake_ssp0_fixup(struct snd_soc_pcm_runtime *rtd, static int skylake_ssp0_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params)
...@@ -112,12 +176,15 @@ static int skylake_ssp0_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -112,12 +176,15 @@ static int skylake_ssp0_fixup(struct snd_soc_pcm_runtime *rtd,
SNDRV_PCM_HW_PARAM_RATE); SNDRV_PCM_HW_PARAM_RATE);
struct snd_interval *channels = hw_param_interval(params, struct snd_interval *channels = hw_param_interval(params,
SNDRV_PCM_HW_PARAM_CHANNELS); SNDRV_PCM_HW_PARAM_CHANNELS);
struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
/* The output is 48KHz, stereo, 16bits */ /* The output is 48KHz, stereo, 16bits */
rate->min = rate->max = 48000; rate->min = rate->max = 48000;
channels->min = channels->max = 2; channels->min = channels->max = 2;
params_set_format(params, SNDRV_PCM_FORMAT_S16_LE);
/* set SSP0 to 24 bit */
snd_mask_none(fmt);
snd_mask_set(fmt, SNDRV_PCM_FORMAT_S24_LE);
return 0; return 0;
} }
...@@ -140,6 +207,42 @@ static struct snd_soc_ops skylake_rt286_ops = { ...@@ -140,6 +207,42 @@ static struct snd_soc_ops skylake_rt286_ops = {
.hw_params = skylake_rt286_hw_params, .hw_params = skylake_rt286_hw_params,
}; };
static int skylake_dmic_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params)
{
struct snd_interval *channels = hw_param_interval(params,
SNDRV_PCM_HW_PARAM_CHANNELS);
channels->min = channels->max = 4;
return 0;
}
static unsigned int channels_dmic[] = {
2, 4,
};
static struct snd_pcm_hw_constraint_list constraints_dmic_channels = {
.count = ARRAY_SIZE(channels_dmic),
.list = channels_dmic,
.mask = 0,
};
static int skylake_dmic_startup(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
runtime->hw.channels_max = 4;
snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
&constraints_dmic_channels);
return snd_pcm_hw_constraint_list(substream->runtime, 0,
SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
}
static struct snd_soc_ops skylake_dmic_ops = {
.startup = skylake_dmic_startup,
};
/* skylake digital audio interface glue - connects codec <--> CPU */ /* skylake digital audio interface glue - connects codec <--> CPU */
static struct snd_soc_dai_link skylake_rt286_dais[] = { static struct snd_soc_dai_link skylake_rt286_dais[] = {
/* Front End DAI links */ /* Front End DAI links */
...@@ -152,11 +255,13 @@ static struct snd_soc_dai_link skylake_rt286_dais[] = { ...@@ -152,11 +255,13 @@ static struct snd_soc_dai_link skylake_rt286_dais[] = {
.dynamic = 1, .dynamic = 1,
.codec_name = "snd-soc-dummy", .codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai", .codec_dai_name = "snd-soc-dummy-dai",
.init = skylake_rt286_fe_init,
.trigger = { .trigger = {
SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST SND_SOC_DPCM_TRIGGER_POST
}, },
.dpcm_playback = 1, .dpcm_playback = 1,
.ops = &skylake_rt286_fe_ops,
}, },
{ {
.name = "Skl Audio Capture Port", .name = "Skl Audio Capture Port",
...@@ -172,6 +277,7 @@ static struct snd_soc_dai_link skylake_rt286_dais[] = { ...@@ -172,6 +277,7 @@ static struct snd_soc_dai_link skylake_rt286_dais[] = {
SND_SOC_DPCM_TRIGGER_POST SND_SOC_DPCM_TRIGGER_POST
}, },
.dpcm_capture = 1, .dpcm_capture = 1,
.ops = &skylake_rt286_fe_ops,
}, },
{ {
.name = "Skl Audio Reference cap", .name = "Skl Audio Reference cap",
...@@ -186,6 +292,19 @@ static struct snd_soc_dai_link skylake_rt286_dais[] = { ...@@ -186,6 +292,19 @@ static struct snd_soc_dai_link skylake_rt286_dais[] = {
.nonatomic = 1, .nonatomic = 1,
.dynamic = 1, .dynamic = 1,
}, },
{
.name = "Skl Audio DMIC cap",
.stream_name = "dmiccap",
.cpu_dai_name = "DMIC Pin",
.codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai",
.platform_name = "0000:00:1f.3",
.init = NULL,
.dpcm_capture = 1,
.nonatomic = 1,
.dynamic = 1,
.ops = &skylake_dmic_ops,
},
/* Back End DAI links */ /* Back End DAI links */
{ {
...@@ -201,7 +320,6 @@ static struct snd_soc_dai_link skylake_rt286_dais[] = { ...@@ -201,7 +320,6 @@ static struct snd_soc_dai_link skylake_rt286_dais[] = {
.dai_fmt = SND_SOC_DAIFMT_I2S | .dai_fmt = SND_SOC_DAIFMT_I2S |
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS, SND_SOC_DAIFMT_CBS_CFS,
.ignore_suspend = 1,
.ignore_pmdown_time = 1, .ignore_pmdown_time = 1,
.be_hw_params_fixup = skylake_ssp0_fixup, .be_hw_params_fixup = skylake_ssp0_fixup,
.ops = &skylake_rt286_ops, .ops = &skylake_rt286_ops,
...@@ -215,6 +333,7 @@ static struct snd_soc_dai_link skylake_rt286_dais[] = { ...@@ -215,6 +333,7 @@ static struct snd_soc_dai_link skylake_rt286_dais[] = {
.codec_name = "dmic-codec", .codec_name = "dmic-codec",
.codec_dai_name = "dmic-hifi", .codec_dai_name = "dmic-hifi",
.platform_name = "0000:00:1f.3", .platform_name = "0000:00:1f.3",
.be_hw_params_fixup = skylake_dmic_fixup,
.ignore_suspend = 1, .ignore_suspend = 1,
.dpcm_capture = 1, .dpcm_capture = 1,
.no_pcm = 1, .no_pcm = 1,
...@@ -247,6 +366,7 @@ static struct platform_driver skylake_audio = { ...@@ -247,6 +366,7 @@ static struct platform_driver skylake_audio = {
.probe = skylake_audio_probe, .probe = skylake_audio_probe,
.driver = { .driver = {
.name = "skl_alc286s_i2s", .name = "skl_alc286s_i2s",
.pm = &snd_soc_pm_ops,
}, },
}; };
......
snd-soc-sst-dsp-objs := sst-dsp.o snd-soc-sst-dsp-objs := sst-dsp.o
snd-soc-sst-acpi-objs := sst-acpi.o ifneq ($(CONFIG_SND_SST_IPC_ACPI),)
snd-soc-sst-acpi-objs := sst-match-acpi.o
else
snd-soc-sst-acpi-objs := sst-acpi.o sst-match-acpi.o
endif
snd-soc-sst-ipc-objs := sst-ipc.o snd-soc-sst-ipc-objs := sst-ipc.o
ifneq ($(CONFIG_DW_DMAC_CORE),) snd-soc-sst-dsp-$(CONFIG_DW_DMAC_CORE) += sst-firmware.o
snd-soc-sst-dsp-objs += sst-firmware.o
endif
obj-$(CONFIG_SND_SOC_INTEL_SST) += snd-soc-sst-dsp.o snd-soc-sst-ipc.o obj-$(CONFIG_SND_SOC_INTEL_SST) += snd-soc-sst-dsp.o snd-soc-sst-ipc.o
obj-$(CONFIG_SND_SOC_INTEL_SST_ACPI) += snd-soc-sst-acpi.o obj-$(CONFIG_SND_SOC_INTEL_SST_ACPI) += snd-soc-sst-acpi.o
...@@ -21,21 +21,12 @@ ...@@ -21,21 +21,12 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include "sst-dsp.h" #include "sst-dsp.h"
#include "sst-acpi.h"
#define SST_LPT_DSP_DMA_ADDR_OFFSET 0x0F0000 #define SST_LPT_DSP_DMA_ADDR_OFFSET 0x0F0000
#define SST_WPT_DSP_DMA_ADDR_OFFSET 0x0FE000 #define SST_WPT_DSP_DMA_ADDR_OFFSET 0x0FE000
#define SST_LPT_DSP_DMA_SIZE (1024 - 1) #define SST_LPT_DSP_DMA_SIZE (1024 - 1)
/* Descriptor for SST ASoC machine driver */
struct sst_acpi_mach {
/* ACPI ID for the matching machine driver. Audio codec for instance */
const u8 id[ACPI_ID_LEN];
/* machine driver name */
const char *drv_name;
/* firmware file name */
const char *fw_filename;
};
/* Descriptor for setting up SST platform data */ /* Descriptor for setting up SST platform data */
struct sst_acpi_desc { struct sst_acpi_desc {
const char *drv_name; const char *drv_name;
...@@ -88,28 +79,6 @@ static void sst_acpi_fw_cb(const struct firmware *fw, void *context) ...@@ -88,28 +79,6 @@ static void sst_acpi_fw_cb(const struct firmware *fw, void *context)
return; return;
} }
static acpi_status sst_acpi_mach_match(acpi_handle handle, u32 level,
void *context, void **ret)
{
*(bool *)context = true;
return AE_OK;
}
static struct sst_acpi_mach *sst_acpi_find_machine(
struct sst_acpi_mach *machines)
{
struct sst_acpi_mach *mach;
bool found = false;
for (mach = machines; mach->id[0]; mach++)
if (ACPI_SUCCESS(acpi_get_devices(mach->id,
sst_acpi_mach_match,
&found, NULL)) && found)
return mach;
return NULL;
}
static int sst_acpi_probe(struct platform_device *pdev) static int sst_acpi_probe(struct platform_device *pdev)
{ {
const struct acpi_device_id *id; const struct acpi_device_id *id;
...@@ -211,7 +180,7 @@ static int sst_acpi_remove(struct platform_device *pdev) ...@@ -211,7 +180,7 @@ static int sst_acpi_remove(struct platform_device *pdev)
} }
static struct sst_acpi_mach haswell_machines[] = { static struct sst_acpi_mach haswell_machines[] = {
{ "INT33CA", "haswell-audio", "intel/IntcSST1.bin" }, { "INT33CA", "haswell-audio", "intel/IntcSST1.bin", NULL, NULL, NULL },
{} {}
}; };
...@@ -229,7 +198,7 @@ static struct sst_acpi_desc sst_acpi_haswell_desc = { ...@@ -229,7 +198,7 @@ static struct sst_acpi_desc sst_acpi_haswell_desc = {
}; };
static struct sst_acpi_mach broadwell_machines[] = { static struct sst_acpi_mach broadwell_machines[] = {
{ "INT343A", "broadwell-audio", "intel/IntcSST2.bin" }, { "INT343A", "broadwell-audio", "intel/IntcSST2.bin", NULL, NULL, NULL },
{} {}
}; };
...@@ -247,8 +216,8 @@ static struct sst_acpi_desc sst_acpi_broadwell_desc = { ...@@ -247,8 +216,8 @@ static struct sst_acpi_desc sst_acpi_broadwell_desc = {
}; };
static struct sst_acpi_mach baytrail_machines[] = { static struct sst_acpi_mach baytrail_machines[] = {
{ "10EC5640", "byt-rt5640", "intel/fw_sst_0f28.bin-48kHz_i2s_master" }, { "10EC5640", "byt-rt5640", "intel/fw_sst_0f28.bin-48kHz_i2s_master", NULL, NULL, NULL },
{ "193C9890", "byt-max98090", "intel/fw_sst_0f28.bin-48kHz_i2s_master" }, { "193C9890", "byt-max98090", "intel/fw_sst_0f28.bin-48kHz_i2s_master", NULL, NULL, NULL },
{} {}
}; };
......
/*
* Copyright (C) 2013-15, Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version
* 2 as published by the Free Software Foundation.
*
* 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/acpi.h>
/* acpi match */
struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines);
/* Descriptor for SST ASoC machine driver */
struct sst_acpi_mach {
/* ACPI ID for the matching machine driver. Audio codec for instance */
const u8 id[ACPI_ID_LEN];
/* machine driver name */
const char *drv_name;
/* firmware file name */
const char *fw_filename;
/* board name */
const char *board;
void (*machine_quirk)(void);
void *pdata;
};
...@@ -243,7 +243,7 @@ struct sst_mem_block { ...@@ -243,7 +243,7 @@ struct sst_mem_block {
u32 size; /* block size */ u32 size; /* block size */
u32 index; /* block index 0..N */ u32 index; /* block index 0..N */
enum sst_mem_type type; /* block memory type IRAM/DRAM */ enum sst_mem_type type; /* block memory type IRAM/DRAM */
struct sst_block_ops *ops; /* block operations, if any */ const struct sst_block_ops *ops;/* block operations, if any */
/* block status */ /* block status */
u32 bytes_used; /* bytes in use by modules */ u32 bytes_used; /* bytes in use by modules */
...@@ -308,6 +308,8 @@ struct sst_dsp { ...@@ -308,6 +308,8 @@ struct sst_dsp {
/* SKL data */ /* SKL data */
const char *fw_name;
/* To allocate CL dma buffers */ /* To allocate CL dma buffers */
struct skl_dsp_loader_ops dsp_ops; struct skl_dsp_loader_ops dsp_ops;
struct skl_dsp_fw_ops fw_ops; struct skl_dsp_fw_ops fw_ops;
...@@ -376,8 +378,8 @@ void sst_block_free_scratch(struct sst_dsp *dsp); ...@@ -376,8 +378,8 @@ void sst_block_free_scratch(struct sst_dsp *dsp);
/* Register the DSPs memory blocks - would be nice to read from ACPI */ /* Register the DSPs memory blocks - would be nice to read from ACPI */
struct sst_mem_block *sst_mem_block_register(struct sst_dsp *dsp, u32 offset, struct sst_mem_block *sst_mem_block_register(struct sst_dsp *dsp, u32 offset,
u32 size, enum sst_mem_type type, struct sst_block_ops *ops, u32 index, u32 size, enum sst_mem_type type, const struct sst_block_ops *ops,
void *private); u32 index, void *private);
void sst_mem_block_unregister_all(struct sst_dsp *dsp); void sst_mem_block_unregister_all(struct sst_dsp *dsp);
/* Create/Free DMA resources */ /* Create/Free DMA resources */
......
...@@ -420,7 +420,7 @@ void sst_dsp_inbox_read(struct sst_dsp *sst, void *message, size_t bytes) ...@@ -420,7 +420,7 @@ void sst_dsp_inbox_read(struct sst_dsp *sst, void *message, size_t bytes)
} }
EXPORT_SYMBOL_GPL(sst_dsp_inbox_read); EXPORT_SYMBOL_GPL(sst_dsp_inbox_read);
#if IS_ENABLED(CONFIG_DW_DMAC_CORE) #ifdef CONFIG_DW_DMAC_CORE
struct sst_dsp *sst_dsp_new(struct device *dev, struct sst_dsp *sst_dsp_new(struct device *dev,
struct sst_dsp_device *sst_dev, struct sst_pdata *pdata) struct sst_dsp_device *sst_dev, struct sst_pdata *pdata)
{ {
......
...@@ -216,7 +216,7 @@ struct sst_pdata { ...@@ -216,7 +216,7 @@ struct sst_pdata {
void *dsp; void *dsp;
}; };
#if IS_ENABLED(CONFIG_DW_DMAC_CORE) #ifdef CONFIG_DW_DMAC_CORE
/* Initialization */ /* Initialization */
struct sst_dsp *sst_dsp_new(struct device *dev, struct sst_dsp *sst_dsp_new(struct device *dev,
struct sst_dsp_device *sst_dev, struct sst_pdata *pdata); struct sst_dsp_device *sst_dev, struct sst_pdata *pdata);
......
...@@ -51,8 +51,22 @@ struct sst_dma { ...@@ -51,8 +51,22 @@ struct sst_dma {
static inline void sst_memcpy32(volatile void __iomem *dest, void *src, u32 bytes) static inline void sst_memcpy32(volatile void __iomem *dest, void *src, u32 bytes)
{ {
u32 tmp = 0;
int i, m, n;
const u8 *src_byte = src;
m = bytes / 4;
n = bytes % 4;
/* __iowrite32_copy use 32bit size values so divide by 4 */ /* __iowrite32_copy use 32bit size values so divide by 4 */
__iowrite32_copy((void *)dest, src, bytes/4); __iowrite32_copy((void *)dest, src, m);
if (n) {
for (i = 0; i < n; i++)
tmp |= (u32)*(src_byte + m * 4 + i) << (i * 8);
__iowrite32_copy((void *)(dest + m * 4), &tmp, 1);
}
} }
static void sst_dma_transfer_complete(void *arg) static void sst_dma_transfer_complete(void *arg)
...@@ -1014,8 +1028,8 @@ EXPORT_SYMBOL_GPL(sst_module_runtime_restore); ...@@ -1014,8 +1028,8 @@ EXPORT_SYMBOL_GPL(sst_module_runtime_restore);
/* register a DSP memory block for use with FW based modules */ /* register a DSP memory block for use with FW based modules */
struct sst_mem_block *sst_mem_block_register(struct sst_dsp *dsp, u32 offset, struct sst_mem_block *sst_mem_block_register(struct sst_dsp *dsp, u32 offset,
u32 size, enum sst_mem_type type, struct sst_block_ops *ops, u32 index, u32 size, enum sst_mem_type type, const struct sst_block_ops *ops,
void *private) u32 index, void *private)
{ {
struct sst_mem_block *block; struct sst_mem_block *block;
......
/*
* sst_match_apci.c - SST (LPE) match for ACPI enumeration.
*
* Copyright (c) 2013-15, Intel Corporation.
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope 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/acpi.h>
#include <linux/device.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include "sst-acpi.h"
static acpi_status sst_acpi_mach_match(acpi_handle handle, u32 level,
void *context, void **ret)
{
*(bool *)context = true;
return AE_OK;
}
struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines)
{
struct sst_acpi_mach *mach;
bool found = false;
for (mach = machines; mach->id[0]; mach++)
if (ACPI_SUCCESS(acpi_get_devices(mach->id,
sst_acpi_mach_match,
&found, NULL)) && found)
return mach;
return NULL;
}
EXPORT_SYMBOL_GPL(sst_acpi_find_machine);
...@@ -607,7 +607,7 @@ static int hsw_block_disable(struct sst_mem_block *block) ...@@ -607,7 +607,7 @@ static int hsw_block_disable(struct sst_mem_block *block)
return 0; return 0;
} }
static struct sst_block_ops sst_hsw_ops = { static const struct sst_block_ops sst_hsw_ops = {
.enable = hsw_block_enable, .enable = hsw_block_enable,
.disable = hsw_block_disable, .disable = hsw_block_disable,
}; };
......
...@@ -778,7 +778,6 @@ static irqreturn_t hsw_irq_thread(int irq, void *context) ...@@ -778,7 +778,6 @@ static irqreturn_t hsw_irq_thread(int irq, void *context)
struct sst_hsw *hsw = sst_dsp_get_thread_context(sst); struct sst_hsw *hsw = sst_dsp_get_thread_context(sst);
struct sst_generic_ipc *ipc = &hsw->ipc; struct sst_generic_ipc *ipc = &hsw->ipc;
u32 ipcx, ipcd; u32 ipcx, ipcd;
int handled;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&sst->spinlock, flags); spin_lock_irqsave(&sst->spinlock, flags);
...@@ -790,34 +789,30 @@ static irqreturn_t hsw_irq_thread(int irq, void *context) ...@@ -790,34 +789,30 @@ static irqreturn_t hsw_irq_thread(int irq, void *context)
if (ipcx & SST_IPCX_DONE) { if (ipcx & SST_IPCX_DONE) {
/* Handle Immediate reply from DSP Core */ /* Handle Immediate reply from DSP Core */
handled = hsw_process_reply(hsw, ipcx); hsw_process_reply(hsw, ipcx);
if (handled > 0) { /* clear DONE bit - tell DSP we have completed */
/* clear DONE bit - tell DSP we have completed */ sst_dsp_shim_update_bits_unlocked(sst, SST_IPCX,
sst_dsp_shim_update_bits_unlocked(sst, SST_IPCX, SST_IPCX_DONE, 0);
SST_IPCX_DONE, 0);
/* unmask Done interrupt */ /* unmask Done interrupt */
sst_dsp_shim_update_bits_unlocked(sst, SST_IMRX, sst_dsp_shim_update_bits_unlocked(sst, SST_IMRX,
SST_IMRX_DONE, 0); SST_IMRX_DONE, 0);
}
} }
/* new message from DSP */ /* new message from DSP */
if (ipcd & SST_IPCD_BUSY) { if (ipcd & SST_IPCD_BUSY) {
/* Handle Notification and Delayed reply from DSP Core */ /* Handle Notification and Delayed reply from DSP Core */
handled = hsw_process_notification(hsw); hsw_process_notification(hsw);
/* clear BUSY bit and set DONE bit - accept new messages */ /* clear BUSY bit and set DONE bit - accept new messages */
if (handled > 0) { sst_dsp_shim_update_bits_unlocked(sst, SST_IPCD,
sst_dsp_shim_update_bits_unlocked(sst, SST_IPCD, SST_IPCD_BUSY | SST_IPCD_DONE, SST_IPCD_DONE);
SST_IPCD_BUSY | SST_IPCD_DONE, SST_IPCD_DONE);
/* unmask busy interrupt */ /* unmask busy interrupt */
sst_dsp_shim_update_bits_unlocked(sst, SST_IMRX, sst_dsp_shim_update_bits_unlocked(sst, SST_IMRX,
SST_IMRX_BUSY, 0); SST_IMRX_BUSY, 0);
}
} }
spin_unlock_irqrestore(&sst->spinlock, flags); spin_unlock_irqrestore(&sst->spinlock, flags);
......
This diff is collapsed.
...@@ -55,7 +55,7 @@ void skl_nhlt_free(void *addr) ...@@ -55,7 +55,7 @@ void skl_nhlt_free(void *addr)
static struct nhlt_specific_cfg *skl_get_specific_cfg( static struct nhlt_specific_cfg *skl_get_specific_cfg(
struct device *dev, struct nhlt_fmt *fmt, struct device *dev, struct nhlt_fmt *fmt,
u8 no_ch, u32 rate, u16 bps) u8 no_ch, u32 rate, u16 bps, u8 linktype)
{ {
struct nhlt_specific_cfg *sp_config; struct nhlt_specific_cfg *sp_config;
struct wav_fmt *wfmt; struct wav_fmt *wfmt;
...@@ -68,11 +68,17 @@ static struct nhlt_specific_cfg *skl_get_specific_cfg( ...@@ -68,11 +68,17 @@ static struct nhlt_specific_cfg *skl_get_specific_cfg(
wfmt = &fmt_config->fmt_ext.fmt; wfmt = &fmt_config->fmt_ext.fmt;
dev_dbg(dev, "ch=%d fmt=%d s_rate=%d\n", wfmt->channels, dev_dbg(dev, "ch=%d fmt=%d s_rate=%d\n", wfmt->channels,
wfmt->bits_per_sample, wfmt->samples_per_sec); wfmt->bits_per_sample, wfmt->samples_per_sec);
if (wfmt->channels == no_ch && wfmt->samples_per_sec == rate && if (wfmt->channels == no_ch && wfmt->bits_per_sample == bps) {
wfmt->bits_per_sample == bps) { /*
* if link type is dmic ignore rate check as the blob is
* generic for all rates
*/
sp_config = &fmt_config->config; sp_config = &fmt_config->config;
if (linktype == NHLT_LINK_DMIC)
return sp_config;
return sp_config; if (wfmt->samples_per_sec == rate)
return sp_config;
} }
fmt_config = (struct nhlt_fmt_cfg *)(fmt_config->config.caps + fmt_config = (struct nhlt_fmt_cfg *)(fmt_config->config.caps +
...@@ -115,7 +121,7 @@ struct nhlt_specific_cfg ...@@ -115,7 +121,7 @@ struct nhlt_specific_cfg
struct device *dev = bus->dev; struct device *dev = bus->dev;
struct nhlt_specific_cfg *sp_config; struct nhlt_specific_cfg *sp_config;
struct nhlt_acpi_table *nhlt = (struct nhlt_acpi_table *)skl->nhlt; struct nhlt_acpi_table *nhlt = (struct nhlt_acpi_table *)skl->nhlt;
u16 bps = num_ch * s_fmt; u16 bps = (s_fmt == 16) ? 16 : 32;
u8 j; u8 j;
dump_config(dev, instance, link_type, s_fmt, num_ch, s_rate, dirn, bps); dump_config(dev, instance, link_type, s_fmt, num_ch, s_rate, dirn, bps);
...@@ -128,7 +134,8 @@ struct nhlt_specific_cfg ...@@ -128,7 +134,8 @@ struct nhlt_specific_cfg
if (skl_check_ep_match(dev, epnt, instance, link_type, dirn)) { if (skl_check_ep_match(dev, epnt, instance, link_type, dirn)) {
fmt = (struct nhlt_fmt *)(epnt->config.caps + fmt = (struct nhlt_fmt *)(epnt->config.caps +
epnt->config.size); epnt->config.size);
sp_config = skl_get_specific_cfg(dev, fmt, num_ch, s_rate, bps); sp_config = skl_get_specific_cfg(dev, fmt, num_ch,
s_rate, bps, link_type);
if (sp_config) if (sp_config)
return sp_config; return sp_config;
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -81,8 +81,12 @@ static int rear_amp_power(struct snd_soc_codec *codec, int power) ...@@ -81,8 +81,12 @@ static int rear_amp_power(struct snd_soc_codec *codec, int power)
static int rear_amp_event(struct snd_soc_dapm_widget *widget, static int rear_amp_event(struct snd_soc_dapm_widget *widget,
struct snd_kcontrol *kctl, int event) struct snd_kcontrol *kctl, int event)
{ {
struct snd_soc_codec *codec = widget->dapm->card->rtd[0].codec; struct snd_soc_card *card = widget->dapm->card;
struct snd_soc_pcm_runtime *rtd;
struct snd_soc_codec *codec;
rtd = snd_soc_get_pcm_runtime(card, card->dai_link[0].name);
codec = rtd->codec;
return rear_amp_power(codec, SND_SOC_DAPM_EVENT_ON(event)); return rear_amp_power(codec, SND_SOC_DAPM_EVENT_ON(event));
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment