Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: sx9324: Add setting for CS idle mode

Based on device tree setting, set the CS idle mode.

Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20220503193937.3794477-3-swboyd@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Stephen Boyd and committed by
Jonathan Cameron
68d07a7b f2433310

+16
+16
drivers/iio/proximity/sx9324.c
··· 57 57 GENMASK(SX9324_REG_AFE_CTRL0_RINT_SHIFT + 1, \ 58 58 SX9324_REG_AFE_CTRL0_RINT_SHIFT) 59 59 #define SX9324_REG_AFE_CTRL0_RINT_LOWEST 0x00 60 + #define SX9324_REG_AFE_CTRL0_CSIDLE_SHIFT 4 61 + #define SX9324_REG_AFE_CTRL0_CSIDLE_MASK \ 62 + GENMASK(SX9324_REG_AFE_CTRL0_CSIDLE_SHIFT + 1, \ 63 + SX9324_REG_AFE_CTRL0_CSIDLE_SHIFT) 64 + #define SX9324_REG_AFE_CTRL0_RINT_LOWEST 0x00 60 65 #define SX9324_REG_AFE_CTRL1 0x21 61 66 #define SX9324_REG_AFE_CTRL2 0x22 62 67 #define SX9324_REG_AFE_CTRL3 0x23 ··· 877 872 { 878 873 static const char * const sx9324_rints[] = { "lowest", "low", "high", 879 874 "highest" }; 875 + static const char * const sx9324_csidle[] = { "hi-z", "hi-z", "gnd", 876 + "vdd" }; 880 877 #define SX9324_PIN_DEF "semtech,ph0-pin" 881 878 #define SX9324_RESOLUTION_DEF "semtech,ph01-resolution" 882 879 #define SX9324_PROXRAW_DEF "semtech,ph01-proxraw-strength" ··· 908 901 reg_def->def = raw; 909 902 break; 910 903 case SX9324_REG_AFE_CTRL0: 904 + ret = device_property_read_string(dev, 905 + "semtech,cs-idle-sleep", &res); 906 + if (!ret) 907 + ret = match_string(sx9324_csidle, ARRAY_SIZE(sx9324_csidle), res); 908 + if (ret >= 0) { 909 + reg_def->def &= ~SX9324_REG_AFE_CTRL0_CSIDLE_MASK; 910 + reg_def->def |= ret << SX9324_REG_AFE_CTRL0_CSIDLE_SHIFT; 911 + } 912 + 911 913 ret = device_property_read_string(dev, 912 914 "semtech,int-comp-resistor", &res); 913 915 if (ret)