Commit b35ddfd4 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/topic/rt5514', 'asoc/topic/rt5616',...

Merge remote-tracking branches 'asoc/topic/rt5514', 'asoc/topic/rt5616', 'asoc/topic/rt5640', 'asoc/topic/rt5660' and 'asoc/topic/rt5663' into asoc-next
...@@ -13,6 +13,9 @@ Optional properties: ...@@ -13,6 +13,9 @@ Optional properties:
- clocks: The phandle of the master clock to the CODEC - clocks: The phandle of the master clock to the CODEC
- clock-names: Should be "mclk" - clock-names: Should be "mclk"
- realtek,dmic-init-delay-ms
Set the DMIC initial delay (ms) to wait it ready.
Pins on the device (for linking into audio routes) for RT5514: Pins on the device (for linking into audio routes) for RT5514:
* DMIC1L * DMIC1L
......
RT5663/RT5668 audio CODEC RT5663 audio CODEC
This device supports I2C only. This device supports I2C only.
Required properties: Required properties:
- compatible : One of "realtek,rt5663" or "realtek,rt5668". - compatible : "realtek,rt5663".
- reg : The I2C address of the device. - reg : The I2C address of the device.
...@@ -12,7 +12,7 @@ Required properties: ...@@ -12,7 +12,7 @@ Required properties:
Optional properties: Optional properties:
Pins on the device (for linking into audio routes) for RT5663/RT5668: Pins on the device (for linking into audio routes) for RT5663:
* IN1P * IN1P
* IN1N * IN1N
......
RT5665/RT5666/RT5668 audio CODEC
This device supports I2C only.
Required properties:
- compatible : One of "realtek,rt5665", "realtek,rt5666" or "realtek,rt5668".
- reg : The I2C address of the device.
- interrupts : The CODEC's interrupt output.
Optional properties:
- realtek,in1-differential
- realtek,in2-differential
- realtek,in3-differential
- realtek,in4-differential
Boolean. Indicate MIC1/2/3/4 input are differential, rather than single-ended.
- realtek,dmic1-data-pin
0: dmic1 is not used
1: using GPIO4 pin as dmic1 data pin
2: using IN2N pin as dmic2 data pin
- realtek,dmic2-data-pin
0: dmic2 is not used
1: using GPIO5 pin as dmic2 data pin
2: using IN2P pin as dmic2 data pin
- realtek,jd-src
0: No JD is used
1: using JD1 as JD source
- realtek,ldo1-en-gpios : The GPIO that controls the CODEC's LDO1_EN pin.
Pins on the device (for linking into audio routes) for RT5659/RT5658:
* DMIC L1
* DMIC R1
* DMIC L2
* DMIC R2
* IN1P
* IN1N
* IN2P
* IN2N
* IN3P
* IN3N
* IN4P
* IN4N
* HPOL
* HPOR
* LOUTL
* LOUTR
* MONOOUT
* PDML
* PDMR
Example:
rt5659 {
compatible = "realtek,rt5665";
reg = <0x1b>;
interrupt-parent = <&gpio>;
interrupts = <TEGRA_GPIO(W, 3) GPIO_ACTIVE_HIGH>;
realtek,ldo1-en-gpios =
<&gpio TEGRA_GPIO(V, 3) GPIO_ACTIVE_HIGH>;
};
/*
* linux/sound/rt5514.h -- Platform data for RT5514
*
* Copyright 2016 Realtek Semiconductor Corp.
* Author: Oder Chiou <oder_chiou@realtek.com>
*
* 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.
*/
#ifndef __LINUX_SND_RT5514_H
#define __LINUX_SND_RT5514_H
struct rt5514_platform_data {
unsigned int dmic_init_delay;
};
#endif
/*
* linux/sound/rt5665.h -- Platform data for RT5665
*
* Copyright 2016 Realtek Microelectronics
*
* 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.
*/
#ifndef __LINUX_SND_RT5665_H
#define __LINUX_SND_RT5665_H
enum rt5665_dmic1_data_pin {
RT5665_DMIC1_NULL,
RT5665_DMIC1_DATA_GPIO4,
RT5665_DMIC1_DATA_IN2N,
};
enum rt5665_dmic2_data_pin {
RT5665_DMIC2_NULL,
RT5665_DMIC2_DATA_GPIO5,
RT5665_DMIC2_DATA_IN2P,
};
enum rt5665_jd_src {
RT5665_JD_NULL,
RT5665_JD1,
};
struct rt5665_platform_data {
bool in1_diff;
bool in2_diff;
bool in3_diff;
bool in4_diff;
int ldo1_en; /* GPIO for LDO1_EN */
enum rt5665_dmic1_data_pin dmic1_data_pin;
enum rt5665_dmic2_data_pin dmic2_data_pin;
enum rt5665_jd_src jd_src;
unsigned int sar_hs_type;
};
#endif
...@@ -117,6 +117,7 @@ config SND_SOC_ALL_CODECS ...@@ -117,6 +117,7 @@ config SND_SOC_ALL_CODECS
select SND_SOC_RT5651 if I2C select SND_SOC_RT5651 if I2C
select SND_SOC_RT5659 if I2C select SND_SOC_RT5659 if I2C
select SND_SOC_RT5660 if I2C select SND_SOC_RT5660 if I2C
select SND_SOC_RT5665 if I2C
select SND_SOC_RT5663 if I2C select SND_SOC_RT5663 if I2C
select SND_SOC_RT5670 if I2C select SND_SOC_RT5670 if I2C
select SND_SOC_RT5677 if I2C && SPI_MASTER select SND_SOC_RT5677 if I2C && SPI_MASTER
...@@ -667,6 +668,7 @@ config SND_SOC_RL6231 ...@@ -667,6 +668,7 @@ config SND_SOC_RL6231
default y if SND_SOC_RT5651=y default y if SND_SOC_RT5651=y
default y if SND_SOC_RT5659=y default y if SND_SOC_RT5659=y
default y if SND_SOC_RT5660=y default y if SND_SOC_RT5660=y
default y if SND_SOC_RT5665=y
default y if SND_SOC_RT5663=y default y if SND_SOC_RT5663=y
default y if SND_SOC_RT5670=y default y if SND_SOC_RT5670=y
default y if SND_SOC_RT5677=y default y if SND_SOC_RT5677=y
...@@ -677,6 +679,7 @@ config SND_SOC_RL6231 ...@@ -677,6 +679,7 @@ config SND_SOC_RL6231
default m if SND_SOC_RT5651=m default m if SND_SOC_RT5651=m
default m if SND_SOC_RT5659=m default m if SND_SOC_RT5659=m
default m if SND_SOC_RT5660=m default m if SND_SOC_RT5660=m
default m if SND_SOC_RT5665=m
default m if SND_SOC_RT5663=m default m if SND_SOC_RT5663=m
default m if SND_SOC_RT5670=m default m if SND_SOC_RT5670=m
default m if SND_SOC_RT5677=m default m if SND_SOC_RT5677=m
...@@ -725,6 +728,9 @@ config SND_SOC_RT5659 ...@@ -725,6 +728,9 @@ config SND_SOC_RT5659
config SND_SOC_RT5660 config SND_SOC_RT5660
tristate tristate
config SND_SOC_RT5665
tristate
config SND_SOC_RT5663 config SND_SOC_RT5663
tristate tristate
......
...@@ -118,6 +118,7 @@ snd-soc-rt5645-objs := rt5645.o ...@@ -118,6 +118,7 @@ snd-soc-rt5645-objs := rt5645.o
snd-soc-rt5651-objs := rt5651.o snd-soc-rt5651-objs := rt5651.o
snd-soc-rt5659-objs := rt5659.o snd-soc-rt5659-objs := rt5659.o
snd-soc-rt5660-objs := rt5660.o snd-soc-rt5660-objs := rt5660.o
snd-soc-rt5665-objs := rt5665.o
snd-soc-rt5663-objs := rt5663.o snd-soc-rt5663-objs := rt5663.o
snd-soc-rt5670-objs := rt5670.o snd-soc-rt5670-objs := rt5670.o
snd-soc-rt5677-objs := rt5677.o snd-soc-rt5677-objs := rt5677.o
...@@ -345,6 +346,7 @@ obj-$(CONFIG_SND_SOC_RT5645) += snd-soc-rt5645.o ...@@ -345,6 +346,7 @@ obj-$(CONFIG_SND_SOC_RT5645) += snd-soc-rt5645.o
obj-$(CONFIG_SND_SOC_RT5651) += snd-soc-rt5651.o obj-$(CONFIG_SND_SOC_RT5651) += snd-soc-rt5651.o
obj-$(CONFIG_SND_SOC_RT5659) += snd-soc-rt5659.o obj-$(CONFIG_SND_SOC_RT5659) += snd-soc-rt5659.o
obj-$(CONFIG_SND_SOC_RT5660) += snd-soc-rt5660.o obj-$(CONFIG_SND_SOC_RT5660) += snd-soc-rt5660.o
obj-$(CONFIG_SND_SOC_RT5665) += snd-soc-rt5665.o
obj-$(CONFIG_SND_SOC_RT5663) += snd-soc-rt5663.o obj-$(CONFIG_SND_SOC_RT5663) += snd-soc-rt5663.o
obj-$(CONFIG_SND_SOC_RT5670) += snd-soc-rt5670.o obj-$(CONFIG_SND_SOC_RT5670) += snd-soc-rt5670.o
obj-$(CONFIG_SND_SOC_RT5677) += snd-soc-rt5677.o obj-$(CONFIG_SND_SOC_RT5677) += snd-soc-rt5677.o
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/kthread.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
......
...@@ -452,6 +452,9 @@ static int rt5514_set_dmic_clk(struct snd_soc_dapm_widget *w, ...@@ -452,6 +452,9 @@ static int rt5514_set_dmic_clk(struct snd_soc_dapm_widget *w,
RT5514_CLK_DMIC_OUT_SEL_MASK, RT5514_CLK_DMIC_OUT_SEL_MASK,
idx << RT5514_CLK_DMIC_OUT_SEL_SFT); idx << RT5514_CLK_DMIC_OUT_SEL_SFT);
if (rt5514->pdata.dmic_init_delay)
msleep(rt5514->pdata.dmic_init_delay);
return idx; return idx;
} }
...@@ -1073,9 +1076,18 @@ static const struct of_device_id rt5514_of_match[] = { ...@@ -1073,9 +1076,18 @@ static const struct of_device_id rt5514_of_match[] = {
MODULE_DEVICE_TABLE(of, rt5514_of_match); MODULE_DEVICE_TABLE(of, rt5514_of_match);
#endif #endif
static int rt5514_parse_dt(struct rt5514_priv *rt5514, struct device *dev)
{
device_property_read_u32(dev, "realtek,dmic-init-delay-ms",
&rt5514->pdata.dmic_init_delay);
return 0;
}
static int rt5514_i2c_probe(struct i2c_client *i2c, static int rt5514_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
struct rt5514_platform_data *pdata = dev_get_platdata(&i2c->dev);
struct rt5514_priv *rt5514; struct rt5514_priv *rt5514;
int ret; int ret;
unsigned int val; unsigned int val;
...@@ -1087,6 +1099,11 @@ static int rt5514_i2c_probe(struct i2c_client *i2c, ...@@ -1087,6 +1099,11 @@ static int rt5514_i2c_probe(struct i2c_client *i2c,
i2c_set_clientdata(i2c, rt5514); i2c_set_clientdata(i2c, rt5514);
if (pdata)
rt5514->pdata = *pdata;
else if (i2c->dev.of_node)
rt5514_parse_dt(rt5514, &i2c->dev);
rt5514->i2c_regmap = devm_regmap_init_i2c(i2c, &rt5514_i2c_regmap); rt5514->i2c_regmap = devm_regmap_init_i2c(i2c, &rt5514_i2c_regmap);
if (IS_ERR(rt5514->i2c_regmap)) { if (IS_ERR(rt5514->i2c_regmap)) {
ret = PTR_ERR(rt5514->i2c_regmap); ret = PTR_ERR(rt5514->i2c_regmap);
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#define __RT5514_H__ #define __RT5514_H__
#include <linux/clk.h> #include <linux/clk.h>
#include <sound/rt5514.h>
#define RT5514_DEVICE_ID 0x10ec5514 #define RT5514_DEVICE_ID 0x10ec5514
...@@ -243,6 +244,7 @@ enum { ...@@ -243,6 +244,7 @@ enum {
}; };
struct rt5514_priv { struct rt5514_priv {
struct rt5514_platform_data pdata;
struct snd_soc_codec *codec; struct snd_soc_codec *codec;
struct regmap *i2c_regmap, *regmap; struct regmap *i2c_regmap, *regmap;
struct clk *mclk; struct clk *mclk;
......
...@@ -960,8 +960,7 @@ static int rt5616_hw_params(struct snd_pcm_substream *substream, ...@@ -960,8 +960,7 @@ static int rt5616_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_codec *codec = dai->codec;
struct snd_soc_codec *codec = rtd->codec;
struct rt5616_priv *rt5616 = snd_soc_codec_get_drvdata(codec); struct rt5616_priv *rt5616 = snd_soc_codec_get_drvdata(codec);
unsigned int val_len = 0, val_clk, mask_clk; unsigned int val_len = 0, val_clk, mask_clk;
int pre_div, bclk_ms, frame_size; int pre_div, bclk_ms, frame_size;
......
...@@ -423,6 +423,8 @@ static const struct snd_kcontrol_new rt5640_snd_controls[] = { ...@@ -423,6 +423,8 @@ static const struct snd_kcontrol_new rt5640_snd_controls[] = {
SOC_DOUBLE_TLV("ADC Capture Volume", RT5640_ADC_DIG_VOL, SOC_DOUBLE_TLV("ADC Capture Volume", RT5640_ADC_DIG_VOL,
RT5640_L_VOL_SFT, RT5640_R_VOL_SFT, RT5640_L_VOL_SFT, RT5640_R_VOL_SFT,
127, 0, adc_vol_tlv), 127, 0, adc_vol_tlv),
SOC_DOUBLE("Mono ADC Capture Switch", RT5640_DUMMY1,
RT5640_M_MONO_ADC_L_SFT, RT5640_M_MONO_ADC_R_SFT, 1, 1),
SOC_DOUBLE_TLV("Mono ADC Capture Volume", RT5640_ADC_DATA, SOC_DOUBLE_TLV("Mono ADC Capture Volume", RT5640_ADC_DATA,
RT5640_L_VOL_SFT, RT5640_R_VOL_SFT, RT5640_L_VOL_SFT, RT5640_R_VOL_SFT,
127, 0, adc_vol_tlv), 127, 0, adc_vol_tlv),
...@@ -2407,6 +2409,9 @@ static int rt5640_i2c_probe(struct i2c_client *i2c, ...@@ -2407,6 +2409,9 @@ static int rt5640_i2c_probe(struct i2c_client *i2c,
if (ret != 0) if (ret != 0)
dev_warn(&i2c->dev, "Failed to apply regmap patch: %d\n", ret); dev_warn(&i2c->dev, "Failed to apply regmap patch: %d\n", ret);
regmap_update_bits(rt5640->regmap, RT5640_DUMMY1,
RT5640_MCLK_DET, RT5640_MCLK_DET);
if (rt5640->pdata.in1_diff) if (rt5640->pdata.in1_diff)
regmap_update_bits(rt5640->regmap, RT5640_IN1_IN2, regmap_update_bits(rt5640->regmap, RT5640_IN1_IN2,
RT5640_IN_DF1, RT5640_IN_DF1); RT5640_IN_DF1, RT5640_IN_DF1);
......
...@@ -1970,6 +1970,12 @@ ...@@ -1970,6 +1970,12 @@
#define RT5640_ZCD_HP_DIS (0x0 << 15) #define RT5640_ZCD_HP_DIS (0x0 << 15)
#define RT5640_ZCD_HP_EN (0x1 << 15) #define RT5640_ZCD_HP_EN (0x1 << 15)
/* General Control 1 (0xfa) */
#define RT5640_M_MONO_ADC_L (0x1 << 13)
#define RT5640_M_MONO_ADC_L_SFT 13
#define RT5640_M_MONO_ADC_R (0x1 << 12)
#define RT5640_M_MONO_ADC_R_SFT 12
#define RT5640_MCLK_DET (0x1 << 11)
/* Codec Private Register definition */ /* Codec Private Register definition */
/* 3D Speaker Control (0x63) */ /* 3D Speaker Control (0x63) */
......
...@@ -1311,6 +1311,10 @@ static int rt5660_i2c_probe(struct i2c_client *i2c, ...@@ -1311,6 +1311,10 @@ static int rt5660_i2c_probe(struct i2c_client *i2c,
if (ret != 0) if (ret != 0)
dev_warn(&i2c->dev, "Failed to apply regmap patch: %d\n", ret); dev_warn(&i2c->dev, "Failed to apply regmap patch: %d\n", ret);
regmap_update_bits(rt5660->regmap, RT5660_GEN_CTRL1,
RT5660_AUTO_DIS_AMP | RT5660_MCLK_DET | RT5660_POW_CLKDET,
RT5660_AUTO_DIS_AMP | RT5660_MCLK_DET | RT5660_POW_CLKDET);
if (rt5660->pdata.dmic1_data_pin) { if (rt5660->pdata.dmic1_data_pin) {
regmap_update_bits(rt5660->regmap, RT5660_GPIO_CTRL1, regmap_update_bits(rt5660->regmap, RT5660_GPIO_CTRL1,
RT5660_GP1_PIN_MASK, RT5660_GP1_PIN_DMIC1_SCL); RT5660_GP1_PIN_MASK, RT5660_GP1_PIN_DMIC1_SCL);
......
...@@ -810,6 +810,9 @@ ...@@ -810,6 +810,9 @@
/* General Control 1 (0xfa) */ /* General Control 1 (0xfa) */
#define RT5660_PWR_VREF_HP (0x1 << 11) #define RT5660_PWR_VREF_HP (0x1 << 11)
#define RT5660_PWR_VREF_HP_SFT 11 #define RT5660_PWR_VREF_HP_SFT 11
#define RT5660_AUTO_DIS_AMP (0x1 << 6)
#define RT5660_MCLK_DET (0x1 << 5)
#define RT5660_POW_CLKDET (0x1 << 1)
#define RT5660_DIG_GATE_CTRL (0x1) #define RT5660_DIG_GATE_CTRL (0x1)
#define RT5660_DIG_GATE_CTRL_SFT 0 #define RT5660_DIG_GATE_CTRL_SFT 0
......
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