mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-19 12:24:34 +08:00
serial: qcom-geni: fix opp vote on shutdown
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: a5819b548a
("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>
Acked-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20230714130214.14552-2-johan+linaro@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d9219528fa
commit
8ece7b754b
@ -125,6 +125,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;
|
||||
@ -1248,6 +1249,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;
|
||||
@ -1512,10 +1514,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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user