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.
Unified · Split
| @@ -25,12 +25,12 @@ properties: · 24 unmodified lines | |||
| 25 | - qcom,sc7280-lpass-cpu | 25 | - qcom,sc7280-lpass-cpu |
| 26 | 26 | ||
| 27 | reg: | 27 | reg: |
| 28 | minItems: 2 | 28 | minItems: 1 |
| 29 | maxItems: 6 | 29 | maxItems: 6 |
| 30 | description: LPAIF core registers | 30 | description: LPAIF core registers |
| 31 | 31 | ||
| 32 | reg-names: | 32 | reg-names: |
| 33 | minItems: 2 | 33 | minItems: 1 |
| 34 | maxItems: 6 | 34 | maxItems: 6 |
| 35 | 35 | ||
| 36 | clocks: | 36 | clocks: |
| @@ -42,12 +42,12 @@ properties: · 5 unmodified lines | |||
| 42 | maxItems: 10 | 42 | maxItems: 10 |
| 43 | 43 | ||
| 44 | interrupts: | 44 | interrupts: |
| 45 | minItems: 2 | 45 | minItems: 1 |
| 46 | maxItems: 4 | 46 | maxItems: 4 |
| 47 | description: LPAIF DMA buffer interrupt | 47 | description: LPAIF DMA buffer interrupt |
| 48 | 48 | ||
| 49 | interrupt-names: | 49 | interrupt-names: |
| 50 | minItems: 2 | 50 | minItems: 1 |
| 51 | maxItems: 4 | 51 | maxItems: 4 |
| 52 | 52 | ||
| 53 | qcom,adsp: | 53 | qcom,adsp: |
| @@ -10,7 +10,7 @@ AC97 · 9 unmodified lines | |||
| 10 | ==== | 10 | ==== |
| 11 | 11 | ||
| 12 | AC97 is a five wire interface commonly found on many PC sound cards. It is | 12 | AC97 is a five wire interface commonly found on many PC sound cards. It is |
| 13 | now also popular in many portable devices. This DAI has a reset line and time | 13 | now also popular in many portable devices. This DAI has a RESET line and time |
| 14 | multiplexes its data on its SDATA_OUT (playback) and SDATA_IN (capture) lines. | 14 | multiplexes its data on its SDATA_OUT (playback) and SDATA_IN (capture) lines. |
| 15 | The bit clock (BCLK) is always driven by the CODEC (usually 12.288MHz) and the | 15 | The bit clock (BCLK) is always driven by the CODEC (usually 12.288MHz) and the |
| 16 | frame (FRAME) (usually 48kHz) is always driven by the controller. Each AC97 | 16 | frame (FRAME) (usually 48kHz) is always driven by the controller. Each AC97 |
| @@ -1760,8 +1760,8 @@ static bool arizona_aif_cfg_changed(struct snd_soc_component *component, · 1759 unmodified lines | |||
| 1760 | if (bclk != (val & ARIZONA_AIF1_BCLK_FREQ_MASK)) | 1760 | if (bclk != (val & ARIZONA_AIF1_BCLK_FREQ_MASK)) |
| 1761 | return true; | 1761 | return true; |
| 1762 | 1762 | ||
| 1763 | val = snd_soc_component_read(component, base + ARIZONA_AIF_TX_BCLK_RATE); | 1763 | val = snd_soc_component_read(component, base + ARIZONA_AIF_RX_BCLK_RATE); |
| 1764 | if (lrclk != (val & ARIZONA_AIF1TX_BCPF_MASK)) | 1764 | if (lrclk != (val & ARIZONA_AIF1RX_BCPF_MASK)) |
| 1765 | return true; | 1765 | return true; |
| 1766 | 1766 | ||
| 1767 | val = snd_soc_component_read(component, base + ARIZONA_AIF_FRAME_CTRL_1); | 1767 | val = snd_soc_component_read(component, base + ARIZONA_AIF_FRAME_CTRL_1); |
| @@ -119,7 +119,13 @@ static int cs47l92_put_demux(struct snd_kcontrol *kcontrol, · 118 unmodified lines | |||
| 119 | end: | 119 | end: |
| 120 | snd_soc_dapm_mutex_unlock(dapm); | 120 | snd_soc_dapm_mutex_unlock(dapm); |
| 121 | 121 | ||
| 122 | return snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL); | 122 | ret = snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL); |
| 123 | if (ret < 0) { | ||
| 124 | dev_err(madera->dev, "Failed to update demux power state: %d\n", ret); | ||
| 125 | return ret; | ||
| 126 | } | ||
| 127 | |||
| 128 | return change; | ||
| 123 | } | 129 | } |
| 124 | 130 | ||
| 125 | static SOC_ENUM_SINGLE_DECL(cs47l92_outdemux_enum, | 131 | static SOC_ENUM_SINGLE_DECL(cs47l92_outdemux_enum, |
| @@ -342,12 +342,15 @@ static int max98396_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) · 341 unmodified lines | |||
| 342 | { | 342 | { |
| 343 | struct snd_soc_component *component = codec_dai->component; | 343 | struct snd_soc_component *component = codec_dai->component; |
| 344 | struct max98396_priv *max98396 = snd_soc_component_get_drvdata(component); | 344 | struct max98396_priv *max98396 = snd_soc_component_get_drvdata(component); |
| 345 | unsigned int format = 0; | 345 | unsigned int format_mask, format = 0; |
| 346 | unsigned int bclk_pol = 0; | 346 | unsigned int bclk_pol = 0; |
| 347 | int ret, status; | 347 | int ret, status; |
| 348 | int reg; | 348 | int reg; |
| 349 | bool update = false; | 349 | bool update = false; |
| 350 | 350 | ||
| 351 | format_mask = MAX98396_PCM_MODE_CFG_FORMAT_MASK | | ||
| 352 | MAX98396_PCM_MODE_CFG_LRCLKEDGE; | ||
| 353 | |||
| 351 | dev_dbg(component->dev, "%s: fmt 0x%08X\n", __func__, fmt); | 354 | dev_dbg(component->dev, "%s: fmt 0x%08X\n", __func__, fmt); |
| 352 | 355 | ||
| 353 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { | 356 | 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) · 41 unmodified lines | |||
| 395 | ret = regmap_read(max98396->regmap, MAX98396_R2041_PCM_MODE_CFG, ®); | 398 | ret = regmap_read(max98396->regmap, MAX98396_R2041_PCM_MODE_CFG, ®); |
| 396 | if (ret < 0) | 399 | if (ret < 0) |
| 397 | return -EINVAL; | 400 | return -EINVAL; |
| 398 | if (format != (reg & MAX98396_PCM_BCLKEDGE_BSEL_MASK)) { | 401 | if (format != (reg & format_mask)) { |
| 399 | update = true; | 402 | update = true; |
| 400 | } else { | 403 | } else { |
| 401 | ret = regmap_read(max98396->regmap, | 404 | ret = regmap_read(max98396->regmap, |
| @@ -412,8 +415,7 @@ static int max98396_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) · 10 unmodified lines | |||
| 412 | 415 | ||
| 413 | regmap_update_bits(max98396->regmap, | 416 | regmap_update_bits(max98396->regmap, |
| 414 | MAX98396_R2041_PCM_MODE_CFG, | 417 | MAX98396_R2041_PCM_MODE_CFG, |
| 415 | MAX98396_PCM_BCLKEDGE_BSEL_MASK, | 418 | format_mask, format); |
| 416 | format); | ||
| 417 | 419 | ||
| 418 | regmap_update_bits(max98396->regmap, | 420 | regmap_update_bits(max98396->regmap, |
| 419 | MAX98396_R2042_PCM_CLK_SETUP, | 421 | MAX98396_R2042_PCM_CLK_SETUP, |
| @@ -1984,7 +1984,12 @@ static int rt5640_set_bias_level(struct snd_soc_component *component, · 1983 unmodified lines | |||
| 1984 | snd_soc_component_write(component, RT5640_PWR_DIG2, 0x0000); | 1984 | snd_soc_component_write(component, RT5640_PWR_DIG2, 0x0000); |
| 1985 | snd_soc_component_write(component, RT5640_PWR_VOL, 0x0000); | 1985 | snd_soc_component_write(component, RT5640_PWR_VOL, 0x0000); |
| 1986 | snd_soc_component_write(component, RT5640_PWR_MIXER, 0x0000); | 1986 | snd_soc_component_write(component, RT5640_PWR_MIXER, 0x0000); |
| 1987 | snd_soc_component_write(component, RT5640_PWR_ANLG1, 0x0000); | 1987 | if (rt5640->jd_src == RT5640_JD_SRC_HDA_HEADER) |
| 1988 | snd_soc_component_write(component, RT5640_PWR_ANLG1, | ||
| 1989 | 0x0018); | ||
| 1990 | else | ||
| 1991 | snd_soc_component_write(component, RT5640_PWR_ANLG1, | ||
| 1992 | 0x0000); | ||
| 1988 | snd_soc_component_write(component, RT5640_PWR_ANLG2, 0x0000); | 1993 | snd_soc_component_write(component, RT5640_PWR_ANLG2, 0x0000); |
| 1989 | break; | 1994 | break; |
| 1990 | 1995 | ||
| @@ -2393,9 +2398,15 @@ static void rt5640_jack_work(struct work_struct *work) · 402 unmodified lines | |||
| 2393 | static irqreturn_t rt5640_irq(int irq, void *data) | 2398 | static irqreturn_t rt5640_irq(int irq, void *data) |
| 2394 | { | 2399 | { |
| 2395 | struct rt5640_priv *rt5640 = data; | 2400 | struct rt5640_priv *rt5640 = data; |
| 2401 | int delay = 0; | ||
| 2402 | |||
| 2403 | if (rt5640->jd_src == RT5640_JD_SRC_HDA_HEADER) { | ||
| 2404 | cancel_delayed_work_sync(&rt5640->jack_work); | ||
| 2405 | delay = 100; | ||
| 2406 | } | ||
| 2396 | 2407 | ||
| 2397 | if (rt5640->jack) | 2408 | if (rt5640->jack) |
| 2398 | queue_delayed_work(system_long_wq, &rt5640->jack_work, 0); | 2409 | queue_delayed_work(system_long_wq, &rt5640->jack_work, delay); |
| 2399 | 2410 | ||
| 2400 | return IRQ_HANDLED; | 2411 | return IRQ_HANDLED; |
| 2401 | } | 2412 | } |
| @@ -2580,6 +2591,12 @@ static void rt5640_enable_hda_jack_detect( · 178 unmodified lines | |||
| 2580 | 2591 | ||
| 2581 | snd_soc_component_update_bits(component, RT5640_DUMMY1, 0x400, 0x0); | 2592 | snd_soc_component_update_bits(component, RT5640_DUMMY1, 0x400, 0x0); |
| 2582 | 2593 | ||
| 2594 | snd_soc_component_update_bits(component, RT5640_PWR_ANLG1, | ||
| 2595 | RT5640_PWR_VREF2, RT5640_PWR_VREF2); | ||
| 2596 | usleep_range(10000, 15000); | ||
| 2597 | snd_soc_component_update_bits(component, RT5640_PWR_ANLG1, | ||
| 2598 | RT5640_PWR_FV2, RT5640_PWR_FV2); | ||
| 2599 | |||
| 2583 | rt5640->jack = jack; | 2600 | rt5640->jack = jack; |
| 2584 | 2601 | ||
| 2585 | ret = request_irq(rt5640->irq, rt5640_irq, | 2602 | ret = request_irq(rt5640->irq, rt5640_irq, |
| @@ -2696,16 +2713,13 @@ static int rt5640_probe(struct snd_soc_component *component) · 110 unmodified lines | |||
| 2696 | 2713 | ||
| 2697 | if (device_property_read_u32(component->dev, | 2714 | if (device_property_read_u32(component->dev, |
| 2698 | "realtek,jack-detect-source", &val) == 0) { | 2715 | "realtek,jack-detect-source", &val) == 0) { |
| 2699 | if (val <= RT5640_JD_SRC_GPIO4) { | 2716 | if (val <= RT5640_JD_SRC_GPIO4) |
| 2700 | rt5640->jd_src = val << RT5640_JD_SFT; | 2717 | rt5640->jd_src = val << RT5640_JD_SFT; |
| 2701 | } else if (val == RT5640_JD_SRC_HDA_HEADER) { | 2718 | else if (val == RT5640_JD_SRC_HDA_HEADER) |
| 2702 | rt5640->jd_src = RT5640_JD_SRC_HDA_HEADER; | 2719 | rt5640->jd_src = RT5640_JD_SRC_HDA_HEADER; |
| 2703 | snd_soc_component_update_bits(component, RT5640_DUMMY1, | 2720 | else |
| 2704 | 0x0300, 0x0); | ||
| 2705 | } else { | ||
| 2706 | dev_warn(component->dev, "Warning: Invalid jack-detect-source value: %d, leaving jack-detect disabled\n", | 2721 | dev_warn(component->dev, "Warning: Invalid jack-detect-source value: %d, leaving jack-detect disabled\n", |
| 2707 | val); | 2722 | val); |
| 2708 | } | ||
| 2709 | } | 2723 | } |
| 2710 | 2724 | ||
| 2711 | if (!device_property_read_bool(component->dev, "realtek,jack-detect-not-inverted")) | 2725 | if (!device_property_read_bool(component->dev, "realtek,jack-detect-not-inverted")) |
| @@ -1795,6 +1795,9 @@ static int sgtl5000_i2c_remove(struct i2c_client *client) · 1794 unmodified lines | |||
| 1795 | { | 1795 | { |
| 1796 | struct sgtl5000_priv *sgtl5000 = i2c_get_clientdata(client); | 1796 | struct sgtl5000_priv *sgtl5000 = i2c_get_clientdata(client); |
| 1797 | 1797 | ||
| 1798 | regmap_write(sgtl5000->regmap, SGTL5000_CHIP_DIG_POWER, SGTL5000_DIG_POWER_DEFAULT); | ||
| 1799 | regmap_write(sgtl5000->regmap, SGTL5000_CHIP_ANA_POWER, SGTL5000_ANA_POWER_DEFAULT); | ||
| 1800 | |||
| 1798 | clk_disable_unprepare(sgtl5000->mclk); | 1801 | clk_disable_unprepare(sgtl5000->mclk); |
| 1799 | regulator_bulk_disable(sgtl5000->num_supplies, sgtl5000->supplies); | 1802 | regulator_bulk_disable(sgtl5000->num_supplies, sgtl5000->supplies); |
| 1800 | regulator_bulk_free(sgtl5000->num_supplies, sgtl5000->supplies); | 1803 | regulator_bulk_free(sgtl5000->num_supplies, sgtl5000->supplies); |
| @@ -1802,6 +1805,11 @@ static int sgtl5000_i2c_remove(struct i2c_client *client) · 1 unmodified line | |||
| 1802 | return 0; | 1805 | return 0; |
| 1803 | } | 1806 | } |
| 1804 | 1807 | ||
| 1808 | static void sgtl5000_i2c_shutdown(struct i2c_client *client) | ||
| 1809 | { | ||
| 1810 | sgtl5000_i2c_remove(client); | ||
| 1811 | } | ||
| 1812 | |||
| 1805 | static const struct i2c_device_id sgtl5000_id[] = { | 1813 | static const struct i2c_device_id sgtl5000_id[] = { |
| 1806 | {"sgtl5000", 0}, | 1814 | {"sgtl5000", 0}, |
| 1807 | {}, | 1815 | {}, |
| @@ -1822,6 +1830,7 @@ static struct i2c_driver sgtl5000_i2c_driver = { · 14 unmodified lines | |||
| 1822 | }, | 1830 | }, |
| 1823 | .probe_new = sgtl5000_i2c_probe, | 1831 | .probe_new = sgtl5000_i2c_probe, |
| 1824 | .remove = sgtl5000_i2c_remove, | 1832 | .remove = sgtl5000_i2c_remove, |
| 1833 | .shutdown = sgtl5000_i2c_shutdown, | ||
| 1825 | .id_table = sgtl5000_id, | 1834 | .id_table = sgtl5000_id, |
| 1826 | }; | 1835 | }; |
| 1827 | 1836 | ||
| @@ -80,6 +80,7 @@ · 79 unmodified lines | |||
| 80 | /* | 80 | /* |
| 81 | * SGTL5000_CHIP_DIG_POWER | 81 | * SGTL5000_CHIP_DIG_POWER |
| 82 | */ | 82 | */ |
| 83 | #define SGTL5000_DIG_POWER_DEFAULT 0x0000 | ||
| 83 | #define SGTL5000_ADC_EN 0x0040 | 84 | #define SGTL5000_ADC_EN 0x0040 |
| 84 | #define SGTL5000_DAC_EN 0x0020 | 85 | #define SGTL5000_DAC_EN 0x0020 |
| 85 | #define SGTL5000_DAP_POWERUP 0x0010 | 86 | #define SGTL5000_DAP_POWERUP 0x0010 |
| @@ -42,10 +42,12 @@ static void tas2764_reset(struct tas2764_priv *tas2764) · 41 unmodified lines | |||
| 42 | gpiod_set_value_cansleep(tas2764->reset_gpio, 0); | 42 | gpiod_set_value_cansleep(tas2764->reset_gpio, 0); |
| 43 | msleep(20); | 43 | msleep(20); |
| 44 | gpiod_set_value_cansleep(tas2764->reset_gpio, 1); | 44 | gpiod_set_value_cansleep(tas2764->reset_gpio, 1); |
| 45 | usleep_range(1000, 2000); | ||
| 45 | } | 46 | } |
| 46 | 47 | ||
| 47 | snd_soc_component_write(tas2764->component, TAS2764_SW_RST, | 48 | snd_soc_component_write(tas2764->component, TAS2764_SW_RST, |
| 48 | TAS2764_RST); | 49 | TAS2764_RST); |
| 50 | usleep_range(1000, 2000); | ||
| 49 | } | 51 | } |
| 50 | 52 | ||
| 51 | static int tas2764_set_bias_level(struct snd_soc_component *component, | 53 | 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) · 55 unmodified lines | |||
| 107 | struct tas2764_priv *tas2764 = snd_soc_component_get_drvdata(component); | 109 | struct tas2764_priv *tas2764 = snd_soc_component_get_drvdata(component); |
| 108 | int ret; | 110 | int ret; |
| 109 | 111 | ||
| 110 | if (tas2764->sdz_gpio) | 112 | if (tas2764->sdz_gpio) { |
| 111 | gpiod_set_value_cansleep(tas2764->sdz_gpio, 1); | 113 | gpiod_set_value_cansleep(tas2764->sdz_gpio, 1); |
| 114 | usleep_range(1000, 2000); | ||
| 115 | } | ||
| 112 | 116 | ||
| 113 | ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, | 117 | ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, |
| 114 | TAS2764_PWR_CTRL_MASK, | 118 | TAS2764_PWR_CTRL_MASK, |
| @@ -131,7 +135,8 @@ static const char * const tas2764_ASI1_src[] = { · 16 unmodified lines | |||
| 131 | }; | 135 | }; |
| 132 | 136 | ||
| 133 | static SOC_ENUM_SINGLE_DECL( | 137 | static SOC_ENUM_SINGLE_DECL( |
| 134 | tas2764_ASI1_src_enum, TAS2764_TDM_CFG2, 4, tas2764_ASI1_src); | 138 | tas2764_ASI1_src_enum, TAS2764_TDM_CFG2, TAS2764_TDM_CFG2_SCFG_SHIFT, |
| 139 | tas2764_ASI1_src); | ||
| 135 | 140 | ||
| 136 | static const struct snd_kcontrol_new tas2764_asi1_mux = | 141 | static const struct snd_kcontrol_new tas2764_asi1_mux = |
| 137 | SOC_DAPM_ENUM("ASI1 Source", tas2764_ASI1_src_enum); | 142 | 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) · 191 unmodified lines | |||
| 329 | { | 334 | { |
| 330 | struct snd_soc_component *component = dai->component; | 335 | struct snd_soc_component *component = dai->component; |
| 331 | struct tas2764_priv *tas2764 = snd_soc_component_get_drvdata(component); | 336 | struct tas2764_priv *tas2764 = snd_soc_component_get_drvdata(component); |
| 332 | u8 tdm_rx_start_slot = 0, asi_cfg_1 = 0; | 337 | u8 tdm_rx_start_slot = 0, asi_cfg_0 = 0, asi_cfg_1 = 0; |
| 333 | int iface; | ||
| 334 | int ret; | 338 | int ret; |
| 335 | 339 | ||
| 336 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { | 340 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { |
| 341 | case SND_SOC_DAIFMT_NB_IF: | ||
| 342 | asi_cfg_0 ^= TAS2764_TDM_CFG0_FRAME_START; | ||
| 343 | fallthrough; | ||
| 337 | case SND_SOC_DAIFMT_NB_NF: | 344 | case SND_SOC_DAIFMT_NB_NF: |
| 338 | asi_cfg_1 = TAS2764_TDM_CFG1_RX_RISING; | 345 | asi_cfg_1 = TAS2764_TDM_CFG1_RX_RISING; |
| 339 | break; | 346 | break; |
| 347 | case SND_SOC_DAIFMT_IB_IF: | ||
| 348 | asi_cfg_0 ^= TAS2764_TDM_CFG0_FRAME_START; | ||
| 349 | fallthrough; | ||
| 340 | case SND_SOC_DAIFMT_IB_NF: | 350 | case SND_SOC_DAIFMT_IB_NF: |
| 341 | asi_cfg_1 = TAS2764_TDM_CFG1_RX_FALLING; | 351 | asi_cfg_1 = TAS2764_TDM_CFG1_RX_FALLING; |
| 342 | break; | 352 | break; |
| 343 | default: | ||
| 344 | dev_err(tas2764->dev, "ASI format Inverse is not found\n"); | ||
| 345 | return -EINVAL; | ||
| 346 | } | 353 | } |
| 347 | 354 | ||
| 348 | ret = snd_soc_component_update_bits(component, TAS2764_TDM_CFG1, | 355 | 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) · 4 unmodified lines | |||
| 353 | 360 | ||
| 354 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { | 361 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { |
| 355 | case SND_SOC_DAIFMT_I2S: | 362 | case SND_SOC_DAIFMT_I2S: |
| 363 | asi_cfg_0 ^= TAS2764_TDM_CFG0_FRAME_START; | ||
| 364 | fallthrough; | ||
| 356 | case SND_SOC_DAIFMT_DSP_A: | 365 | case SND_SOC_DAIFMT_DSP_A: |
| 357 | iface = TAS2764_TDM_CFG2_SCFG_I2S; | ||
| 358 | tdm_rx_start_slot = 1; | 366 | tdm_rx_start_slot = 1; |
| 359 | break; | 367 | break; |
| 360 | case SND_SOC_DAIFMT_DSP_B: | 368 | case SND_SOC_DAIFMT_DSP_B: |
| 361 | case SND_SOC_DAIFMT_LEFT_J: | 369 | case SND_SOC_DAIFMT_LEFT_J: |
| 362 | iface = TAS2764_TDM_CFG2_SCFG_LEFT_J; | ||
| 363 | tdm_rx_start_slot = 0; | 370 | tdm_rx_start_slot = 0; |
| 364 | break; | 371 | break; |
| 365 | default: | 372 | default: |
| @@ -368,14 +375,15 @@ static int tas2764_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) · 2 unmodified lines | |||
| 368 | return -EINVAL; | 375 | return -EINVAL; |
| 369 | } | 376 | } |
| 370 | 377 | ||
| 371 | ret = snd_soc_component_update_bits(component, TAS2764_TDM_CFG1, | 378 | ret = snd_soc_component_update_bits(component, TAS2764_TDM_CFG0, |
| 372 | TAS2764_TDM_CFG1_MASK, | 379 | TAS2764_TDM_CFG0_FRAME_START, |
| 373 | (tdm_rx_start_slot << TAS2764_TDM_CFG1_51_SHIFT)); | 380 | asi_cfg_0); |
| 374 | if (ret < 0) | 381 | if (ret < 0) |
| 375 | return ret; | 382 | return ret; |
| 376 | 383 | ||
| 377 | ret = snd_soc_component_update_bits(component, TAS2764_TDM_CFG2, | 384 | ret = snd_soc_component_update_bits(component, TAS2764_TDM_CFG1, |
| 378 | TAS2764_TDM_CFG2_SCFG_MASK, iface); | 385 | TAS2764_TDM_CFG1_MASK, |
| 386 | (tdm_rx_start_slot << TAS2764_TDM_CFG1_51_SHIFT)); | ||
| 379 | if (ret < 0) | 387 | if (ret < 0) |
| 380 | return ret; | 388 | return ret; |
| 381 | 389 | ||
| @@ -501,8 +509,10 @@ static int tas2764_codec_probe(struct snd_soc_component *component) · 119 unmodified lines | |||
| 501 | 509 | ||
| 502 | tas2764->component = component; | 510 | tas2764->component = component; |
| 503 | 511 | ||
| 504 | if (tas2764->sdz_gpio) | 512 | if (tas2764->sdz_gpio) { |
| 505 | gpiod_set_value_cansleep(tas2764->sdz_gpio, 1); | 513 | gpiod_set_value_cansleep(tas2764->sdz_gpio, 1); |
| 514 | usleep_range(1000, 2000); | ||
| 515 | } | ||
| 506 | 516 | ||
| 507 | tas2764_reset(tas2764); | 517 | tas2764_reset(tas2764); |
| 508 | 518 | ||
| @@ -526,12 +536,12 @@ static int tas2764_codec_probe(struct snd_soc_component *component) · 17 unmodified lines | |||
| 526 | } | 536 | } |
| 527 | 537 | ||
| 528 | static DECLARE_TLV_DB_SCALE(tas2764_digital_tlv, 1100, 50, 0); | 538 | static DECLARE_TLV_DB_SCALE(tas2764_digital_tlv, 1100, 50, 0); |
| 529 | static DECLARE_TLV_DB_SCALE(tas2764_playback_volume, -10000, 50, 0); | 539 | static DECLARE_TLV_DB_SCALE(tas2764_playback_volume, -10050, 50, 1); |
| 530 | 540 | ||
| 531 | static const struct snd_kcontrol_new tas2764_snd_controls[] = { | 541 | static const struct snd_kcontrol_new tas2764_snd_controls[] = { |
| 532 | SOC_SINGLE_TLV("Speaker Volume", TAS2764_DVC, 0, | 542 | SOC_SINGLE_TLV("Speaker Volume", TAS2764_DVC, 0, |
| 533 | TAS2764_DVC_MAX, 1, tas2764_playback_volume), | 543 | TAS2764_DVC_MAX, 1, tas2764_playback_volume), |
| 534 | SOC_SINGLE_TLV("Amp Gain Volume", TAS2764_CHNL_0, 0, 0x14, 0, | 544 | SOC_SINGLE_TLV("Amp Gain Volume", TAS2764_CHNL_0, 1, 0x14, 0, |
| 535 | tas2764_digital_tlv), | 545 | tas2764_digital_tlv), |
| 536 | }; | 546 | }; |
| 537 | 547 | ||
| @@ -556,7 +566,7 @@ static const struct reg_default tas2764_reg_defaults[] = { · 18 unmodified lines | |||
| 556 | { TAS2764_SW_RST, 0x00 }, | 566 | { TAS2764_SW_RST, 0x00 }, |
| 557 | { TAS2764_PWR_CTRL, 0x1a }, | 567 | { TAS2764_PWR_CTRL, 0x1a }, |
| 558 | { TAS2764_DVC, 0x00 }, | 568 | { TAS2764_DVC, 0x00 }, |
| 559 | { TAS2764_CHNL_0, 0x00 }, | 569 | { TAS2764_CHNL_0, 0x28 }, |
| 560 | { TAS2764_TDM_CFG0, 0x09 }, | 570 | { TAS2764_TDM_CFG0, 0x09 }, |
| 561 | { TAS2764_TDM_CFG1, 0x02 }, | 571 | { TAS2764_TDM_CFG1, 0x02 }, |
| 562 | { TAS2764_TDM_CFG2, 0x0a }, | 572 | { TAS2764_TDM_CFG2, 0x0a }, |
| @@ -47,6 +47,7 @@ · 46 unmodified lines | |||
| 47 | #define TAS2764_TDM_CFG0_MASK GENMASK(3, 1) | 47 | #define TAS2764_TDM_CFG0_MASK GENMASK(3, 1) |
| 48 | #define TAS2764_TDM_CFG0_44_1_48KHZ BIT(3) | 48 | #define TAS2764_TDM_CFG0_44_1_48KHZ BIT(3) |
| 49 | #define TAS2764_TDM_CFG0_88_2_96KHZ (BIT(3) | BIT(1)) | 49 | #define TAS2764_TDM_CFG0_88_2_96KHZ (BIT(3) | BIT(1)) |
| 50 | #define TAS2764_TDM_CFG0_FRAME_START BIT(0) | ||
| 50 | 51 | ||
| 51 | /* TDM Configuration Reg1 */ | 52 | /* TDM Configuration Reg1 */ |
| 52 | #define TAS2764_TDM_CFG1 TAS2764_REG(0X0, 0x09) | 53 | #define TAS2764_TDM_CFG1 TAS2764_REG(0X0, 0x09) |
| @@ -66,10 +67,7 @@ · 13 unmodified lines | |||
| 66 | #define TAS2764_TDM_CFG2_RXS_16BITS 0x0 | 67 | #define TAS2764_TDM_CFG2_RXS_16BITS 0x0 |
| 67 | #define TAS2764_TDM_CFG2_RXS_24BITS BIT(0) | 68 | #define TAS2764_TDM_CFG2_RXS_24BITS BIT(0) |
| 68 | #define TAS2764_TDM_CFG2_RXS_32BITS BIT(1) | 69 | #define TAS2764_TDM_CFG2_RXS_32BITS BIT(1) |
| 69 | #define TAS2764_TDM_CFG2_SCFG_MASK GENMASK(5, 4) | 70 | #define TAS2764_TDM_CFG2_SCFG_SHIFT 4 |
| 70 | #define TAS2764_TDM_CFG2_SCFG_I2S 0x0 | ||
| 71 | #define TAS2764_TDM_CFG2_SCFG_LEFT_J BIT(4) | ||
| 72 | #define TAS2764_TDM_CFG2_SCFG_RIGHT_J BIT(5) | ||
| 73 | 71 | ||
| 74 | /* TDM Configuration Reg3 */ | 72 | /* TDM Configuration Reg3 */ |
| 75 | #define TAS2764_TDM_CFG3 TAS2764_REG(0X0, 0x0c) | 73 | #define TAS2764_TDM_CFG3 TAS2764_REG(0X0, 0x0c) |
| @@ -33,7 +33,6 @@ struct adcx140_priv { · 32 unmodified lines | |||
| 33 | bool micbias_vg; | 33 | bool micbias_vg; |
| 34 | 34 | ||
| 35 | unsigned int dai_fmt; | 35 | unsigned int dai_fmt; |
| 36 | unsigned int tdm_delay; | ||
| 37 | unsigned int slot_width; | 36 | unsigned int slot_width; |
| 38 | }; | 37 | }; |
| 39 | 38 | ||
| @@ -792,12 +791,13 @@ static int adcx140_set_dai_tdm_slot(struct snd_soc_dai *codec_dai, · 752 unmodified lines | |||
| 792 | { | 791 | { |
| 793 | struct snd_soc_component *component = codec_dai->component; | 792 | struct snd_soc_component *component = codec_dai->component; |
| 794 | struct adcx140_priv *adcx140 = snd_soc_component_get_drvdata(component); | 793 | struct adcx140_priv *adcx140 = snd_soc_component_get_drvdata(component); |
| 795 | unsigned int lsb; | ||
| 796 | 794 | ||
| 797 | /* TDM based on DSP mode requires slots to be adjacent */ | 795 | /* |
| 798 | lsb = __ffs(tx_mask); | 796 | * The chip itself supports arbitrary masks, but the driver currently |
| 799 | if ((lsb + 1) != __fls(tx_mask)) { | 797 | * only supports adjacent slots beginning at the first slot. |
| 800 | dev_err(component->dev, "Invalid mask, slots must be adjacent\n"); | 798 | */ |
| 799 | if (tx_mask != GENMASK(__fls(tx_mask), 0)) { | ||
| 800 | dev_err(component->dev, "Only lower adjacent slots are supported\n"); | ||
| 801 | return -EINVAL; | 801 | return -EINVAL; |
| 802 | } | 802 | } |
| 803 | 803 | ||
| @@ -812,7 +812,6 @@ static int adcx140_set_dai_tdm_slot(struct snd_soc_dai *codec_dai, · 8 unmodified lines | |||
| 812 | return -EINVAL; | 812 | return -EINVAL; |
| 813 | } | 813 | } |
| 814 | 814 | ||
| 815 | adcx140->tdm_delay = lsb; | ||
| 816 | adcx140->slot_width = slot_width; | 815 | adcx140->slot_width = slot_width; |
| 817 | 816 | ||
| 818 | return 0; | 817 | return 0; |
| @@ -342,7 +342,7 @@ struct wcd9335_codec { · 341 unmodified lines | |||
| 342 | struct regulator_bulk_data supplies[WCD9335_MAX_SUPPLY]; | 342 | struct regulator_bulk_data supplies[WCD9335_MAX_SUPPLY]; |
| 343 | 343 | ||
| 344 | unsigned int rx_port_value[WCD9335_RX_MAX]; | 344 | unsigned int rx_port_value[WCD9335_RX_MAX]; |
| 345 | unsigned int tx_port_value; | 345 | unsigned int tx_port_value[WCD9335_TX_MAX]; |
| 346 | int hph_l_gain; | 346 | int hph_l_gain; |
| 347 | int hph_r_gain; | 347 | int hph_r_gain; |
| 348 | u32 rx_bias_count; | 348 | u32 rx_bias_count; |
| @@ -1334,8 +1334,13 @@ static int slim_tx_mixer_get(struct snd_kcontrol *kc, · 985 unmodified lines | |||
| 1334 | 1334 | ||
| 1335 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kc); | 1335 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kc); |
| 1336 | struct wcd9335_codec *wcd = dev_get_drvdata(dapm->dev); | 1336 | struct wcd9335_codec *wcd = dev_get_drvdata(dapm->dev); |
| 1337 | struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kc); | ||
| 1338 | struct soc_mixer_control *mixer = | ||
| 1339 | (struct soc_mixer_control *)kc->private_value; | ||
| 1340 | int dai_id = widget->shift; | ||
| 1341 | int port_id = mixer->shift; | ||
| 1337 | 1342 | ||
| 1338 | ucontrol->value.integer.value[0] = wcd->tx_port_value; | 1343 | ucontrol->value.integer.value[0] = wcd->tx_port_value[port_id] == dai_id; |
| 1339 | 1344 | ||
| 1340 | return 0; | 1345 | return 0; |
| 1341 | } | 1346 | } |
| @@ -1358,12 +1363,12 @@ static int slim_tx_mixer_put(struct snd_kcontrol *kc, · 16 unmodified lines | |||
| 1358 | case AIF2_CAP: | 1363 | case AIF2_CAP: |
| 1359 | case AIF3_CAP: | 1364 | case AIF3_CAP: |
| 1360 | /* only add to the list if value not set */ | 1365 | /* only add to the list if value not set */ |
| 1361 | if (enable && !(wcd->tx_port_value & BIT(port_id))) { | 1366 | if (enable && wcd->tx_port_value[port_id] != dai_id) { |
| 1362 | wcd->tx_port_value |= BIT(port_id); | 1367 | wcd->tx_port_value[port_id] = dai_id; |
| 1363 | list_add_tail(&wcd->tx_chs[port_id].list, | 1368 | list_add_tail(&wcd->tx_chs[port_id].list, |
| 1364 | &wcd->dai[dai_id].slim_ch_list); | 1369 | &wcd->dai[dai_id].slim_ch_list); |
| 1365 | } else if (!enable && (wcd->tx_port_value & BIT(port_id))) { | 1370 | } else if (!enable && wcd->tx_port_value[port_id] == dai_id) { |
| 1366 | wcd->tx_port_value &= ~BIT(port_id); | 1371 | wcd->tx_port_value[port_id] = -1; |
| 1367 | list_del_init(&wcd->tx_chs[port_id].list); | 1372 | list_del_init(&wcd->tx_chs[port_id].list); |
| 1368 | } | 1373 | } |
| 1369 | break; | 1374 | break; |
| @@ -680,12 +680,17 @@ static int wm5102_out_comp_coeff_put(struct snd_kcontrol *kcontrol, · 679 unmodified lines | |||
| 680 | { | 680 | { |
| 681 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 681 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
| 682 | struct arizona *arizona = dev_get_drvdata(component->dev->parent); | 682 | struct arizona *arizona = dev_get_drvdata(component->dev->parent); |
| 683 | uint16_t dac_comp_coeff = get_unaligned_be16(ucontrol->value.bytes.data); | ||
| 684 | int ret = 0; | ||
| 683 | 685 | ||
| 684 | mutex_lock(&arizona->dac_comp_lock); | 686 | mutex_lock(&arizona->dac_comp_lock); |
| 685 | arizona->dac_comp_coeff = get_unaligned_be16(ucontrol->value.bytes.data); | 687 | if (arizona->dac_comp_coeff != dac_comp_coeff) { |
| 688 | arizona->dac_comp_coeff = dac_comp_coeff; | ||
| 689 | ret = 1; | ||
| 690 | } | ||
| 686 | mutex_unlock(&arizona->dac_comp_lock); | 691 | mutex_unlock(&arizona->dac_comp_lock); |
| 687 | 692 | ||
| 688 | return 0; | 693 | return ret; |
| 689 | } | 694 | } |
| 690 | 695 | ||
| 691 | static int wm5102_out_comp_switch_get(struct snd_kcontrol *kcontrol, | 696 | 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, · 14 unmodified lines | |||
| 706 | { | 711 | { |
| 707 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 712 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
| 708 | struct arizona *arizona = dev_get_drvdata(component->dev->parent); | 713 | struct arizona *arizona = dev_get_drvdata(component->dev->parent); |
| 714 | struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; | ||
| 715 | int ret = 0; | ||
| 716 | |||
| 717 | if (ucontrol->value.integer.value[0] > mc->max) | ||
| 718 | return -EINVAL; | ||
| 709 | 719 | ||
| 710 | mutex_lock(&arizona->dac_comp_lock); | 720 | mutex_lock(&arizona->dac_comp_lock); |
| 711 | arizona->dac_comp_enabled = ucontrol->value.integer.value[0]; | 721 | if (arizona->dac_comp_enabled != ucontrol->value.integer.value[0]) { |
| 722 | arizona->dac_comp_enabled = ucontrol->value.integer.value[0]; | ||
| 723 | ret = 1; | ||
| 724 | } | ||
| 712 | mutex_unlock(&arizona->dac_comp_lock); | 725 | mutex_unlock(&arizona->dac_comp_lock); |
| 713 | 726 | ||
| 714 | return 0; | 727 | return ret; |
| 715 | } | 728 | } |
| 716 | 729 | ||
| 717 | static const char * const wm5102_osr_text[] = { | 730 | static const char * const wm5102_osr_text[] = { |
| @@ -108,6 +108,7 @@ static int wm8998_inmux_put(struct snd_kcontrol *kcontrol, · 107 unmodified lines | |||
| 108 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 108 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 109 | unsigned int mode_reg, mode_index; | 109 | unsigned int mode_reg, mode_index; |
| 110 | unsigned int mux, inmode, src_val, mode_val; | 110 | unsigned int mux, inmode, src_val, mode_val; |
| 111 | int change, ret; | ||
| 111 | 112 | ||
| 112 | mux = ucontrol->value.enumerated.item[0]; | 113 | mux = ucontrol->value.enumerated.item[0]; |
| 113 | if (mux > 1) | 114 | if (mux > 1) |
| @@ -137,14 +138,20 @@ static int wm8998_inmux_put(struct snd_kcontrol *kcontrol, · 23 unmodified lines | |||
| 137 | snd_soc_component_update_bits(component, mode_reg, | 138 | snd_soc_component_update_bits(component, mode_reg, |
| 138 | ARIZONA_IN1_MODE_MASK, mode_val); | 139 | ARIZONA_IN1_MODE_MASK, mode_val); |
| 139 | 140 | ||
| 140 | snd_soc_component_update_bits(component, e->reg, | 141 | change = snd_soc_component_update_bits(component, e->reg, |
| 141 | ARIZONA_IN1L_SRC_MASK | | 142 | ARIZONA_IN1L_SRC_MASK | |
| 142 | ARIZONA_IN1L_SRC_SE_MASK, | 143 | ARIZONA_IN1L_SRC_SE_MASK, |
| 143 | src_val); | 144 | src_val); |
| 144 | 145 | ||
| 145 | return snd_soc_dapm_mux_update_power(dapm, kcontrol, | 146 | ret = snd_soc_dapm_mux_update_power(dapm, kcontrol, |
| 146 | ucontrol->value.enumerated.item[0], | 147 | ucontrol->value.enumerated.item[0], |
| 147 | e, NULL); | 148 | e, NULL); |
| 149 | if (ret < 0) { | ||
| 150 | dev_err(arizona->dev, "Failed to update demux power state: %d\n", ret); | ||
| 151 | return ret; | ||
| 152 | } | ||
| 153 | |||
| 154 | return change; | ||
| 148 | } | 155 | } |
| 149 | 156 | ||
| 150 | static const char * const wm8998_inmux_texts[] = { | 157 | static const char * const wm8998_inmux_texts[] = { |
| @@ -90,12 +90,12 @@ links indicates connection part of CPU side (= A). · 89 unmodified lines | |||
| 90 | ports@0 { | 90 | ports@0 { |
| 91 | (X) (A) mcpu: port@0 { mcpu0_ep: endpoint { remote-endpoint = <&mcodec0_ep>; }; }; | 91 | (X) (A) mcpu: port@0 { mcpu0_ep: endpoint { remote-endpoint = <&mcodec0_ep>; }; }; |
| 92 | (y) port@1 { mcpu1_ep: endpoint { remote-endpoint = <&cpu1_ep>; }; }; | 92 | (y) port@1 { mcpu1_ep: endpoint { remote-endpoint = <&cpu1_ep>; }; }; |
| 93 | (y) port@1 { mcpu2_ep: endpoint { remote-endpoint = <&cpu2_ep>; }; }; | 93 | (y) port@2 { mcpu2_ep: endpoint { remote-endpoint = <&cpu2_ep>; }; }; |
| 94 | }; | 94 | }; |
| 95 | ports@1 { | 95 | ports@1 { |
| 96 | (X) port@0 { mcodec0_ep: endpoint { remote-endpoint = <&mcpu0_ep>; }; }; | 96 | (X) port@0 { mcodec0_ep: endpoint { remote-endpoint = <&mcpu0_ep>; }; }; |
| 97 | (y) port@0 { mcodec1_ep: endpoint { remote-endpoint = <&codec1_ep>; }; }; | 97 | (y) port@1 { mcodec1_ep: endpoint { remote-endpoint = <&codec1_ep>; }; }; |
| 98 | (y) port@1 { mcodec2_ep: endpoint { remote-endpoint = <&codec2_ep>; }; }; | 98 | (y) port@2 { mcodec2_ep: endpoint { remote-endpoint = <&codec2_ep>; }; }; |
| 99 | }; | 99 | }; |
| 100 | }; | 100 | }; |
| 101 | }; | 101 | }; |
| @@ -69,11 +69,10 @@ static unsigned long sof_rt5682_quirk = SOF_RT5682_MCLK_EN | · 68 unmodified lines | |||
| 69 | 69 | ||
| 70 | static int is_legacy_cpu; | 70 | static int is_legacy_cpu; |
| 71 | 71 | ||
| 72 | static struct snd_soc_jack sof_hdmi[3]; | ||
| 73 | |||
| 74 | struct sof_hdmi_pcm { | 72 | struct sof_hdmi_pcm { |
| 75 | struct list_head head; | 73 | struct list_head head; |
| 76 | struct snd_soc_dai *codec_dai; | 74 | struct snd_soc_dai *codec_dai; |
| 75 | struct snd_soc_jack hdmi_jack; | ||
| 77 | int device; | 76 | int device; |
| 78 | }; | 77 | }; |
| 79 | 78 | ||
| @@ -434,7 +433,6 @@ static int sof_card_late_probe(struct snd_soc_card *card) · 354 unmodified lines | |||
| 434 | char jack_name[NAME_SIZE]; | 433 | char jack_name[NAME_SIZE]; |
| 435 | struct sof_hdmi_pcm *pcm; | 434 | struct sof_hdmi_pcm *pcm; |
| 436 | int err; | 435 | int err; |
| 437 | int i = 0; | ||
| 438 | 436 | ||
| 439 | /* HDMI is not supported by SOF on Baytrail/CherryTrail */ | 437 | /* HDMI is not supported by SOF on Baytrail/CherryTrail */ |
| 440 | if (is_legacy_cpu || !ctx->idisp_codec) | 438 | if (is_legacy_cpu || !ctx->idisp_codec) |
| @@ -455,17 +453,15 @@ static int sof_card_late_probe(struct snd_soc_card *card) · 14 unmodified lines | |||
| 455 | snprintf(jack_name, sizeof(jack_name), | 453 | snprintf(jack_name, sizeof(jack_name), |
| 456 | "HDMI/DP, pcm=%d Jack", pcm->device); | 454 | "HDMI/DP, pcm=%d Jack", pcm->device); |
| 457 | err = snd_soc_card_jack_new(card, jack_name, | 455 | err = snd_soc_card_jack_new(card, jack_name, |
| 458 | SND_JACK_AVOUT, &sof_hdmi[i]); | 456 | SND_JACK_AVOUT, &pcm->hdmi_jack); |
| 459 | 457 | ||
| 460 | if (err) | 458 | if (err) |
| 461 | return err; | 459 | return err; |
| 462 | 460 | ||
| 463 | err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device, | 461 | err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device, |
| 464 | &sof_hdmi[i]); | 462 | &pcm->hdmi_jack); |
| 465 | if (err < 0) | 463 | if (err < 0) |
| 466 | return err; | 464 | return err; |
| 467 | |||
| 468 | i++; | ||
| 469 | } | 465 | } |
| 470 | 466 | ||
| 471 | if (sof_rt5682_quirk & SOF_MAX98373_SPEAKER_AMP_PRESENT) { | 467 | if (sof_rt5682_quirk & SOF_MAX98373_SPEAKER_AMP_PRESENT) { |
| @@ -99,7 +99,6 @@ static void skl_get_ssp_clks(struct skl_dev *skl, struct skl_ssp_clk *ssp_clks, · 98 unmodified lines | |||
| 99 | struct nhlt_fmt_cfg *fmt_cfg; | 99 | struct nhlt_fmt_cfg *fmt_cfg; |
| 100 | struct wav_fmt_ext *wav_fmt; | 100 | struct wav_fmt_ext *wav_fmt; |
| 101 | unsigned long rate; | 101 | unsigned long rate; |
| 102 | bool present = false; | ||
| 103 | int rate_index = 0; | 102 | int rate_index = 0; |
| 104 | u16 channels, bps; | 103 | u16 channels, bps; |
| 105 | u8 clk_src; | 104 | u8 clk_src; |
| @@ -112,9 +111,12 @@ static void skl_get_ssp_clks(struct skl_dev *skl, struct skl_ssp_clk *ssp_clks, · 6 unmodified lines | |||
| 112 | if (fmt->fmt_count == 0) | 111 | if (fmt->fmt_count == 0) |
| 113 | return; | 112 | return; |
| 114 | 113 | ||
| 114 | fmt_cfg = (struct nhlt_fmt_cfg *)fmt->fmt_config; | ||
| 115 | for (i = 0; i < fmt->fmt_count; i++) { | 115 | for (i = 0; i < fmt->fmt_count; i++) { |
| 116 | fmt_cfg = &fmt->fmt_config[i]; | 116 | struct nhlt_fmt_cfg *saved_fmt_cfg = fmt_cfg; |
| 117 | wav_fmt = &fmt_cfg->fmt_ext; | 117 | bool present = false; |
| 118 | |||
| 119 | wav_fmt = &saved_fmt_cfg->fmt_ext; | ||
| 118 | 120 | ||
| 119 | channels = wav_fmt->fmt.channels; | 121 | channels = wav_fmt->fmt.channels; |
| 120 | bps = wav_fmt->fmt.bits_per_sample; | 122 | 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, · 11 unmodified lines | |||
| 132 | * derive the rate. | 134 | * derive the rate. |
| 133 | */ | 135 | */ |
| 134 | for (j = i; j < fmt->fmt_count; j++) { | 136 | for (j = i; j < fmt->fmt_count; j++) { |
| 135 | fmt_cfg = &fmt->fmt_config[j]; | 137 | struct nhlt_fmt_cfg *tmp_fmt_cfg = fmt_cfg; |
| 136 | wav_fmt = &fmt_cfg->fmt_ext; | 138 | |
| 139 | wav_fmt = &tmp_fmt_cfg->fmt_ext; | ||
| 137 | if ((fs == wav_fmt->fmt.samples_per_sec) && | 140 | if ((fs == wav_fmt->fmt.samples_per_sec) && |
| 138 | (bps == wav_fmt->fmt.bits_per_sample)) | 141 | (bps == wav_fmt->fmt.bits_per_sample)) { |
| 139 | channels = max_t(u16, channels, | 142 | channels = max_t(u16, channels, |
| 140 | wav_fmt->fmt.channels); | 143 | wav_fmt->fmt.channels); |
| 144 | saved_fmt_cfg = tmp_fmt_cfg; | ||
| 145 | } | ||
| 146 | /* Move to the next nhlt_fmt_cfg */ | ||
| 147 | tmp_fmt_cfg = (struct nhlt_fmt_cfg *)(tmp_fmt_cfg->config.caps + | ||
| 148 | tmp_fmt_cfg->config.size); | ||
| 141 | } | 149 | } |
| 142 | 150 | ||
| 143 | rate = channels * bps * fs; | 151 | rate = channels * bps * fs; |
| @@ -153,8 +161,11 @@ static void skl_get_ssp_clks(struct skl_dev *skl, struct skl_ssp_clk *ssp_clks, · 9 unmodified lines | |||
| 153 | 161 | ||
| 154 | /* Fill rate and parent for sclk/sclkfs */ | 162 | /* Fill rate and parent for sclk/sclkfs */ |
| 155 | if (!present) { | 163 | if (!present) { |
| 164 | struct nhlt_fmt_cfg *first_fmt_cfg; | ||
| 165 | |||
| 166 | first_fmt_cfg = (struct nhlt_fmt_cfg *)fmt->fmt_config; | ||
| 156 | i2s_config_ext = (struct skl_i2s_config_blob_ext *) | 167 | i2s_config_ext = (struct skl_i2s_config_blob_ext *) |
| 157 | fmt->fmt_config[0].config.caps; | 168 | first_fmt_cfg->config.caps; |
| 158 | 169 | ||
| 159 | /* MCLK Divider Source Select */ | 170 | /* MCLK Divider Source Select */ |
| 160 | if (is_legacy_blob(i2s_config_ext->hdr.sig)) { | 171 | 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, · 7 unmodified lines | |||
| 168 | 179 | ||
| 169 | parent = skl_get_parent_clk(clk_src); | 180 | parent = skl_get_parent_clk(clk_src); |
| 170 | 181 | ||
| 182 | /* Move to the next nhlt_fmt_cfg */ | ||
| 183 | fmt_cfg = (struct nhlt_fmt_cfg *)(fmt_cfg->config.caps + | ||
| 184 | fmt_cfg->config.size); | ||
| 171 | /* | 185 | /* |
| 172 | * Do not copy the config data if there is no parent | 186 | * Do not copy the config data if there is no parent |
| 173 | * clock available for this clock source select | 187 | * 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, · 2 unmodified lines | |||
| 176 | continue; | 190 | continue; |
| 177 | 191 | ||
| 178 | sclk[id].rate_cfg[rate_index].rate = rate; | 192 | sclk[id].rate_cfg[rate_index].rate = rate; |
| 179 | sclk[id].rate_cfg[rate_index].config = fmt_cfg; | 193 | sclk[id].rate_cfg[rate_index].config = saved_fmt_cfg; |
| 180 | sclkfs[id].rate_cfg[rate_index].rate = rate; | 194 | sclkfs[id].rate_cfg[rate_index].rate = rate; |
| 181 | sclkfs[id].rate_cfg[rate_index].config = fmt_cfg; | 195 | sclkfs[id].rate_cfg[rate_index].config = saved_fmt_cfg; |
| 182 | sclk[id].parent_name = parent->name; | 196 | sclk[id].parent_name = parent->name; |
| 183 | sclkfs[id].parent_name = parent->name; | 197 | sclkfs[id].parent_name = parent->name; |
| 184 | 198 | ||
| @@ -192,13 +206,13 @@ static void skl_get_mclk(struct skl_dev *skl, struct skl_ssp_clk *mclk, · 7 unmodified lines | |||
| 192 | { | 206 | { |
| 193 | struct skl_i2s_config_blob_ext *i2s_config_ext; | 207 | struct skl_i2s_config_blob_ext *i2s_config_ext; |
| 194 | struct skl_i2s_config_blob_legacy *i2s_config; | 208 | struct skl_i2s_config_blob_legacy *i2s_config; |
| 195 | struct nhlt_specific_cfg *fmt_cfg; | 209 | struct nhlt_fmt_cfg *fmt_cfg; |
| 196 | struct skl_clk_parent_src *parent; | 210 | struct skl_clk_parent_src *parent; |
| 197 | u32 clkdiv, div_ratio; | 211 | u32 clkdiv, div_ratio; |
| 198 | u8 clk_src; | 212 | u8 clk_src; |
| 199 | 213 | ||
| 200 | fmt_cfg = &fmt->fmt_config[0].config; | 214 | fmt_cfg = (struct nhlt_fmt_cfg *)fmt->fmt_config; |
| 201 | i2s_config_ext = (struct skl_i2s_config_blob_ext *)fmt_cfg->caps; | 215 | i2s_config_ext = (struct skl_i2s_config_blob_ext *)fmt_cfg->config.caps; |
| 202 | 216 | ||
| 203 | /* MCLK Divider Source Select and divider */ | 217 | /* MCLK Divider Source Select and divider */ |
| 204 | if (is_legacy_blob(i2s_config_ext->hdr.sig)) { | 218 | 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, · 22 unmodified lines | |||
| 227 | return; | 241 | return; |
| 228 | 242 | ||
| 229 | mclk[id].rate_cfg[0].rate = parent->rate/div_ratio; | 243 | mclk[id].rate_cfg[0].rate = parent->rate/div_ratio; |
| 230 | mclk[id].rate_cfg[0].config = &fmt->fmt_config[0]; | 244 | mclk[id].rate_cfg[0].config = fmt_cfg; |
| 231 | mclk[id].parent_name = parent->name; | 245 | mclk[id].parent_name = parent->name; |
| 232 | } | 246 | } |
| 233 | 247 | ||
| @@ -75,6 +75,7 @@ static struct audioreach_graph *q6apm_get_audioreach_graph(struct q6apm *apm, ui · 74 unmodified lines | |||
| 75 | id = idr_alloc(&apm->graph_idr, graph, graph_id, graph_id + 1, GFP_KERNEL); | 75 | id = idr_alloc(&apm->graph_idr, graph, graph_id, graph_id + 1, GFP_KERNEL); |
| 76 | if (id < 0) { | 76 | if (id < 0) { |
| 77 | dev_err(apm->dev, "Unable to allocate graph id (%d)\n", graph_id); | 77 | dev_err(apm->dev, "Unable to allocate graph id (%d)\n", graph_id); |
| 78 | kfree(graph->graph); | ||
| 78 | kfree(graph); | 79 | kfree(graph); |
| 79 | mutex_unlock(&apm->lock); | 80 | mutex_unlock(&apm->lock); |
| 80 | return ERR_PTR(id); | 81 | return ERR_PTR(id); |
| @@ -316,8 +316,6 @@ static inline int omap_mcbsp_read(struct omap_mcbsp *mcbsp, u16 reg, · 315 unmodified lines | |||
| 316 | 316 | ||
| 317 | /* Sidetone specific API */ | 317 | /* Sidetone specific API */ |
| 318 | int omap_mcbsp_st_init(struct platform_device *pdev); | 318 | int omap_mcbsp_st_init(struct platform_device *pdev); |
| 319 | void omap_mcbsp_st_cleanup(struct platform_device *pdev); | ||
| 320 | |||
| 321 | int omap_mcbsp_st_start(struct omap_mcbsp *mcbsp); | 319 | int omap_mcbsp_st_start(struct omap_mcbsp *mcbsp); |
| 322 | int omap_mcbsp_st_stop(struct omap_mcbsp *mcbsp); | 320 | int omap_mcbsp_st_stop(struct omap_mcbsp *mcbsp); |
| 323 | 321 | ||
| @@ -347,7 +347,7 @@ int omap_mcbsp_st_init(struct platform_device *pdev) · 346 unmodified lines | |||
| 347 | if (!st_data) | 347 | if (!st_data) |
| 348 | return -ENOMEM; | 348 | return -ENOMEM; |
| 349 | 349 | ||
| 350 | st_data->mcbsp_iclk = clk_get(mcbsp->dev, "ick"); | 350 | st_data->mcbsp_iclk = devm_clk_get(mcbsp->dev, "ick"); |
| 351 | if (IS_ERR(st_data->mcbsp_iclk)) { | 351 | if (IS_ERR(st_data->mcbsp_iclk)) { |
| 352 | dev_warn(mcbsp->dev, | 352 | dev_warn(mcbsp->dev, |
| 353 | "Failed to get ick, sidetone might be broken\n"); | 353 | "Failed to get ick, sidetone might be broken\n"); |
| @@ -359,7 +359,7 @@ int omap_mcbsp_st_init(struct platform_device *pdev) · 5 unmodified lines | |||
| 359 | if (!st_data->io_base_st) | 359 | if (!st_data->io_base_st) |
| 360 | return -ENOMEM; | 360 | return -ENOMEM; |
| 361 | 361 | ||
| 362 | ret = sysfs_create_group(&mcbsp->dev->kobj, &sidetone_attr_group); | 362 | ret = devm_device_add_group(mcbsp->dev, &sidetone_attr_group); |
| 363 | if (ret) | 363 | if (ret) |
| 364 | return ret; | 364 | return ret; |
| 365 | 365 | ||
| @@ -368,16 +368,6 @@ int omap_mcbsp_st_init(struct platform_device *pdev) · 2 unmodified lines | |||
| 368 | return 0; | 368 | return 0; |
| 369 | } | 369 | } |
| 370 | 370 | ||
| 371 | void omap_mcbsp_st_cleanup(struct platform_device *pdev) | ||
| 372 | { | ||
| 373 | struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev); | ||
| 374 | |||
| 375 | if (mcbsp->st_data) { | ||
| 376 | sysfs_remove_group(&mcbsp->dev->kobj, &sidetone_attr_group); | ||
| 377 | clk_put(mcbsp->st_data->mcbsp_iclk); | ||
| 378 | } | ||
| 379 | } | ||
| 380 | |||
| 381 | static int omap_mcbsp_st_info_volsw(struct snd_kcontrol *kcontrol, | 371 | static int omap_mcbsp_st_info_volsw(struct snd_kcontrol *kcontrol, |
| 382 | struct snd_ctl_elem_info *uinfo) | 372 | struct snd_ctl_elem_info *uinfo) |
| 383 | { | 373 | { |
| @@ -702,8 +702,7 @@ static int omap_mcbsp_init(struct platform_device *pdev) · 701 unmodified lines | |||
| 702 | mcbsp->max_tx_thres = max_thres(mcbsp) - 0x10; | 702 | mcbsp->max_tx_thres = max_thres(mcbsp) - 0x10; |
| 703 | mcbsp->max_rx_thres = max_thres(mcbsp) - 0x10; | 703 | mcbsp->max_rx_thres = max_thres(mcbsp) - 0x10; |
| 704 | 704 | ||
| 705 | ret = sysfs_create_group(&mcbsp->dev->kobj, | 705 | ret = devm_device_add_group(mcbsp->dev, &additional_attr_group); |
| 706 | &additional_attr_group); | ||
| 707 | if (ret) { | 706 | if (ret) { |
| 708 | dev_err(mcbsp->dev, | 707 | dev_err(mcbsp->dev, |
| 709 | "Unable to create additional controls\n"); | 708 | "Unable to create additional controls\n"); |
| @@ -711,16 +710,7 @@ static int omap_mcbsp_init(struct platform_device *pdev) · 1 unmodified line | |||
| 711 | } | 710 | } |
| 712 | } | 711 | } |
| 713 | 712 | ||
| 714 | ret = omap_mcbsp_st_init(pdev); | 713 | return omap_mcbsp_st_init(pdev); |
| 715 | if (ret) | ||
| 716 | goto err_st; | ||
| 717 | |||
| 718 | return 0; | ||
| 719 | |||
| 720 | err_st: | ||
| 721 | if (mcbsp->pdata->buffer_size) | ||
| 722 | sysfs_remove_group(&mcbsp->dev->kobj, &additional_attr_group); | ||
| 723 | return ret; | ||
| 724 | } | 714 | } |
| 725 | 715 | ||
| 726 | /* | 716 | /* |
| @@ -1431,11 +1421,6 @@ static int asoc_mcbsp_remove(struct platform_device *pdev) · 704 unmodified lines | |||
| 1431 | if (cpu_latency_qos_request_active(&mcbsp->pm_qos_req)) | 1421 | if (cpu_latency_qos_request_active(&mcbsp->pm_qos_req)) |
| 1432 | cpu_latency_qos_remove_request(&mcbsp->pm_qos_req); | 1422 | cpu_latency_qos_remove_request(&mcbsp->pm_qos_req); |
| 1433 | 1423 | ||
| 1434 | if (mcbsp->pdata->buffer_size) | ||
| 1435 | sysfs_remove_group(&mcbsp->dev->kobj, &additional_attr_group); | ||
| 1436 | |||
| 1437 | omap_mcbsp_st_cleanup(pdev); | ||
| 1438 | |||
| 1439 | return 0; | 1424 | return 0; |
| 1440 | } | 1425 | } |
| 1441 | 1426 | ||