Re: [PATCH RFC] usb: typec: tipd: Add support for polling interrupts status when interrupt line is not connected

From: Aswath Govindraju
Date: Wed Apr 13 2022 - 06:48:22 EST


Hi Heikki,

On 13/04/22 16:07, Heikki Krogerus wrote:
> On Wed, Apr 13, 2022 at 03:32:50PM +0530, Aswath Govindraju wrote:
>> Hi Heikki,
>>
>> On 13/04/22 15:04, Heikki Krogerus wrote:
>>> Hi Aswath,
>>>
>>> On Tue, Apr 12, 2022 at 08:20:58PM +0530, Aswath Govindraju wrote:
>>>> In some cases the interrupt line from the pd controller may not be
>>>> connected. In these cases, poll the status of various events.
>>>
>>> Well, if the alert/interrupt line is not connected anywhere, then
>>> polling is the only way to go. I'm fine with that, but the driver
>>> really should be told that there is no interrupt. Using polling
>>> whenever request_threaded_irq() returns -EINVAL is wrong. We really
>>> should not even attempt to request the interrupt if there is no
>>> interrupt for the device.
>>>
>>> Isn't there any way you can get that information from DT? Or how is
>>> the device enumerated in your case?
>>>
>>
>> Would checking if (client->irq) field is populated, to decide between
>> polling and interrupts be a good approach?
>>
>> I am sorry but I did not understand what you meant by device getting
>> enumerated. The device is on an I2C bus and gets enumerated based on the
>> I2C address provided. The device does not have I2C_IRQ line connected,
>> in my case.
>
> "I2C devices are not enumerated at hardware level":
> https://www.kernel.org/doc/html/latest/i2c/instantiating-devices.html
>
> So your PD controller I2C slave device has to be either described in
> Devicetree or ACPI tables, or there is a board file or platform driver
> that actually populates the device for it.
>
> Can you tell a little bit about the platform you are running? Is it
> ARM, x86, or what, and is it ACPI or DT platform?
>

Got it. Currently I am testing on a ARM platform and the I2C device tree
nodes are populated in the device tree. This is how the PD controller
gets enumerated.


> thanks,
>


--
Thanks,
Aswath