Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+16 -160
+16 -160
drivers/tty/serial/qcom_geni_serial.c
··· 14 14 #include <linux/irq.h> 15 15 #include <linux/module.h> 16 16 #include <linux/of.h> 17 - #include <linux/pm_domain.h> 18 17 #include <linux/pm_opp.h> 19 18 #include <linux/platform_device.h> 20 19 #include <linux/pm_runtime.h> ··· 101 102 #define DMA_RX_BUF_SIZE 2048 102 103 103 104 static DEFINE_IDA(port_ida); 104 - #define DOMAIN_IDX_POWER 0 105 - #define DOMAIN_IDX_PERF 1 106 105 107 106 struct qcom_geni_device_data { 108 107 bool console; 109 108 enum geni_se_xfer_mode mode; 110 - struct dev_pm_domain_attach_data pd_data; 111 - int (*resources_init)(struct uart_port *uport); 112 - int (*set_rate)(struct uart_port *uport, unsigned int baud); 113 - int (*power_state)(struct uart_port *uport, bool state); 114 109 }; 115 110 116 111 struct qcom_geni_private_data { ··· 142 149 143 150 struct qcom_geni_private_data private_data; 144 151 const struct qcom_geni_device_data *dev_data; 145 - struct dev_pm_domain_list *pd_list; 146 152 }; 147 153 148 154 static const struct uart_ops qcom_geni_console_pops; ··· 1299 1307 return 0; 1300 1308 } 1301 1309 1302 - static int geni_serial_set_level(struct uart_port *uport, unsigned int baud) 1303 - { 1304 - struct qcom_geni_serial_port *port = to_dev_port(uport); 1305 - struct device *perf_dev = port->pd_list->pd_devs[DOMAIN_IDX_PERF]; 1306 - 1307 - /* 1308 - * The performance protocol sets UART communication 1309 - * speeds by selecting different performance levels 1310 - * through the OPP framework. 1311 - * 1312 - * Supported perf levels for baudrates in firmware are below 1313 - * +---------------------+--------------------+ 1314 - * | Perf level value | Baudrate values | 1315 - * +---------------------+--------------------+ 1316 - * | 300 | 300 | 1317 - * | 1200 | 1200 | 1318 - * | 2400 | 2400 | 1319 - * | 4800 | 4800 | 1320 - * | 9600 | 9600 | 1321 - * | 19200 | 19200 | 1322 - * | 38400 | 38400 | 1323 - * | 57600 | 57600 | 1324 - * | 115200 | 115200 | 1325 - * | 230400 | 230400 | 1326 - * | 460800 | 460800 | 1327 - * | 921600 | 921600 | 1328 - * | 2000000 | 2000000 | 1329 - * | 3000000 | 3000000 | 1330 - * | 3200000 | 3200000 | 1331 - * | 4000000 | 4000000 | 1332 - * +---------------------+--------------------+ 1333 - */ 1334 - 1335 - return dev_pm_opp_set_level(perf_dev, baud); 1336 - } 1337 - 1338 1310 static void qcom_geni_serial_set_termios(struct uart_port *uport, 1339 1311 struct ktermios *termios, 1340 1312 const struct ktermios *old) ··· 1317 1361 /* baud rate */ 1318 1362 baud = uart_get_baud_rate(uport, termios, old, 300, 8000000); 1319 1363 1320 - ret = port->dev_data->set_rate(uport, baud); 1364 + ret = geni_serial_set_rate(uport, baud); 1321 1365 if (ret) 1322 1366 return; 1323 1367 ··· 1604 1648 return 0; 1605 1649 } 1606 1650 1607 - static int geni_serial_resource_state(struct uart_port *uport, bool power_on) 1651 + static int geni_serial_resource_init(struct qcom_geni_serial_port *port) 1608 1652 { 1609 - return power_on ? geni_serial_resources_on(uport) : geni_serial_resources_off(uport); 1610 - } 1611 - 1612 - static int geni_serial_pwr_init(struct uart_port *uport) 1613 - { 1614 - struct qcom_geni_serial_port *port = to_dev_port(uport); 1615 - int ret; 1616 - 1617 - ret = dev_pm_domain_attach_list(port->se.dev, 1618 - &port->dev_data->pd_data, &port->pd_list); 1619 - if (ret <= 0) 1620 - return -EINVAL; 1621 - 1622 - return 0; 1623 - } 1624 - 1625 - static int geni_serial_resource_init(struct uart_port *uport) 1626 - { 1627 - struct qcom_geni_serial_port *port = to_dev_port(uport); 1628 1653 int ret; 1629 1654 1630 1655 port->se.clk = devm_clk_get(port->se.dev, "se"); ··· 1650 1713 old_state = UART_PM_STATE_OFF; 1651 1714 1652 1715 if (new_state == UART_PM_STATE_ON && old_state == UART_PM_STATE_OFF) 1653 - pm_runtime_resume_and_get(uport->dev); 1716 + geni_serial_resources_on(uport); 1654 1717 else if (new_state == UART_PM_STATE_OFF && 1655 1718 old_state == UART_PM_STATE_ON) 1656 - pm_runtime_put_sync(uport->dev); 1719 + geni_serial_resources_off(uport); 1657 1720 1658 1721 } 1659 1722 ··· 1756 1819 port->se.dev = &pdev->dev; 1757 1820 port->se.wrapper = dev_get_drvdata(pdev->dev.parent); 1758 1821 1759 - ret = port->dev_data->resources_init(uport); 1822 + ret = geni_serial_resource_init(port); 1760 1823 if (ret) 1761 1824 return ret; 1762 1825 1763 1826 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1764 - if (!res) { 1765 - ret = -EINVAL; 1766 - goto error; 1767 - } 1768 - 1827 + if (!res) 1828 + return -EINVAL; 1769 1829 uport->mapbase = res->start; 1770 1830 1771 1831 uport->rs485_config = qcom_geni_rs485_config; ··· 1774 1840 if (!data->console) { 1775 1841 port->rx_buf = devm_kzalloc(uport->dev, 1776 1842 DMA_RX_BUF_SIZE, GFP_KERNEL); 1777 - if (!port->rx_buf) { 1778 - ret = -ENOMEM; 1779 - goto error; 1780 - } 1843 + if (!port->rx_buf) 1844 + return -ENOMEM; 1781 1845 } 1782 1846 1783 1847 port->name = devm_kasprintf(uport->dev, GFP_KERNEL, 1784 1848 "qcom_geni_serial_%s%d", 1785 1849 uart_console(uport) ? "console" : "uart", uport->line); 1786 - if (!port->name) { 1787 - ret = -ENOMEM; 1788 - goto error; 1789 - } 1850 + if (!port->name) 1851 + return -ENOMEM; 1790 1852 1791 1853 irq = platform_get_irq(pdev, 0); 1792 - if (irq < 0) { 1793 - ret = irq; 1794 - goto error; 1795 - } 1796 - 1854 + if (irq < 0) 1855 + return irq; 1797 1856 uport->irq = irq; 1798 1857 uport->has_sysrq = IS_ENABLED(CONFIG_SERIAL_QCOM_GENI_CONSOLE); 1799 1858 ··· 1808 1881 IRQF_TRIGGER_HIGH, port->name, uport); 1809 1882 if (ret) { 1810 1883 dev_err(uport->dev, "Failed to get IRQ ret %d\n", ret); 1811 - goto error; 1884 + return ret; 1812 1885 } 1813 1886 1814 1887 ret = uart_get_rs485_mode(uport); 1815 1888 if (ret) 1816 1889 return ret; 1817 1890 1818 - devm_pm_runtime_enable(port->se.dev); 1819 - 1820 1891 ret = uart_add_one_port(drv, uport); 1821 1892 if (ret) 1822 - goto error; 1893 + return ret; 1823 1894 1824 1895 if (port->wakeup_irq > 0) { 1825 1896 device_init_wakeup(&pdev->dev, true); ··· 1827 1902 device_init_wakeup(&pdev->dev, false); 1828 1903 ida_free(&port_ida, uport->line); 1829 1904 uart_remove_one_port(drv, uport); 1830 - goto error; 1905 + return ret; 1831 1906 } 1832 1907 } 1833 1908 1834 1909 return 0; 1835 - 1836 - error: 1837 - dev_pm_domain_detach_list(port->pd_list); 1838 - return ret; 1839 1910 } 1840 1911 1841 1912 static void qcom_geni_serial_remove(struct platform_device *pdev) ··· 1844 1923 device_init_wakeup(&pdev->dev, false); 1845 1924 ida_free(&port_ida, uport->line); 1846 1925 uart_remove_one_port(drv, &port->uport); 1847 - dev_pm_domain_detach_list(port->pd_list); 1848 - } 1849 - 1850 - static int __maybe_unused qcom_geni_serial_runtime_suspend(struct device *dev) 1851 - { 1852 - struct qcom_geni_serial_port *port = dev_get_drvdata(dev); 1853 - struct uart_port *uport = &port->uport; 1854 - int ret = 0; 1855 - 1856 - if (port->dev_data->power_state) 1857 - ret = port->dev_data->power_state(uport, false); 1858 - 1859 - return ret; 1860 - } 1861 - 1862 - static int __maybe_unused qcom_geni_serial_runtime_resume(struct device *dev) 1863 - { 1864 - struct qcom_geni_serial_port *port = dev_get_drvdata(dev); 1865 - struct uart_port *uport = &port->uport; 1866 - int ret = 0; 1867 - 1868 - if (port->dev_data->power_state) 1869 - ret = port->dev_data->power_state(uport, true); 1870 - 1871 - return ret; 1872 1926 } 1873 1927 1874 1928 static int qcom_geni_serial_suspend(struct device *dev) ··· 1881 1985 static const struct qcom_geni_device_data qcom_geni_console_data = { 1882 1986 .console = true, 1883 1987 .mode = GENI_SE_FIFO, 1884 - .resources_init = geni_serial_resource_init, 1885 - .set_rate = geni_serial_set_rate, 1886 - .power_state = geni_serial_resource_state, 1887 1988 }; 1888 1989 1889 1990 static const struct qcom_geni_device_data qcom_geni_uart_data = { 1890 1991 .console = false, 1891 1992 .mode = GENI_SE_DMA, 1892 - .resources_init = geni_serial_resource_init, 1893 - .set_rate = geni_serial_set_rate, 1894 - .power_state = geni_serial_resource_state, 1895 - }; 1896 - 1897 - static const struct qcom_geni_device_data sa8255p_qcom_geni_console_data = { 1898 - .console = true, 1899 - .mode = GENI_SE_FIFO, 1900 - .pd_data = { 1901 - .pd_flags = PD_FLAG_DEV_LINK_ON, 1902 - .pd_names = (const char*[]) { "power", "perf" }, 1903 - .num_pd_names = 2, 1904 - }, 1905 - .resources_init = geni_serial_pwr_init, 1906 - .set_rate = geni_serial_set_level, 1907 - }; 1908 - 1909 - static const struct qcom_geni_device_data sa8255p_qcom_geni_uart_data = { 1910 - .console = false, 1911 - .mode = GENI_SE_DMA, 1912 - .pd_data = { 1913 - .pd_flags = PD_FLAG_DEV_LINK_ON, 1914 - .pd_names = (const char*[]) { "power", "perf" }, 1915 - .num_pd_names = 2, 1916 - }, 1917 - .resources_init = geni_serial_pwr_init, 1918 - .set_rate = geni_serial_set_level, 1919 1993 }; 1920 1994 1921 1995 static const struct dev_pm_ops qcom_geni_serial_pm_ops = { 1922 - SET_RUNTIME_PM_OPS(qcom_geni_serial_runtime_suspend, 1923 - qcom_geni_serial_runtime_resume, NULL) 1924 1996 SYSTEM_SLEEP_PM_OPS(qcom_geni_serial_suspend, qcom_geni_serial_resume) 1925 1997 }; 1926 1998 ··· 1898 2034 .data = &qcom_geni_console_data, 1899 2035 }, 1900 2036 { 1901 - .compatible = "qcom,sa8255p-geni-debug-uart", 1902 - .data = &sa8255p_qcom_geni_console_data, 1903 - }, 1904 - { 1905 2037 .compatible = "qcom,geni-uart", 1906 2038 .data = &qcom_geni_uart_data, 1907 - }, 1908 - { 1909 - .compatible = "qcom,sa8255p-geni-uart", 1910 - .data = &sa8255p_qcom_geni_uart_data, 1911 2039 }, 1912 2040 {} 1913 2041 };