iio: adis: Add adis_update_bits() APIs
This patch adds a `regmap_update_bits()` like API to the ADIS library. It provides locked and unlocked variant. Signed-off-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:

committed by
Jonathan Cameron

parent
698211065d
commit
b9c5eec725
@@ -223,6 +223,31 @@ int __adis_read_reg(struct adis *adis, unsigned int reg,
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__adis_read_reg);
|
||||
/**
|
||||
* __adis_update_bits_base() - ADIS Update bits function - Unlocked version
|
||||
* @adis: The adis device
|
||||
* @reg: The address of the lower of the two registers
|
||||
* @mask: Bitmask to change
|
||||
* @val: Value to be written
|
||||
* @size: Size of the register to update
|
||||
*
|
||||
* Updates the desired bits of @reg in accordance with @mask and @val.
|
||||
*/
|
||||
int __adis_update_bits_base(struct adis *adis, unsigned int reg, const u32 mask,
|
||||
const u32 val, u8 size)
|
||||
{
|
||||
int ret;
|
||||
u32 __val;
|
||||
|
||||
ret = __adis_read_reg(adis, reg, &__val, size);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
__val = (__val & ~mask) | (val & mask);
|
||||
|
||||
return __adis_write_reg(adis, reg, __val, size);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__adis_update_bits_base);
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
|
||||
|
Reference in New Issue
Block a user