Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3488066rwb; Fri, 30 Sep 2022 04:28:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5HMdOXLJ0+Duqkf1MQ/FU7VO+ATEcZJRTJ1jsSqvGxYGo1UUIT8F14d+aq4CwMxHCnzaM0 X-Received: by 2002:a17:907:1c12:b0:783:a788:9bbc with SMTP id nc18-20020a1709071c1200b00783a7889bbcmr6051747ejc.497.1664537296319; Fri, 30 Sep 2022 04:28:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664537296; cv=none; d=google.com; s=arc-20160816; b=Ti2dmX1BEZvox475oyO+dRFvrMLGLZ41ymjrTIi1eLlDf63vjIaFY00WkRzi0gSCou bCY+dITibQkYny1FsW9JBIZRw49jGwpqIPT4XLEV42KyIqNcrNAaCF8IVuhYdosd1w// J5rX4ndCRI4qr4n8cOQjKVouOelTwX4xWOq2WOAB0x/ZtuoH90T5JO5EP1LAM2U1Lm1U 9CoYKISN1+byc8Xo4KYsjv6tKEWqQu2TT4/wGxHqdNvt49zEOTS32t9s9OxvAoAbjLKy 5gssV5nAhrnaaI508pISLCQSTPtdn7objvhArU5+Ind7/dhBZ4GFR5BMKLQho+PZhof2 ZKPA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=eflBW1/omcz649gzqa80EdxHOHLRvARzQtLAthFPzJI=; b=t0nq7CCU3k1x0beSc5XaoXp0Nx09kXbDQjeeiootfz+9ytWCkFou89YzjZJKBNAM9r s3BK5XJPe8+80G7uSGZXso63eRtzSHssvE9eT9P08m5iB5C7ykRASDzZVuIBypwGVBHC C1+ZtUdEUZCuVu/J8Lr4Rn32FtH/dM/i/N+dWHiimPSDGG2GfusFgfoW5OSoQaCxN1ub FGLyA6YsN4Zhb4aYjgCojDhWihsQtmNqd3mbXuv99rZk19pEa7LA8X3oOVD7qoveeRrN AZa964VRHsx46/WqnytTw2+IblusBpFlBAEpNt00au1sp4BPaWuJ7QgjUQqE0HVGoN9D 0qbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OWK5LGKW; 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 cw20-20020a170906479400b0077ce17dac95si1666043ejc.120.2022.09.30.04.27.50; Fri, 30 Sep 2022 04:28:16 -0700 (PDT) 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=OWK5LGKW; 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 S231601AbiI3KAn (ORCPT + 99 others); Fri, 30 Sep 2022 06:00:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231611AbiI3KA1 (ORCPT ); Fri, 30 Sep 2022 06:00:27 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FC312B27C for ; Fri, 30 Sep 2022 03:00:18 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id l12so4247982ljg.9 for ; Fri, 30 Sep 2022 03:00:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=eflBW1/omcz649gzqa80EdxHOHLRvARzQtLAthFPzJI=; b=OWK5LGKWP0pdp3UPFCNUfXZUKNnZoBJUrmaauwMpZ82/O4KMFbn4fiY5fm0U5Ydqld OsiAVf+z608fk9ECGQhxGFQzomsxoLyemejEjZHZ+DGWAr++8OYtnDf+pJDBIZToR878 gfptsC3sbcKHx7ZTNpJok8J2N+TQOp66L1Jg3EP2AfGAUTEosVpw43u8rqeSqUs8LVWF ZFHFjy0CJaDfUa5B61twfyKo88jykM86qFHIoWncHvxv4n0TxHNOLDsrUHWnrwPGelj/ V/fISMnD0XD5ynehEItyMZ4az5V3iZWBJJGca2njI6DzP7lvejVWnowY1lM2Wln3FJyu mxQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=eflBW1/omcz649gzqa80EdxHOHLRvARzQtLAthFPzJI=; b=7HjxhuKDG5spdTNVhTW9jBqF1Pm1PXONns97+DJlb6BWmYPIQF1FllxgVyIGZXbhSW R+8tDJJQutjuQOWy61xiWT/I7qqRfFIIRn2GwMyJa6yaqDzxBc+h/pIN+619It339wVW Ld80+qNCQkkDx2BxaCovY8zs5NywsoWZBBd1n9HkZFqGsQ6K3eW7AUYo8bXqBJfvBQqQ Afv4xFP5UnAoqUmaOuHj43eMlkYsQprAQHLdqTyWAY4288kjTtKNtuOycgItF2TYwDGM P3DnQKYrWIHrfBPlWqAvILFwrBMml2fTau15Dpi7856Ga8QCpkvwQC7DiJkmr2ipe5Sf DdIQ== X-Gm-Message-State: ACrzQf192Vwda3PwfKCqnOLA9ot484krhJvP9iUT6fwaifGmBd6/kq3O bqZuzQzkqjkhDmJe1V6nHNVYPg== X-Received: by 2002:a2e:a54b:0:b0:26c:72ed:b758 with SMTP id e11-20020a2ea54b000000b0026c72edb758mr2692885ljn.245.1664532017099; Fri, 30 Sep 2022 03:00:17 -0700 (PDT) Received: from krzk-bin.. (78-11-189-27.static.ip.netia.com.pl. [78.11.189.27]) by smtp.gmail.com with ESMTPSA id q65-20020a2e2a44000000b0026c3e350682sm113521ljq.14.2022.09.30.03.00.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Sep 2022 03:00:16 -0700 (PDT) From: Krzysztof Kozlowski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Srinivas Kandagatla , linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH v2 1/2] slimbus: stream: handle unsupported bitrates for presence rate Date: Fri, 30 Sep 2022 12:00:14 +0200 Message-Id: <20220930100015.259106-1-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 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 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 --- 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