Lines Matching +full:input +full:- +full:precharge +full:- +full:resistor +full:- +full:ohms

1 // SPDX-License-Identifier: GPL-2.0
186 ret = regmap_read(data->regmap, SX9324_REG_AFE_PH0 + chan->channel, &val); in sx9324_phase_configuration_show()
195 buf[len - 1] = '\n'; in sx9324_phase_configuration_show()
315 regmap_reg_range(SX9324_REG_IRQ_CFG2 + 1, SX9324_REG_GNRL_CTRL0 - 1),
316 regmap_reg_range(SX9324_REG_GNRL_CTRL1 + 1, SX9324_REG_AFE_CTRL0 - 1),
317 regmap_reg_range(SX9324_REG_AFE_CTRL9 + 1, SX9324_REG_PROX_CTRL0 - 1),
318 regmap_reg_range(SX9324_REG_PROX_CTRL7 + 1, SX9324_REG_ADV_CTRL0 - 1),
319 regmap_reg_range(SX9324_REG_ADV_CTRL20 + 1, SX9324_REG_PHASE_SEL - 1),
320 regmap_reg_range(SX9324_REG_SAR_LSB + 1, SX9324_REG_RESET - 1),
321 regmap_reg_range(SX9324_REG_RESET + 1, SX9324_REG_WHOAMI - 1),
322 regmap_reg_range(SX9324_REG_WHOAMI + 1, SX9324_REG_REVISION - 1),
361 ret = regmap_write(data->regmap, SX9324_REG_PHASE_SEL, chan->channel); in sx9324_read_prox_data()
365 return regmap_bulk_read(data->regmap, chan->address, val, sizeof(*val)); in sx9324_read_prox_data()
377 ret = regmap_read(data->regmap, SX9324_REG_GNRL_CTRL0, &val); in sx9324_wait_for_sample()
393 reg = SX9324_REG_PROX_CTRL0 + chan->channel / 2; in sx9324_read_gain()
394 ret = regmap_read(data->regmap, reg, &regval); in sx9324_read_gain()
400 regval--; in sx9324_read_gain()
403 return -EINVAL; in sx9324_read_gain()
416 ret = regmap_read(data->regmap, SX9324_REG_GNRL_CTRL0, &regval); in sx9324_read_samp_freq()
435 iio_device_claim_direct_scoped(return -EBUSY, indio_dev) in sx9324_read_raw()
439 iio_device_claim_direct_scoped(return -EBUSY, indio_dev) in sx9324_read_raw()
445 return -EINVAL; in sx9324_read_raw()
456 if (chan->type != IIO_PROXIMITY) in sx9324_read_avail()
457 return -EINVAL; in sx9324_read_avail()
471 return -EINVAL; in sx9324_read_avail()
486 return -EINVAL; in sx9324_set_samp_freq()
488 guard(mutex)(&data->mutex); in sx9324_set_samp_freq()
490 return regmap_update_bits(data->regmap, in sx9324_set_samp_freq()
507 reg = SX9324_REG_PROX_CTRL6 + chan->channel / 2; in sx9324_read_thresh()
508 ret = regmap_read(data->regmap, reg, &regval); in sx9324_read_thresh()
530 ret = regmap_read(data->regmap, SX9324_REG_PROX_CTRL5, &regval); in sx9324_read_hysteresis()
538 *val = pthresh >> (5 - regval); in sx9324_read_hysteresis()
548 ret = regmap_read(data->regmap, SX9324_REG_PROX_CTRL5, &regval); in sx9324_read_far_debounce()
566 ret = regmap_read(data->regmap, SX9324_REG_PROX_CTRL5, &regval); in sx9324_read_close_debounce()
587 if (chan->type != IIO_PROXIMITY) in sx9324_read_event_val()
588 return -EINVAL; in sx9324_read_event_val()
600 return -EINVAL; in sx9324_read_event_val()
605 return -EINVAL; in sx9324_read_event_val()
614 reg = SX9324_REG_PROX_CTRL6 + chan->channel / 2; in sx9324_write_thresh()
620 return -EINVAL; in sx9324_write_thresh()
622 guard(mutex)(&data->mutex); in sx9324_write_thresh()
624 return regmap_write(data->regmap, reg, val); in sx9324_write_thresh()
646 return -EINVAL; in sx9324_write_hysteresis()
649 guard(mutex)(&data->mutex); in sx9324_write_hysteresis()
651 return regmap_update_bits(data->regmap, SX9324_REG_PROX_CTRL5, in sx9324_write_hysteresis()
662 return -EINVAL; in sx9324_write_far_debounce()
666 guard(mutex)(&data->mutex); in sx9324_write_far_debounce()
668 return regmap_update_bits(data->regmap, SX9324_REG_PROX_CTRL5, in sx9324_write_far_debounce()
680 return -EINVAL; in sx9324_write_close_debounce()
684 guard(mutex)(&data->mutex); in sx9324_write_close_debounce()
686 return regmap_update_bits(data->regmap, SX9324_REG_PROX_CTRL5, in sx9324_write_close_debounce()
699 if (chan->type != IIO_PROXIMITY) in sx9324_write_event_val()
700 return -EINVAL; in sx9324_write_event_val()
712 return -EINVAL; in sx9324_write_event_val()
717 return -EINVAL; in sx9324_write_event_val()
726 reg = SX9324_REG_PROX_CTRL0 + chan->channel / 2; in sx9324_write_gain()
730 return -EINVAL; in sx9324_write_gain()
734 guard(mutex)(&data->mutex); in sx9324_write_gain()
736 return regmap_update_bits(data->regmap, reg, in sx9324_write_gain()
753 return -EINVAL; in sx9324_write_raw()
838 ret = regmap_set_bits(data->regmap, SX9324_REG_STAT2, in sx9324_init_compensation()
843 return regmap_read_poll_timeout(data->regmap, SX9324_REG_STAT2, val, in sx9324_init_compensation()
858 return reg_def->def; in sx9324_parse_phase_prop()
862 return reg_def->def; in sx9324_parse_phase_prop()
877 static const char * const sx9324_csidle[] = { "hi-z", "hi-z", "gnd", in sx9324_get_default_reg()
886 switch (reg_def->reg) { in sx9324_get_default_reg()
888 reg_def->def = sx9324_parse_phase_prop(dev, reg_def, in sx9324_get_default_reg()
889 "semtech,ph0-pin"); in sx9324_get_default_reg()
892 reg_def->def = sx9324_parse_phase_prop(dev, reg_def, in sx9324_get_default_reg()
893 "semtech,ph1-pin"); in sx9324_get_default_reg()
896 reg_def->def = sx9324_parse_phase_prop(dev, reg_def, in sx9324_get_default_reg()
897 "semtech,ph2-pin"); in sx9324_get_default_reg()
900 reg_def->def = sx9324_parse_phase_prop(dev, reg_def, in sx9324_get_default_reg()
901 "semtech,ph3-pin"); in sx9324_get_default_reg()
904 ret = device_property_match_property_string(dev, "semtech,cs-idle-sleep", in sx9324_get_default_reg()
908 reg_def->def &= ~SX9324_REG_AFE_CTRL0_CSIDLE_MASK; in sx9324_get_default_reg()
909 reg_def->def |= ret << SX9324_REG_AFE_CTRL0_CSIDLE_SHIFT; in sx9324_get_default_reg()
912 ret = device_property_match_property_string(dev, "semtech,int-comp-resistor", in sx9324_get_default_reg()
916 reg_def->def &= ~SX9324_REG_AFE_CTRL0_RINT_MASK; in sx9324_get_default_reg()
917 reg_def->def |= ret << SX9324_REG_AFE_CTRL0_RINT_SHIFT; in sx9324_get_default_reg()
922 if (reg_def->reg == SX9324_REG_AFE_CTRL4) in sx9324_get_default_reg()
923 prop = "semtech,ph01-resolution"; in sx9324_get_default_reg()
925 prop = "semtech,ph23-resolution"; in sx9324_get_default_reg()
931 raw = ilog2(raw) - 3; in sx9324_get_default_reg()
933 reg_def->def &= ~SX9324_REG_AFE_CTRL4_RESOLUTION_MASK; in sx9324_get_default_reg()
934 reg_def->def |= FIELD_PREP(SX9324_REG_AFE_CTRL4_RESOLUTION_MASK, in sx9324_get_default_reg()
939 "semtech,input-precharge-resistor-ohms", in sx9324_get_default_reg()
944 reg_def->def &= ~SX9324_REG_AFE_CTRL8_RESFILTIN_MASK; in sx9324_get_default_reg()
945 reg_def->def |= FIELD_PREP(SX9324_REG_AFE_CTRL8_RESFILTIN_MASK, in sx9324_get_default_reg()
951 "semtech,input-analog-gain", &raw); in sx9324_get_default_reg()
956 * +---------+----------------+----------------+ in sx9324_get_default_reg()
958 * +---------+----------------+----------------+ in sx9324_get_default_reg()
963 * +---------+----------------+----------------+ in sx9324_get_default_reg()
965 reg_def->def &= ~SX9324_REG_AFE_CTRL9_AGAIN_MASK; in sx9324_get_default_reg()
966 reg_def->def |= FIELD_PREP(SX9324_REG_AFE_CTRL9_AGAIN_MASK, in sx9324_get_default_reg()
971 ret = device_property_read_u32(dev, "semtech,startup-sensor", in sx9324_get_default_reg()
976 reg_def->def &= ~SX9324_REG_ADV_CTRL5_STARTUPSENS_MASK; in sx9324_get_default_reg()
977 reg_def->def |= FIELD_PREP(SX9324_REG_ADV_CTRL5_STARTUPSENS_MASK, in sx9324_get_default_reg()
981 ret = device_property_read_u32(dev, "semtech,avg-pos-strength", in sx9324_get_default_reg()
987 raw = clamp(ilog2(pos), 3, 11) - (pos >= 32 ? 4 : 3); in sx9324_get_default_reg()
989 reg_def->def &= ~SX9324_REG_PROX_CTRL4_AVGPOSFILT_MASK; in sx9324_get_default_reg()
990 reg_def->def |= FIELD_PREP(SX9324_REG_PROX_CTRL4_AVGPOSFILT_MASK, in sx9324_get_default_reg()
995 if (reg_def->reg == SX9324_REG_PROX_CTRL0) in sx9324_get_default_reg()
996 prop = "semtech,ph01-proxraw-strength"; in sx9324_get_default_reg()
998 prop = "semtech,ph23-proxraw-strength"; in sx9324_get_default_reg()
1003 reg_def->def &= ~SX9324_REG_PROX_CTRL0_RAWFILT_MASK; in sx9324_get_default_reg()
1004 reg_def->def |= FIELD_PREP(SX9324_REG_PROX_CTRL0_RAWFILT_MASK, in sx9324_get_default_reg()
1018 indio_dev->name = "sx9324"; in sx9324_check_whoami()
1065 disable_irq_nosync(data->client->irq); in sx9324_suspend()
1067 guard(mutex)(&data->mutex); in sx9324_suspend()
1068 ret = regmap_read(data->regmap, SX9324_REG_GNRL_CTRL1, &regval); in sx9324_suspend()
1072 data->suspend_ctrl = in sx9324_suspend()
1077 return regmap_write(data->regmap, SX9324_REG_GNRL_CTRL1, 0); in sx9324_suspend()
1084 scoped_guard(mutex, &data->mutex) { in sx9324_resume()
1085 int ret = regmap_write(data->regmap, SX9324_REG_GNRL_CTRL1, in sx9324_resume()
1086 data->suspend_ctrl | in sx9324_resume()
1092 enable_irq(data->client->irq); in sx9324_resume()