From 04b908a3577a000894fe39353bd2fa3fc53a4410 Mon Sep 17 00:00:00 2001 From: Jeff LaBundy Date: Thu, 26 Apr 2018 10:52:23 -0500 Subject: [PATCH] misc: cs40l2x: Route VPMON to DSP Routed the battery monitoring ADC output (VPMON) to the DSP in support of DSP algorithms that may query the battery voltage. Change-Id: I8d83ed6a3f8ad7f0d985406eb4ef4038760151ca Signed-off-by: Jeff LaBundy Signed-off-by: Ravi Vembu --- drivers/misc/cs40l2x.c | 9 +++++++++ drivers/misc/cs40l2x.h | 1 + 2 files changed, 10 insertions(+) diff --git a/drivers/misc/cs40l2x.c b/drivers/misc/cs40l2x.c index e03cb6f94982..13123b28de2b 100644 --- a/drivers/misc/cs40l2x.c +++ b/drivers/misc/cs40l2x.c @@ -2132,6 +2132,15 @@ static int cs40l2x_init(struct cs40l2x_private *cs40l2x) return ret; } + ret = regmap_update_bits(regmap, CS40L2X_DSP1_RX4_SRC, + CS40L2X_DSP1_RXn_SRC_MASK, + CS40L2X_DSP1_RXn_SRC_VPMON + << CS40L2X_DSP1_RXn_SRC_SHIFT); + if (ret) { + dev_err(dev, "Failed to route battery monitor to DSP\n"); + return ret; + } + return 0; } diff --git a/drivers/misc/cs40l2x.h b/drivers/misc/cs40l2x.h index 654ac83e50b1..6ac166517266 100644 --- a/drivers/misc/cs40l2x.h +++ b/drivers/misc/cs40l2x.h @@ -592,6 +592,7 @@ #define CS40L2X_DSP1_RXn_SRC_SHIFT 0 #define CS40L2X_DSP1_RXn_SRC_VMON 0x18 #define CS40L2X_DSP1_RXn_SRC_IMON 0x19 +#define CS40L2X_DSP1_RXn_SRC_VPMON 0x28 #define CS40L2X_DSP1_RESET_MASK 0x200 #define CS40L2X_DSP1_RESET_SHIFT 9