Skip to content

Commit

Permalink
Merge series "ASoC: SOF: cleanups" from Pierre-Louis Bossart <pierre-…
Browse files Browse the repository at this point in the history
[email protected]>:

Minor cleanups for error formats, missing cases, useless functions and
simplifications.

Curtis Malainey (2):
  ASoC: SOF: add missing pm debug
  ASoC: SOF: fix string format for errors

Fred Oh (1):
  ASoC: SOF: ext_manifest: use explicit number for elem_type

Guennadi Liakhovetski (2):
  ASoC: SOF: remove unused functions
  ASoC: SOF: HDA: (cosmetic) simplify hda_dsp_d0i3_work()

 include/sound/sof/ext_manifest.h   |  6 ++--
 sound/soc/sof/intel/hda-compress.c |  2 +-
 sound/soc/sof/intel/hda-dsp.c      | 18 +++++------
 sound/soc/sof/intel/hda-loader.c   |  6 ++--
 sound/soc/sof/intel/hda-pcm.c      |  2 +-
 sound/soc/sof/intel/hda-trace.c    |  4 +--
 sound/soc/sof/intel/hda.c          | 50 ------------------------------
 sound/soc/sof/intel/hda.h          |  1 -
 sound/soc/sof/ipc.c                |  2 ++
 9 files changed, 19 insertions(+), 72 deletions(-)

--
2.25.1
  • Loading branch information
broonie committed Feb 10, 2021
2 parents 02eb390 + cc11626 commit 4fc320d
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 72 deletions.
6 changes: 3 additions & 3 deletions include/sound/sof/ext_manifest.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ struct sof_ext_man_header {
/* Extended manifest elements types */
enum sof_ext_man_elem_type {
SOF_EXT_MAN_ELEM_FW_VERSION = 0,
SOF_EXT_MAN_ELEM_WINDOW = SOF_IPC_EXT_WINDOW,
SOF_EXT_MAN_ELEM_CC_VERSION = SOF_IPC_EXT_CC_INFO,
SOF_EXT_MAN_ELEM_DBG_ABI = SOF_IPC_EXT_USER_ABI_INFO,
SOF_EXT_MAN_ELEM_WINDOW = 1,
SOF_EXT_MAN_ELEM_CC_VERSION = 2,
SOF_EXT_MAN_ELEM_DBG_ABI = 4,
SOF_EXT_MAN_ELEM_CONFIG_DATA = 5, /**< ABI3.17 */
SOF_EXT_MAN_ELEM_PLATFORM_CONFIG_DATA = 6,
};
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/sof/intel/hda-compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ int hda_probe_compr_set_params(struct snd_sof_dev *sdev,

ret = hda_dsp_stream_hw_params(sdev, stream, dmab, NULL);
if (ret < 0) {
dev_err(sdev->dev, "error: hdac prepare failed: %x\n", ret);
dev_err(sdev->dev, "error: hdac prepare failed: %d\n", ret);
return ret;
}

Expand Down
18 changes: 7 additions & 11 deletions sound/soc/sof/intel/hda-dsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ int hda_dsp_resume(struct snd_sof_dev *sdev)
ret = snd_hdac_ext_bus_link_power_up(hlink);
if (ret < 0) {
dev_dbg(sdev->dev,
"error %x in %s: failed to power up links",
"error %d in %s: failed to power up links",
ret, __func__);
return ret;
}
Expand Down Expand Up @@ -934,19 +934,15 @@ void hda_dsp_d0i3_work(struct work_struct *work)
d0i3_work.work);
struct hdac_bus *bus = &hdev->hbus.core;
struct snd_sof_dev *sdev = dev_get_drvdata(bus->dev);
struct sof_dsp_power_state target_state;
struct sof_dsp_power_state target_state = {
.state = SOF_DSP_PM_D0,
.substate = SOF_HDA_DSP_PM_D0I3,
};
int ret;

target_state.state = SOF_DSP_PM_D0;

/* DSP can enter D0I3 iff only D0I3-compatible streams are active */
if (snd_sof_dsp_only_d0i3_compatible_stream_active(sdev))
target_state.substate = SOF_HDA_DSP_PM_D0I3;
else
target_state.substate = SOF_HDA_DSP_PM_D0I0;

/* remain in D0I0 */
if (target_state.substate == SOF_HDA_DSP_PM_D0I0)
if (!snd_sof_dsp_only_d0i3_compatible_stream_active(sdev))
/* remain in D0I0 */
return;

/* This can fail but error cannot be propagated */
Expand Down
6 changes: 3 additions & 3 deletions sound/soc/sof/intel/hda-loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static struct hdac_ext_stream *cl_stream_prepare(struct snd_sof_dev *sdev, unsig
/* allocate DMA buffer */
ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV_SG, &pci->dev, size, dmab);
if (ret < 0) {
dev_err(sdev->dev, "error: memory alloc failed: %x\n", ret);
dev_err(sdev->dev, "error: memory alloc failed: %d\n", ret);
goto error;
}

Expand All @@ -58,13 +58,13 @@ static struct hdac_ext_stream *cl_stream_prepare(struct snd_sof_dev *sdev, unsig
if (direction == SNDRV_PCM_STREAM_CAPTURE) {
ret = hda_dsp_iccmax_stream_hw_params(sdev, dsp_stream, dmab, NULL);
if (ret < 0) {
dev_err(sdev->dev, "error: iccmax stream prepare failed: %x\n", ret);
dev_err(sdev->dev, "error: iccmax stream prepare failed: %d\n", ret);
goto error;
}
} else {
ret = hda_dsp_stream_hw_params(sdev, dsp_stream, dmab, NULL);
if (ret < 0) {
dev_err(sdev->dev, "error: hdac prepare failed: %x\n", ret);
dev_err(sdev->dev, "error: hdac prepare failed: %d\n", ret);
goto error;
}
hda_dsp_stream_spib_config(sdev, dsp_stream, HDA_DSP_SPIB_ENABLE, size);
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/sof/intel/hda-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ int hda_dsp_pcm_hw_params(struct snd_sof_dev *sdev,

ret = hda_dsp_stream_hw_params(sdev, stream, dmab, params);
if (ret < 0) {
dev_err(sdev->dev, "error: hdac prepare failed: %x\n", ret);
dev_err(sdev->dev, "error: hdac prepare failed: %d\n", ret);
return ret;
}

Expand Down
4 changes: 2 additions & 2 deletions sound/soc/sof/intel/hda-trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static int hda_dsp_trace_prepare(struct snd_sof_dev *sdev)

ret = hda_dsp_stream_hw_params(sdev, stream, dmab, NULL);
if (ret < 0)
dev_err(sdev->dev, "error: hdac prepare failed: %x\n", ret);
dev_err(sdev->dev, "error: hdac prepare failed: %d\n", ret);

return ret;
}
Expand All @@ -59,7 +59,7 @@ int hda_dsp_trace_init(struct snd_sof_dev *sdev, u32 *stream_tag)
*/
ret = hda_dsp_trace_prepare(sdev);
if (ret < 0) {
dev_err(sdev->dev, "error: hdac trace init failed: %x\n", ret);
dev_err(sdev->dev, "error: hdac trace init failed: %d\n", ret);
hda_dsp_stream_put(sdev, SNDRV_PCM_STREAM_CAPTURE, *stream_tag);
hda->dtrace_stream = NULL;
*stream_tag = 0;
Expand Down
50 changes: 0 additions & 50 deletions sound/soc/sof/intel/hda.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,26 +319,6 @@ static const struct hda_dsp_msg_code hda_dsp_rom_msg[] = {
{HDA_DSP_ROM_NULL_FW_ENTRY, "error: null FW entry point"},
};

static void hda_dsp_get_status_skl(struct snd_sof_dev *sdev)
{
u32 status;
int i;

status = snd_sof_dsp_read(sdev, HDA_DSP_BAR,
HDA_ADSP_FW_STATUS_SKL);

for (i = 0; i < ARRAY_SIZE(hda_dsp_rom_msg); i++) {
if (status == hda_dsp_rom_msg[i].code) {
dev_err(sdev->dev, "%s - code %8.8x\n",
hda_dsp_rom_msg[i].msg, status);
return;
}
}

/* not for us, must be generic sof message */
dev_dbg(sdev->dev, "unknown ROM status value %8.8x\n", status);
}

static void hda_dsp_get_status(struct snd_sof_dev *sdev)
{
u32 status;
Expand Down Expand Up @@ -387,36 +367,6 @@ static void hda_dsp_get_registers(struct snd_sof_dev *sdev,
stack_words * sizeof(u32));
}

void hda_dsp_dump_skl(struct snd_sof_dev *sdev, u32 flags)
{
struct sof_ipc_dsp_oops_xtensa xoops;
struct sof_ipc_panic_info panic_info;
u32 stack[HDA_DSP_STACK_DUMP_SIZE];
u32 status, panic;

/* try APL specific status message types first */
hda_dsp_get_status_skl(sdev);

/* now try generic SOF status messages */
status = snd_sof_dsp_read(sdev, HDA_DSP_BAR,
HDA_ADSP_ERROR_CODE_SKL);

/*TODO: Check: there is no define in spec, but it is used in the code*/
panic = snd_sof_dsp_read(sdev, HDA_DSP_BAR,
HDA_ADSP_ERROR_CODE_SKL + 0x4);

if (sdev->fw_state == SOF_FW_BOOT_COMPLETE) {
hda_dsp_get_registers(sdev, &xoops, &panic_info, stack,
HDA_DSP_STACK_DUMP_SIZE);
snd_sof_get_status(sdev, status, panic, &xoops, &panic_info,
stack, HDA_DSP_STACK_DUMP_SIZE);
} else {
dev_err(sdev->dev, "error: status = 0x%8.8x panic = 0x%8.8x\n",
status, panic);
hda_dsp_get_status_skl(sdev);
}
}

/* dump the first 8 dwords representing the extended ROM status */
static void hda_dsp_dump_ext_rom_status(struct snd_sof_dev *sdev, u32 flags)
{
Expand Down
1 change: 0 additions & 1 deletion sound/soc/sof/intel/hda.h
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,6 @@ int hda_dsp_runtime_suspend(struct snd_sof_dev *sdev);
int hda_dsp_runtime_resume(struct snd_sof_dev *sdev);
int hda_dsp_runtime_idle(struct snd_sof_dev *sdev);
int hda_dsp_set_hw_params_upon_resume(struct snd_sof_dev *sdev);
void hda_dsp_dump_skl(struct snd_sof_dev *sdev, u32 flags);
void hda_dsp_dump(struct snd_sof_dev *sdev, u32 flags);
void hda_ipc_dump(struct snd_sof_dev *sdev);
void hda_ipc_irq_dump(struct snd_sof_dev *sdev);
Expand Down
2 changes: 2 additions & 0 deletions sound/soc/sof/ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ static void ipc_log_header(struct device *dev, u8 *text, u32 cmd)
str2 = "CLK_REQ"; break;
case SOF_IPC_PM_CORE_ENABLE:
str2 = "CORE_ENABLE"; break;
case SOF_IPC_PM_GATE:
str2 = "GATE"; break;
default:
str2 = "unknown type"; break;
}
Expand Down

0 comments on commit 4fc320d

Please sign in to comment.