mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Konrad Dybcio <konrad.dybcio@linaro.org>
To: Johan Hovold <johan+linaro@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Andy Gross <agross@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Rajendra Nayak <quic_rjendra@quicinc.com>,
	Matthias Kaehlcke <mka@chromium.org>
Subject: Re: [PATCH 1/2] serial: qcom-geni: fix opp vote on shutdown
Date: Fri, 14 Jul 2023 16:29:08 +0200	[thread overview]
Message-ID: <e99b5975-b770-5460-1ce4-cd4eb1a50291@linaro.org> (raw)
In-Reply-To: <20230714130214.14552-2-johan+linaro@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 <quic_rjendra@quicinc.com>
> Cc: Matthias Kaehlcke <mka@chromium.org>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> ---
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);
>  	}
>  }

  reply	other threads:[~2023-07-14 14:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-14 13:02 [PATCH 0/2] " Johan Hovold
2023-07-14 13:02 ` [PATCH 1/2] " Johan Hovold
2023-07-14 14:29   ` Konrad Dybcio [this message]
2023-07-14 15:08     ` Johan Hovold
2023-07-15  9:19       ` Konrad Dybcio
2023-07-14 13:02 ` [PATCH 2/2] serial: qcom-geni: clean up clock-rate debug printk Johan Hovold
2023-07-14 14:26   ` Konrad Dybcio

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=e99b5975-b770-5460-1ce4-cd4eb1a50291@linaro.org \
    --to=konrad.dybcio@linaro.org \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=johan+linaro@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mka@chromium.org \
    --cc=quic_rjendra@quicinc.com \
    --cc=stable@vger.kernel.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

all inboxes | Powered by JetHome®