Commit 8bd06b89 authored by Takashi Iwai's avatar Takashi Iwai

Merge tag 'asoc-fix-v6.9-rc7' of...

Merge tag 'asoc-fix-v6.9-rc7' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v6.9

A few final fixes for v6.9, none of them super major but all real.
parents fdb3f29d a85ed162
...@@ -358,11 +358,25 @@ int smn_read(struct pci_dev *dev, u32 smn_addr) ...@@ -358,11 +358,25 @@ int smn_read(struct pci_dev *dev, u32 smn_addr)
} }
EXPORT_SYMBOL_NS_GPL(smn_read, SND_SOC_ACP_COMMON); EXPORT_SYMBOL_NS_GPL(smn_read, SND_SOC_ACP_COMMON);
int check_acp_pdm(struct pci_dev *pci, struct acp_chip_info *chip) static void check_acp3x_config(struct acp_chip_info *chip)
{ {
struct acpi_device *pdm_dev; u32 val;
const union acpi_object *obj;
u32 pdm_addr, val; val = readl(chip->base + ACP3X_PIN_CONFIG);
switch (val) {
case ACP_CONFIG_4:
chip->is_i2s_config = true;
chip->is_pdm_config = true;
break;
default:
chip->is_pdm_config = true;
break;
}
}
static void check_acp6x_config(struct acp_chip_info *chip)
{
u32 val;
val = readl(chip->base + ACP_PIN_CONFIG); val = readl(chip->base + ACP_PIN_CONFIG);
switch (val) { switch (val) {
...@@ -371,42 +385,94 @@ int check_acp_pdm(struct pci_dev *pci, struct acp_chip_info *chip) ...@@ -371,42 +385,94 @@ int check_acp_pdm(struct pci_dev *pci, struct acp_chip_info *chip)
case ACP_CONFIG_6: case ACP_CONFIG_6:
case ACP_CONFIG_7: case ACP_CONFIG_7:
case ACP_CONFIG_8: case ACP_CONFIG_8:
case ACP_CONFIG_10:
case ACP_CONFIG_11: case ACP_CONFIG_11:
case ACP_CONFIG_14:
chip->is_pdm_config = true;
break;
case ACP_CONFIG_9:
chip->is_i2s_config = true;
break;
case ACP_CONFIG_10:
case ACP_CONFIG_12: case ACP_CONFIG_12:
case ACP_CONFIG_13: case ACP_CONFIG_13:
chip->is_i2s_config = true;
chip->is_pdm_config = true;
break;
default:
break;
}
}
static void check_acp70_config(struct acp_chip_info *chip)
{
u32 val;
val = readl(chip->base + ACP_PIN_CONFIG);
switch (val) {
case ACP_CONFIG_4:
case ACP_CONFIG_5:
case ACP_CONFIG_6:
case ACP_CONFIG_7:
case ACP_CONFIG_8:
case ACP_CONFIG_11:
case ACP_CONFIG_14: case ACP_CONFIG_14:
case ACP_CONFIG_17:
case ACP_CONFIG_18:
chip->is_pdm_config = true;
break;
case ACP_CONFIG_9:
chip->is_i2s_config = true;
break;
case ACP_CONFIG_10:
case ACP_CONFIG_12:
case ACP_CONFIG_13:
case ACP_CONFIG_19:
case ACP_CONFIG_20:
chip->is_i2s_config = true;
chip->is_pdm_config = true;
break; break;
default: default:
return -EINVAL; break;
} }
}
void check_acp_config(struct pci_dev *pci, struct acp_chip_info *chip)
{
struct acpi_device *pdm_dev;
const union acpi_object *obj;
u32 pdm_addr;
switch (chip->acp_rev) { switch (chip->acp_rev) {
case ACP3X_DEV: case ACP3X_DEV:
pdm_addr = ACP_RENOIR_PDM_ADDR; pdm_addr = ACP_RENOIR_PDM_ADDR;
check_acp3x_config(chip);
break; break;
case ACP6X_DEV: case ACP6X_DEV:
pdm_addr = ACP_REMBRANDT_PDM_ADDR; pdm_addr = ACP_REMBRANDT_PDM_ADDR;
check_acp6x_config(chip);
break; break;
case ACP63_DEV: case ACP63_DEV:
pdm_addr = ACP63_PDM_ADDR; pdm_addr = ACP63_PDM_ADDR;
check_acp6x_config(chip);
break; break;
case ACP70_DEV: case ACP70_DEV:
pdm_addr = ACP70_PDM_ADDR; pdm_addr = ACP70_PDM_ADDR;
check_acp70_config(chip);
break; break;
default: default:
return -EINVAL; break;
} }
pdm_dev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), pdm_addr, 0); if (chip->is_pdm_config) {
if (pdm_dev) { pdm_dev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), pdm_addr, 0);
if (!acpi_dev_get_property(pdm_dev, "acp-audio-device-type", if (pdm_dev) {
ACPI_TYPE_INTEGER, &obj) && if (!acpi_dev_get_property(pdm_dev, "acp-audio-device-type",
obj->integer.value == pdm_addr) ACPI_TYPE_INTEGER, &obj) &&
return 0; obj->integer.value == pdm_addr)
chip->is_pdm_dev = true;
}
} }
return -ENODEV;
} }
EXPORT_SYMBOL_NS_GPL(check_acp_pdm, SND_SOC_ACP_COMMON); EXPORT_SYMBOL_NS_GPL(check_acp_config, SND_SOC_ACP_COMMON);
MODULE_LICENSE("Dual BSD/GPL"); MODULE_LICENSE("Dual BSD/GPL");
...@@ -100,7 +100,6 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id ...@@ -100,7 +100,6 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id
ret = -EINVAL; ret = -EINVAL;
goto release_regions; goto release_regions;
} }
dmic_dev = platform_device_register_data(dev, "dmic-codec", PLATFORM_DEVID_NONE, NULL, 0); dmic_dev = platform_device_register_data(dev, "dmic-codec", PLATFORM_DEVID_NONE, NULL, 0);
if (IS_ERR(dmic_dev)) { if (IS_ERR(dmic_dev)) {
dev_err(dev, "failed to create DMIC device\n"); dev_err(dev, "failed to create DMIC device\n");
...@@ -119,6 +118,10 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id ...@@ -119,6 +118,10 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id
if (ret) if (ret)
goto unregister_dmic_dev; goto unregister_dmic_dev;
check_acp_config(pci, chip);
if (!chip->is_pdm_dev && !chip->is_i2s_config)
goto skip_pdev_creation;
res = devm_kcalloc(&pci->dev, num_res, sizeof(struct resource), GFP_KERNEL); res = devm_kcalloc(&pci->dev, num_res, sizeof(struct resource), GFP_KERNEL);
if (!res) { if (!res) {
ret = -ENOMEM; ret = -ENOMEM;
...@@ -136,10 +139,6 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id ...@@ -136,10 +139,6 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id
} }
} }
ret = check_acp_pdm(pci, chip);
if (ret < 0)
goto skip_pdev_creation;
chip->flag = flag; chip->flag = flag;
memset(&pdevinfo, 0, sizeof(pdevinfo)); memset(&pdevinfo, 0, sizeof(pdevinfo));
......
...@@ -138,6 +138,9 @@ struct acp_chip_info { ...@@ -138,6 +138,9 @@ struct acp_chip_info {
void __iomem *base; /* ACP memory PCI base */ void __iomem *base; /* ACP memory PCI base */
struct platform_device *chip_pdev; struct platform_device *chip_pdev;
unsigned int flag; /* Distinguish b/w Legacy or Only PDM */ unsigned int flag; /* Distinguish b/w Legacy or Only PDM */
bool is_pdm_dev; /* flag set to true when ACP PDM controller exists */
bool is_pdm_config; /* flag set to true when PDM configuration is selected from BIOS */
bool is_i2s_config; /* flag set to true when I2S configuration is selected from BIOS */
}; };
struct acp_stream { struct acp_stream {
...@@ -212,6 +215,11 @@ enum acp_config { ...@@ -212,6 +215,11 @@ enum acp_config {
ACP_CONFIG_13, ACP_CONFIG_13,
ACP_CONFIG_14, ACP_CONFIG_14,
ACP_CONFIG_15, ACP_CONFIG_15,
ACP_CONFIG_16,
ACP_CONFIG_17,
ACP_CONFIG_18,
ACP_CONFIG_19,
ACP_CONFIG_20,
}; };
extern const struct snd_soc_dai_ops asoc_acp_cpu_dai_ops; extern const struct snd_soc_dai_ops asoc_acp_cpu_dai_ops;
...@@ -240,7 +248,7 @@ void restore_acp_pdm_params(struct snd_pcm_substream *substream, ...@@ -240,7 +248,7 @@ void restore_acp_pdm_params(struct snd_pcm_substream *substream,
int restore_acp_i2s_params(struct snd_pcm_substream *substream, int restore_acp_i2s_params(struct snd_pcm_substream *substream,
struct acp_dev_data *adata, struct acp_stream *stream); struct acp_dev_data *adata, struct acp_stream *stream);
int check_acp_pdm(struct pci_dev *pci, struct acp_chip_info *chip); void check_acp_config(struct pci_dev *pci, struct acp_chip_info *chip);
static inline u64 acp_get_byte_count(struct acp_dev_data *adata, int dai_id, int direction) static inline u64 acp_get_byte_count(struct acp_dev_data *adata, int dai_id, int direction)
{ {
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#define ACP_SOFT_RESET 0x1000 #define ACP_SOFT_RESET 0x1000
#define ACP_CONTROL 0x1004 #define ACP_CONTROL 0x1004
#define ACP_PIN_CONFIG 0x1440 #define ACP_PIN_CONFIG 0x1440
#define ACP3X_PIN_CONFIG 0x1400
#define ACP_EXTERNAL_INTR_REG_ADDR(adata, offset, ctrl) \ #define ACP_EXTERNAL_INTR_REG_ADDR(adata, offset, ctrl) \
(adata->acp_base + adata->rsrc->irq_reg_offset + offset + (ctrl * 0x04)) (adata->acp_base + adata->rsrc->irq_reg_offset + offset + (ctrl * 0x04))
......
...@@ -113,7 +113,7 @@ static int avs_es8336_codec_init(struct snd_soc_pcm_runtime *runtime) ...@@ -113,7 +113,7 @@ static int avs_es8336_codec_init(struct snd_soc_pcm_runtime *runtime)
if (!pins) if (!pins)
return -ENOMEM; return -ENOMEM;
ret = snd_soc_card_jack_new_pins(card, "Headset", SND_JACK_HEADSET | SND_JACK_BTN_0, ret = snd_soc_card_jack_new_pins(card, "Headset Jack", SND_JACK_HEADSET | SND_JACK_BTN_0,
&data->jack, pins, num_pins); &data->jack, pins, num_pins);
if (ret) if (ret)
return ret; return ret;
......
...@@ -96,7 +96,7 @@ static int avs_nau8825_codec_init(struct snd_soc_pcm_runtime *runtime) ...@@ -96,7 +96,7 @@ static int avs_nau8825_codec_init(struct snd_soc_pcm_runtime *runtime)
* 4 buttons here map to the google Reference headset. * 4 buttons here map to the google Reference headset.
* The use of these buttons can be decided by the user space. * The use of these buttons can be decided by the user space.
*/ */
ret = snd_soc_card_jack_new_pins(card, "Headset", SND_JACK_HEADSET | SND_JACK_BTN_0 | ret = snd_soc_card_jack_new_pins(card, "Headset Jack", SND_JACK_HEADSET | SND_JACK_BTN_0 |
SND_JACK_BTN_1 | SND_JACK_BTN_2 | SND_JACK_BTN_3, SND_JACK_BTN_1 | SND_JACK_BTN_2 | SND_JACK_BTN_3,
jack, pins, num_pins); jack, pins, num_pins);
if (ret) if (ret)
......
...@@ -102,7 +102,8 @@ static int avs_rt274_codec_init(struct snd_soc_pcm_runtime *runtime) ...@@ -102,7 +102,8 @@ static int avs_rt274_codec_init(struct snd_soc_pcm_runtime *runtime)
if (!pins) if (!pins)
return -ENOMEM; return -ENOMEM;
ret = snd_soc_card_jack_new_pins(card, "Headset", SND_JACK_HEADSET, jack, pins, num_pins); ret = snd_soc_card_jack_new_pins(card, "Headset Jack", SND_JACK_HEADSET, jack, pins,
num_pins);
if (ret) if (ret)
return ret; return ret;
......
...@@ -63,8 +63,8 @@ static int avs_rt286_codec_init(struct snd_soc_pcm_runtime *runtime) ...@@ -63,8 +63,8 @@ static int avs_rt286_codec_init(struct snd_soc_pcm_runtime *runtime)
if (!pins) if (!pins)
return -ENOMEM; return -ENOMEM;
ret = snd_soc_card_jack_new_pins(card, "Headset", SND_JACK_HEADSET | SND_JACK_BTN_0, jack, ret = snd_soc_card_jack_new_pins(card, "Headset Jack", SND_JACK_HEADSET | SND_JACK_BTN_0,
pins, num_pins); jack, pins, num_pins);
if (ret) if (ret)
return ret; return ret;
......
...@@ -74,8 +74,8 @@ static int avs_rt298_codec_init(struct snd_soc_pcm_runtime *runtime) ...@@ -74,8 +74,8 @@ static int avs_rt298_codec_init(struct snd_soc_pcm_runtime *runtime)
if (!pins) if (!pins)
return -ENOMEM; return -ENOMEM;
ret = snd_soc_card_jack_new_pins(card, "Headset", SND_JACK_HEADSET | SND_JACK_BTN_0, jack, ret = snd_soc_card_jack_new_pins(card, "Headset Jack", SND_JACK_HEADSET | SND_JACK_BTN_0,
pins, num_pins); jack, pins, num_pins);
if (ret) if (ret)
return ret; return ret;
......
...@@ -566,10 +566,10 @@ static int mtk_dai_tdm_hw_params(struct snd_pcm_substream *substream, ...@@ -566,10 +566,10 @@ static int mtk_dai_tdm_hw_params(struct snd_pcm_substream *substream,
tdm_con |= 1 << DELAY_DATA_SFT; tdm_con |= 1 << DELAY_DATA_SFT;
tdm_con |= get_tdm_lrck_width(format) << LRCK_TDM_WIDTH_SFT; tdm_con |= get_tdm_lrck_width(format) << LRCK_TDM_WIDTH_SFT;
} else if (tdm_priv->tdm_out_mode == TDM_OUT_DSP_A) { } else if (tdm_priv->tdm_out_mode == TDM_OUT_DSP_A) {
tdm_con |= 0 << DELAY_DATA_SFT; tdm_con |= 1 << DELAY_DATA_SFT;
tdm_con |= 0 << LRCK_TDM_WIDTH_SFT; tdm_con |= 0 << LRCK_TDM_WIDTH_SFT;
} else if (tdm_priv->tdm_out_mode == TDM_OUT_DSP_B) { } else if (tdm_priv->tdm_out_mode == TDM_OUT_DSP_B) {
tdm_con |= 1 << DELAY_DATA_SFT; tdm_con |= 0 << DELAY_DATA_SFT;
tdm_con |= 0 << LRCK_TDM_WIDTH_SFT; tdm_con |= 0 << LRCK_TDM_WIDTH_SFT;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment