[linux-yocto] [yocto-kernel-cache][PATCH] netfilter: enable connection tracking for IPv6

2016-12-12 Thread Dmitry Rozhkov
In case of the DROP policy in the INPUT chain a host using IPv6 still
might need to receive TCP packets for established connections, that is
to have the rule

-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT

in its INPUT chain of ip6tables. For this feature to work the option
CONFIG_NF_CONNTRACK_IPV6 needs to be enabled.

Signed-off-by: Dmitry Rozhkov 
---
 features/netfilter/netfilter.cfg | 1 +
 1 file changed, 1 insertion(+)

diff --git a/features/netfilter/netfilter.cfg b/features/netfilter/netfilter.cfg
index 8ecef4a..99fa30f 100644
--- a/features/netfilter/netfilter.cfg
+++ b/features/netfilter/netfilter.cfg
@@ -68,6 +68,7 @@ CONFIG_NETFILTER_XT_MATCH_U32=m
 #
 CONFIG_NF_DEFRAG_IPV4=m
 CONFIG_NF_CONNTRACK_IPV4=m
+CONFIG_NF_CONNTRACK_IPV6=m
 CONFIG_NF_CONNTRACK_PROC_COMPAT=y
 CONFIG_IP_NF_IPTABLES=m
 CONFIG_IP_NF_MATCH_AH=m
-- 
2.7.4

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


[linux-yocto] [PATCH 4/5] iio: adc: ti-ads1015: add indio_dev->dev.of_node reference

2016-12-12 Thread tuomas . katila
From: Matt Ranostay 

Backported from linux-yocto-4.8: f5241dbdfef4404b4e80f0bda13e5c7ceba3ee4a

Add the pointer to the device tree node of the ADC so that iio
consumers can reference the respective channels.

Signed-off-by: Matt Ranostay 
Acked-by: Daniel Baluta 
Signed-off-by: Jonathan Cameron 
---
 drivers/iio/adc/ti-ads1015.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
index 8be192a84893..6f75a4aa67c1 100644
--- a/drivers/iio/adc/ti-ads1015.c
+++ b/drivers/iio/adc/ti-ads1015.c
@@ -585,6 +585,7 @@ static int ads1015_probe(struct i2c_client *client,
mutex_init(>lock);
 
indio_dev->dev.parent = >dev;
+   indio_dev->dev.of_node = client->dev.of_node;
indio_dev->name = ADS1015_DRV_NAME;
indio_dev->modes = INDIO_DIRECT_MODE;
 
-- 
2.11.0

-
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


[linux-yocto] [PATCH 5/5] iio: adc: ti-ads1015: add support for acpi

2016-12-12 Thread tuomas . katila
From: Tuomas Katila 

Add support for acpi platform configuration.

Signed-off-by: Tuomas Katila 
---
 drivers/iio/adc/ti-ads1015.c | 34 +-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
index 6f75a4aa67c1..4a4463f74098 100644
--- a/drivers/iio/adc/ti-ads1015.c
+++ b/drivers/iio/adc/ti-ads1015.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -568,11 +569,23 @@ static void ads1015_get_channels_config(struct i2c_client 
*client)
}
 }
 
+static const int ads1015_match_acpi_device(struct device *dev)
+{
+const struct acpi_device_id *id;
+
+id = acpi_match_device(dev->driver->acpi_match_table, dev);
+if (!id)
+return 0;
+
+return id->driver_data;
+}
+
 static int ads1015_probe(struct i2c_client *client,
 const struct i2c_device_id *id)
 {
struct iio_dev *indio_dev;
struct ads1015_data *data;
+   int driver_data;
int ret;
 
indio_dev = devm_iio_device_alloc(>dev, sizeof(*data));
@@ -589,7 +602,13 @@ static int ads1015_probe(struct i2c_client *client,
indio_dev->name = ADS1015_DRV_NAME;
indio_dev->modes = INDIO_DIRECT_MODE;
 
-   switch (id->driver_data) {
+   if (ACPI_HANDLE(>dev)) {
+   driver_data = ads1015_match_acpi_device(>dev);
+   } else {
+   driver_data = id->driver_data;
+   }
+
+   switch (driver_data) {
case ADS1015:
indio_dev->channels = ads1015_channels;
indio_dev->num_channels = ARRAY_SIZE(ads1015_channels);
@@ -620,6 +639,7 @@ static int ads1015_probe(struct i2c_client *client,
dev_err(>dev, "iio triggered buffer setup failed\n");
return ret;
}
+
ret = pm_runtime_set_active(>dev);
if (ret)
goto err_buffer_cleanup;
@@ -687,6 +707,15 @@ static const struct dev_pm_ops ads1015_pm_ops = {
   ads1015_runtime_resume, NULL)
 };
 
+#ifdef CONFIG_ACPI
+static const struct acpi_device_id ads1015_acpi_match[] = {
+   {"ADS1015", ADS1015},
+   {"ADS1115", ADS1115},
+   {}
+};
+MODULE_DEVICE_TABLE(acpi, ads1015_acpi_match);
+#endif
+
 static const struct i2c_device_id ads1015_id[] = {
{"ads1015", ADS1015},
{"ads1115", ADS1115},
@@ -698,6 +727,9 @@ static struct i2c_driver ads1015_driver = {
.driver = {
.name = ADS1015_DRV_NAME,
.pm = _pm_ops,
+#ifdef CONFIG_ACPI
+   .acpi_match_table = ACPI_PTR(ads1015_acpi_match),
+#endif
},
.probe  = ads1015_probe,
.remove = ads1015_remove,
-- 
2.11.0

-
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


[linux-yocto] [PATCH 3/5] iio: adc: ti-ads1015: add datasheet names

2016-12-12 Thread tuomas . katila
From: Matt Ranostay 

Backported from linux-yocto-4.8: 8ac8aa61f87eda944cf29229c9c20cba9e83f1ea

Add datasheet names for ADC channels to allow iio consumers access.

Signed-off-by: Matt Ranostay 
Acked-by: Daniel Baluta 
Signed-off-by: Jonathan Cameron 
---
 drivers/iio/adc/ti-ads1015.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
index a83542319d28..8be192a84893 100644
--- a/drivers/iio/adc/ti-ads1015.c
+++ b/drivers/iio/adc/ti-ads1015.c
@@ -110,6 +110,7 @@ static const struct {
.shift = 4, \
.endianness = IIO_CPU,  \
},  \
+   .datasheet_name = "AIN"#_chan,  \
 }
 
 #define ADS1015_V_DIFF_CHAN(_chan, _chan2, _addr) {\
@@ -130,6 +131,7 @@ static const struct {
.shift = 4, \
.endianness = IIO_CPU,  \
},  \
+   .datasheet_name = "AIN"#_chan"-AIN"#_chan2, \
 }
 
 #define ADS1115_V_CHAN(_chan, _addr) { \
@@ -147,6 +149,7 @@ static const struct {
.storagebits = 16,  \
.endianness = IIO_CPU,  \
},  \
+   .datasheet_name = "AIN"#_chan,  \
 }
 
 #define ADS1115_V_DIFF_CHAN(_chan, _chan2, _addr) {\
@@ -166,6 +169,7 @@ static const struct {
.storagebits = 16,  \
.endianness = IIO_CPU,  \
},  \
+   .datasheet_name = "AIN"#_chan"-AIN"#_chan2, \
 }
 
 struct ads1015_data {
-- 
2.11.0

-
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


[linux-yocto] [PATCH 2/5] iio: adc: ti-ads1015: add support for ADS1115 part

2016-12-12 Thread tuomas . katila
From: Matt Ranostay 

Backported from linux-yocto-4.8: ba35f111aa6f386df33f950aeaea53a2bf040cc2

TI ADS1115 is a 16-bit resolution ADC that is register map
compatible with the ADS1015 device.

Signed-off-by: Matt Ranostay 
Acked-by: Daniel Baluta 
Acked-by: Crt Mori 
Signed-off-by: Jonathan Cameron 
---
 drivers/iio/adc/ti-ads1015.c | 124 +--
 1 file changed, 109 insertions(+), 15 deletions(-)

diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
index 73cbf0b54e54..a83542319d28 100644
--- a/drivers/iio/adc/ti-ads1015.c
+++ b/drivers/iio/adc/ti-ads1015.c
@@ -55,6 +55,11 @@
 #define ADS1015_DEFAULT_DATA_RATE  4
 #define ADS1015_DEFAULT_CHAN   0
 
+enum {
+   ADS1015,
+   ADS1115,
+};
+
 enum ads1015_channels {
ADS1015_AIN0_AIN1 = 0,
ADS1015_AIN0_AIN3,
@@ -71,6 +76,10 @@ static const unsigned int ads1015_data_rate[] = {
128, 250, 490, 920, 1600, 2400, 3300, 3300
 };
 
+static const unsigned int ads1115_data_rate[] = {
+   8, 16, 32, 64, 128, 250, 475, 860
+};
+
 static const struct {
int scale;
int uscale;
@@ -123,6 +132,42 @@ static const struct {
},  \
 }
 
+#define ADS1115_V_CHAN(_chan, _addr) { \
+   .type = IIO_VOLTAGE,\
+   .indexed = 1,   \
+   .address = _addr,   \
+   .channel = _chan,   \
+   .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |  \
+   BIT(IIO_CHAN_INFO_SCALE) |  \
+   BIT(IIO_CHAN_INFO_SAMP_FREQ),   \
+   .scan_index = _addr,\
+   .scan_type = {  \
+   .sign = 's',\
+   .realbits = 16, \
+   .storagebits = 16,  \
+   .endianness = IIO_CPU,  \
+   },  \
+}
+
+#define ADS1115_V_DIFF_CHAN(_chan, _chan2, _addr) {\
+   .type = IIO_VOLTAGE,\
+   .differential = 1,  \
+   .indexed = 1,   \
+   .address = _addr,   \
+   .channel = _chan,   \
+   .channel2 = _chan2, \
+   .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |  \
+   BIT(IIO_CHAN_INFO_SCALE) |  \
+   BIT(IIO_CHAN_INFO_SAMP_FREQ),   \
+   .scan_index = _addr,\
+   .scan_type = {  \
+   .sign = 's',\
+   .realbits = 16, \
+   .storagebits = 16,  \
+   .endianness = IIO_CPU,  \
+   },  \
+}
+
 struct ads1015_data {
struct regmap *regmap;
/*
@@ -131,6 +176,8 @@ struct ads1015_data {
 */
struct mutex lock;
struct ads1015_channel_data channel_data[ADS1015_CHANNELS];
+
+   unsigned int *data_rate;
 };
 
 static bool ads1015_is_writeable_reg(struct device *dev, unsigned int reg)
@@ -157,6 +204,18 @@ static const struct iio_chan_spec ads1015_channels[] = {
IIO_CHAN_SOFT_TIMESTAMP(ADS1015_TIMESTAMP),
 };
 
+static const struct iio_chan_spec ads1115_channels[] = {
+   ADS1115_V_DIFF_CHAN(0, 1, ADS1015_AIN0_AIN1),
+   ADS1115_V_DIFF_CHAN(0, 3, ADS1015_AIN0_AIN3),
+   ADS1115_V_DIFF_CHAN(1, 3, ADS1015_AIN1_AIN3),
+   ADS1115_V_DIFF_CHAN(2, 3, ADS1015_AIN2_AIN3),
+   ADS1115_V_CHAN(0, ADS1015_AIN0),
+   ADS1115_V_CHAN(1, ADS1015_AIN1),
+   ADS1115_V_CHAN(2, ADS1015_AIN2),
+   ADS1115_V_CHAN(3, ADS1015_AIN3),
+   IIO_CHAN_SOFT_TIMESTAMP(ADS1015_TIMESTAMP),
+};
+
 static int ads1015_set_power_state(struct ads1015_data *data, bool on)
 {
int ret;
@@ -196,7 +255,7 @@ int ads1015_get_adc_result(struct ads1015_data *data, int 
chan, int *val)
return ret;
 
if (change) {
-   conv_time = DIV_ROUND_UP(USEC_PER_SEC, ads1015_data_rate[dr]);
+   conv_time = DIV_ROUND_UP(USEC_PER_SEC, data->data_rate[dr]);
usleep_range(conv_time, conv_time + 1);
}
 
@@ -263,7 +322,7 @@ static int ads1015_set_data_rate(struct ads1015_data *data, 

[linux-yocto] [PATCH 1/5] iio: adc: Add TI ADS1015 ADC driver support

2016-12-12 Thread tuomas . katila
From: Daniel Baluta 

Backported from linux-yocto-4.8: ecc24e72f43735cceab06f4e69aa6ce075a3ae46

The driver has sysfs readings with runtime PM support for power saving.
It also offers buffer support that can be used together with IIO software
triggers.

Datasheet can be found here:
http://www.ti.com.cn/cn/lit/ds/symlink/ads1015.pdf

Signed-off-by: Daniel Baluta 
Signed-off-by: Jonathan Cameron 
Signed-off-by: Tuomas Katila 
---
 drivers/iio/adc/Kconfig  |  13 +
 drivers/iio/adc/Makefile |   1 +
 drivers/iio/adc/ti-ads1015.c | 612 +++
 3 files changed, 626 insertions(+)
 create mode 100644 drivers/iio/adc/ti-ads1015.c

diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
index bda6bbe4479c..b5b97f40bc00 100644
--- a/drivers/iio/adc/Kconfig
+++ b/drivers/iio/adc/Kconfig
@@ -334,6 +334,19 @@ config TI_ADC128S052
  This driver can also be built as a module. If so, the module will be
  called ti-adc128s052.
 
+config TI_ADS1015
+   tristate "Texas Instruments ADS1015 ADC"
+   depends on I2C && !SENSORS_ADS1015
+   select REGMAP_I2C
+   select IIO_BUFFER
+   select IIO_TRIGGERED_BUFFER
+   help
+ If you say yes here you get support for Texas Instruments ADS1015
+ ADC chip.
+
+ This driver can also be built as a module. If so, the module will be
+ called ti-ads1015.
+
 config TI_AM335X_ADC
tristate "TI's AM335X ADC driver"
depends on MFD_TI_AM335X_TSCADC
diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile
index 99b37a963a1e..5751c42c8c58 100644
--- a/drivers/iio/adc/Makefile
+++ b/drivers/iio/adc/Makefile
@@ -32,6 +32,7 @@ obj-$(CONFIG_QCOM_SPMI_VADC) += qcom-spmi-vadc.o
 obj-$(CONFIG_ROCKCHIP_SARADC) += rockchip_saradc.o
 obj-$(CONFIG_TI_ADC081C) += ti-adc081c.o
 obj-$(CONFIG_TI_ADC128S052) += ti-adc128s052.o
+obj-$(CONFIG_TI_ADS1015) += ti-ads1015.o
 obj-$(CONFIG_TI_AM335X_ADC) += ti_am335x_adc.o
 obj-$(CONFIG_TWL4030_MADC) += twl4030-madc.o
 obj-$(CONFIG_TWL6030_GPADC) += twl6030-gpadc.o
diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
new file mode 100644
index ..73cbf0b54e54
--- /dev/null
+++ b/drivers/iio/adc/ti-ads1015.c
@@ -0,0 +1,612 @@
+/*
+ * ADS1015 - Texas Instruments Analog-to-Digital Converter
+ *
+ * Copyright (c) 2016, Intel Corporation.
+ *
+ * This file is subject to the terms and conditions of version 2 of
+ * the GNU General Public License.  See the file COPYING in the main
+ * directory of this archive for more details.
+ *
+ * IIO driver for ADS1015 ADC 7-bit I2C slave address:
+ * * 0x48 - ADDR connected to Ground
+ * * 0x49 - ADDR connected to Vdd
+ * * 0x4A - ADDR connected to SDA
+ * * 0x4B - ADDR connected to SCL
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define ADS1015_DRV_NAME "ads1015"
+
+#define ADS1015_CONV_REG   0x00
+#define ADS1015_CFG_REG0x01
+
+#define ADS1015_CFG_DR_SHIFT   5
+#define ADS1015_CFG_MOD_SHIFT  8
+#define ADS1015_CFG_PGA_SHIFT  9
+#define ADS1015_CFG_MUX_SHIFT  12
+
+#define ADS1015_CFG_DR_MASKGENMASK(7, 5)
+#define ADS1015_CFG_MOD_MASK   BIT(8)
+#define ADS1015_CFG_PGA_MASK   GENMASK(11, 9)
+#define ADS1015_CFG_MUX_MASK   GENMASK(14, 12)
+
+/* device operating modes */
+#define ADS1015_CONTINUOUS 0
+#define ADS1015_SINGLESHOT 1
+
+#define ADS1015_SLEEP_DELAY_MS 2000
+#define ADS1015_DEFAULT_PGA2
+#define ADS1015_DEFAULT_DATA_RATE  4
+#define ADS1015_DEFAULT_CHAN   0
+
+enum ads1015_channels {
+   ADS1015_AIN0_AIN1 = 0,
+   ADS1015_AIN0_AIN3,
+   ADS1015_AIN1_AIN3,
+   ADS1015_AIN2_AIN3,
+   ADS1015_AIN0,
+   ADS1015_AIN1,
+   ADS1015_AIN2,
+   ADS1015_AIN3,
+   ADS1015_TIMESTAMP,
+};
+
+static const unsigned int ads1015_data_rate[] = {
+   128, 250, 490, 920, 1600, 2400, 3300, 3300
+};
+
+static const struct {
+   int scale;
+   int uscale;
+} ads1015_scale[] = {
+   {3, 0},
+   {2, 0},
+   {1, 0},
+   {0, 50},
+   {0, 25},
+   {0, 125000},
+   {0, 125000},
+   {0, 125000},
+};
+
+#define ADS1015_V_CHAN(_chan, _addr) { \
+   .type = IIO_VOLTAGE,\
+   .indexed = 1,   \
+   .address = _addr,   \
+   .channel = _chan,   \
+   .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |  \
+   BIT(IIO_CHAN_INFO_SCALE) |  \
+   BIT(IIO_CHAN_INFO_SAMP_FREQ),   \
+   .scan_index = _addr,\
+   .scan_type 

[linux-yocto] [PATCH 0/5] Backport from 4.8: iio: ti-ads1015 support

2016-12-12 Thread tuomas . katila
From: Tuomas Katila 

Patches are intended for the bxt-rebase branch

Backported ti-ads1015 support from linux-yocto 4.8 kernel. The
chip is supported in some Joule extender boards, such as Gravity
Expansion Shield for Intel Joule SKU: DFR0465.

Also added ACPI support for the driver.

Daniel Baluta (1):
  iio: adc: Add TI ADS1015 ADC driver support

Matt Ranostay (3):
  iio: adc: ti-ads1015: add support for ADS1115 part
  iio: adc: ti-ads1015: add datasheet names
  iio: adc: ti-ads1015: add indio_dev->dev.of_node reference

Tuomas Katila (1):
  iio: adc: ti-ads1015: add support for acpi

 drivers/iio/adc/Kconfig  |  13 +
 drivers/iio/adc/Makefile |   1 +
 drivers/iio/adc/ti-ads1015.c | 743 +++
 3 files changed, 757 insertions(+)
 create mode 100644 drivers/iio/adc/ti-ads1015.c

-- 
2.11.0

-
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto