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, ®val); 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, ®val); 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, ®val); in sx9324_read_thresh()
530 ret = regmap_read(data->regmap, SX9324_REG_PROX_CTRL5, ®val); in sx9324_read_hysteresis()
538 *val = pthresh >> (5 - regval); in sx9324_read_hysteresis()
548 ret = regmap_read(data->regmap, SX9324_REG_PROX_CTRL5, ®val); in sx9324_read_far_debounce()
566 ret = regmap_read(data->regmap, SX9324_REG_PROX_CTRL5, ®val); 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()
879 if (!reg_def->property || !adev) in sx_common_get_raw_register_config()
882 snprintf(prop, ARRAY_SIZE(prop), "%s,reg_%s", acpi_device_hid(adev), reg_def->property); in sx_common_get_raw_register_config()
887 reg_def->def = raw; in sx_common_get_raw_register_config()
897 static const char * const sx9324_csidle[] = { "hi-z", "hi-z", "gnd", in sx9324_get_default_reg()
906 switch (reg_def->reg) { in sx9324_get_default_reg()
908 reg_def->def = sx9324_parse_phase_prop(dev, reg_def, in sx9324_get_default_reg()
909 "semtech,ph0-pin"); in sx9324_get_default_reg()
912 reg_def->def = sx9324_parse_phase_prop(dev, reg_def, in sx9324_get_default_reg()
913 "semtech,ph1-pin"); in sx9324_get_default_reg()
916 reg_def->def = sx9324_parse_phase_prop(dev, reg_def, in sx9324_get_default_reg()
917 "semtech,ph2-pin"); in sx9324_get_default_reg()
920 reg_def->def = sx9324_parse_phase_prop(dev, reg_def, in sx9324_get_default_reg()
921 "semtech,ph3-pin"); in sx9324_get_default_reg()
924 ret = device_property_match_property_string(dev, "semtech,cs-idle-sleep", in sx9324_get_default_reg()
928 reg_def->def &= ~SX9324_REG_AFE_CTRL0_CSIDLE_MASK; in sx9324_get_default_reg()
929 reg_def->def |= ret << SX9324_REG_AFE_CTRL0_CSIDLE_SHIFT; in sx9324_get_default_reg()
932 ret = device_property_match_property_string(dev, "semtech,int-comp-resistor", in sx9324_get_default_reg()
936 reg_def->def &= ~SX9324_REG_AFE_CTRL0_RINT_MASK; in sx9324_get_default_reg()
937 reg_def->def |= ret << SX9324_REG_AFE_CTRL0_RINT_SHIFT; in sx9324_get_default_reg()
942 if (reg_def->reg == SX9324_REG_AFE_CTRL4) in sx9324_get_default_reg()
943 prop = "semtech,ph01-resolution"; in sx9324_get_default_reg()
945 prop = "semtech,ph23-resolution"; in sx9324_get_default_reg()
951 raw = ilog2(raw) - 3; in sx9324_get_default_reg()
953 reg_def->def &= ~SX9324_REG_AFE_CTRL4_RESOLUTION_MASK; in sx9324_get_default_reg()
954 reg_def->def |= FIELD_PREP(SX9324_REG_AFE_CTRL4_RESOLUTION_MASK, in sx9324_get_default_reg()
959 "semtech,input-precharge-resistor-ohms", in sx9324_get_default_reg()
964 reg_def->def &= ~SX9324_REG_AFE_CTRL8_RESFILTIN_MASK; in sx9324_get_default_reg()
965 reg_def->def |= FIELD_PREP(SX9324_REG_AFE_CTRL8_RESFILTIN_MASK, in sx9324_get_default_reg()
971 "semtech,input-analog-gain", &raw); in sx9324_get_default_reg()
976 * +---------+----------------+----------------+ in sx9324_get_default_reg()
978 * +---------+----------------+----------------+ in sx9324_get_default_reg()
983 * +---------+----------------+----------------+ in sx9324_get_default_reg()
985 reg_def->def &= ~SX9324_REG_AFE_CTRL9_AGAIN_MASK; in sx9324_get_default_reg()
986 reg_def->def |= FIELD_PREP(SX9324_REG_AFE_CTRL9_AGAIN_MASK, in sx9324_get_default_reg()
991 ret = device_property_read_u32(dev, "semtech,startup-sensor", in sx9324_get_default_reg()
996 reg_def->def &= ~SX9324_REG_ADV_CTRL5_STARTUPSENS_MASK; in sx9324_get_default_reg()
997 reg_def->def |= FIELD_PREP(SX9324_REG_ADV_CTRL5_STARTUPSENS_MASK, in sx9324_get_default_reg()
1001 ret = device_property_read_u32(dev, "semtech,avg-pos-strength", in sx9324_get_default_reg()
1007 raw = clamp(ilog2(pos), 3, 11) - (pos >= 32 ? 4 : 3); in sx9324_get_default_reg()
1009 reg_def->def &= ~SX9324_REG_PROX_CTRL4_AVGPOSFILT_MASK; in sx9324_get_default_reg()
1010 reg_def->def |= FIELD_PREP(SX9324_REG_PROX_CTRL4_AVGPOSFILT_MASK, in sx9324_get_default_reg()
1015 if (reg_def->reg == SX9324_REG_PROX_CTRL0) in sx9324_get_default_reg()
1016 prop = "semtech,ph01-proxraw-strength"; in sx9324_get_default_reg()
1018 prop = "semtech,ph23-proxraw-strength"; in sx9324_get_default_reg()
1023 reg_def->def &= ~SX9324_REG_PROX_CTRL0_RAWFILT_MASK; in sx9324_get_default_reg()
1024 reg_def->def |= FIELD_PREP(SX9324_REG_PROX_CTRL0_RAWFILT_MASK, in sx9324_get_default_reg()
1038 indio_dev->name = "sx9324"; in sx9324_check_whoami()
1085 disable_irq_nosync(data->client->irq); in sx9324_suspend()
1087 guard(mutex)(&data->mutex); in sx9324_suspend()
1088 ret = regmap_read(data->regmap, SX9324_REG_GNRL_CTRL1, ®val); in sx9324_suspend()
1092 data->suspend_ctrl = in sx9324_suspend()
1097 return regmap_write(data->regmap, SX9324_REG_GNRL_CTRL1, 0); in sx9324_suspend()
1104 scoped_guard(mutex, &data->mutex) { in sx9324_resume()
1105 int ret = regmap_write(data->regmap, SX9324_REG_GNRL_CTRL1, in sx9324_resume()
1106 data->suspend_ctrl | in sx9324_resume()
1112 enable_irq(data->client->irq); in sx9324_resume()