driver/misc: Add new driver for Avago ADJD-S371-QR999
PATCH 1/1 driver/misc: Add new driver for Avago ADJD-S371-QR999
Add new driver for Avago ADJD-S371-QR999 digital color sensor.
This driver has two functions.
1. raw_color
Gets color values of object.
2. trim_color
Gets color values of object except the influence of natural light.
Reset, sleep, external clock functions are not mandatory, so not implemented.
--- drivers/misc/Kconfig | 11 + drivers/misc/Makefile | 1 + drivers/misc/s371_qr999.c | 569 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 581 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/s371_qr999.c
drivers/misc/Kconfig +11 -0
@@ -292,6 +292,17 @@ config TI_DAC7512 This driver can also be built as a module. If so, the module will be calles ti_dac7512. +config S371_QR999 + tristate "Avago ADJD-S371-QR999" + depends on I2C && SYSFS + default n + help + If you say yes here, you get support for the Avago + ADJD-S371-QR999 digital color sensor. + + This driver can also be built as a module. If so, the module + will be called s371_qr999. + source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig"
drivers/misc/Makefile +1 -0
@@ -26,5 +26,6 @@ obj-$(CONFIG_DS1682) += ds1682.o obj-$(CONFIG_TI_DAC7512) += ti_dac7512.o obj-$(CONFIG_C2PORT) += c2port/ obj-$(CONFIG_IWMC3200TOP) += iwmc3200top/ +obj-$(CONFIG_S371_QR999) += s371_qr999.o obj-y += eeprom/ obj-y += cb710/
drivers/misc/s371_qr999.c new file +569 -0
569 lines not on this page · raw message
Signature · 1 line
1.6.3.3
Quoted 10 lines · On Sun, 14 Feb 2010 23:08:16 +0900 NISHIMOTO Hiroki <[email protected]> wrote:
Add new driver for Avago ADJD-S371-QR999 digital color sensor.
This driver has two functions.
1.raw_color
Gets color values of object.
2.trim_color
Gets color values of object except the influence of natural light.Reset, sleep, external clock functions are not mandatory, so not implemented.
There are quite a number of driver commands here which weren't documented. Please fully describe the proposed userspace interface within the changelog. Or, better, within a documentation file. Because the userspace interface is the most important part. It's the only thing we can never change.
It appears that the entire userspace interface for this driver is implemented via sysfs? This is odd - we used to have this thing called "/dev" for communicating with device drivers. What do people think about this?
The proposed sysfs interface appears to emit multiple values from a single sysfs file. This is considered to be against the sysfs design rules.
Note that all the above discusses the usersapce interface! Once we get that sorted out then we can start looking at the implementation.
Quoted 7 lines · NISHIMOTO Hiroki
+ * The main function of the ADJD-S371-QR999 is to detect color of object.
+ * If you need other functions led, reset, sleep, external clock,
+ * implement it youself by using gpio.
+ *
+ * ++ USAGE EXAMPLE ++
+ * + optimize the color value
+ * # echo 3 >/sys/devices/platform/s371_qr999/capacitor/xxx_cap
Quoted 8 lines
+ * # echo 1500 >
/sys/devices/platform/s371_qr999/integration/xxx_int
+ *
+ * + get color values
+ * # cat/sys/devices/platform/s371_qr999/raw_color
+ *
+ * + get color values except the influence of natural light
+ * # cat/sys/devices/platform/s371_qr999/trim_get
+ * # cat/sys/devices/platform/s371_qr999/trim_color
As you are adding new sysfs files, you have to add the proper entries in the Documentation/ABI/ directory as well.
Also, sysfs is ONE VALUE PER FILE, please do not do what you are doing here with multiple values per a single file, that is not acceptable.
Quoted 4 lines
+ * Data Sheet
+ * http://www.avagotech.com/docs/AV02-0314EN
+ * Application Note:
+ * http://www.avagotech.com/docs/AV02-0359EN
I would recommend working with the hwmon developers to develop a standard API for these types of devices, and use it instead of creating your own.
thanks,
greg k-h