Skip to content

Commit 1ee45e6

Browse files
committed
firmware: cs_dsp: Some small coding improvements
Merge series from Richard Fitzgerald <[email protected]>: Commit series that makes some small improvements to code and the kernel log messages.
2 parents 0d1ebba + dc0e5ca commit 1ee45e6

File tree

10 files changed

+237
-128
lines changed

10 files changed

+237
-128
lines changed

drivers/firmware/cirrus/cs_dsp.c

Lines changed: 185 additions & 110 deletions
Large diffs are not rendered by default.

include/linux/firmware/cirrus/cs_dsp.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ struct cs_dsp {
167167
const struct cs_dsp_region *mem;
168168
int num_mems;
169169

170-
int fw_ver;
170+
int wmfw_ver;
171171

172172
bool booted;
173173
bool running;
@@ -213,13 +213,13 @@ int cs_dsp_adsp2_init(struct cs_dsp *dsp);
213213
int cs_dsp_halo_init(struct cs_dsp *dsp);
214214

215215
int cs_dsp_adsp1_power_up(struct cs_dsp *dsp,
216-
const struct firmware *wmfw_firmware, char *wmfw_filename,
217-
const struct firmware *coeff_firmware, char *coeff_filename,
216+
const struct firmware *wmfw_firmware, const char *wmfw_filename,
217+
const struct firmware *coeff_firmware, const char *coeff_filename,
218218
const char *fw_name);
219219
void cs_dsp_adsp1_power_down(struct cs_dsp *dsp);
220220
int cs_dsp_power_up(struct cs_dsp *dsp,
221-
const struct firmware *wmfw_firmware, char *wmfw_filename,
222-
const struct firmware *coeff_firmware, char *coeff_filename,
221+
const struct firmware *wmfw_firmware, const char *wmfw_filename,
222+
const struct firmware *coeff_firmware, const char *coeff_filename,
223223
const char *fw_name);
224224
void cs_dsp_power_down(struct cs_dsp *dsp);
225225
int cs_dsp_run(struct cs_dsp *dsp);

sound/soc/amd/yc/acp6x-mach.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = {
283283
DMI_MATCH(DMI_PRODUCT_NAME, "M5402RA"),
284284
}
285285
},
286+
{
287+
.driver_data = &acp6x_card,
288+
.matches = {
289+
DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC."),
290+
DMI_MATCH(DMI_PRODUCT_NAME, "M5602RA"),
291+
}
292+
},
286293
{
287294
.driver_data = &acp6x_card,
288295
.matches = {

sound/soc/codecs/rt5645.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ static const struct reg_sequence init_list[] = {
8181
static const struct reg_sequence rt5650_init_list[] = {
8282
{0xf6, 0x0100},
8383
{RT5645_PWR_ANLG1, 0x02},
84-
{RT5645_IL_CMD3, 0x0018},
84+
{RT5645_IL_CMD3, 0x6728},
8585
};
8686

8787
static const struct reg_default rt5645_reg[] = {
@@ -3130,20 +3130,32 @@ static void rt5645_enable_push_button_irq(struct snd_soc_component *component,
31303130
bool enable)
31313131
{
31323132
struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
3133+
int ret;
31333134

31343135
if (enable) {
31353136
snd_soc_dapm_force_enable_pin(dapm, "ADC L power");
31363137
snd_soc_dapm_force_enable_pin(dapm, "ADC R power");
31373138
snd_soc_dapm_sync(dapm);
31383139

3140+
snd_soc_component_update_bits(component, RT5650_4BTN_IL_CMD2,
3141+
RT5645_EN_4BTN_IL_MASK | RT5645_RST_4BTN_IL_MASK,
3142+
RT5645_EN_4BTN_IL_EN | RT5645_RST_4BTN_IL_RST);
3143+
usleep_range(10000, 15000);
3144+
snd_soc_component_update_bits(component, RT5650_4BTN_IL_CMD2,
3145+
RT5645_EN_4BTN_IL_MASK | RT5645_RST_4BTN_IL_MASK,
3146+
RT5645_EN_4BTN_IL_EN | RT5645_RST_4BTN_IL_NORM);
3147+
msleep(50);
3148+
ret = snd_soc_component_read(component, RT5645_INT_IRQ_ST);
3149+
pr_debug("%s read %x = %x\n", __func__, RT5645_INT_IRQ_ST,
3150+
snd_soc_component_read(component, RT5645_INT_IRQ_ST));
3151+
snd_soc_component_write(component, RT5645_INT_IRQ_ST, ret);
3152+
ret = snd_soc_component_read(component, RT5650_4BTN_IL_CMD1);
3153+
pr_debug("%s read %x = %x\n", __func__, RT5650_4BTN_IL_CMD1,
3154+
snd_soc_component_read(component, RT5650_4BTN_IL_CMD1));
3155+
snd_soc_component_write(component, RT5650_4BTN_IL_CMD1, ret);
31393156
snd_soc_component_update_bits(component, RT5650_4BTN_IL_CMD1, 0x3, 0x3);
31403157
snd_soc_component_update_bits(component,
31413158
RT5645_INT_IRQ_ST, 0x8, 0x8);
3142-
snd_soc_component_update_bits(component,
3143-
RT5650_4BTN_IL_CMD2, 0x8000, 0x8000);
3144-
snd_soc_component_read(component, RT5650_4BTN_IL_CMD1);
3145-
pr_debug("%s read %x = %x\n", __func__, RT5650_4BTN_IL_CMD1,
3146-
snd_soc_component_read(component, RT5650_4BTN_IL_CMD1));
31473159
} else {
31483160
snd_soc_component_update_bits(component, RT5650_4BTN_IL_CMD2, 0x8000, 0x0);
31493161
snd_soc_component_update_bits(component, RT5645_INT_IRQ_ST, 0x8, 0x0);

sound/soc/codecs/rt5645.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,6 +2011,12 @@
20112011
#define RT5645_ZCD_HP_DIS (0x0 << 15)
20122012
#define RT5645_ZCD_HP_EN (0x1 << 15)
20132013

2014+
/* Buttons Inline Command Function 2 (0xe0) */
2015+
#define RT5645_EN_4BTN_IL_MASK (0x1 << 15)
2016+
#define RT5645_EN_4BTN_IL_EN (0x1 << 15)
2017+
#define RT5645_RST_4BTN_IL_MASK (0x1 << 14)
2018+
#define RT5645_RST_4BTN_IL_RST (0x0 << 14)
2019+
#define RT5645_RST_4BTN_IL_NORM (0x1 << 14)
20142020

20152021
/* Codec Private Register definition */
20162022
/* DAC ADC Digital Volume (0x00) */

sound/soc/codecs/rt711-sdw.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ static bool rt711_readable_register(struct device *dev, unsigned int reg)
3838
case 0x8300 ... 0x83ff:
3939
case 0x9c00 ... 0x9cff:
4040
case 0xb900 ... 0xb9ff:
41+
case 0x752008:
4142
case 0x752009:
43+
case 0x75200b:
4244
case 0x752011:
4345
case 0x75201a:
4446
case 0x752045:

sound/soc/codecs/wm_adsp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ static int wm_adsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl)
601601
return -EINVAL;
602602
}
603603

604-
switch (cs_dsp->fw_ver) {
604+
switch (cs_dsp->wmfw_ver) {
605605
case 0:
606606
case 1:
607607
ret = scnprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN,

sound/soc/mediatek/mt8195/mt8195-mt6359.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,7 @@ SND_SOC_DAILINK_DEFS(ETDM2_IN_BE,
827827

828828
SND_SOC_DAILINK_DEFS(ETDM1_OUT_BE,
829829
DAILINK_COMP_ARRAY(COMP_CPU("ETDM1_OUT")),
830+
DAILINK_COMP_ARRAY(COMP_EMPTY()),
830831
DAILINK_COMP_ARRAY(COMP_EMPTY()));
831832

832833
SND_SOC_DAILINK_DEFS(ETDM2_OUT_BE,

sound/soc/sof/intel/hda-dai.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -617,12 +617,6 @@ static int hda_dai_suspend(struct hdac_bus *bus)
617617
sdai = swidget->private;
618618
ops = sdai->platform_private;
619619

620-
ret = hda_link_dma_cleanup(hext_stream->link_substream,
621-
hext_stream,
622-
cpu_dai);
623-
if (ret < 0)
624-
return ret;
625-
626620
/* for consistency with TRIGGER_SUSPEND */
627621
if (ops->post_trigger) {
628622
ret = ops->post_trigger(sdev, cpu_dai,
@@ -631,6 +625,12 @@ static int hda_dai_suspend(struct hdac_bus *bus)
631625
if (ret < 0)
632626
return ret;
633627
}
628+
629+
ret = hda_link_dma_cleanup(hext_stream->link_substream,
630+
hext_stream,
631+
cpu_dai);
632+
if (ret < 0)
633+
return ret;
634634
}
635635
}
636636

sound/soc/sof/intel/hda-pcm.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,12 @@ int hda_dsp_pcm_open(struct snd_sof_dev *sdev,
258258
snd_pcm_hw_constraint_integer(substream->runtime,
259259
SNDRV_PCM_HW_PARAM_PERIODS);
260260

261+
/* Limit the maximum number of periods to not exceed the BDL entries count */
262+
if (runtime->hw.periods_max > HDA_DSP_MAX_BDL_ENTRIES)
263+
snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS,
264+
runtime->hw.periods_min,
265+
HDA_DSP_MAX_BDL_ENTRIES);
266+
261267
/* Only S16 and S32 supported by HDA hardware when used without DSP */
262268
if (sdev->dspless_mode_selected)
263269
snd_pcm_hw_constraint_mask64(substream->runtime, SNDRV_PCM_HW_PARAM_FORMAT,

0 commit comments

Comments
 (0)