Lines Matching +full:4 +full:- +full:inch
1 // SPDX-License-Identifier: GPL-2.0
8 * Datasheet: https://www.allsensors.com/cad/DS-0355_Rev_B.PDF
42 unsigned int fss; /* full scale span (inch H2O) */
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()
261 &st->rx_buf[1] + chn * DLH_NUM_DATA_BYTES, in dlh_trigger_handler()
268 iio_trigger_notify_done(indio_dev->trig); in dlh_trigger_handler()
278 complete(&st->completion); in dlh_interrupt()
290 if (!i2c_check_functionality(client->adapter, in dlh_probe()
292 dev_err(&client->dev, in dlh_probe()
294 return -EOPNOTSUPP; in dlh_probe()
297 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*st)); in dlh_probe()
299 dev_err(&client->dev, "failed to allocate iio device\n"); in dlh_probe()
300 return -ENOMEM; in dlh_probe()
306 st->info = dlh_info_tbl[id->driver_data]; in dlh_probe()
307 st->client = client; in dlh_probe()
308 st->use_interrupt = false; in dlh_probe()
310 indio_dev->name = id->name; in dlh_probe()
311 indio_dev->info = &dlh_info; in dlh_probe()
312 indio_dev->modes = INDIO_DIRECT_MODE; in dlh_probe()
313 indio_dev->channels = dlh_channels; in dlh_probe()
314 indio_dev->num_channels = ARRAY_SIZE(dlh_channels); in dlh_probe()
316 if (client->irq > 0) { in dlh_probe()
317 ret = devm_request_threaded_irq(&client->dev, client->irq, in dlh_probe()
320 id->name, indio_dev); in dlh_probe()
322 dev_err(&client->dev, "failed to allocate threaded irq"); in dlh_probe()
326 st->use_interrupt = true; in dlh_probe()
327 init_completion(&st->completion); in dlh_probe()
330 ret = devm_iio_triggered_buffer_setup(&client->dev, indio_dev, in dlh_probe()
333 dev_err(&client->dev, "failed to setup iio buffer\n"); in dlh_probe()
337 ret = devm_iio_device_register(&client->dev, indio_dev); in dlh_probe()
339 dev_err(&client->dev, "failed to register iio device\n"); in dlh_probe()