ASoC: Fixes for v5.19

Quite a large batch due to things building up for a couple of weeks but
 all driver specific apart from Marek's documentation fix.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmLHDQcACgkQJNaLcl1U
 h9DaoAf+LjanLg76KbeHMQg/IaG2dhvKJvSAjixMdLlNixMDpSOVr/2UR4lzLCpw
 gfoJk9liujPjtKMsIlQT/OiVdsMROc8vfb10PdmV7rntaBwCN01aqyr4NMauOmby
 ccdZlsoj7D0k3iTtP0nlZ+Xvm+L0zTEfI66bSB9UU+/h8PDSoK/RHMCjNBtqenAd
 4QMQWxQTvqt3xfgrWxiZeFPUJrLFjDypEDqG8qx8roIcbzEhVYInGq52XZw3ST9o
 mvC/LIFK96WvDGgiOj2UNmSuWpe3lF7cMPmomwyYkdUMcMwbSdVfDOsnAdnyqONi
 RiWIr7g5NOPkYa4mSNhB9Ia1PTzf0Q==
 =V5ia
 -----END PGP SIGNATURE-----

Merge tag 'asoc-fix-v5.19-rc4' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v5.19

Quite a large batch due to things building up for a couple of weeks but
all driver specific apart from Marek's documentation fix.
This commit is contained in:
Takashi Iwai 2022-07-09 18:23:54 +02:00
commit a4bd9358d5
21 changed files with 168 additions and 120 deletions

View File

@ -25,12 +25,12 @@ properties:
- qcom,sc7280-lpass-cpu - qcom,sc7280-lpass-cpu
reg: reg:
minItems: 2 minItems: 1
maxItems: 6 maxItems: 6
description: LPAIF core registers description: LPAIF core registers
reg-names: reg-names:
minItems: 2 minItems: 1
maxItems: 6 maxItems: 6
clocks: clocks:
@ -42,12 +42,12 @@ properties:
maxItems: 10 maxItems: 10
interrupts: interrupts:
minItems: 2 minItems: 1
maxItems: 4 maxItems: 4
description: LPAIF DMA buffer interrupt description: LPAIF DMA buffer interrupt
interrupt-names: interrupt-names:
minItems: 2 minItems: 1
maxItems: 4 maxItems: 4
qcom,adsp: qcom,adsp:

View File

@ -10,7 +10,7 @@ AC97
==== ====
AC97 is a five wire interface commonly found on many PC sound cards. It is AC97 is a five wire interface commonly found on many PC sound cards. It is
now also popular in many portable devices. This DAI has a reset line and time now also popular in many portable devices. This DAI has a RESET line and time
multiplexes its data on its SDATA_OUT (playback) and SDATA_IN (capture) lines. multiplexes its data on its SDATA_OUT (playback) and SDATA_IN (capture) lines.
The bit clock (BCLK) is always driven by the CODEC (usually 12.288MHz) and the The bit clock (BCLK) is always driven by the CODEC (usually 12.288MHz) and the
frame (FRAME) (usually 48kHz) is always driven by the controller. Each AC97 frame (FRAME) (usually 48kHz) is always driven by the controller. Each AC97

View File

@ -1760,8 +1760,8 @@ static bool arizona_aif_cfg_changed(struct snd_soc_component *component,
if (bclk != (val & ARIZONA_AIF1_BCLK_FREQ_MASK)) if (bclk != (val & ARIZONA_AIF1_BCLK_FREQ_MASK))
return true; return true;
val = snd_soc_component_read(component, base + ARIZONA_AIF_TX_BCLK_RATE); val = snd_soc_component_read(component, base + ARIZONA_AIF_RX_BCLK_RATE);
if (lrclk != (val & ARIZONA_AIF1TX_BCPF_MASK)) if (lrclk != (val & ARIZONA_AIF1RX_BCPF_MASK))
return true; return true;
val = snd_soc_component_read(component, base + ARIZONA_AIF_FRAME_CTRL_1); val = snd_soc_component_read(component, base + ARIZONA_AIF_FRAME_CTRL_1);

View File

@ -119,7 +119,13 @@ static int cs47l92_put_demux(struct snd_kcontrol *kcontrol,
end: end:
snd_soc_dapm_mutex_unlock(dapm); snd_soc_dapm_mutex_unlock(dapm);
return snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL); ret = snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL);
if (ret < 0) {
dev_err(madera->dev, "Failed to update demux power state: %d\n", ret);
return ret;
}
return change;
} }
static SOC_ENUM_SINGLE_DECL(cs47l92_outdemux_enum, static SOC_ENUM_SINGLE_DECL(cs47l92_outdemux_enum,

View File

@ -342,12 +342,15 @@ static int max98396_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
{ {
struct snd_soc_component *component = codec_dai->component; struct snd_soc_component *component = codec_dai->component;
struct max98396_priv *max98396 = snd_soc_component_get_drvdata(component); struct max98396_priv *max98396 = snd_soc_component_get_drvdata(component);
unsigned int format = 0; unsigned int format_mask, format = 0;
unsigned int bclk_pol = 0; unsigned int bclk_pol = 0;
int ret, status; int ret, status;
int reg; int reg;
bool update = false; bool update = false;
format_mask = MAX98396_PCM_MODE_CFG_FORMAT_MASK |
MAX98396_PCM_MODE_CFG_LRCLKEDGE;
dev_dbg(component->dev, "%s: fmt 0x%08X\n", __func__, fmt); dev_dbg(component->dev, "%s: fmt 0x%08X\n", __func__, fmt);
switch (fmt & SND_SOC_DAIFMT_INV_MASK) { switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
@ -395,7 +398,7 @@ static int max98396_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
ret = regmap_read(max98396->regmap, MAX98396_R2041_PCM_MODE_CFG, &reg); ret = regmap_read(max98396->regmap, MAX98396_R2041_PCM_MODE_CFG, &reg);
if (ret < 0) if (ret < 0)
return -EINVAL; return -EINVAL;
if (format != (reg & MAX98396_PCM_BCLKEDGE_BSEL_MASK)) { if (format != (reg & format_mask)) {
update = true; update = true;
} else { } else {
ret = regmap_read(max98396->regmap, ret = regmap_read(max98396->regmap,
@ -412,8 +415,7 @@ static int max98396_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
regmap_update_bits(max98396->regmap, regmap_update_bits(max98396->regmap,
MAX98396_R2041_PCM_MODE_CFG, MAX98396_R2041_PCM_MODE_CFG,
MAX98396_PCM_BCLKEDGE_BSEL_MASK, format_mask, format);
format);
regmap_update_bits(max98396->regmap, regmap_update_bits(max98396->regmap,
MAX98396_R2042_PCM_CLK_SETUP, MAX98396_R2042_PCM_CLK_SETUP,

View File

@ -1984,7 +1984,12 @@ static int rt5640_set_bias_level(struct snd_soc_component *component,
snd_soc_component_write(component, RT5640_PWR_DIG2, 0x0000); snd_soc_component_write(component, RT5640_PWR_DIG2, 0x0000);
snd_soc_component_write(component, RT5640_PWR_VOL, 0x0000); snd_soc_component_write(component, RT5640_PWR_VOL, 0x0000);
snd_soc_component_write(component, RT5640_PWR_MIXER, 0x0000); snd_soc_component_write(component, RT5640_PWR_MIXER, 0x0000);
snd_soc_component_write(component, RT5640_PWR_ANLG1, 0x0000); if (rt5640->jd_src == RT5640_JD_SRC_HDA_HEADER)
snd_soc_component_write(component, RT5640_PWR_ANLG1,
0x0018);
else
snd_soc_component_write(component, RT5640_PWR_ANLG1,
0x0000);
snd_soc_component_write(component, RT5640_PWR_ANLG2, 0x0000); snd_soc_component_write(component, RT5640_PWR_ANLG2, 0x0000);
break; break;
@ -2393,9 +2398,15 @@ static void rt5640_jack_work(struct work_struct *work)
static irqreturn_t rt5640_irq(int irq, void *data) static irqreturn_t rt5640_irq(int irq, void *data)
{ {
struct rt5640_priv *rt5640 = data; struct rt5640_priv *rt5640 = data;
int delay = 0;
if (rt5640->jd_src == RT5640_JD_SRC_HDA_HEADER) {
cancel_delayed_work_sync(&rt5640->jack_work);
delay = 100;
}
if (rt5640->jack) if (rt5640->jack)
queue_delayed_work(system_long_wq, &rt5640->jack_work, 0); queue_delayed_work(system_long_wq, &rt5640->jack_work, delay);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
@ -2580,6 +2591,12 @@ static void rt5640_enable_hda_jack_detect(
snd_soc_component_update_bits(component, RT5640_DUMMY1, 0x400, 0x0); snd_soc_component_update_bits(component, RT5640_DUMMY1, 0x400, 0x0);
snd_soc_component_update_bits(component, RT5640_PWR_ANLG1,
RT5640_PWR_VREF2, RT5640_PWR_VREF2);
usleep_range(10000, 15000);
snd_soc_component_update_bits(component, RT5640_PWR_ANLG1,
RT5640_PWR_FV2, RT5640_PWR_FV2);
rt5640->jack = jack; rt5640->jack = jack;
ret = request_irq(rt5640->irq, rt5640_irq, ret = request_irq(rt5640->irq, rt5640_irq,
@ -2696,17 +2713,14 @@ static int rt5640_probe(struct snd_soc_component *component)
if (device_property_read_u32(component->dev, if (device_property_read_u32(component->dev,
"realtek,jack-detect-source", &val) == 0) { "realtek,jack-detect-source", &val) == 0) {
if (val <= RT5640_JD_SRC_GPIO4) { if (val <= RT5640_JD_SRC_GPIO4)
rt5640->jd_src = val << RT5640_JD_SFT; rt5640->jd_src = val << RT5640_JD_SFT;
} else if (val == RT5640_JD_SRC_HDA_HEADER) { else if (val == RT5640_JD_SRC_HDA_HEADER)
rt5640->jd_src = RT5640_JD_SRC_HDA_HEADER; rt5640->jd_src = RT5640_JD_SRC_HDA_HEADER;
snd_soc_component_update_bits(component, RT5640_DUMMY1, else
0x0300, 0x0);
} else {
dev_warn(component->dev, "Warning: Invalid jack-detect-source value: %d, leaving jack-detect disabled\n", dev_warn(component->dev, "Warning: Invalid jack-detect-source value: %d, leaving jack-detect disabled\n",
val); val);
} }
}
if (!device_property_read_bool(component->dev, "realtek,jack-detect-not-inverted")) if (!device_property_read_bool(component->dev, "realtek,jack-detect-not-inverted"))
rt5640->jd_inverted = true; rt5640->jd_inverted = true;

View File

@ -1795,6 +1795,9 @@ static int sgtl5000_i2c_remove(struct i2c_client *client)
{ {
struct sgtl5000_priv *sgtl5000 = i2c_get_clientdata(client); struct sgtl5000_priv *sgtl5000 = i2c_get_clientdata(client);
regmap_write(sgtl5000->regmap, SGTL5000_CHIP_DIG_POWER, SGTL5000_DIG_POWER_DEFAULT);
regmap_write(sgtl5000->regmap, SGTL5000_CHIP_ANA_POWER, SGTL5000_ANA_POWER_DEFAULT);
clk_disable_unprepare(sgtl5000->mclk); clk_disable_unprepare(sgtl5000->mclk);
regulator_bulk_disable(sgtl5000->num_supplies, sgtl5000->supplies); regulator_bulk_disable(sgtl5000->num_supplies, sgtl5000->supplies);
regulator_bulk_free(sgtl5000->num_supplies, sgtl5000->supplies); regulator_bulk_free(sgtl5000->num_supplies, sgtl5000->supplies);
@ -1802,6 +1805,11 @@ static int sgtl5000_i2c_remove(struct i2c_client *client)
return 0; return 0;
} }
static void sgtl5000_i2c_shutdown(struct i2c_client *client)
{
sgtl5000_i2c_remove(client);
}
static const struct i2c_device_id sgtl5000_id[] = { static const struct i2c_device_id sgtl5000_id[] = {
{"sgtl5000", 0}, {"sgtl5000", 0},
{}, {},
@ -1822,6 +1830,7 @@ static struct i2c_driver sgtl5000_i2c_driver = {
}, },
.probe_new = sgtl5000_i2c_probe, .probe_new = sgtl5000_i2c_probe,
.remove = sgtl5000_i2c_remove, .remove = sgtl5000_i2c_remove,
.shutdown = sgtl5000_i2c_shutdown,
.id_table = sgtl5000_id, .id_table = sgtl5000_id,
}; };

View File

@ -80,6 +80,7 @@
/* /*
* SGTL5000_CHIP_DIG_POWER * SGTL5000_CHIP_DIG_POWER
*/ */
#define SGTL5000_DIG_POWER_DEFAULT 0x0000
#define SGTL5000_ADC_EN 0x0040 #define SGTL5000_ADC_EN 0x0040
#define SGTL5000_DAC_EN 0x0020 #define SGTL5000_DAC_EN 0x0020
#define SGTL5000_DAP_POWERUP 0x0010 #define SGTL5000_DAP_POWERUP 0x0010

View File

@ -42,10 +42,12 @@ static void tas2764_reset(struct tas2764_priv *tas2764)
gpiod_set_value_cansleep(tas2764->reset_gpio, 0); gpiod_set_value_cansleep(tas2764->reset_gpio, 0);
msleep(20); msleep(20);
gpiod_set_value_cansleep(tas2764->reset_gpio, 1); gpiod_set_value_cansleep(tas2764->reset_gpio, 1);
usleep_range(1000, 2000);
} }
snd_soc_component_write(tas2764->component, TAS2764_SW_RST, snd_soc_component_write(tas2764->component, TAS2764_SW_RST,
TAS2764_RST); TAS2764_RST);
usleep_range(1000, 2000);
} }
static int tas2764_set_bias_level(struct snd_soc_component *component, static int tas2764_set_bias_level(struct snd_soc_component *component,
@ -107,8 +109,10 @@ static int tas2764_codec_resume(struct snd_soc_component *component)
struct tas2764_priv *tas2764 = snd_soc_component_get_drvdata(component); struct tas2764_priv *tas2764 = snd_soc_component_get_drvdata(component);
int ret; int ret;
if (tas2764->sdz_gpio) if (tas2764->sdz_gpio) {
gpiod_set_value_cansleep(tas2764->sdz_gpio, 1); gpiod_set_value_cansleep(tas2764->sdz_gpio, 1);
usleep_range(1000, 2000);
}
ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL,
TAS2764_PWR_CTRL_MASK, TAS2764_PWR_CTRL_MASK,
@ -131,7 +135,8 @@ static const char * const tas2764_ASI1_src[] = {
}; };
static SOC_ENUM_SINGLE_DECL( static SOC_ENUM_SINGLE_DECL(
tas2764_ASI1_src_enum, TAS2764_TDM_CFG2, 4, tas2764_ASI1_src); tas2764_ASI1_src_enum, TAS2764_TDM_CFG2, TAS2764_TDM_CFG2_SCFG_SHIFT,
tas2764_ASI1_src);
static const struct snd_kcontrol_new tas2764_asi1_mux = static const struct snd_kcontrol_new tas2764_asi1_mux =
SOC_DAPM_ENUM("ASI1 Source", tas2764_ASI1_src_enum); SOC_DAPM_ENUM("ASI1 Source", tas2764_ASI1_src_enum);
@ -329,20 +334,22 @@ static int tas2764_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{ {
struct snd_soc_component *component = dai->component; struct snd_soc_component *component = dai->component;
struct tas2764_priv *tas2764 = snd_soc_component_get_drvdata(component); struct tas2764_priv *tas2764 = snd_soc_component_get_drvdata(component);
u8 tdm_rx_start_slot = 0, asi_cfg_1 = 0; u8 tdm_rx_start_slot = 0, asi_cfg_0 = 0, asi_cfg_1 = 0;
int iface;
int ret; int ret;
switch (fmt & SND_SOC_DAIFMT_INV_MASK) { switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
case SND_SOC_DAIFMT_NB_IF:
asi_cfg_0 ^= TAS2764_TDM_CFG0_FRAME_START;
fallthrough;
case SND_SOC_DAIFMT_NB_NF: case SND_SOC_DAIFMT_NB_NF:
asi_cfg_1 = TAS2764_TDM_CFG1_RX_RISING; asi_cfg_1 = TAS2764_TDM_CFG1_RX_RISING;
break; break;
case SND_SOC_DAIFMT_IB_IF:
asi_cfg_0 ^= TAS2764_TDM_CFG0_FRAME_START;
fallthrough;
case SND_SOC_DAIFMT_IB_NF: case SND_SOC_DAIFMT_IB_NF:
asi_cfg_1 = TAS2764_TDM_CFG1_RX_FALLING; asi_cfg_1 = TAS2764_TDM_CFG1_RX_FALLING;
break; break;
default:
dev_err(tas2764->dev, "ASI format Inverse is not found\n");
return -EINVAL;
} }
ret = snd_soc_component_update_bits(component, TAS2764_TDM_CFG1, ret = snd_soc_component_update_bits(component, TAS2764_TDM_CFG1,
@ -353,13 +360,13 @@ static int tas2764_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
case SND_SOC_DAIFMT_I2S: case SND_SOC_DAIFMT_I2S:
asi_cfg_0 ^= TAS2764_TDM_CFG0_FRAME_START;
fallthrough;
case SND_SOC_DAIFMT_DSP_A: case SND_SOC_DAIFMT_DSP_A:
iface = TAS2764_TDM_CFG2_SCFG_I2S;
tdm_rx_start_slot = 1; tdm_rx_start_slot = 1;
break; break;
case SND_SOC_DAIFMT_DSP_B: case SND_SOC_DAIFMT_DSP_B:
case SND_SOC_DAIFMT_LEFT_J: case SND_SOC_DAIFMT_LEFT_J:
iface = TAS2764_TDM_CFG2_SCFG_LEFT_J;
tdm_rx_start_slot = 0; tdm_rx_start_slot = 0;
break; break;
default: default:
@ -368,14 +375,15 @@ static int tas2764_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
return -EINVAL; return -EINVAL;
} }
ret = snd_soc_component_update_bits(component, TAS2764_TDM_CFG1, ret = snd_soc_component_update_bits(component, TAS2764_TDM_CFG0,
TAS2764_TDM_CFG1_MASK, TAS2764_TDM_CFG0_FRAME_START,
(tdm_rx_start_slot << TAS2764_TDM_CFG1_51_SHIFT)); asi_cfg_0);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = snd_soc_component_update_bits(component, TAS2764_TDM_CFG2, ret = snd_soc_component_update_bits(component, TAS2764_TDM_CFG1,
TAS2764_TDM_CFG2_SCFG_MASK, iface); TAS2764_TDM_CFG1_MASK,
(tdm_rx_start_slot << TAS2764_TDM_CFG1_51_SHIFT));
if (ret < 0) if (ret < 0)
return ret; return ret;
@ -501,8 +509,10 @@ static int tas2764_codec_probe(struct snd_soc_component *component)
tas2764->component = component; tas2764->component = component;
if (tas2764->sdz_gpio) if (tas2764->sdz_gpio) {
gpiod_set_value_cansleep(tas2764->sdz_gpio, 1); gpiod_set_value_cansleep(tas2764->sdz_gpio, 1);
usleep_range(1000, 2000);
}
tas2764_reset(tas2764); tas2764_reset(tas2764);
@ -526,12 +536,12 @@ static int tas2764_codec_probe(struct snd_soc_component *component)
} }
static DECLARE_TLV_DB_SCALE(tas2764_digital_tlv, 1100, 50, 0); static DECLARE_TLV_DB_SCALE(tas2764_digital_tlv, 1100, 50, 0);
static DECLARE_TLV_DB_SCALE(tas2764_playback_volume, -10000, 50, 0); static DECLARE_TLV_DB_SCALE(tas2764_playback_volume, -10050, 50, 1);
static const struct snd_kcontrol_new tas2764_snd_controls[] = { static const struct snd_kcontrol_new tas2764_snd_controls[] = {
SOC_SINGLE_TLV("Speaker Volume", TAS2764_DVC, 0, SOC_SINGLE_TLV("Speaker Volume", TAS2764_DVC, 0,
TAS2764_DVC_MAX, 1, tas2764_playback_volume), TAS2764_DVC_MAX, 1, tas2764_playback_volume),
SOC_SINGLE_TLV("Amp Gain Volume", TAS2764_CHNL_0, 0, 0x14, 0, SOC_SINGLE_TLV("Amp Gain Volume", TAS2764_CHNL_0, 1, 0x14, 0,
tas2764_digital_tlv), tas2764_digital_tlv),
}; };
@ -556,7 +566,7 @@ static const struct reg_default tas2764_reg_defaults[] = {
{ TAS2764_SW_RST, 0x00 }, { TAS2764_SW_RST, 0x00 },
{ TAS2764_PWR_CTRL, 0x1a }, { TAS2764_PWR_CTRL, 0x1a },
{ TAS2764_DVC, 0x00 }, { TAS2764_DVC, 0x00 },
{ TAS2764_CHNL_0, 0x00 }, { TAS2764_CHNL_0, 0x28 },
{ TAS2764_TDM_CFG0, 0x09 }, { TAS2764_TDM_CFG0, 0x09 },
{ TAS2764_TDM_CFG1, 0x02 }, { TAS2764_TDM_CFG1, 0x02 },
{ TAS2764_TDM_CFG2, 0x0a }, { TAS2764_TDM_CFG2, 0x0a },

View File

@ -47,6 +47,7 @@
#define TAS2764_TDM_CFG0_MASK GENMASK(3, 1) #define TAS2764_TDM_CFG0_MASK GENMASK(3, 1)
#define TAS2764_TDM_CFG0_44_1_48KHZ BIT(3) #define TAS2764_TDM_CFG0_44_1_48KHZ BIT(3)
#define TAS2764_TDM_CFG0_88_2_96KHZ (BIT(3) | BIT(1)) #define TAS2764_TDM_CFG0_88_2_96KHZ (BIT(3) | BIT(1))
#define TAS2764_TDM_CFG0_FRAME_START BIT(0)
/* TDM Configuration Reg1 */ /* TDM Configuration Reg1 */
#define TAS2764_TDM_CFG1 TAS2764_REG(0X0, 0x09) #define TAS2764_TDM_CFG1 TAS2764_REG(0X0, 0x09)
@ -66,10 +67,7 @@
#define TAS2764_TDM_CFG2_RXS_16BITS 0x0 #define TAS2764_TDM_CFG2_RXS_16BITS 0x0
#define TAS2764_TDM_CFG2_RXS_24BITS BIT(0) #define TAS2764_TDM_CFG2_RXS_24BITS BIT(0)
#define TAS2764_TDM_CFG2_RXS_32BITS BIT(1) #define TAS2764_TDM_CFG2_RXS_32BITS BIT(1)
#define TAS2764_TDM_CFG2_SCFG_MASK GENMASK(5, 4) #define TAS2764_TDM_CFG2_SCFG_SHIFT 4
#define TAS2764_TDM_CFG2_SCFG_I2S 0x0
#define TAS2764_TDM_CFG2_SCFG_LEFT_J BIT(4)
#define TAS2764_TDM_CFG2_SCFG_RIGHT_J BIT(5)
/* TDM Configuration Reg3 */ /* TDM Configuration Reg3 */
#define TAS2764_TDM_CFG3 TAS2764_REG(0X0, 0x0c) #define TAS2764_TDM_CFG3 TAS2764_REG(0X0, 0x0c)

View File

@ -33,7 +33,6 @@ struct adcx140_priv {
bool micbias_vg; bool micbias_vg;
unsigned int dai_fmt; unsigned int dai_fmt;
unsigned int tdm_delay;
unsigned int slot_width; unsigned int slot_width;
}; };
@ -792,12 +791,13 @@ static int adcx140_set_dai_tdm_slot(struct snd_soc_dai *codec_dai,
{ {
struct snd_soc_component *component = codec_dai->component; struct snd_soc_component *component = codec_dai->component;
struct adcx140_priv *adcx140 = snd_soc_component_get_drvdata(component); struct adcx140_priv *adcx140 = snd_soc_component_get_drvdata(component);
unsigned int lsb;
/* TDM based on DSP mode requires slots to be adjacent */ /*
lsb = __ffs(tx_mask); * The chip itself supports arbitrary masks, but the driver currently
if ((lsb + 1) != __fls(tx_mask)) { * only supports adjacent slots beginning at the first slot.
dev_err(component->dev, "Invalid mask, slots must be adjacent\n"); */
if (tx_mask != GENMASK(__fls(tx_mask), 0)) {
dev_err(component->dev, "Only lower adjacent slots are supported\n");
return -EINVAL; return -EINVAL;
} }
@ -812,7 +812,6 @@ static int adcx140_set_dai_tdm_slot(struct snd_soc_dai *codec_dai,
return -EINVAL; return -EINVAL;
} }
adcx140->tdm_delay = lsb;
adcx140->slot_width = slot_width; adcx140->slot_width = slot_width;
return 0; return 0;

View File

@ -342,7 +342,7 @@ struct wcd9335_codec {
struct regulator_bulk_data supplies[WCD9335_MAX_SUPPLY]; struct regulator_bulk_data supplies[WCD9335_MAX_SUPPLY];
unsigned int rx_port_value[WCD9335_RX_MAX]; unsigned int rx_port_value[WCD9335_RX_MAX];
unsigned int tx_port_value; unsigned int tx_port_value[WCD9335_TX_MAX];
int hph_l_gain; int hph_l_gain;
int hph_r_gain; int hph_r_gain;
u32 rx_bias_count; u32 rx_bias_count;
@ -1334,8 +1334,13 @@ static int slim_tx_mixer_get(struct snd_kcontrol *kc,
struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kc); struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kc);
struct wcd9335_codec *wcd = dev_get_drvdata(dapm->dev); struct wcd9335_codec *wcd = dev_get_drvdata(dapm->dev);
struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kc);
struct soc_mixer_control *mixer =
(struct soc_mixer_control *)kc->private_value;
int dai_id = widget->shift;
int port_id = mixer->shift;
ucontrol->value.integer.value[0] = wcd->tx_port_value; ucontrol->value.integer.value[0] = wcd->tx_port_value[port_id] == dai_id;
return 0; return 0;
} }
@ -1358,12 +1363,12 @@ static int slim_tx_mixer_put(struct snd_kcontrol *kc,
case AIF2_CAP: case AIF2_CAP:
case AIF3_CAP: case AIF3_CAP:
/* only add to the list if value not set */ /* only add to the list if value not set */
if (enable && !(wcd->tx_port_value & BIT(port_id))) { if (enable && wcd->tx_port_value[port_id] != dai_id) {
wcd->tx_port_value |= BIT(port_id); wcd->tx_port_value[port_id] = dai_id;
list_add_tail(&wcd->tx_chs[port_id].list, list_add_tail(&wcd->tx_chs[port_id].list,
&wcd->dai[dai_id].slim_ch_list); &wcd->dai[dai_id].slim_ch_list);
} else if (!enable && (wcd->tx_port_value & BIT(port_id))) { } else if (!enable && wcd->tx_port_value[port_id] == dai_id) {
wcd->tx_port_value &= ~BIT(port_id); wcd->tx_port_value[port_id] = -1;
list_del_init(&wcd->tx_chs[port_id].list); list_del_init(&wcd->tx_chs[port_id].list);
} }
break; break;

View File

@ -680,12 +680,17 @@ static int wm5102_out_comp_coeff_put(struct snd_kcontrol *kcontrol,
{ {
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
struct arizona *arizona = dev_get_drvdata(component->dev->parent); struct arizona *arizona = dev_get_drvdata(component->dev->parent);
uint16_t dac_comp_coeff = get_unaligned_be16(ucontrol->value.bytes.data);
int ret = 0;
mutex_lock(&arizona->dac_comp_lock); mutex_lock(&arizona->dac_comp_lock);
arizona->dac_comp_coeff = get_unaligned_be16(ucontrol->value.bytes.data); if (arizona->dac_comp_coeff != dac_comp_coeff) {
arizona->dac_comp_coeff = dac_comp_coeff;
ret = 1;
}
mutex_unlock(&arizona->dac_comp_lock); mutex_unlock(&arizona->dac_comp_lock);
return 0; return ret;
} }
static int wm5102_out_comp_switch_get(struct snd_kcontrol *kcontrol, static int wm5102_out_comp_switch_get(struct snd_kcontrol *kcontrol,
@ -706,12 +711,20 @@ static int wm5102_out_comp_switch_put(struct snd_kcontrol *kcontrol,
{ {
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
struct arizona *arizona = dev_get_drvdata(component->dev->parent); struct arizona *arizona = dev_get_drvdata(component->dev->parent);
struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value;
int ret = 0;
if (ucontrol->value.integer.value[0] > mc->max)
return -EINVAL;
mutex_lock(&arizona->dac_comp_lock); mutex_lock(&arizona->dac_comp_lock);
if (arizona->dac_comp_enabled != ucontrol->value.integer.value[0]) {
arizona->dac_comp_enabled = ucontrol->value.integer.value[0]; arizona->dac_comp_enabled = ucontrol->value.integer.value[0];
ret = 1;
}
mutex_unlock(&arizona->dac_comp_lock); mutex_unlock(&arizona->dac_comp_lock);
return 0; return ret;
} }
static const char * const wm5102_osr_text[] = { static const char * const wm5102_osr_text[] = {

View File

@ -108,6 +108,7 @@ static int wm8998_inmux_put(struct snd_kcontrol *kcontrol,
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
unsigned int mode_reg, mode_index; unsigned int mode_reg, mode_index;
unsigned int mux, inmode, src_val, mode_val; unsigned int mux, inmode, src_val, mode_val;
int change, ret;
mux = ucontrol->value.enumerated.item[0]; mux = ucontrol->value.enumerated.item[0];
if (mux > 1) if (mux > 1)
@ -137,14 +138,20 @@ static int wm8998_inmux_put(struct snd_kcontrol *kcontrol,
snd_soc_component_update_bits(component, mode_reg, snd_soc_component_update_bits(component, mode_reg,
ARIZONA_IN1_MODE_MASK, mode_val); ARIZONA_IN1_MODE_MASK, mode_val);
snd_soc_component_update_bits(component, e->reg, change = snd_soc_component_update_bits(component, e->reg,
ARIZONA_IN1L_SRC_MASK | ARIZONA_IN1L_SRC_MASK |
ARIZONA_IN1L_SRC_SE_MASK, ARIZONA_IN1L_SRC_SE_MASK,
src_val); src_val);
return snd_soc_dapm_mux_update_power(dapm, kcontrol, ret = snd_soc_dapm_mux_update_power(dapm, kcontrol,
ucontrol->value.enumerated.item[0], ucontrol->value.enumerated.item[0],
e, NULL); e, NULL);
if (ret < 0) {
dev_err(arizona->dev, "Failed to update demux power state: %d\n", ret);
return ret;
}
return change;
} }
static const char * const wm8998_inmux_texts[] = { static const char * const wm8998_inmux_texts[] = {

View File

@ -90,12 +90,12 @@ links indicates connection part of CPU side (= A).
ports@0 { ports@0 {
(X) (A) mcpu: port@0 { mcpu0_ep: endpoint { remote-endpoint = <&mcodec0_ep>; }; }; (X) (A) mcpu: port@0 { mcpu0_ep: endpoint { remote-endpoint = <&mcodec0_ep>; }; };
(y) port@1 { mcpu1_ep: endpoint { remote-endpoint = <&cpu1_ep>; }; }; (y) port@1 { mcpu1_ep: endpoint { remote-endpoint = <&cpu1_ep>; }; };
(y) port@1 { mcpu2_ep: endpoint { remote-endpoint = <&cpu2_ep>; }; }; (y) port@2 { mcpu2_ep: endpoint { remote-endpoint = <&cpu2_ep>; }; };
}; };
ports@1 { ports@1 {
(X) port@0 { mcodec0_ep: endpoint { remote-endpoint = <&mcpu0_ep>; }; }; (X) port@0 { mcodec0_ep: endpoint { remote-endpoint = <&mcpu0_ep>; }; };
(y) port@0 { mcodec1_ep: endpoint { remote-endpoint = <&codec1_ep>; }; }; (y) port@1 { mcodec1_ep: endpoint { remote-endpoint = <&codec1_ep>; }; };
(y) port@1 { mcodec2_ep: endpoint { remote-endpoint = <&codec2_ep>; }; }; (y) port@2 { mcodec2_ep: endpoint { remote-endpoint = <&codec2_ep>; }; };
}; };
}; };
}; };

View File

@ -69,11 +69,10 @@ static unsigned long sof_rt5682_quirk = SOF_RT5682_MCLK_EN |
static int is_legacy_cpu; static int is_legacy_cpu;
static struct snd_soc_jack sof_hdmi[3];
struct sof_hdmi_pcm { struct sof_hdmi_pcm {
struct list_head head; struct list_head head;
struct snd_soc_dai *codec_dai; struct snd_soc_dai *codec_dai;
struct snd_soc_jack hdmi_jack;
int device; int device;
}; };
@ -434,7 +433,6 @@ static int sof_card_late_probe(struct snd_soc_card *card)
char jack_name[NAME_SIZE]; char jack_name[NAME_SIZE];
struct sof_hdmi_pcm *pcm; struct sof_hdmi_pcm *pcm;
int err; int err;
int i = 0;
/* HDMI is not supported by SOF on Baytrail/CherryTrail */ /* HDMI is not supported by SOF on Baytrail/CherryTrail */
if (is_legacy_cpu || !ctx->idisp_codec) if (is_legacy_cpu || !ctx->idisp_codec)
@ -455,17 +453,15 @@ static int sof_card_late_probe(struct snd_soc_card *card)
snprintf(jack_name, sizeof(jack_name), snprintf(jack_name, sizeof(jack_name),
"HDMI/DP, pcm=%d Jack", pcm->device); "HDMI/DP, pcm=%d Jack", pcm->device);
err = snd_soc_card_jack_new(card, jack_name, err = snd_soc_card_jack_new(card, jack_name,
SND_JACK_AVOUT, &sof_hdmi[i]); SND_JACK_AVOUT, &pcm->hdmi_jack);
if (err) if (err)
return err; return err;
err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device, err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device,
&sof_hdmi[i]); &pcm->hdmi_jack);
if (err < 0) if (err < 0)
return err; return err;
i++;
} }
if (sof_rt5682_quirk & SOF_MAX98373_SPEAKER_AMP_PRESENT) { if (sof_rt5682_quirk & SOF_MAX98373_SPEAKER_AMP_PRESENT) {

View File

@ -99,7 +99,6 @@ static void skl_get_ssp_clks(struct skl_dev *skl, struct skl_ssp_clk *ssp_clks,
struct nhlt_fmt_cfg *fmt_cfg; struct nhlt_fmt_cfg *fmt_cfg;
struct wav_fmt_ext *wav_fmt; struct wav_fmt_ext *wav_fmt;
unsigned long rate; unsigned long rate;
bool present = false;
int rate_index = 0; int rate_index = 0;
u16 channels, bps; u16 channels, bps;
u8 clk_src; u8 clk_src;
@ -112,9 +111,12 @@ static void skl_get_ssp_clks(struct skl_dev *skl, struct skl_ssp_clk *ssp_clks,
if (fmt->fmt_count == 0) if (fmt->fmt_count == 0)
return; return;
fmt_cfg = (struct nhlt_fmt_cfg *)fmt->fmt_config;
for (i = 0; i < fmt->fmt_count; i++) { for (i = 0; i < fmt->fmt_count; i++) {
fmt_cfg = &fmt->fmt_config[i]; struct nhlt_fmt_cfg *saved_fmt_cfg = fmt_cfg;
wav_fmt = &fmt_cfg->fmt_ext; bool present = false;
wav_fmt = &saved_fmt_cfg->fmt_ext;
channels = wav_fmt->fmt.channels; channels = wav_fmt->fmt.channels;
bps = wav_fmt->fmt.bits_per_sample; bps = wav_fmt->fmt.bits_per_sample;
@ -132,12 +134,18 @@ static void skl_get_ssp_clks(struct skl_dev *skl, struct skl_ssp_clk *ssp_clks,
* derive the rate. * derive the rate.
*/ */
for (j = i; j < fmt->fmt_count; j++) { for (j = i; j < fmt->fmt_count; j++) {
fmt_cfg = &fmt->fmt_config[j]; struct nhlt_fmt_cfg *tmp_fmt_cfg = fmt_cfg;
wav_fmt = &fmt_cfg->fmt_ext;
wav_fmt = &tmp_fmt_cfg->fmt_ext;
if ((fs == wav_fmt->fmt.samples_per_sec) && if ((fs == wav_fmt->fmt.samples_per_sec) &&
(bps == wav_fmt->fmt.bits_per_sample)) (bps == wav_fmt->fmt.bits_per_sample)) {
channels = max_t(u16, channels, channels = max_t(u16, channels,
wav_fmt->fmt.channels); wav_fmt->fmt.channels);
saved_fmt_cfg = tmp_fmt_cfg;
}
/* Move to the next nhlt_fmt_cfg */
tmp_fmt_cfg = (struct nhlt_fmt_cfg *)(tmp_fmt_cfg->config.caps +
tmp_fmt_cfg->config.size);
} }
rate = channels * bps * fs; rate = channels * bps * fs;
@ -153,8 +161,11 @@ static void skl_get_ssp_clks(struct skl_dev *skl, struct skl_ssp_clk *ssp_clks,
/* Fill rate and parent for sclk/sclkfs */ /* Fill rate and parent for sclk/sclkfs */
if (!present) { if (!present) {
struct nhlt_fmt_cfg *first_fmt_cfg;
first_fmt_cfg = (struct nhlt_fmt_cfg *)fmt->fmt_config;
i2s_config_ext = (struct skl_i2s_config_blob_ext *) i2s_config_ext = (struct skl_i2s_config_blob_ext *)
fmt->fmt_config[0].config.caps; first_fmt_cfg->config.caps;
/* MCLK Divider Source Select */ /* MCLK Divider Source Select */
if (is_legacy_blob(i2s_config_ext->hdr.sig)) { if (is_legacy_blob(i2s_config_ext->hdr.sig)) {
@ -168,6 +179,9 @@ static void skl_get_ssp_clks(struct skl_dev *skl, struct skl_ssp_clk *ssp_clks,
parent = skl_get_parent_clk(clk_src); parent = skl_get_parent_clk(clk_src);
/* Move to the next nhlt_fmt_cfg */
fmt_cfg = (struct nhlt_fmt_cfg *)(fmt_cfg->config.caps +
fmt_cfg->config.size);
/* /*
* Do not copy the config data if there is no parent * Do not copy the config data if there is no parent
* clock available for this clock source select * clock available for this clock source select
@ -176,9 +190,9 @@ static void skl_get_ssp_clks(struct skl_dev *skl, struct skl_ssp_clk *ssp_clks,
continue; continue;
sclk[id].rate_cfg[rate_index].rate = rate; sclk[id].rate_cfg[rate_index].rate = rate;
sclk[id].rate_cfg[rate_index].config = fmt_cfg; sclk[id].rate_cfg[rate_index].config = saved_fmt_cfg;
sclkfs[id].rate_cfg[rate_index].rate = rate; sclkfs[id].rate_cfg[rate_index].rate = rate;
sclkfs[id].rate_cfg[rate_index].config = fmt_cfg; sclkfs[id].rate_cfg[rate_index].config = saved_fmt_cfg;
sclk[id].parent_name = parent->name; sclk[id].parent_name = parent->name;
sclkfs[id].parent_name = parent->name; sclkfs[id].parent_name = parent->name;
@ -192,13 +206,13 @@ static void skl_get_mclk(struct skl_dev *skl, struct skl_ssp_clk *mclk,
{ {
struct skl_i2s_config_blob_ext *i2s_config_ext; struct skl_i2s_config_blob_ext *i2s_config_ext;
struct skl_i2s_config_blob_legacy *i2s_config; struct skl_i2s_config_blob_legacy *i2s_config;
struct nhlt_specific_cfg *fmt_cfg; struct nhlt_fmt_cfg *fmt_cfg;
struct skl_clk_parent_src *parent; struct skl_clk_parent_src *parent;
u32 clkdiv, div_ratio; u32 clkdiv, div_ratio;
u8 clk_src; u8 clk_src;
fmt_cfg = &fmt->fmt_config[0].config; fmt_cfg = (struct nhlt_fmt_cfg *)fmt->fmt_config;
i2s_config_ext = (struct skl_i2s_config_blob_ext *)fmt_cfg->caps; i2s_config_ext = (struct skl_i2s_config_blob_ext *)fmt_cfg->config.caps;
/* MCLK Divider Source Select and divider */ /* MCLK Divider Source Select and divider */
if (is_legacy_blob(i2s_config_ext->hdr.sig)) { if (is_legacy_blob(i2s_config_ext->hdr.sig)) {
@ -227,7 +241,7 @@ static void skl_get_mclk(struct skl_dev *skl, struct skl_ssp_clk *mclk,
return; return;
mclk[id].rate_cfg[0].rate = parent->rate/div_ratio; mclk[id].rate_cfg[0].rate = parent->rate/div_ratio;
mclk[id].rate_cfg[0].config = &fmt->fmt_config[0]; mclk[id].rate_cfg[0].config = fmt_cfg;
mclk[id].parent_name = parent->name; mclk[id].parent_name = parent->name;
} }

View File

@ -75,6 +75,7 @@ static struct audioreach_graph *q6apm_get_audioreach_graph(struct q6apm *apm, ui
id = idr_alloc(&apm->graph_idr, graph, graph_id, graph_id + 1, GFP_KERNEL); id = idr_alloc(&apm->graph_idr, graph, graph_id, graph_id + 1, GFP_KERNEL);
if (id < 0) { if (id < 0) {
dev_err(apm->dev, "Unable to allocate graph id (%d)\n", graph_id); dev_err(apm->dev, "Unable to allocate graph id (%d)\n", graph_id);
kfree(graph->graph);
kfree(graph); kfree(graph);
mutex_unlock(&apm->lock); mutex_unlock(&apm->lock);
return ERR_PTR(id); return ERR_PTR(id);

View File

@ -316,8 +316,6 @@ static inline int omap_mcbsp_read(struct omap_mcbsp *mcbsp, u16 reg,
/* Sidetone specific API */ /* Sidetone specific API */
int omap_mcbsp_st_init(struct platform_device *pdev); int omap_mcbsp_st_init(struct platform_device *pdev);
void omap_mcbsp_st_cleanup(struct platform_device *pdev);
int omap_mcbsp_st_start(struct omap_mcbsp *mcbsp); int omap_mcbsp_st_start(struct omap_mcbsp *mcbsp);
int omap_mcbsp_st_stop(struct omap_mcbsp *mcbsp); int omap_mcbsp_st_stop(struct omap_mcbsp *mcbsp);

View File

@ -347,7 +347,7 @@ int omap_mcbsp_st_init(struct platform_device *pdev)
if (!st_data) if (!st_data)
return -ENOMEM; return -ENOMEM;
st_data->mcbsp_iclk = clk_get(mcbsp->dev, "ick"); st_data->mcbsp_iclk = devm_clk_get(mcbsp->dev, "ick");
if (IS_ERR(st_data->mcbsp_iclk)) { if (IS_ERR(st_data->mcbsp_iclk)) {
dev_warn(mcbsp->dev, dev_warn(mcbsp->dev,
"Failed to get ick, sidetone might be broken\n"); "Failed to get ick, sidetone might be broken\n");
@ -359,7 +359,7 @@ int omap_mcbsp_st_init(struct platform_device *pdev)
if (!st_data->io_base_st) if (!st_data->io_base_st)
return -ENOMEM; return -ENOMEM;
ret = sysfs_create_group(&mcbsp->dev->kobj, &sidetone_attr_group); ret = devm_device_add_group(mcbsp->dev, &sidetone_attr_group);
if (ret) if (ret)
return ret; return ret;
@ -368,16 +368,6 @@ int omap_mcbsp_st_init(struct platform_device *pdev)
return 0; return 0;
} }
void omap_mcbsp_st_cleanup(struct platform_device *pdev)
{
struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev);
if (mcbsp->st_data) {
sysfs_remove_group(&mcbsp->dev->kobj, &sidetone_attr_group);
clk_put(mcbsp->st_data->mcbsp_iclk);
}
}
static int omap_mcbsp_st_info_volsw(struct snd_kcontrol *kcontrol, static int omap_mcbsp_st_info_volsw(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo) struct snd_ctl_elem_info *uinfo)
{ {

View File

@ -702,8 +702,7 @@ static int omap_mcbsp_init(struct platform_device *pdev)
mcbsp->max_tx_thres = max_thres(mcbsp) - 0x10; mcbsp->max_tx_thres = max_thres(mcbsp) - 0x10;
mcbsp->max_rx_thres = max_thres(mcbsp) - 0x10; mcbsp->max_rx_thres = max_thres(mcbsp) - 0x10;
ret = sysfs_create_group(&mcbsp->dev->kobj, ret = devm_device_add_group(mcbsp->dev, &additional_attr_group);
&additional_attr_group);
if (ret) { if (ret) {
dev_err(mcbsp->dev, dev_err(mcbsp->dev,
"Unable to create additional controls\n"); "Unable to create additional controls\n");
@ -711,16 +710,7 @@ static int omap_mcbsp_init(struct platform_device *pdev)
} }
} }
ret = omap_mcbsp_st_init(pdev); return omap_mcbsp_st_init(pdev);
if (ret)
goto err_st;
return 0;
err_st:
if (mcbsp->pdata->buffer_size)
sysfs_remove_group(&mcbsp->dev->kobj, &additional_attr_group);
return ret;
} }
/* /*
@ -1431,11 +1421,6 @@ static int asoc_mcbsp_remove(struct platform_device *pdev)
if (cpu_latency_qos_request_active(&mcbsp->pm_qos_req)) if (cpu_latency_qos_request_active(&mcbsp->pm_qos_req))
cpu_latency_qos_remove_request(&mcbsp->pm_qos_req); cpu_latency_qos_remove_request(&mcbsp->pm_qos_req);
if (mcbsp->pdata->buffer_size)
sysfs_remove_group(&mcbsp->dev->kobj, &additional_attr_group);
omap_mcbsp_st_cleanup(pdev);
return 0; return 0;
} }