iio: light: Add a driver for Sharp GP2AP002x00F
authorLinus Walleij <linus.walleij@linaro.org>
Sun, 26 Jan 2020 15:05:48 +0000 (16:05 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Fri, 14 Feb 2020 12:08:19 +0000 (12:08 +0000)
commit97d642e23037c5545266f9564c9b81e6db81b122
tree901e854d69b60f8b66013aa012abb39b1d867b71
parenta2ff6e0347a9f1cbf930a1b121027c950c68c4ea
iio: light: Add a driver for Sharp GP2AP002x00F

This driver handles two different Sharp sensors that have been
proposed for merging to the mainline kernel over the years, and
already has a limited proximity-only driver in the input
subsystem.

These components are completely different from the confusingly
similarly named Sharp GP2AP020A00F, for which we have a driver
in drivers/iio/light/gp2ap020a00f.c

The two components GP2AP002A00F and GP2AP002S00F are
distinctively different but similar: they share the same set of
registers but differ slightly in the I2C protocol.

Instead of the approach by the previous input driver, we create
a combined IIO proximity and light sensor driver.

The plan is to merge this driver and delete the input driver.

The pieces for the driver are picked all over the place after
researching and grepping through a few different vendor trees
and driver submissions.

We merge it under the light sensors because:

- It has similarities with the Capella CM3605 light sensor and
  proximity driver which is there.

- It is related to the GP2AP020A00F driver which is also there.

This driver was tested with the Samsung GT-S7710 mobile phone
which has the GP2AP002S00F proximity sensor mounted.

The suspend/resume cycle will disable the interrupt from the
sensor. If someone would desire to use this interrupt for
wakeup, the driver will need modifications.

Cc: Stephan Gerhold <stephan@gerhold.net>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
Cc: Jonathan Bakker <xc-racer2@live.ca>
Cc: Oskar Andero <oskar.andero@gmail.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Tested-by: Jonathan Bakker <xc-racer2@live.ca>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
MAINTAINERS
drivers/iio/light/Kconfig
drivers/iio/light/Makefile
drivers/iio/light/gp2ap002.c [new file with mode: 0644]