msm: hwmon: Add EPM ADC driver
External Power Monitor(EPM) uses the external ADS1158 ADC
to measure voltage and current. Each ADS1158 ADC supports
measuring 16 Analog input channels.
APQ8064 has support for 2ADS ADC and can measure upto 32
analog input channels. The power to the EPM uses a
SX1509 I2C expander to enable the ADS ADC. Depending on
the input channel the appropriate chip select is de-asserted
to select the ADS ADC to measure the input signal. The
ADS1158 chip is configured through the SPI interface.
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Change-Id: Ib9f36606b6b183f75754b7763dbe45455c779327
diff --git a/include/linux/epm_adc.h b/include/linux/epm_adc.h
new file mode 100644
index 0000000..25211f3
--- /dev/null
+++ b/include/linux/epm_adc.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __EPM_ADC_H
+#define __EPM_ADC_H
+
+#include <linux/i2c.h>
+
+struct epm_chan_request {
+ /* EPM ADC device index. 0 - ADC1, 1 - ADC2 */
+ uint32_t device_idx;
+ /* Channel number within the EPM ADC device */
+ uint32_t channel_idx;
+ /* The data meaningful for each individual channel whether it is
+ * voltage, current etc. */
+ int32_t physical;
+};
+
+struct epm_chan_properties {
+ uint32_t resistorValue;
+ uint32_t gain;
+};
+
+struct epm_adc_platform_data {
+ struct epm_chan_properties *channel;
+ uint32_t num_channels;
+ uint32_t num_adc;
+ uint32_t chan_per_adc;
+ uint32_t chan_per_mux;
+ struct i2c_board_info epm_i2c_board_info;
+ uint32_t bus_id;
+ uint32_t gpio_expander_base_addr;
+};
+#endif /* __EPM_ADC_H */