diff --git a/drivers/iio/adc/qcom-spmi-adc5.c b/drivers/iio/adc/qcom-spmi-adc5.c index 9d37c9bada5e..1bfa247c8b18 100644 --- a/drivers/iio/adc/qcom-spmi-adc5.c +++ b/drivers/iio/adc/qcom-spmi-adc5.c @@ -1104,6 +1104,11 @@ static int adc5_get_fw_channel_data(struct adc5_chip *adc, prop->avg_samples = VADC_DEF_AVG_SAMPLES; } + prop->scale_fn_type = -EINVAL; + ret = fwnode_property_read_u32(fwnode, "qcom,scale-fn-type", &value); + if (!ret && value < SCALE_HW_CALIB_INVALID) + prop->scale_fn_type = value; + if (fwnode_property_read_bool(fwnode, "qcom,ratiometric")) prop->cal_method = ADC5_RATIOMETRIC_CAL; else if (fwnode_property_read_bool(fwnode, "qcom,no-cal")) @@ -1239,8 +1244,10 @@ static int adc5_get_fw_data(struct adc5_chip *adc) return ret; } - prop.scale_fn_type = - adc->data->adc_chans[prop.channel].scale_fn_type; + if (prop.scale_fn_type == -EINVAL) + prop.scale_fn_type = + adc->data->adc_chans[prop.channel].scale_fn_type; + *chan_props = prop; adc_chan = &adc->data->adc_chans[prop.channel];