From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@somainline.org>,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org,
linux-kernel@vger.kernel.org
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Subject: [PATCH v2 1/2] slimbus: stream: handle unsupported bitrates for presence rate
Date: Fri, 30 Sep 2022 12:00:14 +0200 [thread overview]
Message-ID: <20220930100015.259106-1-krzysztof.kozlowski@linaro.org> (raw)
Handle errors of getting presence rate for unsupported stream bitrate,
instead of sending -EINVAL in change content message.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@somainline.org>
---
Changes since v1:
1. Rebase (drop development pieces in the context).
2. Return prrate (which has errno) instead of -EINVAL.
3. Add Rb tag.
---
drivers/slimbus/stream.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/slimbus/stream.c b/drivers/slimbus/stream.c
index d5ce974e880b..f631d5ed9809 100644
--- a/drivers/slimbus/stream.c
+++ b/drivers/slimbus/stream.c
@@ -204,7 +204,7 @@ int slim_stream_prepare(struct slim_stream_runtime *rt,
{
struct slim_controller *ctrl = rt->dev->ctrl;
struct slim_port *port;
- int num_ports, i, port_id;
+ int num_ports, i, port_id, prrate;
if (rt->ports) {
dev_err(&rt->dev->dev, "Stream already Prepared\n");
@@ -221,6 +221,13 @@ int slim_stream_prepare(struct slim_stream_runtime *rt,
rt->bps = cfg->bps;
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) {
/*
* data rate not exactly multiple of super frame,
@@ -241,7 +248,7 @@ int slim_stream_prepare(struct slim_stream_runtime *rt,
port = &rt->ports[i];
port->state = SLIM_PORT_DISCONNECTED;
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.data_fmt = SLIM_CH_DATA_FMT_NOT_DEFINED;
port->ch.aux_fmt = SLIM_CH_AUX_FMT_NOT_APPLICABLE;
--
2.34.1
next reply other threads:[~2022-09-30 10:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-30 10:00 Krzysztof Kozlowski [this message]
2022-09-30 10:00 ` [PATCH v2 2/2] slimbus: qcom-ngd-ctrl: add support for 44.1 Khz frequency Krzysztof Kozlowski
2022-10-31 18:28 ` [PATCH v2 1/2] slimbus: stream: handle unsupported bitrates for presence rate Srinivas Kandagatla
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=20220930100015.259106-1-krzysztof.kozlowski@linaro.org \
--to=krzysztof.kozlowski@linaro.org \
--cc=agross@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=andersson@kernel.org \
--cc=konrad.dybcio@somainline.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=srinivas.kandagatla@linaro.org \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).