From: "Patel, Chintan M" <chintan.m.patel@intel.com> To: "Periyasamy, SriramX" <sriramx.periyasamy@intel.com>, ALSA ML <alsa-devel@alsa-project.org>, Mark Brown <broonie@kernel.org> Cc: Takashi Iwai <tiwai@suse.de>, "Periyasamy, SriramX" <sriramx.periyasamy@intel.com>, "mturquette@baylibre.com" <mturquette@baylibre.com>, "sboyd@codeaurora.org" <sboyd@codeaurora.org>, Patches Audio <patches.audio@intel.com>, Liam Girdwood <liam.r.girdwood@linux.intel.com>, "Koul, Vinod" <vinod.koul@intel.com>, "Prusty, Subhransu S" <subhransu.s.prusty@intel.com>, "linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org> Subject: RE: [alsa-devel] [PATCH v5 5/6] ASoC: Intel: Skylake: Make DSP replies more human readable Date: Tue, 12 Dec 2017 18:27:07 +0000 [thread overview] Message-ID: <074180B186AC2945B61C466FE6C478304ADE8101@ORSMSX103.amr.corp.intel.com> (raw) In-Reply-To: <1512978390-8848-6-git-send-email-sriramx.periyasamy@intel.com> I would also suggest to make similar changes for FW error code, since it do= esn't give any clue what does FW error code indicates. -----Original Message----- From: alsa-devel-bounces@alsa-project.org [mailto:alsa-devel-bounces@alsa-p= roject.org] On Behalf Of Sriram Periyasamy Sent: Sunday, December 10, 2017 11:46 PM To: ALSA ML <alsa-devel@alsa-project.org>; Mark Brown <broonie@kernel.org> Cc: Takashi Iwai <tiwai@suse.de>; Periyasamy, SriramX <sriramx.periyasamy@i= ntel.com>; mturquette@baylibre.com; sboyd@codeaurora.org; Patches Audio <pa= tches.audio@intel.com>; Liam Girdwood <liam.r.girdwood@linux.intel.com>; Ko= ul, Vinod <vinod.koul@intel.com>; Prusty, Subhransu S <subhransu.s.prusty@i= ntel.com>; linux-clk@vger.kernel.org Subject: [alsa-devel] [PATCH v5 5/6] ASoC: Intel: Skylake: Make DSP replies= more human readable From: "Subhransu S. Prusty" <subhransu.s.prusty@intel.com> Add more meaning to the IPC replies for easy debugging. Replace the switch = case with a lookup table to lookup for the IPC replies and print in human r= eadable form. Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Sriram Periyasamy <sriramx.periyasamy@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> --- sound/soc/intel/skylake/skl-sst-ipc.c | 44 ++++++++++++++++++++++++++-----= ---- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/sound/soc/intel/skylake/skl-sst-ipc.c b/sound/soc/intel/skylak= e/skl-sst-ipc.c index 5234fafb758a..8708755a8f9a 100644 --- a/sound/soc/intel/skylake/skl-sst-ipc.c +++ b/sound/soc/intel/skylake/skl-sst-ipc.c @@ -392,18 +392,43 @@ int skl_ipc_process_notification(struct sst_generic_i= pc *ipc, return 0; } =20 -static int skl_ipc_set_reply_error_code(u32 reply) +struct skl_ipc_err_map { + const char *msg; + enum skl_ipc_glb_reply reply; + int err; +}; + +static struct skl_ipc_err_map skl_err_map[] =3D { + {"DSP out of memory", IPC_GLB_REPLY_OUT_OF_MEMORY, -ENOMEM}, + {"DSP busy", IPC_GLB_REPLY_BUSY, -EBUSY}, }; + +static int skl_ipc_set_reply_error_code(struct sst_generic_ipc *ipc,=20 +u32 reply) { - switch (reply) { - case IPC_GLB_REPLY_OUT_OF_MEMORY: - return -ENOMEM; + int i; =20 - case IPC_GLB_REPLY_BUSY: - return -EBUSY; + for (i =3D 0; i < ARRAY_SIZE(skl_err_map); i++) { + if (skl_err_map[i].reply =3D=3D reply) + break; + } =20 - default: + if (i =3D=3D ARRAY_SIZE(skl_err_map)) { + dev_err(ipc->dev, "ipc FW reply: %d FW Error Code: %u\n", + reply, + ipc->dsp->fw_ops.get_fw_errcode(ipc->dsp)); return -EINVAL; } + + if (skl_err_map[i].err < 0) + dev_err(ipc->dev, "ipc FW reply: %s FW Error Code: %u\n", + skl_err_map[i].msg, + ipc->dsp->fw_ops.get_fw_errcode(ipc->dsp)); + else + dev_info(ipc->dev, "ipc FW reply: %s FW Error Code: %u\n", + skl_err_map[i].msg, + ipc->dsp->fw_ops.get_fw_errcode(ipc->dsp)); + + return skl_err_map[i].err; } =20 void skl_ipc_process_reply(struct sst_generic_ipc *ipc, @@ -441,10 +466,7 = @@ void skl_ipc_process_reply(struct sst_generic_ipc *ipc, =20 } } else { - msg->errno =3D skl_ipc_set_reply_error_code(reply); - dev_err(ipc->dev, "ipc FW reply: reply=3D%d\n", reply); - dev_err(ipc->dev, "FW Error Code: %u\n", - ipc->dsp->fw_ops.get_fw_errcode(ipc->dsp)); + msg->errno =3D skl_ipc_set_reply_error_code(ipc, reply); switch (IPC_GLB_NOTIFY_MSG_TYPE(header.primary)) { case IPC_GLB_LOAD_MULTIPLE_MODS: case IPC_GLB_LOAD_LIBRARY: -- 2.7.4 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
WARNING: multiple messages have this Message-ID (diff)
From: "Patel, Chintan M" <chintan.m.patel@intel.com> To: ALSA ML <alsa-devel@alsa-project.org>, Mark Brown <broonie@kernel.org> Cc: Takashi Iwai <tiwai@suse.de>, "Periyasamy, SriramX" <sriramx.periyasamy@intel.com>, "mturquette@baylibre.com" <mturquette@baylibre.com>, "sboyd@codeaurora.org" <sboyd@codeaurora.org>, Patches Audio <patches.audio@intel.com>, Liam Girdwood <liam.r.girdwood@linux.intel.com>, "Koul, Vinod" <vinod.koul@intel.com>, "Prusty, Subhransu S" <subhransu.s.prusty@intel.com>, "linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org> Subject: RE: [alsa-devel] [PATCH v5 5/6] ASoC: Intel: Skylake: Make DSP replies more human readable Date: Tue, 12 Dec 2017 18:27:07 +0000 [thread overview] Message-ID: <074180B186AC2945B61C466FE6C478304ADE8101@ORSMSX103.amr.corp.intel.com> (raw) In-Reply-To: <1512978390-8848-6-git-send-email-sriramx.periyasamy@intel.com> I would also suggest to make similar changes for FW error code, since it doesn't give any clue what does FW error code indicates. -----Original Message----- From: alsa-devel-bounces@alsa-project.org [mailto:alsa-devel-bounces@alsa-project.org] On Behalf Of Sriram Periyasamy Sent: Sunday, December 10, 2017 11:46 PM To: ALSA ML <alsa-devel@alsa-project.org>; Mark Brown <broonie@kernel.org> Cc: Takashi Iwai <tiwai@suse.de>; Periyasamy, SriramX <sriramx.periyasamy@intel.com>; mturquette@baylibre.com; sboyd@codeaurora.org; Patches Audio <patches.audio@intel.com>; Liam Girdwood <liam.r.girdwood@linux.intel.com>; Koul, Vinod <vinod.koul@intel.com>; Prusty, Subhransu S <subhransu.s.prusty@intel.com>; linux-clk@vger.kernel.org Subject: [alsa-devel] [PATCH v5 5/6] ASoC: Intel: Skylake: Make DSP replies more human readable From: "Subhransu S. Prusty" <subhransu.s.prusty@intel.com> Add more meaning to the IPC replies for easy debugging. Replace the switch case with a lookup table to lookup for the IPC replies and print in human readable form. Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Sriram Periyasamy <sriramx.periyasamy@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> --- sound/soc/intel/skylake/skl-sst-ipc.c | 44 ++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/sound/soc/intel/skylake/skl-sst-ipc.c b/sound/soc/intel/skylake/skl-sst-ipc.c index 5234fafb758a..8708755a8f9a 100644 --- a/sound/soc/intel/skylake/skl-sst-ipc.c +++ b/sound/soc/intel/skylake/skl-sst-ipc.c @@ -392,18 +392,43 @@ int skl_ipc_process_notification(struct sst_generic_ipc *ipc, return 0; } -static int skl_ipc_set_reply_error_code(u32 reply) +struct skl_ipc_err_map { + const char *msg; + enum skl_ipc_glb_reply reply; + int err; +}; + +static struct skl_ipc_err_map skl_err_map[] = { + {"DSP out of memory", IPC_GLB_REPLY_OUT_OF_MEMORY, -ENOMEM}, + {"DSP busy", IPC_GLB_REPLY_BUSY, -EBUSY}, }; + +static int skl_ipc_set_reply_error_code(struct sst_generic_ipc *ipc, +u32 reply) { - switch (reply) { - case IPC_GLB_REPLY_OUT_OF_MEMORY: - return -ENOMEM; + int i; - case IPC_GLB_REPLY_BUSY: - return -EBUSY; + for (i = 0; i < ARRAY_SIZE(skl_err_map); i++) { + if (skl_err_map[i].reply == reply) + break; + } - default: + if (i == ARRAY_SIZE(skl_err_map)) { + dev_err(ipc->dev, "ipc FW reply: %d FW Error Code: %u\n", + reply, + ipc->dsp->fw_ops.get_fw_errcode(ipc->dsp)); return -EINVAL; } + + if (skl_err_map[i].err < 0) + dev_err(ipc->dev, "ipc FW reply: %s FW Error Code: %u\n", + skl_err_map[i].msg, + ipc->dsp->fw_ops.get_fw_errcode(ipc->dsp)); + else + dev_info(ipc->dev, "ipc FW reply: %s FW Error Code: %u\n", + skl_err_map[i].msg, + ipc->dsp->fw_ops.get_fw_errcode(ipc->dsp)); + + return skl_err_map[i].err; } void skl_ipc_process_reply(struct sst_generic_ipc *ipc, @@ -441,10 +466,7 @@ void skl_ipc_process_reply(struct sst_generic_ipc *ipc, } } else { - msg->errno = skl_ipc_set_reply_error_code(reply); - dev_err(ipc->dev, "ipc FW reply: reply=%d\n", reply); - dev_err(ipc->dev, "FW Error Code: %u\n", - ipc->dsp->fw_ops.get_fw_errcode(ipc->dsp)); + msg->errno = skl_ipc_set_reply_error_code(ipc, reply); switch (IPC_GLB_NOTIFY_MSG_TYPE(header.primary)) { case IPC_GLB_LOAD_MULTIPLE_MODS: case IPC_GLB_LOAD_LIBRARY: -- 2.7.4 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
next prev parent reply other threads:[~2017-12-12 18:27 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-12-11 7:46 [alsa-devel] [PATCH v5 0/6] ASoC: Intel: Skylake: Add a clk driver to enable ssp clks early Sriram Periyasamy 2017-12-11 7:46 ` [alsa-devel] [PATCH v5 1/6] ASoC: Intel: Skylake: Add ssp clock driver Sriram Periyasamy 2017-12-13 22:30 ` Stephen Boyd 2017-12-18 3:57 ` Subhransu S. Prusty 2017-12-18 5:01 ` Subhransu S. Prusty 2017-12-18 19:10 ` Stephen Boyd 2017-12-19 5:41 ` Subhransu S. Prusty 2017-12-19 19:17 ` Stephen Boyd 2017-12-20 3:33 ` Subhransu S. Prusty 2017-12-22 2:04 ` Stephen Boyd 2017-12-22 4:52 ` Subhransu S. Prusty 2017-12-11 7:46 ` [alsa-devel] [PATCH v5 2/6] ASoC: Intel: Skylake: Add extended I2S config blob support in Clock driver Sriram Periyasamy 2018-01-26 12:54 ` Applied "ASoC: Intel: Skylake: Add extended I2S config blob support in Clock driver" to the asoc tree Mark Brown 2018-01-26 12:54 ` Mark Brown 2017-12-11 7:46 ` [alsa-devel] [PATCH v5 3/6] ASoC: Intel: kbl: Enable mclk and ssp sclk early Sriram Periyasamy 2018-01-26 12:53 ` Applied "ASoC: Intel: kbl: Enable mclk and ssp sclk early" to the asoc tree Mark Brown 2018-01-26 12:53 ` Mark Brown 2017-12-11 7:46 ` [alsa-devel] [PATCH v5 4/6] ASoC: Intel: eve: Enable mclk and ssp sclk early Sriram Periyasamy 2017-12-11 7:46 ` [alsa-devel] [PATCH v5 5/6] ASoC: Intel: Skylake: Make DSP replies more human readable Sriram Periyasamy 2017-12-12 18:27 ` Patel, Chintan M [this message] 2017-12-12 18:27 ` Patel, Chintan M 2017-12-13 3:25 ` Vinod Koul 2017-12-13 3:25 ` Vinod Koul 2017-12-11 7:46 ` [alsa-devel] [PATCH v5 6/6] ASoC: Intel: Skylake: Add FW reply for MCLK/SCLK IPC Sriram Periyasamy
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=074180B186AC2945B61C466FE6C478304ADE8101@ORSMSX103.amr.corp.intel.com \ --to=chintan.m.patel@intel.com \ --cc=alsa-devel@alsa-project.org \ --cc=broonie@kernel.org \ --cc=liam.r.girdwood@linux.intel.com \ --cc=linux-clk@vger.kernel.org \ --cc=mturquette@baylibre.com \ --cc=patches.audio@intel.com \ --cc=sboyd@codeaurora.org \ --cc=sriramx.periyasamy@intel.com \ --cc=subhransu.s.prusty@intel.com \ --cc=tiwai@suse.de \ --cc=vinod.koul@intel.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.