apds9960.c (35bb28ece90dfb7f72b77ba529f25f79323d9581) | apds9960.c (17395ce299211a8148ee45d1d71eb740a3fec48d) |
---|---|
1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * apds9960.c - Support for Avago APDS9960 gesture/RGB/ALS/proximity sensor 4 * 5 * Copyright (C) 2015, 2018 6 * Author: Matt Ranostay <matt.ranostay@konsulko.com> 7 * 8 * TODO: gesture + proximity calib offsets --- 974 unchanged lines hidden (view full) --- 983 984 return apds9960_set_powermode(data, 1); 985} 986 987static int apds9960_probe(struct i2c_client *client, 988 const struct i2c_device_id *id) 989{ 990 struct apds9960_data *data; | 1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * apds9960.c - Support for Avago APDS9960 gesture/RGB/ALS/proximity sensor 4 * 5 * Copyright (C) 2015, 2018 6 * Author: Matt Ranostay <matt.ranostay@konsulko.com> 7 * 8 * TODO: gesture + proximity calib offsets --- 974 unchanged lines hidden (view full) --- 983 984 return apds9960_set_powermode(data, 1); 985} 986 987static int apds9960_probe(struct i2c_client *client, 988 const struct i2c_device_id *id) 989{ 990 struct apds9960_data *data; |
991 struct iio_buffer *buffer; | |
992 struct iio_dev *indio_dev; 993 int ret; 994 995 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); 996 if (!indio_dev) 997 return -ENOMEM; 998 | 991 struct iio_dev *indio_dev; 992 int ret; 993 994 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); 995 if (!indio_dev) 996 return -ENOMEM; 997 |
999 buffer = devm_iio_kfifo_allocate(&client->dev); 1000 if (!buffer) 1001 return -ENOMEM; 1002 1003 iio_device_attach_buffer(indio_dev, buffer); 1004 | |
1005 indio_dev->info = &apds9960_info; 1006 indio_dev->name = APDS9960_DRV_NAME; 1007 indio_dev->channels = apds9960_channels; 1008 indio_dev->num_channels = ARRAY_SIZE(apds9960_channels); 1009 indio_dev->available_scan_masks = apds9960_scan_masks; | 998 indio_dev->info = &apds9960_info; 999 indio_dev->name = APDS9960_DRV_NAME; 1000 indio_dev->channels = apds9960_channels; 1001 indio_dev->num_channels = ARRAY_SIZE(apds9960_channels); 1002 indio_dev->available_scan_masks = apds9960_scan_masks; |
1010 indio_dev->modes = (INDIO_BUFFER_SOFTWARE | INDIO_DIRECT_MODE); 1011 indio_dev->setup_ops = &apds9960_buffer_setup_ops; | 1003 indio_dev->modes = INDIO_DIRECT_MODE; |
1012 | 1004 |
1005 ret = devm_iio_kfifo_buffer_setup(&client->dev, indio_dev, 1006 INDIO_BUFFER_SOFTWARE, 1007 &apds9960_buffer_setup_ops); 1008 if (ret) 1009 return ret; 1010 |
|
1013 data = iio_priv(indio_dev); 1014 i2c_set_clientdata(client, indio_dev); 1015 1016 data->regmap = devm_regmap_init_i2c(client, &apds9960_regmap_config); 1017 if (IS_ERR(data->regmap)) { 1018 dev_err(&client->dev, "regmap initialization failed.\n"); 1019 return PTR_ERR(data->regmap); 1020 } --- 124 unchanged lines hidden --- | 1011 data = iio_priv(indio_dev); 1012 i2c_set_clientdata(client, indio_dev); 1013 1014 data->regmap = devm_regmap_init_i2c(client, &apds9960_regmap_config); 1015 if (IS_ERR(data->regmap)) { 1016 dev_err(&client->dev, "regmap initialization failed.\n"); 1017 return PTR_ERR(data->regmap); 1018 } --- 124 unchanged lines hidden --- |