>-----Original Message-----
>From: Nathan Hartman <hartman.nat...@gmail.com>
>Sent: 16 September 2022 12:37
>
>On Fri, Sep 16, 2022 at 7:33 AM TimH <t...@jti.uk.com.invalid> wrote:
>
>> >From: Nathan Hartman <hartman.nat...@gmail.com>
>> >Sent: 16 September 2022 12:31
>> >To: dev@nuttx.apache.org
>> >Subject: Re: ADC device close and IRQ
>> >
>> >On Fri, Sep 16, 2022 at 7:20 AM TimH <t...@jti.uk.com.invalid> wrote:
>> >
>> >> Actually a little more complicated as the detach and disable in adc
>> >> close then kills the touch screen driver as well (it uses the ADC).
>> >> l'll figure out a way, I'm sure!
>> >
>> >
>> >
>> >I haven't looked at the code, but it sounds like any driver being
>> >closed
>> shuts
>> >down the ADC for all drivers.
>> >
>> >Instead, the driver should keep a reference count. The underlying
>> >hardware should be initialized when the first instance of the driver
>> >is opened and
>> un-
>> >initialized only when the last instance of the driver is closed.
>> >
>> >Cheers
>> >Nathan
>>
>> At present (by default/out of the box) there are two drivers - one for
>> the TS, registered as /dev/input0, the other for the ADC, as
>> /dev/adc0. There are, indeed, counts for each separate driver, but no
>"cross-coupling".
>>
>> Perhaps the TS driver needs to be rolled into the ADC driver for this chip?
>
>
>
>If it's using the same physical hardware peripheral then they will indeed need
>to be coordinated somehow, or combined. Not sure what specifically to
>suggest here.
>
>Nathan

Since all SAMA5Dx devices provide touchscreen support using the built-in ADC 
there is definitely an argument to move the touchscreen code into the ADC code. 
It will need a Kconfig bool to enable/disable this built-in support, as there 
is no reason a given design might not use an external TS controller chip - the 
built-in ADC support is only for resistive touchscreens, so any capacitive type 
will still need the external device, for example.

Reply via email to