slimbus: patches for 7.4
[email protected]
maintainercover slimbus: patches for 7.4
From: Srinivas Kandagatla <[email protected]>
Hi Greg,
Here are few slimbus patches for 7.4, Could you please queue these for 7.4.
Patches include
- qcom-ngd-ctrl: implement disable_stream callback so clients can cleanly shut down a channel before switching frequency.
- qcom-ngd-ctrl: switch to platform_device_set_fwnode() and drop redundant dev_err_probe() calls around devm_request_irq().
- fix typos in comments.
Thanks,
Srini
Bartosz Golaszewski (1):
slimbus: qcom-ngd-ctrl: use platform_device_set_fwnode()
Hemanth Selam (1):
slimbus: fix typos in comments
Pan Chuang (1):
slimbus: qcom-ngd-ctrl: Remove redundant dev_err_probe()
Viken Dadhaniya (1):
slimbus: qcom-ngd-ctrl: Implement disable_stream callback
drivers/slimbus/qcom-ngd-ctrl.c | 82 ++++++++++++++++++++++++++++++++- drivers/slimbus/slimbus.h | 14 +++++- include/linux/slimbus.h | 2 +- 3 files changed, 94 insertions(+), 4 deletions(-)
Signature · 1 line
2.53.0
[email protected]
maintainerPATCH 1/4 slimbus: fix typos in comments
From: Hemanth Selam <[email protected]>
Fix typos in comments, reported by scripts/checkpatch.pl using the misspelling list in scripts/spelling.txt. Only touches comments, no code changes.
--- drivers/slimbus/slimbus.h | 2 +- include/linux/slimbus.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/slimbus/slimbus.h +1 -1
@@ -325,7 +325,7 @@ enum slim_transport_protocol {* @prot: Transport protocol used in this stream * @rate: Data rate of samples * * @bps: bits per sample -* @ratem: rate multipler which is super frame rate/data rate +* @ratem: rate multiplier which is super frame rate/data rate * @num_ports: number of ports * @ports: pointer to instance of ports * @node: list head for stream associated with slim device.
include/linux/slimbus.h +1 -1
@@ -98,7 +98,7 @@ struct slim_driver {* @start_offset: Specifies starting offset in information/value element map * @rbuf: buffer to read the values * @wbuf: buffer to write -* @num_bytes: upto 16. This ensures that the message will fit the slicesize +* @num_bytes: up to 16. This ensures that the message will fit the slicesize * per SLIMbus spec * @comp: completion for asynchronous operations, valid only if TID is * required for transaction, like REQUEST operations.
Signature · 1 line
2.53.0
[email protected]
maintainerPATCH 2/4 slimbus: qcom-ngd-ctrl: use platform_device_set_fwnode()
In reply to [email protected]From: Bartosz Golaszewski <[email protected]>
Prefer the higher-level platform_device_set_fwnode() over the OF-specific platform_device_set_of_node() for dynamically allocated platform devices.
--- drivers/slimbus/qcom-ngd-ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/slimbus/qcom-ngd-ctrl.c +1 -1
@@ -1539,7 +1539,7 @@ static int of_qcom_slim_ngd_register(struct device *parent,kfree (ngd);return ret; } -platform_device_set_of_node (ngd->pdev, node); +platform_device_set_fwnode (ngd->pdev,of_fwnode_handle (node)); ctrl->ngd = ngd; ret =platform_device_add (ngd->pdev);
Signature · 1 line
2.53.0
[email protected]
maintainerPATCH 3/4 slimbus: qcom-ngd-ctrl: Remove redundant dev_err_probe()
In reply to [email protected]From: Pan Chuang <[email protected]>
Since commit 55b48e23f5c4 ("genirq/devres: Add error handling in devm_request_*_irq()"), devm_request_irq() automatically logs detailed error messages on failure. Remove the now-redundant driver-specific dev_err_probe() calls.
--- drivers/slimbus/qcom-ngd-ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/slimbus/qcom-ngd-ctrl.c +1 -1
@@ -1614,7 +1614,7 @@ static int qcom_slim_ngd_ctrl_probe(struct platform_device *pdev)IRQF_TRIGGER_HIGH |IRQF_NO_AUTOEN , "slim-ngd", ctrl);if (ret) -return dev_err_probe (&pdev->dev, ret,"request IRQ failed\n" ); +return ret; ctrl->dev = dev; ctrl->framer.rootfreq =SLIM_ROOT_FREQ >>3 ;
Signature · 1 line
2.53.0
[email protected]
maintainerPATCH 4/4 slimbus: qcom-ngd-ctrl: Implement disable_stream callback
In reply to [email protected]From: Viken Dadhaniya <[email protected]>
Switching a channel to a new frequency without first disabling the stream causes the channel to be re-enabled without a clean shutdown, leading to a crash on the DSP subsystem.
Implement qcom_slim_ngd_disable_stream() so clients can properly close a channel before switching to a new frequency.
--- drivers/slimbus/qcom-ngd-ctrl.c | 78 +++++++++++++++++++++++++++++++++ drivers/slimbus/slimbus.h | 12 +++++ 2 files changed, 90 insertions(+)
drivers/slimbus/qcom-ngd-ctrl.c +78 -0
@@ -2,6 +2,7 @@// Copyright (c) 2011-2017, The Linux Foundation. All rights reserved. // Copyright (c) 2018, Linaro Limited +#include <linux/bitfield.h> #include <linux/irq.h> #include <linux/kernel.h> #include <linux/init.h>
@@ -87,6 +88,10 @@#define SLIM_ROOT_FREQ 24576000#define LADDR_RETRY 5 +#define SLIM_CHAN_CTRL_CMD GENMASK(7, 6) +#define SLIM_CHAN_CTRL_LADDR GENMASK(4, 0) +#define SLIM_MSG_HDR_LEN 4 +/* Per spec.max 40 bytes per received message */ #define SLIM_MSGQ_BUF_LEN 40#define QCOM_SLIM_NGD_DESC_NUM 32
@@ -1086,6 +1091,78 @@ static int qcom_slim_ngd_enable_stream(struct slim_stream_runtime *rt)return ret; } +static int qcom_slim_ngd_disable_stream (struct slim_stream_runtime *rt) +{ +struct slim_device *sdev = rt->dev; +struct slim_controller *ctrl = sdev->ctrl; +struct slim_msg_txn txn = {0 }; +struct slim_val_inf msg = {0 }; +u8 wbuf[SLIM_MSGQ_BUF_LEN ]; +u8 rbuf[SLIM_MSGQ_BUF_LEN ]; +int i, ret; + + txn.mt =SLIM_MSG_MT_DEST_REFERRED_USER ; + txn.dt =SLIM_MSG_DEST_LOGICALADDR ; + txn.la =SLIM_LA_MGR ; + txn.ec =0 ; + txn.msg = &msg; + txn.msg->num_bytes =0 ; + txn.msg->wbuf = wbuf; + txn.msg->rbuf = rbuf; + +for (i =0 ; i < rt->num_ports; i++) { +struct slim_port *port = &rt->ports[i]; + +if (txn.msg->num_bytes ==0 ) { + wbuf[txn.msg->num_bytes++] = +FIELD_PREP (SLIM_CHAN_CTRL_CMD ,SLIM_CH_REMOVE ) | +FIELD_PREP (SLIM_CHAN_CTRL_LADDR , sdev->laddr); + + ret =slim_alloc_txn_tid (ctrl, &txn); +if (ret) { +dev_err (&sdev->dev,"Fail to allocate TID ret:%d\n" , ret); +return ret; + } + wbuf[txn.msg->num_bytes++] = txn.tid; + } + wbuf[txn.msg->num_bytes++] = port->ch.id; + } + + txn.mc =SLIM_USR_MC_CHAN_CTRL ; + txn.rl = txn.msg->num_bytes +SLIM_MSG_HDR_LEN ; + ret =qcom_slim_ngd_xfer_msg_sync (ctrl, &txn); +if (ret) { +slim_free_txn_tid (ctrl, &txn); +/* Controller restarting, the channels are gone anyway */ +if (ret == -EREMOTEIO ) +return 0 ; +dev_err (&sdev->dev,"TX timed out: MC: 0x%x, mt: 0x%x, laddr: 0x%x, ret: %d\n" , + txn.mc, txn.mt, sdev->laddr, ret); +return ret; + } + + txn.mc =SLIM_USR_MC_RECONFIG_NOW ; + txn.msg->num_bytes =2 ; + wbuf[1 ] = sdev->laddr; + txn.rl = txn.msg->num_bytes +SLIM_MSG_HDR_LEN ; + + ret =slim_alloc_txn_tid (ctrl, &txn); +if (ret) { +dev_err (&sdev->dev,"Fail to allocate TID ret:%d\n" , ret); +return ret; + } + + wbuf[0 ] = txn.tid; + ret =qcom_slim_ngd_xfer_msg_sync (ctrl, &txn); +if (ret) { +slim_free_txn_tid (ctrl, &txn); +dev_err (&sdev->dev,"TX timed out: MC: 0x%x, mt: 0x%x, laddr: 0x%x, ret: %d\n" , + txn.mc, txn.mt, sdev->laddr, ret); + } + +return ret; +} +static int qcom_slim_ngd_get_laddr (struct slim_controller *ctrl,struct slim_eaddr *ea,u8 *laddr) {
@@ -1625,6 +1702,7 @@ static int qcom_slim_ngd_ctrl_probe(struct platform_device *pdev) ctrl->ctrl.clkgear =SLIM_MAX_CLK_GEAR ; ctrl->ctrl.get_laddr = qcom_slim_ngd_get_laddr; ctrl->ctrl.enable_stream = qcom_slim_ngd_enable_stream; + ctrl->ctrl.disable_stream = qcom_slim_ngd_disable_stream; ctrl->ctrl.xfer_msg = qcom_slim_ngd_xfer_msg; ctrl->ctrl.wakeup =NULL ; ctrl->state =QCOM_SLIM_NGD_CTRL_DOWN ;
drivers/slimbus/slimbus.h +12 -0
@@ -316,6 +316,18 @@ enum slim_transport_protocol { SLIM_PROTO_EXT_HALF_DUP, }; +/** +* enum slim_ch_control: Channel control. +* @SLIM_CH_ACTIVATE: Schedules channel or group of channels in the TDM frame. +* @SLIM_CH_SUSPEND: Keeps the TDM schedule but halts data transfer. +* @SLIM_CH_REMOVE: Drops the channel or group from the TDM frame. +*/ +enum slim_ch_control { +SLIM_CH_ACTIVATE , +SLIM_CH_SUSPEND , +SLIM_CH_REMOVE , +}; +/** * struct slim_stream_runtime - SLIMbus stream runtime instance *
Signature · 1 line
2.53.0