Own kernel driver with usage of hwmon driver

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Own kernel driver with usage of hwmon driver

462 Views
MicMoba
Contributor V

My board has two 4ch 8bit I2C-ADC devices for monitoring some board voltages. Now I set up the DT with the driver of my ADC and I have access to the values by sysfs. But sysfs only gives the raw digit values (0-254). I want to write a driver that have access to the ADC, convert the digit values to voltage values and write them to the sysfs.

Is it possible to organize that similar to the gpio-controller?

 

DT
 +-> I2C
  |      +-> ADC1
  |      +-> ADC2
 +-> MyDriver
            +-> Board Voltage (ADC1, ch2)
            +-> 5V0-Line (ADC1, ch4)
            +-> 3V3-Line (ADC2, ch0)
            ...

Are there other possibilities to do such things?

 

0 Kudos
1 Reply

402 Views
igorpadykov
NXP Employee
NXP Employee

Hi Michael

 

one can look at description of adc driver in sect.4.1 ADC   i.MX Linux Reference Manual​

and try to change function vf610_read_raw() output to voltage values

https://source.codeaurora.org/external/imx/linux-imx/tree/drivers/iio/adc/vf610_adc.c?h=lf-5.10.y

 

Best regards
igor

0 Kudos