Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1632185 > unrolled thread
| Started by | Sebastian Reichel <sebastian.reichel@collabora.co.uk> |
|---|---|
| First post | 2017-04-27 17:40 +0200 |
| Last post | 2017-04-30 18:40 +0200 |
| Articles | 8 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 0/7] twl4030-madc cleanup Sebastian Reichel <sebastian.reichel@collabora.co.uk> - 2017-04-27 17:40 +0200
[PATCH 5/7] iio: adc: twl4030: Drop struct twl4030_madc_user_parms Sebastian Reichel <sebastian.reichel@collabora.co.uk> - 2017-04-27 17:40 +0200
[PATCH 2/7] power: supply: avoid unused twl4030-madc.h Sebastian Reichel <sebastian.reichel@collabora.co.uk> - 2017-04-27 17:40 +0200
Re: [PATCH 2/7] power: supply: avoid unused twl4030-madc.h Sebastian Reichel <sebastian.reichel@collabora.co.uk> - 2017-05-01 14:00 +0200
[PATCH 3/7] iio: adc: twl4030: Drop twl4030_get_madc_conversion() Sebastian Reichel <sebastian.reichel@collabora.co.uk> - 2017-04-27 17:40 +0200
Re: [PATCH 3/7] iio: adc: twl4030: Drop twl4030_get_madc_conversion() Jonathan Cameron <jic23@kernel.org> - 2017-04-30 18:40 +0200
[PATCH 7/7] iio: adc: twl4030: Fold twl4030-madc.h into driver Sebastian Reichel <sebastian.reichel@collabora.co.uk> - 2017-04-27 17:40 +0200
Re: [PATCH 7/7] iio: adc: twl4030: Fold twl4030-madc.h into driver Jonathan Cameron <jic23@kernel.org> - 2017-04-30 18:40 +0200
| From | Sebastian Reichel <sebastian.reichel@collabora.co.uk> |
|---|---|
| Date | 2017-04-27 17:40 +0200 |
| Subject | [PATCH 0/7] twl4030-madc cleanup |
| Message-ID | <tATGp-2wy-7@gated-at.bofh.it> |
Hi, Here are a few cleanup patches for the twl4030-madc driver, that remove the last users of the driver's legacy API and then remove it. -- Sebastian Sebastian Reichel (7): hwmon: twl4030-madc: drop driver power: supply: avoid unused twl4030-madc.h iio: adc: twl4030: Drop twl4030_get_madc_conversion() iio: adc: twl4030: Unexport twl4030_madc_conversion() iio: adc: twl4030: Drop struct twl4030_madc_user_parms iio: adc: twl4030: Remove twl4030_madc_request.func_cb iio: adc: twl4030: Fold twl4030-madc.h into driver drivers/hwmon/Kconfig | 10 -- drivers/hwmon/Makefile | 1 - drivers/hwmon/twl4030-madc-hwmon.c | 118 ---------------- drivers/iio/adc/twl4030-madc.c | 209 +++++++++++++++------------- drivers/power/supply/rx51_battery.c | 1 - drivers/power/supply/twl4030_madc_battery.c | 1 - include/linux/i2c/twl4030-madc.h | 147 ------------------- 7 files changed, 115 insertions(+), 372 deletions(-) delete mode 100644 drivers/hwmon/twl4030-madc-hwmon.c delete mode 100644 include/linux/i2c/twl4030-madc.h -- 2.11.0
[toc] | [next] | [standalone]
| From | Sebastian Reichel <sebastian.reichel@collabora.co.uk> |
|---|---|
| Date | 2017-04-27 17:40 +0200 |
| Subject | [PATCH 5/7] iio: adc: twl4030: Drop struct twl4030_madc_user_parms |
| Message-ID | <tATGq-2wy-27@gated-at.bofh.it> |
| In reply to | #1632185 |
This struct is no longer used by anything in the kernel.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
---
include/linux/i2c/twl4030-madc.h | 6 ------
1 file changed, 6 deletions(-)
diff --git a/include/linux/i2c/twl4030-madc.h b/include/linux/i2c/twl4030-madc.h
index be9260e261ac..f395700fb933 100644
--- a/include/linux/i2c/twl4030-madc.h
+++ b/include/linux/i2c/twl4030-madc.h
@@ -135,10 +135,4 @@ enum sample_type {
#define TWL4030_REG_GPBR1 0x0c
#define TWL4030_GPBR1_MADC_HFCLK_EN (1 << 7)
-struct twl4030_madc_user_parms {
- int channel;
- int average;
- int status;
- u16 result;
-};
#endif
--
2.11.0
[toc] | [prev] | [next] | [standalone]
| From | Sebastian Reichel <sebastian.reichel@collabora.co.uk> |
|---|---|
| Date | 2017-04-27 17:40 +0200 |
| Subject | [PATCH 2/7] power: supply: avoid unused twl4030-madc.h |
| Message-ID | <tATGq-2wy-23@gated-at.bofh.it> |
| In reply to | #1632185 |
Avoid inclusion of unused twl4030-madc.h. This will allow twl4030-madc.h to be merged into the iio driver. Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> --- drivers/power/supply/rx51_battery.c | 1 - drivers/power/supply/twl4030_madc_battery.c | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/power/supply/rx51_battery.c b/drivers/power/supply/rx51_battery.c index af9383d23d12..5654708b1279 100644 --- a/drivers/power/supply/rx51_battery.c +++ b/drivers/power/supply/rx51_battery.c @@ -23,7 +23,6 @@ #include <linux/platform_device.h> #include <linux/power_supply.h> #include <linux/slab.h> -#include <linux/i2c/twl4030-madc.h> #include <linux/iio/consumer.h> #include <linux/of.h> diff --git a/drivers/power/supply/twl4030_madc_battery.c b/drivers/power/supply/twl4030_madc_battery.c index f5817e422d64..4d41acb98576 100644 --- a/drivers/power/supply/twl4030_madc_battery.c +++ b/drivers/power/supply/twl4030_madc_battery.c @@ -17,7 +17,6 @@ #include <linux/power_supply.h> #include <linux/slab.h> #include <linux/sort.h> -#include <linux/i2c/twl4030-madc.h> #include <linux/power/twl4030_madc_battery.h> #include <linux/iio/consumer.h> -- 2.11.0
[toc] | [prev] | [next] | [standalone]
| From | Sebastian Reichel <sebastian.reichel@collabora.co.uk> |
|---|---|
| Date | 2017-05-01 14:00 +0200 |
| Subject | Re: [PATCH 2/7] power: supply: avoid unused twl4030-madc.h |
| Message-ID | <tCi9H-fo-5@gated-at.bofh.it> |
| In reply to | #1632187 |
[Multipart message — attachments visible in raw view] — view raw
Hi, On Thu, Apr 27, 2017 at 05:30:07PM +0200, Sebastian Reichel wrote: > Avoid inclusion of unused twl4030-madc.h. This > will allow twl4030-madc.h to be merged into the > iio driver. > > Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Queued into power-supply's for-next. I plan to send a second pull-request for power-supply. -- Sebastian
[toc] | [prev] | [next] | [standalone]
| From | Sebastian Reichel <sebastian.reichel@collabora.co.uk> |
|---|---|
| Date | 2017-04-27 17:40 +0200 |
| Subject | [PATCH 3/7] iio: adc: twl4030: Drop twl4030_get_madc_conversion() |
| Message-ID | <tATGr-2wy-35@gated-at.bofh.it> |
| In reply to | #1632185 |
Drop legacy twl4030_get_madc_conversion() method. It has been
used by drivers to get madc data before it conversion to IIO
API. There are no users in the mainline kernel anymore.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
---
drivers/iio/adc/twl4030-madc.c | 21 ---------------------
include/linux/i2c/twl4030-madc.h | 1 -
2 files changed, 22 deletions(-)
diff --git a/drivers/iio/adc/twl4030-madc.c b/drivers/iio/adc/twl4030-madc.c
index 0c74869a540a..88e44066ef82 100644
--- a/drivers/iio/adc/twl4030-madc.c
+++ b/drivers/iio/adc/twl4030-madc.c
@@ -642,27 +642,6 @@ int twl4030_madc_conversion(struct twl4030_madc_request *req)
}
EXPORT_SYMBOL_GPL(twl4030_madc_conversion);
-int twl4030_get_madc_conversion(int channel_no)
-{
- struct twl4030_madc_request req;
- int temp = 0;
- int ret;
-
- req.channels = (1 << channel_no);
- req.method = TWL4030_MADC_SW2;
- req.active = 0;
- req.raw = 0;
- req.func_cb = NULL;
- ret = twl4030_madc_conversion(&req);
- if (ret < 0)
- return ret;
- if (req.rbuf[channel_no] > 0)
- temp = req.rbuf[channel_no];
-
- return temp;
-}
-EXPORT_SYMBOL_GPL(twl4030_get_madc_conversion);
-
/**
* twl4030_madc_set_current_generator() - setup bias current
*
diff --git a/include/linux/i2c/twl4030-madc.h b/include/linux/i2c/twl4030-madc.h
index 1c0134dd3271..0c919ebb31e0 100644
--- a/include/linux/i2c/twl4030-madc.h
+++ b/include/linux/i2c/twl4030-madc.h
@@ -143,5 +143,4 @@ struct twl4030_madc_user_parms {
};
int twl4030_madc_conversion(struct twl4030_madc_request *conv);
-int twl4030_get_madc_conversion(int channel_no);
#endif
--
2.11.0
[toc] | [prev] | [next] | [standalone]
| From | Jonathan Cameron <jic23@kernel.org> |
|---|---|
| Date | 2017-04-30 18:40 +0200 |
| Subject | Re: [PATCH 3/7] iio: adc: twl4030: Drop twl4030_get_madc_conversion() |
| Message-ID | <tC038-5u7-35@gated-at.bofh.it> |
| In reply to | #1632188 |
On 27/04/17 16:30, Sebastian Reichel wrote:
> Drop legacy twl4030_get_madc_conversion() method. It has been
> used by drivers to get madc data before it conversion to IIO
> API. There are no users in the mainline kernel anymore.
>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Jonathan Cameron <jic23@kernel.org>
> ---
> drivers/iio/adc/twl4030-madc.c | 21 ---------------------
> include/linux/i2c/twl4030-madc.h | 1 -
> 2 files changed, 22 deletions(-)
>
> diff --git a/drivers/iio/adc/twl4030-madc.c b/drivers/iio/adc/twl4030-madc.c
> index 0c74869a540a..88e44066ef82 100644
> --- a/drivers/iio/adc/twl4030-madc.c
> +++ b/drivers/iio/adc/twl4030-madc.c
> @@ -642,27 +642,6 @@ int twl4030_madc_conversion(struct twl4030_madc_request *req)
> }
> EXPORT_SYMBOL_GPL(twl4030_madc_conversion);
>
> -int twl4030_get_madc_conversion(int channel_no)
> -{
> - struct twl4030_madc_request req;
> - int temp = 0;
> - int ret;
> -
> - req.channels = (1 << channel_no);
> - req.method = TWL4030_MADC_SW2;
> - req.active = 0;
> - req.raw = 0;
> - req.func_cb = NULL;
> - ret = twl4030_madc_conversion(&req);
> - if (ret < 0)
> - return ret;
> - if (req.rbuf[channel_no] > 0)
> - temp = req.rbuf[channel_no];
> -
> - return temp;
> -}
> -EXPORT_SYMBOL_GPL(twl4030_get_madc_conversion);
> -
> /**
> * twl4030_madc_set_current_generator() - setup bias current
> *
> diff --git a/include/linux/i2c/twl4030-madc.h b/include/linux/i2c/twl4030-madc.h
> index 1c0134dd3271..0c919ebb31e0 100644
> --- a/include/linux/i2c/twl4030-madc.h
> +++ b/include/linux/i2c/twl4030-madc.h
> @@ -143,5 +143,4 @@ struct twl4030_madc_user_parms {
> };
>
> int twl4030_madc_conversion(struct twl4030_madc_request *conv);
> -int twl4030_get_madc_conversion(int channel_no);
> #endif
>
[toc] | [prev] | [next] | [standalone]
| From | Sebastian Reichel <sebastian.reichel@collabora.co.uk> |
|---|---|
| Date | 2017-04-27 17:40 +0200 |
| Subject | [PATCH 7/7] iio: adc: twl4030: Fold twl4030-madc.h into driver |
| Message-ID | <tATGr-2wy-37@gated-at.bofh.it> |
| In reply to | #1632185 |
twl4030-madc.h is no longer used by anything outside of
the iio driver, so it can be merged into the driver.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
---
drivers/iio/adc/twl4030-madc.c | 113 +++++++++++++++++++++++++++++++-
include/linux/i2c/twl4030-madc.h | 137 ---------------------------------------
2 files changed, 112 insertions(+), 138 deletions(-)
delete mode 100644 include/linux/i2c/twl4030-madc.h
diff --git a/drivers/iio/adc/twl4030-madc.c b/drivers/iio/adc/twl4030-madc.c
index 21df5b932bd1..bd3d37fc2144 100644
--- a/drivers/iio/adc/twl4030-madc.c
+++ b/drivers/iio/adc/twl4030-madc.c
@@ -36,7 +36,6 @@
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/i2c/twl.h>
-#include <linux/i2c/twl4030-madc.h>
#include <linux/module.h>
#include <linux/stddef.h>
#include <linux/mutex.h>
@@ -49,9 +48,121 @@
#include <linux/iio/iio.h>
+#define TWL4030_MADC_MAX_CHANNELS 16
+
+#define TWL4030_MADC_CTRL1 0x00
+#define TWL4030_MADC_CTRL2 0x01
+
+#define TWL4030_MADC_RTSELECT_LSB 0x02
+#define TWL4030_MADC_SW1SELECT_LSB 0x06
+#define TWL4030_MADC_SW2SELECT_LSB 0x0A
+
+#define TWL4030_MADC_RTAVERAGE_LSB 0x04
+#define TWL4030_MADC_SW1AVERAGE_LSB 0x08
+#define TWL4030_MADC_SW2AVERAGE_LSB 0x0C
+
+#define TWL4030_MADC_CTRL_SW1 0x12
+#define TWL4030_MADC_CTRL_SW2 0x13
+
+#define TWL4030_MADC_RTCH0_LSB 0x17
+#define TWL4030_MADC_GPCH0_LSB 0x37
+
+#define TWL4030_MADC_MADCON (1 << 0) /* MADC power on */
+#define TWL4030_MADC_BUSY (1 << 0) /* MADC busy */
+/* MADC conversion completion */
+#define TWL4030_MADC_EOC_SW (1 << 1)
+/* MADC SWx start conversion */
+#define TWL4030_MADC_SW_START (1 << 5)
+#define TWL4030_MADC_ADCIN0 (1 << 0)
+#define TWL4030_MADC_ADCIN1 (1 << 1)
+#define TWL4030_MADC_ADCIN2 (1 << 2)
+#define TWL4030_MADC_ADCIN3 (1 << 3)
+#define TWL4030_MADC_ADCIN4 (1 << 4)
+#define TWL4030_MADC_ADCIN5 (1 << 5)
+#define TWL4030_MADC_ADCIN6 (1 << 6)
+#define TWL4030_MADC_ADCIN7 (1 << 7)
+#define TWL4030_MADC_ADCIN8 (1 << 8)
+#define TWL4030_MADC_ADCIN9 (1 << 9)
+#define TWL4030_MADC_ADCIN10 (1 << 10)
+#define TWL4030_MADC_ADCIN11 (1 << 11)
+#define TWL4030_MADC_ADCIN12 (1 << 12)
+#define TWL4030_MADC_ADCIN13 (1 << 13)
+#define TWL4030_MADC_ADCIN14 (1 << 14)
+#define TWL4030_MADC_ADCIN15 (1 << 15)
+
+/* Fixed channels */
+#define TWL4030_MADC_BTEMP TWL4030_MADC_ADCIN1
+#define TWL4030_MADC_VBUS TWL4030_MADC_ADCIN8
+#define TWL4030_MADC_VBKB TWL4030_MADC_ADCIN9
+#define TWL4030_MADC_ICHG TWL4030_MADC_ADCIN10
+#define TWL4030_MADC_VCHG TWL4030_MADC_ADCIN11
+#define TWL4030_MADC_VBAT TWL4030_MADC_ADCIN12
+
+/* Step size and prescaler ratio */
+#define TEMP_STEP_SIZE 147
+#define TEMP_PSR_R 100
+#define CURR_STEP_SIZE 147
+#define CURR_PSR_R1 44
+#define CURR_PSR_R2 88
+
+#define TWL4030_BCI_BCICTL1 0x23
+#define TWL4030_BCI_CGAIN 0x020
+#define TWL4030_BCI_MESBAT (1 << 1)
+#define TWL4030_BCI_TYPEN (1 << 4)
+#define TWL4030_BCI_ITHEN (1 << 3)
+
+#define REG_BCICTL2 0x024
+#define TWL4030_BCI_ITHSENS 0x007
+
+/* Register and bits for GPBR1 register */
+#define TWL4030_REG_GPBR1 0x0c
+#define TWL4030_GPBR1_MADC_HFCLK_EN (1 << 7)
+
#define TWL4030_USB_SEL_MADC_MCPC (1<<3)
#define TWL4030_USB_CARKIT_ANA_CTRL 0xBB
+struct twl4030_madc_conversion_method {
+ u8 sel;
+ u8 avg;
+ u8 rbase;
+ u8 ctrl;
+};
+
+/**
+ * struct twl4030_madc_request - madc request packet for channel conversion
+ * @channels: 16 bit bitmap for individual channels
+ * @do_avg: sample the input channel for 4 consecutive cycles
+ * @method: RT, SW1, SW2
+ * @type: Polling or interrupt based method
+ * @active: Flag if request is active
+ * @result_pending: Flag from irq handler, that result is ready
+ * @raw: Return raw value, do not convert it
+ * @rbuf: Result buffer
+ */
+struct twl4030_madc_request {
+ unsigned long channels;
+ bool do_avg;
+ u16 method;
+ u16 type;
+ bool active;
+ bool result_pending;
+ bool raw;
+ int rbuf[TWL4030_MADC_MAX_CHANNELS];
+};
+
+enum conversion_methods {
+ TWL4030_MADC_RT,
+ TWL4030_MADC_SW1,
+ TWL4030_MADC_SW2,
+ TWL4030_MADC_NUM_METHODS
+};
+
+enum sample_type {
+ TWL4030_MADC_WAIT,
+ TWL4030_MADC_IRQ_ONESHOT,
+ TWL4030_MADC_IRQ_REARM
+};
+
/**
* struct twl4030_madc_data - a container for madc info
* @dev: Pointer to device structure for madc
diff --git a/include/linux/i2c/twl4030-madc.h b/include/linux/i2c/twl4030-madc.h
deleted file mode 100644
index 34e94747b61e..000000000000
--- a/include/linux/i2c/twl4030-madc.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * twl4030_madc.h - Header for TWL4030 MADC
- *
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- * J Keerthy <j-keerthy@ti.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#ifndef _TWL4030_MADC_H
-#define _TWL4030_MADC_H
-
-struct twl4030_madc_conversion_method {
- u8 sel;
- u8 avg;
- u8 rbase;
- u8 ctrl;
-};
-
-#define TWL4030_MADC_MAX_CHANNELS 16
-
-
-/*
- * twl4030_madc_request- madc request packet for channel conversion
- * @channels: 16 bit bitmap for individual channels
- * @do_avgP: sample the input channel for 4 consecutive cycles
- * @method: RT, SW1, SW2
- * @type: Polling or interrupt based method
- * @raw: Return raw value, do not convert it
- */
-
-struct twl4030_madc_request {
- unsigned long channels;
- bool do_avg;
- u16 method;
- u16 type;
- bool active;
- bool result_pending;
- bool raw;
- int rbuf[TWL4030_MADC_MAX_CHANNELS];
-};
-
-enum conversion_methods {
- TWL4030_MADC_RT,
- TWL4030_MADC_SW1,
- TWL4030_MADC_SW2,
- TWL4030_MADC_NUM_METHODS
-};
-
-enum sample_type {
- TWL4030_MADC_WAIT,
- TWL4030_MADC_IRQ_ONESHOT,
- TWL4030_MADC_IRQ_REARM
-};
-
-#define TWL4030_MADC_CTRL1 0x00
-#define TWL4030_MADC_CTRL2 0x01
-
-#define TWL4030_MADC_RTSELECT_LSB 0x02
-#define TWL4030_MADC_SW1SELECT_LSB 0x06
-#define TWL4030_MADC_SW2SELECT_LSB 0x0A
-
-#define TWL4030_MADC_RTAVERAGE_LSB 0x04
-#define TWL4030_MADC_SW1AVERAGE_LSB 0x08
-#define TWL4030_MADC_SW2AVERAGE_LSB 0x0C
-
-#define TWL4030_MADC_CTRL_SW1 0x12
-#define TWL4030_MADC_CTRL_SW2 0x13
-
-#define TWL4030_MADC_RTCH0_LSB 0x17
-#define TWL4030_MADC_GPCH0_LSB 0x37
-
-#define TWL4030_MADC_MADCON (1 << 0) /* MADC power on */
-#define TWL4030_MADC_BUSY (1 << 0) /* MADC busy */
-/* MADC conversion completion */
-#define TWL4030_MADC_EOC_SW (1 << 1)
-/* MADC SWx start conversion */
-#define TWL4030_MADC_SW_START (1 << 5)
-#define TWL4030_MADC_ADCIN0 (1 << 0)
-#define TWL4030_MADC_ADCIN1 (1 << 1)
-#define TWL4030_MADC_ADCIN2 (1 << 2)
-#define TWL4030_MADC_ADCIN3 (1 << 3)
-#define TWL4030_MADC_ADCIN4 (1 << 4)
-#define TWL4030_MADC_ADCIN5 (1 << 5)
-#define TWL4030_MADC_ADCIN6 (1 << 6)
-#define TWL4030_MADC_ADCIN7 (1 << 7)
-#define TWL4030_MADC_ADCIN8 (1 << 8)
-#define TWL4030_MADC_ADCIN9 (1 << 9)
-#define TWL4030_MADC_ADCIN10 (1 << 10)
-#define TWL4030_MADC_ADCIN11 (1 << 11)
-#define TWL4030_MADC_ADCIN12 (1 << 12)
-#define TWL4030_MADC_ADCIN13 (1 << 13)
-#define TWL4030_MADC_ADCIN14 (1 << 14)
-#define TWL4030_MADC_ADCIN15 (1 << 15)
-
-/* Fixed channels */
-#define TWL4030_MADC_BTEMP TWL4030_MADC_ADCIN1
-#define TWL4030_MADC_VBUS TWL4030_MADC_ADCIN8
-#define TWL4030_MADC_VBKB TWL4030_MADC_ADCIN9
-#define TWL4030_MADC_ICHG TWL4030_MADC_ADCIN10
-#define TWL4030_MADC_VCHG TWL4030_MADC_ADCIN11
-#define TWL4030_MADC_VBAT TWL4030_MADC_ADCIN12
-
-/* Step size and prescaler ratio */
-#define TEMP_STEP_SIZE 147
-#define TEMP_PSR_R 100
-#define CURR_STEP_SIZE 147
-#define CURR_PSR_R1 44
-#define CURR_PSR_R2 88
-
-#define TWL4030_BCI_BCICTL1 0x23
-#define TWL4030_BCI_CGAIN 0x020
-#define TWL4030_BCI_MESBAT (1 << 1)
-#define TWL4030_BCI_TYPEN (1 << 4)
-#define TWL4030_BCI_ITHEN (1 << 3)
-
-#define REG_BCICTL2 0x024
-#define TWL4030_BCI_ITHSENS 0x007
-
-/* Register and bits for GPBR1 register */
-#define TWL4030_REG_GPBR1 0x0c
-#define TWL4030_GPBR1_MADC_HFCLK_EN (1 << 7)
-
-#endif
--
2.11.0
[toc] | [prev] | [next] | [standalone]
| From | Jonathan Cameron <jic23@kernel.org> |
|---|---|
| Date | 2017-04-30 18:40 +0200 |
| Subject | Re: [PATCH 7/7] iio: adc: twl4030: Fold twl4030-madc.h into driver |
| Message-ID | <tC038-5u7-33@gated-at.bofh.it> |
| In reply to | #1632190 |
On 27/04/17 16:30, Sebastian Reichel wrote:
> twl4030-madc.h is no longer used by anything outside of
> the iio driver, so it can be merged into the driver.
>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Jonathan Cameron <jic23@kernel.org>
> ---
> drivers/iio/adc/twl4030-madc.c | 113 +++++++++++++++++++++++++++++++-
> include/linux/i2c/twl4030-madc.h | 137 ---------------------------------------
> 2 files changed, 112 insertions(+), 138 deletions(-)
> delete mode 100644 include/linux/i2c/twl4030-madc.h
>
> diff --git a/drivers/iio/adc/twl4030-madc.c b/drivers/iio/adc/twl4030-madc.c
> index 21df5b932bd1..bd3d37fc2144 100644
> --- a/drivers/iio/adc/twl4030-madc.c
> +++ b/drivers/iio/adc/twl4030-madc.c
> @@ -36,7 +36,6 @@
> #include <linux/platform_device.h>
> #include <linux/slab.h>
> #include <linux/i2c/twl.h>
> -#include <linux/i2c/twl4030-madc.h>
> #include <linux/module.h>
> #include <linux/stddef.h>
> #include <linux/mutex.h>
> @@ -49,9 +48,121 @@
>
> #include <linux/iio/iio.h>
>
> +#define TWL4030_MADC_MAX_CHANNELS 16
> +
> +#define TWL4030_MADC_CTRL1 0x00
> +#define TWL4030_MADC_CTRL2 0x01
> +
> +#define TWL4030_MADC_RTSELECT_LSB 0x02
> +#define TWL4030_MADC_SW1SELECT_LSB 0x06
> +#define TWL4030_MADC_SW2SELECT_LSB 0x0A
> +
> +#define TWL4030_MADC_RTAVERAGE_LSB 0x04
> +#define TWL4030_MADC_SW1AVERAGE_LSB 0x08
> +#define TWL4030_MADC_SW2AVERAGE_LSB 0x0C
> +
> +#define TWL4030_MADC_CTRL_SW1 0x12
> +#define TWL4030_MADC_CTRL_SW2 0x13
> +
> +#define TWL4030_MADC_RTCH0_LSB 0x17
> +#define TWL4030_MADC_GPCH0_LSB 0x37
> +
> +#define TWL4030_MADC_MADCON (1 << 0) /* MADC power on */
> +#define TWL4030_MADC_BUSY (1 << 0) /* MADC busy */
> +/* MADC conversion completion */
> +#define TWL4030_MADC_EOC_SW (1 << 1)
> +/* MADC SWx start conversion */
> +#define TWL4030_MADC_SW_START (1 << 5)
> +#define TWL4030_MADC_ADCIN0 (1 << 0)
> +#define TWL4030_MADC_ADCIN1 (1 << 1)
> +#define TWL4030_MADC_ADCIN2 (1 << 2)
> +#define TWL4030_MADC_ADCIN3 (1 << 3)
> +#define TWL4030_MADC_ADCIN4 (1 << 4)
> +#define TWL4030_MADC_ADCIN5 (1 << 5)
> +#define TWL4030_MADC_ADCIN6 (1 << 6)
> +#define TWL4030_MADC_ADCIN7 (1 << 7)
> +#define TWL4030_MADC_ADCIN8 (1 << 8)
> +#define TWL4030_MADC_ADCIN9 (1 << 9)
> +#define TWL4030_MADC_ADCIN10 (1 << 10)
> +#define TWL4030_MADC_ADCIN11 (1 << 11)
> +#define TWL4030_MADC_ADCIN12 (1 << 12)
> +#define TWL4030_MADC_ADCIN13 (1 << 13)
> +#define TWL4030_MADC_ADCIN14 (1 << 14)
> +#define TWL4030_MADC_ADCIN15 (1 << 15)
> +
> +/* Fixed channels */
> +#define TWL4030_MADC_BTEMP TWL4030_MADC_ADCIN1
> +#define TWL4030_MADC_VBUS TWL4030_MADC_ADCIN8
> +#define TWL4030_MADC_VBKB TWL4030_MADC_ADCIN9
> +#define TWL4030_MADC_ICHG TWL4030_MADC_ADCIN10
> +#define TWL4030_MADC_VCHG TWL4030_MADC_ADCIN11
> +#define TWL4030_MADC_VBAT TWL4030_MADC_ADCIN12
> +
> +/* Step size and prescaler ratio */
> +#define TEMP_STEP_SIZE 147
> +#define TEMP_PSR_R 100
> +#define CURR_STEP_SIZE 147
> +#define CURR_PSR_R1 44
> +#define CURR_PSR_R2 88
> +
> +#define TWL4030_BCI_BCICTL1 0x23
> +#define TWL4030_BCI_CGAIN 0x020
> +#define TWL4030_BCI_MESBAT (1 << 1)
> +#define TWL4030_BCI_TYPEN (1 << 4)
> +#define TWL4030_BCI_ITHEN (1 << 3)
> +
> +#define REG_BCICTL2 0x024
> +#define TWL4030_BCI_ITHSENS 0x007
> +
> +/* Register and bits for GPBR1 register */
> +#define TWL4030_REG_GPBR1 0x0c
> +#define TWL4030_GPBR1_MADC_HFCLK_EN (1 << 7)
> +
> #define TWL4030_USB_SEL_MADC_MCPC (1<<3)
> #define TWL4030_USB_CARKIT_ANA_CTRL 0xBB
>
> +struct twl4030_madc_conversion_method {
> + u8 sel;
> + u8 avg;
> + u8 rbase;
> + u8 ctrl;
> +};
> +
> +/**
> + * struct twl4030_madc_request - madc request packet for channel conversion
> + * @channels: 16 bit bitmap for individual channels
> + * @do_avg: sample the input channel for 4 consecutive cycles
> + * @method: RT, SW1, SW2
> + * @type: Polling or interrupt based method
> + * @active: Flag if request is active
> + * @result_pending: Flag from irq handler, that result is ready
> + * @raw: Return raw value, do not convert it
> + * @rbuf: Result buffer
> + */
> +struct twl4030_madc_request {
> + unsigned long channels;
> + bool do_avg;
> + u16 method;
> + u16 type;
> + bool active;
> + bool result_pending;
> + bool raw;
> + int rbuf[TWL4030_MADC_MAX_CHANNELS];
> +};
> +
> +enum conversion_methods {
> + TWL4030_MADC_RT,
> + TWL4030_MADC_SW1,
> + TWL4030_MADC_SW2,
> + TWL4030_MADC_NUM_METHODS
> +};
> +
> +enum sample_type {
> + TWL4030_MADC_WAIT,
> + TWL4030_MADC_IRQ_ONESHOT,
> + TWL4030_MADC_IRQ_REARM
> +};
> +
> /**
> * struct twl4030_madc_data - a container for madc info
> * @dev: Pointer to device structure for madc
> diff --git a/include/linux/i2c/twl4030-madc.h b/include/linux/i2c/twl4030-madc.h
> deleted file mode 100644
> index 34e94747b61e..000000000000
> --- a/include/linux/i2c/twl4030-madc.h
> +++ /dev/null
> @@ -1,137 +0,0 @@
> -/*
> - * twl4030_madc.h - Header for TWL4030 MADC
> - *
> - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
> - * J Keerthy <j-keerthy@ti.com>
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * 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.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> - * 02110-1301 USA
> - *
> - */
> -
> -#ifndef _TWL4030_MADC_H
> -#define _TWL4030_MADC_H
> -
> -struct twl4030_madc_conversion_method {
> - u8 sel;
> - u8 avg;
> - u8 rbase;
> - u8 ctrl;
> -};
> -
> -#define TWL4030_MADC_MAX_CHANNELS 16
> -
> -
> -/*
> - * twl4030_madc_request- madc request packet for channel conversion
> - * @channels: 16 bit bitmap for individual channels
> - * @do_avgP: sample the input channel for 4 consecutive cycles
> - * @method: RT, SW1, SW2
> - * @type: Polling or interrupt based method
> - * @raw: Return raw value, do not convert it
> - */
> -
> -struct twl4030_madc_request {
> - unsigned long channels;
> - bool do_avg;
> - u16 method;
> - u16 type;
> - bool active;
> - bool result_pending;
> - bool raw;
> - int rbuf[TWL4030_MADC_MAX_CHANNELS];
> -};
> -
> -enum conversion_methods {
> - TWL4030_MADC_RT,
> - TWL4030_MADC_SW1,
> - TWL4030_MADC_SW2,
> - TWL4030_MADC_NUM_METHODS
> -};
> -
> -enum sample_type {
> - TWL4030_MADC_WAIT,
> - TWL4030_MADC_IRQ_ONESHOT,
> - TWL4030_MADC_IRQ_REARM
> -};
> -
> -#define TWL4030_MADC_CTRL1 0x00
> -#define TWL4030_MADC_CTRL2 0x01
> -
> -#define TWL4030_MADC_RTSELECT_LSB 0x02
> -#define TWL4030_MADC_SW1SELECT_LSB 0x06
> -#define TWL4030_MADC_SW2SELECT_LSB 0x0A
> -
> -#define TWL4030_MADC_RTAVERAGE_LSB 0x04
> -#define TWL4030_MADC_SW1AVERAGE_LSB 0x08
> -#define TWL4030_MADC_SW2AVERAGE_LSB 0x0C
> -
> -#define TWL4030_MADC_CTRL_SW1 0x12
> -#define TWL4030_MADC_CTRL_SW2 0x13
> -
> -#define TWL4030_MADC_RTCH0_LSB 0x17
> -#define TWL4030_MADC_GPCH0_LSB 0x37
> -
> -#define TWL4030_MADC_MADCON (1 << 0) /* MADC power on */
> -#define TWL4030_MADC_BUSY (1 << 0) /* MADC busy */
> -/* MADC conversion completion */
> -#define TWL4030_MADC_EOC_SW (1 << 1)
> -/* MADC SWx start conversion */
> -#define TWL4030_MADC_SW_START (1 << 5)
> -#define TWL4030_MADC_ADCIN0 (1 << 0)
> -#define TWL4030_MADC_ADCIN1 (1 << 1)
> -#define TWL4030_MADC_ADCIN2 (1 << 2)
> -#define TWL4030_MADC_ADCIN3 (1 << 3)
> -#define TWL4030_MADC_ADCIN4 (1 << 4)
> -#define TWL4030_MADC_ADCIN5 (1 << 5)
> -#define TWL4030_MADC_ADCIN6 (1 << 6)
> -#define TWL4030_MADC_ADCIN7 (1 << 7)
> -#define TWL4030_MADC_ADCIN8 (1 << 8)
> -#define TWL4030_MADC_ADCIN9 (1 << 9)
> -#define TWL4030_MADC_ADCIN10 (1 << 10)
> -#define TWL4030_MADC_ADCIN11 (1 << 11)
> -#define TWL4030_MADC_ADCIN12 (1 << 12)
> -#define TWL4030_MADC_ADCIN13 (1 << 13)
> -#define TWL4030_MADC_ADCIN14 (1 << 14)
> -#define TWL4030_MADC_ADCIN15 (1 << 15)
> -
> -/* Fixed channels */
> -#define TWL4030_MADC_BTEMP TWL4030_MADC_ADCIN1
> -#define TWL4030_MADC_VBUS TWL4030_MADC_ADCIN8
> -#define TWL4030_MADC_VBKB TWL4030_MADC_ADCIN9
> -#define TWL4030_MADC_ICHG TWL4030_MADC_ADCIN10
> -#define TWL4030_MADC_VCHG TWL4030_MADC_ADCIN11
> -#define TWL4030_MADC_VBAT TWL4030_MADC_ADCIN12
> -
> -/* Step size and prescaler ratio */
> -#define TEMP_STEP_SIZE 147
> -#define TEMP_PSR_R 100
> -#define CURR_STEP_SIZE 147
> -#define CURR_PSR_R1 44
> -#define CURR_PSR_R2 88
> -
> -#define TWL4030_BCI_BCICTL1 0x23
> -#define TWL4030_BCI_CGAIN 0x020
> -#define TWL4030_BCI_MESBAT (1 << 1)
> -#define TWL4030_BCI_TYPEN (1 << 4)
> -#define TWL4030_BCI_ITHEN (1 << 3)
> -
> -#define REG_BCICTL2 0x024
> -#define TWL4030_BCI_ITHSENS 0x007
> -
> -/* Register and bits for GPBR1 register */
> -#define TWL4030_REG_GPBR1 0x0c
> -#define TWL4030_GPBR1_MADC_HFCLK_EN (1 << 7)
> -
> -#endif
>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web