On Tue, Mar 19, 2024 at 01:29:23AM +0100, Vasileios Amoiridis wrote: > Add extra IIO_CHAN_INFO_SCALE and IIO_CHAN_INFO_RAW in order to be > able to calculate the processed value with standard userspace IIO > tools. Can be used for triggered buffers as well. > > Even though it is not a good design choice to have SCALE, RAW and > PROCESSED together, the PROCESSED channel is kept for ABI compatibility. ... > + case IIO_CHAN_INFO_RAW: > + switch (chan->type) { > + case IIO_HUMIDITYRELATIVE: > + ret = data->chip_info->read_humid(data, &chan_value); > + if (ret) > + return ret; > + > + *val = chan_value; > + return IIO_VAL_INT; > + case IIO_PRESSURE: > + ret = data->chip_info->read_press(data, &chan_value); > + if (ret) > + return ret; > + > + *val = chan_value; > + return IIO_VAL_INT; > + case IIO_TEMP: > + ret = data->chip_info->read_press(data, &chan_value); > + if (ret) > + return ret; > + > + *val = chan_value; > + return IIO_VAL_INT; > + default: > + return -EINVAL; > + } > + return 0; Dead code. > + case IIO_CHAN_INFO_SCALE: > + switch (chan->type) { > + case IIO_HUMIDITYRELATIVE: > + *val = data->chip_info->humid_coeffs[0]; > + *val2 = data->chip_info->humid_coeffs[1]; > + return data->chip_info->humid_coeffs_type; > + case IIO_PRESSURE: > + *val = data->chip_info->press_coeffs[0]; > + *val2 = data->chip_info->press_coeffs[1]; > + return data->chip_info->press_coeffs_type; > + case IIO_TEMP: > + *val = data->chip_info->temp_coeffs[0]; > + *val2 = data->chip_info->temp_coeffs[1]; > + return data->chip_info->temp_coeffs_type; > + default: > + return -EINVAL; > + } > + return 0; Ditto. -- With Best Regards, Andy Shevchenko