mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-07 22:08:33 -04:00
usb: typec: tcpm/tcpci_maxim: use GENMASK() for TCPC_VENDOR_ADC_CTRL1 register
Convert register TCPC_VENDOR_ADC_CTRL1 to using GENMASK() and FIELD_PREP() so as to keep using a similar approach throughout the code base and make it arguably easier to read. Signed-off-by: André Draszik <andre.draszik@linaro.org> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20240710-tcpc-cleanup-v1-13-0ec1f41f4263@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
5cb7e20bad
commit
fc64f1ce29
@@ -76,8 +76,8 @@ static int max_contaminant_read_adc_mv(struct max_tcpci_chip *chip, enum fladc_s
|
||||
int ret;
|
||||
|
||||
/* Channel & scale select */
|
||||
ret = regmap_update_bits(regmap, TCPC_VENDOR_ADC_CTRL1, ADCINSEL_MASK,
|
||||
channel << ADC_CHANNEL_OFFSET);
|
||||
ret = regmap_update_bits(regmap, TCPC_VENDOR_ADC_CTRL1, ADCINSEL,
|
||||
FIELD_PREP(ADCINSEL, channel));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -96,7 +96,8 @@ static int max_contaminant_read_adc_mv(struct max_tcpci_chip *chip, enum fladc_s
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = regmap_update_bits(regmap, TCPC_VENDOR_ADC_CTRL1, ADCINSEL_MASK, 0);
|
||||
ret = regmap_update_bits(regmap, TCPC_VENDOR_ADC_CTRL1, ADCINSEL,
|
||||
FIELD_PREP(ADCINSEL, 0));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
||||
@@ -37,8 +37,7 @@
|
||||
#define WTRCYCLE_4_8_S 1
|
||||
|
||||
#define TCPC_VENDOR_ADC_CTRL1 0x91
|
||||
#define ADCINSEL_MASK GENMASK(7, 5)
|
||||
#define ADC_CHANNEL_OFFSET 5
|
||||
#define ADCINSEL GENMASK(7, 5)
|
||||
#define ADCEN BIT(0)
|
||||
|
||||
enum contamiant_state {
|
||||
|
||||
Reference in New Issue
Block a user