Unverified Commit c9ae06de authored by Mark Brown's avatar Mark Brown
Browse files

Merge branch 'topic/rt5651' of...

Merge branch 'topic/rt5651' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-intel
parents e39cacc1 ee680968
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -16,6 +16,23 @@ Optional properties:
- realtek,dmic-en
  Boolean. true if dmic is used.

- realtek,jack-detect-source
  u32. Valid values:
  1: Use JD1_1 pin for jack-dectect
  2: Use JD1_2 pin for jack-dectect
  3: Use JD2 pin for jack-dectect

- realtek,over-current-threshold-microamp
  u32, micbias over-current detection threshold in µA, valid values are
  600, 1500 and 2000µA.

- realtek,over-current-scale-factor
  u32, micbias over-current detection scale-factor, valid values are:
  0: Scale current by 0.5
  1: Scale current by 0.75
  2: Scale current by 1.0
  3: Scale current by 1.5

Pins on the device (for linking into audio routes) for RT5651:

  * DMIC L1
+13 −6
Original line number Diff line number Diff line
@@ -11,6 +11,10 @@
#ifndef __LINUX_SND_RT5651_H
#define __LINUX_SND_RT5651_H

/*
 * Note these MUST match the values from the DT binding:
 * Documentation/devicetree/bindings/sound/rt5651.txt
 */
enum rt5651_jd_src {
	RT5651_JD_NULL,
	RT5651_JD1_1,
@@ -18,12 +22,15 @@ enum rt5651_jd_src {
	RT5651_JD2,
};

struct rt5651_platform_data {
	/* IN2 can optionally be differential */
	bool in2_diff;

	bool dmic_en;
	enum rt5651_jd_src jd_src;
/*
 * Note these MUST match the values from the DT binding:
 * Documentation/devicetree/bindings/sound/rt5651.txt
 */
enum rt5651_ovcd_sf {
	RT5651_OVCD_SF_0P5,
	RT5651_OVCD_SF_0P75,
	RT5651_OVCD_SF_1P0,
	RT5651_OVCD_SF_1P5,
};

#endif
+404 −348

File changed.

Preview size limit exceeded, changes collapsed.

+16 −5
Original line number Diff line number Diff line
@@ -138,6 +138,7 @@
/* Index of Codec Private Register definition */
#define RT5651_BIAS_CUR1			0x12
#define RT5651_BIAS_CUR3			0x14
#define RT5651_BIAS_CUR4			0x15
#define RT5651_CLSD_INT_REG1			0x1c
#define RT5651_CHPUMP_INT_REG1			0x24
#define RT5651_MAMP_INT_REG2			0x37
@@ -1966,6 +1967,15 @@
#define RT5651_D_GATE_EN_SFT			0

/* Codec Private Register definition */

/* MIC Over current threshold scale factor (0x15) */
#define RT5651_MIC_OVCD_SF_MASK			(0x3 << 8)
#define RT5651_MIC_OVCD_SF_SFT			8
#define RT5651_MIC_OVCD_SF_0P5			(0x0 << 8)
#define RT5651_MIC_OVCD_SF_0P75			(0x1 << 8)
#define RT5651_MIC_OVCD_SF_1P0			(0x2 << 8)
#define RT5651_MIC_OVCD_SF_1P5			(0x3 << 8)

/* 3D Speaker Control (0x63) */
#define RT5651_3D_SPK_MASK			(0x1 << 15)
#define RT5651_3D_SPK_SFT			15
@@ -2059,12 +2069,15 @@ struct rt5651_pll_code {
};

struct rt5651_priv {
	struct snd_soc_codec *codec;
	struct rt5651_platform_data pdata;
	struct snd_soc_component *component;
	struct regmap *regmap;
	struct snd_soc_jack *hp_jack;
	struct delayed_work jack_detect_work;
	struct work_struct jack_detect_work;
	enum rt5651_jd_src jd_src;
	unsigned int ovcd_th;
	unsigned int ovcd_sf;

	int irq;
	int sysclk;
	int sysclk_src;
	int lrck[RT5651_AIFS];
@@ -2079,6 +2092,4 @@ struct rt5651_priv {
	bool hp_mute;
};

int rt5651_set_jack_detect(struct snd_soc_codec *codec,
			   struct snd_soc_jack *hp_jack);
#endif /* __RT5651_H__ */
+2 −2
Original line number Diff line number Diff line
@@ -296,7 +296,7 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
{
	struct snd_soc_card *card = runtime->card;
	struct snd_soc_codec *codec = runtime->codec;
	struct snd_soc_component *codec = runtime->codec_dai->component;
	struct byt_rt5651_private *priv = snd_soc_card_get_drvdata(card);
	const struct snd_soc_dapm_route *custom_map;
	int num_routes;
@@ -370,7 +370,7 @@ static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
		return ret;
	}

	rt5651_set_jack_detect(codec, &priv->jack);
	snd_soc_component_set_jack(codec, &priv->jack, NULL);

	return ret;
}