Re: [PATCH v2 11/11] staging: iio: tsl2x7x/tsl2772: move out of staging
On Thu, 3 May 2018 22:56:54 -0400 Brian Masneywrote: > Hey Jonathan, > > I intentionally didn't run git format-patch with the --no-renames since > patch 10 renamed the driver. Here is the .[ch] files included inline to > make your review easier. Thanks :) A few really minor things beyond that issue with the way the range is defined which came up in the earlier patch. So very nearly there! Jonathan > > Brian > > > tsl2772.c: > > // SPDX-License-Identifier: GPL-2.0+ > /* > * Device driver for monitoring ambient light intensity in (lux) and proximity > * detection (prox) for the TAOS TSL2571, TSL2671, TMD2671, TSL2771, TMD2771, > * TSL2572, TSL2672, TMD2672, TSL2772, and TMD2772 devices. > * > * Copyright (c) 2012, TAOS Corporation. > * Copyright (c) 2017-2018 Brian Masney > */ > > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > > /* Cal defs */ > #define PROX_STAT_CAL 0 > #define PROX_STAT_SAMP1 > #define MAX_SAMPLES_CAL 200 > > /* TSL2772 Device ID */ > #define TRITON_ID 0x00 > #define SWORDFISH_ID 0x30 > #define HALIBUT_ID0x20 > > /* Lux calculation constants */ > #define TSL2772_LUX_CALC_OVER_FLOW65535 > > /* > * TAOS Register definitions - Note: depending on device, some of these > register > * are not used and the register address is benign. > */ > > /* Register offsets */ > #define TSL2772_MAX_CONFIG_REG16 > > /* Device Registers and Masks */ > #define TSL2772_CNTRL 0x00 > #define TSL2772_ALS_TIME 0X01 > #define TSL2772_PRX_TIME 0x02 > #define TSL2772_WAIT_TIME 0x03 > #define TSL2772_ALS_MINTHRESHLO 0X04 > #define TSL2772_ALS_MINTHRESHHI 0X05 > #define TSL2772_ALS_MAXTHRESHLO 0X06 > #define TSL2772_ALS_MAXTHRESHHI 0X07 > #define TSL2772_PRX_MINTHRESHLO 0X08 > #define TSL2772_PRX_MINTHRESHHI 0X09 > #define TSL2772_PRX_MAXTHRESHLO 0X0A > #define TSL2772_PRX_MAXTHRESHHI 0X0B > #define TSL2772_PERSISTENCE 0x0C > #define TSL2772_ALS_PRX_CONFIG0x0D > #define TSL2772_PRX_COUNT 0x0E > #define TSL2772_GAIN 0x0F > #define TSL2772_NOTUSED 0x10 > #define TSL2772_REVID 0x11 > #define TSL2772_CHIPID0x12 > #define TSL2772_STATUS0x13 > #define TSL2772_ALS_CHAN0LO 0x14 > #define TSL2772_ALS_CHAN0HI 0x15 > #define TSL2772_ALS_CHAN1LO 0x16 > #define TSL2772_ALS_CHAN1HI 0x17 > #define TSL2772_PRX_LO0x18 > #define TSL2772_PRX_HI0x19 > > /* tsl2772 cmd reg masks */ > #define TSL2772_CMD_REG 0x80 > #define TSL2772_CMD_SPL_FN0x60 > #define TSL2772_CMD_REPEAT_PROTO 0x00 > #define TSL2772_CMD_AUTOINC_PROTO 0x20 > > #define TSL2772_CMD_PROX_INT_CLR 0X05 > #define TSL2772_CMD_ALS_INT_CLR 0x06 > #define TSL2772_CMD_PROXALS_INT_CLR 0X07 > > /* tsl2772 cntrl reg masks */ > #define TSL2772_CNTL_ADC_ENBL 0x02 > #define TSL2772_CNTL_PWR_ON 0x01 > > /* tsl2772 status reg masks */ > #define TSL2772_STA_ADC_VALID 0x01 > #define TSL2772_STA_PRX_VALID 0x02 > #define TSL2772_STA_ADC_PRX_VALID (TSL2772_STA_ADC_VALID | \ >TSL2772_STA_PRX_VALID) > #define TSL2772_STA_ALS_INTR 0x10 > #define TSL2772_STA_PRX_INTR 0x20 > > /* tsl2772 cntrl reg masks */ > #define TSL2772_CNTL_REG_CLEAR0x00 > #define TSL2772_CNTL_PROX_INT_ENBL0X20 > #define TSL2772_CNTL_ALS_INT_ENBL 0X10 > #define TSL2772_CNTL_WAIT_TMR_ENBL0X08 > #define TSL2772_CNTL_PROX_DET_ENBL0X04 > #define TSL2772_CNTL_PWRON0x01 > #define TSL2772_CNTL_ALSPON_ENBL 0x03 > #define TSL2772_CNTL_INTALSPON_ENBL 0x13 > #define TSL2772_CNTL_PROXPON_ENBL 0x0F > #define TSL2772_CNTL_INTPROXPON_ENBL 0x2F > > /* TAOS Device family members */ > enum { > tsl2571, > tsl2671, > tmd2671, > tsl2771, > tmd2771, > tsl2572, > tsl2672, > tmd2672, > tsl2772, > tmd2772 > }; > > enum { > TSL2772_CHIP_UNKNOWN = 0, > TSL2772_CHIP_WORKING = 1, > TSL2772_CHIP_SUSPENDED = 2 > }; > > /* Per-device data */ > struct tsl2772_als_info { > u16 als_ch0; > u16 als_ch1; > u16 lux; > }; > > struct tsl2772_chip_info { > int chan_table_elements; > struct iio_chan_spec channel_with_events[4]; > struct iio_chan_spec channel_without_events[4]; > const struct iio_info *info; > }; > > struct tsl2772_chip { >
Re: [PATCH v2 11/11] staging: iio: tsl2x7x/tsl2772: move out of staging
Hey Jonathan, I intentionally didn't run git format-patch with the --no-renames since patch 10 renamed the driver. Here is the .[ch] files included inline to make your review easier. Brian tsl2772.c: // SPDX-License-Identifier: GPL-2.0+ /* * Device driver for monitoring ambient light intensity in (lux) and proximity * detection (prox) for the TAOS TSL2571, TSL2671, TMD2671, TSL2771, TMD2771, * TSL2572, TSL2672, TMD2672, TSL2772, and TMD2772 devices. * * Copyright (c) 2012, TAOS Corporation. * Copyright (c) 2017-2018 Brian Masney*/ #include #include #include #include #include #include #include #include #include #include #include #include /* Cal defs */ #define PROX_STAT_CAL 0 #define PROX_STAT_SAMP 1 #define MAX_SAMPLES_CAL 200 /* TSL2772 Device ID */ #define TRITON_ID 0x00 #define SWORDFISH_ID0x30 #define HALIBUT_ID 0x20 /* Lux calculation constants */ #define TSL2772_LUX_CALC_OVER_FLOW 65535 /* * TAOS Register definitions - Note: depending on device, some of these register * are not used and the register address is benign. */ /* Register offsets */ #define TSL2772_MAX_CONFIG_REG 16 /* Device Registers and Masks */ #define TSL2772_CNTRL 0x00 #define TSL2772_ALS_TIME0X01 #define TSL2772_PRX_TIME0x02 #define TSL2772_WAIT_TIME 0x03 #define TSL2772_ALS_MINTHRESHLO 0X04 #define TSL2772_ALS_MINTHRESHHI 0X05 #define TSL2772_ALS_MAXTHRESHLO 0X06 #define TSL2772_ALS_MAXTHRESHHI 0X07 #define TSL2772_PRX_MINTHRESHLO 0X08 #define TSL2772_PRX_MINTHRESHHI 0X09 #define TSL2772_PRX_MAXTHRESHLO 0X0A #define TSL2772_PRX_MAXTHRESHHI 0X0B #define TSL2772_PERSISTENCE 0x0C #define TSL2772_ALS_PRX_CONFIG 0x0D #define TSL2772_PRX_COUNT 0x0E #define TSL2772_GAIN0x0F #define TSL2772_NOTUSED 0x10 #define TSL2772_REVID 0x11 #define TSL2772_CHIPID 0x12 #define TSL2772_STATUS 0x13 #define TSL2772_ALS_CHAN0LO 0x14 #define TSL2772_ALS_CHAN0HI 0x15 #define TSL2772_ALS_CHAN1LO 0x16 #define TSL2772_ALS_CHAN1HI 0x17 #define TSL2772_PRX_LO 0x18 #define TSL2772_PRX_HI 0x19 /* tsl2772 cmd reg masks */ #define TSL2772_CMD_REG 0x80 #define TSL2772_CMD_SPL_FN 0x60 #define TSL2772_CMD_REPEAT_PROTO0x00 #define TSL2772_CMD_AUTOINC_PROTO 0x20 #define TSL2772_CMD_PROX_INT_CLR0X05 #define TSL2772_CMD_ALS_INT_CLR 0x06 #define TSL2772_CMD_PROXALS_INT_CLR 0X07 /* tsl2772 cntrl reg masks */ #define TSL2772_CNTL_ADC_ENBL 0x02 #define TSL2772_CNTL_PWR_ON 0x01 /* tsl2772 status reg masks */ #define TSL2772_STA_ADC_VALID 0x01 #define TSL2772_STA_PRX_VALID 0x02 #define TSL2772_STA_ADC_PRX_VALID (TSL2772_STA_ADC_VALID | \ TSL2772_STA_PRX_VALID) #define TSL2772_STA_ALS_INTR0x10 #define TSL2772_STA_PRX_INTR0x20 /* tsl2772 cntrl reg masks */ #define TSL2772_CNTL_REG_CLEAR 0x00 #define TSL2772_CNTL_PROX_INT_ENBL 0X20 #define TSL2772_CNTL_ALS_INT_ENBL 0X10 #define TSL2772_CNTL_WAIT_TMR_ENBL 0X08 #define TSL2772_CNTL_PROX_DET_ENBL 0X04 #define TSL2772_CNTL_PWRON 0x01 #define TSL2772_CNTL_ALSPON_ENBL0x03 #define TSL2772_CNTL_INTALSPON_ENBL 0x13 #define TSL2772_CNTL_PROXPON_ENBL 0x0F #define TSL2772_CNTL_INTPROXPON_ENBL0x2F /* TAOS Device family members */ enum { tsl2571, tsl2671, tmd2671, tsl2771, tmd2771, tsl2572, tsl2672, tmd2672, tsl2772, tmd2772 }; enum { TSL2772_CHIP_UNKNOWN = 0, TSL2772_CHIP_WORKING = 1, TSL2772_CHIP_SUSPENDED = 2 }; /* Per-device data */ struct tsl2772_als_info { u16 als_ch0; u16 als_ch1; u16 lux; }; struct tsl2772_chip_info { int chan_table_elements; struct iio_chan_spec channel_with_events[4]; struct iio_chan_spec channel_without_events[4]; const struct iio_info *info; }; struct tsl2772_chip { kernel_ulong_t id; struct mutex prox_mutex; struct mutex als_mutex; struct i2c_client *client; u16 prox_data; struct tsl2772_als_info als_cur_info; struct tsl2772_settings settings; struct tsl2772_platform_data *pdata; int als_gain_time_scale; int als_saturation; int tsl2772_chip_status; u8 tsl2772_config[TSL2772_MAX_CONFIG_REG]; const struct tsl2772_chip_info *chip_info; const struct iio_info *info; s64 event_timestamp;
[PATCH v2 11/11] staging: iio: tsl2x7x/tsl2772: move out of staging
Move the tsl2772 driver out of staging and into mainline. Signed-off-by: Brian Masney--- drivers/iio/light/Kconfig | 8 drivers/iio/light/Makefile | 1 + drivers/{staging => }/iio/light/tsl2772.c | 2 +- drivers/staging/iio/Kconfig| 1 - drivers/staging/iio/Makefile | 1 - drivers/staging/iio/light/Kconfig | 14 -- drivers/staging/iio/light/Makefile | 5 - .../iio/light => include/linux/platform_data}/tsl2772.h| 0 8 files changed, 10 insertions(+), 22 deletions(-) rename drivers/{staging => }/iio/light/tsl2772.c (99%) delete mode 100644 drivers/staging/iio/light/Kconfig delete mode 100644 drivers/staging/iio/light/Makefile rename {drivers/staging/iio/light => include/linux/platform_data}/tsl2772.h (100%) diff --git a/drivers/iio/light/Kconfig b/drivers/iio/light/Kconfig index 074e50657366..c7ef8d1862d6 100644 --- a/drivers/iio/light/Kconfig +++ b/drivers/iio/light/Kconfig @@ -409,6 +409,14 @@ config TSL2583 Provides support for the TAOS tsl2580, tsl2581 and tsl2583 devices. Access ALS data via iio, sysfs. +config TSL2772 + tristate "TAOS TSL/TMD2x71 and TSL/TMD2x72 Family of light and proximity sensors" + depends on I2C + help +Support for: tsl2571, tsl2671, tmd2671, tsl2771, tmd2771, tsl2572, tsl2672, +tmd2672, tsl2772, tmd2772 devices. +Provides iio_events and direct access via sysfs. + config TSL4531 tristate "TAOS TSL4531 ambient light sensors" depends on I2C diff --git a/drivers/iio/light/Makefile b/drivers/iio/light/Makefile index f1777036d4f8..80943af5d627 100644 --- a/drivers/iio/light/Makefile +++ b/drivers/iio/light/Makefile @@ -40,6 +40,7 @@ obj-$(CONFIG_ST_UVIS25_SPI) += st_uvis25_spi.o obj-$(CONFIG_TCS3414) += tcs3414.o obj-$(CONFIG_TCS3472) += tcs3472.o obj-$(CONFIG_TSL2583) += tsl2583.o +obj-$(CONFIG_TSL2772) += tsl2772.o obj-$(CONFIG_TSL4531) += tsl4531.o obj-$(CONFIG_US5182D) += us5182d.o obj-$(CONFIG_VCNL4000) += vcnl4000.o diff --git a/drivers/staging/iio/light/tsl2772.c b/drivers/iio/light/tsl2772.c similarity index 99% rename from drivers/staging/iio/light/tsl2772.c rename to drivers/iio/light/tsl2772.c index 146527e41969..7ed72c98ce1a 100644 --- a/drivers/staging/iio/light/tsl2772.c +++ b/drivers/iio/light/tsl2772.c @@ -19,7 +19,7 @@ #include #include #include -#include "tsl2772.h" +#include /* Cal defs */ #define PROX_STAT_CAL 0 diff --git a/drivers/staging/iio/Kconfig b/drivers/staging/iio/Kconfig index 8abc1ab3c0c7..ca001510782d 100644 --- a/drivers/staging/iio/Kconfig +++ b/drivers/staging/iio/Kconfig @@ -11,7 +11,6 @@ source "drivers/staging/iio/cdc/Kconfig" source "drivers/staging/iio/frequency/Kconfig" source "drivers/staging/iio/gyro/Kconfig" source "drivers/staging/iio/impedance-analyzer/Kconfig" -source "drivers/staging/iio/light/Kconfig" source "drivers/staging/iio/meter/Kconfig" source "drivers/staging/iio/resolver/Kconfig" source "drivers/staging/iio/trigger/Kconfig" diff --git a/drivers/staging/iio/Makefile b/drivers/staging/iio/Makefile index 455bffc29649..5c168403b873 100644 --- a/drivers/staging/iio/Makefile +++ b/drivers/staging/iio/Makefile @@ -10,7 +10,6 @@ obj-y += cdc/ obj-y += frequency/ obj-y += gyro/ obj-y += impedance-analyzer/ -obj-y += light/ obj-y += meter/ obj-y += resolver/ obj-y += trigger/ diff --git a/drivers/staging/iio/light/Kconfig b/drivers/staging/iio/light/Kconfig deleted file mode 100644 index dfa37386ad2c.. --- a/drivers/staging/iio/light/Kconfig +++ /dev/null @@ -1,14 +0,0 @@ -# -# Light sensors -# -menu "Light sensors" - -config TSL2772 - tristate "TAOS TSL/TMD2x71 and TSL/TMD2x72 Family of light and proximity sensors" - depends on I2C - help -Support for: tsl2571, tsl2671, tmd2671, tsl2771, tmd2771, tsl2572, tsl2672, -tmd2672, tsl2772, tmd2772 devices. -Provides iio_events and direct access via sysfs. - -endmenu diff --git a/drivers/staging/iio/light/Makefile b/drivers/staging/iio/light/Makefile deleted file mode 100644 index e7e77a11f02a.. --- a/drivers/staging/iio/light/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# -# Makefile for industrial I/O Light sensors -# - -obj-$(CONFIG_TSL2772) += tsl2772.o diff --git a/drivers/staging/iio/light/tsl2772.h b/include/linux/platform_data/tsl2772.h similarity index 100% rename from drivers/staging/iio/light/tsl2772.h rename to include/linux/platform_data/tsl2772.h -- 2.14.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel