#include <linux/i2c.h>
#include <linux/input.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/dmi.h>
#include <sound/core.h>
#include <sound/jack.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/sof.h>
#include <sound/soc-acpi.h>
#include "../../codecs/nau8825.h"
#include "../common/soc-intel-quirks.h"
#include "sof_board_helpers.h"
#include "sof_realtek_common.h"
#include "sof_maxim_common.h"
#include "sof_nuvoton_common.h"
static unsigned long sof_nau8825_quirk = …;
static struct snd_soc_jack_pin jack_pins[] = …;
static int sof_nau8825_codec_init(struct snd_soc_pcm_runtime *rtd)
{
struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card);
struct snd_soc_component *component = snd_soc_rtd_to_codec(rtd, 0)->component;
struct snd_soc_jack *jack = &ctx->headset_jack;
int ret;
ret = snd_soc_card_jack_new_pins(rtd->card, "Headset Jack",
SND_JACK_HEADSET | SND_JACK_BTN_0 |
SND_JACK_BTN_1 | SND_JACK_BTN_2 |
SND_JACK_BTN_3,
jack,
jack_pins,
ARRAY_SIZE(jack_pins));
if (ret) {
dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret);
return ret;
}
snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOICECOMMAND);
snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEUP);
snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN);
ret = snd_soc_component_set_jack(component, jack, NULL);
if (ret) {
dev_err(rtd->dev, "Headset Jack call-back failed: %d\n", ret);
return ret;
}
return ret;
};
static void sof_nau8825_codec_exit(struct snd_soc_pcm_runtime *rtd)
{ … }
static int sof_nau8825_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{ … }
static const struct snd_soc_ops sof_nau8825_ops = …;
static int sof_card_late_probe(struct snd_soc_card *card)
{ … }
static const struct snd_kcontrol_new sof_controls[] = …;
static const struct snd_soc_dapm_widget sof_widgets[] = …;
static const struct snd_soc_dapm_route sof_map[] = …;
static struct snd_soc_card sof_audio_card_nau8825 = …;
static struct snd_soc_dai_link_component nau8825_component[] = …;
static int
sof_card_dai_links_create(struct device *dev, struct snd_soc_card *card,
struct sof_card_private *ctx)
{ … }
static int sof_audio_probe(struct platform_device *pdev)
{ … }
static const struct platform_device_id board_ids[] = …;
MODULE_DEVICE_TABLE(platform, board_ids);
static struct platform_driver sof_audio = …;
module_platform_driver(…) …
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;
MODULE_IMPORT_NS(…);
MODULE_IMPORT_NS(…);
MODULE_IMPORT_NS(…);
MODULE_IMPORT_NS(…);