Lines Matching +full:input +full:- +full:precharge +full:- +full:resistor +full:- +full:ohms
1 // SPDX-License-Identifier: GPL-2.0
181 * Returns the fake increment of (Max-Min)/2047
216 regmap_reg_range(SX9360_REG_IRQ_CFG + 1, SX9360_REG_GNRL_CTRL0 - 1),
217 regmap_reg_range(SX9360_REG_GNRL_CTRL2 + 1, SX9360_REG_AFE_CTRL1 - 1),
219 SX9360_REG_PROX_CTRL0_PHR - 1),
220 regmap_reg_range(SX9360_REG_PROX_CTRL5 + 1, SX9360_REG_REF_CORR0 - 1),
222 SX9360_REG_USEFUL_PHR_MSB - 1),
223 regmap_reg_range(SX9360_REG_USE_FILTER_LSB + 1, SX9360_REG_RESET - 1),
224 regmap_reg_range(SX9360_REG_RESET + 1, SX9360_REG_WHOAMI - 1),
225 regmap_reg_range(SX9360_REG_WHOAMI + 1, SX9360_REG_REVISION - 1),
261 return regmap_bulk_read(data->regmap, chan->address, val, sizeof(*val)); in sx9360_read_prox_data()
273 ret = regmap_bulk_read(data->regmap, SX9360_REG_GNRL_CTRL1, in sx9360_wait_for_sample()
288 reg = SX9360_REG_PROX_CTRL0_PHR + chan->channel; in sx9360_read_gain()
289 ret = regmap_read(data->regmap, reg, ®val); in sx9360_read_gain()
304 ret = regmap_bulk_read(data->regmap, SX9360_REG_GNRL_CTRL1, in sx9360_read_samp_freq()
328 iio_device_claim_direct_scoped(return -EBUSY, indio_dev) in sx9360_read_raw()
332 iio_device_claim_direct_scoped(return -EBUSY, indio_dev) in sx9360_read_raw()
338 return -EINVAL; in sx9360_read_raw()
349 return sysfs_emit(label, "%s\n", sx9360_channel_labels[chan->channel]); in sx9360_read_label()
359 if (chan->type != IIO_PROXIMITY) in sx9360_read_avail()
360 return -EINVAL; in sx9360_read_avail()
374 return -EINVAL; in sx9360_read_avail()
386 guard(mutex)(&data->mutex); in sx9360_set_samp_freq()
388 return regmap_bulk_write(data->regmap, SX9360_REG_GNRL_CTRL1, &buf, in sx9360_set_samp_freq()
397 ret = regmap_read(data->regmap, SX9360_REG_PROX_CTRL5, ®val); in sx9360_read_thresh()
418 ret = regmap_read(data->regmap, SX9360_REG_PROX_CTRL4, ®val); in sx9360_read_hysteresis()
426 *val = pthresh >> (5 - regval); in sx9360_read_hysteresis()
436 ret = regmap_read(data->regmap, SX9360_REG_PROX_CTRL4, ®val); in sx9360_read_far_debounce()
454 ret = regmap_read(data->regmap, SX9360_REG_PROX_CTRL4, ®val); in sx9360_read_close_debounce()
475 if (chan->type != IIO_PROXIMITY) in sx9360_read_event_val()
476 return -EINVAL; in sx9360_read_event_val()
488 return -EINVAL; in sx9360_read_event_val()
493 return -EINVAL; in sx9360_read_event_val()
505 return -EINVAL; in sx9360_write_thresh()
507 guard(mutex)(&data->mutex); in sx9360_write_thresh()
508 return regmap_write(data->regmap, SX9360_REG_PROX_CTRL5, val); in sx9360_write_thresh()
529 return -EINVAL; in sx9360_write_hysteresis()
532 guard(mutex)(&data->mutex); in sx9360_write_hysteresis()
533 return regmap_update_bits(data->regmap, SX9360_REG_PROX_CTRL4, in sx9360_write_hysteresis()
544 return -EINVAL; in sx9360_write_far_debounce()
548 guard(mutex)(&data->mutex); in sx9360_write_far_debounce()
549 return regmap_update_bits(data->regmap, SX9360_REG_PROX_CTRL4, in sx9360_write_far_debounce()
561 return -EINVAL; in sx9360_write_close_debounce()
565 guard(mutex)(&data->mutex); in sx9360_write_close_debounce()
566 return regmap_update_bits(data->regmap, SX9360_REG_PROX_CTRL4, in sx9360_write_close_debounce()
579 if (chan->type != IIO_PROXIMITY) in sx9360_write_event_val()
580 return -EINVAL; in sx9360_write_event_val()
592 return -EINVAL; in sx9360_write_event_val()
597 return -EINVAL; in sx9360_write_event_val()
607 reg = SX9360_REG_PROX_CTRL0_PHR + chan->channel; in sx9360_write_gain()
610 guard(mutex)(&data->mutex); in sx9360_write_gain()
611 return regmap_update_bits(data->regmap, reg, in sx9360_write_gain()
628 return -EINVAL; in sx9360_write_raw()
675 ret = regmap_set_bits(data->regmap, SX9360_REG_STAT, in sx9360_init_compensation()
680 return regmap_read_poll_timeout(data->regmap, SX9360_REG_STAT, val, in sx9360_init_compensation()
693 switch (reg_def->reg) { in sx9360_get_default_reg()
696 "semtech,input-precharge-resistor-ohms", in sx9360_get_default_reg()
701 reg_def->def &= ~SX9360_REG_AFE_CTRL1_RESFILTIN_MASK; in sx9360_get_default_reg()
702 reg_def->def |= FIELD_PREP(SX9360_REG_AFE_CTRL1_RESFILTIN_MASK, in sx9360_get_default_reg()
711 raw = ilog2(raw) - 3; in sx9360_get_default_reg()
713 reg_def->def &= ~SX9360_REG_AFE_PARAM0_RESOLUTION_MASK; in sx9360_get_default_reg()
714 reg_def->def |= FIELD_PREP(SX9360_REG_AFE_PARAM0_RESOLUTION_MASK, raw); in sx9360_get_default_reg()
718 ret = device_property_read_u32(dev, "semtech,proxraw-strength", &raw); in sx9360_get_default_reg()
722 reg_def->def &= ~SX9360_REG_PROX_CTRL0_RAWFILT_MASK; in sx9360_get_default_reg()
723 reg_def->def |= FIELD_PREP(SX9360_REG_PROX_CTRL0_RAWFILT_MASK, raw); in sx9360_get_default_reg()
726 ret = device_property_read_u32(dev, "semtech,avg-pos-strength", in sx9360_get_default_reg()
732 raw = clamp(ilog2(pos), 3, 11) - (pos >= 32 ? 4 : 3); in sx9360_get_default_reg()
733 reg_def->def &= ~SX9360_REG_PROX_CTRL3_AVGPOS_FILT_MASK; in sx9360_get_default_reg()
734 reg_def->def |= FIELD_PREP(SX9360_REG_PROX_CTRL3_AVGPOS_FILT_MASK, raw); in sx9360_get_default_reg()
747 indio_dev->name = "sx9360"; in sx9360_check_whoami()
795 disable_irq_nosync(data->client->irq); in sx9360_suspend()
797 guard(mutex)(&data->mutex); in sx9360_suspend()
798 ret = regmap_read(data->regmap, SX9360_REG_GNRL_CTRL0, ®val); in sx9360_suspend()
802 data->suspend_ctrl = in sx9360_suspend()
807 return regmap_write(data->regmap, SX9360_REG_GNRL_CTRL0, 0); in sx9360_suspend()
814 scoped_guard(mutex, &data->mutex) { in sx9360_resume()
815 int ret = regmap_update_bits(data->regmap, in sx9360_resume()
818 data->suspend_ctrl); in sx9360_resume()
822 enable_irq(data->client->irq); in sx9360_resume()