From 97afaba2bb7c499af2df76171cb7953ad9b72d20 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 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; From 533a2dee7083d26f35cf05b3df832c6eac2decbb 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 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)); From 6eb7bcc1e49b2095c72bf6a5b19b04023a4fb403 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 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 */