[Sound-open-firmware] [PATCH 1/2] dai: add lbm status for dai
From: Pan Xiuli xiuli.pan@linux.intel.com
Add a status to track dai lbm.
Signed-off-by: Pan Xiuli xiuli.pan@linux.intel.com
--- Work with patch set: SOF-Kernel: ASoC: SOF: Add debug_mode flag in sof dev ASoC: SOF: debug: add debugmode debugfs for sof_dev debug_mode ASoC: SOF: uapi: topology: Add SOF_TKN_DAI_LBM for ssp loopback mode ASoC: SOF: uapi: ipc: Add lbm in sof_ipc_dai_config ASoC: SOF: topology: Add topology handler for dai config loopback mode ASoC: SOF: add headers for lbm control callback functions ASoC: SOF: add lbm kcontrol callback functions ASoC: SOF: topology: add SSP lbm kcontrol switch create function SOF: dai: add lbm status for dai ipc: dai: add loopback mode handler for dai SOF-Tools: topology: Add SOF_TKN_DAI_LBM for ssp loopback mode topology: m4: Add option for loopback mode in DAI config topology: test: Add loopback topology
test & santity test with: Mininow max rt5651 and UP2 Hifiberry PRO and CNL nocodec SOF master: 792bd414ee5629f72b1e24619510d6936eac28ce SOF-Tool master: bd7dc88231f31d385340310cef467f211a739eeb https://github.com/plbossart/sound/tree/topic/sof-v4.14: 1e0f50565669815dd7daa19021b3b04a90487431
--- src/include/sof/dai.h | 1 + 1 file changed, 1 insertion(+)
diff --git a/src/include/sof/dai.h b/src/include/sof/dai.h index e3bce1d..8f4c69e 100644 --- a/src/include/sof/dai.h +++ b/src/include/sof/dai.h @@ -98,6 +98,7 @@ struct dai_plat_data { struct dai { uint32_t type; uint32_t index; + uint32_t lbm; struct dai_plat_data plat_data; const struct dai_ops *ops; void *private;
From: Pan Xiuli xiuli.pan@linux.intel.com
Add a handler function for dai lbm status track and lbm ssp driver function caller.
Signed-off-by: Pan Xiuli xiuli.pan@linux.intel.com
--- Work with patch set: SOF-Kernel: ASoC: SOF: Add debug_mode flag in sof dev ASoC: SOF: debug: add debugmode debugfs for sof_dev debug_mode ASoC: SOF: uapi: topology: Add SOF_TKN_DAI_LBM for ssp loopback mode ASoC: SOF: uapi: ipc: Add lbm in sof_ipc_dai_config ASoC: SOF: topology: Add topology handler for dai config loopback mode ASoC: SOF: add headers for lbm control callback functions ASoC: SOF: add lbm kcontrol callback functions ASoC: SOF: topology: add SSP lbm kcontrol switch create function SOF: dai: add lbm status for dai ipc: dai: add loopback mode handler for dai SOF-Tools: topology: Add SOF_TKN_DAI_LBM for ssp loopback mode topology: m4: Add option for loopback mode in DAI config topology: test: Add loopback topology
test & santity test with: Mininow max rt5651 and UP2 Hifiberry PRO and CNL nocodec SOF master: 792bd414ee5629f72b1e24619510d6936eac28ce SOF-Tool master: bd7dc88231f31d385340310cef467f211a739eeb https://github.com/plbossart/sound/tree/topic/sof-v4.14: 1e0f50565669815dd7daa19021b3b04a90487431
--- src/ipc/handler.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/src/ipc/handler.c b/src/ipc/handler.c index 581ce9e..0569d7d 100644 --- a/src/ipc/handler.c +++ b/src/ipc/handler.c @@ -405,6 +405,39 @@ static int ipc_dai_config(uint32_t header) return ipc_comp_dai_config(_ipc, config); }
+static int ipc_dai_lbm_cmd(uint32_t header) +{ + struct sof_ipc_ctrl_data *cdata = _ipc->comp_data; + struct dai *dai; + + trace_ipc("Dlc"); + + /* get DAI */ + dai = dai_get(SOF_DAI_INTEL_SSP, cdata->comp_id); + if (dai == NULL) { + trace_ipc_error("eDl"); + trace_error_value(cdata->comp_id); + return -ENODEV; + } + + switch (cdata->type) { + case SOF_CTRL_TYPE_VALUE_COMP_SET: + dai_set_loopback_mode(dai, cdata->compv[0].uvalue); + dai->lbm = cdata->compv[0].uvalue; + break; + case SOF_CTRL_TYPE_VALUE_COMP_GET: + cdata->compv[0].uvalue = dai->lbm; + break; + default: + trace_ipc_error("eDt"); + trace_error_value(cdata->type); + return -EINVAL; + } + + mailbox_hostbox_write(0, cdata, cdata->rhdr.hdr.size); + return 1; +} + static int ipc_glb_dai_message(uint32_t header) { uint32_t cmd = (header & SOF_CMD_TYPE_MASK) >> SOF_CMD_TYPE_SHIFT; @@ -413,7 +446,7 @@ static int ipc_glb_dai_message(uint32_t header) case iCS(SOF_IPC_DAI_CONFIG): return ipc_dai_config(header); case iCS(SOF_IPC_DAI_LOOPBACK): - //return ipc_comp_set_value(header, COMP_CMD_LOOPBACK); + return ipc_dai_lbm_cmd(header); default: trace_ipc_error("eDc"); trace_error_value(header);
On 6/13/18 4:24 AM, Xiuli Pan wrote:
From: Pan Xiuli xiuli.pan@linux.intel.com
Add a handler function for dai lbm status track and lbm ssp driver function caller.
Signed-off-by: Pan Xiuli xiuli.pan@linux.intel.com
Work with patch set: SOF-Kernel: ASoC: SOF: Add debug_mode flag in sof dev ASoC: SOF: debug: add debugmode debugfs for sof_dev debug_mode ASoC: SOF: uapi: topology: Add SOF_TKN_DAI_LBM for ssp loopback mode ASoC: SOF: uapi: ipc: Add lbm in sof_ipc_dai_config ASoC: SOF: topology: Add topology handler for dai config loopback mode ASoC: SOF: add headers for lbm control callback functions ASoC: SOF: add lbm kcontrol callback functions ASoC: SOF: topology: add SSP lbm kcontrol switch create function SOF: dai: add lbm status for dai ipc: dai: add loopback mode handler for dai SOF-Tools: topology: Add SOF_TKN_DAI_LBM for ssp loopback mode topology: m4: Add option for loopback mode in DAI config topology: test: Add loopback topology
test & santity test with: Mininow max rt5651 and UP2 Hifiberry PRO and CNL nocodec SOF master: 792bd414ee5629f72b1e24619510d6936eac28ce SOF-Tool master: bd7dc88231f31d385340310cef467f211a739eeb https://github.com/plbossart/sound/tree/topic/sof-v4.14: 1e0f50565669815dd7daa19021b3b04a90487431
src/ipc/handler.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/src/ipc/handler.c b/src/ipc/handler.c index 581ce9e..0569d7d 100644 --- a/src/ipc/handler.c +++ b/src/ipc/handler.c @@ -405,6 +405,39 @@ static int ipc_dai_config(uint32_t header) return ipc_comp_dai_config(_ipc, config); }
+static int ipc_dai_lbm_cmd(uint32_t header) +{
- struct sof_ipc_ctrl_data *cdata = _ipc->comp_data;
- struct dai *dai;
- trace_ipc("Dlc");
- /* get DAI */
- dai = dai_get(SOF_DAI_INTEL_SSP, cdata->comp_id);
that's also another sign that this isn't a generic command at all?
- if (dai == NULL) {
trace_ipc_error("eDl");
trace_error_value(cdata->comp_id);
return -ENODEV;
- }
- switch (cdata->type) {
- case SOF_CTRL_TYPE_VALUE_COMP_SET:
dai_set_loopback_mode(dai, cdata->compv[0].uvalue);
dai->lbm = cdata->compv[0].uvalue;
break;
- case SOF_CTRL_TYPE_VALUE_COMP_GET:
cdata->compv[0].uvalue = dai->lbm;
break;
- default:
trace_ipc_error("eDt");
trace_error_value(cdata->type);
return -EINVAL;
- }
- mailbox_hostbox_write(0, cdata, cdata->rhdr.hdr.size);
- return 1;
+}
- static int ipc_glb_dai_message(uint32_t header) { uint32_t cmd = (header & SOF_CMD_TYPE_MASK) >> SOF_CMD_TYPE_SHIFT;
@@ -413,7 +446,7 @@ static int ipc_glb_dai_message(uint32_t header) case iCS(SOF_IPC_DAI_CONFIG): return ipc_dai_config(header); case iCS(SOF_IPC_DAI_LOOPBACK):
//return ipc_comp_set_value(header, COMP_CMD_LOOPBACK);
default: trace_ipc_error("eDc"); trace_error_value(header);return ipc_dai_lbm_cmd(header);
On Wed, 2018-06-13 at 17:24 +0800, Xiuli Pan wrote:
From: Pan Xiuli xiuli.pan@linux.intel.com
Add a handler function for dai lbm status track and lbm ssp driver function caller.
Signed-off-by: Pan Xiuli xiuli.pan@linux.intel.com
Work with patch set: SOF-Kernel: ASoC: SOF: Add debug_mode flag in sof dev ASoC: SOF: debug: add debugmode debugfs for sof_dev debug_mode ASoC: SOF: uapi: topology: Add SOF_TKN_DAI_LBM for ssp loopback mode ASoC: SOF: uapi: ipc: Add lbm in sof_ipc_dai_config ASoC: SOF: topology: Add topology handler for dai config loopback mode ASoC: SOF: add headers for lbm control callback functions ASoC: SOF: add lbm kcontrol callback functions ASoC: SOF: topology: add SSP lbm kcontrol switch create function SOF: dai: add lbm status for dai ipc: dai: add loopback mode handler for dai SOF-Tools: topology: Add SOF_TKN_DAI_LBM for ssp loopback mode topology: m4: Add option for loopback mode in DAI config topology: test: Add loopback topology
test & santity test with: Mininow max rt5651 and UP2 Hifiberry PRO and CNL nocodec SOF master: 792bd414ee5629f72b1e24619510d6936eac28ce SOF-Tool master: bd7dc88231f31d385340310cef467f211a739eeb https://github.com/plbossart/sound/tree/topic/sof-v4.14: 1e0f50565669815dd7daa19021b3b04a90487431
src/ipc/handler.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/src/ipc/handler.c b/src/ipc/handler.c index 581ce9e..0569d7d 100644 --- a/src/ipc/handler.c +++ b/src/ipc/handler.c @@ -405,6 +405,39 @@ static int ipc_dai_config(uint32_t header) return ipc_comp_dai_config(_ipc, config); }
+static int ipc_dai_lbm_cmd(uint32_t header) +{
- struct sof_ipc_ctrl_data *cdata = _ipc->comp_data;
- struct dai *dai;
- trace_ipc("Dlc");
- /* get DAI */
- dai = dai_get(SOF_DAI_INTEL_SSP, cdata->comp_id);
- if (dai == NULL) {
trace_ipc_error("eDl");
trace_error_value(cdata->comp_id);
return -ENODEV;
- }
- switch (cdata->type) {
- case SOF_CTRL_TYPE_VALUE_COMP_SET:
dai_set_loopback_mode(dai, cdata->compv[0].uvalue);
dai->lbm = cdata->compv[0].uvalue;
break;
- case SOF_CTRL_TYPE_VALUE_COMP_GET:
cdata->compv[0].uvalue = dai->lbm;
break;
- default:
trace_ipc_error("eDt");
trace_error_value(cdata->type);
return -EINVAL;
- }
Lets remove dai_set_loopback_mode() and just use the set_cmd() callback otherwise we encourage adhoc API extensions with no value.
Liam
- mailbox_hostbox_write(0, cdata, cdata->rhdr.hdr.size);
- return 1;
+}
static int ipc_glb_dai_message(uint32_t header) { uint32_t cmd = (header & SOF_CMD_TYPE_MASK) >> SOF_CMD_TYPE_SHIFT; @@ -413,7 +446,7 @@ static int ipc_glb_dai_message(uint32_t header) case iCS(SOF_IPC_DAI_CONFIG): return ipc_dai_config(header); case iCS(SOF_IPC_DAI_LOOPBACK):
//return ipc_comp_set_value(header, COMP_CMD_LOOPBACK);
default: trace_ipc_error("eDc"); trace_error_value(header);return ipc_dai_lbm_cmd(header);
On 6/14/2018 02:55, Liam Girdwood wrote:
On Wed, 2018-06-13 at 17:24 +0800, Xiuli Pan wrote:
From: Pan Xiuli xiuli.pan@linux.intel.com
Add a handler function for dai lbm status track and lbm ssp driver function caller.
Signed-off-by: Pan Xiuli xiuli.pan@linux.intel.com
Work with patch set: SOF-Kernel: ASoC: SOF: Add debug_mode flag in sof dev ASoC: SOF: debug: add debugmode debugfs for sof_dev debug_mode ASoC: SOF: uapi: topology: Add SOF_TKN_DAI_LBM for ssp loopback mode ASoC: SOF: uapi: ipc: Add lbm in sof_ipc_dai_config ASoC: SOF: topology: Add topology handler for dai config loopback mode ASoC: SOF: add headers for lbm control callback functions ASoC: SOF: add lbm kcontrol callback functions ASoC: SOF: topology: add SSP lbm kcontrol switch create function SOF: dai: add lbm status for dai ipc: dai: add loopback mode handler for dai SOF-Tools: topology: Add SOF_TKN_DAI_LBM for ssp loopback mode topology: m4: Add option for loopback mode in DAI config topology: test: Add loopback topology
test & santity test with: Mininow max rt5651 and UP2 Hifiberry PRO and CNL nocodec SOF master: 792bd414ee5629f72b1e24619510d6936eac28ce SOF-Tool master: bd7dc88231f31d385340310cef467f211a739eeb https://github.com/plbossart/sound/tree/topic/sof-v4.14: 1e0f50565669815dd7daa19021b3b04a90487431
src/ipc/handler.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/src/ipc/handler.c b/src/ipc/handler.c index 581ce9e..0569d7d 100644 --- a/src/ipc/handler.c +++ b/src/ipc/handler.c @@ -405,6 +405,39 @@ static int ipc_dai_config(uint32_t header) return ipc_comp_dai_config(_ipc, config); }
+static int ipc_dai_lbm_cmd(uint32_t header) +{
- struct sof_ipc_ctrl_data *cdata = _ipc->comp_data;
- struct dai *dai;
- trace_ipc("Dlc");
- /* get DAI */
- dai = dai_get(SOF_DAI_INTEL_SSP, cdata->comp_id);
- if (dai == NULL) {
trace_ipc_error("eDl");
trace_error_value(cdata->comp_id);
return -ENODEV;
- }
- switch (cdata->type) {
- case SOF_CTRL_TYPE_VALUE_COMP_SET:
dai_set_loopback_mode(dai, cdata->compv[0].uvalue);
dai->lbm = cdata->compv[0].uvalue;
break;
- case SOF_CTRL_TYPE_VALUE_COMP_GET:
cdata->compv[0].uvalue = dai->lbm;
break;
- default:
trace_ipc_error("eDt");
trace_error_value(cdata->type);
return -EINVAL;
- }
Lets remove dai_set_loopback_mode() and just use the set_cmd() callback otherwise we encourage adhoc API extensions with no value.
I would like to reuse the comp_cmd callbacks, but we need to set with ssp which is bind to some DAI COMP. And we will have two DAI share the same SSP. What would you suggest to bind the SSP with? The token is now bind with SectionBE, and do you suggest to use some other widget for a token?
Thanks Xiuli
Liam
- mailbox_hostbox_write(0, cdata, cdata->rhdr.hdr.size);
- return 1;
+}
- static int ipc_glb_dai_message(uint32_t header) { uint32_t cmd = (header & SOF_CMD_TYPE_MASK) >> SOF_CMD_TYPE_SHIFT;
@@ -413,7 +446,7 @@ static int ipc_glb_dai_message(uint32_t header) case iCS(SOF_IPC_DAI_CONFIG): return ipc_dai_config(header); case iCS(SOF_IPC_DAI_LOOPBACK):
//return ipc_comp_set_value(header, COMP_CMD_LOOPBACK);
default: trace_ipc_error("eDc"); trace_error_value(header);return ipc_dai_lbm_cmd(header);
Sound-open-firmware mailing list Sound-open-firmware@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/sound-open-firmware
On Thu, 2018-06-14 at 04:59 +0800, Pan, Xiuli wrote:
Lets remove dai_set_loopback_mode() and just use the set_cmd() callback otherwise we encourage adhoc API extensions with no value.
I would like to reuse the comp_cmd callbacks, but we need to set with ssp which is bind to some DAI COMP. And we will have two DAI share the same SSP. What would you suggest to bind the SSP with? The token is now bind with SectionBE, and do you suggest to use some other widget for a token?
You should just send the cmd to the playback DAI since we loopback the playback into the capture.
Liam
On Wed, 2018-06-13 at 17:24 +0800, Xiuli Pan wrote:
From: Pan Xiuli xiuli.pan@linux.intel.com
Add a status to track dai lbm.
Signed-off-by: Pan Xiuli xiuli.pan@linux.intel.com
Work with patch set: SOF-Kernel: ASoC: SOF: Add debug_mode flag in sof dev ASoC: SOF: debug: add debugmode debugfs for sof_dev debug_mode ASoC: SOF: uapi: topology: Add SOF_TKN_DAI_LBM for ssp loopback mode ASoC: SOF: uapi: ipc: Add lbm in sof_ipc_dai_config ASoC: SOF: topology: Add topology handler for dai config loopback mode ASoC: SOF: add headers for lbm control callback functions ASoC: SOF: add lbm kcontrol callback functions ASoC: SOF: topology: add SSP lbm kcontrol switch create function SOF: dai: add lbm status for dai ipc: dai: add loopback mode handler for dai SOF-Tools: topology: Add SOF_TKN_DAI_LBM for ssp loopback mode topology: m4: Add option for loopback mode in DAI config topology: test: Add loopback topology
test & santity test with: Mininow max rt5651 and UP2 Hifiberry PRO and CNL nocodec SOF master: 792bd414ee5629f72b1e24619510d6936eac28ce SOF-Tool master: bd7dc88231f31d385340310cef467f211a739eeb https://github.com/plbossart/sound/tree/topic/sof-v4.14: 1e0f50565669815dd7daa19021b3b04a90487431
src/include/sof/dai.h | 1 + 1 file changed, 1 insertion(+)
diff --git a/src/include/sof/dai.h b/src/include/sof/dai.h index e3bce1d..8f4c69e 100644 --- a/src/include/sof/dai.h +++ b/src/include/sof/dai.h @@ -98,6 +98,7 @@ struct dai_plat_data { struct dai { uint32_t type; uint32_t index;
- uint32_t lbm;
This is platform data and this should not store runtime status. What is lbm and what is it use for, please rename it with more meaningful name.
struct dai_plat_data plat_data; const struct dai_ops *ops; void *private;
On 6/14/2018 02:53, Liam Girdwood wrote:
On Wed, 2018-06-13 at 17:24 +0800, Xiuli Pan wrote:
From: Pan Xiuli xiuli.pan@linux.intel.com
Add a status to track dai lbm.
Signed-off-by: Pan Xiuli xiuli.pan@linux.intel.com
Work with patch set: SOF-Kernel: ASoC: SOF: Add debug_mode flag in sof dev ASoC: SOF: debug: add debugmode debugfs for sof_dev debug_mode ASoC: SOF: uapi: topology: Add SOF_TKN_DAI_LBM for ssp loopback mode ASoC: SOF: uapi: ipc: Add lbm in sof_ipc_dai_config ASoC: SOF: topology: Add topology handler for dai config loopback mode ASoC: SOF: add headers for lbm control callback functions ASoC: SOF: add lbm kcontrol callback functions ASoC: SOF: topology: add SSP lbm kcontrol switch create function SOF: dai: add lbm status for dai ipc: dai: add loopback mode handler for dai SOF-Tools: topology: Add SOF_TKN_DAI_LBM for ssp loopback mode topology: m4: Add option for loopback mode in DAI config topology: test: Add loopback topology
test & santity test with: Mininow max rt5651 and UP2 Hifiberry PRO and CNL nocodec SOF master: 792bd414ee5629f72b1e24619510d6936eac28ce SOF-Tool master: bd7dc88231f31d385340310cef467f211a739eeb https://github.com/plbossart/sound/tree/topic/sof-v4.14: 1e0f50565669815dd7daa19021b3b04a90487431
src/include/sof/dai.h | 1 + 1 file changed, 1 insertion(+)
diff --git a/src/include/sof/dai.h b/src/include/sof/dai.h index e3bce1d..8f4c69e 100644 --- a/src/include/sof/dai.h +++ b/src/include/sof/dai.h @@ -98,6 +98,7 @@ struct dai_plat_data { struct dai { uint32_t type; uint32_t index;
- uint32_t lbm;
This is platform data and this should not store runtime status. What is lbm and what is it use for, please rename it with more meaningful name.
Then the status should go to private data? Will rename it and send a V2.
Thanks Xiuli
struct dai_plat_data plat_data; const struct dai_ops *ops; void *private;
Sound-open-firmware mailing list Sound-open-firmware@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/sound-open-firmware
On Thu, 2018-06-14 at 04:54 +0800, Pan, Xiuli wrote:
This is platform data and this should not store runtime status. What is lbm and what is it use for, please rename it with more meaningful name.
Then the status should go to private data? Will rename it and send a V2.
Yes, this status should be part of the component private data and not the platform data.
Liam
participants (4)
-
Liam Girdwood
-
Pan, Xiuli
-
Pierre-Louis Bossart
-
Xiuli Pan