diff --git a/sound/soc/sof/intel/bdw.c b/sound/soc/sof/intel/bdw.c index ef272108593f64..223508ef16fac2 100644 --- a/sound/soc/sof/intel/bdw.c +++ b/sound/soc/sof/intel/bdw.c @@ -511,6 +511,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 7b6d549b0d439b..34695d0cac6a5f 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 60aa083a76953a..921427179dfd8b 100644 --- a/sound/soc/sof/intel/hda-ipc.c +++ b/sound/soc/sof/intel/hda-ipc.c @@ -379,6 +379,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 c0139855cd6da6..3407eac9609603 100644 --- a/sound/soc/sof/intel/hsw.c +++ b/sound/soc/sof/intel/hsw.c @@ -513,6 +513,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 ef954a8b2af4f8..cd36421a2aee81 100644 --- a/sound/soc/sof/loader.c +++ b/sound/soc/sof/loader.c @@ -276,6 +276,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 ae1b6d7b6922dd..30956c5976f925 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -336,6 +336,7 @@ struct snd_sof_dev { int cl_bar; struct snd_dma_buffer dmab; struct sof_ipc_fw_ready fw_ready; + struct sof_ipc_fw_version fw_version; /* topology */ struct snd_soc_tplg_ops *tplg_ops;