Lines Matching +full:noa1305 +full:- +full:d

1 // SPDX-License-Identifier: GPL-2.0+
3 * Support for ON Semiconductor NOA1305 ambient light sensor
45 #define NOA1305_DRIVER_NAME "noa1305"
79 ret = regmap_bulk_read(priv->regmap, NOA1305_REG_ALS_DATA_LSB, &data, in noa1305_measure()
94 ret = regmap_read(priv->regmap, NOA1305_REG_INTEGRATION_TIME, &data); in noa1305_scale()
116 ret = regmap_read(priv->regmap, NOA1305_REG_INTEGRATION_TIME, &data); in noa1305_int_time()
143 if (chan->type != IIO_LIGHT) in noa1305_read_avail()
144 return -EINVAL; in noa1305_read_avail()
158 return -EINVAL; in noa1305_read_avail()
168 if (chan->type != IIO_LIGHT) in noa1305_read_raw()
169 return -EINVAL; in noa1305_read_raw()
179 return -EINVAL; in noa1305_read_raw()
190 if (chan->type != IIO_LIGHT) in noa1305_write_raw()
191 return -EINVAL; in noa1305_write_raw()
194 return -EINVAL; in noa1305_write_raw()
197 return -EINVAL; in noa1305_write_raw()
202 return regmap_write(priv->regmap, NOA1305_REG_INTEGRATION_TIME, i); in noa1305_write_raw()
204 return -EINVAL; in noa1305_write_raw()
245 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*priv)); in noa1305_probe()
247 return -ENOMEM; in noa1305_probe()
251 dev_err(&client->dev, "Regmap initialization failed.\n"); in noa1305_probe()
257 ret = devm_regulator_get_enable(&client->dev, "vin"); in noa1305_probe()
259 return dev_err_probe(&client->dev, ret, in noa1305_probe()
263 priv->client = client; in noa1305_probe()
264 priv->regmap = regmap; in noa1305_probe()
268 dev_err(&client->dev, "ID reading failed: %d\n", ret); in noa1305_probe()
274 dev_err(&client->dev, "Unknown device ID: 0x%x\n", dev_id); in noa1305_probe()
275 return -ENODEV; in noa1305_probe()
281 dev_err(&client->dev, "Enabling power control failed\n"); in noa1305_probe()
287 dev_err(&client->dev, "Device reset failed\n"); in noa1305_probe()
294 dev_err(&client->dev, "Setting integration time failed\n"); in noa1305_probe()
298 indio_dev->info = &noa1305_info; in noa1305_probe()
299 indio_dev->channels = noa1305_channels; in noa1305_probe()
300 indio_dev->num_channels = ARRAY_SIZE(noa1305_channels); in noa1305_probe()
301 indio_dev->name = NOA1305_DRIVER_NAME; in noa1305_probe()
302 indio_dev->modes = INDIO_DIRECT_MODE; in noa1305_probe()
304 ret = devm_iio_device_register(&client->dev, indio_dev); in noa1305_probe()
306 dev_err(&client->dev, "registering device failed\n"); in noa1305_probe()
312 { .compatible = "onnn,noa1305" },
318 { "noa1305" },
336 MODULE_DESCRIPTION("ON Semiconductor NOA1305 ambient light sensor");