Lines Matching +full:ds +full:- +full:0355 +full:_rev_b

1 // SPDX-License-Identifier: GPL-2.0
8 * Datasheet: https://www.allsensors.com/cad/DS-0355_Rev_B.PDF
69 ret = i2c_smbus_write_byte(st->client, DLH_START_SINGLE); in dlh_cmd_start_single()
71 dev_err(&st->client->dev, in dlh_cmd_start_single()
81 ret = i2c_master_recv(st->client, st->rx_buf, DLH_NUM_READ_BYTES); in dlh_cmd_read_data()
83 dev_err(&st->client->dev, in dlh_cmd_read_data()
88 if (st->rx_buf[0] != DLH_STATUS_OK) { in dlh_cmd_read_data()
89 dev_err(&st->client->dev, in dlh_cmd_read_data()
90 "%s: invalid status 0x%02x\n", __func__, st->rx_buf[0]); in dlh_cmd_read_data()
91 return -EBUSY; in dlh_cmd_read_data()
101 if (st->use_interrupt) in dlh_start_capture_and_read()
102 reinit_completion(&st->completion); in dlh_start_capture_and_read()
108 if (st->use_interrupt) { in dlh_start_capture_and_read()
109 ret = wait_for_completion_timeout(&st->completion, in dlh_start_capture_and_read()
112 dev_err(&st->client->dev, in dlh_start_capture_and_read()
114 return -ETIMEDOUT; in dlh_start_capture_and_read()
132 *pressure = get_unaligned_be24(&st->rx_buf[1]); in dlh_read_direct()
133 *temperature = get_unaligned_be24(&st->rx_buf[4]); in dlh_read_direct()
159 switch (channel->type) { in dlh_read_raw()
169 return -EINVAL; in dlh_read_raw()
172 switch (channel->type) { in dlh_read_raw()
174 tmp = div_s64(125LL * st->info.fss * 24909 * 100, in dlh_read_raw()
187 return -EINVAL; in dlh_read_raw()
190 switch (channel->type) { in dlh_read_raw()
192 *value = -125 * st->info.fss * 24909; in dlh_read_raw()
193 *value2 = 100 * st->info.osdig * 100000; in dlh_read_raw()
197 *value = -40 * 1000; in dlh_read_raw()
201 return -EINVAL; in dlh_read_raw()
205 return -EINVAL; in dlh_read_raw()
249 struct iio_dev *indio_dev = pf->indio_dev; in dlh_trigger_handler()
259 for_each_set_bit(chn, indio_dev->active_scan_mask, in dlh_trigger_handler()
260 indio_dev->masklength) { in dlh_trigger_handler()
262 &st->rx_buf[1] + chn * DLH_NUM_DATA_BYTES, in dlh_trigger_handler()
270 iio_trigger_notify_done(indio_dev->trig); in dlh_trigger_handler()
280 complete(&st->completion); in dlh_interrupt()
292 if (!i2c_check_functionality(client->adapter, in dlh_probe()
294 dev_err(&client->dev, in dlh_probe()
296 return -EOPNOTSUPP; in dlh_probe()
299 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*st)); in dlh_probe()
301 dev_err(&client->dev, "failed to allocate iio device\n"); in dlh_probe()
302 return -ENOMEM; in dlh_probe()
308 st->info = dlh_info_tbl[id->driver_data]; in dlh_probe()
309 st->client = client; in dlh_probe()
310 st->use_interrupt = false; in dlh_probe()
312 indio_dev->name = id->name; in dlh_probe()
313 indio_dev->info = &dlh_info; in dlh_probe()
314 indio_dev->modes = INDIO_DIRECT_MODE; in dlh_probe()
315 indio_dev->channels = dlh_channels; in dlh_probe()
316 indio_dev->num_channels = ARRAY_SIZE(dlh_channels); in dlh_probe()
318 if (client->irq > 0) { in dlh_probe()
319 ret = devm_request_threaded_irq(&client->dev, client->irq, in dlh_probe()
322 id->name, indio_dev); in dlh_probe()
324 dev_err(&client->dev, "failed to allocate threaded irq"); in dlh_probe()
328 st->use_interrupt = true; in dlh_probe()
329 init_completion(&st->completion); in dlh_probe()
332 ret = devm_iio_triggered_buffer_setup(&client->dev, indio_dev, in dlh_probe()
335 dev_err(&client->dev, "failed to setup iio buffer\n"); in dlh_probe()
339 ret = devm_iio_device_register(&client->dev, indio_dev); in dlh_probe()
341 dev_err(&client->dev, "failed to register iio device\n"); in dlh_probe()