Closed PabloPL closed 3 years ago
Patches send to mainline for review.
Mainline review complete; in order to add light sensor part the driver needs to be converted to an IIO driver. See very similarily named gp2a020... driver as an example of the interfaces needed.
I wonder if existing gp2ap020a00f driver wouldn't work with our hw (maybe it's just a matter of adding new compatible to it) - didn't tested it, just a idea.
I did test it as I initially thought it was the same hardware :)
It doesn't work as the light sensor method is totally different - on the 020 it appears to have some sort of internal ADC while the 002 relies on an external ADC
IIO driver for GP2A is created at https://github.com/PabloPL/linux/tree/for-upstream/gp2a-iio
However, the IIO driver should probably have a scale added to it for the light channel - in Android at https://github.com/xc-racer99/android_device_samsung_aries-common/blob/unlegacy-4.4/libsensors/LightSensor.cpp#L120 there is a function that converts things, but this appears to be device-specific
For reference only - there is another work on such device driver (done by Linus Walleij) https://patchwork.kernel.org/patch/11311631/ https://patchwork.kernel.org/patch/11311635/
For reference only - there is another work on such device driver (done by Linus Walleij) https://patchwork.kernel.org/patch/11311631/ https://patchwork.kernel.org/patch/11311635/
Yes, unfortunately we will need to add to the driver as our device reads an analog voltage while the drivers conversion to lux is from the raw current. Probably just need to figure out what the resistor value that the current goes through is and add that as a DT property.
GP2A IIO driver is merged upstream, as are DTS changes.
Changes already done on brach for-upstream/gp2a, need to send them to mainline