Reputation: 159
I wrote a driver for ADC module which is the part of IIO subsystem. It read voltages of various hardware peripherals connected to specific channel, and these voltages can be read only from sysfs.
My problem is that, my charging driver also want to read data from ADC, but there are no such API exposed so that Charging driver can communicate with the IIO subsystem driver(Driver-Driver communication).
My solution - Is it ok to write a function which will in itself calculate the ADC voltage of specific channel, send the voltage to charging driver. It fetches device details(driver_find_device), can call the handler function for read operation.
Thanks in advance.
Upvotes: 1
Views: 992
Reputation: 2304
That is not true, there is a consumer API for in-kernel user. It is defined in linux/iio/consumer.h. Have a look at drivers/hwmon/ii_hwmon.c or drivers/power/axp288_fuel_gauge.cfor a usage exemple. You can also search for iio_read_channel_raw but I would suggest using the processed version that will definitively more portable.
Upvotes: 3