mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 12:21:22 -05:00
Merge tag 'tty-6.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty driver fix from Greg KH: "Here is a single driver fix for the qcom_geni_serial driver. It has been in my tree for weeks, but missed being sent to you for 6.17-final due to travel on my side. This fixes a reported regression for this driver that prevents 6.17 from working properly on this platform. It has been in linux-next for many weeks with no reported issues" * tag 'tty-6.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: serial: qcom-geni: Fix blocked task
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
#include <linux/irq.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/pm_domain.h>
|
||||
#include <linux/pm_opp.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
@@ -102,16 +101,10 @@
|
||||
#define DMA_RX_BUF_SIZE 2048
|
||||
|
||||
static DEFINE_IDA(port_ida);
|
||||
#define DOMAIN_IDX_POWER 0
|
||||
#define DOMAIN_IDX_PERF 1
|
||||
|
||||
struct qcom_geni_device_data {
|
||||
bool console;
|
||||
enum geni_se_xfer_mode mode;
|
||||
struct dev_pm_domain_attach_data pd_data;
|
||||
int (*resources_init)(struct uart_port *uport);
|
||||
int (*set_rate)(struct uart_port *uport, unsigned int baud);
|
||||
int (*power_state)(struct uart_port *uport, bool state);
|
||||
};
|
||||
|
||||
struct qcom_geni_private_data {
|
||||
@@ -149,7 +142,6 @@ struct qcom_geni_serial_port {
|
||||
|
||||
struct qcom_geni_private_data private_data;
|
||||
const struct qcom_geni_device_data *dev_data;
|
||||
struct dev_pm_domain_list *pd_list;
|
||||
};
|
||||
|
||||
static const struct uart_ops qcom_geni_console_pops;
|
||||
@@ -1307,42 +1299,6 @@ static int geni_serial_set_rate(struct uart_port *uport, unsigned int baud)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int geni_serial_set_level(struct uart_port *uport, unsigned int baud)
|
||||
{
|
||||
struct qcom_geni_serial_port *port = to_dev_port(uport);
|
||||
struct device *perf_dev = port->pd_list->pd_devs[DOMAIN_IDX_PERF];
|
||||
|
||||
/*
|
||||
* The performance protocol sets UART communication
|
||||
* speeds by selecting different performance levels
|
||||
* through the OPP framework.
|
||||
*
|
||||
* Supported perf levels for baudrates in firmware are below
|
||||
* +---------------------+--------------------+
|
||||
* | Perf level value | Baudrate values |
|
||||
* +---------------------+--------------------+
|
||||
* | 300 | 300 |
|
||||
* | 1200 | 1200 |
|
||||
* | 2400 | 2400 |
|
||||
* | 4800 | 4800 |
|
||||
* | 9600 | 9600 |
|
||||
* | 19200 | 19200 |
|
||||
* | 38400 | 38400 |
|
||||
* | 57600 | 57600 |
|
||||
* | 115200 | 115200 |
|
||||
* | 230400 | 230400 |
|
||||
* | 460800 | 460800 |
|
||||
* | 921600 | 921600 |
|
||||
* | 2000000 | 2000000 |
|
||||
* | 3000000 | 3000000 |
|
||||
* | 3200000 | 3200000 |
|
||||
* | 4000000 | 4000000 |
|
||||
* +---------------------+--------------------+
|
||||
*/
|
||||
|
||||
return dev_pm_opp_set_level(perf_dev, baud);
|
||||
}
|
||||
|
||||
static void qcom_geni_serial_set_termios(struct uart_port *uport,
|
||||
struct ktermios *termios,
|
||||
const struct ktermios *old)
|
||||
@@ -1361,7 +1317,7 @@ static void qcom_geni_serial_set_termios(struct uart_port *uport,
|
||||
/* baud rate */
|
||||
baud = uart_get_baud_rate(uport, termios, old, 300, 8000000);
|
||||
|
||||
ret = port->dev_data->set_rate(uport, baud);
|
||||
ret = geni_serial_set_rate(uport, baud);
|
||||
if (ret)
|
||||
return;
|
||||
|
||||
@@ -1648,27 +1604,8 @@ static int geni_serial_resources_off(struct uart_port *uport)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int geni_serial_resource_state(struct uart_port *uport, bool power_on)
|
||||
static int geni_serial_resource_init(struct qcom_geni_serial_port *port)
|
||||
{
|
||||
return power_on ? geni_serial_resources_on(uport) : geni_serial_resources_off(uport);
|
||||
}
|
||||
|
||||
static int geni_serial_pwr_init(struct uart_port *uport)
|
||||
{
|
||||
struct qcom_geni_serial_port *port = to_dev_port(uport);
|
||||
int ret;
|
||||
|
||||
ret = dev_pm_domain_attach_list(port->se.dev,
|
||||
&port->dev_data->pd_data, &port->pd_list);
|
||||
if (ret <= 0)
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int geni_serial_resource_init(struct uart_port *uport)
|
||||
{
|
||||
struct qcom_geni_serial_port *port = to_dev_port(uport);
|
||||
int ret;
|
||||
|
||||
port->se.clk = devm_clk_get(port->se.dev, "se");
|
||||
@@ -1713,10 +1650,10 @@ static void qcom_geni_serial_pm(struct uart_port *uport,
|
||||
old_state = UART_PM_STATE_OFF;
|
||||
|
||||
if (new_state == UART_PM_STATE_ON && old_state == UART_PM_STATE_OFF)
|
||||
pm_runtime_resume_and_get(uport->dev);
|
||||
geni_serial_resources_on(uport);
|
||||
else if (new_state == UART_PM_STATE_OFF &&
|
||||
old_state == UART_PM_STATE_ON)
|
||||
pm_runtime_put_sync(uport->dev);
|
||||
geni_serial_resources_off(uport);
|
||||
|
||||
}
|
||||
|
||||
@@ -1819,16 +1756,13 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
|
||||
port->se.dev = &pdev->dev;
|
||||
port->se.wrapper = dev_get_drvdata(pdev->dev.parent);
|
||||
|
||||
ret = port->dev_data->resources_init(uport);
|
||||
ret = geni_serial_resource_init(port);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!res) {
|
||||
ret = -EINVAL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!res)
|
||||
return -EINVAL;
|
||||
uport->mapbase = res->start;
|
||||
|
||||
uport->rs485_config = qcom_geni_rs485_config;
|
||||
@@ -1840,26 +1774,19 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
|
||||
if (!data->console) {
|
||||
port->rx_buf = devm_kzalloc(uport->dev,
|
||||
DMA_RX_BUF_SIZE, GFP_KERNEL);
|
||||
if (!port->rx_buf) {
|
||||
ret = -ENOMEM;
|
||||
goto error;
|
||||
}
|
||||
if (!port->rx_buf)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
port->name = devm_kasprintf(uport->dev, GFP_KERNEL,
|
||||
"qcom_geni_serial_%s%d",
|
||||
uart_console(uport) ? "console" : "uart", uport->line);
|
||||
if (!port->name) {
|
||||
ret = -ENOMEM;
|
||||
goto error;
|
||||
}
|
||||
if (!port->name)
|
||||
return -ENOMEM;
|
||||
|
||||
irq = platform_get_irq(pdev, 0);
|
||||
if (irq < 0) {
|
||||
ret = irq;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (irq < 0)
|
||||
return irq;
|
||||
uport->irq = irq;
|
||||
uport->has_sysrq = IS_ENABLED(CONFIG_SERIAL_QCOM_GENI_CONSOLE);
|
||||
|
||||
@@ -1881,18 +1808,16 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
|
||||
IRQF_TRIGGER_HIGH, port->name, uport);
|
||||
if (ret) {
|
||||
dev_err(uport->dev, "Failed to get IRQ ret %d\n", ret);
|
||||
goto error;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = uart_get_rs485_mode(uport);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
devm_pm_runtime_enable(port->se.dev);
|
||||
|
||||
ret = uart_add_one_port(drv, uport);
|
||||
if (ret)
|
||||
goto error;
|
||||
return ret;
|
||||
|
||||
if (port->wakeup_irq > 0) {
|
||||
device_init_wakeup(&pdev->dev, true);
|
||||
@@ -1902,15 +1827,11 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
|
||||
device_init_wakeup(&pdev->dev, false);
|
||||
ida_free(&port_ida, uport->line);
|
||||
uart_remove_one_port(drv, uport);
|
||||
goto error;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
dev_pm_domain_detach_list(port->pd_list);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void qcom_geni_serial_remove(struct platform_device *pdev)
|
||||
@@ -1923,31 +1844,6 @@ static void qcom_geni_serial_remove(struct platform_device *pdev)
|
||||
device_init_wakeup(&pdev->dev, false);
|
||||
ida_free(&port_ida, uport->line);
|
||||
uart_remove_one_port(drv, &port->uport);
|
||||
dev_pm_domain_detach_list(port->pd_list);
|
||||
}
|
||||
|
||||
static int __maybe_unused qcom_geni_serial_runtime_suspend(struct device *dev)
|
||||
{
|
||||
struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
|
||||
struct uart_port *uport = &port->uport;
|
||||
int ret = 0;
|
||||
|
||||
if (port->dev_data->power_state)
|
||||
ret = port->dev_data->power_state(uport, false);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __maybe_unused qcom_geni_serial_runtime_resume(struct device *dev)
|
||||
{
|
||||
struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
|
||||
struct uart_port *uport = &port->uport;
|
||||
int ret = 0;
|
||||
|
||||
if (port->dev_data->power_state)
|
||||
ret = port->dev_data->power_state(uport, true);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int qcom_geni_serial_suspend(struct device *dev)
|
||||
@@ -1985,46 +1881,14 @@ static int qcom_geni_serial_resume(struct device *dev)
|
||||
static const struct qcom_geni_device_data qcom_geni_console_data = {
|
||||
.console = true,
|
||||
.mode = GENI_SE_FIFO,
|
||||
.resources_init = geni_serial_resource_init,
|
||||
.set_rate = geni_serial_set_rate,
|
||||
.power_state = geni_serial_resource_state,
|
||||
};
|
||||
|
||||
static const struct qcom_geni_device_data qcom_geni_uart_data = {
|
||||
.console = false,
|
||||
.mode = GENI_SE_DMA,
|
||||
.resources_init = geni_serial_resource_init,
|
||||
.set_rate = geni_serial_set_rate,
|
||||
.power_state = geni_serial_resource_state,
|
||||
};
|
||||
|
||||
static const struct qcom_geni_device_data sa8255p_qcom_geni_console_data = {
|
||||
.console = true,
|
||||
.mode = GENI_SE_FIFO,
|
||||
.pd_data = {
|
||||
.pd_flags = PD_FLAG_DEV_LINK_ON,
|
||||
.pd_names = (const char*[]) { "power", "perf" },
|
||||
.num_pd_names = 2,
|
||||
},
|
||||
.resources_init = geni_serial_pwr_init,
|
||||
.set_rate = geni_serial_set_level,
|
||||
};
|
||||
|
||||
static const struct qcom_geni_device_data sa8255p_qcom_geni_uart_data = {
|
||||
.console = false,
|
||||
.mode = GENI_SE_DMA,
|
||||
.pd_data = {
|
||||
.pd_flags = PD_FLAG_DEV_LINK_ON,
|
||||
.pd_names = (const char*[]) { "power", "perf" },
|
||||
.num_pd_names = 2,
|
||||
},
|
||||
.resources_init = geni_serial_pwr_init,
|
||||
.set_rate = geni_serial_set_level,
|
||||
};
|
||||
|
||||
static const struct dev_pm_ops qcom_geni_serial_pm_ops = {
|
||||
SET_RUNTIME_PM_OPS(qcom_geni_serial_runtime_suspend,
|
||||
qcom_geni_serial_runtime_resume, NULL)
|
||||
SYSTEM_SLEEP_PM_OPS(qcom_geni_serial_suspend, qcom_geni_serial_resume)
|
||||
};
|
||||
|
||||
@@ -2033,18 +1897,10 @@ static const struct of_device_id qcom_geni_serial_match_table[] = {
|
||||
.compatible = "qcom,geni-debug-uart",
|
||||
.data = &qcom_geni_console_data,
|
||||
},
|
||||
{
|
||||
.compatible = "qcom,sa8255p-geni-debug-uart",
|
||||
.data = &sa8255p_qcom_geni_console_data,
|
||||
},
|
||||
{
|
||||
.compatible = "qcom,geni-uart",
|
||||
.data = &qcom_geni_uart_data,
|
||||
},
|
||||
{
|
||||
.compatible = "qcom,sa8255p-geni-uart",
|
||||
.data = &sa8255p_qcom_geni_uart_data,
|
||||
},
|
||||
{}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, qcom_geni_serial_match_table);
|
||||
|
||||
Reference in New Issue
Block a user