Lines Matching +full:input +full:- +full:precharge +full:- +full:resistor +full:- +full:ohms
1 // SPDX-License-Identifier: GPL-2.0
180 * Returns the fake increment of (Max-Min)/2047
215 regmap_reg_range(SX9360_REG_IRQ_CFG + 1, SX9360_REG_GNRL_CTRL0 - 1),
216 regmap_reg_range(SX9360_REG_GNRL_CTRL2 + 1, SX9360_REG_AFE_CTRL1 - 1),
218 SX9360_REG_PROX_CTRL0_PHR - 1),
219 regmap_reg_range(SX9360_REG_PROX_CTRL5 + 1, SX9360_REG_REF_CORR0 - 1),
221 SX9360_REG_USEFUL_PHR_MSB - 1),
222 regmap_reg_range(SX9360_REG_USE_FILTER_LSB + 1, SX9360_REG_RESET - 1),
223 regmap_reg_range(SX9360_REG_RESET + 1, SX9360_REG_WHOAMI - 1),
224 regmap_reg_range(SX9360_REG_WHOAMI + 1, SX9360_REG_REVISION - 1),
260 return regmap_bulk_read(data->regmap, chan->address, val, sizeof(*val)); in sx9360_read_prox_data()
272 ret = regmap_bulk_read(data->regmap, SX9360_REG_GNRL_CTRL1, in sx9360_wait_for_sample()
287 reg = SX9360_REG_PROX_CTRL0_PHR + chan->channel; in sx9360_read_gain()
288 ret = regmap_read(data->regmap, reg, ®val); in sx9360_read_gain()
303 ret = regmap_bulk_read(data->regmap, SX9360_REG_GNRL_CTRL1, in sx9360_read_samp_freq()
327 iio_device_claim_direct_scoped(return -EBUSY, indio_dev) in sx9360_read_raw()
331 iio_device_claim_direct_scoped(return -EBUSY, indio_dev) in sx9360_read_raw()
337 return -EINVAL; in sx9360_read_raw()
348 return sysfs_emit(label, "%s\n", sx9360_channel_labels[chan->channel]); in sx9360_read_label()
358 if (chan->type != IIO_PROXIMITY) in sx9360_read_avail()
359 return -EINVAL; in sx9360_read_avail()
373 return -EINVAL; in sx9360_read_avail()
385 guard(mutex)(&data->mutex); in sx9360_set_samp_freq()
387 return regmap_bulk_write(data->regmap, SX9360_REG_GNRL_CTRL1, &buf, in sx9360_set_samp_freq()
396 ret = regmap_read(data->regmap, SX9360_REG_PROX_CTRL5, ®val); in sx9360_read_thresh()
417 ret = regmap_read(data->regmap, SX9360_REG_PROX_CTRL4, ®val); in sx9360_read_hysteresis()
425 *val = pthresh >> (5 - regval); in sx9360_read_hysteresis()
435 ret = regmap_read(data->regmap, SX9360_REG_PROX_CTRL4, ®val); in sx9360_read_far_debounce()
453 ret = regmap_read(data->regmap, SX9360_REG_PROX_CTRL4, ®val); in sx9360_read_close_debounce()
474 if (chan->type != IIO_PROXIMITY) in sx9360_read_event_val()
475 return -EINVAL; in sx9360_read_event_val()
487 return -EINVAL; in sx9360_read_event_val()
492 return -EINVAL; in sx9360_read_event_val()
504 return -EINVAL; in sx9360_write_thresh()
506 guard(mutex)(&data->mutex); in sx9360_write_thresh()
507 return regmap_write(data->regmap, SX9360_REG_PROX_CTRL5, val); in sx9360_write_thresh()
528 return -EINVAL; in sx9360_write_hysteresis()
531 guard(mutex)(&data->mutex); in sx9360_write_hysteresis()
532 return regmap_update_bits(data->regmap, SX9360_REG_PROX_CTRL4, in sx9360_write_hysteresis()
543 return -EINVAL; in sx9360_write_far_debounce()
547 guard(mutex)(&data->mutex); in sx9360_write_far_debounce()
548 return regmap_update_bits(data->regmap, SX9360_REG_PROX_CTRL4, in sx9360_write_far_debounce()
560 return -EINVAL; in sx9360_write_close_debounce()
564 guard(mutex)(&data->mutex); in sx9360_write_close_debounce()
565 return regmap_update_bits(data->regmap, SX9360_REG_PROX_CTRL4, in sx9360_write_close_debounce()
578 if (chan->type != IIO_PROXIMITY) in sx9360_write_event_val()
579 return -EINVAL; in sx9360_write_event_val()
591 return -EINVAL; in sx9360_write_event_val()
596 return -EINVAL; in sx9360_write_event_val()
606 reg = SX9360_REG_PROX_CTRL0_PHR + chan->channel; in sx9360_write_gain()
609 guard(mutex)(&data->mutex); in sx9360_write_gain()
610 return regmap_update_bits(data->regmap, reg, in sx9360_write_gain()
627 return -EINVAL; in sx9360_write_raw()
674 ret = regmap_set_bits(data->regmap, SX9360_REG_STAT, in sx9360_init_compensation()
679 return regmap_read_poll_timeout(data->regmap, SX9360_REG_STAT, val, in sx9360_init_compensation()
692 switch (reg_def->reg) { in sx9360_get_default_reg()
695 "semtech,input-precharge-resistor-ohms", in sx9360_get_default_reg()
700 reg_def->def &= ~SX9360_REG_AFE_CTRL1_RESFILTIN_MASK; in sx9360_get_default_reg()
701 reg_def->def |= FIELD_PREP(SX9360_REG_AFE_CTRL1_RESFILTIN_MASK, in sx9360_get_default_reg()
710 raw = ilog2(raw) - 3; in sx9360_get_default_reg()
712 reg_def->def &= ~SX9360_REG_AFE_PARAM0_RESOLUTION_MASK; in sx9360_get_default_reg()
713 reg_def->def |= FIELD_PREP(SX9360_REG_AFE_PARAM0_RESOLUTION_MASK, raw); in sx9360_get_default_reg()
717 ret = device_property_read_u32(dev, "semtech,proxraw-strength", &raw); in sx9360_get_default_reg()
721 reg_def->def &= ~SX9360_REG_PROX_CTRL0_RAWFILT_MASK; in sx9360_get_default_reg()
722 reg_def->def |= FIELD_PREP(SX9360_REG_PROX_CTRL0_RAWFILT_MASK, raw); in sx9360_get_default_reg()
725 ret = device_property_read_u32(dev, "semtech,avg-pos-strength", in sx9360_get_default_reg()
731 raw = clamp(ilog2(pos), 3, 11) - (pos >= 32 ? 4 : 3); in sx9360_get_default_reg()
732 reg_def->def &= ~SX9360_REG_PROX_CTRL3_AVGPOS_FILT_MASK; in sx9360_get_default_reg()
733 reg_def->def |= FIELD_PREP(SX9360_REG_PROX_CTRL3_AVGPOS_FILT_MASK, raw); in sx9360_get_default_reg()
746 indio_dev->name = "sx9360"; in sx9360_check_whoami()
794 disable_irq_nosync(data->client->irq); in sx9360_suspend()
796 guard(mutex)(&data->mutex); in sx9360_suspend()
797 ret = regmap_read(data->regmap, SX9360_REG_GNRL_CTRL0, ®val); in sx9360_suspend()
801 data->suspend_ctrl = in sx9360_suspend()
806 return regmap_write(data->regmap, SX9360_REG_GNRL_CTRL0, 0); in sx9360_suspend()
813 scoped_guard(mutex, &data->mutex) { in sx9360_resume()
814 int ret = regmap_update_bits(data->regmap, in sx9360_resume()
817 data->suspend_ctrl); in sx9360_resume()
821 enable_irq(data->client->irq); in sx9360_resume()