提交 434d2572 编写于 作者: K Krzysztof Kozlowski 提交者: Greg Kroah-Hartman

slimbus: stream: handle unsupported bitrates for presence rate

Handle errors of getting presence rate for unsupported stream bitrate,
instead of sending -EINVAL in change content message.
Signed-off-by: NKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: NKonrad Dybcio <konrad.dybcio@somainline.org>
Signed-off-by: NSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20221118065246.6835-4-srinivas.kandagatla@linaro.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 63c60a22
...@@ -204,7 +204,7 @@ int slim_stream_prepare(struct slim_stream_runtime *rt, ...@@ -204,7 +204,7 @@ int slim_stream_prepare(struct slim_stream_runtime *rt,
{ {
struct slim_controller *ctrl = rt->dev->ctrl; struct slim_controller *ctrl = rt->dev->ctrl;
struct slim_port *port; struct slim_port *port;
int num_ports, i, port_id; int num_ports, i, port_id, prrate;
if (rt->ports) { if (rt->ports) {
dev_err(&rt->dev->dev, "Stream already Prepared\n"); dev_err(&rt->dev->dev, "Stream already Prepared\n");
...@@ -221,6 +221,13 @@ int slim_stream_prepare(struct slim_stream_runtime *rt, ...@@ -221,6 +221,13 @@ int slim_stream_prepare(struct slim_stream_runtime *rt,
rt->bps = cfg->bps; rt->bps = cfg->bps;
rt->direction = cfg->direction; rt->direction = cfg->direction;
prrate = slim_get_prate_code(cfg->rate);
if (prrate < 0) {
dev_err(&rt->dev->dev, "Cannot get presence rate for rate %d Hz\n",
cfg->rate);
return prrate;
}
if (cfg->rate % ctrl->a_framer->superfreq) { if (cfg->rate % ctrl->a_framer->superfreq) {
/* /*
* data rate not exactly multiple of super frame, * data rate not exactly multiple of super frame,
...@@ -241,7 +248,7 @@ int slim_stream_prepare(struct slim_stream_runtime *rt, ...@@ -241,7 +248,7 @@ int slim_stream_prepare(struct slim_stream_runtime *rt,
port = &rt->ports[i]; port = &rt->ports[i];
port->state = SLIM_PORT_DISCONNECTED; port->state = SLIM_PORT_DISCONNECTED;
port->id = port_id; port->id = port_id;
port->ch.prrate = slim_get_prate_code(cfg->rate); port->ch.prrate = prrate;
port->ch.id = cfg->chs[i]; port->ch.id = cfg->chs[i];
port->ch.data_fmt = SLIM_CH_DATA_FMT_NOT_DEFINED; port->ch.data_fmt = SLIM_CH_DATA_FMT_NOT_DEFINED;
port->ch.aux_fmt = SLIM_CH_AUX_FMT_NOT_APPLICABLE; port->ch.aux_fmt = SLIM_CH_AUX_FMT_NOT_APPLICABLE;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册