Lines Matching +full:uv +full:- +full:shutdown

1 // SPDX-License-Identifier: GPL-2.0-only
3 * veml6070.c - Support for Vishay VEML6070 UV A light sensor
5 * Copyright 2016 Peter Meerwald-Stadler <pmeerw@pmeerw.net>
7 * IIO driver for VEML6070 (7-bit I2C slave addresses 0x38 and 0x39)
29 #define VEML6070_COMMAND_SD BIT(0) /* shutdown mode when set */
45 mutex_lock(&data->lock); in veml6070_read()
47 /* disable shutdown */ in veml6070_read()
48 ret = i2c_smbus_write_byte(data->client1, in veml6070_read()
49 data->config & ~VEML6070_COMMAND_SD); in veml6070_read()
55 ret = i2c_smbus_read_byte(data->client2); /* read MSB, address 0x39 */ in veml6070_read()
60 ret = i2c_smbus_read_byte(data->client1); /* read LSB, address 0x38 */ in veml6070_read()
65 /* shutdown again */ in veml6070_read()
66 ret = i2c_smbus_write_byte(data->client1, data->config); in veml6070_read()
73 mutex_unlock(&data->lock); in veml6070_read()
93 * conversion of raw UV intensity values to UV index depends on in veml6070_to_uv_index()
130 return -EINVAL; in veml6070_read_raw()
144 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); in veml6070_probe()
146 return -ENOMEM; in veml6070_probe()
150 data->client1 = client; in veml6070_probe()
151 mutex_init(&data->lock); in veml6070_probe()
153 indio_dev->info = &veml6070_info; in veml6070_probe()
154 indio_dev->channels = veml6070_channels; in veml6070_probe()
155 indio_dev->num_channels = ARRAY_SIZE(veml6070_channels); in veml6070_probe()
156 indio_dev->name = VEML6070_DRV_NAME; in veml6070_probe()
157 indio_dev->modes = INDIO_DIRECT_MODE; in veml6070_probe()
159 data->client2 = i2c_new_dummy_device(client->adapter, VEML6070_ADDR_DATA_LSB); in veml6070_probe()
160 if (IS_ERR(data->client2)) { in veml6070_probe()
161 dev_err(&client->dev, "i2c device for second chip address failed\n"); in veml6070_probe()
162 return PTR_ERR(data->client2); in veml6070_probe()
165 data->config = VEML6070_IT_10 | VEML6070_COMMAND_RSRVD | in veml6070_probe()
167 ret = i2c_smbus_write_byte(data->client1, data->config); in veml6070_probe()
178 i2c_unregister_device(data->client2); in veml6070_probe()
188 i2c_unregister_device(data->client2); in veml6070_remove()
208 MODULE_AUTHOR("Peter Meerwald-Stadler <pmeerw@pmeerw.net>");
209 MODULE_DESCRIPTION("Vishay VEML6070 UV A light sensor driver");