Commit 275a231c authored by Sean Nyekjaer's avatar Sean Nyekjaer Committed by Thadeu Lima de Souza Cascardo

iio: core: added support for IIO_VAL_INT

BugLink: https://bugs.launchpad.net/bugs/1676356

Added core support for IIO_VAL_INT in write_raw_get_fmt function.
Signed-off-by: default avatarSean Nyekjaer <sean.nyekjaer@prevas.dk>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
(cherry picked from commit f47dff32)
Signed-off-by: default avatarShrirang Bagul <shrirang.bagul@canonical.com>
Acked-by: default avatarStefan Bader <stefan.bader@canonical.com>
Acked-by: default avatarTim Gardner <tim.gardner@canonical.com>
Signed-off-by: default avatarThadeu Lima de Souza Cascardo <cascardo@canonical.com>
parent 143362c5
......@@ -510,6 +510,12 @@ int iio_str_to_fixpoint(const char *str, int fract_mult,
int i = 0, f = 0;
bool integer_part = true, negative = false;
if (fract_mult == 0) {
*fract = 0;
return kstrtoint(str, 0, integer);
}
if (str[0] == '-') {
negative = true;
str++;
......@@ -569,6 +575,9 @@ static ssize_t iio_write_channel_info(struct device *dev,
if (indio_dev->info->write_raw_get_fmt)
switch (indio_dev->info->write_raw_get_fmt(indio_dev,
this_attr->c, this_attr->address)) {
case IIO_VAL_INT:
fract_mult = 0;
break;
case IIO_VAL_INT_PLUS_MICRO:
fract_mult = 100000;
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment