Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp2539836rwp; Fri, 14 Jul 2023 07:40:43 -0700 (PDT) X-Google-Smtp-Source: APBJJlHOAoF9qBXrdiwOJfRDVhE/G7d7AapS7iopCRakTUl74EgVI8gw3mu25BXt9esAJIbuctr8 X-Received: by 2002:a17:903:247:b0:1b6:9cb9:bb55 with SMTP id j7-20020a170903024700b001b69cb9bb55mr5086308plh.42.1689345643383; Fri, 14 Jul 2023 07:40:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689345643; cv=none; d=google.com; s=arc-20160816; b=c4BKICgTMzfdyJXU8lJZmYRtIZbD2PfQx3yrXXsJPrIZTT5pI69l9APFGq1Fnu+z4Y /ifEl3e+IP8TX86eOSCXmj5JihZOJ1EzZ9Z+vfyB9IpOXPpaQMYH1S16cieHJHMNK8mc ulp1Z83sBceVE43MYJ8uyHE6d86viKq5tjWFji0KMaoll3wA57zd468Ni3yq7ZWGX5xT ITWfsS9c8VVCtslPU5rjhh3ZVqtrKS1KwbputX8D4s2HyXR9FMjyE5fddA5YIQO4hM2V 29NGdYweb7s69gqCPkGxkcHkZpmiogPFsSbvs7T0O5x/909uqKxJezzDim2xt7CyFnSr Eyrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=K7XSLJw52T0/1qLiEhQ2mFyEX8hNR7J0cXAXpzjTkNY=; fh=vNTBiZ+bDxuONfgF7OAqg8Qvk3FWKjqUup20F0IpWmU=; b=MtBiKBsNFJ8ICzyNHcaFWjbTPr9MXBw5oQCNeyPc1xYsB5LBDvvqVyrySeBQCaYx47 oQWGmf95JJw0WeBwvs3wO1XS00AKjVYzZMgMTFsTPOzX+IswMcr2Xe6G358YAO6saxlZ 1/zRni7yNtUtT2Z302xVWCojnV+214Ft4uujS4NR05OnAwUiLDIt0cYIMr65Oe0Pwo/A kWiG0PumgEQ36vT7R0at/XFzJeQqNcVTbvEPYRXeCwo5+eyaXxHTAWVWZXJb361IDafV HJYXgzADYnVEevjvguual2kmcwfrsR5rsXiXdObMCKgcv8Nk9E+oBLoryKl9+dSFZkkr kFDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ho4ZjRdL; 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 s18-20020a17090330d200b001bb12009a14si1843000plc.338.2023.07.14.07.40.28; Fri, 14 Jul 2023 07:40:43 -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=Ho4ZjRdL; 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 S235882AbjGNO3c (ORCPT + 99 others); Fri, 14 Jul 2023 10:29:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235984AbjGNO3X (ORCPT ); Fri, 14 Jul 2023 10:29:23 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70FE03AB8 for ; Fri, 14 Jul 2023 07:29:11 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-4fba86f069bso3364727e87.3 for ; Fri, 14 Jul 2023 07:29:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689344949; x=1691936949; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=K7XSLJw52T0/1qLiEhQ2mFyEX8hNR7J0cXAXpzjTkNY=; b=Ho4ZjRdLf3WGzWiRolCzfv9gXW/0Psx3vukeJjTNb5OOqvI4xEX5FjRQlTlH0VrjpJ 5wjUqnQb6BBfGcQgbH2jWkwjmE+jqezpHa3fGY/MyyF49vWlXwIBwJnolKVlDtgT4ofQ c8Py9ac1aIzpvUIZQPtCmO7g5IhXcGvq1wOimgli2ibG7uUS60HIgoXFwPVaZspW2Rwq kVJUzpAmtRdXbAfMQygzchEnDXSb73F9W+EnelAfBcQkxC6QNfpmiT/95RK27xlhzzhS c1LRyhqN/BBobG0bldsWkzljxPCSpFmL9ar1uyYmdtOCz73tJBp46cMikqLPIcHbv9uk od0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689344949; x=1691936949; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=K7XSLJw52T0/1qLiEhQ2mFyEX8hNR7J0cXAXpzjTkNY=; b=Eve3W3Id1czFHLvs5r/Afa0lwV/KwAA4tqgwEQjASJyGDdeLw1IoUjHC62CJVR4dHm +HJ2cGJrKJqD6yNsCsKiIGzGEyodvkcNFi6bl8UV+p3nScgLMtfdBLkrZGCUAeOf22D5 pNv4kPjwpwMbFlPoueU88xD7vqnDTWaoAlLf7cc6pDZzWwdea4UefHssN2t+++0755Zv 2i+JfMymZGbulhIe5wnKSY9Uc/3g9IP27jP8Td98bh9feppEx6zZnyGVRf/5ticginBY HfUZabH2tL1fG45jx+Bp3EpaJWVDJWnZYs/UhWKjsICDzbNNmteBWXc8yXneWctsVNFa IIGw== X-Gm-Message-State: ABy/qLYoXnYMnhNBP8PHeWIfuQuZ58EPRx7pKlS2eIqshZUxJaddUiKt Jcy50blITroooPqAEsaHpU17Ow== X-Received: by 2002:a05:6512:3ca5:b0:4f9:6c44:1bf3 with SMTP id h37-20020a0565123ca500b004f96c441bf3mr4529346lfv.62.1689344949598; Fri, 14 Jul 2023 07:29:09 -0700 (PDT) Received: from [192.168.1.101] (abxj146.neoplus.adsl.tpnet.pl. [83.9.3.146]) by smtp.gmail.com with ESMTPSA id w28-20020ac2599c000000b004fb759964a9sm1506768lfn.168.2023.07.14.07.29.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Jul 2023 07:29:09 -0700 (PDT) Message-ID: Date: Fri, 14 Jul 2023 16:29:08 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH 1/2] serial: qcom-geni: fix opp vote on shutdown Content-Language: en-US To: Johan Hovold , Greg Kroah-Hartman Cc: Andy Gross , Bjorn Andersson , Jiri Slaby , linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Rajendra Nayak , Matthias Kaehlcke References: <20230714130214.14552-1-johan+linaro@kernel.org> <20230714130214.14552-2-johan+linaro@kernel.org> From: Konrad Dybcio In-Reply-To: <20230714130214.14552-2-johan+linaro@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=unavailable 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 On 14.07.2023 15:02, Johan Hovold wrote: > The operating-performance-point vote needs to be dropped when shutting > down the port to avoid wasting power by keeping resources like power > domains in an unnecessarily high performance state (e.g. when a UART > connected Bluetooth controller is not in use). > > Fixes: a5819b548af0 ("tty: serial: qcom_geni_serial: Use OPP API to set clk/perf state") > Cc: stable@vger.kernel.org # 5.9 > Cc: Rajendra Nayak > Cc: Matthias Kaehlcke > Signed-off-by: Johan Hovold > --- I don't know a whole lot about this subsystem, but the PM call has a pointer to uport which already contains this clock rate.. Is it zeroed out by the core before we reach it, which would prevent us from reusing it? Konrad > drivers/tty/serial/qcom_geni_serial.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c > index b825b05e6137..8be896dbaa88 100644 > --- a/drivers/tty/serial/qcom_geni_serial.c > +++ b/drivers/tty/serial/qcom_geni_serial.c > @@ -126,6 +126,7 @@ struct qcom_geni_serial_port { > dma_addr_t rx_dma_addr; > bool setup; > unsigned int baud; > + unsigned long clk_rate; > void *rx_buf; > u32 loopback; > bool brk; > @@ -1249,6 +1250,7 @@ static void qcom_geni_serial_set_termios(struct uart_port *uport, > baud * sampling_rate, clk_rate, clk_div); > > uport->uartclk = clk_rate; > + port->clk_rate = clk_rate; > dev_pm_opp_set_rate(uport->dev, clk_rate); > ser_clk_cfg = SER_CLK_EN; > ser_clk_cfg |= clk_div << CLK_DIV_SHFT; > @@ -1513,10 +1515,13 @@ static void qcom_geni_serial_pm(struct uart_port *uport, > > if (new_state == UART_PM_STATE_ON && old_state == UART_PM_STATE_OFF) { > geni_icc_enable(&port->se); > + if (port->clk_rate) > + dev_pm_opp_set_rate(uport->dev, port->clk_rate); > geni_se_resources_on(&port->se); > } else if (new_state == UART_PM_STATE_OFF && > old_state == UART_PM_STATE_ON) { > geni_se_resources_off(&port->se); > + dev_pm_opp_set_rate(uport->dev, 0); > geni_icc_disable(&port->se); > } > }