lkml.org 
[lkml]   [2019]   [Jun]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 3/3 v6] tty/serial/8250: use mctrl_gpio helpers
From
Date
On 17.06.19 11:51, Yegor Yefremov wrote:

<snip>

>>> @@ -1944,11 +1948,15 @@ unsigned int serial8250_do_get_mctrl(struct uart_port *port)
>>> {
>>> struct uart_8250_port *up = up_to_u8250p(port);
>>> unsigned int status;
>>> + unsigned int val = 0;
>>>
>>> serial8250_rpm_get(up);
>>> status = serial8250_modem_status(up);
>>> serial8250_rpm_put(up);
>>>
>>> + if (up->gpios)
>>> + return mctrl_gpio_get(up->gpios, &val);
>>> +
>>
>> What happens when you have a mixed setup i.e. CTS controlled by UART
>> but other status pins controlled by GPIO? In this case CTS status
>> won't be returned. Do I see it right?

Yes, your analysis does seem to be correct. Please note that I did
not intentionally did change it this way. I was not thinking about
such a "mixed design".

> What about something like this:
>
> unsigned int serial8250_do_get_mctrl(struct uart_port *port)
> {
> struct uart_8250_port *up = up_to_u8250p(port);
> unsigned int status;
> unsigned int val;
>
> serial8250_rpm_get(up);
> status = serial8250_modem_status(up);
> serial8250_rpm_put(up);
>
> val = serial8250_MSR_to_TIOCM(status);
> if (up->gpios)
> mctrl_gpio_get(up->gpios, &val);
>
> return val;
> }

Looks good to me, thanks. Do you have such a setup with some modem
control signal handled via GPIO and some via the UART? Could you
test such a change?

Thanks,
Stefan

\
 
 \ /
  Last update: 2019-06-17 14:42    [W:0.070 / U:2.368 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site