Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp197551rwb; Thu, 17 Nov 2022 23:29:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf6x5nar3japJo3A+IhUS2pK2y8bga1fPwDvTEBqkViD538qI/AXQCyNhtfhG+pimYn0akZH X-Received: by 2002:a63:747:0:b0:46f:2780:93b7 with SMTP id 68-20020a630747000000b0046f278093b7mr5497104pgh.166.1668756554645; Thu, 17 Nov 2022 23:29:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668756554; cv=none; d=google.com; s=arc-20160816; b=vzOe83MDOaC6cfBHMwQDbTHq15bjdrbUGPaFsOqPaZxGBd2ML4htd+mXZ1NNq3wdOU 1haUnGGnnCcfc9Au7a9jJ5rm0H9HfQ5hOR1v8xf35q6bQmwiUCQVZBF/sXwCrb68e8ee icIGrvRuBX7AsFeue6b3gqwjvKoIRF1UhFFB2bqF7fbtLzA4bCDzBq/jqEVz+oa7Quiy UL58ggE2KAHBIuk0HrA1jZgYVKDEgoHFohpfOrbxcZ6tPagl3bx8Gqd03qTuhgbWDo0f DN6kK6YKMIPi0oRl6JMQym/VopyoNd9rI1XQ9fVgj/RuybSt2MkCvAVlInx+moqwxBEG emdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hPoS5c0NA5mvn5v0/8jSYk8xg57iIs+E4GUJ/bjMpqA=; b=JvdCICh3gjl5Z1BPiOBX4gafwDN2qEhIdpKsKAxhiaO6lSPx/icCbZN0PCvCp8Jfal NLiiOjQ+006duy/+xt4VKsKU+1oTaI/Fd20eiPyCeDyt1y+8LkQCcVdp0dg9/+eGWm0j SlFPDopYajOFsFArw55BvlZk0DZn94aRJ6/GqiXmqGavPJlB1oHwLQYj8jxSCDfF1Tp4 47SqERhkQOFCgXme35Y1YDy5xjOwbogDSAqiLLKEd+AOWoFfhRPYWX9S0knRXvHO7wXf 4+Iux0airF3JGsMFonnuI9mXNWuu9gRB1863u/PnbHXGv3Bz4dzXujQI+/KKxeGJ+ZYV 0y+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h81TVeZb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r10-20020a62e40a000000b0056cf9ed8f10si2655598pfh.329.2022.11.17.23.29.00; Thu, 17 Nov 2022 23:29:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h81TVeZb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241330AbiKRGxX (ORCPT + 91 others); Fri, 18 Nov 2022 01:53:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241289AbiKRGxG (ORCPT ); Fri, 18 Nov 2022 01:53:06 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 863C882BDB for ; Thu, 17 Nov 2022 22:52:59 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id a14so7839943wru.5 for ; Thu, 17 Nov 2022 22:52:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hPoS5c0NA5mvn5v0/8jSYk8xg57iIs+E4GUJ/bjMpqA=; b=h81TVeZbl/leUMsap5jTYhdnKO/oRjIKH44NaE+7GDX+NGkFsEnPBoMCfHEYS58Rmm uN5LbyhomsSTAWdbhR7gzYX9BGf9/iqzKl4BcHSnGvPLH0b10+ifLdUtjs15O/IMeZUC YecV2dowkgGNG5R2Z9c1iyTAhZ1LPea69V3cjJi3Yy8v/rdkUSN+a4T5+6HHFSxBV0b/ Dkp9VH0jFimVX0TIOv0SE5+C1WjuqAp8F0S5J6rw8/bAMzADZ7sKdjnHsznWYsOGDg36 itHGbCJTTskcsUjkhiUefdPQjFv5pRNCVg6POrKjosKAFnAt5lLuURjgVZoSUuBKmusZ Y79w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hPoS5c0NA5mvn5v0/8jSYk8xg57iIs+E4GUJ/bjMpqA=; b=hnF5wRZT612THJVOVX2sAqLAUZ132TBah9OImdToZOpvguI9F7qq6L4vwLEoin7tBG bCHKztBYr7ekfOoaoC6liaTI7uXwfuVbrXGRUkWpHLS5d66LYCYwOuOFeb5fnyEQBFwW HbvZy+OKiqBsX2nCyZdkcmo4waMTVrt9NO+58yhFTuNnIY6ahXS8l8LhgLF/1J6ssoaX QlYlsinNgi6OXYVk5Dx6dqcy9JLJQxJvyoJtdCkkZvFaa4WRqzixFSw2M3VYrDF0W/9e eWGWrY9ViJ/dg2CIpyOw/TC1ewmbrGQPpgLHMk+dVFsuZmAjf3fzDWVf4gyrJDPAse0s od7w== X-Gm-Message-State: ANoB5pky9+MZbcIJCiKq8UPLj8vLriAtT1qmC9T2iic+JkxhPPm5knsW jE7Pn3xhx0mwBPo6BPlXqXFy1iaVWpcRuQ== X-Received: by 2002:a05:6000:18d:b0:236:5fe3:c459 with SMTP id p13-20020a056000018d00b002365fe3c459mr3400195wrx.219.1668754378043; Thu, 17 Nov 2022 22:52:58 -0800 (PST) Received: from localhost.localdomain ([167.98.215.174]) by smtp.gmail.com with ESMTPSA id 23-20020a05600c229700b003cf75213bb9sm7648100wmf.8.2022.11.17.22.52.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 22:52:57 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Krzysztof Kozlowski , Konrad Dybcio , Srinivas Kandagatla Subject: [PATCH 03/12] slimbus: stream: handle unsupported bitrates for presence rate Date: Fri, 18 Nov 2022 06:52:37 +0000 Message-Id: <20221118065246.6835-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221118065246.6835-1-srinivas.kandagatla@linaro.org> References: <20221118065246.6835-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Krzysztof Kozlowski Handle errors of getting presence rate for unsupported stream bitrate, instead of sending -EINVAL in change content message. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Konrad Dybcio Signed-off-by: Srinivas Kandagatla --- 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 73a2aa362957..7e9c818e66c1 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.25.1