Lines Matching +full:prod +full:- +full:edam

1 // SPDX-License-Identifier: GPL-2.0-only
7prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/products/sensors/pressure-sensor…
36 * HSC_PRESSURE_TRIPLET_LEN - length for the string that defines the
38 * Consult honeywell,pressure-triplet in the bindings file for details.
51 * function A: 10% - 90% of 2^14
52 * function B: 5% - 95% of 2^14
53 * function C: 5% - 85% of 2^14
54 * function F: 4% - 94% of 2^14
140 * struct hsc_range_config - list of pressure ranges based on nomenclature
157 [HSC1_6MD] = { .pmin = -160, .pmax = 160 },
158 [HSC2_5MD] = { .pmin = -250, .pmax = 250 },
159 [HSC004MD] = { .pmin = -400, .pmax = 400 },
160 [HSC006MD] = { .pmin = -600, .pmax = 600 },
161 [HSC010MD] = { .pmin = -1000, .pmax = 1000 },
162 [HSC016MD] = { .pmin = -1600, .pmax = 1600 },
163 [HSC025MD] = { .pmin = -2500, .pmax = 2500 },
164 [HSC040MD] = { .pmin = -4000, .pmax = 4000 },
165 [HSC060MD] = { .pmin = -6000, .pmax = 6000 },
166 [HSC100MD] = { .pmin = -10000, .pmax = 10000 },
167 [HSC160MD] = { .pmin = -16000, .pmax = 16000 },
168 [HSC250MD] = { .pmin = -25000, .pmax = 25000 },
169 [HSC400MD] = { .pmin = -40000, .pmax = 40000 },
170 [HSC600MD] = { .pmin = -60000, .pmax = 60000 },
171 [HSC001BD] = { .pmin = -100000, .pmax = 100000 },
172 [HSC1_6BD] = { .pmin = -160000, .pmax = 160000 },
173 [HSC2_5BD] = { .pmin = -250000, .pmax = 250000 },
174 [HSC004BD] = { .pmin = -400000, .pmax = 400000 },
200 [HSC160LD] = { .pmin = -160, .pmax = 160 },
201 [HSC250LD] = { .pmin = -250, .pmax = 250 },
202 [HSC400LD] = { .pmin = -400, .pmax = 400 },
203 [HSC600LD] = { .pmin = -600, .pmax = 600 },
204 [HSC001KD] = { .pmin = -1000, .pmax = 1000 },
205 [HSC1_6KD] = { .pmin = -1600, .pmax = 1600 },
206 [HSC2_5KD] = { .pmin = -2500, .pmax = 2500 },
207 [HSC004KD] = { .pmin = -4000, .pmax = 4000 },
208 [HSC006KD] = { .pmin = -6000, .pmax = 6000 },
209 [HSC010KD] = { .pmin = -10000, .pmax = 10000 },
210 [HSC016KD] = { .pmin = -16000, .pmax = 16000 },
211 [HSC025KD] = { .pmin = -25000, .pmax = 25000 },
212 [HSC040KD] = { .pmin = -40000, .pmax = 40000 },
213 [HSC060KD] = { .pmin = -60000, .pmax = 60000 },
214 [HSC100KD] = { .pmin = -100000, .pmax = 100000 },
215 [HSC160KD] = { .pmin = -160000, .pmax = 160000 },
216 [HSC250KD] = { .pmin = -250000, .pmax = 250000 },
217 [HSC400KD] = { .pmin = -400000, .pmax = 400000 },
242 [HSC0_5ND] = { .pmin = -125, .pmax = 125 },
243 [HSC001ND] = { .pmin = -249, .pmax = 249 },
244 [HSC002ND] = { .pmin = -498, .pmax = 498 },
245 [HSC004ND] = { .pmin = -996, .pmax = 996 },
246 [HSC005ND] = { .pmin = -1245, .pmax = 1245 },
247 [HSC010ND] = { .pmin = -2491, .pmax = 2491 },
248 [HSC020ND] = { .pmin = -4982, .pmax = 4982 },
249 [HSC030ND] = { .pmin = -7473, .pmax = 7473 },
250 [HSC001PD] = { .pmin = -6895, .pmax = 6895 },
251 [HSC005PD] = { .pmin = -34474, .pmax = 34474 },
252 [HSC015PD] = { .pmin = -103421, .pmax = 103421 },
253 [HSC030PD] = { .pmin = -206843, .pmax = 206843 },
254 [HSC060PD] = { .pmin = -413685, .pmax = 413685 },
272 * hsc_measurement_is_valid() - validate last conversion via status bits
277 * 00 - normal operation, valid data
278 * 01 - device in factory programming mode
279 * 10 - stale data
280 * 11 - diagnostic condition
284 return !(data->buffer[0] & HSC_STATUS_MASK); in hsc_measurement_is_valid()
289 const struct hsc_chip_data *chip = data->chip; in hsc_get_measurement()
292 ret = data->recv_cb(data); in hsc_get_measurement()
296 data->is_valid = chip->valid(data); in hsc_get_measurement()
297 if (!data->is_valid) in hsc_get_measurement()
298 return -EAGAIN; in hsc_get_measurement()
306 struct iio_dev *indio_dev = pf->indio_dev; in hsc_trigger_handler()
314 memcpy(&data->scan.chan[0], &data->buffer[0], 2); in hsc_trigger_handler()
315 memcpy(&data->scan.chan[1], &data->buffer[2], 2); in hsc_trigger_handler()
317 iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, in hsc_trigger_handler()
321 iio_trigger_notify_done(indio_dev->trig); in hsc_trigger_handler()
332 * where a = 200/2047; b = -50
337 * offset = b/a = -50 / .097703957 = -50000000 / 97704
340 * pressure = (conv - Omin) * Q + Pmin =
341 * ((conv - Omin) + Pmin/Q) * Q
343 * scale = Q = (Pmax - Pmin) / (Omax - Omin)
344 * offset = Pmin/Q - Omin = Pmin * (Omax - Omin) / (Pmax - Pmin) - Omin
360 recvd = get_unaligned_be32(data->buffer); in hsc_read_raw()
361 switch (channel->type) { in hsc_read_raw()
369 return -EINVAL; in hsc_read_raw()
373 switch (channel->type) { in hsc_read_raw()
379 *val = data->p_scale; in hsc_read_raw()
380 *val2 = data->p_scale_dec; in hsc_read_raw()
383 return -EINVAL; in hsc_read_raw()
387 switch (channel->type) { in hsc_read_raw()
389 *val = -50000000; in hsc_read_raw()
393 *val = data->p_offset; in hsc_read_raw()
394 *val2 = data->p_offset_dec; in hsc_read_raw()
397 return -EINVAL; in hsc_read_raw()
401 return -EINVAL; in hsc_read_raw()
456 return -ENOMEM; in hsc_common_probe()
460 hsc->chip = &hsc_chip; in hsc_common_probe()
461 hsc->recv_cb = recv; in hsc_common_probe()
462 hsc->dev = dev; in hsc_common_probe()
464 ret = device_property_read_u32(dev, "honeywell,transfer-function", in hsc_common_probe()
465 &hsc->function); in hsc_common_probe()
468 "honeywell,transfer-function could not be read\n"); in hsc_common_probe()
469 if (hsc->function > HSC_FUNCTION_F) in hsc_common_probe()
470 return dev_err_probe(dev, -EINVAL, in hsc_common_probe()
471 "honeywell,transfer-function %d invalid\n", in hsc_common_probe()
472 hsc->function); in hsc_common_probe()
474 ret = device_property_read_string(dev, "honeywell,pressure-triplet", in hsc_common_probe()
478 "honeywell,pressure-triplet could not be read\n"); in hsc_common_probe()
481 ret = device_property_read_u32(dev, "honeywell,pmin-pascal", in hsc_common_probe()
482 &hsc->pmin); in hsc_common_probe()
485 "honeywell,pmin-pascal could not be read\n"); in hsc_common_probe()
487 ret = device_property_read_u32(dev, "honeywell,pmax-pascal", in hsc_common_probe()
488 &hsc->pmax); in hsc_common_probe()
491 "honeywell,pmax-pascal could not be read\n"); in hsc_common_probe()
494 "honeywell,pressure-triplet", in hsc_common_probe()
498 return dev_err_probe(dev, -EINVAL, in hsc_common_probe()
499 "honeywell,pressure-triplet is invalid\n"); in hsc_common_probe()
501 hsc->pmin = hsc_range_config[ret].pmin; in hsc_common_probe()
502 hsc->pmax = hsc_range_config[ret].pmax; in hsc_common_probe()
505 if (hsc->pmin >= hsc->pmax) in hsc_common_probe()
506 return dev_err_probe(dev, -EINVAL, in hsc_common_probe()
513 hsc->outmin = hsc_func_spec[hsc->function].output_min; in hsc_common_probe()
514 hsc->outmax = hsc_func_spec[hsc->function].output_max; in hsc_common_probe()
516 tmp = div_s64(((s64)(hsc->pmax - hsc->pmin)) * MICRO, in hsc_common_probe()
517 hsc->outmax - hsc->outmin); in hsc_common_probe()
518 hsc->p_scale = div_s64_rem(tmp, NANO, &hsc->p_scale_dec); in hsc_common_probe()
519 tmp = div_s64(((s64)hsc->pmin * (s64)(hsc->outmax - hsc->outmin)) * MICRO, in hsc_common_probe()
520 hsc->pmax - hsc->pmin); in hsc_common_probe()
521 tmp -= (s64)hsc->outmin * MICRO; in hsc_common_probe()
522 hsc->p_offset = div_s64_rem(tmp, MICRO, &hsc->p_offset_dec); in hsc_common_probe()
524 indio_dev->name = "hsc030pa"; in hsc_common_probe()
525 indio_dev->modes = INDIO_DIRECT_MODE; in hsc_common_probe()
526 indio_dev->info = &hsc_info; in hsc_common_probe()
527 indio_dev->channels = hsc->chip->channels; in hsc_common_probe()
528 indio_dev->num_channels = hsc->chip->num_channels; in hsc_common_probe()