diff options
author | Jinkyu Song <jksong@sta.samsung.com> | 2011-10-13 21:33:26 -0700 |
---|---|---|
committer | Arve Hjønnevåg <arve@android.com> | 2011-10-14 17:27:25 -0700 |
commit | 33f6599cd54310b6829d786a747c3bcf17de2f85 (patch) | |
tree | 7ef519567ca8309bcc35549559c551f0447c750b | |
parent | e0f2fad1b3cadd58f1738601f5d426ed724a9c23 (diff) | |
download | kernel_samsung_tuna-33f6599cd54310b6829d786a747c3bcf17de2f85.zip kernel_samsung_tuna-33f6599cd54310b6829d786a747c3bcf17de2f85.tar.gz kernel_samsung_tuna-33f6599cd54310b6829d786a747c3bcf17de2f85.tar.bz2 |
misc: inv_mpu: yas530: Report the error flag for overflow or underflow
Invensense libmllite needs to be notified when either overflow or underflow
happens in raw values.
When HAL requires to measure hardware offset, coil init will be triggered.
Change-Id: Ib2185242efeceff87c9a1680004699f4f27fef66
Signed-off-by: Jinkyu Song <jksong@sta.samsung.com>
-rw-r--r-- | drivers/misc/inv_mpu/compass/yas530.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/misc/inv_mpu/compass/yas530.c b/drivers/misc/inv_mpu/compass/yas530.c index dff9a26..fbe7d7f 100644 --- a/drivers/misc/inv_mpu/compass/yas530.c +++ b/drivers/misc/inv_mpu/compass/yas530.c @@ -82,6 +82,11 @@ static unsigned char dck; /* -------------------------------------------------------------------------- */ +static int is_overunderflow(short xy1y2) +{ + return (xy1y2 == 0 || xy1y2 == 4095); +} + static int set_hardware_offset(void *mlsl_handle, struct ext_slave_descr *slave, struct ext_slave_platform_data *pdata, @@ -473,6 +478,9 @@ static int yas530_read(void *mlsl_handle, data[3] = rawfixed[1] & 0xFF; data[4] = rawfixed[2] >> 8; data[5] = rawfixed[2] & 0xFF; + data[6] = is_overunderflow(x) + || is_overunderflow(y1) + || is_overunderflow(y2); return result; } @@ -524,6 +532,14 @@ static int yas530_get_config(void *mlsl_handle, LOG_RESULT_LOCATION(result); return result; } + } else { + result = inv_serial_single_write(mlsl_handle, + pdata->address, + YAS530_REGADDR_ACTUATE_INIT_COIL, 0); + if (result) { + LOG_RESULT_LOCATION(result); + return result; + } } result = measure_and_set_offset(mlsl_handle, slave, pdata, (char *)(data->data)); @@ -636,7 +652,7 @@ static struct ext_slave_descr yas530_descr = { .type = EXT_SLAVE_TYPE_COMPASS, .id = COMPASS_ID_YAS530, .read_reg = 0x06, - .read_len = 6, + .read_len = 7, .endian = EXT_SLAVE_BIG_ENDIAN, .range = {3276, 8001}, .trigger = NULL, |