mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: Yegor Yefremov <yegorslists@googlemail.com>
Cc: linux-serial@vger.kernel.org,
	kernel list <linux-kernel@vger.kernel.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Giulio Benetti <giulio.benetti@micronovasrl.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH 3/3 v6] tty/serial/8250: use mctrl_gpio helpers
Date: Mon, 17 Jun 2019 14:42:00 +0200	[thread overview]
Message-ID: <d62c1a2b-3e24-c109-a7fb-57190388d75f@denx.de> (raw)
In-Reply-To: <CAGm1_ksdQ5CNLGGNzHKBNKeLE3ByHvPyOkjYNoWWM+rw0q214Q@mail.gmail.com>

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

  reply	other threads:[~2019-06-17 12:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-13 15:45 [PATCH 1/3 v6] serial: mctrl_gpio: Check if GPIO property exisits before requesting it Stefan Roese
2019-06-13 15:45 ` [PATCH 2/3 v6] serial: 8250: Add MSR/MCR TIOCM conversion wrapper functions Stefan Roese
2019-06-13 17:07   ` Andy Shevchenko
2019-06-13 18:32   ` Mika Westerberg
2019-06-13 15:45 ` [PATCH 3/3 v6] tty/serial/8250: use mctrl_gpio helpers Stefan Roese
2019-06-13 17:12   ` Andy Shevchenko
2019-06-13 18:34   ` Mika Westerberg
2019-06-17  9:40   ` Yegor Yefremov
2019-06-17  9:51     ` Yegor Yefremov
2019-06-17 12:42       ` Stefan Roese [this message]
2019-06-17 12:51         ` Yegor Yefremov
2019-06-13 17:08 ` [PATCH 1/3 v6] serial: mctrl_gpio: Check if GPIO property exisits before requesting it Andy Shevchenko
2019-06-14  9:04   ` Yegor Yefremov
2019-06-14  9:29     ` Stefan Roese
2019-06-14  9:38       ` Yegor Yefremov

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=d62c1a2b-3e24-c109-a7fb-57190388d75f@denx.de \
    --to=sr@denx.de \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=giulio.benetti@micronovasrl.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=yegorslists@googlemail.com \
    /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®