Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branch v6.1 rc8 mostly reverted #5

Open
wants to merge 2 commits into
base: branch-v6.1-rc1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sound/soc/codecs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1629,6 +1629,7 @@ config SND_SOC_TFA989X
config SND_SOC_TLV320ADC3XXX
tristate "Texas Instruments TLV320ADC3001/3101 audio ADC"
depends on I2C
depends on GPIOLIB
help
Enable support for Texas Instruments TLV320ADC3001 and TLV320ADC3101
ADCs.
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/codecs/cs42l51.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ static const struct snd_kcontrol_new cs42l51_snd_controls[] = {
0, 0xA0, 96, adc_att_tlv),
SOC_DOUBLE_R_SX_TLV("PGA Volume",
CS42L51_ALC_PGA_CTL, CS42L51_ALC_PGB_CTL,
0, 0x19, 30, pga_tlv),
0, 0x1A, 30, pga_tlv),
SOC_SINGLE("Playback Deemphasis Switch", CS42L51_DAC_CTL, 3, 1, 0),
SOC_SINGLE("Auto-Mute Switch", CS42L51_DAC_CTL, 2, 1, 0),
SOC_SINGLE("Soft Ramp Switch", CS42L51_DAC_CTL, 1, 1, 0),
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/codecs/cx2072x.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
#define CX2072X_PLBK_DRC_PARM_LEN 9
#define CX2072X_CLASSD_AMP_LEN 6

/* DAI interfae type */
/* DAI interface type */
#define CX2072X_DAI_HIFI 1
#define CX2072X_DAI_DSP 2
#define CX2072X_DAI_DSP_PWM 3 /* 4 ch, including mic and AEC */
Expand Down
4 changes: 2 additions & 2 deletions sound/soc/codecs/hdac_hda.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ enum {
HDAC_HDMI_1_DAI_ID,
HDAC_HDMI_2_DAI_ID,
HDAC_HDMI_3_DAI_ID,
HDAC_LAST_DAI_ID = HDAC_HDMI_3_DAI_ID,
HDAC_DAI_ID_NUM
};

struct hdac_hda_pcm {
Expand All @@ -24,7 +24,7 @@ struct hdac_hda_pcm {

struct hdac_hda_priv {
struct hda_codec *codec;
struct hdac_hda_pcm pcm[HDAC_LAST_DAI_ID];
struct hdac_hda_pcm pcm[HDAC_DAI_ID_NUM];
bool need_display_power;
};

Expand Down
34 changes: 19 additions & 15 deletions sound/soc/codecs/jz4725b.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,26 +136,29 @@ enum {
#define REG_CGR3_GO1L_OFFSET 0
#define REG_CGR3_GO1L_MASK (0x1f << REG_CGR3_GO1L_OFFSET)

#define REG_CGR10_GIL_OFFSET 0
#define REG_CGR10_GIR_OFFSET 4

struct jz_icdc {
struct regmap *regmap;
void __iomem *base;
struct clk *clk;
};

static const SNDRV_CTL_TLVD_DECLARE_DB_LINEAR(jz4725b_dac_tlv, -2250, 0);
static const SNDRV_CTL_TLVD_DECLARE_DB_LINEAR(jz4725b_line_tlv, -1500, 600);
static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(jz4725b_adc_tlv, 0, 150, 0);
static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(jz4725b_dac_tlv, -2250, 150, 0);

static const struct snd_kcontrol_new jz4725b_codec_controls[] = {
SOC_DOUBLE_TLV("Master Playback Volume",
JZ4725B_CODEC_REG_CGR1,
REG_CGR1_GODL_OFFSET,
REG_CGR1_GODR_OFFSET,
0xf, 1, jz4725b_dac_tlv),
SOC_DOUBLE_R_TLV("Master Capture Volume",
JZ4725B_CODEC_REG_CGR3,
JZ4725B_CODEC_REG_CGR2,
REG_CGR2_GO1R_OFFSET,
0x1f, 1, jz4725b_line_tlv),
SOC_DOUBLE_TLV("Master Capture Volume",
JZ4725B_CODEC_REG_CGR10,
REG_CGR10_GIL_OFFSET,
REG_CGR10_GIR_OFFSET,
0xf, 0, jz4725b_adc_tlv),

SOC_SINGLE("Master Playback Switch", JZ4725B_CODEC_REG_CR1,
REG_CR1_DAC_MUTE_OFFSET, 1, 1),
Expand All @@ -180,7 +183,7 @@ static SOC_VALUE_ENUM_SINGLE_DECL(jz4725b_codec_adc_src_enum,
jz4725b_codec_adc_src_texts,
jz4725b_codec_adc_src_values);
static const struct snd_kcontrol_new jz4725b_codec_adc_src_ctrl =
SOC_DAPM_ENUM("Route", jz4725b_codec_adc_src_enum);
SOC_DAPM_ENUM("ADC Source Capture Route", jz4725b_codec_adc_src_enum);

static const struct snd_kcontrol_new jz4725b_codec_mixer_controls[] = {
SOC_DAPM_SINGLE("Line In Bypass", JZ4725B_CODEC_REG_CR1,
Expand Down Expand Up @@ -225,7 +228,7 @@ static const struct snd_soc_dapm_widget jz4725b_codec_dapm_widgets[] = {
SND_SOC_DAPM_ADC("ADC", "Capture",
JZ4725B_CODEC_REG_PMR1, REG_PMR1_SB_ADC_OFFSET, 1),

SND_SOC_DAPM_MUX("ADC Source", SND_SOC_NOPM, 0, 0,
SND_SOC_DAPM_MUX("ADC Source Capture Route", SND_SOC_NOPM, 0, 0,
&jz4725b_codec_adc_src_ctrl),

/* Mixer */
Expand All @@ -236,7 +239,8 @@ static const struct snd_soc_dapm_widget jz4725b_codec_dapm_widgets[] = {
SND_SOC_DAPM_MIXER("DAC to Mixer", JZ4725B_CODEC_REG_CR1,
REG_CR1_DACSEL_OFFSET, 0, NULL, 0),

SND_SOC_DAPM_MIXER("Line In", SND_SOC_NOPM, 0, 0, NULL, 0),
SND_SOC_DAPM_MIXER("Line In", JZ4725B_CODEC_REG_PMR1,
REG_PMR1_SB_LIN_OFFSET, 1, NULL, 0),
SND_SOC_DAPM_MIXER("HP Out", JZ4725B_CODEC_REG_CR1,
REG_CR1_HP_DIS_OFFSET, 1, NULL, 0),

Expand Down Expand Up @@ -283,11 +287,11 @@ static const struct snd_soc_dapm_route jz4725b_codec_dapm_routes[] = {
{"Mixer", NULL, "DAC to Mixer"},

{"Mixer to ADC", NULL, "Mixer"},
{"ADC Source", "Mixer", "Mixer to ADC"},
{"ADC Source", "Line In", "Line In"},
{"ADC Source", "Mic 1", "Mic 1"},
{"ADC Source", "Mic 2", "Mic 2"},
{"ADC", NULL, "ADC Source"},
{"ADC Source Capture Route", "Mixer", "Mixer to ADC"},
{"ADC Source Capture Route", "Line In", "Line In"},
{"ADC Source Capture Route", "Mic 1", "Mic 1"},
{"ADC Source Capture Route", "Mic 2", "Mic 2"},
{"ADC", NULL, "ADC Source Capture Route"},

{"Out Stage", NULL, "Mixer"},
{"HP Out", NULL, "Out Stage"},
Expand Down
4 changes: 4 additions & 0 deletions sound/soc/codecs/max98373-i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,10 @@ static int max98373_i2c_probe(struct i2c_client *i2c)
max98373->cache = devm_kcalloc(&i2c->dev, max98373->cache_num,
sizeof(*max98373->cache),
GFP_KERNEL);
if (!max98373->cache) {
ret = -ENOMEM;
return ret;
}

for (i = 0; i < max98373->cache_num; i++)
max98373->cache[i].reg = max98373_i2c_cache_reg[i];
Expand Down
8 changes: 4 additions & 4 deletions sound/soc/codecs/mt6660.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,14 +503,14 @@ static int mt6660_i2c_probe(struct i2c_client *client)
dev_err(chip->dev, "read chip revision fail\n");
goto probe_fail;
}
pm_runtime_set_active(chip->dev);
pm_runtime_enable(chip->dev);

ret = devm_snd_soc_register_component(chip->dev,
&mt6660_component_driver,
&mt6660_codec_dai, 1);
if (!ret) {
pm_runtime_set_active(chip->dev);
pm_runtime_enable(chip->dev);
}
if (ret)
pm_runtime_disable(chip->dev);

return ret;

Expand Down
20 changes: 11 additions & 9 deletions sound/soc/codecs/rt1019.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,18 +391,18 @@ static int rt1019_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
unsigned int rx_mask, int slots, int slot_width)
{
struct snd_soc_component *component = dai->component;
unsigned int val = 0, rx_slotnum;
unsigned int cn = 0, cl = 0, rx_slotnum;
int ret = 0, first_bit;

switch (slots) {
case 4:
val |= RT1019_I2S_TX_4CH;
cn = RT1019_I2S_TX_4CH;
break;
case 6:
val |= RT1019_I2S_TX_6CH;
cn = RT1019_I2S_TX_6CH;
break;
case 8:
val |= RT1019_I2S_TX_8CH;
cn = RT1019_I2S_TX_8CH;
break;
case 2:
break;
Expand All @@ -412,16 +412,16 @@ static int rt1019_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,

switch (slot_width) {
case 20:
val |= RT1019_I2S_DL_20;
cl = RT1019_TDM_CL_20;
break;
case 24:
val |= RT1019_I2S_DL_24;
cl = RT1019_TDM_CL_24;
break;
case 32:
val |= RT1019_I2S_DL_32;
cl = RT1019_TDM_CL_32;
break;
case 8:
val |= RT1019_I2S_DL_8;
cl = RT1019_TDM_CL_8;
break;
case 16:
break;
Expand Down Expand Up @@ -470,8 +470,10 @@ static int rt1019_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
goto _set_tdm_err_;
}

snd_soc_component_update_bits(component, RT1019_TDM_1,
RT1019_TDM_CL_MASK, cl);
snd_soc_component_update_bits(component, RT1019_TDM_2,
RT1019_I2S_CH_TX_MASK | RT1019_I2S_DF_MASK, val);
RT1019_I2S_CH_TX_MASK, cn);

_set_tdm_err_:
return ret;
Expand Down
6 changes: 6 additions & 0 deletions sound/soc/codecs/rt1019.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@
#define RT1019_TDM_BCLK_MASK (0x1 << 6)
#define RT1019_TDM_BCLK_NORM (0x0 << 6)
#define RT1019_TDM_BCLK_INV (0x1 << 6)
#define RT1019_TDM_CL_MASK (0x7)
#define RT1019_TDM_CL_8 (0x4)
#define RT1019_TDM_CL_32 (0x3)
#define RT1019_TDM_CL_24 (0x2)
#define RT1019_TDM_CL_20 (0x1)
#define RT1019_TDM_CL_16 (0x0)

/* 0x0401 TDM Control-2 */
#define RT1019_I2S_CH_TX_MASK (0x3 << 6)
Expand Down
17 changes: 14 additions & 3 deletions sound/soc/codecs/rt1308-sdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ static bool rt1308_volatile_register(struct device *dev, unsigned int reg)
case 0x3008:
case 0x300a:
case 0xc000:
case 0xc710:
case 0xc860 ... 0xc863:
case 0xc870 ... 0xc873:
return true;
Expand Down Expand Up @@ -200,6 +201,7 @@ static int rt1308_io_init(struct device *dev, struct sdw_slave *slave)
{
struct rt1308_sdw_priv *rt1308 = dev_get_drvdata(dev);
int ret = 0;
unsigned int tmp;

if (rt1308->hw_init)
return 0;
Expand Down Expand Up @@ -231,6 +233,10 @@ static int rt1308_io_init(struct device *dev, struct sdw_slave *slave)
/* sw reset */
regmap_write(rt1308->regmap, RT1308_SDW_RESET, 0);

regmap_read(rt1308->regmap, 0xc710, &tmp);
rt1308->hw_ver = tmp;
dev_dbg(dev, "%s, hw_ver=0x%x\n", __func__, rt1308->hw_ver);

/* initial settings */
regmap_write(rt1308->regmap, 0xc103, 0xc0);
regmap_write(rt1308->regmap, 0xc030, 0x17);
Expand All @@ -246,8 +252,14 @@ static int rt1308_io_init(struct device *dev, struct sdw_slave *slave)
regmap_write(rt1308->regmap, 0xc062, 0x05);
regmap_write(rt1308->regmap, 0xc171, 0x07);
regmap_write(rt1308->regmap, 0xc173, 0x0d);
regmap_write(rt1308->regmap, 0xc311, 0x7f);
regmap_write(rt1308->regmap, 0xc900, 0x90);
if (rt1308->hw_ver == RT1308_VER_C) {
regmap_write(rt1308->regmap, 0xc311, 0x7f);
regmap_write(rt1308->regmap, 0xc300, 0x09);
} else {
regmap_write(rt1308->regmap, 0xc311, 0x4f);
regmap_write(rt1308->regmap, 0xc300, 0x0b);
}
regmap_write(rt1308->regmap, 0xc900, 0x5a);
regmap_write(rt1308->regmap, 0xc1a0, 0x84);
regmap_write(rt1308->regmap, 0xc1a1, 0x01);
regmap_write(rt1308->regmap, 0xc360, 0x78);
Expand All @@ -257,7 +269,6 @@ static int rt1308_io_init(struct device *dev, struct sdw_slave *slave)
regmap_write(rt1308->regmap, 0xc070, 0x00);
regmap_write(rt1308->regmap, 0xc100, 0xd7);
regmap_write(rt1308->regmap, 0xc101, 0xd7);
regmap_write(rt1308->regmap, 0xc300, 0x09);

if (rt1308->first_hw_init) {
regcache_cache_bypass(rt1308->regmap, false);
Expand Down
3 changes: 3 additions & 0 deletions sound/soc/codecs/rt1308-sdw.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,12 @@ static const struct reg_default rt1308_reg_defaults[] = {
{ 0x3005, 0x23 },
{ 0x3008, 0x02 },
{ 0x300a, 0x00 },
{ 0xc000 | (RT1308_DATA_PATH << 4), 0x00 },
{ 0xc003 | (RT1308_DAC_SET << 4), 0x00 },
{ 0xc000 | (RT1308_POWER << 4), 0x00 },
{ 0xc001 | (RT1308_POWER << 4), 0x00 },
{ 0xc002 | (RT1308_POWER << 4), 0x00 },
{ 0xc000 | (RT1308_POWER_STATUS << 4), 0x00 },
};

#define RT1308_SDW_OFFSET 0xc000
Expand All @@ -163,6 +165,7 @@ struct rt1308_sdw_priv {
bool first_hw_init;
int rx_mask;
int slots;
int hw_ver;
};

struct sdw_stream_data {
Expand Down
5 changes: 5 additions & 0 deletions sound/soc/codecs/rt1308.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,4 +286,9 @@ enum {
RT1308_AIFS
};

enum rt1308_hw_ver {
RT1308_VER_C = 2,
RT1308_VER_D
};

#endif /* end of _RT1308_H_ */
15 changes: 8 additions & 7 deletions sound/soc/codecs/rt5514-spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,14 @@ static int rt5514_spi_pcm_new(struct snd_soc_component *component,
}

static const struct snd_soc_component_driver rt5514_spi_component = {
.name = DRV_NAME,
.probe = rt5514_spi_pcm_probe,
.open = rt5514_spi_pcm_open,
.hw_params = rt5514_spi_hw_params,
.hw_free = rt5514_spi_hw_free,
.pointer = rt5514_spi_pcm_pointer,
.pcm_construct = rt5514_spi_pcm_new,
.name = DRV_NAME,
.probe = rt5514_spi_pcm_probe,
.open = rt5514_spi_pcm_open,
.hw_params = rt5514_spi_hw_params,
.hw_free = rt5514_spi_hw_free,
.pointer = rt5514_spi_pcm_pointer,
.pcm_construct = rt5514_spi_pcm_new,
.legacy_dai_naming = 1,
};

/**
Expand Down
19 changes: 10 additions & 9 deletions sound/soc/codecs/rt5677-spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,15 +396,16 @@ static int rt5677_spi_pcm_probe(struct snd_soc_component *component)
}

static const struct snd_soc_component_driver rt5677_spi_dai_component = {
.name = DRV_NAME,
.probe = rt5677_spi_pcm_probe,
.open = rt5677_spi_pcm_open,
.close = rt5677_spi_pcm_close,
.hw_params = rt5677_spi_hw_params,
.hw_free = rt5677_spi_hw_free,
.prepare = rt5677_spi_prepare,
.pointer = rt5677_spi_pcm_pointer,
.pcm_construct = rt5677_spi_pcm_new,
.name = DRV_NAME,
.probe = rt5677_spi_pcm_probe,
.open = rt5677_spi_pcm_open,
.close = rt5677_spi_pcm_close,
.hw_params = rt5677_spi_hw_params,
.hw_free = rt5677_spi_hw_free,
.prepare = rt5677_spi_prepare,
.pointer = rt5677_spi_pcm_pointer,
.pcm_construct = rt5677_spi_pcm_new,
.legacy_dai_naming = 1,
};

/* Select a suitable transfer command for the next transfer to ensure
Expand Down
15 changes: 13 additions & 2 deletions sound/soc/codecs/rt5682s.c
Original file line number Diff line number Diff line change
Expand Up @@ -1981,7 +1981,7 @@ static int rt5682s_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
unsigned int rx_mask, int slots, int slot_width)
{
struct snd_soc_component *component = dai->component;
unsigned int cl, val = 0;
unsigned int cl, val = 0, tx_slotnum;

if (tx_mask || rx_mask)
snd_soc_component_update_bits(component,
Expand All @@ -1990,6 +1990,16 @@ static int rt5682s_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
snd_soc_component_update_bits(component,
RT5682S_TDM_ADDA_CTRL_2, RT5682S_TDM_EN, 0);

/* Tx slot configuration */
tx_slotnum = hweight_long(tx_mask);
if (tx_slotnum) {
if (tx_slotnum > slots) {
dev_err(component->dev, "Invalid or oversized Tx slots.\n");
return -EINVAL;
}
val |= (tx_slotnum - 1) << RT5682S_TDM_ADC_DL_SFT;
}

switch (slots) {
case 4:
val |= RT5682S_TDM_TX_CH_4;
Expand All @@ -2010,7 +2020,8 @@ static int rt5682s_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
}

snd_soc_component_update_bits(component, RT5682S_TDM_CTRL,
RT5682S_TDM_TX_CH_MASK | RT5682S_TDM_RX_CH_MASK, val);
RT5682S_TDM_TX_CH_MASK | RT5682S_TDM_RX_CH_MASK |
RT5682S_TDM_ADC_DL_MASK, val);

switch (slot_width) {
case 8:
Expand Down
1 change: 1 addition & 0 deletions sound/soc/codecs/rt5682s.h
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,7 @@
#define RT5682S_TDM_RX_CH_8 (0x3 << 8)
#define RT5682S_TDM_ADC_LCA_MASK (0x7 << 4)
#define RT5682S_TDM_ADC_LCA_SFT 4
#define RT5682S_TDM_ADC_DL_MASK (0x3 << 0)
#define RT5682S_TDM_ADC_DL_SFT 0

/* TDM control 2 (0x007a) */
Expand Down
Loading