Re: [PATCH v5 2/3] tty: serial: qcom_geni_serial: Wakeup over UART RX

Akash Asthana
2019-11-15T10:00:54Z

On 11/14/2019 11:10 PM, Stephen Boyd wrote:
> Quoting Akash Asthana (2019-11-13 02:48:56)
>> Add system wakeup capability over UART RX line for wakeup capable UART.
>> When system is suspended, RX line act as an interrupt to wakeup system
>> for any communication requests from peer.
> How does the RX line get remuxed as a GPIO interrupt here? Is that
> through some pinctrl magic in DT or just via enabling/disabling the
> interrupt?
Yes, For wakeup capable UART node, we have registered UART RX line with
TLMM interrupt controller in DT file . Example: if GPIO48 is UART RX line

interrupts-extended =  <&intc GIC_SPI 607 IRQ_TYPE_LEVEL_HIGH>,  <&tlmm
48 IRQ_TYPE_EDGE_FALLING>;
>
>> diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
>> index 634054a..56dad67 100644
>> --- a/drivers/tty/serial/qcom_geni_serial.c
>> +++ b/drivers/tty/serial/qcom_geni_serial.c
>> @@ -1321,6 +1327,23 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
>> return ret;
>> }
>>
>> + if (port->wakeup_irq > 0) {
>> + /*
>> + * Set pm_runtime status as ACTIVE so that wakeup_irq gets
>> + * enabled/disabled from dev_pm_arm_wake_irq during system
>> + * suspend/resume respectively.
>> + */
>> + pm_runtime_set_active(&pdev->dev);
> We can always set this device as active regardless of wakeup interrupt,
> right? Can we move this call outside of this if?
Ok, Yes we can move this call outside of if. I will update in next version.
>
>> + device_init_wakeup(&pdev->dev, true);
>> + ret = dev_pm_set_dedicated_wake_irq(&pdev->dev,
>> + port->wakeup_irq);
>> + if (ret) {
>> + device_init_wakeup(&pdev->dev, false);
>> + uart_remove_one_port(drv, uport);
>> + return ret;
>> + }
>> + }
>> +
>> return ret;
>> }
>>