From 0bbd9a47c8b3484de81372415557e27c1c82aba0 Mon Sep 17 00:00:00 2001 From: Pan Xiuli Date: Fri, 2 Nov 2018 18:41:54 +0800 Subject: [PATCH 1/3] ASoC: SOF: sof-priv.h: add fw_version in sof_dev Store fw_version for logger to use Signed-off-by: Pan Xiuli --- sound/soc/sof/sof-priv.h | 1 + 1 file changed, 1 insertion(+) 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; From 384935583481d28a5b6421e3a769ca52dedf1f6b Mon Sep 17 00:00:00 2001 From: Pan Xiuli Date: Fri, 2 Nov 2018 18:42:03 +0800 Subject: [PATCH 2/3] ASoC: SOF: Intel: Store fw_version when first boot Signed-off-by: Pan Xiuli --- sound/soc/sof/intel/bdw.c | 4 ++++ sound/soc/sof/intel/byt.c | 4 ++++ sound/soc/sof/intel/hda-ipc.c | 4 ++++ sound/soc/sof/intel/hsw.c | 4 ++++ 4 files changed, 16 insertions(+) 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)); From 13ea6d9f398a21bd2d032b48c8af6f7149c9dcf8 Mon Sep 17 00:00:00 2001 From: Pan Xiuli Date: Fri, 2 Nov 2018 18:42:14 +0800 Subject: [PATCH 3/3] ASoC: SOF: loader: create debugfs fw_version at first boot Create the debugfs to store the first boot fw verion info. Signed-off-by: Pan Xiuli --- sound/soc/sof/loader.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 */