linux/sound/soc/intel/boards/bytcr_rt5640.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 *  byt_cr_dpcm_rt5640.c - ASoc Machine driver for Intel Byt CR platform
 *
 *  Copyright (C) 2014 Intel Corp
 *  Author: Subhransu S. Prusty <[email protected]>
 *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 *
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */

#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/platform_device.h>
#include <linux/acpi.h>
#include <linux/clk.h>
#include <linux/device.h>
#include <linux/device/bus.h>
#include <linux/dmi.h>
#include <linux/gpio/consumer.h>
#include <linux/gpio/machine.h>
#include <linux/input.h>
#include <linux/slab.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/jack.h>
#include <sound/soc-acpi.h>
#include <dt-bindings/sound/rt5640.h>
#include "../../codecs/rt5640.h"
#include "../atom/sst-atom-controls.h"
#include "../common/soc-intel-quirks.h"

#define BYT_RT5640_FALLBACK_CODEC_DEV_NAME

enum {};

#define RT5640_JD_SRC_EXT_GPIO

enum {};

enum {};

enum {};

#define BYT_RT5640_MAP(quirk)
#define BYT_RT5640_JDSRC(quirk)
#define BYT_RT5640_OVCD_TH(quirk)
#define BYT_RT5640_OVCD_SF(quirk)
#define BYT_RT5640_JD_NOT_INV
#define BYT_RT5640_MONO_SPEAKER
#define BYT_RT5640_DIFF_MIC
#define BYT_RT5640_SSP2_AIF2
#define BYT_RT5640_SSP0_AIF1
#define BYT_RT5640_SSP0_AIF2
#define BYT_RT5640_MCLK_EN
#define BYT_RT5640_MCLK_25MHZ
#define BYT_RT5640_NO_SPEAKERS
#define BYT_RT5640_LINEOUT
#define BYT_RT5640_LINEOUT_AS_HP2
#define BYT_RT5640_HSMIC2_ON_IN1
#define BYT_RT5640_JD_HP_ELITEP_1000G2
#define BYT_RT5640_USE_AMCR0F28
#define BYT_RT5640_SWAPPED_SPEAKERS

#define BYTCR_INPUT_DEFAULTS

/* in-diff or dmic-pin + jdsrc + ovcd-th + -sf + jd-inv + terminating entry */
#define MAX_NO_PROPS

struct byt_rt5640_private {};
static bool is_bytcr;

static unsigned long byt_rt5640_quirk =;
static int quirk_override =;
module_param_named(quirk, quirk_override, int, 0444);
MODULE_PARM_DESC();

static void log_quirks(struct device *dev)
{}

static int byt_rt5640_prepare_and_enable_pll1(struct snd_soc_dai *codec_dai,
					      int rate)
{}

#define BYT_CODEC_DAI1
#define BYT_CODEC_DAI2

static struct snd_soc_dai *byt_rt5640_get_codec_dai(struct snd_soc_dapm_context *dapm)
{}

static int platform_clock_control(struct snd_soc_dapm_widget *w,
				  struct snd_kcontrol *k, int  event)
{}

static int byt_rt5640_event_lineout(struct snd_soc_dapm_widget *w,
			struct snd_kcontrol *k, int event)
{}

static const struct snd_soc_dapm_widget byt_rt5640_widgets[] =;

static const struct snd_soc_dapm_route byt_rt5640_audio_map[] =;

static const struct snd_soc_dapm_route byt_rt5640_intmic_dmic1_map[] =;

static const struct snd_soc_dapm_route byt_rt5640_intmic_dmic2_map[] =;

static const struct snd_soc_dapm_route byt_rt5640_intmic_in1_map[] =;

static const struct snd_soc_dapm_route byt_rt5640_intmic_in3_map[] =;

static const struct snd_soc_dapm_route byt_rt5640_hsmic2_in1_map[] =;

static const struct snd_soc_dapm_route byt_rt5640_ssp2_aif1_map[] =;

static const struct snd_soc_dapm_route byt_rt5640_ssp2_aif2_map[] =;

static const struct snd_soc_dapm_route byt_rt5640_ssp0_aif1_map[] =;

static const struct snd_soc_dapm_route byt_rt5640_ssp0_aif2_map[] =;

static const struct snd_soc_dapm_route byt_rt5640_stereo_spk_map[] =;

static const struct snd_soc_dapm_route byt_rt5640_mono_spk_map[] =;

static const struct snd_soc_dapm_route byt_rt5640_lineout_map[] =;

static const struct snd_kcontrol_new byt_rt5640_controls[] =;

static struct snd_soc_jack_pin rt5640_pins[] =;

static struct snd_soc_jack_pin rt5640_pins2[] =;

static struct snd_soc_jack_gpio rt5640_jack_gpio =;

static struct snd_soc_jack_gpio rt5640_jack2_gpio =;

static const struct acpi_gpio_params acpi_gpio0 =;
static const struct acpi_gpio_params acpi_gpio1 =;
static const struct acpi_gpio_params acpi_gpio2 =;

static const struct acpi_gpio_mapping byt_rt5640_hp_elitepad_1000g2_gpios[] =;

static int byt_rt5640_hp_elitepad_1000g2_jack1_check(void *data)
{}

static int byt_rt5640_hp_elitepad_1000g2_jack2_check(void *data)
{}

static int byt_rt5640_aif1_hw_params(struct snd_pcm_substream *substream,
					struct snd_pcm_hw_params *params)
{}

/* Please keep this list alphabetically sorted */
static const struct dmi_system_id byt_rt5640_quirk_table[] =;

/*
 * Note this MUST be called before snd_soc_register_card(), so that the props
 * are in place before the codec component driver's probe function parses them.
 */
static int byt_rt5640_add_codec_device_props(struct device *i2c_dev,
					     struct byt_rt5640_private *priv)
{}

/* Some Android devs specify IRQs/GPIOS in a special AMCR0F28 ACPI device */
static const struct acpi_gpio_params amcr0f28_jd_gpio =;

static const struct acpi_gpio_mapping amcr0f28_gpios[] =;

static int byt_rt5640_get_amcr0f28_settings(struct snd_soc_card *card)
{}

static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
{}

static void byt_rt5640_exit(struct snd_soc_pcm_runtime *runtime)
{}

static int byt_rt5640_codec_fixup(struct snd_soc_pcm_runtime *rtd,
			    struct snd_pcm_hw_params *params)
{}

static int byt_rt5640_aif1_startup(struct snd_pcm_substream *substream)
{}

static const struct snd_soc_ops byt_rt5640_aif1_ops =;

static const struct snd_soc_ops byt_rt5640_be_ssp2_ops =;

SND_SOC_DAILINK_DEF(dummy,
	DAILINK_COMP_ARRAY(COMP_DUMMY()));

SND_SOC_DAILINK_DEF(media,
	DAILINK_COMP_ARRAY(COMP_CPU("media-cpu-dai")));

SND_SOC_DAILINK_DEF(deepbuffer,
	DAILINK_COMP_ARRAY(COMP_CPU("deepbuffer-cpu-dai")));

SND_SOC_DAILINK_DEF(ssp2_port,
	/* overwritten for ssp0 routing */
	DAILINK_COMP_ARRAY(COMP_CPU("ssp2-port")));
SND_SOC_DAILINK_DEF(ssp2_codec,
	DAILINK_COMP_ARRAY(COMP_CODEC(
	/* overwritten with HID */ "i2c-10EC5640:00",
	/* changed w/ quirk */	"rt5640-aif1")));

SND_SOC_DAILINK_DEF(platform,
	DAILINK_COMP_ARRAY(COMP_PLATFORM("sst-mfld-platform")));

static struct snd_soc_dai_link byt_rt5640_dais[] =;

/* SoC card */
static char byt_rt5640_codec_name[SND_ACPI_I2C_ID_LEN];
#if !IS_ENABLED(CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES)
static char byt_rt5640_long_name[40]; /* = "bytcr-rt5640-*-spk-*-mic" */
#endif
static char byt_rt5640_components[64]; /* = "cfg-spk:* cfg-mic:* ..." */

static int byt_rt5640_suspend(struct snd_soc_card *card)
{}

static int byt_rt5640_resume(struct snd_soc_card *card)
{}

/* use space before codec name to simplify card ID, and simplify driver name */
#define SOF_CARD_NAME
#define SOF_DRIVER_NAME

#define CARD_NAME
#define DRIVER_NAME

static struct snd_soc_card byt_rt5640_card =;

struct acpi_chan_package {};

static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
{}

static void snd_byt_rt5640_mc_remove(struct platform_device *pdev)
{}

static struct platform_driver snd_byt_rt5640_mc_driver =;

module_platform_driver();

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();
MODULE_ALIAS();