| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * tcs3414.c - Support for TAOS TCS3414 digital color sensor |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2014 Peter Meerwald <pmeerw@pmeerw.net> |
|---|
| 5 | | - * |
|---|
| 6 | | - * This file is subject to the terms and conditions of version 2 of |
|---|
| 7 | | - * the GNU General Public License. See the file COPYING in the main |
|---|
| 8 | | - * directory of this archive for more details. |
|---|
| 9 | 6 | * |
|---|
| 10 | 7 | * Digital color sensor with 16-bit channels for red, green, blue, clear); |
|---|
| 11 | 8 | * 7-bit I2C slave address 0x39 (TCS3414) or 0x29, 0x49, 0x59 (TCS3413, |
|---|
| .. | .. |
|---|
| 247 | 244 | .attrs = &tcs3414_attribute_group, |
|---|
| 248 | 245 | }; |
|---|
| 249 | 246 | |
|---|
| 250 | | -static int tcs3414_buffer_preenable(struct iio_dev *indio_dev) |
|---|
| 247 | +static int tcs3414_buffer_postenable(struct iio_dev *indio_dev) |
|---|
| 251 | 248 | { |
|---|
| 252 | 249 | struct tcs3414_data *data = iio_priv(indio_dev); |
|---|
| 253 | 250 | |
|---|
| .. | .. |
|---|
| 259 | 256 | static int tcs3414_buffer_predisable(struct iio_dev *indio_dev) |
|---|
| 260 | 257 | { |
|---|
| 261 | 258 | struct tcs3414_data *data = iio_priv(indio_dev); |
|---|
| 262 | | - int ret; |
|---|
| 263 | | - |
|---|
| 264 | | - ret = iio_triggered_buffer_predisable(indio_dev); |
|---|
| 265 | | - if (ret < 0) |
|---|
| 266 | | - return ret; |
|---|
| 267 | 259 | |
|---|
| 268 | 260 | data->control &= ~TCS3414_CONTROL_ADC_EN; |
|---|
| 269 | 261 | return i2c_smbus_write_byte_data(data->client, TCS3414_CONTROL, |
|---|
| .. | .. |
|---|
| 271 | 263 | } |
|---|
| 272 | 264 | |
|---|
| 273 | 265 | static const struct iio_buffer_setup_ops tcs3414_buffer_setup_ops = { |
|---|
| 274 | | - .preenable = tcs3414_buffer_preenable, |
|---|
| 275 | | - .postenable = &iio_triggered_buffer_postenable, |
|---|
| 266 | + .postenable = tcs3414_buffer_postenable, |
|---|
| 276 | 267 | .predisable = tcs3414_buffer_predisable, |
|---|
| 277 | 268 | }; |
|---|
| 278 | 269 | |
|---|
| .. | .. |
|---|
| 291 | 282 | i2c_set_clientdata(client, indio_dev); |
|---|
| 292 | 283 | data->client = client; |
|---|
| 293 | 284 | |
|---|
| 294 | | - indio_dev->dev.parent = &client->dev; |
|---|
| 295 | 285 | indio_dev->info = &tcs3414_info; |
|---|
| 296 | 286 | indio_dev->name = TCS3414_DRV_NAME; |
|---|
| 297 | 287 | indio_dev->channels = tcs3414_channels; |
|---|