1

while implementing linux kernel driver for proximity and luminosity sensing semiconductor having LED current regulator allowing adjust distance measurement effectiveness against environmental light disturbance, would like to support read_raw/write_raw methods to be able to get/set current regulator value. the channel type is set to IIO_PROXIMITY now. what is the appropriate way to define LED current: over channel info enum to apply for this type of settings? available choices are:

enum iio_chan_info_enum {
    IIO_CHAN_INFO_RAW = 0,
    IIO_CHAN_INFO_PROCESSED,
    IIO_CHAN_INFO_SCALE,
    IIO_CHAN_INFO_OFFSET,
    IIO_CHAN_INFO_CALIBSCALE,
    IIO_CHAN_INFO_CALIBBIAS,
    IIO_CHAN_INFO_PEAK,
    IIO_CHAN_INFO_PEAK_SCALE,
    IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW,
    IIO_CHAN_INFO_AVERAGE_RAW,
    IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY,
    IIO_CHAN_INFO_HIGH_PASS_FILTER_3DB_FREQUENCY,
    IIO_CHAN_INFO_SAMP_FREQ,
    IIO_CHAN_INFO_FREQUENCY,
    IIO_CHAN_INFO_PHASE,
    IIO_CHAN_INFO_HARDWAREGAIN,
    IIO_CHAN_INFO_HYSTERESIS,
    IIO_CHAN_INFO_INT_TIME,
    IIO_CHAN_INFO_ENABLE,
    IIO_CHAN_INFO_CALIBHEIGHT,
    IIO_CHAN_INFO_CALIBWEIGHT,
    IIO_CHAN_INFO_DEBOUNCE_COUNT,
    IIO_CHAN_INFO_DEBOUNCE_TIME,
    IIO_CHAN_INFO_CALIBEMISSIVITY,
    IIO_CHAN_INFO_OVERSAMPLING_RATIO,
};

is it an IIO_CHAN_INFO_HARDWAREGAIN one? or perhaps it's better to define an individual LED current channel type from the following choices:

enum iio_chan_type { IIO_VOLTAGE, IIO_CURRENT, IIO_POWER, IIO_ACCEL, IIO_ANGL_VEL, IIO_MAGN, IIO_LIGHT, IIO_INTENSITY, IIO_PROXIMITY, IIO_TEMP, IIO_INCLI, IIO_ROT, IIO_ANGL, IIO_TIMESTAMP, IIO_CAPACITANCE, IIO_ALTVOLTAGE, IIO_CCT, IIO_PRESSURE, IIO_HUMIDITYRELATIVE, IIO_ACTIVITY, IIO_STEPS, IIO_ENERGY, IIO_DISTANCE, IIO_VELOCITY, IIO_CONCENTRATION, IIO_RESISTANCE, }; while using IIO_CURRENT one for the type then using IIO_CHAN_INFO_RAW for the info?

Oleg Kokorin
  • 2,288
  • 2
  • 16
  • 28
  • 1
    None. LED drivers (in hardware terms) are drived (in software, i.e. Linux kernel) by LED framework. Check *drivers/leds/...*. And I'm 90% sure that one you are trying to use already has a driver there. – 0andriy May 12 '18 at 19:28
  • it's a standalone proximity measurement chip. integrated register for IR led current regulator having impact on proximity measurement. – Oleg Kokorin May 13 '18 at 09:02
  • Update your question accordingly. Don’t forget to mention the chip you’re working on. Best is the link to data sheet. – 0andriy May 13 '18 at 10:43
  • don't want the question to go south by discussing what datasheet info is right or wrong or if current has to be regulated or not, etc. the question is simple as is: the enum is missing current regulator type, perhaps it meant to be HARDWAREGAIN at the moment of definition. perhaps it's just missing. – Oleg Kokorin May 13 '18 at 11:42
  • with such (dumb) "secrecy" and attitude we will go nowhere. Actually to the my first comment. You are using wrong framework. There is no single evidence that's I'm mistaken. – 0andriy May 13 '18 at 15:33
  • I would recommend to see how the rest of proximity sensors are coping with that (hint: via additional attribute, not related to IIO framework). – 0andriy May 14 '18 at 21:44

0 Answers0