Lines Matching refs:adc_tm
241 static int adc_tm5_read(struct adc_tm5_chip *adc_tm, u16 offset, u8 *data, int len) in adc_tm5_read() argument
243 return regmap_bulk_read(adc_tm->regmap, adc_tm->base + offset, data, len); in adc_tm5_read()
246 static int adc_tm5_write(struct adc_tm5_chip *adc_tm, u16 offset, u8 *data, int len) in adc_tm5_write() argument
248 return regmap_bulk_write(adc_tm->regmap, adc_tm->base + offset, data, len); in adc_tm5_write()
251 static int adc_tm5_reg_update(struct adc_tm5_chip *adc_tm, u16 offset, u8 mask, u8 val) in adc_tm5_reg_update() argument
253 return regmap_write_bits(adc_tm->regmap, adc_tm->base + offset, mask, val); in adc_tm5_reg_update()
668 static int adc_tm5_register_tzd(struct adc_tm5_chip *adc_tm) in adc_tm5_register_tzd() argument
673 for (i = 0; i < adc_tm->nchannels; i++) { in adc_tm5_register_tzd()
674 adc_tm->channels[i].chip = adc_tm; in adc_tm5_register_tzd()
675 tzd = devm_thermal_of_zone_register(adc_tm->dev, in adc_tm5_register_tzd()
676 adc_tm->channels[i].channel, in adc_tm5_register_tzd()
677 &adc_tm->channels[i], in adc_tm5_register_tzd()
681 dev_dbg(adc_tm->dev, "thermal sensor on channel %d is not used\n", in adc_tm5_register_tzd()
682 adc_tm->channels[i].channel); in adc_tm5_register_tzd()
686 dev_err(adc_tm->dev, "Error registering TZ zone for channel %d: %ld\n", in adc_tm5_register_tzd()
687 adc_tm->channels[i].channel, PTR_ERR(tzd)); in adc_tm5_register_tzd()
690 adc_tm->channels[i].tzd = tzd; in adc_tm5_register_tzd()
691 devm_thermal_add_hwmon_sysfs(adc_tm->dev, tzd); in adc_tm5_register_tzd()
780 static int adc_tm5_get_dt_channel_data(struct adc_tm5_chip *adc_tm, in adc_tm5_get_dt_channel_data() argument
787 struct device *dev = adc_tm->dev; in adc_tm5_get_dt_channel_data()
821 if (adc_tm->data->gen == ADC_TM5_GEN2) in adc_tm5_get_dt_channel_data()
830 channel->iio = devm_fwnode_iio_channel_get_by_name(adc_tm->dev, in adc_tm5_get_dt_channel_data()
855 ret = qcom_adc5_hw_settle_time_from_dt(value, adc_tm->data->hw_settle); in adc_tm5_get_dt_channel_data()
871 if (adc_tm->data->gen == ADC_TM5_GEN2) { in adc_tm5_get_dt_channel_data()
874 ret = qcom_adc5_decimation_from_dt(value, adc_tm->data->decimation); in adc_tm5_get_dt_channel_data()
941 static int adc_tm5_get_dt_data(struct adc_tm5_chip *adc_tm, struct device_node *node) in adc_tm5_get_dt_data() argument
947 struct device *dev = adc_tm->dev; in adc_tm5_get_dt_data()
949 adc_tm->nchannels = of_get_available_child_count(node); in adc_tm5_get_dt_data()
950 if (!adc_tm->nchannels) in adc_tm5_get_dt_data()
953 adc_tm->channels = devm_kcalloc(dev, adc_tm->nchannels, in adc_tm5_get_dt_data()
954 sizeof(*adc_tm->channels), GFP_KERNEL); in adc_tm5_get_dt_data()
955 if (!adc_tm->channels) in adc_tm5_get_dt_data()
958 channels = adc_tm->channels; in adc_tm5_get_dt_data()
960 adc_tm->data = of_device_get_match_data(dev); in adc_tm5_get_dt_data()
961 if (!adc_tm->data) in adc_tm5_get_dt_data()
962 adc_tm->data = &adc_tm5_data_pmic; in adc_tm5_get_dt_data()
966 ret = qcom_adc5_decimation_from_dt(value, adc_tm->data->decimation); in adc_tm5_get_dt_data()
971 adc_tm->decimation = ret; in adc_tm5_get_dt_data()
973 adc_tm->decimation = ADC5_DECIMATION_DEFAULT; in adc_tm5_get_dt_data()
983 adc_tm->avg_samples = ret; in adc_tm5_get_dt_data()
985 adc_tm->avg_samples = VADC_DEF_AVG_SAMPLES; in adc_tm5_get_dt_data()
989 ret = adc_tm5_get_dt_channel_data(adc_tm, channels, child); in adc_tm5_get_dt_data()
1005 struct adc_tm5_chip *adc_tm; in adc_tm5_probe() local
1018 adc_tm = devm_kzalloc(&pdev->dev, sizeof(*adc_tm), GFP_KERNEL); in adc_tm5_probe()
1019 if (!adc_tm) in adc_tm5_probe()
1022 adc_tm->regmap = regmap; in adc_tm5_probe()
1023 adc_tm->dev = dev; in adc_tm5_probe()
1024 adc_tm->base = reg; in adc_tm5_probe()
1030 ret = adc_tm5_get_dt_data(adc_tm, node); in adc_tm5_probe()
1034 ret = adc_tm->data->init(adc_tm); in adc_tm5_probe()
1040 ret = adc_tm5_register_tzd(adc_tm); in adc_tm5_probe()
1046 return devm_request_threaded_irq(dev, irq, NULL, adc_tm->data->isr, in adc_tm5_probe()
1047 IRQF_ONESHOT, adc_tm->data->irq_name, adc_tm); in adc_tm5_probe()