Skip to contentSkip to conversation

ASoC: intel: atom: Add FW version information

PATCH Superseded Sebastien Guiriec 3 participants 9 messages Nov 24, 2016 – Dec 1, 2016

Subsystems (3)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v4 cover ASoC: intel: atom: Add FW version information

This patch series is adding FW version information of SST. Version is both log as dev_info and sysfs entry.

Update since V1:
- sysfs entry is set to "FW not yet loaded" in case we do not have loaded the FW once

Update since V2:
- Add Vinod ack.
https://www.spinics.net/lists/alsa-devel/msg56521.html

Update since V3:
- Add sysfs entry description.

Sebastien Guiriec (4):
ASoC: intel: atom: Add debug information related to FW version
ASoC: Intel: atom: save FW version
ASoC: Intel: atom: Add sysfs entry in order to store FW version
Documentation: ABI: Add ASoC Intel SST Atom sysfs description

 Documentation/ABI/testing/sysfs-platform-sst-atom | 18 +++++++++++
 sound/soc/intel/atom/sst/sst.c                    | 39 +++++++++++++++++++++++
 sound/soc/intel/atom/sst/sst.h                    |  1 +
 sound/soc/intel/atom/sst/sst_ipc.c                | 10 +++++-
 4 files changed, 67 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/ABI/testing/sysfs-platform-sst-atom
Signature · 13 lines
2.9.3

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#1 lore raw

PATCH v4 1/4 ASoC: intel: atom: Add debug information related to FW version

This patch is adding debug information related to SST FW version.

---
 sound/soc/intel/atom/sst/sst_ipc.c | 3 +++
 1 file changed, 3 insertions(+)
sound/soc/intel/atom/sst/sst_ipc.c +3 -0
index 8afa6fe..92ffeaa 100644
@@ -236,6 +236,9 @@ static void process_fw_init(struct intel_sst_drv *sst_drv_ctx,
 		retval = init->result;
 		goto ret;
 	}
+	dev_info(sst_drv_ctx->dev, "FW Version %02x.%02x.%02x.%02x\n",
+			init->fw_version.type, init->fw_version.major,
+			init->fw_version.minor, init->fw_version.build);
 
 ret:
 	sst_wake_up_block(sst_drv_ctx, retval, FW_DWNL_ID, 0 , NULL, 0);
Signature · 13 lines
2.9.3

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
maintainer
#2 lore raw

Re: [PATCH v4 1/4] ASoC: intel: atom: Add debug information related to FW version

Quoted 1 line · Sebastien Guiriec

This patch is adding debug information related to SST FW version.

This doesn't apply against current code, please check and resend.

#3 lore raw

Re: [PATCH v4 1/4] ASoC: intel: atom: Add debug information related to FW version

Hi Mark,

It seems that you already put v1 single patch inside your topic/intel branch

6a7f5e4 ASoC: Intel: atom: Add debug information related to FW version ca590c1 ASoC: Intel: Skylake: Use DPIB to update position for Playback stream c8eabf8 ASoC: Intel: Skylake: Fix a shift wrapping bug
d5bc18c ASoC: intel: broadwell: constify snd_soc_ops structures 89c03dd ASoC: sst-bxt-da7219_max98357a: fix obsoleted initializer for array a31b466 ASoC: Intel: report JACK_LINEOUT event
1001354 Linux 4.9-rc1

So whereas you just skip patch 0001 and aplly the next 3 to add the sysfs or I can send update without the first patch.

What is you prefer option?

Quoted 5 lines · Mark Brown
Quoted 1 line · Sebastien Guiriec

This patch is adding debug information related to SST FW version.

This doesn't apply against current code, please check and resend.

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company) Registered headquarters: "Les Montalets"- 2, rue de Paris, 92196 Meudon Cedex, France Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

maintainer
#4 lore raw

Re: [PATCH v4 1/4] ASoC: intel: atom: Add debug information related to FW version

Quoted 1 line · Sebastien Guiriec

Hi Mark,

Please don't top post, reply in line with needed context. This allows readers to readily follow the flow of conversation and understand what you are talking about and also helps ensure that everything in the discussion is being addressed.

Quoted 4 lines

So whereas you just skip patch 0001 and aplly the next 3 to add the sysfs or I can send update without the first patch.

What is you prefer option?

Quoted 1 line · As I
Quoted 1 line

This doesn't apply against current code, please check and resend.

please resend with patches that apply against current code.

#5 lore raw

PATCH v4 2/4 ASoC: Intel: atom: save FW version

In reply to Sebastien Guiriec

After the boot of the SST FW the firmware version is send back to the driver. This patch is saving the FW version inside the driver.

---
 sound/soc/intel/atom/sst/sst.h     | 1 +
 sound/soc/intel/atom/sst/sst_ipc.c | 5 +++++
 2 files changed, 6 insertions(+)
sound/soc/intel/atom/sst/sst.h +1 -0
index 3f49386..5c9a51cc 100644
@@ -436,6 +436,7 @@ struct intel_sst_drv {
 	 */
 	char firmware_name[FW_NAME_SIZE];
 
+	struct snd_sst_fw_version fw_version;
 	struct sst_fw_save	*fw_save;
 };
 
sound/soc/intel/atom/sst/sst_ipc.c +5 -0
index 92ffeaa..8e88211 100644
@@ -240,6 +240,11 @@ static void process_fw_init(struct intel_sst_drv *sst_drv_ctx,
 			init->fw_version.type, init->fw_version.major,
 			init->fw_version.minor, init->fw_version.build);
 
+	/* Save FW version */
+	sst_drv_ctx->fw_version.type = init->fw_version.type;
+	sst_drv_ctx->fw_version.major = init->fw_version.major;
+	sst_drv_ctx->fw_version.minor = init->fw_version.minor;
+	sst_drv_ctx->fw_version.build = init->fw_version.build;
 ret:
 	sst_wake_up_block(sst_drv_ctx, retval, FW_DWNL_ID, 0 , NULL, 0);
 }
Signature · 13 lines
2.9.3

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#6 lore raw

PATCH v4 3/4 ASoC: Intel: atom: Add sysfs entry in order to store FW version

In reply to Sebastien Guiriec

This patch is adding a sysfs entry in order to be able to get access to SST FW version.

---
 sound/soc/intel/atom/sst/sst.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
sound/soc/intel/atom/sst/sst.c +39 -0
index a4b458e..9d35706 100644
@@ -27,6 +27,7 @@
 #include <linux/pm_qos.h>
 #include <linux/async.h>
 #include <linux/acpi.h>
+#include <linux/sysfs.h>
 #include <sound/core.h>
 #include <sound/soc.h>
 #include <asm/platform_sst_audio.h>
@@ -241,6 +242,32 @@ int sst_alloc_drv_context(struct intel_sst_drv **ctx,
 }
 EXPORT_SYMBOL_GPL(sst_alloc_drv_context);
 
+static ssize_t firmware_version_show(struct device *dev,
+			    struct device_attribute *attr, char *buf)
+{
+	struct intel_sst_drv *ctx = dev_get_drvdata(dev);
+
+	if (ctx->fw_version.type == 0 && ctx->fw_version.major == 0 &&
+	    ctx->fw_version.minor == 0 && ctx->fw_version.build == 0)
+		return sprintf(buf, "FW not yet loaded\n");
+	else
+		return sprintf(buf, "v%02x.%02x.%02x.%02x\n",
+			       ctx->fw_version.type, ctx->fw_version.major,
+			       ctx->fw_version.minor, ctx->fw_version.build);
+
+}
+
+DEVICE_ATTR_RO(firmware_version);
+
+static const struct attribute *sst_fw_version_attrs[] = {
+	&dev_attr_firmware_version.attr,
+	NULL,
+};
+
+static const struct attribute_group sst_fw_version_attr_group = {
+	.attrs = (struct attribute **)sst_fw_version_attrs,
+};
+
 int sst_context_init(struct intel_sst_drv *ctx)
 {
 	int ret = 0, i;
@@ -314,8 +341,19 @@ int sst_context_init(struct intel_sst_drv *ctx)
 		dev_err(ctx->dev, "Firmware download failed:%d\n", ret);
 		goto do_free_mem;
 	}
+
+	ret = sysfs_create_group(&ctx->dev->kobj,
+				 &sst_fw_version_attr_group);
+	if (ret) {
+		dev_err(ctx->dev,
+			"Unable to create sysfs\n");
+		goto err_sysfs;
+	}
+
 	sst_register(ctx->dev);
 	return 0;
+err_sysfs:
+	sysfs_remove_group(&ctx->dev->kobj, &sst_fw_version_attr_group);
 
 do_free_mem:
 	destroy_workqueue(ctx->post_msg_wq);
@@ -329,6 +367,7 @@ void sst_context_cleanup(struct intel_sst_drv *ctx)
 	pm_runtime_disable(ctx->dev);
 	sst_unregister(ctx->dev);
 	sst_set_fw_state_locked(ctx, SST_SHUTDOWN);
+	sysfs_remove_group(&ctx->dev->kobj, &sst_fw_version_attr_group);
 	flush_scheduled_work();
 	destroy_workqueue(ctx->post_msg_wq);
 	pm_qos_remove_request(ctx->qos);
Signature · 13 lines
2.9.3

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#7 lore raw

PATCH v4 4/4 Documentation: ABI: Add ASoC Intel SST Atom sysfs description

In reply to Sebastien Guiriec

For ASoC Intel SST Atom based devices a sysfs entry is created in order to track FW version. The FW version is useful in order to check the different Version of LPE DSP FW across Intel SoCs.

---
 Documentation/ABI/testing/sysfs-platform-sst-atom | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-platform-sst-atom
Documentation/ABI/testing/sysfs-platform-sst-atom new file +18 -0
new file mode 100644
index 0000000..abb131e
@@ -0,0 +1,18 @@
+What:		/sys/devices/platform/8086%x:00/firmware_version
+Date:		November 2016
+KernelVersion:	4.10
+Contact:	"Sebastien Guiriec" <[email protected]>
+Description:
+		LPE Firmware version for SST driver on all atom
+		plaforms (BYT/CHT/Merrifield/BSW).
+		If the FW has never been loaded it will display:
+			"FW not yet loaded"
+		If FW has been loaded it will display:
+			"v01.aa.bb.cc"
+		aa: Major version is reflecting SoC version:
+			0d: BYT FW
+			0b: BSW FW
+			07: Merrifield FW
+		bb: Minor version
+		cc: Build version
+
Signature · 13 lines
2.9.3

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.