diff --git a/sound/soc/sof/intel/bdw.c b/sound/soc/sof/intel/bdw.c index 8068a48c90cc9b..0a0892afaffd77 100644 --- a/sound/soc/sof/intel/bdw.c +++ b/sound/soc/sof/intel/bdw.c @@ -519,6 +519,10 @@ static int bdw_fw_ready(struct snd_sof_dev *sdev, u32 msg_id) " Firmware info: version %d:%d-%s build %d on %s:%s\n", v->major, v->minor, v->tag, v->build, v->date, v->time); + /* only copy the fw_version into debugfs at first boot */ + if (sdev->first_boot) + memcpy(&sdev->fw_version, v, sizeof(*v)); + /* now check for extended data */ snd_sof_fw_parse_ext_data(sdev, MBOX_OFFSET + sizeof(struct sof_ipc_fw_ready)); diff --git a/sound/soc/sof/intel/byt.c b/sound/soc/sof/intel/byt.c index 25d5bf0ed6f31c..292eed4eeead43 100644 --- a/sound/soc/sof/intel/byt.c +++ b/sound/soc/sof/intel/byt.c @@ -279,6 +279,10 @@ static int byt_fw_ready(struct snd_sof_dev *sdev, u32 msg_id) " Firmware info: version %d:%d-%s build %d on %s:%s\n", v->major, v->minor, v->tag, v->build, v->date, v->time); + /* only copy the fw_version into debugfs at first boot */ + if (sdev->first_boot) + memcpy(&sdev->fw_version, v, sizeof(*v)); + /* now check for extended data */ snd_sof_fw_parse_ext_data(sdev, MBOX_OFFSET + sizeof(struct sof_ipc_fw_ready)); diff --git a/sound/soc/sof/intel/hda-ipc.c b/sound/soc/sof/intel/hda-ipc.c index dc2df7a99d03f2..e025da964ef59e 100644 --- a/sound/soc/sof/intel/hda-ipc.c +++ b/sound/soc/sof/intel/hda-ipc.c @@ -385,6 +385,10 @@ int hda_dsp_ipc_fw_ready(struct snd_sof_dev *sdev, u32 msg_id) " Firmware info: version %d.%d-%s build %d on %s:%s\n", v->major, v->minor, v->tag, v->build, v->date, v->time); + /* only copy the fw_version into debugfs at first boot */ + if (sdev->first_boot) + memcpy(&sdev->fw_version, v, sizeof(*v)); + /* now check for extended data */ snd_sof_fw_parse_ext_data(sdev, HDA_DSP_MBOX_UPLINK_OFFSET + sizeof(struct sof_ipc_fw_ready)); diff --git a/sound/soc/sof/intel/hsw.c b/sound/soc/sof/intel/hsw.c index fef9aa0c8ec249..2299686db32c50 100644 --- a/sound/soc/sof/intel/hsw.c +++ b/sound/soc/sof/intel/hsw.c @@ -521,6 +521,10 @@ static int hsw_fw_ready(struct snd_sof_dev *sdev, u32 msg_id) " Firmware info: version %d:%d-%s build %d on %s:%s\n", v->major, v->minor, v->tag, v->build, v->date, v->time); + /* only copy the fw_version into debugfs at first boot */ + if (sdev->first_boot) + memcpy(&sdev->fw_version, v, sizeof(*v)); + /* now check for extended data */ snd_sof_fw_parse_ext_data(sdev, MBOX_OFFSET + sizeof(struct sof_ipc_fw_ready)); diff --git a/sound/soc/sof/loader.c b/sound/soc/sof/loader.c index e30531026209e9..6828d9e9b1a0d1 100644 --- a/sound/soc/sof/loader.c +++ b/sound/soc/sof/loader.c @@ -284,6 +284,18 @@ int snd_sof_run_firmware(struct snd_sof_dev *sdev) init_waitqueue_head(&sdev->boot_wait); sdev->boot_complete = false; + /* create fw_version debugfs to store boot version info */ + if (sdev->first_boot) { + ret = snd_sof_debugfs_create_item(sdev, &sdev->fw_version, + sizeof(sdev->fw_version), + "fw_version"); + + if (ret < 0) { + dev_err(sdev->dev, "cannot create debugfs for fw_version\n"); + return ret; + } + } + dev_dbg(sdev->dev, "booting DSP firmware\n"); /* boot the firmware on the DSP */ diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index 0f7ddf19bf8a15..318762d1349fea 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -336,6 +336,7 @@ struct snd_sof_dev { struct snd_dma_buffer dmab; struct snd_dma_buffer dmab_bdl; struct sof_ipc_fw_ready fw_ready; + struct sof_ipc_fw_version fw_version; /* topology */ struct snd_soc_tplg_ops *tplg_ops;