Skip to contentSkip to conversation

Extcon: adc-jack driver to support 3.5 pi or simliar devices

PATCH MyungJoo Ham 2 participants 2 messages Feb 14, 2012

lore
Share & tools
lore
#0 lore raw
Quoted 17 lines · Mark Brown
Quoted 8 lines · MyungJoo Ham
Quoted 5 lines · Mark Brown
Quoted 4 lines · MyungJoo Ham

External connector devices that decides connection information based on ADC values may use adc-jack device driver. The user simply needs to provide a table of adc range and connection states. Then, extcon framework will automatically notify others.

Quoted 5 lines
Quoted 1 line

This really should be done in terms of the IIO in-kernel framework.

The ADC part may be done in IIO. However, the intention of this device driver is to provide extcon interface to any ADC drivers, not providing an ADC device driver. If we are going to implement this in

Right, exactly.

Quoted 8 lines
Quoted 2 lines

the ADC driver in IIO, we will need to write the given code in every ADC driver used for analog ports.

No, that's not what I'm suggesting - what I'm suggesting is that rather than having a callback for implementing the ADC read functionality this should work as an in-kernel IIO driver so it'll just automatically work with any ADC without needing code to hook things up. Unless I've not understood your comment fully.

Ok. Do you mean that we should give struct iio_dev * and struct iio_chan_spec * instead of a callback?
I thought there was no standard framework for ADC (the reason why this is a simple callback); however, may I regard iio/adc as the standard for ADC? (I see some ADC device drivers in HWMON)

Do I need to make this driver as an iio device driver in order to do this? I guess including iio.h would be enough anyway.

Quoted 12 lines
Quoted 11 lines
Quoted 7 lines

Review

Quoted 5 lines
(quoted diff) +4 -0
+     /* Check the length of array and set num_cables */
+     for (i = 0; data->edev.supported_cable[i]; i++)
+             ;
+     if (i == 0 || i > SUPPORTED_CABLE_MAX) {

Can we not avoid the hard limit?

Without that limit, we won't be able to easily express binary cable status (u32) with the extcon framework. At least, we will need to forget about setting the status with u32 values.

Quoted 7 lines
Quoted 1 line

Anyway, I can remove the checking SUPPORT_CABLE_MAX part at probe.

It might be clearer to make the limit more obviously associated with the bitmask - it looks like it's an array thing the way the code is written but a limit due to using a bitmask seems reasonable.

Ah.. I'll add a comment or update the error message associated.

Cheers!
MyungJoo.

�淸�{.n�+돴윯돪�+%듚�깁負쪐w��{.n�+돴쪐{깸G쳺��{ay����,j�f"톒쉹��묎�z_溫(�쉸듶줷"얎�m����G쳺�◀?솳鈺�&x�~뤳턨O뺞촾퇉v�^�m��� �띠�◀?뻀�

#1 lore raw
Quoted 8 lines · MyungJoo Ham
Quoted 5 lines · Mark Brown

No, that's not what I'm suggesting - what I'm suggesting is that rather than having a callback for implementing the ADC read functionality this should work as an in-kernel IIO driver so it'll just automatically work with any ADC without needing code to hook things up. Unless I've not understood your comment fully.

Quoted 5 lines

Ok. Do you mean that we should give struct iio_dev * and struct iio_chan_spec * instead of a callback? I thought there was no standard framework for ADC (the reason why this is a simple callback); however, may I regard iio/adc as the standard for ADC? (I see some ADC device drivers in HWMON)

Yes, the idea is that IIO becomes the standard way of using general purpose ADCs like this in the kernel rather than having lots of similar custom APIs floating around with callbacks as we do now.

Quoted 1 line

Do I need to make this driver as an iio device driver in order to do this? I guess including iio.h would be enough anyway.

I'd not expect so, I'd expect it's just a user of IIO.