From f5eebc792559d33ddf973f640f7570d042e3bbe8 Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Wed, 21 Nov 2018 20:05:28 +0200 Subject: power: axp209: Define the chip version mask Use a define for the chip version mask on the axp209. Signed-off-by: Olliver Schinagl Signed-off-by: Priit Laes Acked-by: Maxime Ripard --- drivers/power/axp209.c | 5 +---- include/axp209.h | 2 ++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/power/axp209.c b/drivers/power/axp209.c index 6de5ec6825..e13c762a81 100644 --- a/drivers/power/axp209.c +++ b/drivers/power/axp209.c @@ -153,10 +153,7 @@ int axp_init(void) if (rc) return rc; - /* Low 4 bits is chip version */ - ver &= 0x0f; - - if (ver != 0x1) + if ((ver & AXP209_CHIP_VERSION_MASK) != 0x1) return -EINVAL; /* Mask all interrupts */ diff --git a/include/axp209.h b/include/axp209.h index 3a4fc28196..43e3873e24 100644 --- a/include/axp209.h +++ b/include/axp209.h @@ -25,6 +25,8 @@ enum axp209_reg { #define AXP209_POWER_STATUS_ON_BY_DC BIT(0) #define AXP209_POWER_STATUS_VBUS_USABLE BIT(4) +#define AXP209_CHIP_VERSION_MASK 0x0f + #define AXP209_OUTPUT_CTRL_EXTEN BIT(0) #define AXP209_OUTPUT_CTRL_DCDC3 BIT(1) #define AXP209_OUTPUT_CTRL_LDO2 BIT(2) -- cgit