* [PATCH 0/7] twl4030-madc cleanup
@ 2017-04-27 15:30 Sebastian Reichel
2017-04-27 15:30 ` [PATCH 1/7] hwmon: twl4030-madc: drop driver Sebastian Reichel
` (6 more replies)
0 siblings, 7 replies; 22+ messages in thread
From: Sebastian Reichel @ 2017-04-27 15:30 UTC (permalink / raw)
To: Sebastian Reichel, Jonathan Cameron, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler, Jean Delvare,
Guenter Roeck
Cc: J Keerthy, linux-iio, linux-hwmon, linux-kernel, Sebastian Reichel
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
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 1/7] hwmon: twl4030-madc: drop driver
2017-04-27 15:30 [PATCH 0/7] twl4030-madc cleanup Sebastian Reichel
@ 2017-04-27 15:30 ` Sebastian Reichel
2017-04-27 16:51 ` Guenter Roeck
2017-04-27 15:30 ` [PATCH 2/7] power: supply: avoid unused twl4030-madc.h Sebastian Reichel
` (5 subsequent siblings)
6 siblings, 1 reply; 22+ messages in thread
From: Sebastian Reichel @ 2017-04-27 15:30 UTC (permalink / raw)
To: Sebastian Reichel, Jonathan Cameron, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler, Jean Delvare,
Guenter Roeck
Cc: J Keerthy, linux-iio, linux-hwmon, linux-kernel, Sebastian Reichel
This driver is no longer needed:
* It has no mainline users
* It has no DT support and OMAP is DT only
* iio-hwmon can be used for madc, which also works with DT
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
---
drivers/hwmon/Kconfig | 10 ----
drivers/hwmon/Makefile | 1 -
drivers/hwmon/twl4030-madc-hwmon.c | 118 -------------------------------------
3 files changed, 129 deletions(-)
delete mode 100644 drivers/hwmon/twl4030-madc-hwmon.c
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 0649d53f3d16..776d1ac2bfee 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -1643,16 +1643,6 @@ config SENSORS_TMP421
This driver can also be built as a module. If so, the module
will be called tmp421.
-config SENSORS_TWL4030_MADC
- tristate "Texas Instruments TWL4030 MADC Hwmon"
- depends on TWL4030_MADC
- help
- If you say yes here you get hwmon support for triton
- TWL4030-MADC.
-
- This driver can also be built as a module. If so it will be called
- twl4030-madc-hwmon.
-
config SENSORS_VEXPRESS
tristate "Versatile Express"
depends on VEXPRESS_CONFIG
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 5509edf6186a..c05530d6cb6e 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -157,7 +157,6 @@ obj-$(CONFIG_SENSORS_TMP103) += tmp103.o
obj-$(CONFIG_SENSORS_TMP108) += tmp108.o
obj-$(CONFIG_SENSORS_TMP401) += tmp401.o
obj-$(CONFIG_SENSORS_TMP421) += tmp421.o
-obj-$(CONFIG_SENSORS_TWL4030_MADC)+= twl4030-madc-hwmon.o
obj-$(CONFIG_SENSORS_VEXPRESS) += vexpress-hwmon.o
obj-$(CONFIG_SENSORS_VIA_CPUTEMP)+= via-cputemp.o
obj-$(CONFIG_SENSORS_VIA686A) += via686a.o
diff --git a/drivers/hwmon/twl4030-madc-hwmon.c b/drivers/hwmon/twl4030-madc-hwmon.c
deleted file mode 100644
index b5caf7fdb487..000000000000
--- a/drivers/hwmon/twl4030-madc-hwmon.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- *
- * TWL4030 MADC Hwmon driver-This driver monitors the real time
- * conversion of analog signals like battery temperature,
- * battery type, battery level etc. User can ask for the conversion on a
- * particular channel using the sysfs nodes.
- *
- * 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
- *
- */
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/i2c/twl.h>
-#include <linux/device.h>
-#include <linux/platform_device.h>
-#include <linux/i2c/twl4030-madc.h>
-#include <linux/hwmon.h>
-#include <linux/hwmon-sysfs.h>
-#include <linux/stddef.h>
-#include <linux/sysfs.h>
-#include <linux/err.h>
-#include <linux/types.h>
-
-/*
- * sysfs hook function
- */
-static ssize_t madc_read(struct device *dev,
- struct device_attribute *devattr, char *buf)
-{
- struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
- struct twl4030_madc_request req = {
- .channels = 1 << attr->index,
- .method = TWL4030_MADC_SW2,
- .type = TWL4030_MADC_WAIT,
- };
- long val;
-
- val = twl4030_madc_conversion(&req);
- if (val < 0)
- return val;
-
- return sprintf(buf, "%d\n", req.rbuf[attr->index]);
-}
-
-/* sysfs nodes to read individual channels from user side */
-static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, madc_read, NULL, 0);
-static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, madc_read, NULL, 1);
-static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, madc_read, NULL, 2);
-static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, madc_read, NULL, 3);
-static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, madc_read, NULL, 4);
-static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, madc_read, NULL, 5);
-static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, madc_read, NULL, 6);
-static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, madc_read, NULL, 7);
-static SENSOR_DEVICE_ATTR(in8_input, S_IRUGO, madc_read, NULL, 8);
-static SENSOR_DEVICE_ATTR(in9_input, S_IRUGO, madc_read, NULL, 9);
-static SENSOR_DEVICE_ATTR(curr10_input, S_IRUGO, madc_read, NULL, 10);
-static SENSOR_DEVICE_ATTR(in11_input, S_IRUGO, madc_read, NULL, 11);
-static SENSOR_DEVICE_ATTR(in12_input, S_IRUGO, madc_read, NULL, 12);
-static SENSOR_DEVICE_ATTR(in15_input, S_IRUGO, madc_read, NULL, 15);
-
-static struct attribute *twl4030_madc_attrs[] = {
- &sensor_dev_attr_in0_input.dev_attr.attr,
- &sensor_dev_attr_temp1_input.dev_attr.attr,
- &sensor_dev_attr_in2_input.dev_attr.attr,
- &sensor_dev_attr_in3_input.dev_attr.attr,
- &sensor_dev_attr_in4_input.dev_attr.attr,
- &sensor_dev_attr_in5_input.dev_attr.attr,
- &sensor_dev_attr_in6_input.dev_attr.attr,
- &sensor_dev_attr_in7_input.dev_attr.attr,
- &sensor_dev_attr_in8_input.dev_attr.attr,
- &sensor_dev_attr_in9_input.dev_attr.attr,
- &sensor_dev_attr_curr10_input.dev_attr.attr,
- &sensor_dev_attr_in11_input.dev_attr.attr,
- &sensor_dev_attr_in12_input.dev_attr.attr,
- &sensor_dev_attr_in15_input.dev_attr.attr,
- NULL
-};
-ATTRIBUTE_GROUPS(twl4030_madc);
-
-static int twl4030_madc_hwmon_probe(struct platform_device *pdev)
-{
- struct device *hwmon;
-
- hwmon = devm_hwmon_device_register_with_groups(&pdev->dev,
- "twl4030_madc", NULL,
- twl4030_madc_groups);
- return PTR_ERR_OR_ZERO(hwmon);
-}
-
-static struct platform_driver twl4030_madc_hwmon_driver = {
- .probe = twl4030_madc_hwmon_probe,
- .driver = {
- .name = "twl4030_madc_hwmon",
- },
-};
-
-module_platform_driver(twl4030_madc_hwmon_driver);
-
-MODULE_DESCRIPTION("TWL4030 ADC Hwmon driver");
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("J Keerthy");
-MODULE_ALIAS("platform:twl4030_madc_hwmon");
--
2.11.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 2/7] power: supply: avoid unused twl4030-madc.h
2017-04-27 15:30 [PATCH 0/7] twl4030-madc cleanup Sebastian Reichel
2017-04-27 15:30 ` [PATCH 1/7] hwmon: twl4030-madc: drop driver Sebastian Reichel
@ 2017-04-27 15:30 ` Sebastian Reichel
2017-05-01 11:51 ` Sebastian Reichel
2017-04-27 15:30 ` [PATCH 3/7] iio: adc: twl4030: Drop twl4030_get_madc_conversion() Sebastian Reichel
` (4 subsequent siblings)
6 siblings, 1 reply; 22+ messages in thread
From: Sebastian Reichel @ 2017-04-27 15:30 UTC (permalink / raw)
To: Sebastian Reichel, Jonathan Cameron, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler, Jean Delvare,
Guenter Roeck
Cc: J Keerthy, linux-iio, linux-hwmon, linux-kernel, Sebastian Reichel
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
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 3/7] iio: adc: twl4030: Drop twl4030_get_madc_conversion()
2017-04-27 15:30 [PATCH 0/7] twl4030-madc cleanup Sebastian Reichel
2017-04-27 15:30 ` [PATCH 1/7] hwmon: twl4030-madc: drop driver Sebastian Reichel
2017-04-27 15:30 ` [PATCH 2/7] power: supply: avoid unused twl4030-madc.h Sebastian Reichel
@ 2017-04-27 15:30 ` Sebastian Reichel
2017-04-30 16:35 ` Jonathan Cameron
2017-04-27 15:30 ` [PATCH 4/7] iio: adc: twl4030: Unexport twl4030_madc_conversion() Sebastian Reichel
` (3 subsequent siblings)
6 siblings, 1 reply; 22+ messages in thread
From: Sebastian Reichel @ 2017-04-27 15:30 UTC (permalink / raw)
To: Sebastian Reichel, Jonathan Cameron, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler, Jean Delvare,
Guenter Roeck
Cc: J Keerthy, linux-iio, linux-hwmon, linux-kernel, Sebastian Reichel
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
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 4/7] iio: adc: twl4030: Unexport twl4030_madc_conversion()
2017-04-27 15:30 [PATCH 0/7] twl4030-madc cleanup Sebastian Reichel
` (2 preceding siblings ...)
2017-04-27 15:30 ` [PATCH 3/7] iio: adc: twl4030: Drop twl4030_get_madc_conversion() Sebastian Reichel
@ 2017-04-27 15:30 ` Sebastian Reichel
2017-04-30 16:35 ` Jonathan Cameron
2017-04-27 15:30 ` [PATCH 5/7] iio: adc: twl4030: Drop struct twl4030_madc_user_parms Sebastian Reichel
` (2 subsequent siblings)
6 siblings, 1 reply; 22+ messages in thread
From: Sebastian Reichel @ 2017-04-27 15:30 UTC (permalink / raw)
To: Sebastian Reichel, Jonathan Cameron, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler, Jean Delvare,
Guenter Roeck
Cc: J Keerthy, linux-iio, linux-hwmon, linux-kernel, Sebastian Reichel
All madc users have been converted to IIO API, so drop the
legacy API. The function is still used inside of the driver.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
---
drivers/iio/adc/twl4030-madc.c | 5 +++--
include/linux/i2c/twl4030-madc.h | 2 --
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/adc/twl4030-madc.c b/drivers/iio/adc/twl4030-madc.c
index 88e44066ef82..be60f76d1a50 100644
--- a/drivers/iio/adc/twl4030-madc.c
+++ b/drivers/iio/adc/twl4030-madc.c
@@ -72,6 +72,8 @@ struct twl4030_madc_data {
u8 isr;
};
+static int twl4030_madc_conversion(struct twl4030_madc_request *req);
+
static int twl4030_madc_read(struct iio_dev *iio_dev,
const struct iio_chan_spec *chan,
int *val, int *val2, long mask)
@@ -568,7 +570,7 @@ static int twl4030_madc_wait_conversion_ready(struct twl4030_madc_data *madc,
* be a negative error value in the corresponding array element.
* returns 0 if succeeds else error value
*/
-int twl4030_madc_conversion(struct twl4030_madc_request *req)
+static int twl4030_madc_conversion(struct twl4030_madc_request *req)
{
const struct twl4030_madc_conversion_method *method;
int ret;
@@ -640,7 +642,6 @@ int twl4030_madc_conversion(struct twl4030_madc_request *req)
return ret;
}
-EXPORT_SYMBOL_GPL(twl4030_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 0c919ebb31e0..be9260e261ac 100644
--- a/include/linux/i2c/twl4030-madc.h
+++ b/include/linux/i2c/twl4030-madc.h
@@ -141,6 +141,4 @@ struct twl4030_madc_user_parms {
int status;
u16 result;
};
-
-int twl4030_madc_conversion(struct twl4030_madc_request *conv);
#endif
--
2.11.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 5/7] iio: adc: twl4030: Drop struct twl4030_madc_user_parms
2017-04-27 15:30 [PATCH 0/7] twl4030-madc cleanup Sebastian Reichel
` (3 preceding siblings ...)
2017-04-27 15:30 ` [PATCH 4/7] iio: adc: twl4030: Unexport twl4030_madc_conversion() Sebastian Reichel
@ 2017-04-27 15:30 ` Sebastian Reichel
2017-06-03 9:40 ` Jonathan Cameron
2017-04-27 15:30 ` [PATCH 6/7] iio: adc: twl4030: Remove twl4030_madc_request.func_cb Sebastian Reichel
2017-04-27 15:30 ` [PATCH 7/7] iio: adc: twl4030: Fold twl4030-madc.h into driver Sebastian Reichel
6 siblings, 1 reply; 22+ messages in thread
From: Sebastian Reichel @ 2017-04-27 15:30 UTC (permalink / raw)
To: Sebastian Reichel, Jonathan Cameron, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler, Jean Delvare,
Guenter Roeck
Cc: J Keerthy, linux-iio, linux-hwmon, linux-kernel, Sebastian Reichel
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
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 6/7] iio: adc: twl4030: Remove twl4030_madc_request.func_cb
2017-04-27 15:30 [PATCH 0/7] twl4030-madc cleanup Sebastian Reichel
` (4 preceding siblings ...)
2017-04-27 15:30 ` [PATCH 5/7] iio: adc: twl4030: Drop struct twl4030_madc_user_parms Sebastian Reichel
@ 2017-04-27 15:30 ` Sebastian Reichel
2017-04-30 16:37 ` Jonathan Cameron
2017-04-27 15:30 ` [PATCH 7/7] iio: adc: twl4030: Fold twl4030-madc.h into driver Sebastian Reichel
6 siblings, 1 reply; 22+ messages in thread
From: Sebastian Reichel @ 2017-04-27 15:30 UTC (permalink / raw)
To: Sebastian Reichel, Jonathan Cameron, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler, Jean Delvare,
Guenter Roeck
Cc: J Keerthy, linux-iio, linux-hwmon, linux-kernel, Sebastian Reichel
This functionality is not used by the IIO subsystem. Due
to removal of legacy API it can also be removed.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
---
drivers/iio/adc/twl4030-madc.c | 70 ----------------------------------------
include/linux/i2c/twl4030-madc.h | 1 -
2 files changed, 71 deletions(-)
diff --git a/drivers/iio/adc/twl4030-madc.c b/drivers/iio/adc/twl4030-madc.c
index be60f76d1a50..21df5b932bd1 100644
--- a/drivers/iio/adc/twl4030-madc.c
+++ b/drivers/iio/adc/twl4030-madc.c
@@ -86,7 +86,6 @@ static int twl4030_madc_read(struct iio_dev *iio_dev,
req.channels = BIT(chan->channel);
req.active = false;
- req.func_cb = NULL;
req.type = TWL4030_MADC_WAIT;
req.raw = !(mask == IIO_CHAN_INFO_PROCESSED);
req.do_avg = (mask == IIO_CHAN_INFO_AVERAGE_RAW);
@@ -343,37 +342,6 @@ static int twl4030_madc_read_channels(struct twl4030_madc_data *madc,
}
/*
- * Enables irq.
- * @madc - pointer to twl4030_madc_data struct
- * @id - irq number to be enabled
- * can take one of TWL4030_MADC_RT, TWL4030_MADC_SW1, TWL4030_MADC_SW2
- * corresponding to RT, SW1, SW2 conversion requests.
- * If the i2c read fails it returns an error else returns 0.
- */
-static int twl4030_madc_enable_irq(struct twl4030_madc_data *madc, u8 id)
-{
- u8 val;
- int ret;
-
- ret = twl_i2c_read_u8(TWL4030_MODULE_MADC, &val, madc->imr);
- if (ret) {
- dev_err(madc->dev, "unable to read imr register 0x%X\n",
- madc->imr);
- return ret;
- }
-
- val &= ~(1 << id);
- ret = twl_i2c_write_u8(TWL4030_MODULE_MADC, val, madc->imr);
- if (ret) {
- dev_err(madc->dev,
- "unable to write imr register 0x%X\n", madc->imr);
- return ret;
- }
-
- return 0;
-}
-
-/*
* Disables irq.
* @madc - pointer to twl4030_madc_data struct
* @id - irq number to be disabled
@@ -442,11 +410,6 @@ static irqreturn_t twl4030_madc_threaded_irq_handler(int irq, void *_madc)
/* Read results */
len = twl4030_madc_read_channels(madc, method->rbase,
r->channels, r->rbuf, r->raw);
- /* Return results to caller */
- if (r->func_cb != NULL) {
- r->func_cb(len, r->channels, r->rbuf);
- r->func_cb = NULL;
- }
/* Free request */
r->result_pending = 0;
r->active = 0;
@@ -468,11 +431,6 @@ static irqreturn_t twl4030_madc_threaded_irq_handler(int irq, void *_madc)
/* Read results */
len = twl4030_madc_read_channels(madc, method->rbase,
r->channels, r->rbuf, r->raw);
- /* Return results to caller */
- if (r->func_cb != NULL) {
- r->func_cb(len, r->channels, r->rbuf);
- r->func_cb = NULL;
- }
/* Free request */
r->result_pending = 0;
r->active = 0;
@@ -482,23 +440,6 @@ static irqreturn_t twl4030_madc_threaded_irq_handler(int irq, void *_madc)
return IRQ_HANDLED;
}
-static int twl4030_madc_set_irq(struct twl4030_madc_data *madc,
- struct twl4030_madc_request *req)
-{
- struct twl4030_madc_request *p;
- int ret;
-
- p = &madc->requests[req->method];
- memcpy(p, req, sizeof(*req));
- ret = twl4030_madc_enable_irq(madc, req->method);
- if (ret < 0) {
- dev_err(madc->dev, "enable irq failed!!\n");
- return ret;
- }
-
- return 0;
-}
-
/*
* Function which enables the madc conversion
* by writing to the control register.
@@ -607,17 +548,6 @@ static int twl4030_madc_conversion(struct twl4030_madc_request *req)
goto out;
}
}
- if (req->type == TWL4030_MADC_IRQ_ONESHOT && req->func_cb != NULL) {
- ret = twl4030_madc_set_irq(twl4030_madc, req);
- if (ret < 0)
- goto out;
- ret = twl4030_madc_start_conversion(twl4030_madc, req->method);
- if (ret < 0)
- goto out;
- twl4030_madc->requests[req->method].active = 1;
- ret = 0;
- goto out;
- }
/* With RT method we should not be here anymore */
if (req->method == TWL4030_MADC_RT) {
ret = -EINVAL;
diff --git a/include/linux/i2c/twl4030-madc.h b/include/linux/i2c/twl4030-madc.h
index f395700fb933..34e94747b61e 100644
--- a/include/linux/i2c/twl4030-madc.h
+++ b/include/linux/i2c/twl4030-madc.h
@@ -51,7 +51,6 @@ struct twl4030_madc_request {
bool result_pending;
bool raw;
int rbuf[TWL4030_MADC_MAX_CHANNELS];
- void (*func_cb)(int len, int channels, int *buf);
};
enum conversion_methods {
--
2.11.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 7/7] iio: adc: twl4030: Fold twl4030-madc.h into driver
2017-04-27 15:30 [PATCH 0/7] twl4030-madc cleanup Sebastian Reichel
` (5 preceding siblings ...)
2017-04-27 15:30 ` [PATCH 6/7] iio: adc: twl4030: Remove twl4030_madc_request.func_cb Sebastian Reichel
@ 2017-04-27 15:30 ` Sebastian Reichel
2017-04-30 16:38 ` Jonathan Cameron
6 siblings, 1 reply; 22+ messages in thread
From: Sebastian Reichel @ 2017-04-27 15:30 UTC (permalink / raw)
To: Sebastian Reichel, Jonathan Cameron, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler, Jean Delvare,
Guenter Roeck
Cc: J Keerthy, linux-iio, linux-hwmon, linux-kernel, Sebastian Reichel
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
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PATCH 1/7] hwmon: twl4030-madc: drop driver
2017-04-27 15:30 ` [PATCH 1/7] hwmon: twl4030-madc: drop driver Sebastian Reichel
@ 2017-04-27 16:51 ` Guenter Roeck
2017-04-30 16:41 ` Jonathan Cameron
0 siblings, 1 reply; 22+ messages in thread
From: Guenter Roeck @ 2017-04-27 16:51 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Sebastian Reichel, Jonathan Cameron, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler, Jean Delvare,
J Keerthy, linux-iio, linux-hwmon, linux-kernel
On Thu, Apr 27, 2017 at 05:30:06PM +0200, Sebastian Reichel wrote:
> This driver is no longer needed:
>
> * It has no mainline users
> * It has no DT support and OMAP is DT only
> * iio-hwmon can be used for madc, which also works with DT
>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Guenter Roeck <linux@roeck-us.net>
... assuming this will be pushed through the same tree as the rest
of the series. Let me know if I should queue it up in hwmon for v4.12.
Thanks,
Guenter
> ---
> drivers/hwmon/Kconfig | 10 ----
> drivers/hwmon/Makefile | 1 -
> drivers/hwmon/twl4030-madc-hwmon.c | 118 -------------------------------------
> 3 files changed, 129 deletions(-)
> delete mode 100644 drivers/hwmon/twl4030-madc-hwmon.c
>
> diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
> index 0649d53f3d16..776d1ac2bfee 100644
> --- a/drivers/hwmon/Kconfig
> +++ b/drivers/hwmon/Kconfig
> @@ -1643,16 +1643,6 @@ config SENSORS_TMP421
> This driver can also be built as a module. If so, the module
> will be called tmp421.
>
> -config SENSORS_TWL4030_MADC
> - tristate "Texas Instruments TWL4030 MADC Hwmon"
> - depends on TWL4030_MADC
> - help
> - If you say yes here you get hwmon support for triton
> - TWL4030-MADC.
> -
> - This driver can also be built as a module. If so it will be called
> - twl4030-madc-hwmon.
> -
> config SENSORS_VEXPRESS
> tristate "Versatile Express"
> depends on VEXPRESS_CONFIG
> diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
> index 5509edf6186a..c05530d6cb6e 100644
> --- a/drivers/hwmon/Makefile
> +++ b/drivers/hwmon/Makefile
> @@ -157,7 +157,6 @@ obj-$(CONFIG_SENSORS_TMP103) += tmp103.o
> obj-$(CONFIG_SENSORS_TMP108) += tmp108.o
> obj-$(CONFIG_SENSORS_TMP401) += tmp401.o
> obj-$(CONFIG_SENSORS_TMP421) += tmp421.o
> -obj-$(CONFIG_SENSORS_TWL4030_MADC)+= twl4030-madc-hwmon.o
> obj-$(CONFIG_SENSORS_VEXPRESS) += vexpress-hwmon.o
> obj-$(CONFIG_SENSORS_VIA_CPUTEMP)+= via-cputemp.o
> obj-$(CONFIG_SENSORS_VIA686A) += via686a.o
> diff --git a/drivers/hwmon/twl4030-madc-hwmon.c b/drivers/hwmon/twl4030-madc-hwmon.c
> deleted file mode 100644
> index b5caf7fdb487..000000000000
> --- a/drivers/hwmon/twl4030-madc-hwmon.c
> +++ /dev/null
> @@ -1,118 +0,0 @@
> -/*
> - *
> - * TWL4030 MADC Hwmon driver-This driver monitors the real time
> - * conversion of analog signals like battery temperature,
> - * battery type, battery level etc. User can ask for the conversion on a
> - * particular channel using the sysfs nodes.
> - *
> - * 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
> - *
> - */
> -#include <linux/init.h>
> -#include <linux/module.h>
> -#include <linux/kernel.h>
> -#include <linux/i2c/twl.h>
> -#include <linux/device.h>
> -#include <linux/platform_device.h>
> -#include <linux/i2c/twl4030-madc.h>
> -#include <linux/hwmon.h>
> -#include <linux/hwmon-sysfs.h>
> -#include <linux/stddef.h>
> -#include <linux/sysfs.h>
> -#include <linux/err.h>
> -#include <linux/types.h>
> -
> -/*
> - * sysfs hook function
> - */
> -static ssize_t madc_read(struct device *dev,
> - struct device_attribute *devattr, char *buf)
> -{
> - struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
> - struct twl4030_madc_request req = {
> - .channels = 1 << attr->index,
> - .method = TWL4030_MADC_SW2,
> - .type = TWL4030_MADC_WAIT,
> - };
> - long val;
> -
> - val = twl4030_madc_conversion(&req);
> - if (val < 0)
> - return val;
> -
> - return sprintf(buf, "%d\n", req.rbuf[attr->index]);
> -}
> -
> -/* sysfs nodes to read individual channels from user side */
> -static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, madc_read, NULL, 0);
> -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, madc_read, NULL, 1);
> -static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, madc_read, NULL, 2);
> -static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, madc_read, NULL, 3);
> -static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, madc_read, NULL, 4);
> -static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, madc_read, NULL, 5);
> -static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, madc_read, NULL, 6);
> -static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, madc_read, NULL, 7);
> -static SENSOR_DEVICE_ATTR(in8_input, S_IRUGO, madc_read, NULL, 8);
> -static SENSOR_DEVICE_ATTR(in9_input, S_IRUGO, madc_read, NULL, 9);
> -static SENSOR_DEVICE_ATTR(curr10_input, S_IRUGO, madc_read, NULL, 10);
> -static SENSOR_DEVICE_ATTR(in11_input, S_IRUGO, madc_read, NULL, 11);
> -static SENSOR_DEVICE_ATTR(in12_input, S_IRUGO, madc_read, NULL, 12);
> -static SENSOR_DEVICE_ATTR(in15_input, S_IRUGO, madc_read, NULL, 15);
> -
> -static struct attribute *twl4030_madc_attrs[] = {
> - &sensor_dev_attr_in0_input.dev_attr.attr,
> - &sensor_dev_attr_temp1_input.dev_attr.attr,
> - &sensor_dev_attr_in2_input.dev_attr.attr,
> - &sensor_dev_attr_in3_input.dev_attr.attr,
> - &sensor_dev_attr_in4_input.dev_attr.attr,
> - &sensor_dev_attr_in5_input.dev_attr.attr,
> - &sensor_dev_attr_in6_input.dev_attr.attr,
> - &sensor_dev_attr_in7_input.dev_attr.attr,
> - &sensor_dev_attr_in8_input.dev_attr.attr,
> - &sensor_dev_attr_in9_input.dev_attr.attr,
> - &sensor_dev_attr_curr10_input.dev_attr.attr,
> - &sensor_dev_attr_in11_input.dev_attr.attr,
> - &sensor_dev_attr_in12_input.dev_attr.attr,
> - &sensor_dev_attr_in15_input.dev_attr.attr,
> - NULL
> -};
> -ATTRIBUTE_GROUPS(twl4030_madc);
> -
> -static int twl4030_madc_hwmon_probe(struct platform_device *pdev)
> -{
> - struct device *hwmon;
> -
> - hwmon = devm_hwmon_device_register_with_groups(&pdev->dev,
> - "twl4030_madc", NULL,
> - twl4030_madc_groups);
> - return PTR_ERR_OR_ZERO(hwmon);
> -}
> -
> -static struct platform_driver twl4030_madc_hwmon_driver = {
> - .probe = twl4030_madc_hwmon_probe,
> - .driver = {
> - .name = "twl4030_madc_hwmon",
> - },
> -};
> -
> -module_platform_driver(twl4030_madc_hwmon_driver);
> -
> -MODULE_DESCRIPTION("TWL4030 ADC Hwmon driver");
> -MODULE_LICENSE("GPL");
> -MODULE_AUTHOR("J Keerthy");
> -MODULE_ALIAS("platform:twl4030_madc_hwmon");
> --
> 2.11.0
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 3/7] iio: adc: twl4030: Drop twl4030_get_madc_conversion()
2017-04-27 15:30 ` [PATCH 3/7] iio: adc: twl4030: Drop twl4030_get_madc_conversion() Sebastian Reichel
@ 2017-04-30 16:35 ` Jonathan Cameron
2017-06-03 9:36 ` Jonathan Cameron
0 siblings, 1 reply; 22+ messages in thread
From: Jonathan Cameron @ 2017-04-30 16:35 UTC (permalink / raw)
To: Sebastian Reichel, Sebastian Reichel, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler, Jean Delvare,
Guenter Roeck
Cc: J Keerthy, linux-iio, linux-hwmon, linux-kernel
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
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 4/7] iio: adc: twl4030: Unexport twl4030_madc_conversion()
2017-04-27 15:30 ` [PATCH 4/7] iio: adc: twl4030: Unexport twl4030_madc_conversion() Sebastian Reichel
@ 2017-04-30 16:35 ` Jonathan Cameron
2017-06-03 9:37 ` Jonathan Cameron
0 siblings, 1 reply; 22+ messages in thread
From: Jonathan Cameron @ 2017-04-30 16:35 UTC (permalink / raw)
To: Sebastian Reichel, Sebastian Reichel, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler, Jean Delvare,
Guenter Roeck
Cc: J Keerthy, linux-iio, linux-hwmon, linux-kernel
On 27/04/17 16:30, Sebastian Reichel wrote:
> All madc users have been converted to IIO API, so drop the
> legacy API. The function is still used inside of 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 | 5 +++--
> include/linux/i2c/twl4030-madc.h | 2 --
> 2 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/adc/twl4030-madc.c b/drivers/iio/adc/twl4030-madc.c
> index 88e44066ef82..be60f76d1a50 100644
> --- a/drivers/iio/adc/twl4030-madc.c
> +++ b/drivers/iio/adc/twl4030-madc.c
> @@ -72,6 +72,8 @@ struct twl4030_madc_data {
> u8 isr;
> };
>
> +static int twl4030_madc_conversion(struct twl4030_madc_request *req);
> +
> static int twl4030_madc_read(struct iio_dev *iio_dev,
> const struct iio_chan_spec *chan,
> int *val, int *val2, long mask)
> @@ -568,7 +570,7 @@ static int twl4030_madc_wait_conversion_ready(struct twl4030_madc_data *madc,
> * be a negative error value in the corresponding array element.
> * returns 0 if succeeds else error value
> */
> -int twl4030_madc_conversion(struct twl4030_madc_request *req)
> +static int twl4030_madc_conversion(struct twl4030_madc_request *req)
> {
> const struct twl4030_madc_conversion_method *method;
> int ret;
> @@ -640,7 +642,6 @@ int twl4030_madc_conversion(struct twl4030_madc_request *req)
>
> return ret;
> }
> -EXPORT_SYMBOL_GPL(twl4030_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 0c919ebb31e0..be9260e261ac 100644
> --- a/include/linux/i2c/twl4030-madc.h
> +++ b/include/linux/i2c/twl4030-madc.h
> @@ -141,6 +141,4 @@ struct twl4030_madc_user_parms {
> int status;
> u16 result;
> };
> -
> -int twl4030_madc_conversion(struct twl4030_madc_request *conv);
> #endif
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 6/7] iio: adc: twl4030: Remove twl4030_madc_request.func_cb
2017-04-27 15:30 ` [PATCH 6/7] iio: adc: twl4030: Remove twl4030_madc_request.func_cb Sebastian Reichel
@ 2017-04-30 16:37 ` Jonathan Cameron
0 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2017-04-30 16:37 UTC (permalink / raw)
To: Sebastian Reichel, Sebastian Reichel, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler, Jean Delvare,
Guenter Roeck
Cc: J Keerthy, linux-iio, linux-hwmon, linux-kernel
On 27/04/17 16:30, Sebastian Reichel wrote:
> This functionality is not used by the IIO subsystem. Due
> to removal of legacy API it can also be removed.
>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Jonathan Cameron <jic23@kernel.org>
> ---
> drivers/iio/adc/twl4030-madc.c | 70 ----------------------------------------
> include/linux/i2c/twl4030-madc.h | 1 -
> 2 files changed, 71 deletions(-)
>
> diff --git a/drivers/iio/adc/twl4030-madc.c b/drivers/iio/adc/twl4030-madc.c
> index be60f76d1a50..21df5b932bd1 100644
> --- a/drivers/iio/adc/twl4030-madc.c
> +++ b/drivers/iio/adc/twl4030-madc.c
> @@ -86,7 +86,6 @@ static int twl4030_madc_read(struct iio_dev *iio_dev,
>
> req.channels = BIT(chan->channel);
> req.active = false;
> - req.func_cb = NULL;
> req.type = TWL4030_MADC_WAIT;
> req.raw = !(mask == IIO_CHAN_INFO_PROCESSED);
> req.do_avg = (mask == IIO_CHAN_INFO_AVERAGE_RAW);
> @@ -343,37 +342,6 @@ static int twl4030_madc_read_channels(struct twl4030_madc_data *madc,
> }
>
> /*
> - * Enables irq.
> - * @madc - pointer to twl4030_madc_data struct
> - * @id - irq number to be enabled
> - * can take one of TWL4030_MADC_RT, TWL4030_MADC_SW1, TWL4030_MADC_SW2
> - * corresponding to RT, SW1, SW2 conversion requests.
> - * If the i2c read fails it returns an error else returns 0.
> - */
> -static int twl4030_madc_enable_irq(struct twl4030_madc_data *madc, u8 id)
> -{
> - u8 val;
> - int ret;
> -
> - ret = twl_i2c_read_u8(TWL4030_MODULE_MADC, &val, madc->imr);
> - if (ret) {
> - dev_err(madc->dev, "unable to read imr register 0x%X\n",
> - madc->imr);
> - return ret;
> - }
> -
> - val &= ~(1 << id);
> - ret = twl_i2c_write_u8(TWL4030_MODULE_MADC, val, madc->imr);
> - if (ret) {
> - dev_err(madc->dev,
> - "unable to write imr register 0x%X\n", madc->imr);
> - return ret;
> - }
> -
> - return 0;
> -}
> -
> -/*
> * Disables irq.
> * @madc - pointer to twl4030_madc_data struct
> * @id - irq number to be disabled
> @@ -442,11 +410,6 @@ static irqreturn_t twl4030_madc_threaded_irq_handler(int irq, void *_madc)
> /* Read results */
> len = twl4030_madc_read_channels(madc, method->rbase,
> r->channels, r->rbuf, r->raw);
> - /* Return results to caller */
> - if (r->func_cb != NULL) {
> - r->func_cb(len, r->channels, r->rbuf);
> - r->func_cb = NULL;
> - }
> /* Free request */
> r->result_pending = 0;
> r->active = 0;
> @@ -468,11 +431,6 @@ static irqreturn_t twl4030_madc_threaded_irq_handler(int irq, void *_madc)
> /* Read results */
> len = twl4030_madc_read_channels(madc, method->rbase,
> r->channels, r->rbuf, r->raw);
> - /* Return results to caller */
> - if (r->func_cb != NULL) {
> - r->func_cb(len, r->channels, r->rbuf);
> - r->func_cb = NULL;
> - }
> /* Free request */
> r->result_pending = 0;
> r->active = 0;
> @@ -482,23 +440,6 @@ static irqreturn_t twl4030_madc_threaded_irq_handler(int irq, void *_madc)
> return IRQ_HANDLED;
> }
>
> -static int twl4030_madc_set_irq(struct twl4030_madc_data *madc,
> - struct twl4030_madc_request *req)
> -{
> - struct twl4030_madc_request *p;
> - int ret;
> -
> - p = &madc->requests[req->method];
> - memcpy(p, req, sizeof(*req));
> - ret = twl4030_madc_enable_irq(madc, req->method);
> - if (ret < 0) {
> - dev_err(madc->dev, "enable irq failed!!\n");
> - return ret;
> - }
> -
> - return 0;
> -}
> -
> /*
> * Function which enables the madc conversion
> * by writing to the control register.
> @@ -607,17 +548,6 @@ static int twl4030_madc_conversion(struct twl4030_madc_request *req)
> goto out;
> }
> }
> - if (req->type == TWL4030_MADC_IRQ_ONESHOT && req->func_cb != NULL) {
> - ret = twl4030_madc_set_irq(twl4030_madc, req);
> - if (ret < 0)
> - goto out;
> - ret = twl4030_madc_start_conversion(twl4030_madc, req->method);
> - if (ret < 0)
> - goto out;
> - twl4030_madc->requests[req->method].active = 1;
> - ret = 0;
> - goto out;
> - }
> /* With RT method we should not be here anymore */
> if (req->method == TWL4030_MADC_RT) {
> ret = -EINVAL;
> diff --git a/include/linux/i2c/twl4030-madc.h b/include/linux/i2c/twl4030-madc.h
> index f395700fb933..34e94747b61e 100644
> --- a/include/linux/i2c/twl4030-madc.h
> +++ b/include/linux/i2c/twl4030-madc.h
> @@ -51,7 +51,6 @@ struct twl4030_madc_request {
> bool result_pending;
> bool raw;
> int rbuf[TWL4030_MADC_MAX_CHANNELS];
> - void (*func_cb)(int len, int channels, int *buf);
> };
>
> enum conversion_methods {
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 7/7] iio: adc: twl4030: Fold twl4030-madc.h into driver
2017-04-27 15:30 ` [PATCH 7/7] iio: adc: twl4030: Fold twl4030-madc.h into driver Sebastian Reichel
@ 2017-04-30 16:38 ` Jonathan Cameron
2017-06-03 9:45 ` Jonathan Cameron
0 siblings, 1 reply; 22+ messages in thread
From: Jonathan Cameron @ 2017-04-30 16:38 UTC (permalink / raw)
To: Sebastian Reichel, Sebastian Reichel, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler, Jean Delvare,
Guenter Roeck
Cc: J Keerthy, linux-iio, linux-hwmon, linux-kernel
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
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 1/7] hwmon: twl4030-madc: drop driver
2017-04-27 16:51 ` Guenter Roeck
@ 2017-04-30 16:41 ` Jonathan Cameron
2017-04-30 18:46 ` Guenter Roeck
2017-05-01 9:27 ` Sebastian Reichel
0 siblings, 2 replies; 22+ messages in thread
From: Jonathan Cameron @ 2017-04-30 16:41 UTC (permalink / raw)
To: Guenter Roeck, Sebastian Reichel
Cc: Sebastian Reichel, Hartmut Knaack, Lars-Peter Clausen,
Peter Meerwald-Stadler, Jean Delvare, J Keerthy, linux-iio,
linux-hwmon, linux-kernel, Wolfram Sang
On 27/04/17 17:51, Guenter Roeck wrote:
> On Thu, Apr 27, 2017 at 05:30:06PM +0200, Sebastian Reichel wrote:
>> This driver is no longer needed:
>>
>> * It has no mainline users
>> * It has no DT support and OMAP is DT only
>> * iio-hwmon can be used for madc, which also works with DT
>>
>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
>
> Acked-by: Guenter Roeck <linux@roeck-us.net>
>
> ... assuming this will be pushed through the same tree as the rest
> of the series. Let me know if I should queue it up in hwmon for v4.12.
We are too late for the series to go through IIO for the 4.12 cycle, so I guess it
makes sense to take this one through hwmon if you still have time.
I can then pick up the rest once I have acks from Wolfram
(who should have been cc'd as we are hoovering up things from the
i2c directories in this series) + power supply side of things.
Jonathan
>
> Thanks,
> Guenter
>
>> ---
>> drivers/hwmon/Kconfig | 10 ----
>> drivers/hwmon/Makefile | 1 -
>> drivers/hwmon/twl4030-madc-hwmon.c | 118 -------------------------------------
>> 3 files changed, 129 deletions(-)
>> delete mode 100644 drivers/hwmon/twl4030-madc-hwmon.c
>>
>> diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
>> index 0649d53f3d16..776d1ac2bfee 100644
>> --- a/drivers/hwmon/Kconfig
>> +++ b/drivers/hwmon/Kconfig
>> @@ -1643,16 +1643,6 @@ config SENSORS_TMP421
>> This driver can also be built as a module. If so, the module
>> will be called tmp421.
>>
>> -config SENSORS_TWL4030_MADC
>> - tristate "Texas Instruments TWL4030 MADC Hwmon"
>> - depends on TWL4030_MADC
>> - help
>> - If you say yes here you get hwmon support for triton
>> - TWL4030-MADC.
>> -
>> - This driver can also be built as a module. If so it will be called
>> - twl4030-madc-hwmon.
>> -
>> config SENSORS_VEXPRESS
>> tristate "Versatile Express"
>> depends on VEXPRESS_CONFIG
>> diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
>> index 5509edf6186a..c05530d6cb6e 100644
>> --- a/drivers/hwmon/Makefile
>> +++ b/drivers/hwmon/Makefile
>> @@ -157,7 +157,6 @@ obj-$(CONFIG_SENSORS_TMP103) += tmp103.o
>> obj-$(CONFIG_SENSORS_TMP108) += tmp108.o
>> obj-$(CONFIG_SENSORS_TMP401) += tmp401.o
>> obj-$(CONFIG_SENSORS_TMP421) += tmp421.o
>> -obj-$(CONFIG_SENSORS_TWL4030_MADC)+= twl4030-madc-hwmon.o
>> obj-$(CONFIG_SENSORS_VEXPRESS) += vexpress-hwmon.o
>> obj-$(CONFIG_SENSORS_VIA_CPUTEMP)+= via-cputemp.o
>> obj-$(CONFIG_SENSORS_VIA686A) += via686a.o
>> diff --git a/drivers/hwmon/twl4030-madc-hwmon.c b/drivers/hwmon/twl4030-madc-hwmon.c
>> deleted file mode 100644
>> index b5caf7fdb487..000000000000
>> --- a/drivers/hwmon/twl4030-madc-hwmon.c
>> +++ /dev/null
>> @@ -1,118 +0,0 @@
>> -/*
>> - *
>> - * TWL4030 MADC Hwmon driver-This driver monitors the real time
>> - * conversion of analog signals like battery temperature,
>> - * battery type, battery level etc. User can ask for the conversion on a
>> - * particular channel using the sysfs nodes.
>> - *
>> - * 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
>> - *
>> - */
>> -#include <linux/init.h>
>> -#include <linux/module.h>
>> -#include <linux/kernel.h>
>> -#include <linux/i2c/twl.h>
>> -#include <linux/device.h>
>> -#include <linux/platform_device.h>
>> -#include <linux/i2c/twl4030-madc.h>
>> -#include <linux/hwmon.h>
>> -#include <linux/hwmon-sysfs.h>
>> -#include <linux/stddef.h>
>> -#include <linux/sysfs.h>
>> -#include <linux/err.h>
>> -#include <linux/types.h>
>> -
>> -/*
>> - * sysfs hook function
>> - */
>> -static ssize_t madc_read(struct device *dev,
>> - struct device_attribute *devattr, char *buf)
>> -{
>> - struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
>> - struct twl4030_madc_request req = {
>> - .channels = 1 << attr->index,
>> - .method = TWL4030_MADC_SW2,
>> - .type = TWL4030_MADC_WAIT,
>> - };
>> - long val;
>> -
>> - val = twl4030_madc_conversion(&req);
>> - if (val < 0)
>> - return val;
>> -
>> - return sprintf(buf, "%d\n", req.rbuf[attr->index]);
>> -}
>> -
>> -/* sysfs nodes to read individual channels from user side */
>> -static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, madc_read, NULL, 0);
>> -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, madc_read, NULL, 1);
>> -static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, madc_read, NULL, 2);
>> -static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, madc_read, NULL, 3);
>> -static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, madc_read, NULL, 4);
>> -static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, madc_read, NULL, 5);
>> -static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, madc_read, NULL, 6);
>> -static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, madc_read, NULL, 7);
>> -static SENSOR_DEVICE_ATTR(in8_input, S_IRUGO, madc_read, NULL, 8);
>> -static SENSOR_DEVICE_ATTR(in9_input, S_IRUGO, madc_read, NULL, 9);
>> -static SENSOR_DEVICE_ATTR(curr10_input, S_IRUGO, madc_read, NULL, 10);
>> -static SENSOR_DEVICE_ATTR(in11_input, S_IRUGO, madc_read, NULL, 11);
>> -static SENSOR_DEVICE_ATTR(in12_input, S_IRUGO, madc_read, NULL, 12);
>> -static SENSOR_DEVICE_ATTR(in15_input, S_IRUGO, madc_read, NULL, 15);
>> -
>> -static struct attribute *twl4030_madc_attrs[] = {
>> - &sensor_dev_attr_in0_input.dev_attr.attr,
>> - &sensor_dev_attr_temp1_input.dev_attr.attr,
>> - &sensor_dev_attr_in2_input.dev_attr.attr,
>> - &sensor_dev_attr_in3_input.dev_attr.attr,
>> - &sensor_dev_attr_in4_input.dev_attr.attr,
>> - &sensor_dev_attr_in5_input.dev_attr.attr,
>> - &sensor_dev_attr_in6_input.dev_attr.attr,
>> - &sensor_dev_attr_in7_input.dev_attr.attr,
>> - &sensor_dev_attr_in8_input.dev_attr.attr,
>> - &sensor_dev_attr_in9_input.dev_attr.attr,
>> - &sensor_dev_attr_curr10_input.dev_attr.attr,
>> - &sensor_dev_attr_in11_input.dev_attr.attr,
>> - &sensor_dev_attr_in12_input.dev_attr.attr,
>> - &sensor_dev_attr_in15_input.dev_attr.attr,
>> - NULL
>> -};
>> -ATTRIBUTE_GROUPS(twl4030_madc);
>> -
>> -static int twl4030_madc_hwmon_probe(struct platform_device *pdev)
>> -{
>> - struct device *hwmon;
>> -
>> - hwmon = devm_hwmon_device_register_with_groups(&pdev->dev,
>> - "twl4030_madc", NULL,
>> - twl4030_madc_groups);
>> - return PTR_ERR_OR_ZERO(hwmon);
>> -}
>> -
>> -static struct platform_driver twl4030_madc_hwmon_driver = {
>> - .probe = twl4030_madc_hwmon_probe,
>> - .driver = {
>> - .name = "twl4030_madc_hwmon",
>> - },
>> -};
>> -
>> -module_platform_driver(twl4030_madc_hwmon_driver);
>> -
>> -MODULE_DESCRIPTION("TWL4030 ADC Hwmon driver");
>> -MODULE_LICENSE("GPL");
>> -MODULE_AUTHOR("J Keerthy");
>> -MODULE_ALIAS("platform:twl4030_madc_hwmon");
>> --
>> 2.11.0
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 1/7] hwmon: twl4030-madc: drop driver
2017-04-30 16:41 ` Jonathan Cameron
@ 2017-04-30 18:46 ` Guenter Roeck
2017-05-01 9:27 ` Sebastian Reichel
1 sibling, 0 replies; 22+ messages in thread
From: Guenter Roeck @ 2017-04-30 18:46 UTC (permalink / raw)
To: Jonathan Cameron, Sebastian Reichel
Cc: Sebastian Reichel, Hartmut Knaack, Lars-Peter Clausen,
Peter Meerwald-Stadler, Jean Delvare, J Keerthy, linux-iio,
linux-hwmon, linux-kernel, Wolfram Sang
On 04/30/2017 09:41 AM, Jonathan Cameron wrote:
> On 27/04/17 17:51, Guenter Roeck wrote:
>> On Thu, Apr 27, 2017 at 05:30:06PM +0200, Sebastian Reichel wrote:
>>> This driver is no longer needed:
>>>
>>> * It has no mainline users
>>> * It has no DT support and OMAP is DT only
>>> * iio-hwmon can be used for madc, which also works with DT
>>>
>>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
>>
>> Acked-by: Guenter Roeck <linux@roeck-us.net>
>>
>> ... assuming this will be pushed through the same tree as the rest
>> of the series. Let me know if I should queue it up in hwmon for v4.12.
> We are too late for the series to go through IIO for the 4.12 cycle, so I guess it
> makes sense to take this one through hwmon if you still have time.
>
Ok, done.
Guenter
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 1/7] hwmon: twl4030-madc: drop driver
2017-04-30 16:41 ` Jonathan Cameron
2017-04-30 18:46 ` Guenter Roeck
@ 2017-05-01 9:27 ` Sebastian Reichel
2017-05-01 10:38 ` Wolfram Sang
1 sibling, 1 reply; 22+ messages in thread
From: Sebastian Reichel @ 2017-05-01 9:27 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: linux-iio, linux-hwmon, linux-kernel, Wolfram Sang
[-- Attachment #1: Type: text/plain, Size: 1437 bytes --]
Hi,
On Sun, Apr 30, 2017 at 05:41:05PM +0100, Jonathan Cameron wrote:
> On 27/04/17 17:51, Guenter Roeck wrote:
> > On Thu, Apr 27, 2017 at 05:30:06PM +0200, Sebastian Reichel wrote:
> >> This driver is no longer needed:
> >>
> >> * It has no mainline users
> >> * It has no DT support and OMAP is DT only
> >> * iio-hwmon can be used for madc, which also works with DT
> >>
> >> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
> >
> > Acked-by: Guenter Roeck <linux@roeck-us.net>
> >
> > ... assuming this will be pushed through the same tree as the rest
> > of the series. Let me know if I should queue it up in hwmon for v4.12.
> We are too late for the series to go through IIO for the 4.12 cycle, so I guess it
> makes sense to take this one through hwmon if you still have time.
>
> I can then pick up the rest once I have acks from Wolfram
> (who should have been cc'd as we are hoovering up things from the
> i2c directories in this series)
$ ./scripts/get_maintainer.pl -f include/linux/i2c/twl4030-madc.h
linux-kernel@vger.kernel.org (open list)
This directory contains headers for random i2c chips
and Wolfram maintains the bus drivers (and is already
overloaded with work afaik), so I did not Cc him.
> + power supply side of things.
I just send my pull-request for 4.12. I will queue this up for my
early -rc/late merge window pull-request.
-- Sebastian
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 1/7] hwmon: twl4030-madc: drop driver
2017-05-01 9:27 ` Sebastian Reichel
@ 2017-05-01 10:38 ` Wolfram Sang
0 siblings, 0 replies; 22+ messages in thread
From: Wolfram Sang @ 2017-05-01 10:38 UTC (permalink / raw)
To: Sebastian Reichel; +Cc: Jonathan Cameron, linux-iio, linux-hwmon, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 824 bytes --]
> > I can then pick up the rest once I have acks from Wolfram
> > (who should have been cc'd as we are hoovering up things from the
> > i2c directories in this series)
>
> $ ./scripts/get_maintainer.pl -f include/linux/i2c/twl4030-madc.h
> linux-kernel@vger.kernel.org (open list)
>
> This directory contains headers for random i2c chips
> and Wolfram maintains the bus drivers (and is already
> overloaded with work afaik), so I did not Cc him.
You both have a point :) I should maintain include/linux/i2c but as it
is mainly cruft at the moment, I don't do it very actively.
That being said, I now noticed the patchset and am super happy for the
move of the include file to the proper place. So, for all patches
touching include/linux/i2c:
Acked-by: Wolfram Sang <wsa@the-dreams.de>
Thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/7] power: supply: avoid unused twl4030-madc.h
2017-04-27 15:30 ` [PATCH 2/7] power: supply: avoid unused twl4030-madc.h Sebastian Reichel
@ 2017-05-01 11:51 ` Sebastian Reichel
0 siblings, 0 replies; 22+ messages in thread
From: Sebastian Reichel @ 2017-05-01 11:51 UTC (permalink / raw)
To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
Peter Meerwald-Stadler, Jean Delvare, Guenter Roeck
Cc: J Keerthy, linux-iio, linux-hwmon, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 379 bytes --]
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 3/7] iio: adc: twl4030: Drop twl4030_get_madc_conversion()
2017-04-30 16:35 ` Jonathan Cameron
@ 2017-06-03 9:36 ` Jonathan Cameron
0 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2017-06-03 9:36 UTC (permalink / raw)
To: Sebastian Reichel, Sebastian Reichel, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler, Jean Delvare,
Guenter Roeck
Cc: J Keerthy, linux-iio, linux-hwmon, linux-kernel
On Sun, 30 Apr 2017 17:35:04 +0100
Jonathan Cameron <jic23@kernel.org> wrote:
> 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>
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.
Thanks,
Jonathan
> > ---
> > 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
> >
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 4/7] iio: adc: twl4030: Unexport twl4030_madc_conversion()
2017-04-30 16:35 ` Jonathan Cameron
@ 2017-06-03 9:37 ` Jonathan Cameron
0 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2017-06-03 9:37 UTC (permalink / raw)
To: Sebastian Reichel, Sebastian Reichel, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler, Jean Delvare,
Guenter Roeck
Cc: J Keerthy, linux-iio, linux-hwmon, linux-kernel
On Sun, 30 Apr 2017 17:35:47 +0100
Jonathan Cameron <jic23@kernel.org> wrote:
> On 27/04/17 16:30, Sebastian Reichel wrote:
> > All madc users have been converted to IIO API, so drop the
> > legacy API. The function is still used inside of the driver.
> >
> > Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
> Acked-by: Jonathan Cameron <jic23@kernel.org>
Applied to the togreg branch of iio.git and pushed out
as testing for the autobuilders to play with them.
thanks,
Jonathan
> > ---
> > drivers/iio/adc/twl4030-madc.c | 5 +++--
> > include/linux/i2c/twl4030-madc.h | 2 --
> > 2 files changed, 3 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/iio/adc/twl4030-madc.c b/drivers/iio/adc/twl4030-madc.c
> > index 88e44066ef82..be60f76d1a50 100644
> > --- a/drivers/iio/adc/twl4030-madc.c
> > +++ b/drivers/iio/adc/twl4030-madc.c
> > @@ -72,6 +72,8 @@ struct twl4030_madc_data {
> > u8 isr;
> > };
> >
> > +static int twl4030_madc_conversion(struct twl4030_madc_request *req);
> > +
> > static int twl4030_madc_read(struct iio_dev *iio_dev,
> > const struct iio_chan_spec *chan,
> > int *val, int *val2, long mask)
> > @@ -568,7 +570,7 @@ static int twl4030_madc_wait_conversion_ready(struct twl4030_madc_data *madc,
> > * be a negative error value in the corresponding array element.
> > * returns 0 if succeeds else error value
> > */
> > -int twl4030_madc_conversion(struct twl4030_madc_request *req)
> > +static int twl4030_madc_conversion(struct twl4030_madc_request *req)
> > {
> > const struct twl4030_madc_conversion_method *method;
> > int ret;
> > @@ -640,7 +642,6 @@ int twl4030_madc_conversion(struct twl4030_madc_request *req)
> >
> > return ret;
> > }
> > -EXPORT_SYMBOL_GPL(twl4030_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 0c919ebb31e0..be9260e261ac 100644
> > --- a/include/linux/i2c/twl4030-madc.h
> > +++ b/include/linux/i2c/twl4030-madc.h
> > @@ -141,6 +141,4 @@ struct twl4030_madc_user_parms {
> > int status;
> > u16 result;
> > };
> > -
> > -int twl4030_madc_conversion(struct twl4030_madc_request *conv);
> > #endif
> >
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 5/7] iio: adc: twl4030: Drop struct twl4030_madc_user_parms
2017-04-27 15:30 ` [PATCH 5/7] iio: adc: twl4030: Drop struct twl4030_madc_user_parms Sebastian Reichel
@ 2017-06-03 9:40 ` Jonathan Cameron
0 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2017-06-03 9:40 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Sebastian Reichel, Hartmut Knaack, Lars-Peter Clausen,
Peter Meerwald-Stadler, Jean Delvare, Guenter Roeck, J Keerthy,
linux-iio, linux-hwmon, linux-kernel
On Thu, 27 Apr 2017 17:30:10 +0200
Sebastian Reichel <sebastian.reichel@collabora.co.uk> wrote:
> This struct is no longer used by anything in the kernel.
>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to see if we have missed anything.
Jonathan
> ---
> 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
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 7/7] iio: adc: twl4030: Fold twl4030-madc.h into driver
2017-04-30 16:38 ` Jonathan Cameron
@ 2017-06-03 9:45 ` Jonathan Cameron
0 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2017-06-03 9:45 UTC (permalink / raw)
To: Sebastian Reichel, Sebastian Reichel, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler, Jean Delvare,
Guenter Roeck
Cc: J Keerthy, linux-iio, linux-hwmon, linux-kernel
On Sun, 30 Apr 2017 17:38:07 +0100
Jonathan Cameron <jic23@kernel.org> wrote:
> 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>
Applied.
Thanks
Jonathan
> > ---
> > 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
> >
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2017-06-03 9:45 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-27 15:30 [PATCH 0/7] twl4030-madc cleanup Sebastian Reichel
2017-04-27 15:30 ` [PATCH 1/7] hwmon: twl4030-madc: drop driver Sebastian Reichel
2017-04-27 16:51 ` Guenter Roeck
2017-04-30 16:41 ` Jonathan Cameron
2017-04-30 18:46 ` Guenter Roeck
2017-05-01 9:27 ` Sebastian Reichel
2017-05-01 10:38 ` Wolfram Sang
2017-04-27 15:30 ` [PATCH 2/7] power: supply: avoid unused twl4030-madc.h Sebastian Reichel
2017-05-01 11:51 ` Sebastian Reichel
2017-04-27 15:30 ` [PATCH 3/7] iio: adc: twl4030: Drop twl4030_get_madc_conversion() Sebastian Reichel
2017-04-30 16:35 ` Jonathan Cameron
2017-06-03 9:36 ` Jonathan Cameron
2017-04-27 15:30 ` [PATCH 4/7] iio: adc: twl4030: Unexport twl4030_madc_conversion() Sebastian Reichel
2017-04-30 16:35 ` Jonathan Cameron
2017-06-03 9:37 ` Jonathan Cameron
2017-04-27 15:30 ` [PATCH 5/7] iio: adc: twl4030: Drop struct twl4030_madc_user_parms Sebastian Reichel
2017-06-03 9:40 ` Jonathan Cameron
2017-04-27 15:30 ` [PATCH 6/7] iio: adc: twl4030: Remove twl4030_madc_request.func_cb Sebastian Reichel
2017-04-30 16:37 ` Jonathan Cameron
2017-04-27 15:30 ` [PATCH 7/7] iio: adc: twl4030: Fold twl4030-madc.h into driver Sebastian Reichel
2017-04-30 16:38 ` Jonathan Cameron
2017-06-03 9:45 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).