Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: light: vcnl4000: add support for Capella CM36686 and CM36672P

Add support for Capella's CM36686 and CM36672P sensors. Capella
CM36686 is an ambient light and proximity sensor that is fully
compatible with VCNL4040 and can be used as is.
CM36672P is partially compatible with VCNL4040 - it uses the same
register fields for proximity sensing, but the ambient light registers
are reserved. For CM36672P, we reuse vcnl4040_channels, but remove the
IIO_LIGHT channel and ambient light integration time.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Erikas Bitovtas and committed by
Jonathan Cameron
e3310a32 f48bfc82

+41
+41
drivers/iio/light/vcnl4000.c
··· 185 185 #define VCNL4000_SLEEP_DELAY_MS 2000 /* before we enter pm_runtime_suspend */ 186 186 187 187 enum vcnl4000_device_ids { 188 + CM36672P, 188 189 VCNL4000, 189 190 VCNL4010, 190 191 VCNL4040, ··· 236 235 }; 237 236 238 237 static const struct i2c_device_id vcnl4000_id[] = { 238 + { "cm36672p", CM36672P }, 239 + { "cm36686", VCNL4040 }, 239 240 { "vcnl4000", VCNL4000 }, 240 241 { "vcnl4010", VCNL4010 }, 241 242 { "vcnl4020", VCNL4010 }, ··· 1845 1842 } 1846 1843 }; 1847 1844 1845 + static const struct iio_chan_spec cm36672p_channels[] = { 1846 + { 1847 + .type = IIO_PROXIMITY, 1848 + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | 1849 + BIT(IIO_CHAN_INFO_INT_TIME) | 1850 + BIT(IIO_CHAN_INFO_OVERSAMPLING_RATIO) | 1851 + BIT(IIO_CHAN_INFO_CALIBBIAS), 1852 + .info_mask_separate_available = BIT(IIO_CHAN_INFO_INT_TIME) | 1853 + BIT(IIO_CHAN_INFO_OVERSAMPLING_RATIO) | 1854 + BIT(IIO_CHAN_INFO_CALIBBIAS), 1855 + .ext_info = vcnl4000_ext_info, 1856 + .event_spec = vcnl4040_event_spec, 1857 + .num_event_specs = ARRAY_SIZE(vcnl4040_event_spec), 1858 + }, 1859 + }; 1860 + 1848 1861 static const struct iio_info vcnl4000_info = { 1849 1862 .read_raw = vcnl4000_read_raw, 1850 1863 }; ··· 1886 1867 }; 1887 1868 1888 1869 static const struct vcnl4000_chip_spec vcnl4000_chip_spec_cfg[] = { 1870 + [CM36672P] = { 1871 + .prod = "CM36672P", 1872 + .init = vcnl4200_init, 1873 + .measure_proximity = vcnl4200_measure_proximity, 1874 + .set_power_state = vcnl4200_set_power_state, 1875 + .channels = cm36672p_channels, 1876 + .num_channels = ARRAY_SIZE(cm36672p_channels), 1877 + .info = &vcnl4040_info, 1878 + .irq_thread = vcnl4040_irq_thread, 1879 + .int_reg = VCNL4040_INT_FLAGS, 1880 + .ps_it_times = &vcnl4040_ps_it_times, 1881 + .num_ps_it_times = ARRAY_SIZE(vcnl4040_ps_it_times), 1882 + }, 1889 1883 [VCNL4000] = { 1890 1884 .prod = "VCNL4000", 1891 1885 .init = vcnl4000_init, ··· 2065 2033 } 2066 2034 2067 2035 static const struct of_device_id vcnl_4000_of_match[] = { 2036 + { 2037 + .compatible = "capella,cm36672p", 2038 + .data = (void *)CM36672P, 2039 + }, 2040 + /* Capella CM36686 is fully compatible with Vishay VCNL4040 */ 2041 + { 2042 + .compatible = "capella,cm36686", 2043 + .data = (void *)VCNL4040, 2044 + }, 2068 2045 { 2069 2046 .compatible = "vishay,vcnl4000", 2070 2047 .data = (void *)VCNL4000,