Lines Matching +full:hall +full:- +full:effect
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Driver for the Allegro MicroSystems ALS31300 3-D Linear Hall Effect Sensor
104 /* The whole measure is split into 2x32-bit registers, we need to read them both at once */
111 guard(mutex)(&data->mutex); in als31300_get_measure()
113 ret = pm_runtime_resume_and_get(data->dev); in als31300_get_measure()
125 data->map, ALS31300_VOL_MSB, buf, ARRAY_SIZE(buf)); in als31300_get_measure()
132 dev_err(data->dev, "read data failed, error %d\n", ret); in als31300_get_measure()
143 pm_runtime_mark_last_busy(data->dev); in als31300_get_measure()
144 pm_runtime_put_autosuspend(data->dev); in als31300_get_measure()
165 switch (chan->address) { in als31300_read_raw()
179 return -EINVAL; in als31300_read_raw()
182 switch (chan->type) { in als31300_read_raw()
186 * 1000 * 302 * (value - 1708) in als31300_read_raw()
187 * temp = ---------------------------- in als31300_read_raw()
198 * - 500 GAUSS <-> 4 LSB/Gauss in als31300_read_raw()
199 * - 1000 GAUSS <-> 2 LSB/Gauss in als31300_read_raw()
200 * - 2000 GAUSS <-> 1 LSB/Gauss in als31300_read_raw()
208 *val2 = data->variant_info->sensitivity; in als31300_read_raw()
211 return -EINVAL; in als31300_read_raw()
214 switch (chan->type) { in als31300_read_raw()
216 *val = -1708; in als31300_read_raw()
219 return -EINVAL; in als31300_read_raw()
222 return -EINVAL; in als31300_read_raw()
229 struct iio_dev *indio_dev = pf->indio_dev; in als31300_trigger_handler()
249 pf->timestamp); in als31300_trigger_handler()
252 iio_trigger_notify_done(indio_dev->trig); in als31300_trigger_handler()
304 ret = regmap_update_bits(data->map, ALS31300_VOL_MODE, in als31300_set_operating_mode()
307 dev_err(data->dev, "failed to set operating mode (%pe)\n", ERR_PTR(ret)); in als31300_set_operating_mode()
311 /* The time it takes to exit sleep mode is equivalent to Power-On Delay Time */ in als31300_set_operating_mode()
341 struct device *dev = &i2c->dev; in als31300_probe()
348 return -ENOMEM; in als31300_probe()
351 data->dev = dev; in als31300_probe()
354 ret = devm_mutex_init(dev, &data->mutex); in als31300_probe()
358 data->variant_info = i2c_get_match_data(i2c); in als31300_probe()
359 if (!data->variant_info) in als31300_probe()
360 return -EINVAL; in als31300_probe()
362 data->map = devm_regmap_init_i2c(i2c, &als31300_regmap_config); in als31300_probe()
363 if (IS_ERR(data->map)) in als31300_probe()
364 return dev_err_probe(dev, PTR_ERR(data->map), in als31300_probe()
379 indio_dev->info = &als31300_info; in als31300_probe()
380 indio_dev->modes = INDIO_DIRECT_MODE; in als31300_probe()
381 indio_dev->name = i2c->name; in als31300_probe()
382 indio_dev->channels = als31300_channels; in als31300_probe()
383 indio_dev->num_channels = ARRAY_SIZE(als31300_channels); in als31300_probe()
384 indio_dev->available_scan_masks = als31300_scan_masks; in als31300_probe()
449 .name = "als31300-500",
453 .name = "als31300-1000",
457 .name = "als31300-2000",
466 .compatible = "allegromicro,als31300-500",
470 .compatible = "allegromicro,als31300-1000",
474 .compatible = "allegromicro,als31300-2000",
493 MODULE_DESCRIPTION("ALS31300 3-D Linear Hall Effect Driver");