ASoC: Updates for v5.1

Lots and lots of new drivers so far, a highlight being the MediaTek
BTCVSD which is a driver for a Bluetooth radio chip - the first such
driver we've had upstream.  Hopefully we will soon also see a baseband
with an upstream driver!

 - Support for only powering up channels that are actively being used.
 - Quite a few improvements to simplify the generic card drivers,
   especially the merge of the SCU cards into the main generic drivers.
 - Lots of fixes for probing on Intel systems, trying to rationalize
   things to look more standard from a framework point of view.
 - New drivers for Asahi Kasei Microdevices AK4497, Cirrus Logic CS4341,
   Google ChromeOS embedded controllers, Ingenic JZ4725B, MediaTek
   BTCVSD, MT8183 and MT6358, NXP MICFIL, Rockchip RK3328, Spreadtrum
   DMA controllers, Qualcomm WCD9335, Xilinx S/PDIF and PCM formatters.
This commit is contained in:
Takashi Iwai
2019-02-08 14:20:32 +01:00
1298 changed files with 38948 additions and 8724 deletions

View File

@@ -647,7 +647,7 @@ static int sst_swm_mixer_event(struct snd_soc_dapm_widget *w,
set_mixer = false;
}
if (set_mixer == false)
if (!set_mixer)
return 0;
if (SND_SOC_DAPM_EVENT_ON(event) ||

View File

@@ -190,7 +190,7 @@ int sst_fill_stream_params(void *substream,
map = ctx->pdata->pdev_strm_map;
map_size = ctx->pdata->strm_map_size;
if (is_compress == true)
if (is_compress)
cstream = (struct snd_compr_stream *)substream;
else
pstream = (struct snd_pcm_substream *)substream;

View File

@@ -255,18 +255,16 @@ static int is_byt(void)
return status;
}
static int is_byt_cr(struct device *dev, bool *bytcr)
static bool is_byt_cr(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
int status = 0;
if (IS_ENABLED(CONFIG_IOSF_MBI)) {
if (!is_byt())
return false;
if (iosf_mbi_available()) {
u32 bios_status;
if (!is_byt() || !iosf_mbi_available()) {
/* bail silently */
return status;
}
status = iosf_mbi_read(BT_MBI_UNIT_PMC, /* 0x04 PUNIT */
MBI_REG_READ, /* 0x10 */
0x006, /* BIOS_CONFIG */
@@ -278,15 +276,28 @@ static int is_byt_cr(struct device *dev, bool *bytcr)
/* bits 26:27 mirror PMIC options */
bios_status = (bios_status >> 26) & 3;
if ((bios_status == 1) || (bios_status == 3))
*bytcr = true;
else
dev_info(dev, "BYT-CR not detected\n");
if (bios_status == 1 || bios_status == 3) {
dev_info(dev, "Detected Baytrail-CR platform\n");
return true;
}
dev_info(dev, "BYT-CR not detected\n");
}
} else {
dev_info(dev, "IOSF_MBI not enabled, no BYT-CR detection\n");
dev_info(dev, "IOSF_MBI not available, no BYT-CR detection\n");
}
return status;
if (platform_get_resource(pdev, IORESOURCE_IRQ, 5) == NULL) {
/*
* Some devices detected as BYT-T have only a single IRQ listed,
* causing platform_get_irq with index 5 to return -ENXIO.
* The correct IRQ in this case is at index 0, as on BYT-CR.
*/
dev_info(dev, "Falling back to Baytrail-CR platform\n");
return true;
}
return false;
}
@@ -301,7 +312,6 @@ static int sst_acpi_probe(struct platform_device *pdev)
struct platform_device *plat_dev;
struct sst_platform_info *pdata;
unsigned int dev_id;
bool bytcr = false;
id = acpi_match_device(dev->driver->acpi_match_table, dev);
if (!id)
@@ -333,10 +343,7 @@ static int sst_acpi_probe(struct platform_device *pdev)
if (ret < 0)
return ret;
ret = is_byt_cr(dev, &bytcr);
if (!((ret < 0) || (bytcr == false))) {
dev_info(dev, "Detected Baytrail-CR platform\n");
if (is_byt_cr(pdev)) {
/* override resource info */
byt_rvp_platform_data.res_info = &bytcr_res_info;
}

View File

@@ -146,7 +146,7 @@ static int sst_power_control(struct device *dev, bool state)
int ret = 0;
int usage_count = 0;
if (state == true) {
if (state) {
ret = pm_runtime_get_sync(dev);
usage_count = GET_USAGE_COUNT(dev);
dev_dbg(ctx->dev, "Enable: pm usage count: %d\n", usage_count);

View File

@@ -269,7 +269,7 @@ static void sst_do_memcpy(struct list_head *memcpy_list)
struct sst_memcpy_list *listnode;
list_for_each_entry(listnode, memcpy_list, memcpylist) {
if (listnode->is_io == true)
if (listnode->is_io)
memcpy32_toio((void __iomem *)listnode->dstn,
listnode->src, listnode->size);
else

View File

@@ -278,7 +278,6 @@ static int sst_byt_process_notification(struct sst_byt *byt,
struct sst_byt_stream *stream;
u64 header;
u8 msg_id, stream_id;
int handled = 1;
header = sst_dsp_shim_read64_unlocked(sst, SST_IPCD);
msg_id = sst_byt_header_msg_id(header);
@@ -298,7 +297,7 @@ static int sst_byt_process_notification(struct sst_byt *byt,
break;
}
return handled;
return 1;
}
static irqreturn_t sst_byt_irq_thread(int irq, void *context)

View File

@@ -188,7 +188,7 @@ static int sst_byt_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
sst_byt_stream_start(byt, pcm_data->stream, 0);
break;
case SNDRV_PCM_TRIGGER_RESUME:
if (pdata->restore_stream == true)
if (pdata->restore_stream)
schedule_work(&pcm_data->work);
else
sst_byt_stream_resume(byt, pcm_data->stream);

View File

@@ -26,6 +26,7 @@
#include <sound/soc.h>
#include <sound/pcm_params.h>
#include <sound/jack.h>
#include <sound/soc-acpi.h>
#include "../common/sst-dsp.h"
#include "../haswell/sst-haswell-ipc.h"
@@ -339,6 +340,9 @@ static struct snd_soc_card bdw_rt5677_card = {
static int bdw_rt5677_probe(struct platform_device *pdev)
{
struct bdw_rt5677_priv *bdw_rt5677;
struct snd_soc_acpi_mach *mach;
const char *platform_name = NULL;
int ret;
bdw_rt5677_card.dev = &pdev->dev;
@@ -350,6 +354,16 @@ static int bdw_rt5677_probe(struct platform_device *pdev)
return -ENOMEM;
}
/* override plaform name, if required */
mach = (&pdev->dev)->platform_data;
if (mach) /* extra check since legacy does not pass parameters */
platform_name = mach->mach_params.platform;
ret = snd_soc_fixup_dai_links_platform_name(&bdw_rt5677_card,
platform_name);
if (ret)
return ret;
snd_soc_card_set_drvdata(&bdw_rt5677_card, bdw_rt5677);
return devm_snd_soc_register_card(&pdev->dev, &bdw_rt5677_card);

View File

@@ -21,6 +21,7 @@
#include <sound/soc.h>
#include <sound/jack.h>
#include <sound/pcm_params.h>
#include <sound/soc-acpi.h>
#include "../common/sst-dsp.h"
#include "../haswell/sst-haswell-ipc.h"
@@ -267,7 +268,22 @@ static struct snd_soc_card broadwell_rt286 = {
static int broadwell_audio_probe(struct platform_device *pdev)
{
struct snd_soc_acpi_mach *mach;
const char *platform_name = NULL;
int ret;
broadwell_rt286.dev = &pdev->dev;
/* override plaform name, if required */
mach = (&pdev->dev)->platform_data;
if (mach) /* extra check since legacy does not pass parameters */
platform_name = mach->mach_params.platform;
ret = snd_soc_fixup_dai_links_platform_name(&broadwell_rt286,
platform_name);
if (ret)
return ret;
return devm_snd_soc_register_card(&pdev->dev, &broadwell_rt286);
}

View File

@@ -23,6 +23,7 @@
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/soc-acpi.h>
#include "../../codecs/hdac_hdmi.h"
#include "../../codecs/da7219.h"
#include "../../codecs/da7219-aad.h"
@@ -584,6 +585,9 @@ static struct snd_soc_card broxton_audio_card = {
static int broxton_audio_probe(struct platform_device *pdev)
{
struct bxt_card_private *ctx;
struct snd_soc_acpi_mach *mach;
const char *platform_name;
int ret;
ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
if (!ctx)
@@ -594,6 +598,15 @@ static int broxton_audio_probe(struct platform_device *pdev)
broxton_audio_card.dev = &pdev->dev;
snd_soc_card_set_drvdata(&broxton_audio_card, ctx);
/* override plaform name, if required */
mach = (&pdev->dev)->platform_data;
platform_name = mach->mach_params.platform;
ret = snd_soc_fixup_dai_links_platform_name(&broxton_audio_card,
platform_name);
if (ret)
return ret;
return devm_snd_soc_register_card(&pdev->dev, &broxton_audio_card);
}

View File

@@ -21,6 +21,7 @@
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/soc.h>
#include <sound/soc-acpi.h>
#include <sound/jack.h>
#include <sound/pcm_params.h>
#include "../../codecs/hdac_hdmi.h"
@@ -576,6 +577,9 @@ static int broxton_audio_probe(struct platform_device *pdev)
struct bxt_rt286_private *ctx;
struct snd_soc_card *card =
(struct snd_soc_card *)pdev->id_entry->driver_data;
struct snd_soc_acpi_mach *mach;
const char *platform_name;
int ret;
int i;
for (i = 0; i < ARRAY_SIZE(broxton_rt298_dais); i++) {
@@ -602,6 +606,15 @@ static int broxton_audio_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
snd_soc_card_set_drvdata(card, ctx);
/* override plaform name, if required */
mach = (&pdev->dev)->platform_data;
platform_name = mach->mach_params.platform;
ret = snd_soc_fixup_dai_links_platform_name(card,
platform_name);
if (ret)
return ret;
return devm_snd_soc_register_card(&pdev->dev, card);
}

View File

@@ -225,6 +225,7 @@ static int bytcht_da7213_probe(struct platform_device *pdev)
{
struct snd_soc_card *card;
struct snd_soc_acpi_mach *mach;
const char *platform_name;
const char *i2c_name = NULL;
int dai_index = 0;
int ret_val = 0;
@@ -250,6 +251,13 @@ static int bytcht_da7213_probe(struct platform_device *pdev)
dailink[dai_index].codec_name = codec_name;
}
/* override plaform name, if required */
platform_name = mach->mach_params.platform;
ret_val = snd_soc_fixup_dai_links_platform_name(card, platform_name);
if (ret_val)
return ret_val;
ret_val = devm_snd_soc_register_card(&pdev->dev, card);
if (ret_val) {
dev_err(&pdev->dev,

View File

@@ -19,13 +19,20 @@
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
#include <linux/acpi.h>
#include <linux/clk.h>
#include <linux/device.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/input.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/device.h>
#include <linux/slab.h>
#include <asm/cpu_device_id.h>
#include <asm/intel-family.h>
#include <asm/platform_sst_audio.h>
#include <linux/clk.h>
#include <sound/jack.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
@@ -35,27 +42,96 @@
struct byt_cht_es8316_private {
struct clk *mclk;
struct snd_soc_jack jack;
struct gpio_desc *speaker_en_gpio;
bool speaker_en;
};
static const struct snd_soc_dapm_widget byt_cht_es8316_widgets[] = {
SND_SOC_DAPM_HP("Headphone", NULL),
enum {
BYT_CHT_ES8316_INTMIC_IN1_MAP,
BYT_CHT_ES8316_INTMIC_IN2_MAP,
};
/*
* The codec supports two analog microphone inputs. I have only
* tested MIC1. A DMIC route could also potentially be added
* if such functionality is found on another platform.
*/
SND_SOC_DAPM_MIC("Microphone 1", NULL),
SND_SOC_DAPM_MIC("Microphone 2", NULL),
#define BYT_CHT_ES8316_MAP(quirk) ((quirk) & GENMASK(3, 0))
#define BYT_CHT_ES8316_SSP0 BIT(16)
#define BYT_CHT_ES8316_MONO_SPEAKER BIT(17)
static int quirk;
static int quirk_override = -1;
module_param_named(quirk, quirk_override, int, 0444);
MODULE_PARM_DESC(quirk, "Board-specific quirk override");
static void log_quirks(struct device *dev)
{
if (BYT_CHT_ES8316_MAP(quirk) == BYT_CHT_ES8316_INTMIC_IN1_MAP)
dev_info(dev, "quirk IN1_MAP enabled");
if (BYT_CHT_ES8316_MAP(quirk) == BYT_CHT_ES8316_INTMIC_IN2_MAP)
dev_info(dev, "quirk IN2_MAP enabled");
if (quirk & BYT_CHT_ES8316_SSP0)
dev_info(dev, "quirk SSP0 enabled");
if (quirk & BYT_CHT_ES8316_MONO_SPEAKER)
dev_info(dev, "quirk MONO_SPEAKER enabled\n");
}
static int byt_cht_es8316_speaker_power_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
struct snd_soc_card *card = w->dapm->card;
struct byt_cht_es8316_private *priv = snd_soc_card_get_drvdata(card);
if (SND_SOC_DAPM_EVENT_ON(event))
priv->speaker_en = true;
else
priv->speaker_en = false;
gpiod_set_value_cansleep(priv->speaker_en_gpio, priv->speaker_en);
return 0;
}
static const struct snd_soc_dapm_widget byt_cht_es8316_widgets[] = {
SND_SOC_DAPM_SPK("Speaker", NULL),
SND_SOC_DAPM_HP("Headphone", NULL),
SND_SOC_DAPM_MIC("Headset Mic", NULL),
SND_SOC_DAPM_MIC("Internal Mic", NULL),
SND_SOC_DAPM_SUPPLY("Speaker Power", SND_SOC_NOPM, 0, 0,
byt_cht_es8316_speaker_power_event,
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
};
static const struct snd_soc_dapm_route byt_cht_es8316_audio_map[] = {
{"MIC1", NULL, "Microphone 1"},
{"MIC2", NULL, "Microphone 2"},
{"Headphone", NULL, "HPOL"},
{"Headphone", NULL, "HPOR"},
/*
* There is no separate speaker output instead the speakers are muxed to
* the HP outputs. The mux is controlled by the "Speaker Power" supply.
*/
{"Speaker", NULL, "HPOL"},
{"Speaker", NULL, "HPOR"},
{"Speaker", NULL, "Speaker Power"},
};
static const struct snd_soc_dapm_route byt_cht_es8316_intmic_in1_map[] = {
{"MIC1", NULL, "Internal Mic"},
{"MIC2", NULL, "Headset Mic"},
};
static const struct snd_soc_dapm_route byt_cht_es8316_intmic_in2_map[] = {
{"MIC2", NULL, "Internal Mic"},
{"MIC1", NULL, "Headset Mic"},
};
static const struct snd_soc_dapm_route byt_cht_es8316_ssp0_map[] = {
{"Playback", NULL, "ssp0 Tx"},
{"ssp0 Tx", NULL, "modem_out"},
{"modem_in", NULL, "ssp0 Rx"},
{"ssp0 Rx", NULL, "Capture"},
};
static const struct snd_soc_dapm_route byt_cht_es8316_ssp2_map[] = {
{"Playback", NULL, "ssp2 Tx"},
{"ssp2 Tx", NULL, "codec_out0"},
{"ssp2 Tx", NULL, "codec_out1"},
@@ -65,19 +141,60 @@ static const struct snd_soc_dapm_route byt_cht_es8316_audio_map[] = {
};
static const struct snd_kcontrol_new byt_cht_es8316_controls[] = {
SOC_DAPM_PIN_SWITCH("Speaker"),
SOC_DAPM_PIN_SWITCH("Headphone"),
SOC_DAPM_PIN_SWITCH("Microphone 1"),
SOC_DAPM_PIN_SWITCH("Microphone 2"),
SOC_DAPM_PIN_SWITCH("Headset Mic"),
SOC_DAPM_PIN_SWITCH("Internal Mic"),
};
static struct snd_soc_jack_pin byt_cht_es8316_jack_pins[] = {
{
.pin = "Headphone",
.mask = SND_JACK_HEADPHONE,
},
{
.pin = "Headset Mic",
.mask = SND_JACK_MICROPHONE,
},
};
static int byt_cht_es8316_init(struct snd_soc_pcm_runtime *runtime)
{
struct snd_soc_component *codec = runtime->codec_dai->component;
struct snd_soc_card *card = runtime->card;
struct byt_cht_es8316_private *priv = snd_soc_card_get_drvdata(card);
const struct snd_soc_dapm_route *custom_map;
int num_routes;
int ret;
card->dapm.idle_bias_off = true;
switch (BYT_CHT_ES8316_MAP(quirk)) {
case BYT_CHT_ES8316_INTMIC_IN1_MAP:
default:
custom_map = byt_cht_es8316_intmic_in1_map;
num_routes = ARRAY_SIZE(byt_cht_es8316_intmic_in1_map);
break;
case BYT_CHT_ES8316_INTMIC_IN2_MAP:
custom_map = byt_cht_es8316_intmic_in2_map;
num_routes = ARRAY_SIZE(byt_cht_es8316_intmic_in2_map);
break;
}
ret = snd_soc_dapm_add_routes(&card->dapm, custom_map, num_routes);
if (ret)
return ret;
if (quirk & BYT_CHT_ES8316_SSP0) {
custom_map = byt_cht_es8316_ssp0_map;
num_routes = ARRAY_SIZE(byt_cht_es8316_ssp0_map);
} else {
custom_map = byt_cht_es8316_ssp2_map;
num_routes = ARRAY_SIZE(byt_cht_es8316_ssp2_map);
}
ret = snd_soc_dapm_add_routes(&card->dapm, custom_map, num_routes);
if (ret)
return ret;
/*
* The firmware might enable the clock at boot (this information
* may or may not be reflected in the enable clock register).
@@ -105,6 +222,18 @@ static int byt_cht_es8316_init(struct snd_soc_pcm_runtime *runtime)
return ret;
}
ret = snd_soc_card_jack_new(card, "Headset",
SND_JACK_HEADSET | SND_JACK_BTN_0,
&priv->jack, byt_cht_es8316_jack_pins,
ARRAY_SIZE(byt_cht_es8316_jack_pins));
if (ret) {
dev_err(card->dev, "jack creation failed %d\n", ret);
return ret;
}
snd_jack_set_key(priv->jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
snd_soc_component_set_jack(codec, &priv->jack, NULL);
return 0;
}
@@ -123,14 +252,21 @@ static int byt_cht_es8316_codec_fixup(struct snd_soc_pcm_runtime *rtd,
SNDRV_PCM_HW_PARAM_RATE);
struct snd_interval *channels = hw_param_interval(params,
SNDRV_PCM_HW_PARAM_CHANNELS);
int ret;
int ret, bits;
/* The DSP will covert the FE rate to 48k, stereo */
rate->min = rate->max = 48000;
channels->min = channels->max = 2;
/* set SSP2 to 24-bit */
params_set_format(params, SNDRV_PCM_FORMAT_S24_LE);
if (quirk & BYT_CHT_ES8316_SSP0) {
/* set SSP0 to 16-bit */
params_set_format(params, SNDRV_PCM_FORMAT_S16_LE);
bits = 16;
} else {
/* set SSP2 to 24-bit */
params_set_format(params, SNDRV_PCM_FORMAT_S24_LE);
bits = 24;
}
/*
* Default mode for SSP configuration is TDM 4 slot, override config
@@ -147,7 +283,7 @@ static int byt_cht_es8316_codec_fixup(struct snd_soc_pcm_runtime *rtd,
return ret;
}
ret = snd_soc_dai_set_tdm_slot(rtd->cpu_dai, 0x3, 0x3, 2, 24);
ret = snd_soc_dai_set_tdm_slot(rtd->cpu_dai, 0x3, 0x3, 2, bits);
if (ret < 0) {
dev_err(rtd->dev, "can't set I2S config, err %d\n", ret);
return ret;
@@ -218,6 +354,59 @@ static struct snd_soc_dai_link byt_cht_es8316_dais[] = {
/* SoC card */
static char codec_name[SND_ACPI_I2C_ID_LEN];
static char long_name[50]; /* = "bytcht-es8316-*-spk-*-mic" */
static int byt_cht_es8316_suspend(struct snd_soc_card *card)
{
struct snd_soc_component *component;
for_each_card_components(card, component) {
if (!strcmp(component->name, codec_name)) {
dev_dbg(component->dev, "disabling jack detect before suspend\n");
snd_soc_component_set_jack(component, NULL, NULL);
break;
}
}
return 0;
}
static int byt_cht_es8316_resume(struct snd_soc_card *card)
{
struct byt_cht_es8316_private *priv = snd_soc_card_get_drvdata(card);
struct snd_soc_component *component;
for_each_card_components(card, component) {
if (!strcmp(component->name, codec_name)) {
dev_dbg(component->dev, "re-enabling jack detect after resume\n");
snd_soc_component_set_jack(component, &priv->jack, NULL);
break;
}
}
/*
* Some Cherry Trail boards with an ES8316 codec have a bug in their
* ACPI tables where the MSSL1680 touchscreen's _PS0 and _PS3 methods
* wrongly also set the speaker-enable GPIO to 1/0. Testing has shown
* that this really is a bug and the GPIO has no influence on the
* touchscreen at all.
*
* The silead.c touchscreen driver does not support runtime suspend, so
* the GPIO can only be changed underneath us during a system suspend.
* This resume() function runs from a pm complete() callback, and thus
* is guaranteed to run after the touchscreen driver/ACPI-subsys has
* brought the touchscreen back up again (and thus changed the GPIO).
*
* So to work around this we pass GPIOD_FLAGS_BIT_NONEXCLUSIVE when
* requesting the GPIO and we set its value here to undo any changes
* done by the touchscreen's broken _PS0 ACPI method.
*/
gpiod_set_value_cansleep(priv->speaker_en_gpio, priv->speaker_en);
return 0;
}
static struct snd_soc_card byt_cht_es8316_card = {
.name = "bytcht-es8316",
.owner = THIS_MODULE,
@@ -230,24 +419,40 @@ static struct snd_soc_card byt_cht_es8316_card = {
.controls = byt_cht_es8316_controls,
.num_controls = ARRAY_SIZE(byt_cht_es8316_controls),
.fully_routed = true,
.suspend_pre = byt_cht_es8316_suspend,
.resume_post = byt_cht_es8316_resume,
};
static char codec_name[SND_ACPI_I2C_ID_LEN];
static const struct x86_cpu_id baytrail_cpu_ids[] = {
{ X86_VENDOR_INTEL, 6, INTEL_FAM6_ATOM_SILVERMONT }, /* Valleyview */
{}
};
static const struct acpi_gpio_params first_gpio = { 0, 0, false };
static const struct acpi_gpio_mapping byt_cht_es8316_gpios[] = {
{ "speaker-enable-gpios", &first_gpio, 1 },
{ },
};
static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
{
static const char * const mic_name[] = { "in1", "in2" };
struct byt_cht_es8316_private *priv;
struct device *dev = &pdev->dev;
struct snd_soc_acpi_mach *mach;
const char *platform_name;
const char *i2c_name = NULL;
struct device *codec_dev;
int dai_index = 0;
int i;
int ret = 0;
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
mach = (&pdev->dev)->platform_data;
mach = dev->platform_data;
/* fix index of codec dai */
for (i = 0; i < ARRAY_SIZE(byt_cht_es8316_dais); i++) {
if (!strcmp(byt_cht_es8316_dais[i].codec_name,
@@ -265,26 +470,94 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
byt_cht_es8316_dais[dai_index].codec_name = codec_name;
}
/* register the soc card */
byt_cht_es8316_card.dev = &pdev->dev;
snd_soc_card_set_drvdata(&byt_cht_es8316_card, priv);
/* override plaform name, if required */
platform_name = mach->mach_params.platform;
priv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3");
ret = snd_soc_fixup_dai_links_platform_name(&byt_cht_es8316_card,
platform_name);
if (ret)
return ret;
/* Check for BYTCR or other platform and setup quirks */
if (x86_match_cpu(baytrail_cpu_ids) &&
mach->mach_params.acpi_ipc_irq_index == 0) {
/* On BYTCR default to SSP0, internal-mic-in2-map, mono-spk */
quirk = BYT_CHT_ES8316_SSP0 | BYT_CHT_ES8316_INTMIC_IN2_MAP |
BYT_CHT_ES8316_MONO_SPEAKER;
} else {
/* Others default to internal-mic-in1-map, mono-speaker */
quirk = BYT_CHT_ES8316_INTMIC_IN1_MAP |
BYT_CHT_ES8316_MONO_SPEAKER;
}
if (quirk_override != -1) {
dev_info(dev, "Overriding quirk 0x%x => 0x%x\n", quirk,
quirk_override);
quirk = quirk_override;
}
log_quirks(dev);
if (quirk & BYT_CHT_ES8316_SSP0)
byt_cht_es8316_dais[dai_index].cpu_dai_name = "ssp0-port";
/* get the clock */
priv->mclk = devm_clk_get(dev, "pmc_plt_clk_3");
if (IS_ERR(priv->mclk)) {
ret = PTR_ERR(priv->mclk);
dev_err(&pdev->dev,
"Failed to get MCLK from pmc_plt_clk_3: %d\n",
ret);
dev_err(dev, "clk_get pmc_plt_clk_3 failed: %d\n", ret);
return ret;
}
ret = devm_snd_soc_register_card(&pdev->dev, &byt_cht_es8316_card);
/* get speaker enable GPIO */
codec_dev = bus_find_device_by_name(&i2c_bus_type, NULL, codec_name);
if (!codec_dev)
return -EPROBE_DEFER;
devm_acpi_dev_add_driver_gpios(codec_dev, byt_cht_es8316_gpios);
priv->speaker_en_gpio =
gpiod_get_index(codec_dev, "speaker-enable", 0,
/* see comment in byt_cht_es8316_resume */
GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE);
put_device(codec_dev);
if (IS_ERR(priv->speaker_en_gpio)) {
ret = PTR_ERR(priv->speaker_en_gpio);
switch (ret) {
case -ENOENT:
priv->speaker_en_gpio = NULL;
break;
default:
dev_err(dev, "get speaker GPIO failed: %d\n", ret);
/* fall through */
case -EPROBE_DEFER:
return ret;
}
}
/* register the soc card */
snprintf(long_name, sizeof(long_name), "bytcht-es8316-%s-spk-%s-mic",
(quirk & BYT_CHT_ES8316_MONO_SPEAKER) ? "mono" : "stereo",
mic_name[BYT_CHT_ES8316_MAP(quirk)]);
byt_cht_es8316_card.long_name = long_name;
byt_cht_es8316_card.dev = dev;
snd_soc_card_set_drvdata(&byt_cht_es8316_card, priv);
ret = devm_snd_soc_register_card(dev, &byt_cht_es8316_card);
if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed %d\n", ret);
gpiod_put(priv->speaker_en_gpio);
dev_err(dev, "snd_soc_register_card failed: %d\n", ret);
return ret;
}
platform_set_drvdata(pdev, &byt_cht_es8316_card);
return ret;
return 0;
}
static int snd_byt_cht_es8316_mc_remove(struct platform_device *pdev)
{
struct snd_soc_card *card = platform_get_drvdata(pdev);
struct byt_cht_es8316_private *priv = snd_soc_card_get_drvdata(card);
gpiod_put(priv->speaker_en_gpio);
return 0;
}
static struct platform_driver snd_byt_cht_es8316_mc_driver = {
@@ -292,6 +565,7 @@ static struct platform_driver snd_byt_cht_es8316_mc_driver = {
.name = "bytcht_es8316",
},
.probe = snd_byt_cht_es8316_mc_probe,
.remove = snd_byt_cht_es8316_mc_remove,
};
module_platform_driver(snd_byt_cht_es8316_mc_driver);

View File

@@ -428,6 +428,18 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {
BYT_RT5640_SSP0_AIF1 |
BYT_RT5640_MCLK_EN),
},
{
.matches = {
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ME176C"),
},
.driver_data = (void *)(BYT_RT5640_IN1_MAP |
BYT_RT5640_JD_SRC_JD2_IN4N |
BYT_RT5640_OVCD_TH_2000UA |
BYT_RT5640_OVCD_SF_0P75 |
BYT_RT5640_SSP0_AIF1 |
BYT_RT5640_MCLK_EN),
},
{
.matches = {
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
@@ -1137,10 +1149,11 @@ struct acpi_chan_package { /* ACPICA seems to require 64 bit integers */
static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
{
const char * const map_name[] = { "dmic1", "dmic2", "in1", "in3" };
static const char * const map_name[] = { "dmic1", "dmic2", "in1", "in3" };
const struct dmi_system_id *dmi_id;
struct byt_rt5640_private *priv;
struct snd_soc_acpi_mach *mach;
const char *platform_name;
const char *i2c_name = NULL;
int ret_val = 0;
int dai_index = 0;
@@ -1305,6 +1318,14 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
map_name[BYT_RT5640_MAP(byt_rt5640_quirk)]);
byt_rt5640_card.long_name = byt_rt5640_long_name;
/* override plaform name, if required */
platform_name = mach->mach_params.platform;
ret_val = snd_soc_fixup_dai_links_platform_name(&byt_rt5640_card,
platform_name);
if (ret_val)
return ret_val;
ret_val = devm_snd_soc_register_card(&pdev->dev, &byt_rt5640_card);
if (ret_val) {

View File

@@ -91,13 +91,20 @@ enum {
struct byt_rt5651_private {
struct clk *mclk;
struct gpio_desc *ext_amp_gpio;
struct gpio_desc *hp_detect;
struct snd_soc_jack jack;
};
static const struct acpi_gpio_mapping *byt_rt5651_gpios;
/* Default: jack-detect on JD1_1, internal mic on in2, headsetmic on in3 */
static unsigned long byt_rt5651_quirk = BYT_RT5651_DEFAULT_QUIRKS |
BYT_RT5651_IN2_MAP;
static unsigned int quirk_override;
module_param_named(quirk, quirk_override, uint, 0444);
MODULE_PARM_DESC(quirk, "Board-specific quirk override");
static void log_quirks(struct device *dev)
{
if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_DMIC_MAP)
@@ -266,7 +273,7 @@ static const struct snd_soc_dapm_route byt_rt5651_audio_map[] = {
static const struct snd_soc_dapm_route byt_rt5651_intmic_dmic_map[] = {
{"DMIC L1", NULL, "Internal Mic"},
{"DMIC R1", NULL, "Internal Mic"},
{"IN3P", NULL, "Headset Mic"},
{"IN2P", NULL, "Headset Mic"},
};
static const struct snd_soc_dapm_route byt_rt5651_intmic_in1_map[] = {
@@ -360,6 +367,22 @@ static int byt_rt5651_aif1_hw_params(struct snd_pcm_substream *substream,
return byt_rt5651_prepare_and_enable_pll1(codec_dai, rate, bclk_ratio);
}
static const struct acpi_gpio_params pov_p1006w_hp_detect = { 1, 0, false };
static const struct acpi_gpio_params pov_p1006w_ext_amp_en = { 2, 0, true };
static const struct acpi_gpio_mapping byt_rt5651_pov_p1006w_gpios[] = {
{ "hp-detect-gpios", &pov_p1006w_hp_detect, 1, },
{ "ext-amp-enable-gpios", &pov_p1006w_ext_amp_en, 1, },
{ },
};
static int byt_rt5651_pov_p1006w_quirk_cb(const struct dmi_system_id *id)
{
byt_rt5651_quirk = (unsigned long)id->driver_data;
byt_rt5651_gpios = byt_rt5651_pov_p1006w_gpios;
return 1;
}
static int byt_rt5651_quirk_cb(const struct dmi_system_id *id)
{
byt_rt5651_quirk = (unsigned long)id->driver_data;
@@ -435,6 +458,23 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
.driver_data = (void *)(BYT_RT5651_MCLK_EN |
BYT_RT5651_IN1_MAP),
},
{
/* Point of View mobii wintab p1006w (v1.0) */
.callback = byt_rt5651_pov_p1006w_quirk_cb,
.matches = {
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Insyde"),
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "BayTrail"),
/* Note 105b is Foxcon's USB/PCI vendor id */
DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "105B"),
DMI_EXACT_MATCH(DMI_BOARD_NAME, "0E57"),
},
.driver_data = (void *)(BYT_RT5651_DMIC_MAP |
BYT_RT5651_OVCD_TH_2000UA |
BYT_RT5651_OVCD_SF_0P75 |
BYT_RT5651_DMIC_EN |
BYT_RT5651_MCLK_EN |
BYT_RT5651_SSP0_AIF1),
},
{
/* VIOS LTH17 */
.callback = byt_rt5651_quirk_cb,
@@ -495,6 +535,7 @@ static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
struct byt_rt5651_private *priv = snd_soc_card_get_drvdata(card);
const struct snd_soc_dapm_route *custom_map;
int num_routes;
int report;
int ret;
card->dapm.idle_bias_off = true;
@@ -578,20 +619,27 @@ static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
dev_err(card->dev, "unable to set MCLK rate\n");
}
if (BYT_RT5651_JDSRC(byt_rt5651_quirk)) {
report = 0;
if (BYT_RT5651_JDSRC(byt_rt5651_quirk))
report = SND_JACK_HEADSET | SND_JACK_BTN_0;
else if (priv->hp_detect)
report = SND_JACK_HEADSET;
if (report) {
ret = snd_soc_card_jack_new(runtime->card, "Headset",
SND_JACK_HEADSET | SND_JACK_BTN_0,
&priv->jack, bytcr_jack_pins,
report, &priv->jack, bytcr_jack_pins,
ARRAY_SIZE(bytcr_jack_pins));
if (ret) {
dev_err(runtime->dev, "jack creation failed %d\n", ret);
return ret;
}
snd_jack_set_key(priv->jack.jack, SND_JACK_BTN_0,
KEY_PLAYPAUSE);
if (report & SND_JACK_BTN_0)
snd_jack_set_key(priv->jack.jack, SND_JACK_BTN_0,
KEY_PLAYPAUSE);
ret = snd_soc_component_set_jack(codec, &priv->jack, NULL);
ret = snd_soc_component_set_jack(codec, &priv->jack,
priv->hp_detect);
if (ret)
return ret;
}
@@ -763,7 +811,8 @@ static int byt_rt5651_resume(struct snd_soc_card *card)
for_each_card_components(card, component) {
if (!strcmp(component->name, byt_rt5651_codec_name)) {
dev_dbg(component->dev, "re-enabling jack detect after resume\n");
snd_soc_component_set_jack(component, &priv->jack, NULL);
snd_soc_component_set_jack(component, &priv->jack,
priv->hp_detect);
break;
}
}
@@ -834,7 +883,7 @@ static int snd_byt_rt5651_acpi_resource(struct acpi_resource *ares, void *arg)
return 0;
}
static void snd_byt_rt5651_mc_add_amp_en_gpio_mapping(struct device *codec)
static void snd_byt_rt5651_mc_pick_amp_en_gpio_mapping(struct device *codec)
{
struct byt_rt5651_acpi_resource_data data = { 0, -1 };
LIST_HEAD(resources);
@@ -852,10 +901,10 @@ static void snd_byt_rt5651_mc_add_amp_en_gpio_mapping(struct device *codec)
switch (data.gpio_int_idx) {
case 0:
devm_acpi_dev_add_driver_gpios(codec, byt_rt5651_amp_en_second);
byt_rt5651_gpios = byt_rt5651_amp_en_second;
break;
case 1:
devm_acpi_dev_add_driver_gpios(codec, byt_rt5651_amp_en_first);
byt_rt5651_gpios = byt_rt5651_amp_en_first;
break;
default:
dev_warn(codec, "Unknown GpioInt index %d, not adding external amplifier GPIO mapping\n",
@@ -870,9 +919,10 @@ struct acpi_chan_package { /* ACPICA seems to require 64 bit integers */
static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
{
const char * const mic_name[] = { "dmic", "in1", "in2", "in12" };
static const char * const mic_name[] = { "dmic", "in1", "in2", "in12" };
struct byt_rt5651_private *priv;
struct snd_soc_acpi_mach *mach;
const char *platform_name;
struct device *codec_dev;
const char *i2c_name = NULL;
const char *hp_swapped;
@@ -973,6 +1023,12 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
/* check quirks before creating card */
dmi_check_system(byt_rt5651_quirk_table);
if (quirk_override) {
dev_info(&pdev->dev, "Overriding quirk 0x%x => 0x%x\n",
(unsigned int)byt_rt5651_quirk, quirk_override);
byt_rt5651_quirk = quirk_override;
}
/* Must be called before register_card, also see declaration comment. */
ret_val = byt_rt5651_add_codec_device_props(codec_dev);
if (ret_val) {
@@ -981,8 +1037,11 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
}
/* Cherry Trail devices use an external amplifier enable gpio */
if (x86_match_cpu(cherrytrail_cpu_ids)) {
snd_byt_rt5651_mc_add_amp_en_gpio_mapping(codec_dev);
if (x86_match_cpu(cherrytrail_cpu_ids) && !byt_rt5651_gpios)
snd_byt_rt5651_mc_pick_amp_en_gpio_mapping(codec_dev);
if (byt_rt5651_gpios) {
devm_acpi_dev_add_driver_gpios(codec_dev, byt_rt5651_gpios);
priv->ext_amp_gpio = devm_fwnode_get_index_gpiod_from_child(
&pdev->dev, "ext-amp-enable", 0,
codec_dev->fwnode,
@@ -1002,6 +1061,25 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
return ret_val;
}
}
priv->hp_detect = devm_fwnode_get_index_gpiod_from_child(
&pdev->dev, "hp-detect", 0,
codec_dev->fwnode,
GPIOD_IN, "hp-detect");
if (IS_ERR(priv->hp_detect)) {
ret_val = PTR_ERR(priv->hp_detect);
switch (ret_val) {
case -ENOENT:
priv->hp_detect = NULL;
break;
default:
dev_err(&pdev->dev, "Failed to get hp-detect GPIO: %d\n",
ret_val);
/* fall through */
case -EPROBE_DEFER:
put_device(codec_dev);
return ret_val;
}
}
}
put_device(codec_dev);
@@ -1060,6 +1138,14 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
mic_name[BYT_RT5651_MAP(byt_rt5651_quirk)], hp_swapped);
byt_rt5651_card.long_name = byt_rt5651_long_name;
/* override plaform name, if required */
platform_name = mach->mach_params.platform;
ret_val = snd_soc_fixup_dai_links_platform_name(&byt_rt5651_card,
platform_name);
if (ret_val)
return ret_val;
ret_val = devm_snd_soc_register_card(&pdev->dev, &byt_rt5651_card);
if (ret_val) {

View File

@@ -28,6 +28,7 @@
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/soc-acpi.h>
#include <sound/jack.h>
#include "../../codecs/max98090.h"
#include "../atom/sst-atom-controls.h"
@@ -420,6 +421,8 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
int ret_val = 0;
struct cht_mc_private *drv;
const char *mclk_name;
struct snd_soc_acpi_mach *mach;
const char *platform_name;
int quirks = 0;
dmi_id = dmi_first_match(cht_max98090_quirk_table);
@@ -442,6 +445,15 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
dev_dbg(dev, "Unable to add GPIO mapping table\n");
}
/* override plaform name, if required */
mach = (&pdev->dev)->platform_data;
platform_name = mach->mach_params.platform;
ret_val = snd_soc_fixup_dai_links_platform_name(&snd_soc_card_cht,
platform_name);
if (ret_val)
return ret_val;
/* register the soc card */
snd_soc_card_cht.dev = &pdev->dev;
snd_soc_card_set_drvdata(&snd_soc_card_cht, drv);

View File

@@ -25,6 +25,7 @@
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/soc-acpi.h>
#include <sound/jack.h>
#include <linux/input.h>
#include "../atom/sst-atom-controls.h"
@@ -246,6 +247,8 @@ static struct snd_soc_card snd_soc_card_cht = {
static int snd_cht_mc_probe(struct platform_device *pdev)
{
struct cht_mc_private *drv;
struct snd_soc_acpi_mach *mach;
const char *platform_name;
int ret_val;
drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL);
@@ -253,6 +256,15 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
return -ENOMEM;
snd_soc_card_set_drvdata(&snd_soc_card_cht, drv);
/* override plaform name, if required */
mach = (&pdev->dev)->platform_data;
platform_name = mach->mach_params.platform;
ret_val = snd_soc_fixup_dai_links_platform_name(&snd_soc_card_cht,
platform_name);
if (ret_val)
return ret_val;
/* register the soc card */
snd_soc_card_cht.dev = &pdev->dev;
ret_val = devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_cht);

View File

@@ -530,6 +530,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
{
struct snd_soc_card *card = snd_soc_cards[0].soc_card;
struct snd_soc_acpi_mach *mach;
const char *platform_name;
struct cht_mc_private *drv;
const char *i2c_name = NULL;
bool found = false;
@@ -663,6 +664,14 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
cht_rt5645_cpu_dai_name;
}
/* override plaform name, if required */
platform_name = mach->mach_params.platform;
ret_val = snd_soc_fixup_dai_links_platform_name(card,
platform_name);
if (ret_val)
return ret_val;
drv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3");
if (IS_ERR(drv->mclk)) {
dev_err(&pdev->dev,

View File

@@ -400,6 +400,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
int ret_val = 0;
struct cht_mc_private *drv;
struct snd_soc_acpi_mach *mach = pdev->dev.platform_data;
const char *platform_name;
const char *i2c_name;
int i;
@@ -410,22 +411,27 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
strcpy(drv->codec_name, RT5672_I2C_DEFAULT);
/* fixup codec name based on HID */
if (mach) {
i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
if (i2c_name) {
snprintf(drv->codec_name, sizeof(drv->codec_name),
"i2c-%s", i2c_name);
for (i = 0; i < ARRAY_SIZE(cht_dailink); i++) {
if (!strcmp(cht_dailink[i].codec_name,
RT5672_I2C_DEFAULT)) {
cht_dailink[i].codec_name =
drv->codec_name;
break;
}
i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
if (i2c_name) {
snprintf(drv->codec_name, sizeof(drv->codec_name),
"i2c-%s", i2c_name);
for (i = 0; i < ARRAY_SIZE(cht_dailink); i++) {
if (!strcmp(cht_dailink[i].codec_name,
RT5672_I2C_DEFAULT)) {
cht_dailink[i].codec_name = drv->codec_name;
break;
}
}
}
/* override plaform name, if required */
platform_name = mach->mach_params.platform;
ret_val = snd_soc_fixup_dai_links_platform_name(&snd_soc_card_cht,
platform_name);
if (ret_val)
return ret_val;
drv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3");
if (IS_ERR(drv->mclk)) {
dev_err(&pdev->dev,

View File

@@ -16,6 +16,7 @@
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/soc-acpi.h>
#include "../skylake/skl.h"
#include "../../codecs/rt5682.h"
#include "../../codecs/hdac_hdmi.h"
@@ -126,7 +127,7 @@ static int geminilake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
/* set SSP to 24 bit */
snd_mask_none(fmt);
snd_mask_set(fmt, SNDRV_PCM_FORMAT_S24_LE);
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
return 0;
}
@@ -571,6 +572,10 @@ static struct snd_soc_card glk_audio_card_rt5682_m98357a = {
static int geminilake_audio_probe(struct platform_device *pdev)
{
struct glk_card_private *ctx;
struct snd_soc_acpi_mach *mach;
const char *platform_name;
struct snd_soc_card *card;
int ret;
ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
if (!ctx)
@@ -578,11 +583,19 @@ static int geminilake_audio_probe(struct platform_device *pdev)
INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
glk_audio_card_rt5682_m98357a.dev = &pdev->dev;
snd_soc_card_set_drvdata(&glk_audio_card_rt5682_m98357a, ctx);
card = &glk_audio_card_rt5682_m98357a;
card->dev = &pdev->dev;
snd_soc_card_set_drvdata(card, ctx);
return devm_snd_soc_register_card(&pdev->dev,
&glk_audio_card_rt5682_m98357a);
/* override plaform name, if required */
mach = (&pdev->dev)->platform_data;
platform_name = mach->mach_params.platform;
ret = snd_soc_fixup_dai_links_platform_name(card, platform_name);
if (ret)
return ret;
return devm_snd_soc_register_card(&pdev->dev, card);
}
static const struct platform_device_id glk_board_ids[] = {

View File

@@ -19,6 +19,7 @@
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/soc.h>
#include <sound/soc-acpi.h>
#include <sound/pcm_params.h>
#include "../common/sst-dsp.h"
@@ -189,8 +190,22 @@ static struct snd_soc_card haswell_rt5640 = {
static int haswell_audio_probe(struct platform_device *pdev)
{
struct snd_soc_acpi_mach *mach;
const char *platform_name = NULL;
int ret;
haswell_rt5640.dev = &pdev->dev;
/* override plaform name, if required */
mach = (&pdev->dev)->platform_data;
if (mach) /* extra check since legacy does not pass parameters */
platform_name = mach->mach_params.platform;
ret = snd_soc_fixup_dai_links_platform_name(&haswell_rt5640,
platform_name);
if (ret)
return ret;
return devm_snd_soc_register_card(&pdev->dev, &haswell_rt5640);
}

View File

@@ -221,7 +221,7 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
rate->min = rate->max = 48000;
channels->min = channels->max = 2;
snd_mask_none(fmt);
snd_mask_set(fmt, SNDRV_PCM_FORMAT_S24_LE);
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
}
/*
@@ -229,7 +229,7 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
* thus changing the mask here
*/
if (!strcmp(be_dai_link->name, "SSP0-Codec"))
snd_mask_set(fmt, SNDRV_PCM_FORMAT_S16_LE);
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE);
return 0;
}

View File

@@ -21,6 +21,7 @@
static unsigned long byt_machine_id;
#define BYT_THINKPAD_10 1
#define BYT_POV_P1006W 2
static int byt_thinkpad10_quirk_cb(const struct dmi_system_id *id)
{
@@ -28,6 +29,11 @@ static int byt_thinkpad10_quirk_cb(const struct dmi_system_id *id)
return 1;
}
static int byt_pov_p1006w_quirk_cb(const struct dmi_system_id *id)
{
byt_machine_id = BYT_POV_P1006W;
return 1;
}
static const struct dmi_system_id byt_table[] = {
{
@@ -58,6 +64,17 @@ static const struct dmi_system_id byt_table[] = {
DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Miix 2 10"),
},
},
{
/* Point of View mobii wintab p1006w (v1.0) */
.callback = byt_pov_p1006w_quirk_cb,
.matches = {
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Insyde"),
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "BayTrail"),
/* Note 105b is Foxcon's USB/PCI vendor id */
DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "105B"),
DMI_EXACT_MATCH(DMI_BOARD_NAME, "0E57"),
},
},
{ }
};
@@ -71,16 +88,30 @@ static struct snd_soc_acpi_mach byt_thinkpad_10 = {
.asoc_plat_name = "sst-mfld-platform",
};
static struct snd_soc_acpi_mach byt_pov_p1006w = {
.id = "10EC5640",
.drv_name = "bytcr_rt5651",
.fw_filename = "intel/fw_sst_0f28.bin",
.board = "bytcr_rt5651",
.sof_fw_filename = "intel/sof-byt.ri",
.sof_tplg_filename = "intel/sof-byt-rt5651.tplg",
.asoc_plat_name = "sst-mfld-platform",
};
static struct snd_soc_acpi_mach *byt_quirk(void *arg)
{
struct snd_soc_acpi_mach *mach = arg;
dmi_check_system(byt_table);
if (byt_machine_id == BYT_THINKPAD_10)
switch (byt_machine_id) {
case BYT_THINKPAD_10:
return &byt_thinkpad_10;
else
case BYT_POV_P1006W:
return &byt_pov_p1006w;
default:
return mach;
}
}
struct snd_soc_acpi_mach snd_soc_acpi_intel_baytrail_legacy_machines[] = {
@@ -154,6 +185,15 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_baytrail_machines[] = {
.sof_tplg_filename = "intel/sof-byt-da7213.tplg",
.asoc_plat_name = "sst-mfld-platform",
},
{
.id = "ESSX8316",
.drv_name = "bytcht_es8316",
.fw_filename = "intel/fw_sst_0f28.bin",
.board = "bytcht_es8316",
.sof_fw_filename = "intel/sof-byt.ri",
.sof_tplg_filename = "intel/sof-byt-es8316.tplg",
.asoc_plat_name = "sst-mfld-platform",
},
/* some Baytrail platforms rely on RT5645, use CHT machine driver */
{
.id = "10EC5645",

View File

@@ -1216,7 +1216,7 @@ int sst_hsw_stream_commit(struct sst_hsw *hsw, struct sst_hsw_stream *stream)
return ret;
}
stream->commited = 1;
stream->commited = true;
trace_hsw_stream_alloc_reply(stream);
return 0;

View File

@@ -544,7 +544,7 @@ static int hsw_pcm_hw_params(struct snd_pcm_substream *substream,
dev_err(rtd->dev, "error: invalid DAI ID %d\n",
rtd->cpu_dai->id);
return -EINVAL;
};
}
ret = sst_hsw_stream_format(hsw, pcm_data->stream,
path_id, stream_type, SST_HSW_STREAM_FORMAT_PCM_FORMAT);
@@ -861,7 +861,7 @@ static int hsw_pcm_close(struct snd_pcm_substream *substream)
dev_dbg(rtd->dev, "error: free stream failed %d\n", ret);
goto out;
}
pcm_data->allocated = 0;
pcm_data->allocated = false;
pcm_data->stream = NULL;
out:

View File

@@ -416,7 +416,7 @@ int skl_resume_dsp(struct skl *skl)
snd_hdac_ext_bus_ppcap_int_enable(bus, true);
/* check if DSP 1st boot is done */
if (skl->skl_sst->is_first_boot == true)
if (skl->skl_sst->is_first_boot)
return 0;
/*

View File

@@ -1418,7 +1418,7 @@ static int skl_platform_soc_probe(struct snd_soc_component *component)
if (!ops)
return -EIO;
if (skl->skl_sst->is_first_boot == false) {
if (!skl->skl_sst->is_first_boot) {
dev_err(component->dev, "DSP reports first boot done!!!\n");
return -EIO;
}

View File

@@ -3103,7 +3103,7 @@ static int skl_init_algo_data(struct device *dev, struct soc_bytes_ext *be,
ac->size = dfw_ac->max;
if (ac->max) {
ac->params = (char *) devm_kzalloc(dev, ac->max, GFP_KERNEL);
ac->params = devm_kzalloc(dev, ac->max, GFP_KERNEL);
if (!ac->params)
return -ENOMEM;