drivers: ad559x: fix mfd_ad559x_i2c_read_reg
Reading a register requires 0x70 to be ORed with the register address. Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
This commit is contained in:
parent
b7badee6aa
commit
8933e6cefa
2 changed files with 6 additions and 1 deletions
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
#include "mfd_ad559x.h"
|
||||
|
||||
#define AD559X_REG_RD_POINTER 0x70
|
||||
|
||||
static int mfd_ad559x_i2c_read_raw(const struct device *dev, uint8_t *val, size_t len)
|
||||
{
|
||||
const struct mfd_ad559x_config *config = dev->config;
|
||||
|
|
@ -35,7 +37,9 @@ static int mfd_ad559x_i2c_read_reg(const struct device *dev, uint8_t reg, uint8_
|
|||
|
||||
ARG_UNUSED(reg_data);
|
||||
|
||||
__ASSERT((reg & 0xf0) == 0, "reg bits [7:4] should be 0: 0x%x", reg);
|
||||
if (reg >= AD559X_REG_SEQ_ADC || reg <= AD559X_REG_IO_TS_CONFIG) {
|
||||
reg |= AD559X_REG_RD_POINTER;
|
||||
}
|
||||
|
||||
ret = i2c_write_read_dt(&config->i2c, ®, sizeof(reg), buf, sizeof(buf));
|
||||
if (ret < 0) {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ extern "C" {
|
|||
#define AD559X_REG_GPIO_SET 0x09U
|
||||
#define AD559X_REG_GPIO_INPUT_EN 0x0AU
|
||||
#define AD559X_REG_PD_REF_CTRL 0x0BU
|
||||
#define AD559X_REG_IO_TS_CONFIG 0x0DU
|
||||
|
||||
#define AD559X_EN_REF BIT(9)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue