All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Add touch key driver support for TM2
       [not found] <CGME20170103075733epcas5p48985c789a816f1f2eae84c52e070cc14@epcas5p4.samsung.com>
  2017-01-03  7:57   ` Jaechul Lee
@ 2017-01-03  7:57   ` Jaechul Lee
  0 siblings, 0 replies; 61+ messages in thread
From: Jaechul Lee @ 2017-01-03  7:57 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Mark Rutland, Catalin Marinas,
	Will Deacon, Kukjin Kim, Krzysztof Kozlowski,
	Javier Martinez Canillas
  Cc: Jaechul Lee, Andi Shyti, Chanwoo Choi, beomho.seo, galaxyra,
	linux-arm-kernel, linux-input, devicetree, linux-kernel,
	linux-samsung-soc

Hi,

This patchset adds support for the tm2 touchkey device.

The driver has been ported from Tizen Kernel, originally written
by Beomho. I ported it to the latest mainline Kernel.

dts has been separated between tm2 and tm2e because touchkey is present in tm2
but not tm2e.

Best Regards,
Jaechul

Andi Shyti (1):
  arm64: dts: exynos: make tm2 and tm2e independent from each other

Jaechul Lee (3):
  input: Add support for the tm2 touchkey device driver
  input: tm2-touchkey: Add touchkey driver support for TM2
  arm64: dts: exynos: Add tm2 touchkey node

 .../bindings/input/samsung,tm2-touchkey.txt        |   27 +
 .../boot/dts/exynos/exynos5433-tm2-common.dtsi     | 1046 ++++++++++++++++++++
 arch/arm64/boot/dts/exynos/exynos5433-tm2.dts      | 1037 +------------------
 arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts     |    2 +-
 drivers/input/keyboard/Kconfig                     |   11 +
 drivers/input/keyboard/Makefile                    |    1 +
 drivers/input/keyboard/tm2-touchkey.c              |  326 ++++++
 7 files changed, 1422 insertions(+), 1028 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/input/samsung,tm2-touchkey.txt
 create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
 create mode 100644 drivers/input/keyboard/tm2-touchkey.c

-- 
2.7.4

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH 0/4] Add touch key driver support for TM2
@ 2017-01-03  7:57   ` Jaechul Lee
  0 siblings, 0 replies; 61+ messages in thread
From: Jaechul Lee @ 2017-01-03  7:57 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Mark Rutland, Catalin Marinas,
	Will Deacon, Kukjin Kim, Krzysztof Kozlowski,
	Javier Martinez Canillas
  Cc: Jaechul Lee, Andi Shyti, Chanwoo Choi,
	beomho.seo-Sze3O3UU22JBDgjK7y7TUQ,
	galaxyra-Re5JQEeQqe8AvxtiuMwx3w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA

Hi,

This patchset adds support for the tm2 touchkey device.

The driver has been ported from Tizen Kernel, originally written
by Beomho. I ported it to the latest mainline Kernel.

dts has been separated between tm2 and tm2e because touchkey is present in tm2
but not tm2e.

Best Regards,
Jaechul

Andi Shyti (1):
  arm64: dts: exynos: make tm2 and tm2e independent from each other

Jaechul Lee (3):
  input: Add support for the tm2 touchkey device driver
  input: tm2-touchkey: Add touchkey driver support for TM2
  arm64: dts: exynos: Add tm2 touchkey node

 .../bindings/input/samsung,tm2-touchkey.txt        |   27 +
 .../boot/dts/exynos/exynos5433-tm2-common.dtsi     | 1046 ++++++++++++++++++++
 arch/arm64/boot/dts/exynos/exynos5433-tm2.dts      | 1037 +------------------
 arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts     |    2 +-
 drivers/input/keyboard/Kconfig                     |   11 +
 drivers/input/keyboard/Makefile                    |    1 +
 drivers/input/keyboard/tm2-touchkey.c              |  326 ++++++
 7 files changed, 1422 insertions(+), 1028 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/input/samsung,tm2-touchkey.txt
 create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
 create mode 100644 drivers/input/keyboard/tm2-touchkey.c

-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH 0/4] Add touch key driver support for TM2
@ 2017-01-03  7:57   ` Jaechul Lee
  0 siblings, 0 replies; 61+ messages in thread
From: Jaechul Lee @ 2017-01-03  7:57 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

This patchset adds support for the tm2 touchkey device.

The driver has been ported from Tizen Kernel, originally written
by Beomho. I ported it to the latest mainline Kernel.

dts has been separated between tm2 and tm2e because touchkey is present in tm2
but not tm2e.

Best Regards,
Jaechul

Andi Shyti (1):
  arm64: dts: exynos: make tm2 and tm2e independent from each other

Jaechul Lee (3):
  input: Add support for the tm2 touchkey device driver
  input: tm2-touchkey: Add touchkey driver support for TM2
  arm64: dts: exynos: Add tm2 touchkey node

 .../bindings/input/samsung,tm2-touchkey.txt        |   27 +
 .../boot/dts/exynos/exynos5433-tm2-common.dtsi     | 1046 ++++++++++++++++++++
 arch/arm64/boot/dts/exynos/exynos5433-tm2.dts      | 1037 +------------------
 arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts     |    2 +-
 drivers/input/keyboard/Kconfig                     |   11 +
 drivers/input/keyboard/Makefile                    |    1 +
 drivers/input/keyboard/tm2-touchkey.c              |  326 ++++++
 7 files changed, 1422 insertions(+), 1028 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/input/samsung,tm2-touchkey.txt
 create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
 create mode 100644 drivers/input/keyboard/tm2-touchkey.c

-- 
2.7.4

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH 1/4] input: Add support for the tm2 touchkey device driver
       [not found]   ` <CGME20170103075733epcas5p47dff8d21854938b2439c9843d91bc301@epcas5p4.samsung.com>
@ 2017-01-03  7:57       ` Jaechul Lee
  0 siblings, 0 replies; 61+ messages in thread
From: Jaechul Lee @ 2017-01-03  7:57 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Mark Rutland, Catalin Marinas,
	Will Deacon, Kukjin Kim, Krzysztof Kozlowski,
	Javier Martinez Canillas
  Cc: Jaechul Lee, Andi Shyti, Chanwoo Choi, beomho.seo, galaxyra,
	linux-arm-kernel, linux-input, devicetree, linux-kernel,
	linux-samsung-soc

This patch adds the binding description of the tm2 touchkey
device driver.

Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
---
 .../bindings/input/samsung,tm2-touchkey.txt        | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/samsung,tm2-touchkey.txt

diff --git a/Documentation/devicetree/bindings/input/samsung,tm2-touchkey.txt b/Documentation/devicetree/bindings/input/samsung,tm2-touchkey.txt
new file mode 100644
index 0000000..4de1af0
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/samsung,tm2-touchkey.txt
@@ -0,0 +1,27 @@
+Samsung tm2-touchkey
+
+Required properties:
+- compatible: must be "samsung,tm2-touchkey"
+- reg: I2C address of the chip.
+- interrupt-parent: a phandle for the interrupt controller (see interrupt
+	binding[0]).
+- interrupts: interrupt to which the chip is connected (see interrupt
+	binding[0]).
+- vcc-supply : internal regulator output. 1.8V
+- vdd-supply : power supply for IC 3.3V
+
+[0]: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
+
+Example:
+	&i2c0 {
+		/* ... */
+
+		touchkey@20 {
+			compatible = "samsung,tm2-touchkey";
+			reg = <0x20>;
+			interrupt-parent = <&gpa3>;
+			interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
+			vcc-supply=<&ldo32_reg>;
+			vdd-supply=<&ldo33_reg>;
+		};
+	};
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 1/4] input: Add support for the tm2 touchkey device driver
@ 2017-01-03  7:57       ` Jaechul Lee
  0 siblings, 0 replies; 61+ messages in thread
From: Jaechul Lee @ 2017-01-03  7:57 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds the binding description of the tm2 touchkey
device driver.

Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
---
 .../bindings/input/samsung,tm2-touchkey.txt        | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/samsung,tm2-touchkey.txt

diff --git a/Documentation/devicetree/bindings/input/samsung,tm2-touchkey.txt b/Documentation/devicetree/bindings/input/samsung,tm2-touchkey.txt
new file mode 100644
index 0000000..4de1af0
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/samsung,tm2-touchkey.txt
@@ -0,0 +1,27 @@
+Samsung tm2-touchkey
+
+Required properties:
+- compatible: must be "samsung,tm2-touchkey"
+- reg: I2C address of the chip.
+- interrupt-parent: a phandle for the interrupt controller (see interrupt
+	binding[0]).
+- interrupts: interrupt to which the chip is connected (see interrupt
+	binding[0]).
+- vcc-supply : internal regulator output. 1.8V
+- vdd-supply : power supply for IC 3.3V
+
+[0]: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
+
+Example:
+	&i2c0 {
+		/* ... */
+
+		touchkey at 20 {
+			compatible = "samsung,tm2-touchkey";
+			reg = <0x20>;
+			interrupt-parent = <&gpa3>;
+			interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
+			vcc-supply=<&ldo32_reg>;
+			vdd-supply=<&ldo33_reg>;
+		};
+	};
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 2/4] input: tm2-touchkey: Add touchkey driver support for TM2
       [not found]   ` <CGME20170103075733epcas5p4a065198d4abf35081024af95055c67d2@epcas5p4.samsung.com>
@ 2017-01-03  7:57       ` Jaechul Lee
  0 siblings, 0 replies; 61+ messages in thread
From: Jaechul Lee @ 2017-01-03  7:57 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Mark Rutland, Catalin Marinas,
	Will Deacon, Kukjin Kim, Krzysztof Kozlowski,
	Javier Martinez Canillas
  Cc: Jaechul Lee, Andi Shyti, Chanwoo Choi, beomho.seo, galaxyra,
	linux-arm-kernel, linux-input, devicetree, linux-kernel,
	linux-samsung-soc

This patch adds support for the TM2 touch key and led
functionlity.

The driver interfaces with userspace through an input device and
reports KEY_PHONE and KEY_BACK event types. LED brightness can be
controlled by "/sys/class/leds/tm2-touchkey/brightness".

Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
---
 drivers/input/keyboard/Kconfig        |  11 ++
 drivers/input/keyboard/Makefile       |   1 +
 drivers/input/keyboard/tm2-touchkey.c | 326 ++++++++++++++++++++++++++++++++++
 3 files changed, 338 insertions(+)
 create mode 100644 drivers/input/keyboard/tm2-touchkey.c

diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index cbd75cf..72c0ba1 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -666,6 +666,17 @@ config KEYBOARD_TC3589X
 	  To compile this driver as a module, choose M here: the
 	  module will be called tc3589x-keypad.
 
+config KEYBOARD_TM2_TOUCHKEY
+	tristate "tm2-touchkey support"
+	depends on I2C
+	help
+	  Say Y here to enable the tm2-touchkey.
+	  touchkey driver for tm2. This driver can enable
+	  the interrupt and make input events and control led brightness.
+
+	  To compile this driver as a module, choose M here.
+	  module will be called tm2-touchkey
+
 config KEYBOARD_TWL4030
 	tristate "TI TWL4030/TWL5030/TPS659x0 keypad support"
 	depends on TWL4030_CORE
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
index d9f4cfc..7d9acff 100644
--- a/drivers/input/keyboard/Makefile
+++ b/drivers/input/keyboard/Makefile
@@ -61,6 +61,7 @@ obj-$(CONFIG_KEYBOARD_SUN4I_LRADC)	+= sun4i-lradc-keys.o
 obj-$(CONFIG_KEYBOARD_SUNKBD)		+= sunkbd.o
 obj-$(CONFIG_KEYBOARD_TC3589X)		+= tc3589x-keypad.o
 obj-$(CONFIG_KEYBOARD_TEGRA)		+= tegra-kbc.o
+obj-$(CONFIG_KEYBOARD_TM2_TOUCHKEY)	+= tm2-touchkey.o
 obj-$(CONFIG_KEYBOARD_TWL4030)		+= twl4030_keypad.o
 obj-$(CONFIG_KEYBOARD_XTKBD)		+= xtkbd.o
 obj-$(CONFIG_KEYBOARD_W90P910)		+= w90p910_keypad.o
diff --git a/drivers/input/keyboard/tm2-touchkey.c b/drivers/input/keyboard/tm2-touchkey.c
new file mode 100644
index 0000000..d9575d8
--- /dev/null
+++ b/drivers/input/keyboard/tm2-touchkey.c
@@ -0,0 +1,326 @@
+/*
+ * Driver for keys on GPIO lines capable of generating interrupts.
+ *
+ * Copyright 2005 Phil Blundell
+ * Copyright 2016 Samsung Electronics Co., Ltd.
+ *
+ * Author: Beomho Seo <beomho.seo@samsung.com>
+ * Author: Jaechul Lee <jcsing.lee@samsung.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.
+ */
+
+#include <linux/bitops.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/i2c.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/leds.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/pm.h>
+#include <linux/regulator/consumer.h>
+#include <linux/workqueue.h>
+
+#define TM2_TOUCHKEY_DEV_NAME			"tm2-touchkey"
+#define TM2_TOUCHKEY_KEYCODE_REG			0x03
+#define TM2_TOUCHKEY_BASE_REG			0x00
+#define TM2_TOUCHKEY_CMD_LED_ON			0x10
+#define TM2_TOUCHKEY_CMD_LED_OFF			0x20
+#define TM2_TOUCHKEY_BIT_PRESS_EV			BIT(3)
+#define TM2_TOUCHKEY_BIT_KEYCODE			GENMASK(2, 0)
+#define TM2_TOUCHKEY_LED_VOLTAGE_MIN			2500000
+#define TM2_TOUCHKEY_LED_VOLTAGE_MAX			3300000
+
+enum {
+	TM2_TOUCHKEY_KEY_MENU = 0x1,
+	TM2_TOUCHKEY_KEY_BACK,
+};
+
+#define tm2_touchkey_power_enable(x) __tm2_touchkey_power_onoff(x, 1)
+#define tm2_touchkey_power_disable(x) __tm2_touchkey_power_onoff(x, 0)
+
+struct tm2_touchkey_data {
+	struct i2c_client *client;
+	struct input_dev *input_dev;
+	struct led_classdev led_dev;
+
+	u8 keycode_type;
+	u8 pressed;
+	struct work_struct irq_work;
+
+	bool power_onoff;
+	struct regulator *regulator_vcc;	/* 1.8V */
+	struct regulator *regulator_vdd;	/* 3.3V */
+};
+
+static void tm2_touchkey_led_brightness_set(struct led_classdev *led_dev,
+						enum led_brightness brightness)
+{
+	struct tm2_touchkey_data *samsung_touchkey =
+	    container_of(led_dev, struct tm2_touchkey_data, led_dev);
+	u32 volt;
+	u8 data;
+
+	if (brightness == LED_OFF) {
+		volt = TM2_TOUCHKEY_LED_VOLTAGE_MIN;
+		data = TM2_TOUCHKEY_CMD_LED_OFF;
+	} else {
+		volt = TM2_TOUCHKEY_LED_VOLTAGE_MAX;
+		data = TM2_TOUCHKEY_CMD_LED_ON;
+	}
+
+	regulator_set_voltage(samsung_touchkey->regulator_vdd, volt, volt);
+	i2c_smbus_write_byte_data(samsung_touchkey->client,
+				  TM2_TOUCHKEY_BASE_REG, data);
+}
+
+static int __tm2_touchkey_power_onoff(struct tm2_touchkey_data
+					  *samsung_touchkey, bool onoff)
+{
+	int ret = 0;
+
+	if (samsung_touchkey->power_onoff == onoff)
+		return ret;
+
+	if (onoff) {
+		ret = regulator_enable(samsung_touchkey->regulator_vcc);
+		if (ret)
+			return ret;
+
+		ret = regulator_enable(samsung_touchkey->regulator_vdd);
+		if (ret) {
+			regulator_disable(samsung_touchkey->regulator_vcc);
+			return ret;
+		}
+		msleep(150);
+	} else {
+		int err;
+
+		err = regulator_disable(samsung_touchkey->regulator_vcc);
+		if (err)
+			ret = err;
+
+		err = regulator_disable(samsung_touchkey->regulator_vdd);
+		if (err && !ret)
+			ret = err;
+	}
+	samsung_touchkey->power_onoff = onoff;
+
+	return ret;
+}
+
+static void tm2_touchkey_irq_work(struct work_struct *irq_work)
+{
+	struct tm2_touchkey_data *samsung_touchkey =
+	    container_of(irq_work, struct tm2_touchkey_data, irq_work);
+
+	if (!samsung_touchkey->pressed) {
+		input_report_key(samsung_touchkey->input_dev, KEY_PHONE, 0);
+		input_report_key(samsung_touchkey->input_dev, KEY_BACK, 0);
+	} else {
+		if (samsung_touchkey->keycode_type == TM2_TOUCHKEY_KEY_MENU)
+			input_report_key(samsung_touchkey->input_dev,
+					 KEY_PHONE, 1);
+		else
+			input_report_key(samsung_touchkey->input_dev,
+					 KEY_BACK, 1);
+	}
+	input_sync(samsung_touchkey->input_dev);
+}
+
+static irqreturn_t tm2_touchkey_irq_handler(int irq, void *devid)
+{
+	struct tm2_touchkey_data *samsung_touchkey = devid;
+	u32 data;
+
+	data = i2c_smbus_read_byte_data(samsung_touchkey->client,
+					TM2_TOUCHKEY_KEYCODE_REG);
+
+	if (data < 0) {
+		dev_err(&samsung_touchkey->client->dev, "Failed to read i2c data\n");
+		return IRQ_HANDLED;
+	}
+
+	samsung_touchkey->keycode_type = data & TM2_TOUCHKEY_BIT_KEYCODE;
+	samsung_touchkey->pressed = !(data & TM2_TOUCHKEY_BIT_PRESS_EV);
+
+	if (samsung_touchkey->keycode_type != TM2_TOUCHKEY_KEY_MENU &&
+	    samsung_touchkey->keycode_type != TM2_TOUCHKEY_KEY_BACK)
+		return IRQ_HANDLED;
+
+	schedule_work(&samsung_touchkey->irq_work);
+
+	return IRQ_HANDLED;
+}
+
+static int tm2_touchkey_probe(struct i2c_client *client,
+				  const struct i2c_device_id *id)
+{
+	struct tm2_touchkey_data *samsung_touchkey;
+	int ret;
+
+	ret = i2c_check_functionality(client->adapter,
+				      I2C_FUNC_SMBUS_BYTE |
+				      I2C_FUNC_SMBUS_BYTE_DATA);
+	if (!ret) {
+		dev_err(&client->dev, "No I2C functionality found\n");
+		return -ENODEV;
+	}
+
+	samsung_touchkey = devm_kzalloc(&client->dev,
+			sizeof(struct tm2_touchkey_data), GFP_KERNEL);
+
+	if (!samsung_touchkey) {
+		dev_err(&client->dev, "Failed to allocate memory.\n");
+		return -ENOMEM;
+	}
+
+	samsung_touchkey->client = client;
+	i2c_set_clientdata(client, samsung_touchkey);
+	INIT_WORK(&samsung_touchkey->irq_work, tm2_touchkey_irq_work);
+
+	/* regulator */
+	samsung_touchkey->regulator_vcc =
+				devm_regulator_get(&client->dev, "vcc");
+	if (IS_ERR(samsung_touchkey->regulator_vcc)) {
+		dev_err(&client->dev, "Failed to get vcc regulator\n");
+		return PTR_ERR(samsung_touchkey->regulator_vcc);
+	}
+
+	samsung_touchkey->regulator_vdd =
+				devm_regulator_get(&client->dev, "vdd");
+	if (IS_ERR(samsung_touchkey->regulator_vdd)) {
+		dev_err(&client->dev, "Failed to get vdd regulator\n");
+		return PTR_ERR(samsung_touchkey->regulator_vcc);
+	}
+
+	/* power */
+	ret = tm2_touchkey_power_enable(samsung_touchkey);
+	if (ret) {
+		dev_err(&client->dev, "Failed to enable power\n");
+		return ret;
+	}
+
+	/* irq */
+	ret = devm_request_threaded_irq(&client->dev,
+					client->irq, NULL,
+					tm2_touchkey_irq_handler,
+					IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+					TM2_TOUCHKEY_DEV_NAME,
+					samsung_touchkey);
+	if (ret) {
+		dev_err(&client->dev, "Failed to request threaded irq\n");
+		return ret;
+	}
+
+	/* input device */
+	samsung_touchkey->input_dev = devm_input_allocate_device(&client->dev);
+	if (!samsung_touchkey->input_dev) {
+		dev_err(&client->dev, "Failed to alloc input device.\n");
+		return -ENOMEM;
+	}
+	samsung_touchkey->input_dev->name = TM2_TOUCHKEY_DEV_NAME;
+	samsung_touchkey->input_dev->id.bustype = BUS_I2C;
+	samsung_touchkey->input_dev->dev.parent = &client->dev;
+
+	set_bit(EV_KEY, samsung_touchkey->input_dev->evbit);
+	set_bit(KEY_PHONE, samsung_touchkey->input_dev->keybit);
+	set_bit(KEY_BACK, samsung_touchkey->input_dev->keybit);
+	input_set_drvdata(samsung_touchkey->input_dev, samsung_touchkey);
+
+	ret = input_register_device(samsung_touchkey->input_dev);
+	if (ret) {
+		dev_err(&client->dev, "Failed to register input device.\n");
+		return ret;
+	}
+
+	/* led device */
+	samsung_touchkey->led_dev.name = TM2_TOUCHKEY_DEV_NAME;
+	samsung_touchkey->led_dev.brightness = LED_FULL;
+	samsung_touchkey->led_dev.max_brightness = LED_FULL;
+	samsung_touchkey->led_dev.brightness_set =
+						tm2_touchkey_led_brightness_set;
+
+	ret = devm_led_classdev_register(&client->dev,
+					 &samsung_touchkey->led_dev);
+	if (ret < 0) {
+		dev_err(&client->dev, "Failed to register touchkey led\n");
+		return ret;
+	}
+
+	return 0;
+}
+
+static void tm2_touchkey_shutdown(struct i2c_client *client)
+{
+	struct tm2_touchkey_data *samsung_touchkey =
+						i2c_get_clientdata(client);
+	int ret;
+
+	disable_irq(client->irq);
+	ret = tm2_touchkey_power_disable(samsung_touchkey);
+	if (ret)
+		dev_err(&client->dev, "Failed to disable power\n");
+}
+
+static int tm2_touchkey_suspend(struct device *dev)
+{
+	struct tm2_touchkey_data *samsung_touchkey = dev_get_drvdata(dev);
+	int ret;
+
+	disable_irq(samsung_touchkey->client->irq);
+	ret = tm2_touchkey_power_disable(samsung_touchkey);
+	if (ret)
+		dev_err(dev, "Failed to disable power\n");
+
+	return ret;
+}
+
+static int tm2_touchkey_resume(struct device *dev)
+{
+	struct tm2_touchkey_data *samsung_touchkey = dev_get_drvdata(dev);
+	int ret;
+
+	enable_irq(samsung_touchkey->client->irq);
+	ret = tm2_touchkey_power_enable(samsung_touchkey);
+	if (ret)
+		dev_err(dev, "Failed to enable power\n");
+
+	return ret;
+}
+
+static SIMPLE_DEV_PM_OPS(tm2_touchkey_pm_ops, tm2_touchkey_suspend,
+							tm2_touchkey_resume);
+
+static const struct i2c_device_id tm2_touchkey_id_table[] = {
+	{TM2_TOUCHKEY_DEV_NAME, 0},
+	{},
+};
+
+static const struct of_device_id tm2_touchkey_of_match[] = {
+	{.compatible = "samsung,tm2-touchkey",},
+	{},
+};
+
+static struct i2c_driver tm2_touchkey_driver = {
+	.driver = {
+		.name = TM2_TOUCHKEY_DEV_NAME,
+		.pm = &tm2_touchkey_pm_ops,
+		.of_match_table = of_match_ptr(tm2_touchkey_of_match),
+	},
+	.probe = tm2_touchkey_probe,
+	.shutdown = tm2_touchkey_shutdown,
+	.id_table = tm2_touchkey_id_table,
+};
+
+module_i2c_driver(tm2_touchkey_driver);
+
+MODULE_AUTHOR("Beomho Seo <beomho.seo@samsung.com>");
+MODULE_AUTHOR("Jaechul Lee <jcsing.lee@samsung.com>");
+MODULE_DESCRIPTION("Samsung touchkey driver");
+MODULE_LICENSE("GPL v2");
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 2/4] input: tm2-touchkey: Add touchkey driver support for TM2
@ 2017-01-03  7:57       ` Jaechul Lee
  0 siblings, 0 replies; 61+ messages in thread
From: Jaechul Lee @ 2017-01-03  7:57 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds support for the TM2 touch key and led
functionlity.

The driver interfaces with userspace through an input device and
reports KEY_PHONE and KEY_BACK event types. LED brightness can be
controlled by "/sys/class/leds/tm2-touchkey/brightness".

Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
---
 drivers/input/keyboard/Kconfig        |  11 ++
 drivers/input/keyboard/Makefile       |   1 +
 drivers/input/keyboard/tm2-touchkey.c | 326 ++++++++++++++++++++++++++++++++++
 3 files changed, 338 insertions(+)
 create mode 100644 drivers/input/keyboard/tm2-touchkey.c

diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index cbd75cf..72c0ba1 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -666,6 +666,17 @@ config KEYBOARD_TC3589X
 	  To compile this driver as a module, choose M here: the
 	  module will be called tc3589x-keypad.
 
+config KEYBOARD_TM2_TOUCHKEY
+	tristate "tm2-touchkey support"
+	depends on I2C
+	help
+	  Say Y here to enable the tm2-touchkey.
+	  touchkey driver for tm2. This driver can enable
+	  the interrupt and make input events and control led brightness.
+
+	  To compile this driver as a module, choose M here.
+	  module will be called tm2-touchkey
+
 config KEYBOARD_TWL4030
 	tristate "TI TWL4030/TWL5030/TPS659x0 keypad support"
 	depends on TWL4030_CORE
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
index d9f4cfc..7d9acff 100644
--- a/drivers/input/keyboard/Makefile
+++ b/drivers/input/keyboard/Makefile
@@ -61,6 +61,7 @@ obj-$(CONFIG_KEYBOARD_SUN4I_LRADC)	+= sun4i-lradc-keys.o
 obj-$(CONFIG_KEYBOARD_SUNKBD)		+= sunkbd.o
 obj-$(CONFIG_KEYBOARD_TC3589X)		+= tc3589x-keypad.o
 obj-$(CONFIG_KEYBOARD_TEGRA)		+= tegra-kbc.o
+obj-$(CONFIG_KEYBOARD_TM2_TOUCHKEY)	+= tm2-touchkey.o
 obj-$(CONFIG_KEYBOARD_TWL4030)		+= twl4030_keypad.o
 obj-$(CONFIG_KEYBOARD_XTKBD)		+= xtkbd.o
 obj-$(CONFIG_KEYBOARD_W90P910)		+= w90p910_keypad.o
diff --git a/drivers/input/keyboard/tm2-touchkey.c b/drivers/input/keyboard/tm2-touchkey.c
new file mode 100644
index 0000000..d9575d8
--- /dev/null
+++ b/drivers/input/keyboard/tm2-touchkey.c
@@ -0,0 +1,326 @@
+/*
+ * Driver for keys on GPIO lines capable of generating interrupts.
+ *
+ * Copyright 2005 Phil Blundell
+ * Copyright 2016 Samsung Electronics Co., Ltd.
+ *
+ * Author: Beomho Seo <beomho.seo@samsung.com>
+ * Author: Jaechul Lee <jcsing.lee@samsung.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.
+ */
+
+#include <linux/bitops.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/i2c.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/leds.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/pm.h>
+#include <linux/regulator/consumer.h>
+#include <linux/workqueue.h>
+
+#define TM2_TOUCHKEY_DEV_NAME			"tm2-touchkey"
+#define TM2_TOUCHKEY_KEYCODE_REG			0x03
+#define TM2_TOUCHKEY_BASE_REG			0x00
+#define TM2_TOUCHKEY_CMD_LED_ON			0x10
+#define TM2_TOUCHKEY_CMD_LED_OFF			0x20
+#define TM2_TOUCHKEY_BIT_PRESS_EV			BIT(3)
+#define TM2_TOUCHKEY_BIT_KEYCODE			GENMASK(2, 0)
+#define TM2_TOUCHKEY_LED_VOLTAGE_MIN			2500000
+#define TM2_TOUCHKEY_LED_VOLTAGE_MAX			3300000
+
+enum {
+	TM2_TOUCHKEY_KEY_MENU = 0x1,
+	TM2_TOUCHKEY_KEY_BACK,
+};
+
+#define tm2_touchkey_power_enable(x) __tm2_touchkey_power_onoff(x, 1)
+#define tm2_touchkey_power_disable(x) __tm2_touchkey_power_onoff(x, 0)
+
+struct tm2_touchkey_data {
+	struct i2c_client *client;
+	struct input_dev *input_dev;
+	struct led_classdev led_dev;
+
+	u8 keycode_type;
+	u8 pressed;
+	struct work_struct irq_work;
+
+	bool power_onoff;
+	struct regulator *regulator_vcc;	/* 1.8V */
+	struct regulator *regulator_vdd;	/* 3.3V */
+};
+
+static void tm2_touchkey_led_brightness_set(struct led_classdev *led_dev,
+						enum led_brightness brightness)
+{
+	struct tm2_touchkey_data *samsung_touchkey =
+	    container_of(led_dev, struct tm2_touchkey_data, led_dev);
+	u32 volt;
+	u8 data;
+
+	if (brightness == LED_OFF) {
+		volt = TM2_TOUCHKEY_LED_VOLTAGE_MIN;
+		data = TM2_TOUCHKEY_CMD_LED_OFF;
+	} else {
+		volt = TM2_TOUCHKEY_LED_VOLTAGE_MAX;
+		data = TM2_TOUCHKEY_CMD_LED_ON;
+	}
+
+	regulator_set_voltage(samsung_touchkey->regulator_vdd, volt, volt);
+	i2c_smbus_write_byte_data(samsung_touchkey->client,
+				  TM2_TOUCHKEY_BASE_REG, data);
+}
+
+static int __tm2_touchkey_power_onoff(struct tm2_touchkey_data
+					  *samsung_touchkey, bool onoff)
+{
+	int ret = 0;
+
+	if (samsung_touchkey->power_onoff == onoff)
+		return ret;
+
+	if (onoff) {
+		ret = regulator_enable(samsung_touchkey->regulator_vcc);
+		if (ret)
+			return ret;
+
+		ret = regulator_enable(samsung_touchkey->regulator_vdd);
+		if (ret) {
+			regulator_disable(samsung_touchkey->regulator_vcc);
+			return ret;
+		}
+		msleep(150);
+	} else {
+		int err;
+
+		err = regulator_disable(samsung_touchkey->regulator_vcc);
+		if (err)
+			ret = err;
+
+		err = regulator_disable(samsung_touchkey->regulator_vdd);
+		if (err && !ret)
+			ret = err;
+	}
+	samsung_touchkey->power_onoff = onoff;
+
+	return ret;
+}
+
+static void tm2_touchkey_irq_work(struct work_struct *irq_work)
+{
+	struct tm2_touchkey_data *samsung_touchkey =
+	    container_of(irq_work, struct tm2_touchkey_data, irq_work);
+
+	if (!samsung_touchkey->pressed) {
+		input_report_key(samsung_touchkey->input_dev, KEY_PHONE, 0);
+		input_report_key(samsung_touchkey->input_dev, KEY_BACK, 0);
+	} else {
+		if (samsung_touchkey->keycode_type == TM2_TOUCHKEY_KEY_MENU)
+			input_report_key(samsung_touchkey->input_dev,
+					 KEY_PHONE, 1);
+		else
+			input_report_key(samsung_touchkey->input_dev,
+					 KEY_BACK, 1);
+	}
+	input_sync(samsung_touchkey->input_dev);
+}
+
+static irqreturn_t tm2_touchkey_irq_handler(int irq, void *devid)
+{
+	struct tm2_touchkey_data *samsung_touchkey = devid;
+	u32 data;
+
+	data = i2c_smbus_read_byte_data(samsung_touchkey->client,
+					TM2_TOUCHKEY_KEYCODE_REG);
+
+	if (data < 0) {
+		dev_err(&samsung_touchkey->client->dev, "Failed to read i2c data\n");
+		return IRQ_HANDLED;
+	}
+
+	samsung_touchkey->keycode_type = data & TM2_TOUCHKEY_BIT_KEYCODE;
+	samsung_touchkey->pressed = !(data & TM2_TOUCHKEY_BIT_PRESS_EV);
+
+	if (samsung_touchkey->keycode_type != TM2_TOUCHKEY_KEY_MENU &&
+	    samsung_touchkey->keycode_type != TM2_TOUCHKEY_KEY_BACK)
+		return IRQ_HANDLED;
+
+	schedule_work(&samsung_touchkey->irq_work);
+
+	return IRQ_HANDLED;
+}
+
+static int tm2_touchkey_probe(struct i2c_client *client,
+				  const struct i2c_device_id *id)
+{
+	struct tm2_touchkey_data *samsung_touchkey;
+	int ret;
+
+	ret = i2c_check_functionality(client->adapter,
+				      I2C_FUNC_SMBUS_BYTE |
+				      I2C_FUNC_SMBUS_BYTE_DATA);
+	if (!ret) {
+		dev_err(&client->dev, "No I2C functionality found\n");
+		return -ENODEV;
+	}
+
+	samsung_touchkey = devm_kzalloc(&client->dev,
+			sizeof(struct tm2_touchkey_data), GFP_KERNEL);
+
+	if (!samsung_touchkey) {
+		dev_err(&client->dev, "Failed to allocate memory.\n");
+		return -ENOMEM;
+	}
+
+	samsung_touchkey->client = client;
+	i2c_set_clientdata(client, samsung_touchkey);
+	INIT_WORK(&samsung_touchkey->irq_work, tm2_touchkey_irq_work);
+
+	/* regulator */
+	samsung_touchkey->regulator_vcc =
+				devm_regulator_get(&client->dev, "vcc");
+	if (IS_ERR(samsung_touchkey->regulator_vcc)) {
+		dev_err(&client->dev, "Failed to get vcc regulator\n");
+		return PTR_ERR(samsung_touchkey->regulator_vcc);
+	}
+
+	samsung_touchkey->regulator_vdd =
+				devm_regulator_get(&client->dev, "vdd");
+	if (IS_ERR(samsung_touchkey->regulator_vdd)) {
+		dev_err(&client->dev, "Failed to get vdd regulator\n");
+		return PTR_ERR(samsung_touchkey->regulator_vcc);
+	}
+
+	/* power */
+	ret = tm2_touchkey_power_enable(samsung_touchkey);
+	if (ret) {
+		dev_err(&client->dev, "Failed to enable power\n");
+		return ret;
+	}
+
+	/* irq */
+	ret = devm_request_threaded_irq(&client->dev,
+					client->irq, NULL,
+					tm2_touchkey_irq_handler,
+					IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+					TM2_TOUCHKEY_DEV_NAME,
+					samsung_touchkey);
+	if (ret) {
+		dev_err(&client->dev, "Failed to request threaded irq\n");
+		return ret;
+	}
+
+	/* input device */
+	samsung_touchkey->input_dev = devm_input_allocate_device(&client->dev);
+	if (!samsung_touchkey->input_dev) {
+		dev_err(&client->dev, "Failed to alloc input device.\n");
+		return -ENOMEM;
+	}
+	samsung_touchkey->input_dev->name = TM2_TOUCHKEY_DEV_NAME;
+	samsung_touchkey->input_dev->id.bustype = BUS_I2C;
+	samsung_touchkey->input_dev->dev.parent = &client->dev;
+
+	set_bit(EV_KEY, samsung_touchkey->input_dev->evbit);
+	set_bit(KEY_PHONE, samsung_touchkey->input_dev->keybit);
+	set_bit(KEY_BACK, samsung_touchkey->input_dev->keybit);
+	input_set_drvdata(samsung_touchkey->input_dev, samsung_touchkey);
+
+	ret = input_register_device(samsung_touchkey->input_dev);
+	if (ret) {
+		dev_err(&client->dev, "Failed to register input device.\n");
+		return ret;
+	}
+
+	/* led device */
+	samsung_touchkey->led_dev.name = TM2_TOUCHKEY_DEV_NAME;
+	samsung_touchkey->led_dev.brightness = LED_FULL;
+	samsung_touchkey->led_dev.max_brightness = LED_FULL;
+	samsung_touchkey->led_dev.brightness_set =
+						tm2_touchkey_led_brightness_set;
+
+	ret = devm_led_classdev_register(&client->dev,
+					 &samsung_touchkey->led_dev);
+	if (ret < 0) {
+		dev_err(&client->dev, "Failed to register touchkey led\n");
+		return ret;
+	}
+
+	return 0;
+}
+
+static void tm2_touchkey_shutdown(struct i2c_client *client)
+{
+	struct tm2_touchkey_data *samsung_touchkey =
+						i2c_get_clientdata(client);
+	int ret;
+
+	disable_irq(client->irq);
+	ret = tm2_touchkey_power_disable(samsung_touchkey);
+	if (ret)
+		dev_err(&client->dev, "Failed to disable power\n");
+}
+
+static int tm2_touchkey_suspend(struct device *dev)
+{
+	struct tm2_touchkey_data *samsung_touchkey = dev_get_drvdata(dev);
+	int ret;
+
+	disable_irq(samsung_touchkey->client->irq);
+	ret = tm2_touchkey_power_disable(samsung_touchkey);
+	if (ret)
+		dev_err(dev, "Failed to disable power\n");
+
+	return ret;
+}
+
+static int tm2_touchkey_resume(struct device *dev)
+{
+	struct tm2_touchkey_data *samsung_touchkey = dev_get_drvdata(dev);
+	int ret;
+
+	enable_irq(samsung_touchkey->client->irq);
+	ret = tm2_touchkey_power_enable(samsung_touchkey);
+	if (ret)
+		dev_err(dev, "Failed to enable power\n");
+
+	return ret;
+}
+
+static SIMPLE_DEV_PM_OPS(tm2_touchkey_pm_ops, tm2_touchkey_suspend,
+							tm2_touchkey_resume);
+
+static const struct i2c_device_id tm2_touchkey_id_table[] = {
+	{TM2_TOUCHKEY_DEV_NAME, 0},
+	{},
+};
+
+static const struct of_device_id tm2_touchkey_of_match[] = {
+	{.compatible = "samsung,tm2-touchkey",},
+	{},
+};
+
+static struct i2c_driver tm2_touchkey_driver = {
+	.driver = {
+		.name = TM2_TOUCHKEY_DEV_NAME,
+		.pm = &tm2_touchkey_pm_ops,
+		.of_match_table = of_match_ptr(tm2_touchkey_of_match),
+	},
+	.probe = tm2_touchkey_probe,
+	.shutdown = tm2_touchkey_shutdown,
+	.id_table = tm2_touchkey_id_table,
+};
+
+module_i2c_driver(tm2_touchkey_driver);
+
+MODULE_AUTHOR("Beomho Seo <beomho.seo@samsung.com>");
+MODULE_AUTHOR("Jaechul Lee <jcsing.lee@samsung.com>");
+MODULE_DESCRIPTION("Samsung touchkey driver");
+MODULE_LICENSE("GPL v2");
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
       [not found]   ` <CGME20170103075734epcas5p43a9743131f63affd0a438d2ed342f22e@epcas5p4.samsung.com>
@ 2017-01-03  7:57       ` Jaechul Lee
  0 siblings, 0 replies; 61+ messages in thread
From: Jaechul Lee @ 2017-01-03  7:57 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Mark Rutland, Catalin Marinas,
	Will Deacon, Kukjin Kim, Krzysztof Kozlowski,
	Javier Martinez Canillas
  Cc: Jaechul Lee, Andi Shyti, Chanwoo Choi, beomho.seo, galaxyra,
	linux-arm-kernel, linux-input, devicetree, linux-kernel,
	linux-samsung-soc

From: Andi Shyti <andi.shyti@samsung.com>

Currently tm2e dts includes tm2 but there are some differences
between the two boards and tm2 has some properties that tm2e
doesn't have.

That's why it's important to keep the two dts files independent
and put all the commonalities in a tm2-common.dtsi file.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
---
 .../boot/dts/exynos/exynos5433-tm2-common.dtsi     | 1046 ++++++++++++++++++++
 arch/arm64/boot/dts/exynos/exynos5433-tm2.dts      | 1033 +------------------
 arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts     |    2 +-
 3 files changed, 1049 insertions(+), 1032 deletions(-)
 create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi

diff --git a/arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi b/arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
new file mode 100644
index 0000000..3d36717
--- /dev/null
+++ b/arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
@@ -0,0 +1,1046 @@
+/*
+ * SAMSUNG Exynos5433 TM2 board device tree source
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Device tree source file for Samsung's TM2 board which is based on
+ * Samsung Exynos5433 SoC.
+ *
+ * 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.
+ */
+
+/dts-v1/;
+#include "exynos5433.dtsi"
+#include <dt-bindings/clock/samsung,s2mps11.h>
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/ {
+	aliases {
+		gsc0 = &gsc_0;
+		gsc1 = &gsc_1;
+		gsc2 = &gsc_2;
+		pinctrl0 = &pinctrl_alive;
+		pinctrl1 = &pinctrl_aud;
+		pinctrl2 = &pinctrl_cpif;
+		pinctrl3 = &pinctrl_ese;
+		pinctrl4 = &pinctrl_finger;
+		pinctrl5 = &pinctrl_fsys;
+		pinctrl6 = &pinctrl_imem;
+		pinctrl7 = &pinctrl_nfc;
+		pinctrl8 = &pinctrl_peric;
+		pinctrl9 = &pinctrl_touch;
+		serial0 = &serial_0;
+		serial1 = &serial_1;
+		serial2 = &serial_2;
+		serial3 = &serial_3;
+		spi0 = &spi_0;
+		spi1 = &spi_1;
+		spi2 = &spi_2;
+		spi3 = &spi_3;
+		spi4 = &spi_4;
+		mshc0 = &mshc_0;
+		mshc2 = &mshc_2;
+	};
+
+	chosen {
+		stdout-path = &serial_1;
+	};
+
+	memory@20000000 {
+		device_type = "memory";
+		reg = <0x0 0x20000000 0x0 0xc0000000>;
+	};
+
+	gpio-keys {
+		compatible = "gpio-keys";
+
+		power-key {
+			gpios = <&gpa2 7 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_POWER>;
+			label = "power key";
+			debounce-interval = <10>;
+		};
+
+		volume-up-key {
+			gpios = <&gpa2 0 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_VOLUMEUP>;
+			label = "volume-up key";
+			debounce-interval = <10>;
+		};
+
+		volume-down-key {
+			gpios = <&gpa2 1 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_VOLUMEDOWN>;
+			label = "volume-down key";
+			debounce-interval = <10>;
+		};
+
+		homepage-key {
+			gpios = <&gpa0 3 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_MENU>;
+			label = "homepage key";
+			debounce-interval = <10>;
+		};
+	};
+
+	i2c_max98504: i2c-gpio-0 {
+		compatible = "i2c-gpio";
+		gpios = <&gpd0 1 GPIO_ACTIVE_HIGH /* SPK_AMP_SDA */
+			 &gpd0 0 GPIO_ACTIVE_HIGH /* SPK_AMP_SCL */ >;
+		i2c-gpio,delay-us = <2>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		status = "okay";
+
+		max98504: max98504@31 {
+			compatible = "maxim,max98504";
+			reg = <0x31>;
+			maxim,rx-path = <1>;
+			maxim,tx-path = <1>;
+			maxim,tx-channel-mask = <3>;
+			maxim,tx-channel-source = <2>;
+		};
+	};
+
+	sound {
+		compatible = "samsung,tm2-audio";
+		audio-codec = <&wm5110>;
+		i2s-controller = <&i2s0>;
+		audio-amplifier = <&max98504>;
+		mic-bias-gpios = <&gpr3 2 GPIO_ACTIVE_HIGH>;
+		model = "wm5110";
+		samsung,audio-routing =
+			/* Headphone */
+			"HP", "HPOUT1L",
+			"HP", "HPOUT1R",
+
+			/* Speaker */
+			"SPK", "SPKOUT",
+			"SPKOUT", "HPOUT2L",
+			"SPKOUT", "HPOUT2R",
+
+			/* Receiver */
+			"RCV", "HPOUT3L",
+			"RCV", "HPOUT3R";
+		status = "okay";
+	};
+};
+
+&adc {
+	vdd-supply = <&ldo3_reg>;
+	status = "okay";
+
+	thermistor-ap {
+		compatible = "murata,ncp03wf104";
+		pullup-uv = <1800000>;
+		pullup-ohm = <100000>;
+		pulldown-ohm = <0>;
+		io-channels = <&adc 0>;
+	};
+
+	thermistor-battery {
+		compatible = "murata,ncp03wf104";
+		pullup-uv = <1800000>;
+		pullup-ohm = <100000>;
+		pulldown-ohm = <0>;
+		io-channels = <&adc 1>;
+		#thermal-sensor-cells = <0>;
+	};
+
+	thermistor-charger {
+		compatible = "murata,ncp03wf104";
+		pullup-uv = <1800000>;
+		pullup-ohm = <100000>;
+		pulldown-ohm = <0>;
+		io-channels = <&adc 2>;
+	};
+};
+
+&cmu_aud {
+	assigned-clocks = <&cmu_aud CLK_MOUT_AUD_PLL_USER>;
+	assigned-clock-parents = <&cmu_top CLK_FOUT_AUD_PLL>;
+};
+
+&cmu_fsys {
+	assigned-clocks = <&cmu_top CLK_MOUT_SCLK_USBDRD30>,
+		<&cmu_top CLK_MOUT_SCLK_USBHOST30>,
+		<&cmu_fsys CLK_MOUT_SCLK_USBDRD30_USER>,
+		<&cmu_fsys CLK_MOUT_SCLK_USBHOST30_USER>,
+		<&cmu_fsys CLK_MOUT_PHYCLK_USBDRD30_UDRD30_PIPE_PCLK_USER>,
+		<&cmu_fsys CLK_MOUT_PHYCLK_USBHOST30_UHOST30_PIPE_PCLK_USER>,
+		<&cmu_fsys CLK_MOUT_PHYCLK_USBDRD30_UDRD30_PHYCLOCK_USER>,
+		<&cmu_fsys CLK_MOUT_PHYCLK_USBHOST30_UHOST30_PHYCLOCK_USER>,
+		<&cmu_top CLK_DIV_SCLK_USBDRD30>,
+		<&cmu_top CLK_DIV_SCLK_USBHOST30>;
+	assigned-clock-parents = <&cmu_top CLK_MOUT_BUS_PLL_USER>,
+		<&cmu_top CLK_MOUT_BUS_PLL_USER>,
+		<&cmu_top CLK_SCLK_USBDRD30_FSYS>,
+		<&cmu_top CLK_SCLK_USBHOST30_FSYS>,
+		<&cmu_fsys CLK_PHYCLK_USBDRD30_UDRD30_PIPE_PCLK_PHY>,
+		<&cmu_fsys CLK_PHYCLK_USBHOST30_UHOST30_PIPE_PCLK_PHY>,
+		<&cmu_fsys CLK_PHYCLK_USBDRD30_UDRD30_PHYCLOCK_PHY>,
+		<&cmu_fsys CLK_PHYCLK_USBHOST30_UHOST30_PHYCLOCK_PHY>;
+	assigned-clock-rates = <0>, <0>, <0>, <0>, <0>, <0>, <0>, <0>,
+			       <66700000>, <66700000>;
+};
+
+&cmu_gscl {
+	assigned-clocks = <&cmu_gscl CLK_MOUT_ACLK_GSCL_111_USER>,
+			  <&cmu_gscl CLK_MOUT_ACLK_GSCL_333_USER>;
+	assigned-clock-parents = <&cmu_top CLK_ACLK_GSCL_111>,
+				 <&cmu_top CLK_ACLK_GSCL_333>;
+};
+
+&cmu_mfc {
+	assigned-clocks = <&cmu_mfc CLK_MOUT_ACLK_MFC_400_USER>;
+	assigned-clock-parents = <&cmu_top CLK_ACLK_MFC_400>;
+};
+
+&cmu_mscl {
+	assigned-clocks = <&cmu_mscl CLK_MOUT_ACLK_MSCL_400_USER>,
+			  <&cmu_mscl CLK_MOUT_SCLK_JPEG_USER>,
+			  <&cmu_mscl CLK_MOUT_SCLK_JPEG>,
+			  <&cmu_top CLK_MOUT_SCLK_JPEG_A>;
+	assigned-clock-parents = <&cmu_top CLK_ACLK_MSCL_400>,
+				 <&cmu_top CLK_SCLK_JPEG_MSCL>,
+				 <&cmu_mscl CLK_MOUT_SCLK_JPEG_USER>,
+				 <&cmu_top CLK_MOUT_BUS_PLL_USER>;
+};
+
+&cpu0 {
+	cpu-supply = <&buck3_reg>;
+};
+
+&cpu4 {
+	cpu-supply = <&buck2_reg>;
+};
+
+&decon {
+	status = "okay";
+
+	i80-if-timings {
+	};
+};
+
+&dsi {
+	status = "okay";
+	vddcore-supply = <&ldo6_reg>;
+	vddio-supply = <&ldo7_reg>;
+	samsung,pll-clock-frequency = <24000000>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&te_irq>;
+
+	ports {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		port@1 {
+			reg = <1>;
+
+			dsi_out: endpoint {
+				samsung,burst-clock-frequency = <512000000>;
+				samsung,esc-clock-frequency = <16000000>;
+			};
+		};
+	};
+};
+
+&hsi2c_0 {
+	status = "okay";
+	clock-frequency = <2500000>;
+
+	s2mps13-pmic@66 {
+		compatible = "samsung,s2mps13-pmic";
+		interrupt-parent = <&gpa0>;
+		interrupts = <7 IRQ_TYPE_NONE>;
+		reg = <0x66>;
+		samsung,s2mps11-wrstbi-ground;
+
+		s2mps13_osc: clocks {
+			compatible = "samsung,s2mps13-clk";
+			#clock-cells = <1>;
+			clock-output-names = "s2mps13_ap", "s2mps13_cp",
+				"s2mps13_bt";
+		};
+
+		regulators {
+			ldo1_reg: LDO1 {
+				regulator-name = "VDD_ALIVE_0.9V_AP";
+				regulator-min-microvolt = <900000>;
+				regulator-max-microvolt = <900000>;
+				regulator-always-on;
+			};
+
+			ldo2_reg: LDO2 {
+				regulator-name = "VDDQ_MMC2_2.8V_AP";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			ldo3_reg: LDO3 {
+				regulator-name = "VDD1_E_1.8V_AP";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-always-on;
+			};
+
+			ldo4_reg: LDO4 {
+				regulator-name = "VDD10_MIF_PLL_1.0V_AP";
+				regulator-min-microvolt = <1300000>;
+				regulator-max-microvolt = <1300000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			ldo5_reg: LDO5 {
+				regulator-name = "VDD10_DPLL_1.0V_AP";
+				regulator-min-microvolt = <1000000>;
+				regulator-max-microvolt = <1000000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			ldo6_reg: LDO6 {
+				regulator-name = "VDD10_MIPI2L_1.0V_AP";
+				regulator-min-microvolt = <1000000>;
+				regulator-max-microvolt = <1000000>;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			ldo7_reg: LDO7 {
+				regulator-name = "VDD18_MIPI2L_1.8V_AP";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+			};
+
+			ldo8_reg: LDO8 {
+				regulator-name = "VDD18_LLI_1.8V_AP";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			ldo9_reg: LDO9 {
+				regulator-name = "VDD18_ABB_ETC_1.8V_AP";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			ldo10_reg: LDO10 {
+				regulator-name = "VDD33_USB30_3.0V_AP";
+				regulator-min-microvolt = <3000000>;
+				regulator-max-microvolt = <3000000>;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			ldo11_reg: LDO11 {
+				regulator-name = "VDD_INT_M_1.0V_AP";
+				regulator-min-microvolt = <1000000>;
+				regulator-max-microvolt = <1000000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			ldo12_reg: LDO12 {
+				regulator-name = "VDD_KFC_M_1.1V_AP";
+				regulator-min-microvolt = <800000>;
+				regulator-max-microvolt = <1350000>;
+				regulator-always-on;
+			};
+
+			ldo13_reg: LDO13 {
+				regulator-name = "VDD_G3D_M_0.95V_AP";
+				regulator-min-microvolt = <950000>;
+				regulator-max-microvolt = <950000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			ldo14_reg: LDO14 {
+				regulator-name = "VDDQ_M1_LDO_1.2V_AP";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <1200000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			ldo15_reg: LDO15 {
+				regulator-name = "VDDQ_M2_LDO_1.2V_AP";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <1200000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			ldo16_reg: LDO16 {
+				regulator-name = "VDDQ_EFUSE";
+				regulator-min-microvolt = <1400000>;
+				regulator-max-microvolt = <3400000>;
+				regulator-always-on;
+			};
+
+			ldo17_reg: LDO17 {
+				regulator-name = "V_TFLASH_2.8V_AP";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+			};
+
+			ldo18_reg: LDO18 {
+				regulator-name = "V_CODEC_1.8V_AP";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+			};
+
+			ldo19_reg: LDO19 {
+				regulator-name = "VDDA_1.8V_COMP";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-always-on;
+			};
+
+			ldo20_reg: LDO20 {
+				regulator-name = "VCC_2.8V_AP";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+				regulator-always-on;
+			};
+
+			ldo21_reg: LDO21 {
+				regulator-name = "VT_CAM_1.8V";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+			};
+
+			ldo22_reg: LDO22 {
+				regulator-name = "CAM_IO_1.8V_AP";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+			};
+
+			ldo23_reg: LDO23 {
+				regulator-name = "CAM_SEN_CORE_1.2V_AP";
+				regulator-min-microvolt = <1050000>;
+				regulator-max-microvolt = <1200000>;
+			};
+
+			ldo24_reg: LDO24 {
+				regulator-name = "VT_CAM_1.2V";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <1200000>;
+			};
+
+			ldo25_reg: LDO25 {
+				regulator-name = "CAM_SEN_A2.8V_AP";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+			};
+
+			ldo26_reg: LDO26 {
+				regulator-name = "CAM_AF_2.8V_AP";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+			};
+
+			ldo27_reg: LDO27 {
+				regulator-name = "VCC_3.0V_LCD_AP";
+				regulator-min-microvolt = <3000000>;
+				regulator-max-microvolt = <3000000>;
+			};
+
+			ldo28_reg: LDO28 {
+				regulator-name = "VCC_1.8V_LCD_AP";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+			};
+
+			ldo29_reg: LDO29 {
+				regulator-name = "VT_CAM_2.8V";
+				regulator-min-microvolt = <3000000>;
+				regulator-max-microvolt = <3000000>;
+			};
+
+			ldo30_reg: LDO30 {
+				regulator-name = "TSP_AVDD_3.3V_AP";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+			};
+
+			ldo31_reg: LDO31 {
+				regulator-name = "TSP_VDD_1.85V_AP";
+				regulator-min-microvolt = <1850000>;
+				regulator-max-microvolt = <1850000>;
+			};
+
+			ldo32_reg: LDO32 {
+				regulator-name = "VTOUCH_1.8V_AP";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+			};
+
+			ldo33_reg: LDO33 {
+				regulator-name = "VTOUCH_LED_3.3V";
+				regulator-min-microvolt = <2500000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-ramp-delay = <12500>;
+			};
+
+			ldo34_reg: LDO34 {
+				regulator-name = "VCC_1.8V_MHL_AP";
+				regulator-min-microvolt = <1000000>;
+				regulator-max-microvolt = <2100000>;
+			};
+
+			ldo35_reg: LDO35 {
+				regulator-name = "OIS_VM_2.8V";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <2800000>;
+			};
+
+			ldo36_reg: LDO36 {
+				regulator-name = "VSIL_1.0V";
+				regulator-min-microvolt = <1000000>;
+				regulator-max-microvolt = <1000000>;
+			};
+
+			ldo37_reg: LDO37 {
+				regulator-name = "VF_1.8V";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+			};
+
+			ldo38_reg: LDO38 {
+				regulator-name = "VCC_3.0V_MOTOR_AP";
+				regulator-min-microvolt = <3000000>;
+				regulator-max-microvolt = <3000000>;
+			};
+
+			ldo39_reg: LDO39 {
+				regulator-name = "V_HRM_1.8V";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+			};
+
+			ldo40_reg: LDO40 {
+				regulator-name = "V_HRM_3.3V";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+			};
+
+			buck1_reg: BUCK1 {
+				regulator-name = "VDD_MIF_0.9V_AP";
+				regulator-min-microvolt = <600000>;
+				regulator-max-microvolt = <1500000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			buck2_reg: BUCK2 {
+				regulator-name = "VDD_EGL_1.0V_AP";
+				regulator-min-microvolt = <900000>;
+				regulator-max-microvolt = <1300000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			buck3_reg: BUCK3 {
+				regulator-name = "VDD_KFC_1.0V_AP";
+				regulator-min-microvolt = <800000>;
+				regulator-max-microvolt = <1200000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			buck4_reg: BUCK4 {
+				regulator-name = "VDD_INT_0.95V_AP";
+				regulator-min-microvolt = <600000>;
+				regulator-max-microvolt = <1500000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			buck5_reg: BUCK5 {
+				regulator-name = "VDD_DISP_CAM0_0.9V_AP";
+				regulator-min-microvolt = <600000>;
+				regulator-max-microvolt = <1500000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			buck6_reg: BUCK6 {
+				regulator-name = "VDD_G3D_0.9V_AP";
+				regulator-min-microvolt = <600000>;
+				regulator-max-microvolt = <1500000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			buck7_reg: BUCK7 {
+				regulator-name = "VDD_MEM1_1.2V_AP";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <1200000>;
+				regulator-always-on;
+			};
+
+			buck8_reg: BUCK8 {
+				regulator-name = "VDD_LLDO_1.35V_AP";
+				regulator-min-microvolt = <1350000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-always-on;
+			};
+
+			buck9_reg: BUCK9 {
+				regulator-name = "VDD_MLDO_2.0V_AP";
+				regulator-min-microvolt = <1350000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-always-on;
+			};
+
+			buck10_reg: BUCK10 {
+				regulator-name = "vdd_mem2";
+				regulator-min-microvolt = <550000>;
+				regulator-max-microvolt = <1500000>;
+				regulator-always-on;
+			};
+		};
+	};
+};
+
+&hsi2c_8 {
+	status = "okay";
+
+	max77843@66 {
+		compatible = "maxim,max77843";
+		interrupt-parent = <&gpa1>;
+		interrupts = <5 IRQ_TYPE_EDGE_FALLING>;
+		reg = <0x66>;
+
+		muic: max77843-muic {
+			compatible = "maxim,max77843-muic";
+		};
+
+		regulators {
+			compatible = "maxim,max77843-regulator";
+			safeout1_reg: SAFEOUT1 {
+				regulator-name = "SAFEOUT1";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <4950000>;
+			};
+
+			safeout2_reg: SAFEOUT2 {
+				regulator-name = "SAFEOUT2";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <4950000>;
+			};
+
+			charger_reg: CHARGER {
+				regulator-name = "CHARGER";
+				regulator-min-microamp = <100000>;
+				regulator-max-microamp = <3150000>;
+			};
+		};
+
+		haptic: max77843-haptic {
+			compatible = "maxim,max77843-haptic";
+			haptic-supply = <&ldo38_reg>;
+			pwms = <&pwm 0 33670 0>;
+			pwm-names = "haptic";
+		};
+	};
+};
+
+&i2s0 {
+	status = "okay";
+};
+
+&mshc_0 {
+	status = "okay";
+	num-slots = <1>;
+	mmc-hs200-1_8v;
+	mmc-hs400-1_8v;
+	cap-mmc-highspeed;
+	non-removable;
+	card-detect-delay = <200>;
+	samsung,dw-mshc-ciu-div = <3>;
+	samsung,dw-mshc-sdr-timing = <0 4>;
+	samsung,dw-mshc-ddr-timing = <0 2>;
+	samsung,dw-mshc-hs400-timing = <0 3>;
+	samsung,read-strobe-delay = <90>;
+	fifo-depth = <0x80>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_qrdy &sd0_bus1 &sd0_bus4
+			&sd0_bus8 &sd0_rdqs>;
+	bus-width = <8>;
+	assigned-clocks = <&cmu_top CLK_SCLK_MMC0_FSYS>;
+	assigned-clock-rates = <800000000>;
+};
+
+&mshc_2 {
+	status = "okay";
+	num-slots = <1>;
+	cap-sd-highspeed;
+	disable-wp;
+	cd-gpios = <&gpa2 4 GPIO_ACTIVE_HIGH>;
+	cd-inverted;
+	card-detect-delay = <200>;
+	samsung,dw-mshc-ciu-div = <3>;
+	samsung,dw-mshc-sdr-timing = <0 4>;
+	samsung,dw-mshc-ddr-timing = <0 2>;
+	fifo-depth = <0x80>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_bus1 &sd2_bus4>;
+	bus-width = <4>;
+};
+
+&pinctrl_alive {
+	pinctrl-names = "default";
+	pinctrl-0 = <&initial_alive>;
+
+	initial_alive: initial-state {
+		PIN(IN, gpa0-0, DOWN, LV1);
+		PIN(IN, gpa0-1, NONE, LV1);
+		PIN(IN, gpa0-2, DOWN, LV1);
+		PIN(IN, gpa0-3, NONE, LV1);
+		PIN(IN, gpa0-4, NONE, LV1);
+		PIN(IN, gpa0-5, DOWN, LV1);
+		PIN(IN, gpa0-6, NONE, LV1);
+		PIN(IN, gpa0-7, NONE, LV1);
+
+		PIN(IN, gpa1-0, UP, LV1);
+		PIN(IN, gpa1-1, NONE, LV1);
+		PIN(IN, gpa1-2, NONE, LV1);
+		PIN(IN, gpa1-3, DOWN, LV1);
+		PIN(IN, gpa1-4, DOWN, LV1);
+		PIN(IN, gpa1-5, NONE, LV1);
+		PIN(IN, gpa1-6, NONE, LV1);
+		PIN(IN, gpa1-7, NONE, LV1);
+
+		PIN(IN, gpa2-0, NONE, LV1);
+		PIN(IN, gpa2-1, NONE, LV1);
+		PIN(IN, gpa2-2, NONE, LV1);
+		PIN(IN, gpa2-3, DOWN, LV1);
+		PIN(IN, gpa2-4, NONE, LV1);
+		PIN(IN, gpa2-5, DOWN, LV1);
+		PIN(IN, gpa2-6, DOWN, LV1);
+		PIN(IN, gpa2-7, NONE, LV1);
+
+		PIN(IN, gpa3-0, DOWN, LV1);
+		PIN(IN, gpa3-1, DOWN, LV1);
+		PIN(IN, gpa3-2, NONE, LV1);
+		PIN(IN, gpa3-3, DOWN, LV1);
+		PIN(IN, gpa3-4, NONE, LV1);
+		PIN(IN, gpa3-5, DOWN, LV1);
+		PIN(IN, gpa3-6, DOWN, LV1);
+		PIN(IN, gpa3-7, DOWN, LV1);
+
+		PIN(IN, gpf1-0, NONE, LV1);
+		PIN(IN, gpf1-1, NONE, LV1);
+		PIN(IN, gpf1-2, DOWN, LV1);
+		PIN(IN, gpf1-4, UP, LV1);
+		PIN(OUT, gpf1-5, NONE, LV1);
+		PIN(IN, gpf1-6, DOWN, LV1);
+		PIN(IN, gpf1-7, DOWN, LV1);
+
+		PIN(IN, gpf2-0, DOWN, LV1);
+		PIN(IN, gpf2-1, DOWN, LV1);
+		PIN(IN, gpf2-2, DOWN, LV1);
+		PIN(IN, gpf2-3, DOWN, LV1);
+
+		PIN(IN, gpf3-0, DOWN, LV1);
+		PIN(IN, gpf3-1, DOWN, LV1);
+		PIN(IN, gpf3-2, NONE, LV1);
+		PIN(IN, gpf3-3, DOWN, LV1);
+
+		PIN(IN, gpf4-0, DOWN, LV1);
+		PIN(IN, gpf4-1, DOWN, LV1);
+		PIN(IN, gpf4-2, DOWN, LV1);
+		PIN(IN, gpf4-3, DOWN, LV1);
+		PIN(IN, gpf4-4, DOWN, LV1);
+		PIN(IN, gpf4-5, DOWN, LV1);
+		PIN(IN, gpf4-6, DOWN, LV1);
+		PIN(IN, gpf4-7, DOWN, LV1);
+
+		PIN(IN, gpf5-0, DOWN, LV1);
+		PIN(IN, gpf5-1, DOWN, LV1);
+		PIN(IN, gpf5-2, DOWN, LV1);
+		PIN(IN, gpf5-3, DOWN, LV1);
+		PIN(OUT, gpf5-4, NONE, LV1);
+		PIN(IN, gpf5-5, DOWN, LV1);
+		PIN(IN, gpf5-6, DOWN, LV1);
+		PIN(IN, gpf5-7, DOWN, LV1);
+	};
+
+	te_irq: te_irq {
+		samsung,pins = "gpf1-3";
+		samsung,pin-function = <0xf>;
+	};
+};
+
+&pinctrl_cpif {
+	pinctrl-names = "default";
+	pinctrl-0 = <&initial_cpif>;
+
+	initial_cpif: initial-state {
+		PIN(IN, gpv6-0, DOWN, LV1);
+		PIN(IN, gpv6-1, DOWN, LV1);
+	};
+};
+
+&pinctrl_ese {
+	pinctrl-names = "default";
+	pinctrl-0 = <&initial_ese>;
+
+	initial_ese: initial-state {
+		PIN(IN, gpj2-0, DOWN, LV1);
+		PIN(IN, gpj2-1, DOWN, LV1);
+		PIN(IN, gpj2-2, DOWN, LV1);
+	};
+};
+
+&pinctrl_fsys {
+	pinctrl-names = "default";
+	pinctrl-0 = <&initial_fsys>;
+
+	initial_fsys: initial-state {
+		PIN(IN, gpr3-0, NONE, LV1);
+		PIN(IN, gpr3-1, DOWN, LV1);
+		PIN(IN, gpr3-2, DOWN, LV1);
+		PIN(IN, gpr3-3, DOWN, LV1);
+		PIN(IN, gpr3-7, NONE, LV1);
+	};
+};
+
+&pinctrl_imem {
+	pinctrl-names = "default";
+	pinctrl-0 = <&initial_imem>;
+
+	initial_imem: initial-state {
+		PIN(IN, gpf0-0, UP, LV1);
+		PIN(IN, gpf0-1, UP, LV1);
+		PIN(IN, gpf0-2, DOWN, LV1);
+		PIN(IN, gpf0-3, UP, LV1);
+		PIN(IN, gpf0-4, DOWN, LV1);
+		PIN(IN, gpf0-5, NONE, LV1);
+		PIN(IN, gpf0-6, DOWN, LV1);
+		PIN(IN, gpf0-7, UP, LV1);
+	};
+};
+
+&pinctrl_nfc {
+	pinctrl-names = "default";
+	pinctrl-0 = <&initial_nfc>;
+
+	initial_nfc: initial-state {
+		PIN(IN, gpj0-2, DOWN, LV1);
+	};
+};
+
+&pinctrl_peric {
+	pinctrl-names = "default";
+	pinctrl-0 = <&initial_peric>;
+
+	initial_peric: initial-state {
+		PIN(IN, gpv7-0, DOWN, LV1);
+		PIN(IN, gpv7-1, DOWN, LV1);
+		PIN(IN, gpv7-2, NONE, LV1);
+		PIN(IN, gpv7-3, DOWN, LV1);
+		PIN(IN, gpv7-4, DOWN, LV1);
+		PIN(IN, gpv7-5, DOWN, LV1);
+
+		PIN(IN, gpb0-4, DOWN, LV1);
+
+		PIN(IN, gpc0-2, DOWN, LV1);
+		PIN(IN, gpc0-5, DOWN, LV1);
+		PIN(IN, gpc0-7, DOWN, LV1);
+
+		PIN(IN, gpc1-1, DOWN, LV1);
+
+		PIN(IN, gpc3-4, NONE, LV1);
+		PIN(IN, gpc3-5, NONE, LV1);
+		PIN(IN, gpc3-6, NONE, LV1);
+		PIN(IN, gpc3-7, NONE, LV1);
+
+		PIN(OUT, gpg0-0, NONE, LV1);
+		PIN(FUNC1, gpg0-1, DOWN, LV1);
+
+		PIN(IN, gpd2-5, DOWN, LV1);
+
+		PIN(IN, gpd4-0, NONE, LV1);
+		PIN(IN, gpd4-1, DOWN, LV1);
+		PIN(IN, gpd4-2, DOWN, LV1);
+		PIN(IN, gpd4-3, DOWN, LV1);
+		PIN(IN, gpd4-4, DOWN, LV1);
+
+		PIN(IN, gpd6-3, DOWN, LV1);
+
+		PIN(IN, gpd8-1, UP, LV1);
+
+		PIN(IN, gpg1-0, DOWN, LV1);
+		PIN(IN, gpg1-1, DOWN, LV1);
+		PIN(IN, gpg1-2, DOWN, LV1);
+		PIN(IN, gpg1-3, DOWN, LV1);
+		PIN(IN, gpg1-4, DOWN, LV1);
+
+		PIN(IN, gpg2-0, DOWN, LV1);
+		PIN(IN, gpg2-1, DOWN, LV1);
+
+		PIN(IN, gpg3-0, DOWN, LV1);
+		PIN(IN, gpg3-1, DOWN, LV1);
+		PIN(IN, gpg3-5, DOWN, LV1);
+		PIN(IN, gpg3-7, DOWN, LV1);
+	};
+};
+
+&pinctrl_touch {
+	pinctrl-names = "default";
+	pinctrl-0 = <&initial_touch>;
+
+	initial_touch: initial-state {
+		PIN(IN, gpj1-2, DOWN, LV1);
+	};
+};
+
+&pwm {
+	pinctrl-0 = <&pwm0_out>;
+	pinctrl-names = "default";
+	status = "okay";
+};
+
+&mic {
+	status = "okay";
+
+	i80-if-timings {
+	};
+};
+
+&pmu_system_controller {
+	assigned-clocks = <&pmu_system_controller 0>;
+	assigned-clock-parents = <&xxti>;
+};
+
+&serial_1 {
+	status = "okay";
+};
+
+&spi_1 {
+	cs-gpios = <&gpd6 3 GPIO_ACTIVE_HIGH>;
+	status = "okay";
+
+	wm5110: wm5110-codec@0 {
+		compatible = "wlf,wm5110";
+		reg = <0x0>;
+		spi-max-frequency = <20000000>;
+		interrupt-parent = <&gpa0>;
+		interrupts = <4 IRQ_TYPE_NONE>;
+		clocks = <&pmu_system_controller 0>,
+			<&s2mps13_osc S2MPS11_CLK_BT>;
+		clock-names = "mclk1", "mclk2";
+
+		gpio-controller;
+		#gpio-cells = <2>;
+
+		wlf,micd-detect-debounce = <300>;
+		wlf,micd-bias-start-time = <0x1>;
+		wlf,micd-rate = <0x7>;
+		wlf,micd-dbtime = <0x1>;
+		wlf,micd-force-micbias;
+		wlf,micd-configs = <0x0 1 0>;
+		wlf,hpdet-channel = <1>;
+		wlf,gpsw = <0x1>;
+		wlf,inmode = <2 0 2 0>;
+
+		wlf,reset = <&gpc0 7 GPIO_ACTIVE_HIGH>;
+		wlf,ldoena = <&gpf0 0 GPIO_ACTIVE_HIGH>;
+
+		/* core supplies */
+		AVDD-supply = <&ldo18_reg>;
+		DBVDD1-supply = <&ldo18_reg>;
+		CPVDD-supply = <&ldo18_reg>;
+		DBVDD2-supply = <&ldo18_reg>;
+		DBVDD3-supply = <&ldo18_reg>;
+
+		controller-data {
+			samsung,spi-feedback-delay = <0>;
+		};
+	};
+};
+
+&timer {
+	clock-frequency = <24000000>;
+};
+
+&tmu_atlas0 {
+	vtmu-supply = <&ldo3_reg>;
+	status = "okay";
+};
+
+&tmu_apollo {
+	vtmu-supply = <&ldo3_reg>;
+	status = "okay";
+};
+
+&tmu_g3d {
+	vtmu-supply = <&ldo3_reg>;
+	status = "okay";
+};
+
+&usbdrd30 {
+	vdd33-supply = <&ldo10_reg>;
+	vdd10-supply = <&ldo6_reg>;
+	status = "okay";
+};
+
+&usbdrd_dwc3_0 {
+	dr_mode = "otg";
+};
+
+&usbdrd30_phy {
+	vbus-supply = <&safeout1_reg>;
+	status = "okay";
+};
+
+&xxti {
+	clock-frequency = <24000000>;
+};
diff --git a/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts b/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts
index f21bdc2..887a1f1 100644
--- a/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts
+++ b/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts
@@ -11,1039 +11,10 @@
  * published by the Free Software Foundation.
  */
 
-/dts-v1/;
-#include "exynos5433.dtsi"
-#include <dt-bindings/clock/samsung,s2mps11.h>
-#include <dt-bindings/gpio/gpio.h>
-#include <dt-bindings/input/input.h>
-#include <dt-bindings/interrupt-controller/irq.h>
+#include "exynos5433-tm2-common.dtsi"
 
 / {
 	model = "Samsung TM2 board";
-	compatible = "samsung,tm2", "samsung,exynos5433";
-
-	aliases {
-		gsc0 = &gsc_0;
-		gsc1 = &gsc_1;
-		gsc2 = &gsc_2;
-		pinctrl0 = &pinctrl_alive;
-		pinctrl1 = &pinctrl_aud;
-		pinctrl2 = &pinctrl_cpif;
-		pinctrl3 = &pinctrl_ese;
-		pinctrl4 = &pinctrl_finger;
-		pinctrl5 = &pinctrl_fsys;
-		pinctrl6 = &pinctrl_imem;
-		pinctrl7 = &pinctrl_nfc;
-		pinctrl8 = &pinctrl_peric;
-		pinctrl9 = &pinctrl_touch;
-		serial0 = &serial_0;
-		serial1 = &serial_1;
-		serial2 = &serial_2;
-		serial3 = &serial_3;
-		spi0 = &spi_0;
-		spi1 = &spi_1;
-		spi2 = &spi_2;
-		spi3 = &spi_3;
-		spi4 = &spi_4;
-		mshc0 = &mshc_0;
-		mshc2 = &mshc_2;
-	};
-
-	chosen {
-		stdout-path = &serial_1;
-	};
-
-	memory@20000000 {
-		device_type = "memory";
-		reg = <0x0 0x20000000 0x0 0xc0000000>;
-	};
-
-	gpio-keys {
-		compatible = "gpio-keys";
-
-		power-key {
-			gpios = <&gpa2 7 GPIO_ACTIVE_LOW>;
-			linux,code = <KEY_POWER>;
-			label = "power key";
-			debounce-interval = <10>;
-		};
-
-		volume-up-key {
-			gpios = <&gpa2 0 GPIO_ACTIVE_LOW>;
-			linux,code = <KEY_VOLUMEUP>;
-			label = "volume-up key";
-			debounce-interval = <10>;
-		};
-
-		volume-down-key {
-			gpios = <&gpa2 1 GPIO_ACTIVE_LOW>;
-			linux,code = <KEY_VOLUMEDOWN>;
-			label = "volume-down key";
-			debounce-interval = <10>;
-		};
-
-		homepage-key {
-			gpios = <&gpa0 3 GPIO_ACTIVE_LOW>;
-			linux,code = <KEY_MENU>;
-			label = "homepage key";
-			debounce-interval = <10>;
-		};
-	};
-
-	i2c_max98504: i2c-gpio-0 {
-		compatible = "i2c-gpio";
-		gpios = <&gpd0 1 GPIO_ACTIVE_HIGH /* SPK_AMP_SDA */
-			 &gpd0 0 GPIO_ACTIVE_HIGH /* SPK_AMP_SCL */ >;
-		i2c-gpio,delay-us = <2>;
-		#address-cells = <1>;
-		#size-cells = <0>;
-		status = "okay";
-
-		max98504: max98504@31 {
-			compatible = "maxim,max98504";
-			reg = <0x31>;
-			maxim,rx-path = <1>;
-			maxim,tx-path = <1>;
-			maxim,tx-channel-mask = <3>;
-			maxim,tx-channel-source = <2>;
-		};
-	};
-
-	sound {
-		compatible = "samsung,tm2-audio";
-		audio-codec = <&wm5110>;
-		i2s-controller = <&i2s0>;
-		audio-amplifier = <&max98504>;
-		mic-bias-gpios = <&gpr3 2 GPIO_ACTIVE_HIGH>;
-		model = "wm5110";
-		samsung,audio-routing =
-			/* Headphone */
-			"HP", "HPOUT1L",
-			"HP", "HPOUT1R",
-
-			/* Speaker */
-			"SPK", "SPKOUT",
-			"SPKOUT", "HPOUT2L",
-			"SPKOUT", "HPOUT2R",
-
-			/* Receiver */
-			"RCV", "HPOUT3L",
-			"RCV", "HPOUT3R";
-		status = "okay";
-	};
-};
-
-&adc {
-	vdd-supply = <&ldo3_reg>;
-	status = "okay";
-
-	thermistor-ap {
-		compatible = "murata,ncp03wf104";
-		pullup-uv = <1800000>;
-		pullup-ohm = <100000>;
-		pulldown-ohm = <0>;
-		io-channels = <&adc 0>;
-	};
-
-	thermistor-battery {
-		compatible = "murata,ncp03wf104";
-		pullup-uv = <1800000>;
-		pullup-ohm = <100000>;
-		pulldown-ohm = <0>;
-		io-channels = <&adc 1>;
-		#thermal-sensor-cells = <0>;
-	};
-
-	thermistor-charger {
-		compatible = "murata,ncp03wf104";
-		pullup-uv = <1800000>;
-		pullup-ohm = <100000>;
-		pulldown-ohm = <0>;
-		io-channels = <&adc 2>;
-	};
-};
-
-&cmu_aud {
-	assigned-clocks = <&cmu_aud CLK_MOUT_AUD_PLL_USER>;
-	assigned-clock-parents = <&cmu_top CLK_FOUT_AUD_PLL>;
-};
-
-&cmu_fsys {
-	assigned-clocks = <&cmu_top CLK_MOUT_SCLK_USBDRD30>,
-		<&cmu_top CLK_MOUT_SCLK_USBHOST30>,
-		<&cmu_fsys CLK_MOUT_SCLK_USBDRD30_USER>,
-		<&cmu_fsys CLK_MOUT_SCLK_USBHOST30_USER>,
-		<&cmu_fsys CLK_MOUT_PHYCLK_USBDRD30_UDRD30_PIPE_PCLK_USER>,
-		<&cmu_fsys CLK_MOUT_PHYCLK_USBHOST30_UHOST30_PIPE_PCLK_USER>,
-		<&cmu_fsys CLK_MOUT_PHYCLK_USBDRD30_UDRD30_PHYCLOCK_USER>,
-		<&cmu_fsys CLK_MOUT_PHYCLK_USBHOST30_UHOST30_PHYCLOCK_USER>,
-		<&cmu_top CLK_DIV_SCLK_USBDRD30>,
-		<&cmu_top CLK_DIV_SCLK_USBHOST30>;
-	assigned-clock-parents = <&cmu_top CLK_MOUT_BUS_PLL_USER>,
-		<&cmu_top CLK_MOUT_BUS_PLL_USER>,
-		<&cmu_top CLK_SCLK_USBDRD30_FSYS>,
-		<&cmu_top CLK_SCLK_USBHOST30_FSYS>,
-		<&cmu_fsys CLK_PHYCLK_USBDRD30_UDRD30_PIPE_PCLK_PHY>,
-		<&cmu_fsys CLK_PHYCLK_USBHOST30_UHOST30_PIPE_PCLK_PHY>,
-		<&cmu_fsys CLK_PHYCLK_USBDRD30_UDRD30_PHYCLOCK_PHY>,
-		<&cmu_fsys CLK_PHYCLK_USBHOST30_UHOST30_PHYCLOCK_PHY>;
-	assigned-clock-rates = <0>, <0>, <0>, <0>, <0>, <0>, <0>, <0>,
-			       <66700000>, <66700000>;
-};
-
-&cmu_gscl {
-	assigned-clocks = <&cmu_gscl CLK_MOUT_ACLK_GSCL_111_USER>,
-			  <&cmu_gscl CLK_MOUT_ACLK_GSCL_333_USER>;
-	assigned-clock-parents = <&cmu_top CLK_ACLK_GSCL_111>,
-				 <&cmu_top CLK_ACLK_GSCL_333>;
+	compatible = "samsung,tm2e", "samsung,exynos5433";
 };
 
-&cmu_mfc {
-	assigned-clocks = <&cmu_mfc CLK_MOUT_ACLK_MFC_400_USER>;
-	assigned-clock-parents = <&cmu_top CLK_ACLK_MFC_400>;
-};
-
-&cmu_mscl {
-	assigned-clocks = <&cmu_mscl CLK_MOUT_ACLK_MSCL_400_USER>,
-			  <&cmu_mscl CLK_MOUT_SCLK_JPEG_USER>,
-			  <&cmu_mscl CLK_MOUT_SCLK_JPEG>,
-			  <&cmu_top CLK_MOUT_SCLK_JPEG_A>;
-	assigned-clock-parents = <&cmu_top CLK_ACLK_MSCL_400>,
-				 <&cmu_top CLK_SCLK_JPEG_MSCL>,
-				 <&cmu_mscl CLK_MOUT_SCLK_JPEG_USER>,
-				 <&cmu_top CLK_MOUT_BUS_PLL_USER>;
-};
-
-&cpu0 {
-	cpu-supply = <&buck3_reg>;
-};
-
-&cpu4 {
-	cpu-supply = <&buck2_reg>;
-};
-
-&decon {
-	status = "okay";
-
-	i80-if-timings {
-	};
-};
-
-&dsi {
-	status = "okay";
-	vddcore-supply = <&ldo6_reg>;
-	vddio-supply = <&ldo7_reg>;
-	samsung,pll-clock-frequency = <24000000>;
-	pinctrl-names = "default";
-	pinctrl-0 = <&te_irq>;
-
-	ports {
-		#address-cells = <1>;
-		#size-cells = <0>;
-
-		port@1 {
-			reg = <1>;
-
-			dsi_out: endpoint {
-				samsung,burst-clock-frequency = <512000000>;
-				samsung,esc-clock-frequency = <16000000>;
-			};
-		};
-	};
-};
-
-&hsi2c_0 {
-	status = "okay";
-	clock-frequency = <2500000>;
-
-	s2mps13-pmic@66 {
-		compatible = "samsung,s2mps13-pmic";
-		interrupt-parent = <&gpa0>;
-		interrupts = <7 IRQ_TYPE_NONE>;
-		reg = <0x66>;
-		samsung,s2mps11-wrstbi-ground;
-
-		s2mps13_osc: clocks {
-			compatible = "samsung,s2mps13-clk";
-			#clock-cells = <1>;
-			clock-output-names = "s2mps13_ap", "s2mps13_cp",
-				"s2mps13_bt";
-		};
-
-		regulators {
-			ldo1_reg: LDO1 {
-				regulator-name = "VDD_ALIVE_0.9V_AP";
-				regulator-min-microvolt = <900000>;
-				regulator-max-microvolt = <900000>;
-				regulator-always-on;
-			};
-
-			ldo2_reg: LDO2 {
-				regulator-name = "VDDQ_MMC2_2.8V_AP";
-				regulator-min-microvolt = <2800000>;
-				regulator-max-microvolt = <2800000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			ldo3_reg: LDO3 {
-				regulator-name = "VDD1_E_1.8V_AP";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-always-on;
-			};
-
-			ldo4_reg: LDO4 {
-				regulator-name = "VDD10_MIF_PLL_1.0V_AP";
-				regulator-min-microvolt = <1300000>;
-				regulator-max-microvolt = <1300000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			ldo5_reg: LDO5 {
-				regulator-name = "VDD10_DPLL_1.0V_AP";
-				regulator-min-microvolt = <1000000>;
-				regulator-max-microvolt = <1000000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			ldo6_reg: LDO6 {
-				regulator-name = "VDD10_MIPI2L_1.0V_AP";
-				regulator-min-microvolt = <1000000>;
-				regulator-max-microvolt = <1000000>;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			ldo7_reg: LDO7 {
-				regulator-name = "VDD18_MIPI2L_1.8V_AP";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-			};
-
-			ldo8_reg: LDO8 {
-				regulator-name = "VDD18_LLI_1.8V_AP";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			ldo9_reg: LDO9 {
-				regulator-name = "VDD18_ABB_ETC_1.8V_AP";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			ldo10_reg: LDO10 {
-				regulator-name = "VDD33_USB30_3.0V_AP";
-				regulator-min-microvolt = <3000000>;
-				regulator-max-microvolt = <3000000>;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			ldo11_reg: LDO11 {
-				regulator-name = "VDD_INT_M_1.0V_AP";
-				regulator-min-microvolt = <1000000>;
-				regulator-max-microvolt = <1000000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			ldo12_reg: LDO12 {
-				regulator-name = "VDD_KFC_M_1.1V_AP";
-				regulator-min-microvolt = <800000>;
-				regulator-max-microvolt = <1350000>;
-				regulator-always-on;
-			};
-
-			ldo13_reg: LDO13 {
-				regulator-name = "VDD_G3D_M_0.95V_AP";
-				regulator-min-microvolt = <950000>;
-				regulator-max-microvolt = <950000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			ldo14_reg: LDO14 {
-				regulator-name = "VDDQ_M1_LDO_1.2V_AP";
-				regulator-min-microvolt = <1200000>;
-				regulator-max-microvolt = <1200000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			ldo15_reg: LDO15 {
-				regulator-name = "VDDQ_M2_LDO_1.2V_AP";
-				regulator-min-microvolt = <1200000>;
-				regulator-max-microvolt = <1200000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			ldo16_reg: LDO16 {
-				regulator-name = "VDDQ_EFUSE";
-				regulator-min-microvolt = <1400000>;
-				regulator-max-microvolt = <3400000>;
-				regulator-always-on;
-			};
-
-			ldo17_reg: LDO17 {
-				regulator-name = "V_TFLASH_2.8V_AP";
-				regulator-min-microvolt = <2800000>;
-				regulator-max-microvolt = <2800000>;
-			};
-
-			ldo18_reg: LDO18 {
-				regulator-name = "V_CODEC_1.8V_AP";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-			};
-
-			ldo19_reg: LDO19 {
-				regulator-name = "VDDA_1.8V_COMP";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-always-on;
-			};
-
-			ldo20_reg: LDO20 {
-				regulator-name = "VCC_2.8V_AP";
-				regulator-min-microvolt = <2800000>;
-				regulator-max-microvolt = <2800000>;
-				regulator-always-on;
-			};
-
-			ldo21_reg: LDO21 {
-				regulator-name = "VT_CAM_1.8V";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-			};
-
-			ldo22_reg: LDO22 {
-				regulator-name = "CAM_IO_1.8V_AP";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-			};
-
-			ldo23_reg: LDO23 {
-				regulator-name = "CAM_SEN_CORE_1.2V_AP";
-				regulator-min-microvolt = <1050000>;
-				regulator-max-microvolt = <1200000>;
-			};
-
-			ldo24_reg: LDO24 {
-				regulator-name = "VT_CAM_1.2V";
-				regulator-min-microvolt = <1200000>;
-				regulator-max-microvolt = <1200000>;
-			};
-
-			ldo25_reg: LDO25 {
-				regulator-name = "CAM_SEN_A2.8V_AP";
-				regulator-min-microvolt = <2800000>;
-				regulator-max-microvolt = <2800000>;
-			};
-
-			ldo26_reg: LDO26 {
-				regulator-name = "CAM_AF_2.8V_AP";
-				regulator-min-microvolt = <2800000>;
-				regulator-max-microvolt = <2800000>;
-			};
-
-			ldo27_reg: LDO27 {
-				regulator-name = "VCC_3.0V_LCD_AP";
-				regulator-min-microvolt = <3000000>;
-				regulator-max-microvolt = <3000000>;
-			};
-
-			ldo28_reg: LDO28 {
-				regulator-name = "VCC_1.8V_LCD_AP";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-			};
-
-			ldo29_reg: LDO29 {
-				regulator-name = "VT_CAM_2.8V";
-				regulator-min-microvolt = <3000000>;
-				regulator-max-microvolt = <3000000>;
-			};
-
-			ldo30_reg: LDO30 {
-				regulator-name = "TSP_AVDD_3.3V_AP";
-				regulator-min-microvolt = <3300000>;
-				regulator-max-microvolt = <3300000>;
-			};
-
-			ldo31_reg: LDO31 {
-				regulator-name = "TSP_VDD_1.85V_AP";
-				regulator-min-microvolt = <1850000>;
-				regulator-max-microvolt = <1850000>;
-			};
-
-			ldo32_reg: LDO32 {
-				regulator-name = "VTOUCH_1.8V_AP";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-			};
-
-			ldo33_reg: LDO33 {
-				regulator-name = "VTOUCH_LED_3.3V";
-				regulator-min-microvolt = <2500000>;
-				regulator-max-microvolt = <3300000>;
-				regulator-ramp-delay = <12500>;
-			};
-
-			ldo34_reg: LDO34 {
-				regulator-name = "VCC_1.8V_MHL_AP";
-				regulator-min-microvolt = <1000000>;
-				regulator-max-microvolt = <2100000>;
-			};
-
-			ldo35_reg: LDO35 {
-				regulator-name = "OIS_VM_2.8V";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <2800000>;
-			};
-
-			ldo36_reg: LDO36 {
-				regulator-name = "VSIL_1.0V";
-				regulator-min-microvolt = <1000000>;
-				regulator-max-microvolt = <1000000>;
-			};
-
-			ldo37_reg: LDO37 {
-				regulator-name = "VF_1.8V";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-			};
-
-			ldo38_reg: LDO38 {
-				regulator-name = "VCC_3.0V_MOTOR_AP";
-				regulator-min-microvolt = <3000000>;
-				regulator-max-microvolt = <3000000>;
-			};
-
-			ldo39_reg: LDO39 {
-				regulator-name = "V_HRM_1.8V";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-			};
-
-			ldo40_reg: LDO40 {
-				regulator-name = "V_HRM_3.3V";
-				regulator-min-microvolt = <3300000>;
-				regulator-max-microvolt = <3300000>;
-			};
-
-			buck1_reg: BUCK1 {
-				regulator-name = "VDD_MIF_0.9V_AP";
-				regulator-min-microvolt = <600000>;
-				regulator-max-microvolt = <1500000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			buck2_reg: BUCK2 {
-				regulator-name = "VDD_EGL_1.0V_AP";
-				regulator-min-microvolt = <900000>;
-				regulator-max-microvolt = <1300000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			buck3_reg: BUCK3 {
-				regulator-name = "VDD_KFC_1.0V_AP";
-				regulator-min-microvolt = <800000>;
-				regulator-max-microvolt = <1200000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			buck4_reg: BUCK4 {
-				regulator-name = "VDD_INT_0.95V_AP";
-				regulator-min-microvolt = <600000>;
-				regulator-max-microvolt = <1500000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			buck5_reg: BUCK5 {
-				regulator-name = "VDD_DISP_CAM0_0.9V_AP";
-				regulator-min-microvolt = <600000>;
-				regulator-max-microvolt = <1500000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			buck6_reg: BUCK6 {
-				regulator-name = "VDD_G3D_0.9V_AP";
-				regulator-min-microvolt = <600000>;
-				regulator-max-microvolt = <1500000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			buck7_reg: BUCK7 {
-				regulator-name = "VDD_MEM1_1.2V_AP";
-				regulator-min-microvolt = <1200000>;
-				regulator-max-microvolt = <1200000>;
-				regulator-always-on;
-			};
-
-			buck8_reg: BUCK8 {
-				regulator-name = "VDD_LLDO_1.35V_AP";
-				regulator-min-microvolt = <1350000>;
-				regulator-max-microvolt = <3300000>;
-				regulator-always-on;
-			};
-
-			buck9_reg: BUCK9 {
-				regulator-name = "VDD_MLDO_2.0V_AP";
-				regulator-min-microvolt = <1350000>;
-				regulator-max-microvolt = <3300000>;
-				regulator-always-on;
-			};
-
-			buck10_reg: BUCK10 {
-				regulator-name = "vdd_mem2";
-				regulator-min-microvolt = <550000>;
-				regulator-max-microvolt = <1500000>;
-				regulator-always-on;
-			};
-		};
-	};
-};
-
-&hsi2c_8 {
-	status = "okay";
-
-	max77843@66 {
-		compatible = "maxim,max77843";
-		interrupt-parent = <&gpa1>;
-		interrupts = <5 IRQ_TYPE_EDGE_FALLING>;
-		reg = <0x66>;
-
-		muic: max77843-muic {
-			compatible = "maxim,max77843-muic";
-		};
-
-		regulators {
-			compatible = "maxim,max77843-regulator";
-			safeout1_reg: SAFEOUT1 {
-				regulator-name = "SAFEOUT1";
-				regulator-min-microvolt = <3300000>;
-				regulator-max-microvolt = <4950000>;
-			};
-
-			safeout2_reg: SAFEOUT2 {
-				regulator-name = "SAFEOUT2";
-				regulator-min-microvolt = <3300000>;
-				regulator-max-microvolt = <4950000>;
-			};
-
-			charger_reg: CHARGER {
-				regulator-name = "CHARGER";
-				regulator-min-microamp = <100000>;
-				regulator-max-microamp = <3150000>;
-			};
-		};
-
-		haptic: max77843-haptic {
-			compatible = "maxim,max77843-haptic";
-			haptic-supply = <&ldo38_reg>;
-			pwms = <&pwm 0 33670 0>;
-			pwm-names = "haptic";
-		};
-	};
-};
-
-&i2s0 {
-	status = "okay";
-};
-
-&mshc_0 {
-	status = "okay";
-	num-slots = <1>;
-	mmc-hs200-1_8v;
-	mmc-hs400-1_8v;
-	cap-mmc-highspeed;
-	non-removable;
-	card-detect-delay = <200>;
-	samsung,dw-mshc-ciu-div = <3>;
-	samsung,dw-mshc-sdr-timing = <0 4>;
-	samsung,dw-mshc-ddr-timing = <0 2>;
-	samsung,dw-mshc-hs400-timing = <0 3>;
-	samsung,read-strobe-delay = <90>;
-	fifo-depth = <0x80>;
-	pinctrl-names = "default";
-	pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_qrdy &sd0_bus1 &sd0_bus4
-			&sd0_bus8 &sd0_rdqs>;
-	bus-width = <8>;
-	assigned-clocks = <&cmu_top CLK_SCLK_MMC0_FSYS>;
-	assigned-clock-rates = <800000000>;
-};
-
-&mshc_2 {
-	status = "okay";
-	num-slots = <1>;
-	cap-sd-highspeed;
-	disable-wp;
-	cd-gpios = <&gpa2 4 GPIO_ACTIVE_HIGH>;
-	cd-inverted;
-	card-detect-delay = <200>;
-	samsung,dw-mshc-ciu-div = <3>;
-	samsung,dw-mshc-sdr-timing = <0 4>;
-	samsung,dw-mshc-ddr-timing = <0 2>;
-	fifo-depth = <0x80>;
-	pinctrl-names = "default";
-	pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_bus1 &sd2_bus4>;
-	bus-width = <4>;
-};
-
-&pinctrl_alive {
-	pinctrl-names = "default";
-	pinctrl-0 = <&initial_alive>;
-
-	initial_alive: initial-state {
-		PIN(IN, gpa0-0, DOWN, LV1);
-		PIN(IN, gpa0-1, NONE, LV1);
-		PIN(IN, gpa0-2, DOWN, LV1);
-		PIN(IN, gpa0-3, NONE, LV1);
-		PIN(IN, gpa0-4, NONE, LV1);
-		PIN(IN, gpa0-5, DOWN, LV1);
-		PIN(IN, gpa0-6, NONE, LV1);
-		PIN(IN, gpa0-7, NONE, LV1);
-
-		PIN(IN, gpa1-0, UP, LV1);
-		PIN(IN, gpa1-1, NONE, LV1);
-		PIN(IN, gpa1-2, NONE, LV1);
-		PIN(IN, gpa1-3, DOWN, LV1);
-		PIN(IN, gpa1-4, DOWN, LV1);
-		PIN(IN, gpa1-5, NONE, LV1);
-		PIN(IN, gpa1-6, NONE, LV1);
-		PIN(IN, gpa1-7, NONE, LV1);
-
-		PIN(IN, gpa2-0, NONE, LV1);
-		PIN(IN, gpa2-1, NONE, LV1);
-		PIN(IN, gpa2-2, NONE, LV1);
-		PIN(IN, gpa2-3, DOWN, LV1);
-		PIN(IN, gpa2-4, NONE, LV1);
-		PIN(IN, gpa2-5, DOWN, LV1);
-		PIN(IN, gpa2-6, DOWN, LV1);
-		PIN(IN, gpa2-7, NONE, LV1);
-
-		PIN(IN, gpa3-0, DOWN, LV1);
-		PIN(IN, gpa3-1, DOWN, LV1);
-		PIN(IN, gpa3-2, NONE, LV1);
-		PIN(IN, gpa3-3, DOWN, LV1);
-		PIN(IN, gpa3-4, NONE, LV1);
-		PIN(IN, gpa3-5, DOWN, LV1);
-		PIN(IN, gpa3-6, DOWN, LV1);
-		PIN(IN, gpa3-7, DOWN, LV1);
-
-		PIN(IN, gpf1-0, NONE, LV1);
-		PIN(IN, gpf1-1, NONE, LV1);
-		PIN(IN, gpf1-2, DOWN, LV1);
-		PIN(IN, gpf1-4, UP, LV1);
-		PIN(OUT, gpf1-5, NONE, LV1);
-		PIN(IN, gpf1-6, DOWN, LV1);
-		PIN(IN, gpf1-7, DOWN, LV1);
-
-		PIN(IN, gpf2-0, DOWN, LV1);
-		PIN(IN, gpf2-1, DOWN, LV1);
-		PIN(IN, gpf2-2, DOWN, LV1);
-		PIN(IN, gpf2-3, DOWN, LV1);
-
-		PIN(IN, gpf3-0, DOWN, LV1);
-		PIN(IN, gpf3-1, DOWN, LV1);
-		PIN(IN, gpf3-2, NONE, LV1);
-		PIN(IN, gpf3-3, DOWN, LV1);
-
-		PIN(IN, gpf4-0, DOWN, LV1);
-		PIN(IN, gpf4-1, DOWN, LV1);
-		PIN(IN, gpf4-2, DOWN, LV1);
-		PIN(IN, gpf4-3, DOWN, LV1);
-		PIN(IN, gpf4-4, DOWN, LV1);
-		PIN(IN, gpf4-5, DOWN, LV1);
-		PIN(IN, gpf4-6, DOWN, LV1);
-		PIN(IN, gpf4-7, DOWN, LV1);
-
-		PIN(IN, gpf5-0, DOWN, LV1);
-		PIN(IN, gpf5-1, DOWN, LV1);
-		PIN(IN, gpf5-2, DOWN, LV1);
-		PIN(IN, gpf5-3, DOWN, LV1);
-		PIN(OUT, gpf5-4, NONE, LV1);
-		PIN(IN, gpf5-5, DOWN, LV1);
-		PIN(IN, gpf5-6, DOWN, LV1);
-		PIN(IN, gpf5-7, DOWN, LV1);
-	};
-
-	te_irq: te_irq {
-		samsung,pins = "gpf1-3";
-		samsung,pin-function = <0xf>;
-	};
-};
-
-&pinctrl_cpif {
-	pinctrl-names = "default";
-	pinctrl-0 = <&initial_cpif>;
-
-	initial_cpif: initial-state {
-		PIN(IN, gpv6-0, DOWN, LV1);
-		PIN(IN, gpv6-1, DOWN, LV1);
-	};
-};
-
-&pinctrl_ese {
-	pinctrl-names = "default";
-	pinctrl-0 = <&initial_ese>;
-
-	initial_ese: initial-state {
-		PIN(IN, gpj2-0, DOWN, LV1);
-		PIN(IN, gpj2-1, DOWN, LV1);
-		PIN(IN, gpj2-2, DOWN, LV1);
-	};
-};
-
-&pinctrl_fsys {
-	pinctrl-names = "default";
-	pinctrl-0 = <&initial_fsys>;
-
-	initial_fsys: initial-state {
-		PIN(IN, gpr3-0, NONE, LV1);
-		PIN(IN, gpr3-1, DOWN, LV1);
-		PIN(IN, gpr3-2, DOWN, LV1);
-		PIN(IN, gpr3-3, DOWN, LV1);
-		PIN(IN, gpr3-7, NONE, LV1);
-	};
-};
-
-&pinctrl_imem {
-	pinctrl-names = "default";
-	pinctrl-0 = <&initial_imem>;
-
-	initial_imem: initial-state {
-		PIN(IN, gpf0-0, UP, LV1);
-		PIN(IN, gpf0-1, UP, LV1);
-		PIN(IN, gpf0-2, DOWN, LV1);
-		PIN(IN, gpf0-3, UP, LV1);
-		PIN(IN, gpf0-4, DOWN, LV1);
-		PIN(IN, gpf0-5, NONE, LV1);
-		PIN(IN, gpf0-6, DOWN, LV1);
-		PIN(IN, gpf0-7, UP, LV1);
-	};
-};
-
-&pinctrl_nfc {
-	pinctrl-names = "default";
-	pinctrl-0 = <&initial_nfc>;
-
-	initial_nfc: initial-state {
-		PIN(IN, gpj0-2, DOWN, LV1);
-	};
-};
-
-&pinctrl_peric {
-	pinctrl-names = "default";
-	pinctrl-0 = <&initial_peric>;
-
-	initial_peric: initial-state {
-		PIN(IN, gpv7-0, DOWN, LV1);
-		PIN(IN, gpv7-1, DOWN, LV1);
-		PIN(IN, gpv7-2, NONE, LV1);
-		PIN(IN, gpv7-3, DOWN, LV1);
-		PIN(IN, gpv7-4, DOWN, LV1);
-		PIN(IN, gpv7-5, DOWN, LV1);
-
-		PIN(IN, gpb0-4, DOWN, LV1);
-
-		PIN(IN, gpc0-2, DOWN, LV1);
-		PIN(IN, gpc0-5, DOWN, LV1);
-		PIN(IN, gpc0-7, DOWN, LV1);
-
-		PIN(IN, gpc1-1, DOWN, LV1);
-
-		PIN(IN, gpc3-4, NONE, LV1);
-		PIN(IN, gpc3-5, NONE, LV1);
-		PIN(IN, gpc3-6, NONE, LV1);
-		PIN(IN, gpc3-7, NONE, LV1);
-
-		PIN(OUT, gpg0-0, NONE, LV1);
-		PIN(FUNC1, gpg0-1, DOWN, LV1);
-
-		PIN(IN, gpd2-5, DOWN, LV1);
-
-		PIN(IN, gpd4-0, NONE, LV1);
-		PIN(IN, gpd4-1, DOWN, LV1);
-		PIN(IN, gpd4-2, DOWN, LV1);
-		PIN(IN, gpd4-3, DOWN, LV1);
-		PIN(IN, gpd4-4, DOWN, LV1);
-
-		PIN(IN, gpd6-3, DOWN, LV1);
-
-		PIN(IN, gpd8-1, UP, LV1);
-
-		PIN(IN, gpg1-0, DOWN, LV1);
-		PIN(IN, gpg1-1, DOWN, LV1);
-		PIN(IN, gpg1-2, DOWN, LV1);
-		PIN(IN, gpg1-3, DOWN, LV1);
-		PIN(IN, gpg1-4, DOWN, LV1);
-
-		PIN(IN, gpg2-0, DOWN, LV1);
-		PIN(IN, gpg2-1, DOWN, LV1);
-
-		PIN(IN, gpg3-0, DOWN, LV1);
-		PIN(IN, gpg3-1, DOWN, LV1);
-		PIN(IN, gpg3-5, DOWN, LV1);
-		PIN(IN, gpg3-7, DOWN, LV1);
-	};
-};
-
-&pinctrl_touch {
-	pinctrl-names = "default";
-	pinctrl-0 = <&initial_touch>;
-
-	initial_touch: initial-state {
-		PIN(IN, gpj1-2, DOWN, LV1);
-	};
-};
-
-&pwm {
-	pinctrl-0 = <&pwm0_out>;
-	pinctrl-names = "default";
-	status = "okay";
-};
-
-&mic {
-	status = "okay";
-
-	i80-if-timings {
-	};
-};
-
-&pmu_system_controller {
-	assigned-clocks = <&pmu_system_controller 0>;
-	assigned-clock-parents = <&xxti>;
-};
-
-&serial_1 {
-	status = "okay";
-};
-
-&spi_1 {
-	cs-gpios = <&gpd6 3 GPIO_ACTIVE_HIGH>;
-	status = "okay";
-
-	wm5110: wm5110-codec@0 {
-		compatible = "wlf,wm5110";
-		reg = <0x0>;
-		spi-max-frequency = <20000000>;
-		interrupt-parent = <&gpa0>;
-		interrupts = <4 IRQ_TYPE_NONE>;
-		clocks = <&pmu_system_controller 0>,
-			<&s2mps13_osc S2MPS11_CLK_BT>;
-		clock-names = "mclk1", "mclk2";
-
-		gpio-controller;
-		#gpio-cells = <2>;
-
-		wlf,micd-detect-debounce = <300>;
-		wlf,micd-bias-start-time = <0x1>;
-		wlf,micd-rate = <0x7>;
-		wlf,micd-dbtime = <0x1>;
-		wlf,micd-force-micbias;
-		wlf,micd-configs = <0x0 1 0>;
-		wlf,hpdet-channel = <1>;
-		wlf,gpsw = <0x1>;
-		wlf,inmode = <2 0 2 0>;
-
-		wlf,reset = <&gpc0 7 GPIO_ACTIVE_HIGH>;
-		wlf,ldoena = <&gpf0 0 GPIO_ACTIVE_HIGH>;
-
-		/* core supplies */
-		AVDD-supply = <&ldo18_reg>;
-		DBVDD1-supply = <&ldo18_reg>;
-		CPVDD-supply = <&ldo18_reg>;
-		DBVDD2-supply = <&ldo18_reg>;
-		DBVDD3-supply = <&ldo18_reg>;
-
-		controller-data {
-			samsung,spi-feedback-delay = <0>;
-		};
-	};
-};
-
-&timer {
-	clock-frequency = <24000000>;
-};
-
-&tmu_atlas0 {
-	vtmu-supply = <&ldo3_reg>;
-	status = "okay";
-};
-
-&tmu_apollo {
-	vtmu-supply = <&ldo3_reg>;
-	status = "okay";
-};
-
-&tmu_g3d {
-	vtmu-supply = <&ldo3_reg>;
-	status = "okay";
-};
-
-&usbdrd30 {
-	vdd33-supply = <&ldo10_reg>;
-	vdd10-supply = <&ldo6_reg>;
-	status = "okay";
-};
-
-&usbdrd_dwc3_0 {
-	dr_mode = "otg";
-};
-
-&usbdrd30_phy {
-	vbus-supply = <&safeout1_reg>;
-	status = "okay";
-};
-
-&xxti {
-	clock-frequency = <24000000>;
-};
diff --git a/arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts b/arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts
index 1db4e7f..81fdbef 100644
--- a/arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts
+++ b/arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts
@@ -11,7 +11,7 @@
  * published by the Free Software Foundation.
  */
 
-#include "exynos5433-tm2.dts"
+#include "exynos5433-tm2-common.dtsi"
 
 / {
 	model = "Samsung TM2E board";
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
@ 2017-01-03  7:57       ` Jaechul Lee
  0 siblings, 0 replies; 61+ messages in thread
From: Jaechul Lee @ 2017-01-03  7:57 UTC (permalink / raw)
  To: linux-arm-kernel

From: Andi Shyti <andi.shyti@samsung.com>

Currently tm2e dts includes tm2 but there are some differences
between the two boards and tm2 has some properties that tm2e
doesn't have.

That's why it's important to keep the two dts files independent
and put all the commonalities in a tm2-common.dtsi file.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
---
 .../boot/dts/exynos/exynos5433-tm2-common.dtsi     | 1046 ++++++++++++++++++++
 arch/arm64/boot/dts/exynos/exynos5433-tm2.dts      | 1033 +------------------
 arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts     |    2 +-
 3 files changed, 1049 insertions(+), 1032 deletions(-)
 create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi

diff --git a/arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi b/arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
new file mode 100644
index 0000000..3d36717
--- /dev/null
+++ b/arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
@@ -0,0 +1,1046 @@
+/*
+ * SAMSUNG Exynos5433 TM2 board device tree source
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Device tree source file for Samsung's TM2 board which is based on
+ * Samsung Exynos5433 SoC.
+ *
+ * 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.
+ */
+
+/dts-v1/;
+#include "exynos5433.dtsi"
+#include <dt-bindings/clock/samsung,s2mps11.h>
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/ {
+	aliases {
+		gsc0 = &gsc_0;
+		gsc1 = &gsc_1;
+		gsc2 = &gsc_2;
+		pinctrl0 = &pinctrl_alive;
+		pinctrl1 = &pinctrl_aud;
+		pinctrl2 = &pinctrl_cpif;
+		pinctrl3 = &pinctrl_ese;
+		pinctrl4 = &pinctrl_finger;
+		pinctrl5 = &pinctrl_fsys;
+		pinctrl6 = &pinctrl_imem;
+		pinctrl7 = &pinctrl_nfc;
+		pinctrl8 = &pinctrl_peric;
+		pinctrl9 = &pinctrl_touch;
+		serial0 = &serial_0;
+		serial1 = &serial_1;
+		serial2 = &serial_2;
+		serial3 = &serial_3;
+		spi0 = &spi_0;
+		spi1 = &spi_1;
+		spi2 = &spi_2;
+		spi3 = &spi_3;
+		spi4 = &spi_4;
+		mshc0 = &mshc_0;
+		mshc2 = &mshc_2;
+	};
+
+	chosen {
+		stdout-path = &serial_1;
+	};
+
+	memory at 20000000 {
+		device_type = "memory";
+		reg = <0x0 0x20000000 0x0 0xc0000000>;
+	};
+
+	gpio-keys {
+		compatible = "gpio-keys";
+
+		power-key {
+			gpios = <&gpa2 7 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_POWER>;
+			label = "power key";
+			debounce-interval = <10>;
+		};
+
+		volume-up-key {
+			gpios = <&gpa2 0 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_VOLUMEUP>;
+			label = "volume-up key";
+			debounce-interval = <10>;
+		};
+
+		volume-down-key {
+			gpios = <&gpa2 1 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_VOLUMEDOWN>;
+			label = "volume-down key";
+			debounce-interval = <10>;
+		};
+
+		homepage-key {
+			gpios = <&gpa0 3 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_MENU>;
+			label = "homepage key";
+			debounce-interval = <10>;
+		};
+	};
+
+	i2c_max98504: i2c-gpio-0 {
+		compatible = "i2c-gpio";
+		gpios = <&gpd0 1 GPIO_ACTIVE_HIGH /* SPK_AMP_SDA */
+			 &gpd0 0 GPIO_ACTIVE_HIGH /* SPK_AMP_SCL */ >;
+		i2c-gpio,delay-us = <2>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		status = "okay";
+
+		max98504: max98504 at 31 {
+			compatible = "maxim,max98504";
+			reg = <0x31>;
+			maxim,rx-path = <1>;
+			maxim,tx-path = <1>;
+			maxim,tx-channel-mask = <3>;
+			maxim,tx-channel-source = <2>;
+		};
+	};
+
+	sound {
+		compatible = "samsung,tm2-audio";
+		audio-codec = <&wm5110>;
+		i2s-controller = <&i2s0>;
+		audio-amplifier = <&max98504>;
+		mic-bias-gpios = <&gpr3 2 GPIO_ACTIVE_HIGH>;
+		model = "wm5110";
+		samsung,audio-routing =
+			/* Headphone */
+			"HP", "HPOUT1L",
+			"HP", "HPOUT1R",
+
+			/* Speaker */
+			"SPK", "SPKOUT",
+			"SPKOUT", "HPOUT2L",
+			"SPKOUT", "HPOUT2R",
+
+			/* Receiver */
+			"RCV", "HPOUT3L",
+			"RCV", "HPOUT3R";
+		status = "okay";
+	};
+};
+
+&adc {
+	vdd-supply = <&ldo3_reg>;
+	status = "okay";
+
+	thermistor-ap {
+		compatible = "murata,ncp03wf104";
+		pullup-uv = <1800000>;
+		pullup-ohm = <100000>;
+		pulldown-ohm = <0>;
+		io-channels = <&adc 0>;
+	};
+
+	thermistor-battery {
+		compatible = "murata,ncp03wf104";
+		pullup-uv = <1800000>;
+		pullup-ohm = <100000>;
+		pulldown-ohm = <0>;
+		io-channels = <&adc 1>;
+		#thermal-sensor-cells = <0>;
+	};
+
+	thermistor-charger {
+		compatible = "murata,ncp03wf104";
+		pullup-uv = <1800000>;
+		pullup-ohm = <100000>;
+		pulldown-ohm = <0>;
+		io-channels = <&adc 2>;
+	};
+};
+
+&cmu_aud {
+	assigned-clocks = <&cmu_aud CLK_MOUT_AUD_PLL_USER>;
+	assigned-clock-parents = <&cmu_top CLK_FOUT_AUD_PLL>;
+};
+
+&cmu_fsys {
+	assigned-clocks = <&cmu_top CLK_MOUT_SCLK_USBDRD30>,
+		<&cmu_top CLK_MOUT_SCLK_USBHOST30>,
+		<&cmu_fsys CLK_MOUT_SCLK_USBDRD30_USER>,
+		<&cmu_fsys CLK_MOUT_SCLK_USBHOST30_USER>,
+		<&cmu_fsys CLK_MOUT_PHYCLK_USBDRD30_UDRD30_PIPE_PCLK_USER>,
+		<&cmu_fsys CLK_MOUT_PHYCLK_USBHOST30_UHOST30_PIPE_PCLK_USER>,
+		<&cmu_fsys CLK_MOUT_PHYCLK_USBDRD30_UDRD30_PHYCLOCK_USER>,
+		<&cmu_fsys CLK_MOUT_PHYCLK_USBHOST30_UHOST30_PHYCLOCK_USER>,
+		<&cmu_top CLK_DIV_SCLK_USBDRD30>,
+		<&cmu_top CLK_DIV_SCLK_USBHOST30>;
+	assigned-clock-parents = <&cmu_top CLK_MOUT_BUS_PLL_USER>,
+		<&cmu_top CLK_MOUT_BUS_PLL_USER>,
+		<&cmu_top CLK_SCLK_USBDRD30_FSYS>,
+		<&cmu_top CLK_SCLK_USBHOST30_FSYS>,
+		<&cmu_fsys CLK_PHYCLK_USBDRD30_UDRD30_PIPE_PCLK_PHY>,
+		<&cmu_fsys CLK_PHYCLK_USBHOST30_UHOST30_PIPE_PCLK_PHY>,
+		<&cmu_fsys CLK_PHYCLK_USBDRD30_UDRD30_PHYCLOCK_PHY>,
+		<&cmu_fsys CLK_PHYCLK_USBHOST30_UHOST30_PHYCLOCK_PHY>;
+	assigned-clock-rates = <0>, <0>, <0>, <0>, <0>, <0>, <0>, <0>,
+			       <66700000>, <66700000>;
+};
+
+&cmu_gscl {
+	assigned-clocks = <&cmu_gscl CLK_MOUT_ACLK_GSCL_111_USER>,
+			  <&cmu_gscl CLK_MOUT_ACLK_GSCL_333_USER>;
+	assigned-clock-parents = <&cmu_top CLK_ACLK_GSCL_111>,
+				 <&cmu_top CLK_ACLK_GSCL_333>;
+};
+
+&cmu_mfc {
+	assigned-clocks = <&cmu_mfc CLK_MOUT_ACLK_MFC_400_USER>;
+	assigned-clock-parents = <&cmu_top CLK_ACLK_MFC_400>;
+};
+
+&cmu_mscl {
+	assigned-clocks = <&cmu_mscl CLK_MOUT_ACLK_MSCL_400_USER>,
+			  <&cmu_mscl CLK_MOUT_SCLK_JPEG_USER>,
+			  <&cmu_mscl CLK_MOUT_SCLK_JPEG>,
+			  <&cmu_top CLK_MOUT_SCLK_JPEG_A>;
+	assigned-clock-parents = <&cmu_top CLK_ACLK_MSCL_400>,
+				 <&cmu_top CLK_SCLK_JPEG_MSCL>,
+				 <&cmu_mscl CLK_MOUT_SCLK_JPEG_USER>,
+				 <&cmu_top CLK_MOUT_BUS_PLL_USER>;
+};
+
+&cpu0 {
+	cpu-supply = <&buck3_reg>;
+};
+
+&cpu4 {
+	cpu-supply = <&buck2_reg>;
+};
+
+&decon {
+	status = "okay";
+
+	i80-if-timings {
+	};
+};
+
+&dsi {
+	status = "okay";
+	vddcore-supply = <&ldo6_reg>;
+	vddio-supply = <&ldo7_reg>;
+	samsung,pll-clock-frequency = <24000000>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&te_irq>;
+
+	ports {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		port at 1 {
+			reg = <1>;
+
+			dsi_out: endpoint {
+				samsung,burst-clock-frequency = <512000000>;
+				samsung,esc-clock-frequency = <16000000>;
+			};
+		};
+	};
+};
+
+&hsi2c_0 {
+	status = "okay";
+	clock-frequency = <2500000>;
+
+	s2mps13-pmic at 66 {
+		compatible = "samsung,s2mps13-pmic";
+		interrupt-parent = <&gpa0>;
+		interrupts = <7 IRQ_TYPE_NONE>;
+		reg = <0x66>;
+		samsung,s2mps11-wrstbi-ground;
+
+		s2mps13_osc: clocks {
+			compatible = "samsung,s2mps13-clk";
+			#clock-cells = <1>;
+			clock-output-names = "s2mps13_ap", "s2mps13_cp",
+				"s2mps13_bt";
+		};
+
+		regulators {
+			ldo1_reg: LDO1 {
+				regulator-name = "VDD_ALIVE_0.9V_AP";
+				regulator-min-microvolt = <900000>;
+				regulator-max-microvolt = <900000>;
+				regulator-always-on;
+			};
+
+			ldo2_reg: LDO2 {
+				regulator-name = "VDDQ_MMC2_2.8V_AP";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			ldo3_reg: LDO3 {
+				regulator-name = "VDD1_E_1.8V_AP";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-always-on;
+			};
+
+			ldo4_reg: LDO4 {
+				regulator-name = "VDD10_MIF_PLL_1.0V_AP";
+				regulator-min-microvolt = <1300000>;
+				regulator-max-microvolt = <1300000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			ldo5_reg: LDO5 {
+				regulator-name = "VDD10_DPLL_1.0V_AP";
+				regulator-min-microvolt = <1000000>;
+				regulator-max-microvolt = <1000000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			ldo6_reg: LDO6 {
+				regulator-name = "VDD10_MIPI2L_1.0V_AP";
+				regulator-min-microvolt = <1000000>;
+				regulator-max-microvolt = <1000000>;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			ldo7_reg: LDO7 {
+				regulator-name = "VDD18_MIPI2L_1.8V_AP";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+			};
+
+			ldo8_reg: LDO8 {
+				regulator-name = "VDD18_LLI_1.8V_AP";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			ldo9_reg: LDO9 {
+				regulator-name = "VDD18_ABB_ETC_1.8V_AP";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			ldo10_reg: LDO10 {
+				regulator-name = "VDD33_USB30_3.0V_AP";
+				regulator-min-microvolt = <3000000>;
+				regulator-max-microvolt = <3000000>;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			ldo11_reg: LDO11 {
+				regulator-name = "VDD_INT_M_1.0V_AP";
+				regulator-min-microvolt = <1000000>;
+				regulator-max-microvolt = <1000000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			ldo12_reg: LDO12 {
+				regulator-name = "VDD_KFC_M_1.1V_AP";
+				regulator-min-microvolt = <800000>;
+				regulator-max-microvolt = <1350000>;
+				regulator-always-on;
+			};
+
+			ldo13_reg: LDO13 {
+				regulator-name = "VDD_G3D_M_0.95V_AP";
+				regulator-min-microvolt = <950000>;
+				regulator-max-microvolt = <950000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			ldo14_reg: LDO14 {
+				regulator-name = "VDDQ_M1_LDO_1.2V_AP";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <1200000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			ldo15_reg: LDO15 {
+				regulator-name = "VDDQ_M2_LDO_1.2V_AP";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <1200000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			ldo16_reg: LDO16 {
+				regulator-name = "VDDQ_EFUSE";
+				regulator-min-microvolt = <1400000>;
+				regulator-max-microvolt = <3400000>;
+				regulator-always-on;
+			};
+
+			ldo17_reg: LDO17 {
+				regulator-name = "V_TFLASH_2.8V_AP";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+			};
+
+			ldo18_reg: LDO18 {
+				regulator-name = "V_CODEC_1.8V_AP";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+			};
+
+			ldo19_reg: LDO19 {
+				regulator-name = "VDDA_1.8V_COMP";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-always-on;
+			};
+
+			ldo20_reg: LDO20 {
+				regulator-name = "VCC_2.8V_AP";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+				regulator-always-on;
+			};
+
+			ldo21_reg: LDO21 {
+				regulator-name = "VT_CAM_1.8V";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+			};
+
+			ldo22_reg: LDO22 {
+				regulator-name = "CAM_IO_1.8V_AP";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+			};
+
+			ldo23_reg: LDO23 {
+				regulator-name = "CAM_SEN_CORE_1.2V_AP";
+				regulator-min-microvolt = <1050000>;
+				regulator-max-microvolt = <1200000>;
+			};
+
+			ldo24_reg: LDO24 {
+				regulator-name = "VT_CAM_1.2V";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <1200000>;
+			};
+
+			ldo25_reg: LDO25 {
+				regulator-name = "CAM_SEN_A2.8V_AP";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+			};
+
+			ldo26_reg: LDO26 {
+				regulator-name = "CAM_AF_2.8V_AP";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+			};
+
+			ldo27_reg: LDO27 {
+				regulator-name = "VCC_3.0V_LCD_AP";
+				regulator-min-microvolt = <3000000>;
+				regulator-max-microvolt = <3000000>;
+			};
+
+			ldo28_reg: LDO28 {
+				regulator-name = "VCC_1.8V_LCD_AP";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+			};
+
+			ldo29_reg: LDO29 {
+				regulator-name = "VT_CAM_2.8V";
+				regulator-min-microvolt = <3000000>;
+				regulator-max-microvolt = <3000000>;
+			};
+
+			ldo30_reg: LDO30 {
+				regulator-name = "TSP_AVDD_3.3V_AP";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+			};
+
+			ldo31_reg: LDO31 {
+				regulator-name = "TSP_VDD_1.85V_AP";
+				regulator-min-microvolt = <1850000>;
+				regulator-max-microvolt = <1850000>;
+			};
+
+			ldo32_reg: LDO32 {
+				regulator-name = "VTOUCH_1.8V_AP";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+			};
+
+			ldo33_reg: LDO33 {
+				regulator-name = "VTOUCH_LED_3.3V";
+				regulator-min-microvolt = <2500000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-ramp-delay = <12500>;
+			};
+
+			ldo34_reg: LDO34 {
+				regulator-name = "VCC_1.8V_MHL_AP";
+				regulator-min-microvolt = <1000000>;
+				regulator-max-microvolt = <2100000>;
+			};
+
+			ldo35_reg: LDO35 {
+				regulator-name = "OIS_VM_2.8V";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <2800000>;
+			};
+
+			ldo36_reg: LDO36 {
+				regulator-name = "VSIL_1.0V";
+				regulator-min-microvolt = <1000000>;
+				regulator-max-microvolt = <1000000>;
+			};
+
+			ldo37_reg: LDO37 {
+				regulator-name = "VF_1.8V";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+			};
+
+			ldo38_reg: LDO38 {
+				regulator-name = "VCC_3.0V_MOTOR_AP";
+				regulator-min-microvolt = <3000000>;
+				regulator-max-microvolt = <3000000>;
+			};
+
+			ldo39_reg: LDO39 {
+				regulator-name = "V_HRM_1.8V";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+			};
+
+			ldo40_reg: LDO40 {
+				regulator-name = "V_HRM_3.3V";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+			};
+
+			buck1_reg: BUCK1 {
+				regulator-name = "VDD_MIF_0.9V_AP";
+				regulator-min-microvolt = <600000>;
+				regulator-max-microvolt = <1500000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			buck2_reg: BUCK2 {
+				regulator-name = "VDD_EGL_1.0V_AP";
+				regulator-min-microvolt = <900000>;
+				regulator-max-microvolt = <1300000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			buck3_reg: BUCK3 {
+				regulator-name = "VDD_KFC_1.0V_AP";
+				regulator-min-microvolt = <800000>;
+				regulator-max-microvolt = <1200000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			buck4_reg: BUCK4 {
+				regulator-name = "VDD_INT_0.95V_AP";
+				regulator-min-microvolt = <600000>;
+				regulator-max-microvolt = <1500000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			buck5_reg: BUCK5 {
+				regulator-name = "VDD_DISP_CAM0_0.9V_AP";
+				regulator-min-microvolt = <600000>;
+				regulator-max-microvolt = <1500000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			buck6_reg: BUCK6 {
+				regulator-name = "VDD_G3D_0.9V_AP";
+				regulator-min-microvolt = <600000>;
+				regulator-max-microvolt = <1500000>;
+				regulator-always-on;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			buck7_reg: BUCK7 {
+				regulator-name = "VDD_MEM1_1.2V_AP";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <1200000>;
+				regulator-always-on;
+			};
+
+			buck8_reg: BUCK8 {
+				regulator-name = "VDD_LLDO_1.35V_AP";
+				regulator-min-microvolt = <1350000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-always-on;
+			};
+
+			buck9_reg: BUCK9 {
+				regulator-name = "VDD_MLDO_2.0V_AP";
+				regulator-min-microvolt = <1350000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-always-on;
+			};
+
+			buck10_reg: BUCK10 {
+				regulator-name = "vdd_mem2";
+				regulator-min-microvolt = <550000>;
+				regulator-max-microvolt = <1500000>;
+				regulator-always-on;
+			};
+		};
+	};
+};
+
+&hsi2c_8 {
+	status = "okay";
+
+	max77843 at 66 {
+		compatible = "maxim,max77843";
+		interrupt-parent = <&gpa1>;
+		interrupts = <5 IRQ_TYPE_EDGE_FALLING>;
+		reg = <0x66>;
+
+		muic: max77843-muic {
+			compatible = "maxim,max77843-muic";
+		};
+
+		regulators {
+			compatible = "maxim,max77843-regulator";
+			safeout1_reg: SAFEOUT1 {
+				regulator-name = "SAFEOUT1";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <4950000>;
+			};
+
+			safeout2_reg: SAFEOUT2 {
+				regulator-name = "SAFEOUT2";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <4950000>;
+			};
+
+			charger_reg: CHARGER {
+				regulator-name = "CHARGER";
+				regulator-min-microamp = <100000>;
+				regulator-max-microamp = <3150000>;
+			};
+		};
+
+		haptic: max77843-haptic {
+			compatible = "maxim,max77843-haptic";
+			haptic-supply = <&ldo38_reg>;
+			pwms = <&pwm 0 33670 0>;
+			pwm-names = "haptic";
+		};
+	};
+};
+
+&i2s0 {
+	status = "okay";
+};
+
+&mshc_0 {
+	status = "okay";
+	num-slots = <1>;
+	mmc-hs200-1_8v;
+	mmc-hs400-1_8v;
+	cap-mmc-highspeed;
+	non-removable;
+	card-detect-delay = <200>;
+	samsung,dw-mshc-ciu-div = <3>;
+	samsung,dw-mshc-sdr-timing = <0 4>;
+	samsung,dw-mshc-ddr-timing = <0 2>;
+	samsung,dw-mshc-hs400-timing = <0 3>;
+	samsung,read-strobe-delay = <90>;
+	fifo-depth = <0x80>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_qrdy &sd0_bus1 &sd0_bus4
+			&sd0_bus8 &sd0_rdqs>;
+	bus-width = <8>;
+	assigned-clocks = <&cmu_top CLK_SCLK_MMC0_FSYS>;
+	assigned-clock-rates = <800000000>;
+};
+
+&mshc_2 {
+	status = "okay";
+	num-slots = <1>;
+	cap-sd-highspeed;
+	disable-wp;
+	cd-gpios = <&gpa2 4 GPIO_ACTIVE_HIGH>;
+	cd-inverted;
+	card-detect-delay = <200>;
+	samsung,dw-mshc-ciu-div = <3>;
+	samsung,dw-mshc-sdr-timing = <0 4>;
+	samsung,dw-mshc-ddr-timing = <0 2>;
+	fifo-depth = <0x80>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_bus1 &sd2_bus4>;
+	bus-width = <4>;
+};
+
+&pinctrl_alive {
+	pinctrl-names = "default";
+	pinctrl-0 = <&initial_alive>;
+
+	initial_alive: initial-state {
+		PIN(IN, gpa0-0, DOWN, LV1);
+		PIN(IN, gpa0-1, NONE, LV1);
+		PIN(IN, gpa0-2, DOWN, LV1);
+		PIN(IN, gpa0-3, NONE, LV1);
+		PIN(IN, gpa0-4, NONE, LV1);
+		PIN(IN, gpa0-5, DOWN, LV1);
+		PIN(IN, gpa0-6, NONE, LV1);
+		PIN(IN, gpa0-7, NONE, LV1);
+
+		PIN(IN, gpa1-0, UP, LV1);
+		PIN(IN, gpa1-1, NONE, LV1);
+		PIN(IN, gpa1-2, NONE, LV1);
+		PIN(IN, gpa1-3, DOWN, LV1);
+		PIN(IN, gpa1-4, DOWN, LV1);
+		PIN(IN, gpa1-5, NONE, LV1);
+		PIN(IN, gpa1-6, NONE, LV1);
+		PIN(IN, gpa1-7, NONE, LV1);
+
+		PIN(IN, gpa2-0, NONE, LV1);
+		PIN(IN, gpa2-1, NONE, LV1);
+		PIN(IN, gpa2-2, NONE, LV1);
+		PIN(IN, gpa2-3, DOWN, LV1);
+		PIN(IN, gpa2-4, NONE, LV1);
+		PIN(IN, gpa2-5, DOWN, LV1);
+		PIN(IN, gpa2-6, DOWN, LV1);
+		PIN(IN, gpa2-7, NONE, LV1);
+
+		PIN(IN, gpa3-0, DOWN, LV1);
+		PIN(IN, gpa3-1, DOWN, LV1);
+		PIN(IN, gpa3-2, NONE, LV1);
+		PIN(IN, gpa3-3, DOWN, LV1);
+		PIN(IN, gpa3-4, NONE, LV1);
+		PIN(IN, gpa3-5, DOWN, LV1);
+		PIN(IN, gpa3-6, DOWN, LV1);
+		PIN(IN, gpa3-7, DOWN, LV1);
+
+		PIN(IN, gpf1-0, NONE, LV1);
+		PIN(IN, gpf1-1, NONE, LV1);
+		PIN(IN, gpf1-2, DOWN, LV1);
+		PIN(IN, gpf1-4, UP, LV1);
+		PIN(OUT, gpf1-5, NONE, LV1);
+		PIN(IN, gpf1-6, DOWN, LV1);
+		PIN(IN, gpf1-7, DOWN, LV1);
+
+		PIN(IN, gpf2-0, DOWN, LV1);
+		PIN(IN, gpf2-1, DOWN, LV1);
+		PIN(IN, gpf2-2, DOWN, LV1);
+		PIN(IN, gpf2-3, DOWN, LV1);
+
+		PIN(IN, gpf3-0, DOWN, LV1);
+		PIN(IN, gpf3-1, DOWN, LV1);
+		PIN(IN, gpf3-2, NONE, LV1);
+		PIN(IN, gpf3-3, DOWN, LV1);
+
+		PIN(IN, gpf4-0, DOWN, LV1);
+		PIN(IN, gpf4-1, DOWN, LV1);
+		PIN(IN, gpf4-2, DOWN, LV1);
+		PIN(IN, gpf4-3, DOWN, LV1);
+		PIN(IN, gpf4-4, DOWN, LV1);
+		PIN(IN, gpf4-5, DOWN, LV1);
+		PIN(IN, gpf4-6, DOWN, LV1);
+		PIN(IN, gpf4-7, DOWN, LV1);
+
+		PIN(IN, gpf5-0, DOWN, LV1);
+		PIN(IN, gpf5-1, DOWN, LV1);
+		PIN(IN, gpf5-2, DOWN, LV1);
+		PIN(IN, gpf5-3, DOWN, LV1);
+		PIN(OUT, gpf5-4, NONE, LV1);
+		PIN(IN, gpf5-5, DOWN, LV1);
+		PIN(IN, gpf5-6, DOWN, LV1);
+		PIN(IN, gpf5-7, DOWN, LV1);
+	};
+
+	te_irq: te_irq {
+		samsung,pins = "gpf1-3";
+		samsung,pin-function = <0xf>;
+	};
+};
+
+&pinctrl_cpif {
+	pinctrl-names = "default";
+	pinctrl-0 = <&initial_cpif>;
+
+	initial_cpif: initial-state {
+		PIN(IN, gpv6-0, DOWN, LV1);
+		PIN(IN, gpv6-1, DOWN, LV1);
+	};
+};
+
+&pinctrl_ese {
+	pinctrl-names = "default";
+	pinctrl-0 = <&initial_ese>;
+
+	initial_ese: initial-state {
+		PIN(IN, gpj2-0, DOWN, LV1);
+		PIN(IN, gpj2-1, DOWN, LV1);
+		PIN(IN, gpj2-2, DOWN, LV1);
+	};
+};
+
+&pinctrl_fsys {
+	pinctrl-names = "default";
+	pinctrl-0 = <&initial_fsys>;
+
+	initial_fsys: initial-state {
+		PIN(IN, gpr3-0, NONE, LV1);
+		PIN(IN, gpr3-1, DOWN, LV1);
+		PIN(IN, gpr3-2, DOWN, LV1);
+		PIN(IN, gpr3-3, DOWN, LV1);
+		PIN(IN, gpr3-7, NONE, LV1);
+	};
+};
+
+&pinctrl_imem {
+	pinctrl-names = "default";
+	pinctrl-0 = <&initial_imem>;
+
+	initial_imem: initial-state {
+		PIN(IN, gpf0-0, UP, LV1);
+		PIN(IN, gpf0-1, UP, LV1);
+		PIN(IN, gpf0-2, DOWN, LV1);
+		PIN(IN, gpf0-3, UP, LV1);
+		PIN(IN, gpf0-4, DOWN, LV1);
+		PIN(IN, gpf0-5, NONE, LV1);
+		PIN(IN, gpf0-6, DOWN, LV1);
+		PIN(IN, gpf0-7, UP, LV1);
+	};
+};
+
+&pinctrl_nfc {
+	pinctrl-names = "default";
+	pinctrl-0 = <&initial_nfc>;
+
+	initial_nfc: initial-state {
+		PIN(IN, gpj0-2, DOWN, LV1);
+	};
+};
+
+&pinctrl_peric {
+	pinctrl-names = "default";
+	pinctrl-0 = <&initial_peric>;
+
+	initial_peric: initial-state {
+		PIN(IN, gpv7-0, DOWN, LV1);
+		PIN(IN, gpv7-1, DOWN, LV1);
+		PIN(IN, gpv7-2, NONE, LV1);
+		PIN(IN, gpv7-3, DOWN, LV1);
+		PIN(IN, gpv7-4, DOWN, LV1);
+		PIN(IN, gpv7-5, DOWN, LV1);
+
+		PIN(IN, gpb0-4, DOWN, LV1);
+
+		PIN(IN, gpc0-2, DOWN, LV1);
+		PIN(IN, gpc0-5, DOWN, LV1);
+		PIN(IN, gpc0-7, DOWN, LV1);
+
+		PIN(IN, gpc1-1, DOWN, LV1);
+
+		PIN(IN, gpc3-4, NONE, LV1);
+		PIN(IN, gpc3-5, NONE, LV1);
+		PIN(IN, gpc3-6, NONE, LV1);
+		PIN(IN, gpc3-7, NONE, LV1);
+
+		PIN(OUT, gpg0-0, NONE, LV1);
+		PIN(FUNC1, gpg0-1, DOWN, LV1);
+
+		PIN(IN, gpd2-5, DOWN, LV1);
+
+		PIN(IN, gpd4-0, NONE, LV1);
+		PIN(IN, gpd4-1, DOWN, LV1);
+		PIN(IN, gpd4-2, DOWN, LV1);
+		PIN(IN, gpd4-3, DOWN, LV1);
+		PIN(IN, gpd4-4, DOWN, LV1);
+
+		PIN(IN, gpd6-3, DOWN, LV1);
+
+		PIN(IN, gpd8-1, UP, LV1);
+
+		PIN(IN, gpg1-0, DOWN, LV1);
+		PIN(IN, gpg1-1, DOWN, LV1);
+		PIN(IN, gpg1-2, DOWN, LV1);
+		PIN(IN, gpg1-3, DOWN, LV1);
+		PIN(IN, gpg1-4, DOWN, LV1);
+
+		PIN(IN, gpg2-0, DOWN, LV1);
+		PIN(IN, gpg2-1, DOWN, LV1);
+
+		PIN(IN, gpg3-0, DOWN, LV1);
+		PIN(IN, gpg3-1, DOWN, LV1);
+		PIN(IN, gpg3-5, DOWN, LV1);
+		PIN(IN, gpg3-7, DOWN, LV1);
+	};
+};
+
+&pinctrl_touch {
+	pinctrl-names = "default";
+	pinctrl-0 = <&initial_touch>;
+
+	initial_touch: initial-state {
+		PIN(IN, gpj1-2, DOWN, LV1);
+	};
+};
+
+&pwm {
+	pinctrl-0 = <&pwm0_out>;
+	pinctrl-names = "default";
+	status = "okay";
+};
+
+&mic {
+	status = "okay";
+
+	i80-if-timings {
+	};
+};
+
+&pmu_system_controller {
+	assigned-clocks = <&pmu_system_controller 0>;
+	assigned-clock-parents = <&xxti>;
+};
+
+&serial_1 {
+	status = "okay";
+};
+
+&spi_1 {
+	cs-gpios = <&gpd6 3 GPIO_ACTIVE_HIGH>;
+	status = "okay";
+
+	wm5110: wm5110-codec at 0 {
+		compatible = "wlf,wm5110";
+		reg = <0x0>;
+		spi-max-frequency = <20000000>;
+		interrupt-parent = <&gpa0>;
+		interrupts = <4 IRQ_TYPE_NONE>;
+		clocks = <&pmu_system_controller 0>,
+			<&s2mps13_osc S2MPS11_CLK_BT>;
+		clock-names = "mclk1", "mclk2";
+
+		gpio-controller;
+		#gpio-cells = <2>;
+
+		wlf,micd-detect-debounce = <300>;
+		wlf,micd-bias-start-time = <0x1>;
+		wlf,micd-rate = <0x7>;
+		wlf,micd-dbtime = <0x1>;
+		wlf,micd-force-micbias;
+		wlf,micd-configs = <0x0 1 0>;
+		wlf,hpdet-channel = <1>;
+		wlf,gpsw = <0x1>;
+		wlf,inmode = <2 0 2 0>;
+
+		wlf,reset = <&gpc0 7 GPIO_ACTIVE_HIGH>;
+		wlf,ldoena = <&gpf0 0 GPIO_ACTIVE_HIGH>;
+
+		/* core supplies */
+		AVDD-supply = <&ldo18_reg>;
+		DBVDD1-supply = <&ldo18_reg>;
+		CPVDD-supply = <&ldo18_reg>;
+		DBVDD2-supply = <&ldo18_reg>;
+		DBVDD3-supply = <&ldo18_reg>;
+
+		controller-data {
+			samsung,spi-feedback-delay = <0>;
+		};
+	};
+};
+
+&timer {
+	clock-frequency = <24000000>;
+};
+
+&tmu_atlas0 {
+	vtmu-supply = <&ldo3_reg>;
+	status = "okay";
+};
+
+&tmu_apollo {
+	vtmu-supply = <&ldo3_reg>;
+	status = "okay";
+};
+
+&tmu_g3d {
+	vtmu-supply = <&ldo3_reg>;
+	status = "okay";
+};
+
+&usbdrd30 {
+	vdd33-supply = <&ldo10_reg>;
+	vdd10-supply = <&ldo6_reg>;
+	status = "okay";
+};
+
+&usbdrd_dwc3_0 {
+	dr_mode = "otg";
+};
+
+&usbdrd30_phy {
+	vbus-supply = <&safeout1_reg>;
+	status = "okay";
+};
+
+&xxti {
+	clock-frequency = <24000000>;
+};
diff --git a/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts b/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts
index f21bdc2..887a1f1 100644
--- a/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts
+++ b/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts
@@ -11,1039 +11,10 @@
  * published by the Free Software Foundation.
  */
 
-/dts-v1/;
-#include "exynos5433.dtsi"
-#include <dt-bindings/clock/samsung,s2mps11.h>
-#include <dt-bindings/gpio/gpio.h>
-#include <dt-bindings/input/input.h>
-#include <dt-bindings/interrupt-controller/irq.h>
+#include "exynos5433-tm2-common.dtsi"
 
 / {
 	model = "Samsung TM2 board";
-	compatible = "samsung,tm2", "samsung,exynos5433";
-
-	aliases {
-		gsc0 = &gsc_0;
-		gsc1 = &gsc_1;
-		gsc2 = &gsc_2;
-		pinctrl0 = &pinctrl_alive;
-		pinctrl1 = &pinctrl_aud;
-		pinctrl2 = &pinctrl_cpif;
-		pinctrl3 = &pinctrl_ese;
-		pinctrl4 = &pinctrl_finger;
-		pinctrl5 = &pinctrl_fsys;
-		pinctrl6 = &pinctrl_imem;
-		pinctrl7 = &pinctrl_nfc;
-		pinctrl8 = &pinctrl_peric;
-		pinctrl9 = &pinctrl_touch;
-		serial0 = &serial_0;
-		serial1 = &serial_1;
-		serial2 = &serial_2;
-		serial3 = &serial_3;
-		spi0 = &spi_0;
-		spi1 = &spi_1;
-		spi2 = &spi_2;
-		spi3 = &spi_3;
-		spi4 = &spi_4;
-		mshc0 = &mshc_0;
-		mshc2 = &mshc_2;
-	};
-
-	chosen {
-		stdout-path = &serial_1;
-	};
-
-	memory at 20000000 {
-		device_type = "memory";
-		reg = <0x0 0x20000000 0x0 0xc0000000>;
-	};
-
-	gpio-keys {
-		compatible = "gpio-keys";
-
-		power-key {
-			gpios = <&gpa2 7 GPIO_ACTIVE_LOW>;
-			linux,code = <KEY_POWER>;
-			label = "power key";
-			debounce-interval = <10>;
-		};
-
-		volume-up-key {
-			gpios = <&gpa2 0 GPIO_ACTIVE_LOW>;
-			linux,code = <KEY_VOLUMEUP>;
-			label = "volume-up key";
-			debounce-interval = <10>;
-		};
-
-		volume-down-key {
-			gpios = <&gpa2 1 GPIO_ACTIVE_LOW>;
-			linux,code = <KEY_VOLUMEDOWN>;
-			label = "volume-down key";
-			debounce-interval = <10>;
-		};
-
-		homepage-key {
-			gpios = <&gpa0 3 GPIO_ACTIVE_LOW>;
-			linux,code = <KEY_MENU>;
-			label = "homepage key";
-			debounce-interval = <10>;
-		};
-	};
-
-	i2c_max98504: i2c-gpio-0 {
-		compatible = "i2c-gpio";
-		gpios = <&gpd0 1 GPIO_ACTIVE_HIGH /* SPK_AMP_SDA */
-			 &gpd0 0 GPIO_ACTIVE_HIGH /* SPK_AMP_SCL */ >;
-		i2c-gpio,delay-us = <2>;
-		#address-cells = <1>;
-		#size-cells = <0>;
-		status = "okay";
-
-		max98504: max98504 at 31 {
-			compatible = "maxim,max98504";
-			reg = <0x31>;
-			maxim,rx-path = <1>;
-			maxim,tx-path = <1>;
-			maxim,tx-channel-mask = <3>;
-			maxim,tx-channel-source = <2>;
-		};
-	};
-
-	sound {
-		compatible = "samsung,tm2-audio";
-		audio-codec = <&wm5110>;
-		i2s-controller = <&i2s0>;
-		audio-amplifier = <&max98504>;
-		mic-bias-gpios = <&gpr3 2 GPIO_ACTIVE_HIGH>;
-		model = "wm5110";
-		samsung,audio-routing =
-			/* Headphone */
-			"HP", "HPOUT1L",
-			"HP", "HPOUT1R",
-
-			/* Speaker */
-			"SPK", "SPKOUT",
-			"SPKOUT", "HPOUT2L",
-			"SPKOUT", "HPOUT2R",
-
-			/* Receiver */
-			"RCV", "HPOUT3L",
-			"RCV", "HPOUT3R";
-		status = "okay";
-	};
-};
-
-&adc {
-	vdd-supply = <&ldo3_reg>;
-	status = "okay";
-
-	thermistor-ap {
-		compatible = "murata,ncp03wf104";
-		pullup-uv = <1800000>;
-		pullup-ohm = <100000>;
-		pulldown-ohm = <0>;
-		io-channels = <&adc 0>;
-	};
-
-	thermistor-battery {
-		compatible = "murata,ncp03wf104";
-		pullup-uv = <1800000>;
-		pullup-ohm = <100000>;
-		pulldown-ohm = <0>;
-		io-channels = <&adc 1>;
-		#thermal-sensor-cells = <0>;
-	};
-
-	thermistor-charger {
-		compatible = "murata,ncp03wf104";
-		pullup-uv = <1800000>;
-		pullup-ohm = <100000>;
-		pulldown-ohm = <0>;
-		io-channels = <&adc 2>;
-	};
-};
-
-&cmu_aud {
-	assigned-clocks = <&cmu_aud CLK_MOUT_AUD_PLL_USER>;
-	assigned-clock-parents = <&cmu_top CLK_FOUT_AUD_PLL>;
-};
-
-&cmu_fsys {
-	assigned-clocks = <&cmu_top CLK_MOUT_SCLK_USBDRD30>,
-		<&cmu_top CLK_MOUT_SCLK_USBHOST30>,
-		<&cmu_fsys CLK_MOUT_SCLK_USBDRD30_USER>,
-		<&cmu_fsys CLK_MOUT_SCLK_USBHOST30_USER>,
-		<&cmu_fsys CLK_MOUT_PHYCLK_USBDRD30_UDRD30_PIPE_PCLK_USER>,
-		<&cmu_fsys CLK_MOUT_PHYCLK_USBHOST30_UHOST30_PIPE_PCLK_USER>,
-		<&cmu_fsys CLK_MOUT_PHYCLK_USBDRD30_UDRD30_PHYCLOCK_USER>,
-		<&cmu_fsys CLK_MOUT_PHYCLK_USBHOST30_UHOST30_PHYCLOCK_USER>,
-		<&cmu_top CLK_DIV_SCLK_USBDRD30>,
-		<&cmu_top CLK_DIV_SCLK_USBHOST30>;
-	assigned-clock-parents = <&cmu_top CLK_MOUT_BUS_PLL_USER>,
-		<&cmu_top CLK_MOUT_BUS_PLL_USER>,
-		<&cmu_top CLK_SCLK_USBDRD30_FSYS>,
-		<&cmu_top CLK_SCLK_USBHOST30_FSYS>,
-		<&cmu_fsys CLK_PHYCLK_USBDRD30_UDRD30_PIPE_PCLK_PHY>,
-		<&cmu_fsys CLK_PHYCLK_USBHOST30_UHOST30_PIPE_PCLK_PHY>,
-		<&cmu_fsys CLK_PHYCLK_USBDRD30_UDRD30_PHYCLOCK_PHY>,
-		<&cmu_fsys CLK_PHYCLK_USBHOST30_UHOST30_PHYCLOCK_PHY>;
-	assigned-clock-rates = <0>, <0>, <0>, <0>, <0>, <0>, <0>, <0>,
-			       <66700000>, <66700000>;
-};
-
-&cmu_gscl {
-	assigned-clocks = <&cmu_gscl CLK_MOUT_ACLK_GSCL_111_USER>,
-			  <&cmu_gscl CLK_MOUT_ACLK_GSCL_333_USER>;
-	assigned-clock-parents = <&cmu_top CLK_ACLK_GSCL_111>,
-				 <&cmu_top CLK_ACLK_GSCL_333>;
+	compatible = "samsung,tm2e", "samsung,exynos5433";
 };
 
-&cmu_mfc {
-	assigned-clocks = <&cmu_mfc CLK_MOUT_ACLK_MFC_400_USER>;
-	assigned-clock-parents = <&cmu_top CLK_ACLK_MFC_400>;
-};
-
-&cmu_mscl {
-	assigned-clocks = <&cmu_mscl CLK_MOUT_ACLK_MSCL_400_USER>,
-			  <&cmu_mscl CLK_MOUT_SCLK_JPEG_USER>,
-			  <&cmu_mscl CLK_MOUT_SCLK_JPEG>,
-			  <&cmu_top CLK_MOUT_SCLK_JPEG_A>;
-	assigned-clock-parents = <&cmu_top CLK_ACLK_MSCL_400>,
-				 <&cmu_top CLK_SCLK_JPEG_MSCL>,
-				 <&cmu_mscl CLK_MOUT_SCLK_JPEG_USER>,
-				 <&cmu_top CLK_MOUT_BUS_PLL_USER>;
-};
-
-&cpu0 {
-	cpu-supply = <&buck3_reg>;
-};
-
-&cpu4 {
-	cpu-supply = <&buck2_reg>;
-};
-
-&decon {
-	status = "okay";
-
-	i80-if-timings {
-	};
-};
-
-&dsi {
-	status = "okay";
-	vddcore-supply = <&ldo6_reg>;
-	vddio-supply = <&ldo7_reg>;
-	samsung,pll-clock-frequency = <24000000>;
-	pinctrl-names = "default";
-	pinctrl-0 = <&te_irq>;
-
-	ports {
-		#address-cells = <1>;
-		#size-cells = <0>;
-
-		port at 1 {
-			reg = <1>;
-
-			dsi_out: endpoint {
-				samsung,burst-clock-frequency = <512000000>;
-				samsung,esc-clock-frequency = <16000000>;
-			};
-		};
-	};
-};
-
-&hsi2c_0 {
-	status = "okay";
-	clock-frequency = <2500000>;
-
-	s2mps13-pmic at 66 {
-		compatible = "samsung,s2mps13-pmic";
-		interrupt-parent = <&gpa0>;
-		interrupts = <7 IRQ_TYPE_NONE>;
-		reg = <0x66>;
-		samsung,s2mps11-wrstbi-ground;
-
-		s2mps13_osc: clocks {
-			compatible = "samsung,s2mps13-clk";
-			#clock-cells = <1>;
-			clock-output-names = "s2mps13_ap", "s2mps13_cp",
-				"s2mps13_bt";
-		};
-
-		regulators {
-			ldo1_reg: LDO1 {
-				regulator-name = "VDD_ALIVE_0.9V_AP";
-				regulator-min-microvolt = <900000>;
-				regulator-max-microvolt = <900000>;
-				regulator-always-on;
-			};
-
-			ldo2_reg: LDO2 {
-				regulator-name = "VDDQ_MMC2_2.8V_AP";
-				regulator-min-microvolt = <2800000>;
-				regulator-max-microvolt = <2800000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			ldo3_reg: LDO3 {
-				regulator-name = "VDD1_E_1.8V_AP";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-always-on;
-			};
-
-			ldo4_reg: LDO4 {
-				regulator-name = "VDD10_MIF_PLL_1.0V_AP";
-				regulator-min-microvolt = <1300000>;
-				regulator-max-microvolt = <1300000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			ldo5_reg: LDO5 {
-				regulator-name = "VDD10_DPLL_1.0V_AP";
-				regulator-min-microvolt = <1000000>;
-				regulator-max-microvolt = <1000000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			ldo6_reg: LDO6 {
-				regulator-name = "VDD10_MIPI2L_1.0V_AP";
-				regulator-min-microvolt = <1000000>;
-				regulator-max-microvolt = <1000000>;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			ldo7_reg: LDO7 {
-				regulator-name = "VDD18_MIPI2L_1.8V_AP";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-			};
-
-			ldo8_reg: LDO8 {
-				regulator-name = "VDD18_LLI_1.8V_AP";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			ldo9_reg: LDO9 {
-				regulator-name = "VDD18_ABB_ETC_1.8V_AP";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			ldo10_reg: LDO10 {
-				regulator-name = "VDD33_USB30_3.0V_AP";
-				regulator-min-microvolt = <3000000>;
-				regulator-max-microvolt = <3000000>;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			ldo11_reg: LDO11 {
-				regulator-name = "VDD_INT_M_1.0V_AP";
-				regulator-min-microvolt = <1000000>;
-				regulator-max-microvolt = <1000000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			ldo12_reg: LDO12 {
-				regulator-name = "VDD_KFC_M_1.1V_AP";
-				regulator-min-microvolt = <800000>;
-				regulator-max-microvolt = <1350000>;
-				regulator-always-on;
-			};
-
-			ldo13_reg: LDO13 {
-				regulator-name = "VDD_G3D_M_0.95V_AP";
-				regulator-min-microvolt = <950000>;
-				regulator-max-microvolt = <950000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			ldo14_reg: LDO14 {
-				regulator-name = "VDDQ_M1_LDO_1.2V_AP";
-				regulator-min-microvolt = <1200000>;
-				regulator-max-microvolt = <1200000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			ldo15_reg: LDO15 {
-				regulator-name = "VDDQ_M2_LDO_1.2V_AP";
-				regulator-min-microvolt = <1200000>;
-				regulator-max-microvolt = <1200000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			ldo16_reg: LDO16 {
-				regulator-name = "VDDQ_EFUSE";
-				regulator-min-microvolt = <1400000>;
-				regulator-max-microvolt = <3400000>;
-				regulator-always-on;
-			};
-
-			ldo17_reg: LDO17 {
-				regulator-name = "V_TFLASH_2.8V_AP";
-				regulator-min-microvolt = <2800000>;
-				regulator-max-microvolt = <2800000>;
-			};
-
-			ldo18_reg: LDO18 {
-				regulator-name = "V_CODEC_1.8V_AP";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-			};
-
-			ldo19_reg: LDO19 {
-				regulator-name = "VDDA_1.8V_COMP";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-always-on;
-			};
-
-			ldo20_reg: LDO20 {
-				regulator-name = "VCC_2.8V_AP";
-				regulator-min-microvolt = <2800000>;
-				regulator-max-microvolt = <2800000>;
-				regulator-always-on;
-			};
-
-			ldo21_reg: LDO21 {
-				regulator-name = "VT_CAM_1.8V";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-			};
-
-			ldo22_reg: LDO22 {
-				regulator-name = "CAM_IO_1.8V_AP";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-			};
-
-			ldo23_reg: LDO23 {
-				regulator-name = "CAM_SEN_CORE_1.2V_AP";
-				regulator-min-microvolt = <1050000>;
-				regulator-max-microvolt = <1200000>;
-			};
-
-			ldo24_reg: LDO24 {
-				regulator-name = "VT_CAM_1.2V";
-				regulator-min-microvolt = <1200000>;
-				regulator-max-microvolt = <1200000>;
-			};
-
-			ldo25_reg: LDO25 {
-				regulator-name = "CAM_SEN_A2.8V_AP";
-				regulator-min-microvolt = <2800000>;
-				regulator-max-microvolt = <2800000>;
-			};
-
-			ldo26_reg: LDO26 {
-				regulator-name = "CAM_AF_2.8V_AP";
-				regulator-min-microvolt = <2800000>;
-				regulator-max-microvolt = <2800000>;
-			};
-
-			ldo27_reg: LDO27 {
-				regulator-name = "VCC_3.0V_LCD_AP";
-				regulator-min-microvolt = <3000000>;
-				regulator-max-microvolt = <3000000>;
-			};
-
-			ldo28_reg: LDO28 {
-				regulator-name = "VCC_1.8V_LCD_AP";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-			};
-
-			ldo29_reg: LDO29 {
-				regulator-name = "VT_CAM_2.8V";
-				regulator-min-microvolt = <3000000>;
-				regulator-max-microvolt = <3000000>;
-			};
-
-			ldo30_reg: LDO30 {
-				regulator-name = "TSP_AVDD_3.3V_AP";
-				regulator-min-microvolt = <3300000>;
-				regulator-max-microvolt = <3300000>;
-			};
-
-			ldo31_reg: LDO31 {
-				regulator-name = "TSP_VDD_1.85V_AP";
-				regulator-min-microvolt = <1850000>;
-				regulator-max-microvolt = <1850000>;
-			};
-
-			ldo32_reg: LDO32 {
-				regulator-name = "VTOUCH_1.8V_AP";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-			};
-
-			ldo33_reg: LDO33 {
-				regulator-name = "VTOUCH_LED_3.3V";
-				regulator-min-microvolt = <2500000>;
-				regulator-max-microvolt = <3300000>;
-				regulator-ramp-delay = <12500>;
-			};
-
-			ldo34_reg: LDO34 {
-				regulator-name = "VCC_1.8V_MHL_AP";
-				regulator-min-microvolt = <1000000>;
-				regulator-max-microvolt = <2100000>;
-			};
-
-			ldo35_reg: LDO35 {
-				regulator-name = "OIS_VM_2.8V";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <2800000>;
-			};
-
-			ldo36_reg: LDO36 {
-				regulator-name = "VSIL_1.0V";
-				regulator-min-microvolt = <1000000>;
-				regulator-max-microvolt = <1000000>;
-			};
-
-			ldo37_reg: LDO37 {
-				regulator-name = "VF_1.8V";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-			};
-
-			ldo38_reg: LDO38 {
-				regulator-name = "VCC_3.0V_MOTOR_AP";
-				regulator-min-microvolt = <3000000>;
-				regulator-max-microvolt = <3000000>;
-			};
-
-			ldo39_reg: LDO39 {
-				regulator-name = "V_HRM_1.8V";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-			};
-
-			ldo40_reg: LDO40 {
-				regulator-name = "V_HRM_3.3V";
-				regulator-min-microvolt = <3300000>;
-				regulator-max-microvolt = <3300000>;
-			};
-
-			buck1_reg: BUCK1 {
-				regulator-name = "VDD_MIF_0.9V_AP";
-				regulator-min-microvolt = <600000>;
-				regulator-max-microvolt = <1500000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			buck2_reg: BUCK2 {
-				regulator-name = "VDD_EGL_1.0V_AP";
-				regulator-min-microvolt = <900000>;
-				regulator-max-microvolt = <1300000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			buck3_reg: BUCK3 {
-				regulator-name = "VDD_KFC_1.0V_AP";
-				regulator-min-microvolt = <800000>;
-				regulator-max-microvolt = <1200000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			buck4_reg: BUCK4 {
-				regulator-name = "VDD_INT_0.95V_AP";
-				regulator-min-microvolt = <600000>;
-				regulator-max-microvolt = <1500000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			buck5_reg: BUCK5 {
-				regulator-name = "VDD_DISP_CAM0_0.9V_AP";
-				regulator-min-microvolt = <600000>;
-				regulator-max-microvolt = <1500000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			buck6_reg: BUCK6 {
-				regulator-name = "VDD_G3D_0.9V_AP";
-				regulator-min-microvolt = <600000>;
-				regulator-max-microvolt = <1500000>;
-				regulator-always-on;
-				regulator-state-mem {
-					regulator-off-in-suspend;
-				};
-			};
-
-			buck7_reg: BUCK7 {
-				regulator-name = "VDD_MEM1_1.2V_AP";
-				regulator-min-microvolt = <1200000>;
-				regulator-max-microvolt = <1200000>;
-				regulator-always-on;
-			};
-
-			buck8_reg: BUCK8 {
-				regulator-name = "VDD_LLDO_1.35V_AP";
-				regulator-min-microvolt = <1350000>;
-				regulator-max-microvolt = <3300000>;
-				regulator-always-on;
-			};
-
-			buck9_reg: BUCK9 {
-				regulator-name = "VDD_MLDO_2.0V_AP";
-				regulator-min-microvolt = <1350000>;
-				regulator-max-microvolt = <3300000>;
-				regulator-always-on;
-			};
-
-			buck10_reg: BUCK10 {
-				regulator-name = "vdd_mem2";
-				regulator-min-microvolt = <550000>;
-				regulator-max-microvolt = <1500000>;
-				regulator-always-on;
-			};
-		};
-	};
-};
-
-&hsi2c_8 {
-	status = "okay";
-
-	max77843 at 66 {
-		compatible = "maxim,max77843";
-		interrupt-parent = <&gpa1>;
-		interrupts = <5 IRQ_TYPE_EDGE_FALLING>;
-		reg = <0x66>;
-
-		muic: max77843-muic {
-			compatible = "maxim,max77843-muic";
-		};
-
-		regulators {
-			compatible = "maxim,max77843-regulator";
-			safeout1_reg: SAFEOUT1 {
-				regulator-name = "SAFEOUT1";
-				regulator-min-microvolt = <3300000>;
-				regulator-max-microvolt = <4950000>;
-			};
-
-			safeout2_reg: SAFEOUT2 {
-				regulator-name = "SAFEOUT2";
-				regulator-min-microvolt = <3300000>;
-				regulator-max-microvolt = <4950000>;
-			};
-
-			charger_reg: CHARGER {
-				regulator-name = "CHARGER";
-				regulator-min-microamp = <100000>;
-				regulator-max-microamp = <3150000>;
-			};
-		};
-
-		haptic: max77843-haptic {
-			compatible = "maxim,max77843-haptic";
-			haptic-supply = <&ldo38_reg>;
-			pwms = <&pwm 0 33670 0>;
-			pwm-names = "haptic";
-		};
-	};
-};
-
-&i2s0 {
-	status = "okay";
-};
-
-&mshc_0 {
-	status = "okay";
-	num-slots = <1>;
-	mmc-hs200-1_8v;
-	mmc-hs400-1_8v;
-	cap-mmc-highspeed;
-	non-removable;
-	card-detect-delay = <200>;
-	samsung,dw-mshc-ciu-div = <3>;
-	samsung,dw-mshc-sdr-timing = <0 4>;
-	samsung,dw-mshc-ddr-timing = <0 2>;
-	samsung,dw-mshc-hs400-timing = <0 3>;
-	samsung,read-strobe-delay = <90>;
-	fifo-depth = <0x80>;
-	pinctrl-names = "default";
-	pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_qrdy &sd0_bus1 &sd0_bus4
-			&sd0_bus8 &sd0_rdqs>;
-	bus-width = <8>;
-	assigned-clocks = <&cmu_top CLK_SCLK_MMC0_FSYS>;
-	assigned-clock-rates = <800000000>;
-};
-
-&mshc_2 {
-	status = "okay";
-	num-slots = <1>;
-	cap-sd-highspeed;
-	disable-wp;
-	cd-gpios = <&gpa2 4 GPIO_ACTIVE_HIGH>;
-	cd-inverted;
-	card-detect-delay = <200>;
-	samsung,dw-mshc-ciu-div = <3>;
-	samsung,dw-mshc-sdr-timing = <0 4>;
-	samsung,dw-mshc-ddr-timing = <0 2>;
-	fifo-depth = <0x80>;
-	pinctrl-names = "default";
-	pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_bus1 &sd2_bus4>;
-	bus-width = <4>;
-};
-
-&pinctrl_alive {
-	pinctrl-names = "default";
-	pinctrl-0 = <&initial_alive>;
-
-	initial_alive: initial-state {
-		PIN(IN, gpa0-0, DOWN, LV1);
-		PIN(IN, gpa0-1, NONE, LV1);
-		PIN(IN, gpa0-2, DOWN, LV1);
-		PIN(IN, gpa0-3, NONE, LV1);
-		PIN(IN, gpa0-4, NONE, LV1);
-		PIN(IN, gpa0-5, DOWN, LV1);
-		PIN(IN, gpa0-6, NONE, LV1);
-		PIN(IN, gpa0-7, NONE, LV1);
-
-		PIN(IN, gpa1-0, UP, LV1);
-		PIN(IN, gpa1-1, NONE, LV1);
-		PIN(IN, gpa1-2, NONE, LV1);
-		PIN(IN, gpa1-3, DOWN, LV1);
-		PIN(IN, gpa1-4, DOWN, LV1);
-		PIN(IN, gpa1-5, NONE, LV1);
-		PIN(IN, gpa1-6, NONE, LV1);
-		PIN(IN, gpa1-7, NONE, LV1);
-
-		PIN(IN, gpa2-0, NONE, LV1);
-		PIN(IN, gpa2-1, NONE, LV1);
-		PIN(IN, gpa2-2, NONE, LV1);
-		PIN(IN, gpa2-3, DOWN, LV1);
-		PIN(IN, gpa2-4, NONE, LV1);
-		PIN(IN, gpa2-5, DOWN, LV1);
-		PIN(IN, gpa2-6, DOWN, LV1);
-		PIN(IN, gpa2-7, NONE, LV1);
-
-		PIN(IN, gpa3-0, DOWN, LV1);
-		PIN(IN, gpa3-1, DOWN, LV1);
-		PIN(IN, gpa3-2, NONE, LV1);
-		PIN(IN, gpa3-3, DOWN, LV1);
-		PIN(IN, gpa3-4, NONE, LV1);
-		PIN(IN, gpa3-5, DOWN, LV1);
-		PIN(IN, gpa3-6, DOWN, LV1);
-		PIN(IN, gpa3-7, DOWN, LV1);
-
-		PIN(IN, gpf1-0, NONE, LV1);
-		PIN(IN, gpf1-1, NONE, LV1);
-		PIN(IN, gpf1-2, DOWN, LV1);
-		PIN(IN, gpf1-4, UP, LV1);
-		PIN(OUT, gpf1-5, NONE, LV1);
-		PIN(IN, gpf1-6, DOWN, LV1);
-		PIN(IN, gpf1-7, DOWN, LV1);
-
-		PIN(IN, gpf2-0, DOWN, LV1);
-		PIN(IN, gpf2-1, DOWN, LV1);
-		PIN(IN, gpf2-2, DOWN, LV1);
-		PIN(IN, gpf2-3, DOWN, LV1);
-
-		PIN(IN, gpf3-0, DOWN, LV1);
-		PIN(IN, gpf3-1, DOWN, LV1);
-		PIN(IN, gpf3-2, NONE, LV1);
-		PIN(IN, gpf3-3, DOWN, LV1);
-
-		PIN(IN, gpf4-0, DOWN, LV1);
-		PIN(IN, gpf4-1, DOWN, LV1);
-		PIN(IN, gpf4-2, DOWN, LV1);
-		PIN(IN, gpf4-3, DOWN, LV1);
-		PIN(IN, gpf4-4, DOWN, LV1);
-		PIN(IN, gpf4-5, DOWN, LV1);
-		PIN(IN, gpf4-6, DOWN, LV1);
-		PIN(IN, gpf4-7, DOWN, LV1);
-
-		PIN(IN, gpf5-0, DOWN, LV1);
-		PIN(IN, gpf5-1, DOWN, LV1);
-		PIN(IN, gpf5-2, DOWN, LV1);
-		PIN(IN, gpf5-3, DOWN, LV1);
-		PIN(OUT, gpf5-4, NONE, LV1);
-		PIN(IN, gpf5-5, DOWN, LV1);
-		PIN(IN, gpf5-6, DOWN, LV1);
-		PIN(IN, gpf5-7, DOWN, LV1);
-	};
-
-	te_irq: te_irq {
-		samsung,pins = "gpf1-3";
-		samsung,pin-function = <0xf>;
-	};
-};
-
-&pinctrl_cpif {
-	pinctrl-names = "default";
-	pinctrl-0 = <&initial_cpif>;
-
-	initial_cpif: initial-state {
-		PIN(IN, gpv6-0, DOWN, LV1);
-		PIN(IN, gpv6-1, DOWN, LV1);
-	};
-};
-
-&pinctrl_ese {
-	pinctrl-names = "default";
-	pinctrl-0 = <&initial_ese>;
-
-	initial_ese: initial-state {
-		PIN(IN, gpj2-0, DOWN, LV1);
-		PIN(IN, gpj2-1, DOWN, LV1);
-		PIN(IN, gpj2-2, DOWN, LV1);
-	};
-};
-
-&pinctrl_fsys {
-	pinctrl-names = "default";
-	pinctrl-0 = <&initial_fsys>;
-
-	initial_fsys: initial-state {
-		PIN(IN, gpr3-0, NONE, LV1);
-		PIN(IN, gpr3-1, DOWN, LV1);
-		PIN(IN, gpr3-2, DOWN, LV1);
-		PIN(IN, gpr3-3, DOWN, LV1);
-		PIN(IN, gpr3-7, NONE, LV1);
-	};
-};
-
-&pinctrl_imem {
-	pinctrl-names = "default";
-	pinctrl-0 = <&initial_imem>;
-
-	initial_imem: initial-state {
-		PIN(IN, gpf0-0, UP, LV1);
-		PIN(IN, gpf0-1, UP, LV1);
-		PIN(IN, gpf0-2, DOWN, LV1);
-		PIN(IN, gpf0-3, UP, LV1);
-		PIN(IN, gpf0-4, DOWN, LV1);
-		PIN(IN, gpf0-5, NONE, LV1);
-		PIN(IN, gpf0-6, DOWN, LV1);
-		PIN(IN, gpf0-7, UP, LV1);
-	};
-};
-
-&pinctrl_nfc {
-	pinctrl-names = "default";
-	pinctrl-0 = <&initial_nfc>;
-
-	initial_nfc: initial-state {
-		PIN(IN, gpj0-2, DOWN, LV1);
-	};
-};
-
-&pinctrl_peric {
-	pinctrl-names = "default";
-	pinctrl-0 = <&initial_peric>;
-
-	initial_peric: initial-state {
-		PIN(IN, gpv7-0, DOWN, LV1);
-		PIN(IN, gpv7-1, DOWN, LV1);
-		PIN(IN, gpv7-2, NONE, LV1);
-		PIN(IN, gpv7-3, DOWN, LV1);
-		PIN(IN, gpv7-4, DOWN, LV1);
-		PIN(IN, gpv7-5, DOWN, LV1);
-
-		PIN(IN, gpb0-4, DOWN, LV1);
-
-		PIN(IN, gpc0-2, DOWN, LV1);
-		PIN(IN, gpc0-5, DOWN, LV1);
-		PIN(IN, gpc0-7, DOWN, LV1);
-
-		PIN(IN, gpc1-1, DOWN, LV1);
-
-		PIN(IN, gpc3-4, NONE, LV1);
-		PIN(IN, gpc3-5, NONE, LV1);
-		PIN(IN, gpc3-6, NONE, LV1);
-		PIN(IN, gpc3-7, NONE, LV1);
-
-		PIN(OUT, gpg0-0, NONE, LV1);
-		PIN(FUNC1, gpg0-1, DOWN, LV1);
-
-		PIN(IN, gpd2-5, DOWN, LV1);
-
-		PIN(IN, gpd4-0, NONE, LV1);
-		PIN(IN, gpd4-1, DOWN, LV1);
-		PIN(IN, gpd4-2, DOWN, LV1);
-		PIN(IN, gpd4-3, DOWN, LV1);
-		PIN(IN, gpd4-4, DOWN, LV1);
-
-		PIN(IN, gpd6-3, DOWN, LV1);
-
-		PIN(IN, gpd8-1, UP, LV1);
-
-		PIN(IN, gpg1-0, DOWN, LV1);
-		PIN(IN, gpg1-1, DOWN, LV1);
-		PIN(IN, gpg1-2, DOWN, LV1);
-		PIN(IN, gpg1-3, DOWN, LV1);
-		PIN(IN, gpg1-4, DOWN, LV1);
-
-		PIN(IN, gpg2-0, DOWN, LV1);
-		PIN(IN, gpg2-1, DOWN, LV1);
-
-		PIN(IN, gpg3-0, DOWN, LV1);
-		PIN(IN, gpg3-1, DOWN, LV1);
-		PIN(IN, gpg3-5, DOWN, LV1);
-		PIN(IN, gpg3-7, DOWN, LV1);
-	};
-};
-
-&pinctrl_touch {
-	pinctrl-names = "default";
-	pinctrl-0 = <&initial_touch>;
-
-	initial_touch: initial-state {
-		PIN(IN, gpj1-2, DOWN, LV1);
-	};
-};
-
-&pwm {
-	pinctrl-0 = <&pwm0_out>;
-	pinctrl-names = "default";
-	status = "okay";
-};
-
-&mic {
-	status = "okay";
-
-	i80-if-timings {
-	};
-};
-
-&pmu_system_controller {
-	assigned-clocks = <&pmu_system_controller 0>;
-	assigned-clock-parents = <&xxti>;
-};
-
-&serial_1 {
-	status = "okay";
-};
-
-&spi_1 {
-	cs-gpios = <&gpd6 3 GPIO_ACTIVE_HIGH>;
-	status = "okay";
-
-	wm5110: wm5110-codec at 0 {
-		compatible = "wlf,wm5110";
-		reg = <0x0>;
-		spi-max-frequency = <20000000>;
-		interrupt-parent = <&gpa0>;
-		interrupts = <4 IRQ_TYPE_NONE>;
-		clocks = <&pmu_system_controller 0>,
-			<&s2mps13_osc S2MPS11_CLK_BT>;
-		clock-names = "mclk1", "mclk2";
-
-		gpio-controller;
-		#gpio-cells = <2>;
-
-		wlf,micd-detect-debounce = <300>;
-		wlf,micd-bias-start-time = <0x1>;
-		wlf,micd-rate = <0x7>;
-		wlf,micd-dbtime = <0x1>;
-		wlf,micd-force-micbias;
-		wlf,micd-configs = <0x0 1 0>;
-		wlf,hpdet-channel = <1>;
-		wlf,gpsw = <0x1>;
-		wlf,inmode = <2 0 2 0>;
-
-		wlf,reset = <&gpc0 7 GPIO_ACTIVE_HIGH>;
-		wlf,ldoena = <&gpf0 0 GPIO_ACTIVE_HIGH>;
-
-		/* core supplies */
-		AVDD-supply = <&ldo18_reg>;
-		DBVDD1-supply = <&ldo18_reg>;
-		CPVDD-supply = <&ldo18_reg>;
-		DBVDD2-supply = <&ldo18_reg>;
-		DBVDD3-supply = <&ldo18_reg>;
-
-		controller-data {
-			samsung,spi-feedback-delay = <0>;
-		};
-	};
-};
-
-&timer {
-	clock-frequency = <24000000>;
-};
-
-&tmu_atlas0 {
-	vtmu-supply = <&ldo3_reg>;
-	status = "okay";
-};
-
-&tmu_apollo {
-	vtmu-supply = <&ldo3_reg>;
-	status = "okay";
-};
-
-&tmu_g3d {
-	vtmu-supply = <&ldo3_reg>;
-	status = "okay";
-};
-
-&usbdrd30 {
-	vdd33-supply = <&ldo10_reg>;
-	vdd10-supply = <&ldo6_reg>;
-	status = "okay";
-};
-
-&usbdrd_dwc3_0 {
-	dr_mode = "otg";
-};
-
-&usbdrd30_phy {
-	vbus-supply = <&safeout1_reg>;
-	status = "okay";
-};
-
-&xxti {
-	clock-frequency = <24000000>;
-};
diff --git a/arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts b/arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts
index 1db4e7f..81fdbef 100644
--- a/arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts
+++ b/arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts
@@ -11,7 +11,7 @@
  * published by the Free Software Foundation.
  */
 
-#include "exynos5433-tm2.dts"
+#include "exynos5433-tm2-common.dtsi"
 
 / {
 	model = "Samsung TM2E board";
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 4/4] arm64: dts: exynos: Add tm2 touchkey node
       [not found]   ` <CGME20170103075734epcas5p439b05860a3238ce638f683d9687786a3@epcas5p4.samsung.com>
@ 2017-01-03  7:57       ` Jaechul Lee
  0 siblings, 0 replies; 61+ messages in thread
From: Jaechul Lee @ 2017-01-03  7:57 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Mark Rutland, Catalin Marinas,
	Will Deacon, Kukjin Kim, Krzysztof Kozlowski,
	Javier Martinez Canillas
  Cc: Jaechul Lee, Andi Shyti, Chanwoo Choi, beomho.seo, galaxyra,
	linux-arm-kernel, linux-input, devicetree, linux-kernel,
	linux-samsung-soc

Add DT node support for TM2 touchkey device.

Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
---
 arch/arm64/boot/dts/exynos/exynos5433-tm2.dts | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts b/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts
index 887a1f1..ef7d21c 100644
--- a/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts
+++ b/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts
@@ -18,3 +18,15 @@
 	compatible = "samsung,tm2e", "samsung,exynos5433";
 };
 
+&hsi2c_9 {
+	status = "okay";
+
+	touchkey@20 {
+		compatible = "samsung,tm2-touchkey";
+		reg = <0x20>;
+		interrupt-parent = <&gpa3>;
+		interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
+		vcc-supply = <&ldo32_reg>;
+		vdd-supply = <&ldo33_reg>;
+	};
+};
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 4/4] arm64: dts: exynos: Add tm2 touchkey node
@ 2017-01-03  7:57       ` Jaechul Lee
  0 siblings, 0 replies; 61+ messages in thread
From: Jaechul Lee @ 2017-01-03  7:57 UTC (permalink / raw)
  To: linux-arm-kernel

Add DT node support for TM2 touchkey device.

Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
---
 arch/arm64/boot/dts/exynos/exynos5433-tm2.dts | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts b/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts
index 887a1f1..ef7d21c 100644
--- a/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts
+++ b/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts
@@ -18,3 +18,15 @@
 	compatible = "samsung,tm2e", "samsung,exynos5433";
 };
 
+&hsi2c_9 {
+	status = "okay";
+
+	touchkey at 20 {
+		compatible = "samsung,tm2-touchkey";
+		reg = <0x20>;
+		interrupt-parent = <&gpa3>;
+		interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
+		vcc-supply = <&ldo32_reg>;
+		vdd-supply = <&ldo33_reg>;
+	};
+};
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 61+ messages in thread

* Re: [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
  2017-01-03  7:57       ` Jaechul Lee
@ 2017-01-03  8:16         ` Andi Shyti
  -1 siblings, 0 replies; 61+ messages in thread
From: Andi Shyti @ 2017-01-03  8:16 UTC (permalink / raw)
  To: Jaechul Lee
  Cc: Dmitry Torokhov, Rob Herring, Mark Rutland, Catalin Marinas,
	Will Deacon, Kukjin Kim, Krzysztof Kozlowski,
	Javier Martinez Canillas, Chanwoo Choi, beomho.seo, galaxyra,
	linux-arm-kernel, linux-input, devicetree, linux-kernel,
	linux-samsung-soc

Hi,

> +	compatible = "samsung,tm2e", "samsung,exynos5433";

this is supposed to be "samsung,tm2".
Will wait for other comments and fix it in v2.

Andi

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
@ 2017-01-03  8:16         ` Andi Shyti
  0 siblings, 0 replies; 61+ messages in thread
From: Andi Shyti @ 2017-01-03  8:16 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

> +	compatible = "samsung,tm2e", "samsung,exynos5433";

this is supposed to be "samsung,tm2".
Will wait for other comments and fix it in v2.

Andi

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
  2017-01-03  7:57       ` Jaechul Lee
@ 2017-01-03  8:27         ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 61+ messages in thread
From: Krzysztof Kozlowski @ 2017-01-03  8:27 UTC (permalink / raw)
  To: Jaechul Lee
  Cc: Dmitry Torokhov, Rob Herring, Mark Rutland, Catalin Marinas,
	Will Deacon, Kukjin Kim, Javier Martinez Canillas, Andi Shyti,
	Chanwoo Choi, beomho.seo, galaxyra, linux-arm-kernel,
	linux-input, devicetree, linux-kernel, linux-samsung-soc

On Tue, Jan 3, 2017 at 9:57 AM, Jaechul Lee <jcsing.lee@samsung.com> wrote:
> From: Andi Shyti <andi.shyti@samsung.com>
>
> Currently tm2e dts includes tm2 but there are some differences
> between the two boards and tm2 has some properties that tm2e
> doesn't have.
>
> That's why it's important to keep the two dts files independent
> and put all the commonalities in a tm2-common.dtsi file.
>
> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> ---
>  .../boot/dts/exynos/exynos5433-tm2-common.dtsi     | 1046 ++++++++++++++++++++
>  arch/arm64/boot/dts/exynos/exynos5433-tm2.dts      | 1033 +------------------
>  arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts     |    2 +-
>  3 files changed, 1049 insertions(+), 1032 deletions(-)
>  create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi

I would like to see here the rename and diff from it. Not entire delta
(deletions and addons). It is not possible to compare it... I think
git supports it by default with similarity of 50%.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
@ 2017-01-03  8:27         ` Krzysztof Kozlowski
  0 siblings, 0 replies; 61+ messages in thread
From: Krzysztof Kozlowski @ 2017-01-03  8:27 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jan 3, 2017 at 9:57 AM, Jaechul Lee <jcsing.lee@samsung.com> wrote:
> From: Andi Shyti <andi.shyti@samsung.com>
>
> Currently tm2e dts includes tm2 but there are some differences
> between the two boards and tm2 has some properties that tm2e
> doesn't have.
>
> That's why it's important to keep the two dts files independent
> and put all the commonalities in a tm2-common.dtsi file.
>
> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> ---
>  .../boot/dts/exynos/exynos5433-tm2-common.dtsi     | 1046 ++++++++++++++++++++
>  arch/arm64/boot/dts/exynos/exynos5433-tm2.dts      | 1033 +------------------
>  arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts     |    2 +-
>  3 files changed, 1049 insertions(+), 1032 deletions(-)
>  create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi

I would like to see here the rename and diff from it. Not entire delta
(deletions and addons). It is not possible to compare it... I think
git supports it by default with similarity of 50%.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
  2017-01-03  8:27         ` Krzysztof Kozlowski
@ 2017-01-03  9:58           ` Andi Shyti
  -1 siblings, 0 replies; 61+ messages in thread
From: Andi Shyti @ 2017-01-03  9:58 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jaechul Lee, Dmitry Torokhov, Rob Herring, Mark Rutland,
	Catalin Marinas, Will Deacon, Kukjin Kim,
	Javier Martinez Canillas, Chanwoo Choi, beomho.seo, galaxyra,
	linux-arm-kernel, linux-input, devicetree, linux-kernel,
	linux-samsung-soc

Hi Krzysztof,

> > Currently tm2e dts includes tm2 but there are some differences
> > between the two boards and tm2 has some properties that tm2e
> > doesn't have.
> >
> > That's why it's important to keep the two dts files independent
> > and put all the commonalities in a tm2-common.dtsi file.
> >
> > Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> > Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> > ---
> >  .../boot/dts/exynos/exynos5433-tm2-common.dtsi     | 1046 ++++++++++++++++++++
> >  arch/arm64/boot/dts/exynos/exynos5433-tm2.dts      | 1033 +------------------
> >  arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts     |    2 +-
> >  3 files changed, 1049 insertions(+), 1032 deletions(-)
> >  create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
> 
> I would like to see here the rename and diff from it. Not entire delta
> (deletions and addons). It is not possible to compare it... I think
> git supports it by default with similarity of 50%.

I understand, it's indeed quite cryptic to understand. But all
the diff algorithms (patience, minimal, histogram, myers) give
the same result. I don't know how to make it better.

I could split this patch, but this also means breaking tm2's
functionality, which looks worse.

Please tell me if you know a better way for generating the patch.

Thanks,
Andi

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
@ 2017-01-03  9:58           ` Andi Shyti
  0 siblings, 0 replies; 61+ messages in thread
From: Andi Shyti @ 2017-01-03  9:58 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Krzysztof,

> > Currently tm2e dts includes tm2 but there are some differences
> > between the two boards and tm2 has some properties that tm2e
> > doesn't have.
> >
> > That's why it's important to keep the two dts files independent
> > and put all the commonalities in a tm2-common.dtsi file.
> >
> > Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> > Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> > ---
> >  .../boot/dts/exynos/exynos5433-tm2-common.dtsi     | 1046 ++++++++++++++++++++
> >  arch/arm64/boot/dts/exynos/exynos5433-tm2.dts      | 1033 +------------------
> >  arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts     |    2 +-
> >  3 files changed, 1049 insertions(+), 1032 deletions(-)
> >  create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
> 
> I would like to see here the rename and diff from it. Not entire delta
> (deletions and addons). It is not possible to compare it... I think
> git supports it by default with similarity of 50%.

I understand, it's indeed quite cryptic to understand. But all
the diff algorithms (patience, minimal, histogram, myers) give
the same result. I don't know how to make it better.

I could split this patch, but this also means breaking tm2's
functionality, which looks worse.

Please tell me if you know a better way for generating the patch.

Thanks,
Andi

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
@ 2017-01-03 10:01             ` Krzysztof Kozlowski
  0 siblings, 0 replies; 61+ messages in thread
From: Krzysztof Kozlowski @ 2017-01-03 10:01 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Jaechul Lee, Dmitry Torokhov, Rob Herring, Mark Rutland,
	Catalin Marinas, Will Deacon, Kukjin Kim,
	Javier Martinez Canillas, Chanwoo Choi, beomho.seo, galaxyra,
	linux-arm-kernel, linux-input, devicetree, linux-kernel,
	linux-samsung-soc

On Tue, Jan 3, 2017 at 11:58 AM, Andi Shyti <andi.shyti@samsung.com> wrote:
> Hi Krzysztof,
>
>> > Currently tm2e dts includes tm2 but there are some differences
>> > between the two boards and tm2 has some properties that tm2e
>> > doesn't have.
>> >
>> > That's why it's important to keep the two dts files independent
>> > and put all the commonalities in a tm2-common.dtsi file.
>> >
>> > Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
>> > Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
>> > ---
>> >  .../boot/dts/exynos/exynos5433-tm2-common.dtsi     | 1046 ++++++++++++++++++++
>> >  arch/arm64/boot/dts/exynos/exynos5433-tm2.dts      | 1033 +------------------
>> >  arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts     |    2 +-
>> >  3 files changed, 1049 insertions(+), 1032 deletions(-)
>> >  create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
>>
>> I would like to see here the rename and diff from it. Not entire delta
>> (deletions and addons). It is not possible to compare it... I think
>> git supports it by default with similarity of 50%.
>
> I understand, it's indeed quite cryptic to understand. But all
> the diff algorithms (patience, minimal, histogram, myers) give
> the same result. I don't know how to make it better.
>
> I could split this patch, but this also means breaking tm2's
> functionality, which looks worse.
>
> Please tell me if you know a better way for generating the patch.

git format-patch -M95%?

Krzysztof

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
@ 2017-01-03 10:01             ` Krzysztof Kozlowski
  0 siblings, 0 replies; 61+ messages in thread
From: Krzysztof Kozlowski @ 2017-01-03 10:01 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Jaechul Lee, Dmitry Torokhov, Rob Herring, Mark Rutland,
	Catalin Marinas, Will Deacon, Kukjin Kim,
	Javier Martinez Canillas, Chanwoo Choi,
	beomho.seo-Sze3O3UU22JBDgjK7y7TUQ,
	galaxyra-Re5JQEeQqe8AvxtiuMwx3w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA

On Tue, Jan 3, 2017 at 11:58 AM, Andi Shyti <andi.shyti-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote:
> Hi Krzysztof,
>
>> > Currently tm2e dts includes tm2 but there are some differences
>> > between the two boards and tm2 has some properties that tm2e
>> > doesn't have.
>> >
>> > That's why it's important to keep the two dts files independent
>> > and put all the commonalities in a tm2-common.dtsi file.
>> >
>> > Signed-off-by: Andi Shyti <andi.shyti-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
>> > Signed-off-by: Jaechul Lee <jcsing.lee-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
>> > ---
>> >  .../boot/dts/exynos/exynos5433-tm2-common.dtsi     | 1046 ++++++++++++++++++++
>> >  arch/arm64/boot/dts/exynos/exynos5433-tm2.dts      | 1033 +------------------
>> >  arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts     |    2 +-
>> >  3 files changed, 1049 insertions(+), 1032 deletions(-)
>> >  create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
>>
>> I would like to see here the rename and diff from it. Not entire delta
>> (deletions and addons). It is not possible to compare it... I think
>> git supports it by default with similarity of 50%.
>
> I understand, it's indeed quite cryptic to understand. But all
> the diff algorithms (patience, minimal, histogram, myers) give
> the same result. I don't know how to make it better.
>
> I could split this patch, but this also means breaking tm2's
> functionality, which looks worse.
>
> Please tell me if you know a better way for generating the patch.

git format-patch -M95%?

Krzysztof
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
@ 2017-01-03 10:01             ` Krzysztof Kozlowski
  0 siblings, 0 replies; 61+ messages in thread
From: Krzysztof Kozlowski @ 2017-01-03 10:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jan 3, 2017 at 11:58 AM, Andi Shyti <andi.shyti@samsung.com> wrote:
> Hi Krzysztof,
>
>> > Currently tm2e dts includes tm2 but there are some differences
>> > between the two boards and tm2 has some properties that tm2e
>> > doesn't have.
>> >
>> > That's why it's important to keep the two dts files independent
>> > and put all the commonalities in a tm2-common.dtsi file.
>> >
>> > Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
>> > Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
>> > ---
>> >  .../boot/dts/exynos/exynos5433-tm2-common.dtsi     | 1046 ++++++++++++++++++++
>> >  arch/arm64/boot/dts/exynos/exynos5433-tm2.dts      | 1033 +------------------
>> >  arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts     |    2 +-
>> >  3 files changed, 1049 insertions(+), 1032 deletions(-)
>> >  create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
>>
>> I would like to see here the rename and diff from it. Not entire delta
>> (deletions and addons). It is not possible to compare it... I think
>> git supports it by default with similarity of 50%.
>
> I understand, it's indeed quite cryptic to understand. But all
> the diff algorithms (patience, minimal, histogram, myers) give
> the same result. I don't know how to make it better.
>
> I could split this patch, but this also means breaking tm2's
> functionality, which looks worse.
>
> Please tell me if you know a better way for generating the patch.

git format-patch -M95%?

Krzysztof

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
  2017-01-03 10:01             ` Krzysztof Kozlowski
@ 2017-01-03 10:25               ` Andi Shyti
  -1 siblings, 0 replies; 61+ messages in thread
From: Andi Shyti @ 2017-01-03 10:25 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jaechul Lee, Dmitry Torokhov, Rob Herring, Mark Rutland,
	Catalin Marinas, Will Deacon, Kukjin Kim,
	Javier Martinez Canillas, Chanwoo Choi, beomho.seo, galaxyra,
	linux-arm-kernel, linux-input, devicetree, linux-kernel,
	linux-samsung-soc

> >> > Currently tm2e dts includes tm2 but there are some differences
> >> > between the two boards and tm2 has some properties that tm2e
> >> > doesn't have.
> >> >
> >> > That's why it's important to keep the two dts files independent
> >> > and put all the commonalities in a tm2-common.dtsi file.
> >> >
> >> > Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> >> > Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> >> > ---
> >> >  .../boot/dts/exynos/exynos5433-tm2-common.dtsi     | 1046 ++++++++++++++++++++
> >> >  arch/arm64/boot/dts/exynos/exynos5433-tm2.dts      | 1033 +------------------
> >> >  arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts     |    2 +-
> >> >  3 files changed, 1049 insertions(+), 1032 deletions(-)
> >> >  create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
> >>
> >> I would like to see here the rename and diff from it. Not entire delta
> >> (deletions and addons). It is not possible to compare it... I think
> >> git supports it by default with similarity of 50%.
> >
> > I understand, it's indeed quite cryptic to understand. But all
> > the diff algorithms (patience, minimal, histogram, myers) give
> > the same result. I don't know how to make it better.
> >
> > I could split this patch, but this also means breaking tm2's
> > functionality, which looks worse.
> >
> > Please tell me if you know a better way for generating the patch.
> 
> git format-patch -M95%?

Same thing with all M values.

Because exynos5433-tm2.dts results modified, while
exynos5433-tm2-common.dtsi is new. Even though I did:

1. mv exynos5433-tm2.dts exynos5433-tm2-common.dtsi
2. copied pieces from exynos5433-tm2-common.dtsi to a new
   exynos5433-tm2.dts

Andi

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
@ 2017-01-03 10:25               ` Andi Shyti
  0 siblings, 0 replies; 61+ messages in thread
From: Andi Shyti @ 2017-01-03 10:25 UTC (permalink / raw)
  To: linux-arm-kernel

> >> > Currently tm2e dts includes tm2 but there are some differences
> >> > between the two boards and tm2 has some properties that tm2e
> >> > doesn't have.
> >> >
> >> > That's why it's important to keep the two dts files independent
> >> > and put all the commonalities in a tm2-common.dtsi file.
> >> >
> >> > Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> >> > Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> >> > ---
> >> >  .../boot/dts/exynos/exynos5433-tm2-common.dtsi     | 1046 ++++++++++++++++++++
> >> >  arch/arm64/boot/dts/exynos/exynos5433-tm2.dts      | 1033 +------------------
> >> >  arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts     |    2 +-
> >> >  3 files changed, 1049 insertions(+), 1032 deletions(-)
> >> >  create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
> >>
> >> I would like to see here the rename and diff from it. Not entire delta
> >> (deletions and addons). It is not possible to compare it... I think
> >> git supports it by default with similarity of 50%.
> >
> > I understand, it's indeed quite cryptic to understand. But all
> > the diff algorithms (patience, minimal, histogram, myers) give
> > the same result. I don't know how to make it better.
> >
> > I could split this patch, but this also means breaking tm2's
> > functionality, which looks worse.
> >
> > Please tell me if you know a better way for generating the patch.
> 
> git format-patch -M95%?

Same thing with all M values.

Because exynos5433-tm2.dts results modified, while
exynos5433-tm2-common.dtsi is new. Even though I did:

1. mv exynos5433-tm2.dts exynos5433-tm2-common.dtsi
2. copied pieces from exynos5433-tm2-common.dtsi to a new
   exynos5433-tm2.dts

Andi

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
  2017-01-03 10:25               ` Andi Shyti
@ 2017-01-03 11:47                 ` Chanwoo Choi
  -1 siblings, 0 replies; 61+ messages in thread
From: Chanwoo Choi @ 2017-01-03 11:47 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Krzysztof Kozlowski, Jaechul Lee, Dmitry Torokhov, Rob Herring,
	Mark Rutland, Catalin Marinas, Will Deacon, Kukjin Kim,
	Javier Martinez Canillas, Chanwoo Choi, beomho.seo, galaxyra,
	linux-arm-kernel, linux-input, devicetree, linux-kernel,
	linux-samsung-soc

Dear all,

2017-01-03 19:25 GMT+09:00 Andi Shyti <andi.shyti@samsung.com>:
>> >> > Currently tm2e dts includes tm2 but there are some differences
>> >> > between the two boards and tm2 has some properties that tm2e
>> >> > doesn't have.
>> >> >
>> >> > That's why it's important to keep the two dts files independent
>> >> > and put all the commonalities in a tm2-common.dtsi file.
>> >> >
>> >> > Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
>> >> > Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
>> >> > ---
>> >> >  .../boot/dts/exynos/exynos5433-tm2-common.dtsi     | 1046 ++++++++++++++++++++
>> >> >  arch/arm64/boot/dts/exynos/exynos5433-tm2.dts      | 1033 +------------------
>> >> >  arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts     |    2 +-
>> >> >  3 files changed, 1049 insertions(+), 1032 deletions(-)
>> >> >  create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
>> >>
>> >> I would like to see here the rename and diff from it. Not entire delta
>> >> (deletions and addons). It is not possible to compare it... I think
>> >> git supports it by default with similarity of 50%.
>> >
>> > I understand, it's indeed quite cryptic to understand. But all
>> > the diff algorithms (patience, minimal, histogram, myers) give
>> > the same result. I don't know how to make it better.
>> >
>> > I could split this patch, but this also means breaking tm2's
>> > functionality, which looks worse.
>> >
>> > Please tell me if you know a better way for generating the patch.
>>
>> git format-patch -M95%?
>
> Same thing with all M values.
>
> Because exynos5433-tm2.dts results modified, while
> exynos5433-tm2-common.dtsi is new. Even though I did:
>
> 1. mv exynos5433-tm2.dts exynos5433-tm2-common.dtsi
> 2. copied pieces from exynos5433-tm2-common.dtsi to a new
>    exynos5433-tm2.dts

I think that exynos5433-tm2-common.dtsi is not necessary because there
is small difference between TM2 and TM2E.

I explain the detailed difference between TM2 and TM2E and then reply
how to support the TM2E board with existing exynos5433-tm2.dts file
without exynos5433-tm2-common.dtsi.

Difference and the way to support TM2E with existing
exynos5433-tm2.dts file as following:
- hsi2c_9 is either used or not. TM2 uses the hsi2c_9 node for
touchkey. but TM2E do not use the hsi2c_9.
   : We can just disable the hsi2c_9 node on tm2e.dts as following:

   &hsi2c_9 {
         status = "disable";
   };

- The difference name and voltage of regulators.
   : Already modified on tm2e.dts.
- The size of touchscreen between tm2 and tm2e ('x-size', 'y-size')
   : We can update the x/y size on tm2e.dts.
- The timing value of display-timing between tm2 and tm2e
('clock-frequency', 'hactive')
   : We can update the 'clock-frequency' and 'hactive'  on tm2e.dts.

-- 
Best Regards,
Chanwoo Choi

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
@ 2017-01-03 11:47                 ` Chanwoo Choi
  0 siblings, 0 replies; 61+ messages in thread
From: Chanwoo Choi @ 2017-01-03 11:47 UTC (permalink / raw)
  To: linux-arm-kernel

Dear all,

2017-01-03 19:25 GMT+09:00 Andi Shyti <andi.shyti@samsung.com>:
>> >> > Currently tm2e dts includes tm2 but there are some differences
>> >> > between the two boards and tm2 has some properties that tm2e
>> >> > doesn't have.
>> >> >
>> >> > That's why it's important to keep the two dts files independent
>> >> > and put all the commonalities in a tm2-common.dtsi file.
>> >> >
>> >> > Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
>> >> > Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
>> >> > ---
>> >> >  .../boot/dts/exynos/exynos5433-tm2-common.dtsi     | 1046 ++++++++++++++++++++
>> >> >  arch/arm64/boot/dts/exynos/exynos5433-tm2.dts      | 1033 +------------------
>> >> >  arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts     |    2 +-
>> >> >  3 files changed, 1049 insertions(+), 1032 deletions(-)
>> >> >  create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
>> >>
>> >> I would like to see here the rename and diff from it. Not entire delta
>> >> (deletions and addons). It is not possible to compare it... I think
>> >> git supports it by default with similarity of 50%.
>> >
>> > I understand, it's indeed quite cryptic to understand. But all
>> > the diff algorithms (patience, minimal, histogram, myers) give
>> > the same result. I don't know how to make it better.
>> >
>> > I could split this patch, but this also means breaking tm2's
>> > functionality, which looks worse.
>> >
>> > Please tell me if you know a better way for generating the patch.
>>
>> git format-patch -M95%?
>
> Same thing with all M values.
>
> Because exynos5433-tm2.dts results modified, while
> exynos5433-tm2-common.dtsi is new. Even though I did:
>
> 1. mv exynos5433-tm2.dts exynos5433-tm2-common.dtsi
> 2. copied pieces from exynos5433-tm2-common.dtsi to a new
>    exynos5433-tm2.dts

I think that exynos5433-tm2-common.dtsi is not necessary because there
is small difference between TM2 and TM2E.

I explain the detailed difference between TM2 and TM2E and then reply
how to support the TM2E board with existing exynos5433-tm2.dts file
without exynos5433-tm2-common.dtsi.

Difference and the way to support TM2E with existing
exynos5433-tm2.dts file as following:
- hsi2c_9 is either used or not. TM2 uses the hsi2c_9 node for
touchkey. but TM2E do not use the hsi2c_9.
   : We can just disable the hsi2c_9 node on tm2e.dts as following:

   &hsi2c_9 {
         status = "disable";
   };

- The difference name and voltage of regulators.
   : Already modified on tm2e.dts.
- The size of touchscreen between tm2 and tm2e ('x-size', 'y-size')
   : We can update the x/y size on tm2e.dts.
- The timing value of display-timing between tm2 and tm2e
('clock-frequency', 'hactive')
   : We can update the 'clock-frequency' and 'hactive'  on tm2e.dts.

-- 
Best Regards,
Chanwoo Choi

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
@ 2017-01-03 11:55                   ` Andi Shyti
  0 siblings, 0 replies; 61+ messages in thread
From: Andi Shyti @ 2017-01-03 11:55 UTC (permalink / raw)
  To: Chanwoo Choi
  Cc: Krzysztof Kozlowski, Jaechul Lee, Dmitry Torokhov, Rob Herring,
	Mark Rutland, Catalin Marinas, Will Deacon, Kukjin Kim,
	Javier Martinez Canillas, Chanwoo Choi, beomho.seo, galaxyra,
	linux-arm-kernel, linux-input, devicetree, linux-kernel,
	linux-samsung-soc

Hi Chanwoo,

> >> >> > Currently tm2e dts includes tm2 but there are some differences
> >> >> > between the two boards and tm2 has some properties that tm2e
> >> >> > doesn't have.
> >> >> >
> >> >> > That's why it's important to keep the two dts files independent
> >> >> > and put all the commonalities in a tm2-common.dtsi file.
> >> >> >
> >> >> > Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> >> >> > Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> >> >> > ---
> >> >> >  .../boot/dts/exynos/exynos5433-tm2-common.dtsi     | 1046 ++++++++++++++++++++
> >> >> >  arch/arm64/boot/dts/exynos/exynos5433-tm2.dts      | 1033 +------------------
> >> >> >  arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts     |    2 +-
> >> >> >  3 files changed, 1049 insertions(+), 1032 deletions(-)
> >> >> >  create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
> >> >>

[...]

> > Because exynos5433-tm2.dts results modified, while
> > exynos5433-tm2-common.dtsi is new. Even though I did:
> >
> > 1. mv exynos5433-tm2.dts exynos5433-tm2-common.dtsi
> > 2. copied pieces from exynos5433-tm2-common.dtsi to a new
> >    exynos5433-tm2.dts
> 
> I think that exynos5433-tm2-common.dtsi is not necessary because there
> is small difference between TM2 and TM2E.
> 
> I explain the detailed difference between TM2 and TM2E and then reply
> how to support the TM2E board with existing exynos5433-tm2.dts file
> without exynos5433-tm2-common.dtsi.
> 
> Difference and the way to support TM2E with existing
> exynos5433-tm2.dts file as following:
> - hsi2c_9 is either used or not. TM2 uses the hsi2c_9 node for
> touchkey. but TM2E do not use the hsi2c_9.
>    : We can just disable the hsi2c_9 node on tm2e.dts as following:
> 
>    &hsi2c_9 {
>          status = "disable";
>    };

I thought about this alternative too, it just looked cleaner to
me to have a tm2-common.dtsi file.

Anyway, as you guys wish. If for you and Krzysztof is better this
way, we can drop this patch and add the above lines in the current
Jaechul's patch 4/4.

Thanks,
Andi

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
@ 2017-01-03 11:55                   ` Andi Shyti
  0 siblings, 0 replies; 61+ messages in thread
From: Andi Shyti @ 2017-01-03 11:55 UTC (permalink / raw)
  To: Chanwoo Choi
  Cc: Krzysztof Kozlowski, Jaechul Lee, Dmitry Torokhov, Rob Herring,
	Mark Rutland, Catalin Marinas, Will Deacon, Kukjin Kim,
	Javier Martinez Canillas, Chanwoo Choi,
	beomho.seo-Sze3O3UU22JBDgjK7y7TUQ,
	galaxyra-Re5JQEeQqe8AvxtiuMwx3w, linux-arm-kernel,
	linux-input-u79uwXL29TY76Z2rM5mHXA, devicetree, linux-kernel,
	linux-samsung-soc

Hi Chanwoo,

> >> >> > Currently tm2e dts includes tm2 but there are some differences
> >> >> > between the two boards and tm2 has some properties that tm2e
> >> >> > doesn't have.
> >> >> >
> >> >> > That's why it's important to keep the two dts files independent
> >> >> > and put all the commonalities in a tm2-common.dtsi file.
> >> >> >
> >> >> > Signed-off-by: Andi Shyti <andi.shyti-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> >> >> > Signed-off-by: Jaechul Lee <jcsing.lee-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> >> >> > ---
> >> >> >  .../boot/dts/exynos/exynos5433-tm2-common.dtsi     | 1046 ++++++++++++++++++++
> >> >> >  arch/arm64/boot/dts/exynos/exynos5433-tm2.dts      | 1033 +------------------
> >> >> >  arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts     |    2 +-
> >> >> >  3 files changed, 1049 insertions(+), 1032 deletions(-)
> >> >> >  create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
> >> >>

[...]

> > Because exynos5433-tm2.dts results modified, while
> > exynos5433-tm2-common.dtsi is new. Even though I did:
> >
> > 1. mv exynos5433-tm2.dts exynos5433-tm2-common.dtsi
> > 2. copied pieces from exynos5433-tm2-common.dtsi to a new
> >    exynos5433-tm2.dts
> 
> I think that exynos5433-tm2-common.dtsi is not necessary because there
> is small difference between TM2 and TM2E.
> 
> I explain the detailed difference between TM2 and TM2E and then reply
> how to support the TM2E board with existing exynos5433-tm2.dts file
> without exynos5433-tm2-common.dtsi.
> 
> Difference and the way to support TM2E with existing
> exynos5433-tm2.dts file as following:
> - hsi2c_9 is either used or not. TM2 uses the hsi2c_9 node for
> touchkey. but TM2E do not use the hsi2c_9.
>    : We can just disable the hsi2c_9 node on tm2e.dts as following:
> 
>    &hsi2c_9 {
>          status = "disable";
>    };

I thought about this alternative too, it just looked cleaner to
me to have a tm2-common.dtsi file.

Anyway, as you guys wish. If for you and Krzysztof is better this
way, we can drop this patch and add the above lines in the current
Jaechul's patch 4/4.

Thanks,
Andi
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
@ 2017-01-03 11:55                   ` Andi Shyti
  0 siblings, 0 replies; 61+ messages in thread
From: Andi Shyti @ 2017-01-03 11:55 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Chanwoo,

> >> >> > Currently tm2e dts includes tm2 but there are some differences
> >> >> > between the two boards and tm2 has some properties that tm2e
> >> >> > doesn't have.
> >> >> >
> >> >> > That's why it's important to keep the two dts files independent
> >> >> > and put all the commonalities in a tm2-common.dtsi file.
> >> >> >
> >> >> > Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> >> >> > Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> >> >> > ---
> >> >> >  .../boot/dts/exynos/exynos5433-tm2-common.dtsi     | 1046 ++++++++++++++++++++
> >> >> >  arch/arm64/boot/dts/exynos/exynos5433-tm2.dts      | 1033 +------------------
> >> >> >  arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts     |    2 +-
> >> >> >  3 files changed, 1049 insertions(+), 1032 deletions(-)
> >> >> >  create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
> >> >>

[...]

> > Because exynos5433-tm2.dts results modified, while
> > exynos5433-tm2-common.dtsi is new. Even though I did:
> >
> > 1. mv exynos5433-tm2.dts exynos5433-tm2-common.dtsi
> > 2. copied pieces from exynos5433-tm2-common.dtsi to a new
> >    exynos5433-tm2.dts
> 
> I think that exynos5433-tm2-common.dtsi is not necessary because there
> is small difference between TM2 and TM2E.
> 
> I explain the detailed difference between TM2 and TM2E and then reply
> how to support the TM2E board with existing exynos5433-tm2.dts file
> without exynos5433-tm2-common.dtsi.
> 
> Difference and the way to support TM2E with existing
> exynos5433-tm2.dts file as following:
> - hsi2c_9 is either used or not. TM2 uses the hsi2c_9 node for
> touchkey. but TM2E do not use the hsi2c_9.
>    : We can just disable the hsi2c_9 node on tm2e.dts as following:
> 
>    &hsi2c_9 {
>          status = "disable";
>    };

I thought about this alternative too, it just looked cleaner to
me to have a tm2-common.dtsi file.

Anyway, as you guys wish. If for you and Krzysztof is better this
way, we can drop this patch and add the above lines in the current
Jaechul's patch 4/4.

Thanks,
Andi

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
@ 2017-01-03 12:15                     ` Javier Martinez Canillas
  0 siblings, 0 replies; 61+ messages in thread
From: Javier Martinez Canillas @ 2017-01-03 12:15 UTC (permalink / raw)
  To: Andi Shyti, Chanwoo Choi
  Cc: Krzysztof Kozlowski, Jaechul Lee, Dmitry Torokhov, Rob Herring,
	Mark Rutland, Catalin Marinas, Will Deacon, Kukjin Kim,
	Chanwoo Choi, beomho.seo, galaxyra, linux-arm-kernel,
	linux-input, devicetree, linux-kernel, linux-samsung-soc

Hello Andi,

On 01/03/2017 08:55 AM, Andi Shyti wrote:
> Hi Chanwoo,
> 
>>>>>>> Currently tm2e dts includes tm2 but there are some differences
>>>>>>> between the two boards and tm2 has some properties that tm2e
>>>>>>> doesn't have.
>>>>>>>
>>>>>>> That's why it's important to keep the two dts files independent
>>>>>>> and put all the commonalities in a tm2-common.dtsi file.
>>>>>>>
>>>>>>> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
>>>>>>> Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
>>>>>>> ---
>>>>>>>  .../boot/dts/exynos/exynos5433-tm2-common.dtsi     | 1046 ++++++++++++++++++++
>>>>>>>  arch/arm64/boot/dts/exynos/exynos5433-tm2.dts      | 1033 +------------------
>>>>>>>  arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts     |    2 +-
>>>>>>>  3 files changed, 1049 insertions(+), 1032 deletions(-)
>>>>>>>  create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
>>>>>>
> 
> [...]
> 
>>> Because exynos5433-tm2.dts results modified, while
>>> exynos5433-tm2-common.dtsi is new. Even though I did:
>>>
>>> 1. mv exynos5433-tm2.dts exynos5433-tm2-common.dtsi
>>> 2. copied pieces from exynos5433-tm2-common.dtsi to a new
>>>    exynos5433-tm2.dts
>>
>> I think that exynos5433-tm2-common.dtsi is not necessary because there
>> is small difference between TM2 and TM2E.
>>
>> I explain the detailed difference between TM2 and TM2E and then reply
>> how to support the TM2E board with existing exynos5433-tm2.dts file
>> without exynos5433-tm2-common.dtsi.
>>
>> Difference and the way to support TM2E with existing
>> exynos5433-tm2.dts file as following:
>> - hsi2c_9 is either used or not. TM2 uses the hsi2c_9 node for
>> touchkey. but TM2E do not use the hsi2c_9.
>>    : We can just disable the hsi2c_9 node on tm2e.dts as following:
>>
>>    &hsi2c_9 {
>>          status = "disable";
>>    };
> 
> I thought about this alternative too, it just looked cleaner to
> me to have a tm2-common.dtsi file.
> 
> Anyway, as you guys wish. If for you and Krzysztof is better this
> way, we can drop this patch and add the above lines in the current
> Jaechul's patch 4/4.
>

FWIW, I also agree with Chanwoo that the difference is too small to
need a common .dtsi file.
 
> Thanks,
> Andi
> 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
@ 2017-01-03 12:15                     ` Javier Martinez Canillas
  0 siblings, 0 replies; 61+ messages in thread
From: Javier Martinez Canillas @ 2017-01-03 12:15 UTC (permalink / raw)
  To: Andi Shyti, Chanwoo Choi
  Cc: Krzysztof Kozlowski, Jaechul Lee, Dmitry Torokhov, Rob Herring,
	Mark Rutland, Catalin Marinas, Will Deacon, Kukjin Kim,
	Chanwoo Choi, beomho.seo-Sze3O3UU22JBDgjK7y7TUQ,
	galaxyra-Re5JQEeQqe8AvxtiuMwx3w, linux-arm-kernel,
	linux-input-u79uwXL29TY76Z2rM5mHXA, devicetree, linux-kernel,
	linux-samsung-soc

Hello Andi,

On 01/03/2017 08:55 AM, Andi Shyti wrote:
> Hi Chanwoo,
> 
>>>>>>> Currently tm2e dts includes tm2 but there are some differences
>>>>>>> between the two boards and tm2 has some properties that tm2e
>>>>>>> doesn't have.
>>>>>>>
>>>>>>> That's why it's important to keep the two dts files independent
>>>>>>> and put all the commonalities in a tm2-common.dtsi file.
>>>>>>>
>>>>>>> Signed-off-by: Andi Shyti <andi.shyti-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
>>>>>>> Signed-off-by: Jaechul Lee <jcsing.lee-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
>>>>>>> ---
>>>>>>>  .../boot/dts/exynos/exynos5433-tm2-common.dtsi     | 1046 ++++++++++++++++++++
>>>>>>>  arch/arm64/boot/dts/exynos/exynos5433-tm2.dts      | 1033 +------------------
>>>>>>>  arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts     |    2 +-
>>>>>>>  3 files changed, 1049 insertions(+), 1032 deletions(-)
>>>>>>>  create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
>>>>>>
> 
> [...]
> 
>>> Because exynos5433-tm2.dts results modified, while
>>> exynos5433-tm2-common.dtsi is new. Even though I did:
>>>
>>> 1. mv exynos5433-tm2.dts exynos5433-tm2-common.dtsi
>>> 2. copied pieces from exynos5433-tm2-common.dtsi to a new
>>>    exynos5433-tm2.dts
>>
>> I think that exynos5433-tm2-common.dtsi is not necessary because there
>> is small difference between TM2 and TM2E.
>>
>> I explain the detailed difference between TM2 and TM2E and then reply
>> how to support the TM2E board with existing exynos5433-tm2.dts file
>> without exynos5433-tm2-common.dtsi.
>>
>> Difference and the way to support TM2E with existing
>> exynos5433-tm2.dts file as following:
>> - hsi2c_9 is either used or not. TM2 uses the hsi2c_9 node for
>> touchkey. but TM2E do not use the hsi2c_9.
>>    : We can just disable the hsi2c_9 node on tm2e.dts as following:
>>
>>    &hsi2c_9 {
>>          status = "disable";
>>    };
> 
> I thought about this alternative too, it just looked cleaner to
> me to have a tm2-common.dtsi file.
> 
> Anyway, as you guys wish. If for you and Krzysztof is better this
> way, we can drop this patch and add the above lines in the current
> Jaechul's patch 4/4.
>

FWIW, I also agree with Chanwoo that the difference is too small to
need a common .dtsi file.
 
> Thanks,
> Andi
> 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
@ 2017-01-03 12:15                     ` Javier Martinez Canillas
  0 siblings, 0 replies; 61+ messages in thread
From: Javier Martinez Canillas @ 2017-01-03 12:15 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Andi,

On 01/03/2017 08:55 AM, Andi Shyti wrote:
> Hi Chanwoo,
> 
>>>>>>> Currently tm2e dts includes tm2 but there are some differences
>>>>>>> between the two boards and tm2 has some properties that tm2e
>>>>>>> doesn't have.
>>>>>>>
>>>>>>> That's why it's important to keep the two dts files independent
>>>>>>> and put all the commonalities in a tm2-common.dtsi file.
>>>>>>>
>>>>>>> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
>>>>>>> Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
>>>>>>> ---
>>>>>>>  .../boot/dts/exynos/exynos5433-tm2-common.dtsi     | 1046 ++++++++++++++++++++
>>>>>>>  arch/arm64/boot/dts/exynos/exynos5433-tm2.dts      | 1033 +------------------
>>>>>>>  arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts     |    2 +-
>>>>>>>  3 files changed, 1049 insertions(+), 1032 deletions(-)
>>>>>>>  create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
>>>>>>
> 
> [...]
> 
>>> Because exynos5433-tm2.dts results modified, while
>>> exynos5433-tm2-common.dtsi is new. Even though I did:
>>>
>>> 1. mv exynos5433-tm2.dts exynos5433-tm2-common.dtsi
>>> 2. copied pieces from exynos5433-tm2-common.dtsi to a new
>>>    exynos5433-tm2.dts
>>
>> I think that exynos5433-tm2-common.dtsi is not necessary because there
>> is small difference between TM2 and TM2E.
>>
>> I explain the detailed difference between TM2 and TM2E and then reply
>> how to support the TM2E board with existing exynos5433-tm2.dts file
>> without exynos5433-tm2-common.dtsi.
>>
>> Difference and the way to support TM2E with existing
>> exynos5433-tm2.dts file as following:
>> - hsi2c_9 is either used or not. TM2 uses the hsi2c_9 node for
>> touchkey. but TM2E do not use the hsi2c_9.
>>    : We can just disable the hsi2c_9 node on tm2e.dts as following:
>>
>>    &hsi2c_9 {
>>          status = "disable";
>>    };
> 
> I thought about this alternative too, it just looked cleaner to
> me to have a tm2-common.dtsi file.
> 
> Anyway, as you guys wish. If for you and Krzysztof is better this
> way, we can drop this patch and add the above lines in the current
> Jaechul's patch 4/4.
>

FWIW, I also agree with Chanwoo that the difference is too small to
need a common .dtsi file.
 
> Thanks,
> Andi
> 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 1/4] input: Add support for the tm2 touchkey device driver
  2017-01-03  7:57       ` Jaechul Lee
@ 2017-01-03 12:26         ` Javier Martinez Canillas
  -1 siblings, 0 replies; 61+ messages in thread
From: Javier Martinez Canillas @ 2017-01-03 12:26 UTC (permalink / raw)
  To: Jaechul Lee, Dmitry Torokhov, Rob Herring, Mark Rutland,
	Catalin Marinas, Will Deacon, Kukjin Kim, Krzysztof Kozlowski
  Cc: Andi Shyti, Chanwoo Choi, beomho.seo, galaxyra, linux-arm-kernel,
	linux-input, devicetree, linux-kernel, linux-samsung-soc

Hello Jaechul,

On 01/03/2017 04:57 AM, Jaechul Lee wrote:
> This patch adds the binding description of the tm2 touchkey
> device driver.
> 
> Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> ---

Patch looks good to me.

Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH 1/4] input: Add support for the tm2 touchkey device driver
@ 2017-01-03 12:26         ` Javier Martinez Canillas
  0 siblings, 0 replies; 61+ messages in thread
From: Javier Martinez Canillas @ 2017-01-03 12:26 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Jaechul,

On 01/03/2017 04:57 AM, Jaechul Lee wrote:
> This patch adds the binding description of the tm2 touchkey
> device driver.
> 
> Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> ---

Patch looks good to me.

Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 2/4] input: tm2-touchkey: Add touchkey driver support for TM2
  2017-01-03  7:57       ` Jaechul Lee
  (?)
@ 2017-01-03 13:11         ` Javier Martinez Canillas
  -1 siblings, 0 replies; 61+ messages in thread
From: Javier Martinez Canillas @ 2017-01-03 13:11 UTC (permalink / raw)
  To: Jaechul Lee, Dmitry Torokhov, Rob Herring, Mark Rutland,
	Catalin Marinas, Will Deacon, Kukjin Kim, Krzysztof Kozlowski
  Cc: Andi Shyti, Chanwoo Choi, beomho.seo, galaxyra, linux-arm-kernel,
	linux-input, devicetree, linux-kernel, linux-samsung-soc

Hello Jaechul,

On 01/03/2017 04:57 AM, Jaechul Lee wrote:
> This patch adds support for the TM2 touch key and led
> functionlity.
> 

s/functionlity/functionality

> The driver interfaces with userspace through an input device and
> reports KEY_PHONE and KEY_BACK event types. LED brightness can be
> controlled by "/sys/class/leds/tm2-touchkey/brightness".
> 
> Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
> ---
>  drivers/input/keyboard/Kconfig        |  11 ++
>  drivers/input/keyboard/Makefile       |   1 +
>  drivers/input/keyboard/tm2-touchkey.c | 326 ++++++++++++++++++++++++++++++++++
>  3 files changed, 338 insertions(+)
>  create mode 100644 drivers/input/keyboard/tm2-touchkey.c
> 
> diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
> index cbd75cf..72c0ba1 100644
> --- a/drivers/input/keyboard/Kconfig
> +++ b/drivers/input/keyboard/Kconfig
> @@ -666,6 +666,17 @@ config KEYBOARD_TC3589X
>  	  To compile this driver as a module, choose M here: the
>  	  module will be called tc3589x-keypad.
>  
> +config KEYBOARD_TM2_TOUCHKEY
> +	tristate "tm2-touchkey support"
> +	depends on I2C
> +	help
> +	  Say Y here to enable the tm2-touchkey.
> +	  touchkey driver for tm2. This driver can enable
> +	  the interrupt and make input events and control led brightness.
> +
> +	  To compile this driver as a module, choose M here.
> +	  module will be called tm2-touchkey
> +
>  config KEYBOARD_TWL4030
>  	tristate "TI TWL4030/TWL5030/TPS659x0 keypad support"
>  	depends on TWL4030_CORE
> diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
> index d9f4cfc..7d9acff 100644
> --- a/drivers/input/keyboard/Makefile
> +++ b/drivers/input/keyboard/Makefile
> @@ -61,6 +61,7 @@ obj-$(CONFIG_KEYBOARD_SUN4I_LRADC)	+= sun4i-lradc-keys.o
>  obj-$(CONFIG_KEYBOARD_SUNKBD)		+= sunkbd.o
>  obj-$(CONFIG_KEYBOARD_TC3589X)		+= tc3589x-keypad.o
>  obj-$(CONFIG_KEYBOARD_TEGRA)		+= tegra-kbc.o
> +obj-$(CONFIG_KEYBOARD_TM2_TOUCHKEY)	+= tm2-touchkey.o
>  obj-$(CONFIG_KEYBOARD_TWL4030)		+= twl4030_keypad.o
>  obj-$(CONFIG_KEYBOARD_XTKBD)		+= xtkbd.o
>  obj-$(CONFIG_KEYBOARD_W90P910)		+= w90p910_keypad.o
> diff --git a/drivers/input/keyboard/tm2-touchkey.c b/drivers/input/keyboard/tm2-touchkey.c
> new file mode 100644
> index 0000000..d9575d8
> --- /dev/null
> +++ b/drivers/input/keyboard/tm2-touchkey.c
> @@ -0,0 +1,326 @@
> +/*
> + * Driver for keys on GPIO lines capable of generating interrupts.
> + *
> + * Copyright 2005 Phil Blundell
> + * Copyright 2016 Samsung Electronics Co., Ltd.
> + *
> + * Author: Beomho Seo <beomho.seo@samsung.com>
> + * Author: Jaechul Lee <jcsing.lee@samsung.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.
> + */
> +
> +#include <linux/bitops.h>
> +#include <linux/delay.h>
> +#include <linux/device.h>
> +#include <linux/i2c.h>
> +#include <linux/input.h>
> +#include <linux/interrupt.h>
> +#include <linux/irq.h>
> +#include <linux/leds.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/pm.h>
> +#include <linux/regulator/consumer.h>
> +#include <linux/workqueue.h>
> +
> +#define TM2_TOUCHKEY_DEV_NAME			"tm2-touchkey"
> +#define TM2_TOUCHKEY_KEYCODE_REG			0x03
> +#define TM2_TOUCHKEY_BASE_REG			0x00
> +#define TM2_TOUCHKEY_CMD_LED_ON			0x10
> +#define TM2_TOUCHKEY_CMD_LED_OFF			0x20
> +#define TM2_TOUCHKEY_BIT_PRESS_EV			BIT(3)
> +#define TM2_TOUCHKEY_BIT_KEYCODE			GENMASK(2, 0)
> +#define TM2_TOUCHKEY_LED_VOLTAGE_MIN			2500000
> +#define TM2_TOUCHKEY_LED_VOLTAGE_MAX			3300000
> +
> +enum {
> +	TM2_TOUCHKEY_KEY_MENU = 0x1,
> +	TM2_TOUCHKEY_KEY_BACK,
> +};
> +
> +#define tm2_touchkey_power_enable(x) __tm2_touchkey_power_onoff(x, 1)
> +#define tm2_touchkey_power_disable(x) __tm2_touchkey_power_onoff(x, 0)
> +
> +struct tm2_touchkey_data {
> +	struct i2c_client *client;
> +	struct input_dev *input_dev;
> +	struct led_classdev led_dev;
> +
> +	u8 keycode_type;
> +	u8 pressed;
> +	struct work_struct irq_work;
> +
> +	bool power_onoff;
> +	struct regulator *regulator_vcc;	/* 1.8V */
> +	struct regulator *regulator_vdd;	/* 3.3V */
> +};
> +
> +static void tm2_touchkey_led_brightness_set(struct led_classdev *led_dev,
> +						enum led_brightness brightness)
> +{
> +	struct tm2_touchkey_data *samsung_touchkey =
> +	    container_of(led_dev, struct tm2_touchkey_data, led_dev);
> +	u32 volt;
> +	u8 data;
> +
> +	if (brightness == LED_OFF) {
> +		volt = TM2_TOUCHKEY_LED_VOLTAGE_MIN;
> +		data = TM2_TOUCHKEY_CMD_LED_OFF;
> +	} else {
> +		volt = TM2_TOUCHKEY_LED_VOLTAGE_MAX;
> +		data = TM2_TOUCHKEY_CMD_LED_ON;
> +	}
> +
> +	regulator_set_voltage(samsung_touchkey->regulator_vdd, volt, volt);
> +	i2c_smbus_write_byte_data(samsung_touchkey->client,
> +				  TM2_TOUCHKEY_BASE_REG, data);
> +}
> +
> +static int __tm2_touchkey_power_onoff(struct tm2_touchkey_data
> +					  *samsung_touchkey, bool onoff)
> +{
> +	int ret = 0;
> +
> +	if (samsung_touchkey->power_onoff == onoff)
> +		return ret;
> +
> +	if (onoff) {
> +		ret = regulator_enable(samsung_touchkey->regulator_vcc);
> +		if (ret)
> +			return ret;
> +
> +		ret = regulator_enable(samsung_touchkey->regulator_vdd);
> +		if (ret) {
> +			regulator_disable(samsung_touchkey->regulator_vcc);
> +			return ret;
> +		}

I would add a comment about the sleep here.

> +		msleep(150);
> +	} else {
> +		int err;
> +
> +		err = regulator_disable(samsung_touchkey->regulator_vcc);
> +		if (err)
> +			ret = err;
> +
> +		err = regulator_disable(samsung_touchkey->regulator_vdd);
> +		if (err && !ret)
> +			ret = err;
> +	}
> +	samsung_touchkey->power_onoff = onoff;
> +
> +	return ret;
> +}
> +
> +static void tm2_touchkey_irq_work(struct work_struct *irq_work)
> +{
> +	struct tm2_touchkey_data *samsung_touchkey =
> +	    container_of(irq_work, struct tm2_touchkey_data, irq_work);
> +
> +	if (!samsung_touchkey->pressed) {
> +		input_report_key(samsung_touchkey->input_dev, KEY_PHONE, 0);
> +		input_report_key(samsung_touchkey->input_dev, KEY_BACK, 0);
> +	} else {
> +		if (samsung_touchkey->keycode_type == TM2_TOUCHKEY_KEY_MENU)
> +			input_report_key(samsung_touchkey->input_dev,
> +					 KEY_PHONE, 1);
> +		else
> +			input_report_key(samsung_touchkey->input_dev,
> +					 KEY_BACK, 1);
> +	}
> +	input_sync(samsung_touchkey->input_dev);
> +}
> +
> +static irqreturn_t tm2_touchkey_irq_handler(int irq, void *devid)
> +{
> +	struct tm2_touchkey_data *samsung_touchkey = devid;
> +	u32 data;
> +
> +	data = i2c_smbus_read_byte_data(samsung_touchkey->client,
> +					TM2_TOUCHKEY_KEYCODE_REG);
> +
> +	if (data < 0) {
> +		dev_err(&samsung_touchkey->client->dev, "Failed to read i2c data\n");
> +		return IRQ_HANDLED;
> +	}
> +
> +	samsung_touchkey->keycode_type = data & TM2_TOUCHKEY_BIT_KEYCODE;
> +	samsung_touchkey->pressed = !(data & TM2_TOUCHKEY_BIT_PRESS_EV);
> +
> +	if (samsung_touchkey->keycode_type != TM2_TOUCHKEY_KEY_MENU &&
> +	    samsung_touchkey->keycode_type != TM2_TOUCHKEY_KEY_BACK)

Shouldn't at least a debug message be printed here so the user can
know that an error occurred and a correct keycode was not received?

> +		return IRQ_HANDLED;
> +
> +	schedule_work(&samsung_touchkey->irq_work);
> +
> +	return IRQ_HANDLED;
> +}
> +
> +static int tm2_touchkey_probe(struct i2c_client *client,
> +				  const struct i2c_device_id *id)
> +{
> +	struct tm2_touchkey_data *samsung_touchkey;
> +	int ret;
> +
> +	ret = i2c_check_functionality(client->adapter,
> +				      I2C_FUNC_SMBUS_BYTE |
> +				      I2C_FUNC_SMBUS_BYTE_DATA);
> +	if (!ret) {
> +		dev_err(&client->dev, "No I2C functionality found\n");
> +		return -ENODEV;
> +	}
> +
> +	samsung_touchkey = devm_kzalloc(&client->dev,
> +			sizeof(struct tm2_touchkey_data), GFP_KERNEL);
> +
> +	if (!samsung_touchkey) {
> +		dev_err(&client->dev, "Failed to allocate memory.\n");
> +		return -ENOMEM;
> +	}
> +
> +	samsung_touchkey->client = client;
> +	i2c_set_clientdata(client, samsung_touchkey);
> +	INIT_WORK(&samsung_touchkey->irq_work, tm2_touchkey_irq_work);
> +
> +	/* regulator */
> +	samsung_touchkey->regulator_vcc =
> +				devm_regulator_get(&client->dev, "vcc");
> +	if (IS_ERR(samsung_touchkey->regulator_vcc)) {
> +		dev_err(&client->dev, "Failed to get vcc regulator\n");
> +		return PTR_ERR(samsung_touchkey->regulator_vcc);
> +	}
> +
> +	samsung_touchkey->regulator_vdd =
> +				devm_regulator_get(&client->dev, "vdd");
> +	if (IS_ERR(samsung_touchkey->regulator_vdd)) {
> +		dev_err(&client->dev, "Failed to get vdd regulator\n");
> +		return PTR_ERR(samsung_touchkey->regulator_vcc);
> +	}
> +
> +	/* power */
> +	ret = tm2_touchkey_power_enable(samsung_touchkey);
> +	if (ret) {
> +		dev_err(&client->dev, "Failed to enable power\n");
> +		return ret;
> +	}
> +
> +	/* irq */
> +	ret = devm_request_threaded_irq(&client->dev,
> +					client->irq, NULL,
> +					tm2_touchkey_irq_handler,
> +					IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> +					TM2_TOUCHKEY_DEV_NAME,
> +					samsung_touchkey);
> +	if (ret) {
> +		dev_err(&client->dev, "Failed to request threaded irq\n");
> +		return ret;
> +	}
> +
> +	/* input device */
> +	samsung_touchkey->input_dev = devm_input_allocate_device(&client->dev);
> +	if (!samsung_touchkey->input_dev) {
> +		dev_err(&client->dev, "Failed to alloc input device.\n");
> +		return -ENOMEM;
> +	}
> +	samsung_touchkey->input_dev->name = TM2_TOUCHKEY_DEV_NAME;
> +	samsung_touchkey->input_dev->id.bustype = BUS_I2C;
> +	samsung_touchkey->input_dev->dev.parent = &client->dev;
> +
> +	set_bit(EV_KEY, samsung_touchkey->input_dev->evbit);
> +	set_bit(KEY_PHONE, samsung_touchkey->input_dev->keybit);
> +	set_bit(KEY_BACK, samsung_touchkey->input_dev->keybit);
> +	input_set_drvdata(samsung_touchkey->input_dev, samsung_touchkey);
> +
> +	ret = input_register_device(samsung_touchkey->input_dev);
> +	if (ret) {
> +		dev_err(&client->dev, "Failed to register input device.\n");
> +		return ret;
> +	}
> +
> +	/* led device */
> +	samsung_touchkey->led_dev.name = TM2_TOUCHKEY_DEV_NAME;
> +	samsung_touchkey->led_dev.brightness = LED_FULL;
> +	samsung_touchkey->led_dev.max_brightness = LED_FULL;
> +	samsung_touchkey->led_dev.brightness_set =
> +						tm2_touchkey_led_brightness_set;
> +
> +	ret = devm_led_classdev_register(&client->dev,
> +					 &samsung_touchkey->led_dev);
> +	if (ret < 0) {
> +		dev_err(&client->dev, "Failed to register touchkey led\n");
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
> +static void tm2_touchkey_shutdown(struct i2c_client *client)
> +{
> +	struct tm2_touchkey_data *samsung_touchkey =
> +						i2c_get_clientdata(client);
> +	int ret;
> +
> +	disable_irq(client->irq);
> +	ret = tm2_touchkey_power_disable(samsung_touchkey);
> +	if (ret)
> +		dev_err(&client->dev, "Failed to disable power\n");
> +}
> +
> +static int tm2_touchkey_suspend(struct device *dev)
> +{
> +	struct tm2_touchkey_data *samsung_touchkey = dev_get_drvdata(dev);
> +	int ret;
> +
> +	disable_irq(samsung_touchkey->client->irq);
> +	ret = tm2_touchkey_power_disable(samsung_touchkey);
> +	if (ret)
> +		dev_err(dev, "Failed to disable power\n");
> +
> +	return ret;
> +}

These two functions are basically the same, can you factor it out?

> +
> +static int tm2_touchkey_resume(struct device *dev)
> +{
> +	struct tm2_touchkey_data *samsung_touchkey = dev_get_drvdata(dev);
> +	int ret;
> +
> +	enable_irq(samsung_touchkey->client->irq);
> +	ret = tm2_touchkey_power_enable(samsung_touchkey);
> +	if (ret)
> +		dev_err(dev, "Failed to enable power\n");
> +
> +	return ret;
> +}
> +
> +static SIMPLE_DEV_PM_OPS(tm2_touchkey_pm_ops, tm2_touchkey_suspend,
> +							tm2_touchkey_resume);
> +
> +static const struct i2c_device_id tm2_touchkey_id_table[] = {
> +	{TM2_TOUCHKEY_DEV_NAME, 0},
> +	{},
> +};
> +

You need a MODULE_DEVICE_TABLE(i2c, tm2_touchkey_id_table) here so the
module can be autoloaded when the device is registered.

> +static const struct of_device_id tm2_touchkey_of_match[] = {
> +	{.compatible = "samsung,tm2-touchkey",},
> +	{},
> +};
> +

Here a MODULE_DEVICE_TABLE(of, tm2_touchkey_of_match) is not strictly
needed since the I2C core always reports MODALIAS of the form i2c:<dev>
but still is good to have so the I2C core can be fixed at some point.

> +static struct i2c_driver tm2_touchkey_driver = {
> +	.driver = {
> +		.name = TM2_TOUCHKEY_DEV_NAME,
> +		.pm = &tm2_touchkey_pm_ops,
> +		.of_match_table = of_match_ptr(tm2_touchkey_of_match),
> +	},
> +	.probe = tm2_touchkey_probe,
> +	.shutdown = tm2_touchkey_shutdown,
> +	.id_table = tm2_touchkey_id_table,
> +};
> +
> +module_i2c_driver(tm2_touchkey_driver);
> +
> +MODULE_AUTHOR("Beomho Seo <beomho.seo@samsung.com>");
> +MODULE_AUTHOR("Jaechul Lee <jcsing.lee@samsung.com>");
> +MODULE_DESCRIPTION("Samsung touchkey driver");
> +MODULE_LICENSE("GPL v2");
> 

The rest looks good to me, so after the changes I suggested:

Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 2/4] input: tm2-touchkey: Add touchkey driver support for TM2
@ 2017-01-03 13:11         ` Javier Martinez Canillas
  0 siblings, 0 replies; 61+ messages in thread
From: Javier Martinez Canillas @ 2017-01-03 13:11 UTC (permalink / raw)
  To: Jaechul Lee, Dmitry Torokhov, Rob Herring, Mark Rutland,
	Catalin Marinas, Will Deacon, Kukjin Kim, Krzysztof Kozlowski
  Cc: devicetree, linux-samsung-soc, linux-kernel, Andi Shyti,
	Chanwoo Choi, beomho.seo, linux-input, galaxyra,
	linux-arm-kernel

Hello Jaechul,

On 01/03/2017 04:57 AM, Jaechul Lee wrote:
> This patch adds support for the TM2 touch key and led
> functionlity.
> 

s/functionlity/functionality

> The driver interfaces with userspace through an input device and
> reports KEY_PHONE and KEY_BACK event types. LED brightness can be
> controlled by "/sys/class/leds/tm2-touchkey/brightness".
> 
> Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
> ---
>  drivers/input/keyboard/Kconfig        |  11 ++
>  drivers/input/keyboard/Makefile       |   1 +
>  drivers/input/keyboard/tm2-touchkey.c | 326 ++++++++++++++++++++++++++++++++++
>  3 files changed, 338 insertions(+)
>  create mode 100644 drivers/input/keyboard/tm2-touchkey.c
> 
> diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
> index cbd75cf..72c0ba1 100644
> --- a/drivers/input/keyboard/Kconfig
> +++ b/drivers/input/keyboard/Kconfig
> @@ -666,6 +666,17 @@ config KEYBOARD_TC3589X
>  	  To compile this driver as a module, choose M here: the
>  	  module will be called tc3589x-keypad.
>  
> +config KEYBOARD_TM2_TOUCHKEY
> +	tristate "tm2-touchkey support"
> +	depends on I2C
> +	help
> +	  Say Y here to enable the tm2-touchkey.
> +	  touchkey driver for tm2. This driver can enable
> +	  the interrupt and make input events and control led brightness.
> +
> +	  To compile this driver as a module, choose M here.
> +	  module will be called tm2-touchkey
> +
>  config KEYBOARD_TWL4030
>  	tristate "TI TWL4030/TWL5030/TPS659x0 keypad support"
>  	depends on TWL4030_CORE
> diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
> index d9f4cfc..7d9acff 100644
> --- a/drivers/input/keyboard/Makefile
> +++ b/drivers/input/keyboard/Makefile
> @@ -61,6 +61,7 @@ obj-$(CONFIG_KEYBOARD_SUN4I_LRADC)	+= sun4i-lradc-keys.o
>  obj-$(CONFIG_KEYBOARD_SUNKBD)		+= sunkbd.o
>  obj-$(CONFIG_KEYBOARD_TC3589X)		+= tc3589x-keypad.o
>  obj-$(CONFIG_KEYBOARD_TEGRA)		+= tegra-kbc.o
> +obj-$(CONFIG_KEYBOARD_TM2_TOUCHKEY)	+= tm2-touchkey.o
>  obj-$(CONFIG_KEYBOARD_TWL4030)		+= twl4030_keypad.o
>  obj-$(CONFIG_KEYBOARD_XTKBD)		+= xtkbd.o
>  obj-$(CONFIG_KEYBOARD_W90P910)		+= w90p910_keypad.o
> diff --git a/drivers/input/keyboard/tm2-touchkey.c b/drivers/input/keyboard/tm2-touchkey.c
> new file mode 100644
> index 0000000..d9575d8
> --- /dev/null
> +++ b/drivers/input/keyboard/tm2-touchkey.c
> @@ -0,0 +1,326 @@
> +/*
> + * Driver for keys on GPIO lines capable of generating interrupts.
> + *
> + * Copyright 2005 Phil Blundell
> + * Copyright 2016 Samsung Electronics Co., Ltd.
> + *
> + * Author: Beomho Seo <beomho.seo@samsung.com>
> + * Author: Jaechul Lee <jcsing.lee@samsung.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.
> + */
> +
> +#include <linux/bitops.h>
> +#include <linux/delay.h>
> +#include <linux/device.h>
> +#include <linux/i2c.h>
> +#include <linux/input.h>
> +#include <linux/interrupt.h>
> +#include <linux/irq.h>
> +#include <linux/leds.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/pm.h>
> +#include <linux/regulator/consumer.h>
> +#include <linux/workqueue.h>
> +
> +#define TM2_TOUCHKEY_DEV_NAME			"tm2-touchkey"
> +#define TM2_TOUCHKEY_KEYCODE_REG			0x03
> +#define TM2_TOUCHKEY_BASE_REG			0x00
> +#define TM2_TOUCHKEY_CMD_LED_ON			0x10
> +#define TM2_TOUCHKEY_CMD_LED_OFF			0x20
> +#define TM2_TOUCHKEY_BIT_PRESS_EV			BIT(3)
> +#define TM2_TOUCHKEY_BIT_KEYCODE			GENMASK(2, 0)
> +#define TM2_TOUCHKEY_LED_VOLTAGE_MIN			2500000
> +#define TM2_TOUCHKEY_LED_VOLTAGE_MAX			3300000
> +
> +enum {
> +	TM2_TOUCHKEY_KEY_MENU = 0x1,
> +	TM2_TOUCHKEY_KEY_BACK,
> +};
> +
> +#define tm2_touchkey_power_enable(x) __tm2_touchkey_power_onoff(x, 1)
> +#define tm2_touchkey_power_disable(x) __tm2_touchkey_power_onoff(x, 0)
> +
> +struct tm2_touchkey_data {
> +	struct i2c_client *client;
> +	struct input_dev *input_dev;
> +	struct led_classdev led_dev;
> +
> +	u8 keycode_type;
> +	u8 pressed;
> +	struct work_struct irq_work;
> +
> +	bool power_onoff;
> +	struct regulator *regulator_vcc;	/* 1.8V */
> +	struct regulator *regulator_vdd;	/* 3.3V */
> +};
> +
> +static void tm2_touchkey_led_brightness_set(struct led_classdev *led_dev,
> +						enum led_brightness brightness)
> +{
> +	struct tm2_touchkey_data *samsung_touchkey =
> +	    container_of(led_dev, struct tm2_touchkey_data, led_dev);
> +	u32 volt;
> +	u8 data;
> +
> +	if (brightness == LED_OFF) {
> +		volt = TM2_TOUCHKEY_LED_VOLTAGE_MIN;
> +		data = TM2_TOUCHKEY_CMD_LED_OFF;
> +	} else {
> +		volt = TM2_TOUCHKEY_LED_VOLTAGE_MAX;
> +		data = TM2_TOUCHKEY_CMD_LED_ON;
> +	}
> +
> +	regulator_set_voltage(samsung_touchkey->regulator_vdd, volt, volt);
> +	i2c_smbus_write_byte_data(samsung_touchkey->client,
> +				  TM2_TOUCHKEY_BASE_REG, data);
> +}
> +
> +static int __tm2_touchkey_power_onoff(struct tm2_touchkey_data
> +					  *samsung_touchkey, bool onoff)
> +{
> +	int ret = 0;
> +
> +	if (samsung_touchkey->power_onoff == onoff)
> +		return ret;
> +
> +	if (onoff) {
> +		ret = regulator_enable(samsung_touchkey->regulator_vcc);
> +		if (ret)
> +			return ret;
> +
> +		ret = regulator_enable(samsung_touchkey->regulator_vdd);
> +		if (ret) {
> +			regulator_disable(samsung_touchkey->regulator_vcc);
> +			return ret;
> +		}

I would add a comment about the sleep here.

> +		msleep(150);
> +	} else {
> +		int err;
> +
> +		err = regulator_disable(samsung_touchkey->regulator_vcc);
> +		if (err)
> +			ret = err;
> +
> +		err = regulator_disable(samsung_touchkey->regulator_vdd);
> +		if (err && !ret)
> +			ret = err;
> +	}
> +	samsung_touchkey->power_onoff = onoff;
> +
> +	return ret;
> +}
> +
> +static void tm2_touchkey_irq_work(struct work_struct *irq_work)
> +{
> +	struct tm2_touchkey_data *samsung_touchkey =
> +	    container_of(irq_work, struct tm2_touchkey_data, irq_work);
> +
> +	if (!samsung_touchkey->pressed) {
> +		input_report_key(samsung_touchkey->input_dev, KEY_PHONE, 0);
> +		input_report_key(samsung_touchkey->input_dev, KEY_BACK, 0);
> +	} else {
> +		if (samsung_touchkey->keycode_type == TM2_TOUCHKEY_KEY_MENU)
> +			input_report_key(samsung_touchkey->input_dev,
> +					 KEY_PHONE, 1);
> +		else
> +			input_report_key(samsung_touchkey->input_dev,
> +					 KEY_BACK, 1);
> +	}
> +	input_sync(samsung_touchkey->input_dev);
> +}
> +
> +static irqreturn_t tm2_touchkey_irq_handler(int irq, void *devid)
> +{
> +	struct tm2_touchkey_data *samsung_touchkey = devid;
> +	u32 data;
> +
> +	data = i2c_smbus_read_byte_data(samsung_touchkey->client,
> +					TM2_TOUCHKEY_KEYCODE_REG);
> +
> +	if (data < 0) {
> +		dev_err(&samsung_touchkey->client->dev, "Failed to read i2c data\n");
> +		return IRQ_HANDLED;
> +	}
> +
> +	samsung_touchkey->keycode_type = data & TM2_TOUCHKEY_BIT_KEYCODE;
> +	samsung_touchkey->pressed = !(data & TM2_TOUCHKEY_BIT_PRESS_EV);
> +
> +	if (samsung_touchkey->keycode_type != TM2_TOUCHKEY_KEY_MENU &&
> +	    samsung_touchkey->keycode_type != TM2_TOUCHKEY_KEY_BACK)

Shouldn't at least a debug message be printed here so the user can
know that an error occurred and a correct keycode was not received?

> +		return IRQ_HANDLED;
> +
> +	schedule_work(&samsung_touchkey->irq_work);
> +
> +	return IRQ_HANDLED;
> +}
> +
> +static int tm2_touchkey_probe(struct i2c_client *client,
> +				  const struct i2c_device_id *id)
> +{
> +	struct tm2_touchkey_data *samsung_touchkey;
> +	int ret;
> +
> +	ret = i2c_check_functionality(client->adapter,
> +				      I2C_FUNC_SMBUS_BYTE |
> +				      I2C_FUNC_SMBUS_BYTE_DATA);
> +	if (!ret) {
> +		dev_err(&client->dev, "No I2C functionality found\n");
> +		return -ENODEV;
> +	}
> +
> +	samsung_touchkey = devm_kzalloc(&client->dev,
> +			sizeof(struct tm2_touchkey_data), GFP_KERNEL);
> +
> +	if (!samsung_touchkey) {
> +		dev_err(&client->dev, "Failed to allocate memory.\n");
> +		return -ENOMEM;
> +	}
> +
> +	samsung_touchkey->client = client;
> +	i2c_set_clientdata(client, samsung_touchkey);
> +	INIT_WORK(&samsung_touchkey->irq_work, tm2_touchkey_irq_work);
> +
> +	/* regulator */
> +	samsung_touchkey->regulator_vcc =
> +				devm_regulator_get(&client->dev, "vcc");
> +	if (IS_ERR(samsung_touchkey->regulator_vcc)) {
> +		dev_err(&client->dev, "Failed to get vcc regulator\n");
> +		return PTR_ERR(samsung_touchkey->regulator_vcc);
> +	}
> +
> +	samsung_touchkey->regulator_vdd =
> +				devm_regulator_get(&client->dev, "vdd");
> +	if (IS_ERR(samsung_touchkey->regulator_vdd)) {
> +		dev_err(&client->dev, "Failed to get vdd regulator\n");
> +		return PTR_ERR(samsung_touchkey->regulator_vcc);
> +	}
> +
> +	/* power */
> +	ret = tm2_touchkey_power_enable(samsung_touchkey);
> +	if (ret) {
> +		dev_err(&client->dev, "Failed to enable power\n");
> +		return ret;
> +	}
> +
> +	/* irq */
> +	ret = devm_request_threaded_irq(&client->dev,
> +					client->irq, NULL,
> +					tm2_touchkey_irq_handler,
> +					IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> +					TM2_TOUCHKEY_DEV_NAME,
> +					samsung_touchkey);
> +	if (ret) {
> +		dev_err(&client->dev, "Failed to request threaded irq\n");
> +		return ret;
> +	}
> +
> +	/* input device */
> +	samsung_touchkey->input_dev = devm_input_allocate_device(&client->dev);
> +	if (!samsung_touchkey->input_dev) {
> +		dev_err(&client->dev, "Failed to alloc input device.\n");
> +		return -ENOMEM;
> +	}
> +	samsung_touchkey->input_dev->name = TM2_TOUCHKEY_DEV_NAME;
> +	samsung_touchkey->input_dev->id.bustype = BUS_I2C;
> +	samsung_touchkey->input_dev->dev.parent = &client->dev;
> +
> +	set_bit(EV_KEY, samsung_touchkey->input_dev->evbit);
> +	set_bit(KEY_PHONE, samsung_touchkey->input_dev->keybit);
> +	set_bit(KEY_BACK, samsung_touchkey->input_dev->keybit);
> +	input_set_drvdata(samsung_touchkey->input_dev, samsung_touchkey);
> +
> +	ret = input_register_device(samsung_touchkey->input_dev);
> +	if (ret) {
> +		dev_err(&client->dev, "Failed to register input device.\n");
> +		return ret;
> +	}
> +
> +	/* led device */
> +	samsung_touchkey->led_dev.name = TM2_TOUCHKEY_DEV_NAME;
> +	samsung_touchkey->led_dev.brightness = LED_FULL;
> +	samsung_touchkey->led_dev.max_brightness = LED_FULL;
> +	samsung_touchkey->led_dev.brightness_set =
> +						tm2_touchkey_led_brightness_set;
> +
> +	ret = devm_led_classdev_register(&client->dev,
> +					 &samsung_touchkey->led_dev);
> +	if (ret < 0) {
> +		dev_err(&client->dev, "Failed to register touchkey led\n");
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
> +static void tm2_touchkey_shutdown(struct i2c_client *client)
> +{
> +	struct tm2_touchkey_data *samsung_touchkey =
> +						i2c_get_clientdata(client);
> +	int ret;
> +
> +	disable_irq(client->irq);
> +	ret = tm2_touchkey_power_disable(samsung_touchkey);
> +	if (ret)
> +		dev_err(&client->dev, "Failed to disable power\n");
> +}
> +
> +static int tm2_touchkey_suspend(struct device *dev)
> +{
> +	struct tm2_touchkey_data *samsung_touchkey = dev_get_drvdata(dev);
> +	int ret;
> +
> +	disable_irq(samsung_touchkey->client->irq);
> +	ret = tm2_touchkey_power_disable(samsung_touchkey);
> +	if (ret)
> +		dev_err(dev, "Failed to disable power\n");
> +
> +	return ret;
> +}

These two functions are basically the same, can you factor it out?

> +
> +static int tm2_touchkey_resume(struct device *dev)
> +{
> +	struct tm2_touchkey_data *samsung_touchkey = dev_get_drvdata(dev);
> +	int ret;
> +
> +	enable_irq(samsung_touchkey->client->irq);
> +	ret = tm2_touchkey_power_enable(samsung_touchkey);
> +	if (ret)
> +		dev_err(dev, "Failed to enable power\n");
> +
> +	return ret;
> +}
> +
> +static SIMPLE_DEV_PM_OPS(tm2_touchkey_pm_ops, tm2_touchkey_suspend,
> +							tm2_touchkey_resume);
> +
> +static const struct i2c_device_id tm2_touchkey_id_table[] = {
> +	{TM2_TOUCHKEY_DEV_NAME, 0},
> +	{},
> +};
> +

You need a MODULE_DEVICE_TABLE(i2c, tm2_touchkey_id_table) here so the
module can be autoloaded when the device is registered.

> +static const struct of_device_id tm2_touchkey_of_match[] = {
> +	{.compatible = "samsung,tm2-touchkey",},
> +	{},
> +};
> +

Here a MODULE_DEVICE_TABLE(of, tm2_touchkey_of_match) is not strictly
needed since the I2C core always reports MODALIAS of the form i2c:<dev>
but still is good to have so the I2C core can be fixed at some point.

> +static struct i2c_driver tm2_touchkey_driver = {
> +	.driver = {
> +		.name = TM2_TOUCHKEY_DEV_NAME,
> +		.pm = &tm2_touchkey_pm_ops,
> +		.of_match_table = of_match_ptr(tm2_touchkey_of_match),
> +	},
> +	.probe = tm2_touchkey_probe,
> +	.shutdown = tm2_touchkey_shutdown,
> +	.id_table = tm2_touchkey_id_table,
> +};
> +
> +module_i2c_driver(tm2_touchkey_driver);
> +
> +MODULE_AUTHOR("Beomho Seo <beomho.seo@samsung.com>");
> +MODULE_AUTHOR("Jaechul Lee <jcsing.lee@samsung.com>");
> +MODULE_DESCRIPTION("Samsung touchkey driver");
> +MODULE_LICENSE("GPL v2");
> 

The rest looks good to me, so after the changes I suggested:

Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH 2/4] input: tm2-touchkey: Add touchkey driver support for TM2
@ 2017-01-03 13:11         ` Javier Martinez Canillas
  0 siblings, 0 replies; 61+ messages in thread
From: Javier Martinez Canillas @ 2017-01-03 13:11 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Jaechul,

On 01/03/2017 04:57 AM, Jaechul Lee wrote:
> This patch adds support for the TM2 touch key and led
> functionlity.
> 

s/functionlity/functionality

> The driver interfaces with userspace through an input device and
> reports KEY_PHONE and KEY_BACK event types. LED brightness can be
> controlled by "/sys/class/leds/tm2-touchkey/brightness".
> 
> Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
> ---
>  drivers/input/keyboard/Kconfig        |  11 ++
>  drivers/input/keyboard/Makefile       |   1 +
>  drivers/input/keyboard/tm2-touchkey.c | 326 ++++++++++++++++++++++++++++++++++
>  3 files changed, 338 insertions(+)
>  create mode 100644 drivers/input/keyboard/tm2-touchkey.c
> 
> diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
> index cbd75cf..72c0ba1 100644
> --- a/drivers/input/keyboard/Kconfig
> +++ b/drivers/input/keyboard/Kconfig
> @@ -666,6 +666,17 @@ config KEYBOARD_TC3589X
>  	  To compile this driver as a module, choose M here: the
>  	  module will be called tc3589x-keypad.
>  
> +config KEYBOARD_TM2_TOUCHKEY
> +	tristate "tm2-touchkey support"
> +	depends on I2C
> +	help
> +	  Say Y here to enable the tm2-touchkey.
> +	  touchkey driver for tm2. This driver can enable
> +	  the interrupt and make input events and control led brightness.
> +
> +	  To compile this driver as a module, choose M here.
> +	  module will be called tm2-touchkey
> +
>  config KEYBOARD_TWL4030
>  	tristate "TI TWL4030/TWL5030/TPS659x0 keypad support"
>  	depends on TWL4030_CORE
> diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
> index d9f4cfc..7d9acff 100644
> --- a/drivers/input/keyboard/Makefile
> +++ b/drivers/input/keyboard/Makefile
> @@ -61,6 +61,7 @@ obj-$(CONFIG_KEYBOARD_SUN4I_LRADC)	+= sun4i-lradc-keys.o
>  obj-$(CONFIG_KEYBOARD_SUNKBD)		+= sunkbd.o
>  obj-$(CONFIG_KEYBOARD_TC3589X)		+= tc3589x-keypad.o
>  obj-$(CONFIG_KEYBOARD_TEGRA)		+= tegra-kbc.o
> +obj-$(CONFIG_KEYBOARD_TM2_TOUCHKEY)	+= tm2-touchkey.o
>  obj-$(CONFIG_KEYBOARD_TWL4030)		+= twl4030_keypad.o
>  obj-$(CONFIG_KEYBOARD_XTKBD)		+= xtkbd.o
>  obj-$(CONFIG_KEYBOARD_W90P910)		+= w90p910_keypad.o
> diff --git a/drivers/input/keyboard/tm2-touchkey.c b/drivers/input/keyboard/tm2-touchkey.c
> new file mode 100644
> index 0000000..d9575d8
> --- /dev/null
> +++ b/drivers/input/keyboard/tm2-touchkey.c
> @@ -0,0 +1,326 @@
> +/*
> + * Driver for keys on GPIO lines capable of generating interrupts.
> + *
> + * Copyright 2005 Phil Blundell
> + * Copyright 2016 Samsung Electronics Co., Ltd.
> + *
> + * Author: Beomho Seo <beomho.seo@samsung.com>
> + * Author: Jaechul Lee <jcsing.lee@samsung.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.
> + */
> +
> +#include <linux/bitops.h>
> +#include <linux/delay.h>
> +#include <linux/device.h>
> +#include <linux/i2c.h>
> +#include <linux/input.h>
> +#include <linux/interrupt.h>
> +#include <linux/irq.h>
> +#include <linux/leds.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/pm.h>
> +#include <linux/regulator/consumer.h>
> +#include <linux/workqueue.h>
> +
> +#define TM2_TOUCHKEY_DEV_NAME			"tm2-touchkey"
> +#define TM2_TOUCHKEY_KEYCODE_REG			0x03
> +#define TM2_TOUCHKEY_BASE_REG			0x00
> +#define TM2_TOUCHKEY_CMD_LED_ON			0x10
> +#define TM2_TOUCHKEY_CMD_LED_OFF			0x20
> +#define TM2_TOUCHKEY_BIT_PRESS_EV			BIT(3)
> +#define TM2_TOUCHKEY_BIT_KEYCODE			GENMASK(2, 0)
> +#define TM2_TOUCHKEY_LED_VOLTAGE_MIN			2500000
> +#define TM2_TOUCHKEY_LED_VOLTAGE_MAX			3300000
> +
> +enum {
> +	TM2_TOUCHKEY_KEY_MENU = 0x1,
> +	TM2_TOUCHKEY_KEY_BACK,
> +};
> +
> +#define tm2_touchkey_power_enable(x) __tm2_touchkey_power_onoff(x, 1)
> +#define tm2_touchkey_power_disable(x) __tm2_touchkey_power_onoff(x, 0)
> +
> +struct tm2_touchkey_data {
> +	struct i2c_client *client;
> +	struct input_dev *input_dev;
> +	struct led_classdev led_dev;
> +
> +	u8 keycode_type;
> +	u8 pressed;
> +	struct work_struct irq_work;
> +
> +	bool power_onoff;
> +	struct regulator *regulator_vcc;	/* 1.8V */
> +	struct regulator *regulator_vdd;	/* 3.3V */
> +};
> +
> +static void tm2_touchkey_led_brightness_set(struct led_classdev *led_dev,
> +						enum led_brightness brightness)
> +{
> +	struct tm2_touchkey_data *samsung_touchkey =
> +	    container_of(led_dev, struct tm2_touchkey_data, led_dev);
> +	u32 volt;
> +	u8 data;
> +
> +	if (brightness == LED_OFF) {
> +		volt = TM2_TOUCHKEY_LED_VOLTAGE_MIN;
> +		data = TM2_TOUCHKEY_CMD_LED_OFF;
> +	} else {
> +		volt = TM2_TOUCHKEY_LED_VOLTAGE_MAX;
> +		data = TM2_TOUCHKEY_CMD_LED_ON;
> +	}
> +
> +	regulator_set_voltage(samsung_touchkey->regulator_vdd, volt, volt);
> +	i2c_smbus_write_byte_data(samsung_touchkey->client,
> +				  TM2_TOUCHKEY_BASE_REG, data);
> +}
> +
> +static int __tm2_touchkey_power_onoff(struct tm2_touchkey_data
> +					  *samsung_touchkey, bool onoff)
> +{
> +	int ret = 0;
> +
> +	if (samsung_touchkey->power_onoff == onoff)
> +		return ret;
> +
> +	if (onoff) {
> +		ret = regulator_enable(samsung_touchkey->regulator_vcc);
> +		if (ret)
> +			return ret;
> +
> +		ret = regulator_enable(samsung_touchkey->regulator_vdd);
> +		if (ret) {
> +			regulator_disable(samsung_touchkey->regulator_vcc);
> +			return ret;
> +		}

I would add a comment about the sleep here.

> +		msleep(150);
> +	} else {
> +		int err;
> +
> +		err = regulator_disable(samsung_touchkey->regulator_vcc);
> +		if (err)
> +			ret = err;
> +
> +		err = regulator_disable(samsung_touchkey->regulator_vdd);
> +		if (err && !ret)
> +			ret = err;
> +	}
> +	samsung_touchkey->power_onoff = onoff;
> +
> +	return ret;
> +}
> +
> +static void tm2_touchkey_irq_work(struct work_struct *irq_work)
> +{
> +	struct tm2_touchkey_data *samsung_touchkey =
> +	    container_of(irq_work, struct tm2_touchkey_data, irq_work);
> +
> +	if (!samsung_touchkey->pressed) {
> +		input_report_key(samsung_touchkey->input_dev, KEY_PHONE, 0);
> +		input_report_key(samsung_touchkey->input_dev, KEY_BACK, 0);
> +	} else {
> +		if (samsung_touchkey->keycode_type == TM2_TOUCHKEY_KEY_MENU)
> +			input_report_key(samsung_touchkey->input_dev,
> +					 KEY_PHONE, 1);
> +		else
> +			input_report_key(samsung_touchkey->input_dev,
> +					 KEY_BACK, 1);
> +	}
> +	input_sync(samsung_touchkey->input_dev);
> +}
> +
> +static irqreturn_t tm2_touchkey_irq_handler(int irq, void *devid)
> +{
> +	struct tm2_touchkey_data *samsung_touchkey = devid;
> +	u32 data;
> +
> +	data = i2c_smbus_read_byte_data(samsung_touchkey->client,
> +					TM2_TOUCHKEY_KEYCODE_REG);
> +
> +	if (data < 0) {
> +		dev_err(&samsung_touchkey->client->dev, "Failed to read i2c data\n");
> +		return IRQ_HANDLED;
> +	}
> +
> +	samsung_touchkey->keycode_type = data & TM2_TOUCHKEY_BIT_KEYCODE;
> +	samsung_touchkey->pressed = !(data & TM2_TOUCHKEY_BIT_PRESS_EV);
> +
> +	if (samsung_touchkey->keycode_type != TM2_TOUCHKEY_KEY_MENU &&
> +	    samsung_touchkey->keycode_type != TM2_TOUCHKEY_KEY_BACK)

Shouldn't at least a debug message be printed here so the user can
know that an error occurred and a correct keycode was not received?

> +		return IRQ_HANDLED;
> +
> +	schedule_work(&samsung_touchkey->irq_work);
> +
> +	return IRQ_HANDLED;
> +}
> +
> +static int tm2_touchkey_probe(struct i2c_client *client,
> +				  const struct i2c_device_id *id)
> +{
> +	struct tm2_touchkey_data *samsung_touchkey;
> +	int ret;
> +
> +	ret = i2c_check_functionality(client->adapter,
> +				      I2C_FUNC_SMBUS_BYTE |
> +				      I2C_FUNC_SMBUS_BYTE_DATA);
> +	if (!ret) {
> +		dev_err(&client->dev, "No I2C functionality found\n");
> +		return -ENODEV;
> +	}
> +
> +	samsung_touchkey = devm_kzalloc(&client->dev,
> +			sizeof(struct tm2_touchkey_data), GFP_KERNEL);
> +
> +	if (!samsung_touchkey) {
> +		dev_err(&client->dev, "Failed to allocate memory.\n");
> +		return -ENOMEM;
> +	}
> +
> +	samsung_touchkey->client = client;
> +	i2c_set_clientdata(client, samsung_touchkey);
> +	INIT_WORK(&samsung_touchkey->irq_work, tm2_touchkey_irq_work);
> +
> +	/* regulator */
> +	samsung_touchkey->regulator_vcc =
> +				devm_regulator_get(&client->dev, "vcc");
> +	if (IS_ERR(samsung_touchkey->regulator_vcc)) {
> +		dev_err(&client->dev, "Failed to get vcc regulator\n");
> +		return PTR_ERR(samsung_touchkey->regulator_vcc);
> +	}
> +
> +	samsung_touchkey->regulator_vdd =
> +				devm_regulator_get(&client->dev, "vdd");
> +	if (IS_ERR(samsung_touchkey->regulator_vdd)) {
> +		dev_err(&client->dev, "Failed to get vdd regulator\n");
> +		return PTR_ERR(samsung_touchkey->regulator_vcc);
> +	}
> +
> +	/* power */
> +	ret = tm2_touchkey_power_enable(samsung_touchkey);
> +	if (ret) {
> +		dev_err(&client->dev, "Failed to enable power\n");
> +		return ret;
> +	}
> +
> +	/* irq */
> +	ret = devm_request_threaded_irq(&client->dev,
> +					client->irq, NULL,
> +					tm2_touchkey_irq_handler,
> +					IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> +					TM2_TOUCHKEY_DEV_NAME,
> +					samsung_touchkey);
> +	if (ret) {
> +		dev_err(&client->dev, "Failed to request threaded irq\n");
> +		return ret;
> +	}
> +
> +	/* input device */
> +	samsung_touchkey->input_dev = devm_input_allocate_device(&client->dev);
> +	if (!samsung_touchkey->input_dev) {
> +		dev_err(&client->dev, "Failed to alloc input device.\n");
> +		return -ENOMEM;
> +	}
> +	samsung_touchkey->input_dev->name = TM2_TOUCHKEY_DEV_NAME;
> +	samsung_touchkey->input_dev->id.bustype = BUS_I2C;
> +	samsung_touchkey->input_dev->dev.parent = &client->dev;
> +
> +	set_bit(EV_KEY, samsung_touchkey->input_dev->evbit);
> +	set_bit(KEY_PHONE, samsung_touchkey->input_dev->keybit);
> +	set_bit(KEY_BACK, samsung_touchkey->input_dev->keybit);
> +	input_set_drvdata(samsung_touchkey->input_dev, samsung_touchkey);
> +
> +	ret = input_register_device(samsung_touchkey->input_dev);
> +	if (ret) {
> +		dev_err(&client->dev, "Failed to register input device.\n");
> +		return ret;
> +	}
> +
> +	/* led device */
> +	samsung_touchkey->led_dev.name = TM2_TOUCHKEY_DEV_NAME;
> +	samsung_touchkey->led_dev.brightness = LED_FULL;
> +	samsung_touchkey->led_dev.max_brightness = LED_FULL;
> +	samsung_touchkey->led_dev.brightness_set =
> +						tm2_touchkey_led_brightness_set;
> +
> +	ret = devm_led_classdev_register(&client->dev,
> +					 &samsung_touchkey->led_dev);
> +	if (ret < 0) {
> +		dev_err(&client->dev, "Failed to register touchkey led\n");
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
> +static void tm2_touchkey_shutdown(struct i2c_client *client)
> +{
> +	struct tm2_touchkey_data *samsung_touchkey =
> +						i2c_get_clientdata(client);
> +	int ret;
> +
> +	disable_irq(client->irq);
> +	ret = tm2_touchkey_power_disable(samsung_touchkey);
> +	if (ret)
> +		dev_err(&client->dev, "Failed to disable power\n");
> +}
> +
> +static int tm2_touchkey_suspend(struct device *dev)
> +{
> +	struct tm2_touchkey_data *samsung_touchkey = dev_get_drvdata(dev);
> +	int ret;
> +
> +	disable_irq(samsung_touchkey->client->irq);
> +	ret = tm2_touchkey_power_disable(samsung_touchkey);
> +	if (ret)
> +		dev_err(dev, "Failed to disable power\n");
> +
> +	return ret;
> +}

These two functions are basically the same, can you factor it out?

> +
> +static int tm2_touchkey_resume(struct device *dev)
> +{
> +	struct tm2_touchkey_data *samsung_touchkey = dev_get_drvdata(dev);
> +	int ret;
> +
> +	enable_irq(samsung_touchkey->client->irq);
> +	ret = tm2_touchkey_power_enable(samsung_touchkey);
> +	if (ret)
> +		dev_err(dev, "Failed to enable power\n");
> +
> +	return ret;
> +}
> +
> +static SIMPLE_DEV_PM_OPS(tm2_touchkey_pm_ops, tm2_touchkey_suspend,
> +							tm2_touchkey_resume);
> +
> +static const struct i2c_device_id tm2_touchkey_id_table[] = {
> +	{TM2_TOUCHKEY_DEV_NAME, 0},
> +	{},
> +};
> +

You need a MODULE_DEVICE_TABLE(i2c, tm2_touchkey_id_table) here so the
module can be autoloaded when the device is registered.

> +static const struct of_device_id tm2_touchkey_of_match[] = {
> +	{.compatible = "samsung,tm2-touchkey",},
> +	{},
> +};
> +

Here a MODULE_DEVICE_TABLE(of, tm2_touchkey_of_match) is not strictly
needed since the I2C core always reports MODALIAS of the form i2c:<dev>
but still is good to have so the I2C core can be fixed at some point.

> +static struct i2c_driver tm2_touchkey_driver = {
> +	.driver = {
> +		.name = TM2_TOUCHKEY_DEV_NAME,
> +		.pm = &tm2_touchkey_pm_ops,
> +		.of_match_table = of_match_ptr(tm2_touchkey_of_match),
> +	},
> +	.probe = tm2_touchkey_probe,
> +	.shutdown = tm2_touchkey_shutdown,
> +	.id_table = tm2_touchkey_id_table,
> +};
> +
> +module_i2c_driver(tm2_touchkey_driver);
> +
> +MODULE_AUTHOR("Beomho Seo <beomho.seo@samsung.com>");
> +MODULE_AUTHOR("Jaechul Lee <jcsing.lee@samsung.com>");
> +MODULE_DESCRIPTION("Samsung touchkey driver");
> +MODULE_LICENSE("GPL v2");
> 

The rest looks good to me, so after the changes I suggested:

Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 4/4] arm64: dts: exynos: Add tm2 touchkey node
  2017-01-03  7:57       ` Jaechul Lee
@ 2017-01-03 13:14         ` Javier Martinez Canillas
  -1 siblings, 0 replies; 61+ messages in thread
From: Javier Martinez Canillas @ 2017-01-03 13:14 UTC (permalink / raw)
  To: Jaechul Lee, Dmitry Torokhov, Rob Herring, Mark Rutland,
	Catalin Marinas, Will Deacon, Kukjin Kim, Krzysztof Kozlowski
  Cc: Andi Shyti, Chanwoo Choi, beomho.seo, galaxyra, linux-arm-kernel,
	linux-input, devicetree, linux-kernel, linux-samsung-soc

Hello Jaechul,

On 01/03/2017 04:57 AM, Jaechul Lee wrote:
> Add DT node support for TM2 touchkey device.
> 
> Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> ---
>  arch/arm64/boot/dts/exynos/exynos5433-tm2.dts | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts b/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts
> index 887a1f1..ef7d21c 100644
> --- a/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts
> +++ b/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts
> @@ -18,3 +18,15 @@
>  	compatible = "samsung,tm2e", "samsung,exynos5433";
>  };
>  
> +&hsi2c_9 {
> +	status = "okay";
> +
> +	touchkey@20 {
> +		compatible = "samsung,tm2-touchkey";
> +		reg = <0x20>;
> +		interrupt-parent = <&gpa3>;
> +		interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
> +		vcc-supply = <&ldo32_reg>;
> +		vdd-supply = <&ldo33_reg>;
> +	};
> +};
> 

If you re-spin with the changes suggested by Chanwoo instead
of the commont .dtsi, feel free to add:

Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH 4/4] arm64: dts: exynos: Add tm2 touchkey node
@ 2017-01-03 13:14         ` Javier Martinez Canillas
  0 siblings, 0 replies; 61+ messages in thread
From: Javier Martinez Canillas @ 2017-01-03 13:14 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Jaechul,

On 01/03/2017 04:57 AM, Jaechul Lee wrote:
> Add DT node support for TM2 touchkey device.
> 
> Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> ---
>  arch/arm64/boot/dts/exynos/exynos5433-tm2.dts | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts b/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts
> index 887a1f1..ef7d21c 100644
> --- a/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts
> +++ b/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts
> @@ -18,3 +18,15 @@
>  	compatible = "samsung,tm2e", "samsung,exynos5433";
>  };
>  
> +&hsi2c_9 {
> +	status = "okay";
> +
> +	touchkey at 20 {
> +		compatible = "samsung,tm2-touchkey";
> +		reg = <0x20>;
> +		interrupt-parent = <&gpa3>;
> +		interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
> +		vcc-supply = <&ldo32_reg>;
> +		vdd-supply = <&ldo33_reg>;
> +	};
> +};
> 

If you re-spin with the changes suggested by Chanwoo instead
of the commont .dtsi, feel free to add:

Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
  2017-01-03 12:15                     ` Javier Martinez Canillas
@ 2017-01-03 14:40                       ` Andi Shyti
  -1 siblings, 0 replies; 61+ messages in thread
From: Andi Shyti @ 2017-01-03 14:40 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: Andi Shyti, Chanwoo Choi, Mark Rutland, devicetree,
	linux-samsung-soc, Dmitry Torokhov, Catalin Marinas, Jaechul Lee,
	Will Deacon, linux-kernel, Krzysztof Kozlowski, Chanwoo Choi,
	Rob Herring, Kukjin Kim, linux-input, galaxyra, beomho.seo,
	linux-arm-kernel

Hi,

> FWIW, I also agree with Chanwoo that the difference is too small to
> need a common .dtsi file.

in principle I don't like "switching on and off" properties by
overwriting them with "status = disable", unless it's really
necessary (and this case is not). Even for small differences. It
makes the DTS harder to read and duplicates nodes with different
values throughout the DTS include chain.

In my opinion this approach should be discouraged.

Besides, there are other overwritten differences in tm2e.dts that
I think should be separated as well. The "common" file approach is
widely used in arm/boot/dts/exynos* files.

The "status = disable" looks to me more like a temporary hack
rather than a permanent solution.

In any case, still up to you :)

Andi

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
@ 2017-01-03 14:40                       ` Andi Shyti
  0 siblings, 0 replies; 61+ messages in thread
From: Andi Shyti @ 2017-01-03 14:40 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

> FWIW, I also agree with Chanwoo that the difference is too small to
> need a common .dtsi file.

in principle I don't like "switching on and off" properties by
overwriting them with "status = disable", unless it's really
necessary (and this case is not). Even for small differences. It
makes the DTS harder to read and duplicates nodes with different
values throughout the DTS include chain.

In my opinion this approach should be discouraged.

Besides, there are other overwritten differences in tm2e.dts that
I think should be separated as well. The "common" file approach is
widely used in arm/boot/dts/exynos* files.

The "status = disable" looks to me more like a temporary hack
rather than a permanent solution.

In any case, still up to you :)

Andi

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
  2017-01-03 14:40                       ` Andi Shyti
  (?)
@ 2017-01-03 14:57                         ` Javier Martinez Canillas
  -1 siblings, 0 replies; 61+ messages in thread
From: Javier Martinez Canillas @ 2017-01-03 14:57 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Andi Shyti, Chanwoo Choi, Mark Rutland, devicetree,
	linux-samsung-soc, Dmitry Torokhov, Catalin Marinas, Jaechul Lee,
	Will Deacon, linux-kernel, Krzysztof Kozlowski, Chanwoo Choi,
	Rob Herring, Kukjin Kim, linux-input, galaxyra, beomho.seo,
	linux-arm-kernel

Hello Andi,

On 01/03/2017 11:40 AM, Andi Shyti wrote:
> Hi,
> 
>> FWIW, I also agree with Chanwoo that the difference is too small to
>> need a common .dtsi file.
> 
> in principle I don't like "switching on and off" properties by
> overwriting them with "status = disable", unless it's really

This is a very good point. It would had been different if it was the
opposite and tm2e had to enable the device node, but disabling it is
indeed more confusing.

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
@ 2017-01-03 14:57                         ` Javier Martinez Canillas
  0 siblings, 0 replies; 61+ messages in thread
From: Javier Martinez Canillas @ 2017-01-03 14:57 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Mark Rutland, devicetree, beomho.seo, linux-samsung-soc,
	Kukjin Kim, Catalin Marinas, Jaechul Lee, Dmitry Torokhov,
	Will Deacon, linux-kernel, Andi Shyti, Chanwoo Choi, Rob Herring,
	Krzysztof Kozlowski, linux-input, galaxyra, Chanwoo Choi,
	linux-arm-kernel

Hello Andi,

On 01/03/2017 11:40 AM, Andi Shyti wrote:
> Hi,
> 
>> FWIW, I also agree with Chanwoo that the difference is too small to
>> need a common .dtsi file.
> 
> in principle I don't like "switching on and off" properties by
> overwriting them with "status = disable", unless it's really

This is a very good point. It would had been different if it was the
opposite and tm2e had to enable the device node, but disabling it is
indeed more confusing.

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
@ 2017-01-03 14:57                         ` Javier Martinez Canillas
  0 siblings, 0 replies; 61+ messages in thread
From: Javier Martinez Canillas @ 2017-01-03 14:57 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Andi,

On 01/03/2017 11:40 AM, Andi Shyti wrote:
> Hi,
> 
>> FWIW, I also agree with Chanwoo that the difference is too small to
>> need a common .dtsi file.
> 
> in principle I don't like "switching on and off" properties by
> overwriting them with "status = disable", unless it's really

This is a very good point. It would had been different if it was the
opposite and tm2e had to enable the device node, but disabling it is
indeed more confusing.

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
  2017-01-03 14:40                       ` Andi Shyti
  (?)
@ 2017-01-03 15:29                         ` Chanwoo Choi
  -1 siblings, 0 replies; 61+ messages in thread
From: Chanwoo Choi @ 2017-01-03 15:29 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Javier Martinez Canillas, Andi Shyti, Mark Rutland, devicetree,
	linux-samsung-soc, Dmitry Torokhov, Catalin Marinas, Jaechul Lee,
	Will Deacon, linux-kernel, Krzysztof Kozlowski, Chanwoo Choi,
	Rob Herring, Kukjin Kim, linux-input, galaxyra, beomho.seo,
	linux-arm-kernel

Hi Andi,

2017-01-03 23:40 GMT+09:00 Andi Shyti <andi@etezian.org>:
> Hi,
>
>> FWIW, I also agree with Chanwoo that the difference is too small to
>> need a common .dtsi file.
>
> in principle I don't like "switching on and off" properties by
> overwriting them with "status = disable", unless it's really
> necessary (and this case is not). Even for small differences. It
> makes the DTS harder to read and duplicates nodes with different
> values throughout the DTS include chain.
>
> In my opinion this approach should be discouraged.
>
> Besides, there are other overwritten differences in tm2e.dts that
> I think should be separated as well. The "common" file approach is
> widely used in arm/boot/dts/exynos* files.
>
> The "status = disable" looks to me more like a temporary hack
> rather than a permanent solution.
>
> In any case, still up to you :)
>
> Andi

I think that "status=disabled" of hsi2c_9 is not hack. The overwrite
is possible for Device-tree. But, there is just difference how to
support them with some method.

Except for touchkey, all peripheral device are same on both tm2 and
tm2e. There are only small difference for a few property value.

To understand the difference between tm2 and tm2e, I made the patch
(it is not complete version). If we implement the following patch, we
support both tm2 and tm2e. So, I think that it is not complex to
understand the h/w difference between tm2 and tm2e.

diff --git a/arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts
b/arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts
index 1db4e7f..09b6935 100644
--- a/arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts
+++ b/arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts
@@ -18,6 +18,17 @@
        compatible = "samsung,tm2e", "samsung,exynos5433";
 };

+&display_timings {
+       clock-frequency = <16523724>;
+       hactive = <1600>;
+};
+
+&hsi2c_9 {
+        /* TM2E don't use the separate touchkey device. Instead, touchscreen
+         * device support the touchkey device.*/
+       status = "disabled";
+};
+
 &ldo23_reg {
        regulator-name = "CAM_SEN_CORE_1.025V_AP";
        regulator-max-microvolt = <1050000>;
@@ -39,3 +50,7 @@
        regulator-min-microvolt = <3300000>;
        regulator-max-microvolt = <3300000>;
 };
+
+&touchscreen {
+       x-size = "1599";
+};

-- 
Best Regards,
Chanwoo Choi

^ permalink raw reply related	[flat|nested] 61+ messages in thread

* Re: [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
@ 2017-01-03 15:29                         ` Chanwoo Choi
  0 siblings, 0 replies; 61+ messages in thread
From: Chanwoo Choi @ 2017-01-03 15:29 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Mark Rutland, devicetree, linux-samsung-soc, Kukjin Kim,
	Chanwoo Choi, Catalin Marinas, Jaechul Lee, Dmitry Torokhov,
	Will Deacon, linux-kernel, Andi Shyti, Javier Martinez Canillas,
	Rob Herring, Krzysztof Kozlowski, linux-input, galaxyra,
	beomho.seo, linux-arm-kernel

Hi Andi,

2017-01-03 23:40 GMT+09:00 Andi Shyti <andi@etezian.org>:
> Hi,
>
>> FWIW, I also agree with Chanwoo that the difference is too small to
>> need a common .dtsi file.
>
> in principle I don't like "switching on and off" properties by
> overwriting them with "status = disable", unless it's really
> necessary (and this case is not). Even for small differences. It
> makes the DTS harder to read and duplicates nodes with different
> values throughout the DTS include chain.
>
> In my opinion this approach should be discouraged.
>
> Besides, there are other overwritten differences in tm2e.dts that
> I think should be separated as well. The "common" file approach is
> widely used in arm/boot/dts/exynos* files.
>
> The "status = disable" looks to me more like a temporary hack
> rather than a permanent solution.
>
> In any case, still up to you :)
>
> Andi

I think that "status=disabled" of hsi2c_9 is not hack. The overwrite
is possible for Device-tree. But, there is just difference how to
support them with some method.

Except for touchkey, all peripheral device are same on both tm2 and
tm2e. There are only small difference for a few property value.

To understand the difference between tm2 and tm2e, I made the patch
(it is not complete version). If we implement the following patch, we
support both tm2 and tm2e. So, I think that it is not complex to
understand the h/w difference between tm2 and tm2e.

diff --git a/arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts
b/arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts
index 1db4e7f..09b6935 100644
--- a/arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts
+++ b/arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts
@@ -18,6 +18,17 @@
        compatible = "samsung,tm2e", "samsung,exynos5433";
 };

+&display_timings {
+       clock-frequency = <16523724>;
+       hactive = <1600>;
+};
+
+&hsi2c_9 {
+        /* TM2E don't use the separate touchkey device. Instead, touchscreen
+         * device support the touchkey device.*/
+       status = "disabled";
+};
+
 &ldo23_reg {
        regulator-name = "CAM_SEN_CORE_1.025V_AP";
        regulator-max-microvolt = <1050000>;
@@ -39,3 +50,7 @@
        regulator-min-microvolt = <3300000>;
        regulator-max-microvolt = <3300000>;
 };
+
+&touchscreen {
+       x-size = "1599";
+};

-- 
Best Regards,
Chanwoo Choi

^ permalink raw reply related	[flat|nested] 61+ messages in thread

* [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
@ 2017-01-03 15:29                         ` Chanwoo Choi
  0 siblings, 0 replies; 61+ messages in thread
From: Chanwoo Choi @ 2017-01-03 15:29 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Andi,

2017-01-03 23:40 GMT+09:00 Andi Shyti <andi@etezian.org>:
> Hi,
>
>> FWIW, I also agree with Chanwoo that the difference is too small to
>> need a common .dtsi file.
>
> in principle I don't like "switching on and off" properties by
> overwriting them with "status = disable", unless it's really
> necessary (and this case is not). Even for small differences. It
> makes the DTS harder to read and duplicates nodes with different
> values throughout the DTS include chain.
>
> In my opinion this approach should be discouraged.
>
> Besides, there are other overwritten differences in tm2e.dts that
> I think should be separated as well. The "common" file approach is
> widely used in arm/boot/dts/exynos* files.
>
> The "status = disable" looks to me more like a temporary hack
> rather than a permanent solution.
>
> In any case, still up to you :)
>
> Andi

I think that "status=disabled" of hsi2c_9 is not hack. The overwrite
is possible for Device-tree. But, there is just difference how to
support them with some method.

Except for touchkey, all peripheral device are same on both tm2 and
tm2e. There are only small difference for a few property value.

To understand the difference between tm2 and tm2e, I made the patch
(it is not complete version). If we implement the following patch, we
support both tm2 and tm2e. So, I think that it is not complex to
understand the h/w difference between tm2 and tm2e.

diff --git a/arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts
b/arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts
index 1db4e7f..09b6935 100644
--- a/arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts
+++ b/arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts
@@ -18,6 +18,17 @@
        compatible = "samsung,tm2e", "samsung,exynos5433";
 };

+&display_timings {
+       clock-frequency = <16523724>;
+       hactive = <1600>;
+};
+
+&hsi2c_9 {
+        /* TM2E don't use the separate touchkey device. Instead, touchscreen
+         * device support the touchkey device.*/
+       status = "disabled";
+};
+
 &ldo23_reg {
        regulator-name = "CAM_SEN_CORE_1.025V_AP";
        regulator-max-microvolt = <1050000>;
@@ -39,3 +50,7 @@
        regulator-min-microvolt = <3300000>;
        regulator-max-microvolt = <3300000>;
 };
+
+&touchscreen {
+       x-size = "1599";
+};

-- 
Best Regards,
Chanwoo Choi

^ permalink raw reply related	[flat|nested] 61+ messages in thread

* Re: [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
  2017-01-03 15:29                         ` Chanwoo Choi
  (?)
@ 2017-01-03 16:31                           ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 61+ messages in thread
From: Krzysztof Kozlowski @ 2017-01-03 16:31 UTC (permalink / raw)
  To: Chanwoo Choi
  Cc: Andi Shyti, Javier Martinez Canillas, Andi Shyti, Mark Rutland,
	devicetree, linux-samsung-soc, Dmitry Torokhov, Catalin Marinas,
	Jaechul Lee, Will Deacon, linux-kernel, Krzysztof Kozlowski,
	Chanwoo Choi, Rob Herring, Kukjin Kim, linux-input, galaxyra,
	beomho.seo, linux-arm-kernel

On Wed, Jan 04, 2017 at 12:29:23AM +0900, Chanwoo Choi wrote:
> Hi Andi,
> 
> 2017-01-03 23:40 GMT+09:00 Andi Shyti <andi@etezian.org>:
> > Hi,
> >
> >> FWIW, I also agree with Chanwoo that the difference is too small to
> >> need a common .dtsi file.
> >
> > in principle I don't like "switching on and off" properties by
> > overwriting them with "status = disable", unless it's really
> > necessary (and this case is not). Even for small differences. It
> > makes the DTS harder to read and duplicates nodes with different
> > values throughout the DTS include chain.

I agree.

> >
> > In my opinion this approach should be discouraged.
> >
> > Besides, there are other overwritten differences in tm2e.dts that
> > I think should be separated as well. The "common" file approach is
> > widely used in arm/boot/dts/exynos* files.

I agree. Mostly we use:
1. Common DTSI and final addons/customizations in DTS.
2. Several common DTSI for specific parts (like sound).

> > The "status = disable" looks to me more like a temporary hack
> > rather than a permanent solution.
> >
> > In any case, still up to you :)
> >
> > Andi
> 
> I think that "status=disabled" of hsi2c_9 is not hack. The overwrite
> is possible for Device-tree. But, there is just difference how to
> support them with some method.
> 
> Except for touchkey, all peripheral device are same on both tm2 and
> tm2e. There are only small difference for a few property value.
> 
> To understand the difference between tm2 and tm2e, I made the patch
> (it is not complete version). If we implement the following patch, we
> support both tm2 and tm2e. So, I think that it is not complex to
> understand the h/w difference between tm2 and tm2e.

The difference below (I removed it from the quote) is indeed very small,
thanks Chanwoo for pointing this. However having common DTSI should not
end with much bigger final diff between files. I mean that it should be
the same amount of lines in total...

Actually, after applying this patch, the final exynos5433-tm2e.dts is
exactly the same as before. To me, this is a indication that a common
file is a good approach.


>From a separate Javier's mail:
> On 01/03/2017 11:40 AM, Andi Shyti wrote:
> > Hi,
> > 
> >> FWIW, I also agree with Chanwoo that the difference is too small to
> >> need a common .dtsi file.
> > 
> > in principle I don't like "switching on and off" properties by
> > overwriting them with "status = disable", unless it's really
> 
> This is a very good point. It would had been different if it was the
> opposite and tm2e had to enable the device node, but disabling it is
> indeed more confusing.
> On 01/03/2017 11:40 AM, Andi Shyti wrote:
> > Hi,
> > 
> >> FWIW, I also agree with Chanwoo that the difference is too small to
> >> need a common .dtsi file.
> > 
> > in principle I don't like "switching on and off" properties by
> > overwriting them with "status = disable", unless it's really
> 
> This is a very good point. It would had been different if it was the
> opposite and tm2e had to enable the device node, but disabling it is
> indeed more confusing.

I agree, 'status = disable' in final DTS is not a common pattern and
to me when reading, it makes me wonder what was the author's intention.

Also including a DTS in DTS is not a common pattern, neither. It appears
(git grep include arch/arm/boot/dts | grep 'dts"') in few places but it
is not obvious. At least to me.

Overall, I prefer the common approach.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
@ 2017-01-03 16:31                           ` Krzysztof Kozlowski
  0 siblings, 0 replies; 61+ messages in thread
From: Krzysztof Kozlowski @ 2017-01-03 16:31 UTC (permalink / raw)
  To: Chanwoo Choi
  Cc: Mark Rutland, devicetree, linux-samsung-soc, Kukjin Kim,
	Chanwoo Choi, Catalin Marinas, Jaechul Lee, Dmitry Torokhov,
	Will Deacon, linux-kernel, Andi Shyti, Javier Martinez Canillas,
	Rob Herring, Krzysztof Kozlowski, Andi Shyti, linux-input,
	galaxyra, beomho.seo, linux-arm-kernel

On Wed, Jan 04, 2017 at 12:29:23AM +0900, Chanwoo Choi wrote:
> Hi Andi,
> 
> 2017-01-03 23:40 GMT+09:00 Andi Shyti <andi@etezian.org>:
> > Hi,
> >
> >> FWIW, I also agree with Chanwoo that the difference is too small to
> >> need a common .dtsi file.
> >
> > in principle I don't like "switching on and off" properties by
> > overwriting them with "status = disable", unless it's really
> > necessary (and this case is not). Even for small differences. It
> > makes the DTS harder to read and duplicates nodes with different
> > values throughout the DTS include chain.

I agree.

> >
> > In my opinion this approach should be discouraged.
> >
> > Besides, there are other overwritten differences in tm2e.dts that
> > I think should be separated as well. The "common" file approach is
> > widely used in arm/boot/dts/exynos* files.

I agree. Mostly we use:
1. Common DTSI and final addons/customizations in DTS.
2. Several common DTSI for specific parts (like sound).

> > The "status = disable" looks to me more like a temporary hack
> > rather than a permanent solution.
> >
> > In any case, still up to you :)
> >
> > Andi
> 
> I think that "status=disabled" of hsi2c_9 is not hack. The overwrite
> is possible for Device-tree. But, there is just difference how to
> support them with some method.
> 
> Except for touchkey, all peripheral device are same on both tm2 and
> tm2e. There are only small difference for a few property value.
> 
> To understand the difference between tm2 and tm2e, I made the patch
> (it is not complete version). If we implement the following patch, we
> support both tm2 and tm2e. So, I think that it is not complex to
> understand the h/w difference between tm2 and tm2e.

The difference below (I removed it from the quote) is indeed very small,
thanks Chanwoo for pointing this. However having common DTSI should not
end with much bigger final diff between files. I mean that it should be
the same amount of lines in total...

Actually, after applying this patch, the final exynos5433-tm2e.dts is
exactly the same as before. To me, this is a indication that a common
file is a good approach.


>From a separate Javier's mail:
> On 01/03/2017 11:40 AM, Andi Shyti wrote:
> > Hi,
> > 
> >> FWIW, I also agree with Chanwoo that the difference is too small to
> >> need a common .dtsi file.
> > 
> > in principle I don't like "switching on and off" properties by
> > overwriting them with "status = disable", unless it's really
> 
> This is a very good point. It would had been different if it was the
> opposite and tm2e had to enable the device node, but disabling it is
> indeed more confusing.
> On 01/03/2017 11:40 AM, Andi Shyti wrote:
> > Hi,
> > 
> >> FWIW, I also agree with Chanwoo that the difference is too small to
> >> need a common .dtsi file.
> > 
> > in principle I don't like "switching on and off" properties by
> > overwriting them with "status = disable", unless it's really
> 
> This is a very good point. It would had been different if it was the
> opposite and tm2e had to enable the device node, but disabling it is
> indeed more confusing.

I agree, 'status = disable' in final DTS is not a common pattern and
to me when reading, it makes me wonder what was the author's intention.

Also including a DTS in DTS is not a common pattern, neither. It appears
(git grep include arch/arm/boot/dts | grep 'dts"') in few places but it
is not obvious. At least to me.

Overall, I prefer the common approach.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
@ 2017-01-03 16:31                           ` Krzysztof Kozlowski
  0 siblings, 0 replies; 61+ messages in thread
From: Krzysztof Kozlowski @ 2017-01-03 16:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jan 04, 2017 at 12:29:23AM +0900, Chanwoo Choi wrote:
> Hi Andi,
> 
> 2017-01-03 23:40 GMT+09:00 Andi Shyti <andi@etezian.org>:
> > Hi,
> >
> >> FWIW, I also agree with Chanwoo that the difference is too small to
> >> need a common .dtsi file.
> >
> > in principle I don't like "switching on and off" properties by
> > overwriting them with "status = disable", unless it's really
> > necessary (and this case is not). Even for small differences. It
> > makes the DTS harder to read and duplicates nodes with different
> > values throughout the DTS include chain.

I agree.

> >
> > In my opinion this approach should be discouraged.
> >
> > Besides, there are other overwritten differences in tm2e.dts that
> > I think should be separated as well. The "common" file approach is
> > widely used in arm/boot/dts/exynos* files.

I agree. Mostly we use:
1. Common DTSI and final addons/customizations in DTS.
2. Several common DTSI for specific parts (like sound).

> > The "status = disable" looks to me more like a temporary hack
> > rather than a permanent solution.
> >
> > In any case, still up to you :)
> >
> > Andi
> 
> I think that "status=disabled" of hsi2c_9 is not hack. The overwrite
> is possible for Device-tree. But, there is just difference how to
> support them with some method.
> 
> Except for touchkey, all peripheral device are same on both tm2 and
> tm2e. There are only small difference for a few property value.
> 
> To understand the difference between tm2 and tm2e, I made the patch
> (it is not complete version). If we implement the following patch, we
> support both tm2 and tm2e. So, I think that it is not complex to
> understand the h/w difference between tm2 and tm2e.

The difference below (I removed it from the quote) is indeed very small,
thanks Chanwoo for pointing this. However having common DTSI should not
end with much bigger final diff between files. I mean that it should be
the same amount of lines in total...

Actually, after applying this patch, the final exynos5433-tm2e.dts is
exactly the same as before. To me, this is a indication that a common
file is a good approach.


>From a separate Javier's mail:
> On 01/03/2017 11:40 AM, Andi Shyti wrote:
> > Hi,
> > 
> >> FWIW, I also agree with Chanwoo that the difference is too small to
> >> need a common .dtsi file.
> > 
> > in principle I don't like "switching on and off" properties by
> > overwriting them with "status = disable", unless it's really
> 
> This is a very good point. It would had been different if it was the
> opposite and tm2e had to enable the device node, but disabling it is
> indeed more confusing.
> On 01/03/2017 11:40 AM, Andi Shyti wrote:
> > Hi,
> > 
> >> FWIW, I also agree with Chanwoo that the difference is too small to
> >> need a common .dtsi file.
> > 
> > in principle I don't like "switching on and off" properties by
> > overwriting them with "status = disable", unless it's really
> 
> This is a very good point. It would had been different if it was the
> opposite and tm2e had to enable the device node, but disabling it is
> indeed more confusing.

I agree, 'status = disable' in final DTS is not a common pattern and
to me when reading, it makes me wonder what was the author's intention.

Also including a DTS in DTS is not a common pattern, neither. It appears
(git grep include arch/arm/boot/dts | grep 'dts"') in few places but it
is not obvious. At least to me.

Overall, I prefer the common approach.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
  2017-01-03 10:25               ` Andi Shyti
  (?)
@ 2017-01-03 16:41                 ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 61+ messages in thread
From: Krzysztof Kozlowski @ 2017-01-03 16:41 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Krzysztof Kozlowski, Jaechul Lee, Dmitry Torokhov, Rob Herring,
	Mark Rutland, Catalin Marinas, Will Deacon, Kukjin Kim,
	Javier Martinez Canillas, Chanwoo Choi, beomho.seo, galaxyra,
	linux-arm-kernel, linux-input, devicetree, linux-kernel,
	linux-samsung-soc

On Tue, Jan 03, 2017 at 07:25:48PM +0900, Andi Shyti wrote:
> > >> > Currently tm2e dts includes tm2 but there are some differences
> > >> > between the two boards and tm2 has some properties that tm2e
> > >> > doesn't have.
> > >> >
> > >> > That's why it's important to keep the two dts files independent
> > >> > and put all the commonalities in a tm2-common.dtsi file.
> > >> >
> > >> > Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> > >> > Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> > >> > ---
> > >> >  .../boot/dts/exynos/exynos5433-tm2-common.dtsi     | 1046 ++++++++++++++++++++
> > >> >  arch/arm64/boot/dts/exynos/exynos5433-tm2.dts      | 1033 +------------------
> > >> >  arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts     |    2 +-
> > >> >  3 files changed, 1049 insertions(+), 1032 deletions(-)
> > >> >  create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
> > >>
> > >> I would like to see here the rename and diff from it. Not entire delta
> > >> (deletions and addons). It is not possible to compare it... I think
> > >> git supports it by default with similarity of 50%.
> > >
> > > I understand, it's indeed quite cryptic to understand. But all
> > > the diff algorithms (patience, minimal, histogram, myers) give
> > > the same result. I don't know how to make it better.
> > >
> > > I could split this patch, but this also means breaking tm2's
> > > functionality, which looks worse.
> > >
> > > Please tell me if you know a better way for generating the patch.
> > 
> > git format-patch -M95%?
> 
> Same thing with all M values.
> 
> Because exynos5433-tm2.dts results modified, while
> exynos5433-tm2-common.dtsi is new. Even though I did:
> 
> 1. mv exynos5433-tm2.dts exynos5433-tm2-common.dtsi
> 2. copied pieces from exynos5433-tm2-common.dtsi to a new
>    exynos5433-tm2.dts

mv/etc won't help. You need to convince git format-patch that it is
rename. For that, you need -B so copy will be considered a rename
(otherwise rename will be detected only if a file is removed), so:
	git format-patch -B50% -1

Please resend with this approach.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
@ 2017-01-03 16:41                 ` Krzysztof Kozlowski
  0 siblings, 0 replies; 61+ messages in thread
From: Krzysztof Kozlowski @ 2017-01-03 16:41 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Mark Rutland, devicetree, linux-samsung-soc, Dmitry Torokhov,
	Chanwoo Choi, Catalin Marinas, Jaechul Lee, Will Deacon,
	linux-kernel, Krzysztof Kozlowski, Javier Martinez Canillas,
	Rob Herring, Kukjin Kim, linux-input, galaxyra, beomho.seo,
	linux-arm-kernel

On Tue, Jan 03, 2017 at 07:25:48PM +0900, Andi Shyti wrote:
> > >> > Currently tm2e dts includes tm2 but there are some differences
> > >> > between the two boards and tm2 has some properties that tm2e
> > >> > doesn't have.
> > >> >
> > >> > That's why it's important to keep the two dts files independent
> > >> > and put all the commonalities in a tm2-common.dtsi file.
> > >> >
> > >> > Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> > >> > Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> > >> > ---
> > >> >  .../boot/dts/exynos/exynos5433-tm2-common.dtsi     | 1046 ++++++++++++++++++++
> > >> >  arch/arm64/boot/dts/exynos/exynos5433-tm2.dts      | 1033 +------------------
> > >> >  arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts     |    2 +-
> > >> >  3 files changed, 1049 insertions(+), 1032 deletions(-)
> > >> >  create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
> > >>
> > >> I would like to see here the rename and diff from it. Not entire delta
> > >> (deletions and addons). It is not possible to compare it... I think
> > >> git supports it by default with similarity of 50%.
> > >
> > > I understand, it's indeed quite cryptic to understand. But all
> > > the diff algorithms (patience, minimal, histogram, myers) give
> > > the same result. I don't know how to make it better.
> > >
> > > I could split this patch, but this also means breaking tm2's
> > > functionality, which looks worse.
> > >
> > > Please tell me if you know a better way for generating the patch.
> > 
> > git format-patch -M95%?
> 
> Same thing with all M values.
> 
> Because exynos5433-tm2.dts results modified, while
> exynos5433-tm2-common.dtsi is new. Even though I did:
> 
> 1. mv exynos5433-tm2.dts exynos5433-tm2-common.dtsi
> 2. copied pieces from exynos5433-tm2-common.dtsi to a new
>    exynos5433-tm2.dts

mv/etc won't help. You need to convince git format-patch that it is
rename. For that, you need -B so copy will be considered a rename
(otherwise rename will be detected only if a file is removed), so:
	git format-patch -B50% -1

Please resend with this approach.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
@ 2017-01-03 16:41                 ` Krzysztof Kozlowski
  0 siblings, 0 replies; 61+ messages in thread
From: Krzysztof Kozlowski @ 2017-01-03 16:41 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jan 03, 2017 at 07:25:48PM +0900, Andi Shyti wrote:
> > >> > Currently tm2e dts includes tm2 but there are some differences
> > >> > between the two boards and tm2 has some properties that tm2e
> > >> > doesn't have.
> > >> >
> > >> > That's why it's important to keep the two dts files independent
> > >> > and put all the commonalities in a tm2-common.dtsi file.
> > >> >
> > >> > Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> > >> > Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> > >> > ---
> > >> >  .../boot/dts/exynos/exynos5433-tm2-common.dtsi     | 1046 ++++++++++++++++++++
> > >> >  arch/arm64/boot/dts/exynos/exynos5433-tm2.dts      | 1033 +------------------
> > >> >  arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts     |    2 +-
> > >> >  3 files changed, 1049 insertions(+), 1032 deletions(-)
> > >> >  create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
> > >>
> > >> I would like to see here the rename and diff from it. Not entire delta
> > >> (deletions and addons). It is not possible to compare it... I think
> > >> git supports it by default with similarity of 50%.
> > >
> > > I understand, it's indeed quite cryptic to understand. But all
> > > the diff algorithms (patience, minimal, histogram, myers) give
> > > the same result. I don't know how to make it better.
> > >
> > > I could split this patch, but this also means breaking tm2's
> > > functionality, which looks worse.
> > >
> > > Please tell me if you know a better way for generating the patch.
> > 
> > git format-patch -M95%?
> 
> Same thing with all M values.
> 
> Because exynos5433-tm2.dts results modified, while
> exynos5433-tm2-common.dtsi is new. Even though I did:
> 
> 1. mv exynos5433-tm2.dts exynos5433-tm2-common.dtsi
> 2. copied pieces from exynos5433-tm2-common.dtsi to a new
>    exynos5433-tm2.dts

mv/etc won't help. You need to convince git format-patch that it is
rename. For that, you need -B so copy will be considered a rename
(otherwise rename will be detected only if a file is removed), so:
	git format-patch -B50% -1

Please resend with this approach.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 4/4] arm64: dts: exynos: Add tm2 touchkey node
  2017-01-03  7:57       ` Jaechul Lee
  (?)
@ 2017-01-03 16:49         ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 61+ messages in thread
From: Krzysztof Kozlowski @ 2017-01-03 16:49 UTC (permalink / raw)
  To: Jaechul Lee
  Cc: Dmitry Torokhov, Rob Herring, Mark Rutland, Catalin Marinas,
	Will Deacon, Kukjin Kim, Krzysztof Kozlowski,
	Javier Martinez Canillas, Andi Shyti, Chanwoo Choi, beomho.seo,
	galaxyra, linux-arm-kernel, linux-input, devicetree,
	linux-kernel, linux-samsung-soc

On Tue, Jan 03, 2017 at 04:57:17PM +0900, Jaechul Lee wrote:
> Add DT node support for TM2 touchkey device.
> 
> Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>

The order of sign-offs should follow the order of "who touched it". I
assume that the real order was like this:
1. Initially create by Beomho,
2. Adjustments by Andi,
3. Final adjustments and sending by you.

If that is correct then the order should be 1->2->3.

Beside of that, patch looks good.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 4/4] arm64: dts: exynos: Add tm2 touchkey node
@ 2017-01-03 16:49         ` Krzysztof Kozlowski
  0 siblings, 0 replies; 61+ messages in thread
From: Krzysztof Kozlowski @ 2017-01-03 16:49 UTC (permalink / raw)
  To: Jaechul Lee
  Cc: Mark Rutland, devicetree, linux-samsung-soc, Andi Shyti,
	Chanwoo Choi, Catalin Marinas, Dmitry Torokhov, Will Deacon,
	linux-kernel, Rob Herring, Javier Martinez Canillas, Kukjin Kim,
	Krzysztof Kozlowski, linux-input, galaxyra, beomho.seo,
	linux-arm-kernel

On Tue, Jan 03, 2017 at 04:57:17PM +0900, Jaechul Lee wrote:
> Add DT node support for TM2 touchkey device.
> 
> Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>

The order of sign-offs should follow the order of "who touched it". I
assume that the real order was like this:
1. Initially create by Beomho,
2. Adjustments by Andi,
3. Final adjustments and sending by you.

If that is correct then the order should be 1->2->3.

Beside of that, patch looks good.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH 4/4] arm64: dts: exynos: Add tm2 touchkey node
@ 2017-01-03 16:49         ` Krzysztof Kozlowski
  0 siblings, 0 replies; 61+ messages in thread
From: Krzysztof Kozlowski @ 2017-01-03 16:49 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jan 03, 2017 at 04:57:17PM +0900, Jaechul Lee wrote:
> Add DT node support for TM2 touchkey device.
> 
> Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>

The order of sign-offs should follow the order of "who touched it". I
assume that the real order was like this:
1. Initially create by Beomho,
2. Adjustments by Andi,
3. Final adjustments and sending by you.

If that is correct then the order should be 1->2->3.

Beside of that, patch looks good.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 2/4] input: tm2-touchkey: Add touchkey driver support for TM2
  2017-01-03  7:57       ` Jaechul Lee
  (?)
@ 2017-01-03 16:59         ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 61+ messages in thread
From: Krzysztof Kozlowski @ 2017-01-03 16:59 UTC (permalink / raw)
  To: Jaechul Lee
  Cc: Dmitry Torokhov, Rob Herring, Mark Rutland, Catalin Marinas,
	Will Deacon, Kukjin Kim, Krzysztof Kozlowski,
	Javier Martinez Canillas, Andi Shyti, Chanwoo Choi, beomho.seo,
	galaxyra, linux-arm-kernel, linux-input, devicetree,
	linux-kernel, linux-samsung-soc

On Tue, Jan 03, 2017 at 04:57:15PM +0900, Jaechul Lee wrote:
> This patch adds support for the TM2 touch key and led
> functionlity.
> 
> The driver interfaces with userspace through an input device and
> reports KEY_PHONE and KEY_BACK event types. LED brightness can be
> controlled by "/sys/class/leds/tm2-touchkey/brightness".
> 
> Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
> ---
>  drivers/input/keyboard/Kconfig        |  11 ++
>  drivers/input/keyboard/Makefile       |   1 +
>  drivers/input/keyboard/tm2-touchkey.c | 326 ++++++++++++++++++++++++++++++++++
>  3 files changed, 338 insertions(+)
>  create mode 100644 drivers/input/keyboard/tm2-touchkey.c
> 
> diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
> index cbd75cf..72c0ba1 100644
> --- a/drivers/input/keyboard/Kconfig
> +++ b/drivers/input/keyboard/Kconfig
> @@ -666,6 +666,17 @@ config KEYBOARD_TC3589X
>  	  To compile this driver as a module, choose M here: the
>  	  module will be called tc3589x-keypad.
>  
> +config KEYBOARD_TM2_TOUCHKEY
> +	tristate "tm2-touchkey support"
> +	depends on I2C
> +	help
> +	  Say Y here to enable the tm2-touchkey.

The ending full stop is not needed.

> +	  touchkey driver for tm2. This driver can enable
> +	  the interrupt and make input events and control led brightness.

This sentence needs improvements. How about just:
"Beside input device, this driver provides also brightness control for
LEDs on touch keys."

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 2/4] input: tm2-touchkey: Add touchkey driver support for TM2
@ 2017-01-03 16:59         ` Krzysztof Kozlowski
  0 siblings, 0 replies; 61+ messages in thread
From: Krzysztof Kozlowski @ 2017-01-03 16:59 UTC (permalink / raw)
  To: Jaechul Lee
  Cc: Mark Rutland, devicetree, linux-samsung-soc, Andi Shyti,
	Chanwoo Choi, Catalin Marinas, Dmitry Torokhov, Will Deacon,
	linux-kernel, Rob Herring, Javier Martinez Canillas, Kukjin Kim,
	Krzysztof Kozlowski, linux-input, galaxyra, beomho.seo,
	linux-arm-kernel

On Tue, Jan 03, 2017 at 04:57:15PM +0900, Jaechul Lee wrote:
> This patch adds support for the TM2 touch key and led
> functionlity.
> 
> The driver interfaces with userspace through an input device and
> reports KEY_PHONE and KEY_BACK event types. LED brightness can be
> controlled by "/sys/class/leds/tm2-touchkey/brightness".
> 
> Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
> ---
>  drivers/input/keyboard/Kconfig        |  11 ++
>  drivers/input/keyboard/Makefile       |   1 +
>  drivers/input/keyboard/tm2-touchkey.c | 326 ++++++++++++++++++++++++++++++++++
>  3 files changed, 338 insertions(+)
>  create mode 100644 drivers/input/keyboard/tm2-touchkey.c
> 
> diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
> index cbd75cf..72c0ba1 100644
> --- a/drivers/input/keyboard/Kconfig
> +++ b/drivers/input/keyboard/Kconfig
> @@ -666,6 +666,17 @@ config KEYBOARD_TC3589X
>  	  To compile this driver as a module, choose M here: the
>  	  module will be called tc3589x-keypad.
>  
> +config KEYBOARD_TM2_TOUCHKEY
> +	tristate "tm2-touchkey support"
> +	depends on I2C
> +	help
> +	  Say Y here to enable the tm2-touchkey.

The ending full stop is not needed.

> +	  touchkey driver for tm2. This driver can enable
> +	  the interrupt and make input events and control led brightness.

This sentence needs improvements. How about just:
"Beside input device, this driver provides also brightness control for
LEDs on touch keys."

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH 2/4] input: tm2-touchkey: Add touchkey driver support for TM2
@ 2017-01-03 16:59         ` Krzysztof Kozlowski
  0 siblings, 0 replies; 61+ messages in thread
From: Krzysztof Kozlowski @ 2017-01-03 16:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jan 03, 2017 at 04:57:15PM +0900, Jaechul Lee wrote:
> This patch adds support for the TM2 touch key and led
> functionlity.
> 
> The driver interfaces with userspace through an input device and
> reports KEY_PHONE and KEY_BACK event types. LED brightness can be
> controlled by "/sys/class/leds/tm2-touchkey/brightness".
> 
> Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
> ---
>  drivers/input/keyboard/Kconfig        |  11 ++
>  drivers/input/keyboard/Makefile       |   1 +
>  drivers/input/keyboard/tm2-touchkey.c | 326 ++++++++++++++++++++++++++++++++++
>  3 files changed, 338 insertions(+)
>  create mode 100644 drivers/input/keyboard/tm2-touchkey.c
> 
> diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
> index cbd75cf..72c0ba1 100644
> --- a/drivers/input/keyboard/Kconfig
> +++ b/drivers/input/keyboard/Kconfig
> @@ -666,6 +666,17 @@ config KEYBOARD_TC3589X
>  	  To compile this driver as a module, choose M here: the
>  	  module will be called tc3589x-keypad.
>  
> +config KEYBOARD_TM2_TOUCHKEY
> +	tristate "tm2-touchkey support"
> +	depends on I2C
> +	help
> +	  Say Y here to enable the tm2-touchkey.

The ending full stop is not needed.

> +	  touchkey driver for tm2. This driver can enable
> +	  the interrupt and make input events and control led brightness.

This sentence needs improvements. How about just:
"Beside input device, this driver provides also brightness control for
LEDs on touch keys."

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 2/4] input: tm2-touchkey: Add touchkey driver support for TM2
  2017-01-03 13:11         ` Javier Martinez Canillas
@ 2017-01-03 18:56           ` Dmitry Torokhov
  -1 siblings, 0 replies; 61+ messages in thread
From: Dmitry Torokhov @ 2017-01-03 18:56 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: Jaechul Lee, Rob Herring, Mark Rutland, Catalin Marinas,
	Will Deacon, Kukjin Kim, Krzysztof Kozlowski, Andi Shyti,
	Chanwoo Choi, beomho.seo, galaxyra, linux-arm-kernel,
	linux-input, devicetree, linux-kernel, linux-samsung-soc

On Tue, Jan 03, 2017 at 10:11:39AM -0300, Javier Martinez Canillas wrote:
> Hello Jaechul,
> 
> On 01/03/2017 04:57 AM, Jaechul Lee wrote:
> > This patch adds support for the TM2 touch key and led
> > functionlity.
> > 
> 
> s/functionlity/functionality
> 
> > The driver interfaces with userspace through an input device and
> > reports KEY_PHONE and KEY_BACK event types. LED brightness can be
> > controlled by "/sys/class/leds/tm2-touchkey/brightness".
> > 
> > Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> > Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
> > ---
> >  drivers/input/keyboard/Kconfig        |  11 ++
> >  drivers/input/keyboard/Makefile       |   1 +
> >  drivers/input/keyboard/tm2-touchkey.c | 326 ++++++++++++++++++++++++++++++++++
> >  3 files changed, 338 insertions(+)
> >  create mode 100644 drivers/input/keyboard/tm2-touchkey.c
> > 
> > diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
> > index cbd75cf..72c0ba1 100644
> > --- a/drivers/input/keyboard/Kconfig
> > +++ b/drivers/input/keyboard/Kconfig
> > @@ -666,6 +666,17 @@ config KEYBOARD_TC3589X
> >  	  To compile this driver as a module, choose M here: the
> >  	  module will be called tc3589x-keypad.
> >  
> > +config KEYBOARD_TM2_TOUCHKEY
> > +	tristate "tm2-touchkey support"
> > +	depends on I2C

There should be LED dependency as well.

> > +	help
> > +	  Say Y here to enable the tm2-touchkey.
> > +	  touchkey driver for tm2. This driver can enable
> > +	  the interrupt and make input events and control led brightness.
> > +
> > +	  To compile this driver as a module, choose M here.
> > +	  module will be called tm2-touchkey
> > +
> >  config KEYBOARD_TWL4030
> >  	tristate "TI TWL4030/TWL5030/TPS659x0 keypad support"
> >  	depends on TWL4030_CORE
> > diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
> > index d9f4cfc..7d9acff 100644
> > --- a/drivers/input/keyboard/Makefile
> > +++ b/drivers/input/keyboard/Makefile
> > @@ -61,6 +61,7 @@ obj-$(CONFIG_KEYBOARD_SUN4I_LRADC)	+= sun4i-lradc-keys.o
> >  obj-$(CONFIG_KEYBOARD_SUNKBD)		+= sunkbd.o
> >  obj-$(CONFIG_KEYBOARD_TC3589X)		+= tc3589x-keypad.o
> >  obj-$(CONFIG_KEYBOARD_TEGRA)		+= tegra-kbc.o
> > +obj-$(CONFIG_KEYBOARD_TM2_TOUCHKEY)	+= tm2-touchkey.o
> >  obj-$(CONFIG_KEYBOARD_TWL4030)		+= twl4030_keypad.o
> >  obj-$(CONFIG_KEYBOARD_XTKBD)		+= xtkbd.o
> >  obj-$(CONFIG_KEYBOARD_W90P910)		+= w90p910_keypad.o
> > diff --git a/drivers/input/keyboard/tm2-touchkey.c b/drivers/input/keyboard/tm2-touchkey.c
> > new file mode 100644
> > index 0000000..d9575d8
> > --- /dev/null
> > +++ b/drivers/input/keyboard/tm2-touchkey.c
> > @@ -0,0 +1,326 @@
> > +/*
> > + * Driver for keys on GPIO lines capable of generating interrupts.

This does not match what the driver does.

> > + *
> > + * Copyright 2005 Phil Blundell
> > + * Copyright 2016 Samsung Electronics Co., Ltd.
> > + *
> > + * Author: Beomho Seo <beomho.seo@samsung.com>
> > + * Author: Jaechul Lee <jcsing.lee@samsung.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.
> > + */
> > +
> > +#include <linux/bitops.h>
> > +#include <linux/delay.h>
> > +#include <linux/device.h>
> > +#include <linux/i2c.h>
> > +#include <linux/input.h>
> > +#include <linux/interrupt.h>
> > +#include <linux/irq.h>
> > +#include <linux/leds.h>
> > +#include <linux/module.h>
> > +#include <linux/of.h>
> > +#include <linux/pm.h>
> > +#include <linux/regulator/consumer.h>
> > +#include <linux/workqueue.h>
> > +
> > +#define TM2_TOUCHKEY_DEV_NAME			"tm2-touchkey"
> > +#define TM2_TOUCHKEY_KEYCODE_REG			0x03
> > +#define TM2_TOUCHKEY_BASE_REG			0x00
> > +#define TM2_TOUCHKEY_CMD_LED_ON			0x10
> > +#define TM2_TOUCHKEY_CMD_LED_OFF			0x20
> > +#define TM2_TOUCHKEY_BIT_PRESS_EV			BIT(3)
> > +#define TM2_TOUCHKEY_BIT_KEYCODE			GENMASK(2, 0)
> > +#define TM2_TOUCHKEY_LED_VOLTAGE_MIN			2500000
> > +#define TM2_TOUCHKEY_LED_VOLTAGE_MAX			3300000
> > +
> > +enum {
> > +	TM2_TOUCHKEY_KEY_MENU = 0x1,
> > +	TM2_TOUCHKEY_KEY_BACK,
> > +};
> > +
> > +#define tm2_touchkey_power_enable(x) __tm2_touchkey_power_onoff(x, 1)
> > +#define tm2_touchkey_power_disable(x) __tm2_touchkey_power_onoff(x, 0)
> > +
> > +struct tm2_touchkey_data {
> > +	struct i2c_client *client;
> > +	struct input_dev *input_dev;
> > +	struct led_classdev led_dev;
> > +
> > +	u8 keycode_type;
> > +	u8 pressed;
> > +	struct work_struct irq_work;
> > +
> > +	bool power_onoff;
> > +	struct regulator *regulator_vcc;	/* 1.8V */
> > +	struct regulator *regulator_vdd;	/* 3.3V */
> > +};
> > +
> > +static void tm2_touchkey_led_brightness_set(struct led_classdev *led_dev,
> > +						enum led_brightness brightness)
> > +{
> > +	struct tm2_touchkey_data *samsung_touchkey =

Just call it "touchkey", "samsung_touchkey" is too long for a local
variable.

> > +	    container_of(led_dev, struct tm2_touchkey_data, led_dev);
> > +	u32 volt;
> > +	u8 data;
> > +
> > +	if (brightness == LED_OFF) {
> > +		volt = TM2_TOUCHKEY_LED_VOLTAGE_MIN;
> > +		data = TM2_TOUCHKEY_CMD_LED_OFF;
> > +	} else {
> > +		volt = TM2_TOUCHKEY_LED_VOLTAGE_MAX;
> > +		data = TM2_TOUCHKEY_CMD_LED_ON;
> > +	}
> > +
> > +	regulator_set_voltage(samsung_touchkey->regulator_vdd, volt, volt);
> > +	i2c_smbus_write_byte_data(samsung_touchkey->client,
> > +				  TM2_TOUCHKEY_BASE_REG, data);
> > +}
> > +
> > +static int __tm2_touchkey_power_onoff(struct tm2_touchkey_data
> > +					  *samsung_touchkey, bool onoff)
> > +{
> > +	int ret = 0;
> > +
> > +	if (samsung_touchkey->power_onoff == onoff)
> > +		return ret;
> > +
> > +	if (onoff) {
> > +		ret = regulator_enable(samsung_touchkey->regulator_vcc);
> > +		if (ret)
> > +			return ret;
> > +
> > +		ret = regulator_enable(samsung_touchkey->regulator_vdd);
> > +		if (ret) {
> > +			regulator_disable(samsung_touchkey->regulator_vcc);
> > +			return ret;
> > +		}
> 
> I would add a comment about the sleep here.

Also "bulk" regulator API can be useful here.

> 
> > +		msleep(150);
> > +	} else {
> > +		int err;
> > +
> > +		err = regulator_disable(samsung_touchkey->regulator_vcc);
> > +		if (err)
> > +			ret = err;
> > +
> > +		err = regulator_disable(samsung_touchkey->regulator_vdd);
> > +		if (err && !ret)
> > +			ret = err;
> > +	}
> > +	samsung_touchkey->power_onoff = onoff;
> > +
> > +	return ret;
> > +}
> > +
> > +static void tm2_touchkey_irq_work(struct work_struct *irq_work)
> > +{
> > +	struct tm2_touchkey_data *samsung_touchkey =
> > +	    container_of(irq_work, struct tm2_touchkey_data, irq_work);
> > +
> > +	if (!samsung_touchkey->pressed) {
> > +		input_report_key(samsung_touchkey->input_dev, KEY_PHONE, 0);
> > +		input_report_key(samsung_touchkey->input_dev, KEY_BACK, 0);
> > +	} else {
> > +		if (samsung_touchkey->keycode_type == TM2_TOUCHKEY_KEY_MENU)
> > +			input_report_key(samsung_touchkey->input_dev,
> > +					 KEY_PHONE, 1);
> > +		else
> > +			input_report_key(samsung_touchkey->input_dev,
> > +					 KEY_BACK, 1);
> > +	}
> > +	input_sync(samsung_touchkey->input_dev);
> > +}

There is absolutely no reason for doing this in a work. Just call
input_report_key/input_sync from your threaded IRQ routine.

> > +
> > +static irqreturn_t tm2_touchkey_irq_handler(int irq, void *devid)
> > +{
> > +	struct tm2_touchkey_data *samsung_touchkey = devid;
> > +	u32 data;
> > +
> > +	data = i2c_smbus_read_byte_data(samsung_touchkey->client,
> > +					TM2_TOUCHKEY_KEYCODE_REG);
> > +
> > +	if (data < 0) {
> > +		dev_err(&samsung_touchkey->client->dev, "Failed to read i2c data\n");
> > +		return IRQ_HANDLED;
> > +	}
> > +
> > +	samsung_touchkey->keycode_type = data & TM2_TOUCHKEY_BIT_KEYCODE;
> > +	samsung_touchkey->pressed = !(data & TM2_TOUCHKEY_BIT_PRESS_EV);
> > +
> > +	if (samsung_touchkey->keycode_type != TM2_TOUCHKEY_KEY_MENU &&
> > +	    samsung_touchkey->keycode_type != TM2_TOUCHKEY_KEY_BACK)
> 
> Shouldn't at least a debug message be printed here so the user can
> know that an error occurred and a correct keycode was not received?
> 
> > +		return IRQ_HANDLED;
> > +
> > +	schedule_work(&samsung_touchkey->irq_work);
> > +
> > +	return IRQ_HANDLED;
> > +}
> > +
> > +static int tm2_touchkey_probe(struct i2c_client *client,
> > +				  const struct i2c_device_id *id)
> > +{
> > +	struct tm2_touchkey_data *samsung_touchkey;
> > +	int ret;
> > +
> > +	ret = i2c_check_functionality(client->adapter,
> > +				      I2C_FUNC_SMBUS_BYTE |
> > +				      I2C_FUNC_SMBUS_BYTE_DATA);
> > +	if (!ret) {
> > +		dev_err(&client->dev, "No I2C functionality found\n");
> > +		return -ENODEV;
> > +	}
> > +
> > +	samsung_touchkey = devm_kzalloc(&client->dev,
> > +			sizeof(struct tm2_touchkey_data), GFP_KERNEL);

sizeof(*touchkey)

> > +
> > +	if (!samsung_touchkey) {
> > +		dev_err(&client->dev, "Failed to allocate memory.\n");
> > +		return -ENOMEM;
> > +	}
> > +
> > +	samsung_touchkey->client = client;
> > +	i2c_set_clientdata(client, samsung_touchkey);
> > +	INIT_WORK(&samsung_touchkey->irq_work, tm2_touchkey_irq_work);

Work is not needed.

> > +
> > +	/* regulator */
> > +	samsung_touchkey->regulator_vcc =
> > +				devm_regulator_get(&client->dev, "vcc");
> > +	if (IS_ERR(samsung_touchkey->regulator_vcc)) {
> > +		dev_err(&client->dev, "Failed to get vcc regulator\n");
> > +		return PTR_ERR(samsung_touchkey->regulator_vcc);
> > +	}
> > +
> > +	samsung_touchkey->regulator_vdd =
> > +				devm_regulator_get(&client->dev, "vdd");
> > +	if (IS_ERR(samsung_touchkey->regulator_vdd)) {
> > +		dev_err(&client->dev, "Failed to get vdd regulator\n");
> > +		return PTR_ERR(samsung_touchkey->regulator_vcc);
> > +	}

devm_regulator_bulk_get

> > +
> > +	/* power */
> > +	ret = tm2_touchkey_power_enable(samsung_touchkey);
> > +	if (ret) {
> > +		dev_err(&client->dev, "Failed to enable power\n");
> > +		return ret;
> > +	}

You need to install devm action (devm_add_action_or_reset) to disable
power when unloading driver (or if initialization fails).

> > +
> > +	/* irq */
> > +	ret = devm_request_threaded_irq(&client->dev,
> > +					client->irq, NULL,
> > +					tm2_touchkey_irq_handler,
> > +					IRQF_TRIGGER_FALLING | IRQF_ONESHOT,

I'd rather we rely on IRQ trigger from DT, so just use IRQF_PNESHOT
here.

I'd rather you allocated input device before requesting IRQ. The
registering input device is fine to do after getting IRQ.

> > +					TM2_TOUCHKEY_DEV_NAME,
> > +					samsung_touchkey);
> > +	if (ret) {
> > +		dev_err(&client->dev, "Failed to request threaded irq\n");
> > +		return ret;
> > +	}
> > +
> > +	/* input device */
> > +	samsung_touchkey->input_dev = devm_input_allocate_device(&client->dev);
> > +	if (!samsung_touchkey->input_dev) {
> > +		dev_err(&client->dev, "Failed to alloc input device.\n");
> > +		return -ENOMEM;
> > +	}
> > +	samsung_touchkey->input_dev->name = TM2_TOUCHKEY_DEV_NAME;
> > +	samsung_touchkey->input_dev->id.bustype = BUS_I2C;
> > +	samsung_touchkey->input_dev->dev.parent = &client->dev;

No need to set parent when using devm_input_allocate_device(), it is
done automatically.

> > +
> > +	set_bit(EV_KEY, samsung_touchkey->input_dev->evbit);
> > +	set_bit(KEY_PHONE, samsung_touchkey->input_dev->keybit);
> > +	set_bit(KEY_BACK, samsung_touchkey->input_dev->keybit);


Just do
	input_set_capability(touchkey->input_dev, EV_KEY, KEY_PHONE);
	input_set_capability(touchkey->input_dev, EV_KEY, KEY_BACK);


> > +	input_set_drvdata(samsung_touchkey->input_dev, samsung_touchkey);
> > +
> > +	ret = input_register_device(samsung_touchkey->input_dev);
> > +	if (ret) {
> > +		dev_err(&client->dev, "Failed to register input device.\n");
> > +		return ret;
> > +	}
> > +
> > +	/* led device */
> > +	samsung_touchkey->led_dev.name = TM2_TOUCHKEY_DEV_NAME;
> > +	samsung_touchkey->led_dev.brightness = LED_FULL;
> > +	samsung_touchkey->led_dev.max_brightness = LED_FULL;
> > +	samsung_touchkey->led_dev.brightness_set =
> > +						tm2_touchkey_led_brightness_set;
> > +
> > +	ret = devm_led_classdev_register(&client->dev,
> > +					 &samsung_touchkey->led_dev);
> > +	if (ret < 0) {
> > +		dev_err(&client->dev, "Failed to register touchkey led\n");
> > +		return ret;
> > +	}
> > +
> > +	return 0;
> > +}
> > +
> > +static void tm2_touchkey_shutdown(struct i2c_client *client)
> > +{

This is something not normally done. Does your platform really keep
rails on when AP is off?

> > +	struct tm2_touchkey_data *samsung_touchkey =
> > +						i2c_get_clientdata(client);
> > +	int ret;
> > +
> > +	disable_irq(client->irq);
> > +	ret = tm2_touchkey_power_disable(samsung_touchkey);
> > +	if (ret)
> > +		dev_err(&client->dev, "Failed to disable power\n");
> > +}
> > +
> > +static int tm2_touchkey_suspend(struct device *dev)

__maybe_unused

> > +{
> > +	struct tm2_touchkey_data *samsung_touchkey = dev_get_drvdata(dev);
> > +	int ret;
> > +
> > +	disable_irq(samsung_touchkey->client->irq);
> > +	ret = tm2_touchkey_power_disable(samsung_touchkey);
> > +	if (ret)
> > +		dev_err(dev, "Failed to disable power\n");
> > +
> > +	return ret;
> > +}
> 
> These two functions are basically the same, can you factor it out?
> 
> > +
> > +static int tm2_touchkey_resume(struct device *dev)

__maybe_unused

> > +{
> > +	struct tm2_touchkey_data *samsung_touchkey = dev_get_drvdata(dev);
> > +	int ret;
> > +
> > +	enable_irq(samsung_touchkey->client->irq);
> > +	ret = tm2_touchkey_power_enable(samsung_touchkey);
> > +	if (ret)
> > +		dev_err(dev, "Failed to enable power\n");
> > +
> > +	return ret;
> > +}
> > +
> > +static SIMPLE_DEV_PM_OPS(tm2_touchkey_pm_ops, tm2_touchkey_suspend,
> > +							tm2_touchkey_resume);
> > +
> > +static const struct i2c_device_id tm2_touchkey_id_table[] = {
> > +	{TM2_TOUCHKEY_DEV_NAME, 0},
> > +	{},
> > +};
> > +
> 
> You need a MODULE_DEVICE_TABLE(i2c, tm2_touchkey_id_table) here so the
> module can be autoloaded when the device is registered.
> 
> > +static const struct of_device_id tm2_touchkey_of_match[] = {
> > +	{.compatible = "samsung,tm2-touchkey",},
> > +	{},
> > +};
> > +
> 
> Here a MODULE_DEVICE_TABLE(of, tm2_touchkey_of_match) is not strictly
> needed since the I2C core always reports MODALIAS of the form i2c:<dev>
> but still is good to have so the I2C core can be fixed at some point.

Yes, please add MODULE_DEVICE_TABLE(of, ...).

> 
> > +static struct i2c_driver tm2_touchkey_driver = {
> > +	.driver = {
> > +		.name = TM2_TOUCHKEY_DEV_NAME,
> > +		.pm = &tm2_touchkey_pm_ops,
> > +		.of_match_table = of_match_ptr(tm2_touchkey_of_match),
> > +	},
> > +	.probe = tm2_touchkey_probe,
> > +	.shutdown = tm2_touchkey_shutdown,
> > +	.id_table = tm2_touchkey_id_table,
> > +};
> > +
> > +module_i2c_driver(tm2_touchkey_driver);
> > +
> > +MODULE_AUTHOR("Beomho Seo <beomho.seo@samsung.com>");
> > +MODULE_AUTHOR("Jaechul Lee <jcsing.lee@samsung.com>");
> > +MODULE_DESCRIPTION("Samsung touchkey driver");
> > +MODULE_LICENSE("GPL v2");
> > 

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH 2/4] input: tm2-touchkey: Add touchkey driver support for TM2
@ 2017-01-03 18:56           ` Dmitry Torokhov
  0 siblings, 0 replies; 61+ messages in thread
From: Dmitry Torokhov @ 2017-01-03 18:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jan 03, 2017 at 10:11:39AM -0300, Javier Martinez Canillas wrote:
> Hello Jaechul,
> 
> On 01/03/2017 04:57 AM, Jaechul Lee wrote:
> > This patch adds support for the TM2 touch key and led
> > functionlity.
> > 
> 
> s/functionlity/functionality
> 
> > The driver interfaces with userspace through an input device and
> > reports KEY_PHONE and KEY_BACK event types. LED brightness can be
> > controlled by "/sys/class/leds/tm2-touchkey/brightness".
> > 
> > Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> > Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
> > ---
> >  drivers/input/keyboard/Kconfig        |  11 ++
> >  drivers/input/keyboard/Makefile       |   1 +
> >  drivers/input/keyboard/tm2-touchkey.c | 326 ++++++++++++++++++++++++++++++++++
> >  3 files changed, 338 insertions(+)
> >  create mode 100644 drivers/input/keyboard/tm2-touchkey.c
> > 
> > diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
> > index cbd75cf..72c0ba1 100644
> > --- a/drivers/input/keyboard/Kconfig
> > +++ b/drivers/input/keyboard/Kconfig
> > @@ -666,6 +666,17 @@ config KEYBOARD_TC3589X
> >  	  To compile this driver as a module, choose M here: the
> >  	  module will be called tc3589x-keypad.
> >  
> > +config KEYBOARD_TM2_TOUCHKEY
> > +	tristate "tm2-touchkey support"
> > +	depends on I2C

There should be LED dependency as well.

> > +	help
> > +	  Say Y here to enable the tm2-touchkey.
> > +	  touchkey driver for tm2. This driver can enable
> > +	  the interrupt and make input events and control led brightness.
> > +
> > +	  To compile this driver as a module, choose M here.
> > +	  module will be called tm2-touchkey
> > +
> >  config KEYBOARD_TWL4030
> >  	tristate "TI TWL4030/TWL5030/TPS659x0 keypad support"
> >  	depends on TWL4030_CORE
> > diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
> > index d9f4cfc..7d9acff 100644
> > --- a/drivers/input/keyboard/Makefile
> > +++ b/drivers/input/keyboard/Makefile
> > @@ -61,6 +61,7 @@ obj-$(CONFIG_KEYBOARD_SUN4I_LRADC)	+= sun4i-lradc-keys.o
> >  obj-$(CONFIG_KEYBOARD_SUNKBD)		+= sunkbd.o
> >  obj-$(CONFIG_KEYBOARD_TC3589X)		+= tc3589x-keypad.o
> >  obj-$(CONFIG_KEYBOARD_TEGRA)		+= tegra-kbc.o
> > +obj-$(CONFIG_KEYBOARD_TM2_TOUCHKEY)	+= tm2-touchkey.o
> >  obj-$(CONFIG_KEYBOARD_TWL4030)		+= twl4030_keypad.o
> >  obj-$(CONFIG_KEYBOARD_XTKBD)		+= xtkbd.o
> >  obj-$(CONFIG_KEYBOARD_W90P910)		+= w90p910_keypad.o
> > diff --git a/drivers/input/keyboard/tm2-touchkey.c b/drivers/input/keyboard/tm2-touchkey.c
> > new file mode 100644
> > index 0000000..d9575d8
> > --- /dev/null
> > +++ b/drivers/input/keyboard/tm2-touchkey.c
> > @@ -0,0 +1,326 @@
> > +/*
> > + * Driver for keys on GPIO lines capable of generating interrupts.

This does not match what the driver does.

> > + *
> > + * Copyright 2005 Phil Blundell
> > + * Copyright 2016 Samsung Electronics Co., Ltd.
> > + *
> > + * Author: Beomho Seo <beomho.seo@samsung.com>
> > + * Author: Jaechul Lee <jcsing.lee@samsung.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.
> > + */
> > +
> > +#include <linux/bitops.h>
> > +#include <linux/delay.h>
> > +#include <linux/device.h>
> > +#include <linux/i2c.h>
> > +#include <linux/input.h>
> > +#include <linux/interrupt.h>
> > +#include <linux/irq.h>
> > +#include <linux/leds.h>
> > +#include <linux/module.h>
> > +#include <linux/of.h>
> > +#include <linux/pm.h>
> > +#include <linux/regulator/consumer.h>
> > +#include <linux/workqueue.h>
> > +
> > +#define TM2_TOUCHKEY_DEV_NAME			"tm2-touchkey"
> > +#define TM2_TOUCHKEY_KEYCODE_REG			0x03
> > +#define TM2_TOUCHKEY_BASE_REG			0x00
> > +#define TM2_TOUCHKEY_CMD_LED_ON			0x10
> > +#define TM2_TOUCHKEY_CMD_LED_OFF			0x20
> > +#define TM2_TOUCHKEY_BIT_PRESS_EV			BIT(3)
> > +#define TM2_TOUCHKEY_BIT_KEYCODE			GENMASK(2, 0)
> > +#define TM2_TOUCHKEY_LED_VOLTAGE_MIN			2500000
> > +#define TM2_TOUCHKEY_LED_VOLTAGE_MAX			3300000
> > +
> > +enum {
> > +	TM2_TOUCHKEY_KEY_MENU = 0x1,
> > +	TM2_TOUCHKEY_KEY_BACK,
> > +};
> > +
> > +#define tm2_touchkey_power_enable(x) __tm2_touchkey_power_onoff(x, 1)
> > +#define tm2_touchkey_power_disable(x) __tm2_touchkey_power_onoff(x, 0)
> > +
> > +struct tm2_touchkey_data {
> > +	struct i2c_client *client;
> > +	struct input_dev *input_dev;
> > +	struct led_classdev led_dev;
> > +
> > +	u8 keycode_type;
> > +	u8 pressed;
> > +	struct work_struct irq_work;
> > +
> > +	bool power_onoff;
> > +	struct regulator *regulator_vcc;	/* 1.8V */
> > +	struct regulator *regulator_vdd;	/* 3.3V */
> > +};
> > +
> > +static void tm2_touchkey_led_brightness_set(struct led_classdev *led_dev,
> > +						enum led_brightness brightness)
> > +{
> > +	struct tm2_touchkey_data *samsung_touchkey =

Just call it "touchkey", "samsung_touchkey" is too long for a local
variable.

> > +	    container_of(led_dev, struct tm2_touchkey_data, led_dev);
> > +	u32 volt;
> > +	u8 data;
> > +
> > +	if (brightness == LED_OFF) {
> > +		volt = TM2_TOUCHKEY_LED_VOLTAGE_MIN;
> > +		data = TM2_TOUCHKEY_CMD_LED_OFF;
> > +	} else {
> > +		volt = TM2_TOUCHKEY_LED_VOLTAGE_MAX;
> > +		data = TM2_TOUCHKEY_CMD_LED_ON;
> > +	}
> > +
> > +	regulator_set_voltage(samsung_touchkey->regulator_vdd, volt, volt);
> > +	i2c_smbus_write_byte_data(samsung_touchkey->client,
> > +				  TM2_TOUCHKEY_BASE_REG, data);
> > +}
> > +
> > +static int __tm2_touchkey_power_onoff(struct tm2_touchkey_data
> > +					  *samsung_touchkey, bool onoff)
> > +{
> > +	int ret = 0;
> > +
> > +	if (samsung_touchkey->power_onoff == onoff)
> > +		return ret;
> > +
> > +	if (onoff) {
> > +		ret = regulator_enable(samsung_touchkey->regulator_vcc);
> > +		if (ret)
> > +			return ret;
> > +
> > +		ret = regulator_enable(samsung_touchkey->regulator_vdd);
> > +		if (ret) {
> > +			regulator_disable(samsung_touchkey->regulator_vcc);
> > +			return ret;
> > +		}
> 
> I would add a comment about the sleep here.

Also "bulk" regulator API can be useful here.

> 
> > +		msleep(150);
> > +	} else {
> > +		int err;
> > +
> > +		err = regulator_disable(samsung_touchkey->regulator_vcc);
> > +		if (err)
> > +			ret = err;
> > +
> > +		err = regulator_disable(samsung_touchkey->regulator_vdd);
> > +		if (err && !ret)
> > +			ret = err;
> > +	}
> > +	samsung_touchkey->power_onoff = onoff;
> > +
> > +	return ret;
> > +}
> > +
> > +static void tm2_touchkey_irq_work(struct work_struct *irq_work)
> > +{
> > +	struct tm2_touchkey_data *samsung_touchkey =
> > +	    container_of(irq_work, struct tm2_touchkey_data, irq_work);
> > +
> > +	if (!samsung_touchkey->pressed) {
> > +		input_report_key(samsung_touchkey->input_dev, KEY_PHONE, 0);
> > +		input_report_key(samsung_touchkey->input_dev, KEY_BACK, 0);
> > +	} else {
> > +		if (samsung_touchkey->keycode_type == TM2_TOUCHKEY_KEY_MENU)
> > +			input_report_key(samsung_touchkey->input_dev,
> > +					 KEY_PHONE, 1);
> > +		else
> > +			input_report_key(samsung_touchkey->input_dev,
> > +					 KEY_BACK, 1);
> > +	}
> > +	input_sync(samsung_touchkey->input_dev);
> > +}

There is absolutely no reason for doing this in a work. Just call
input_report_key/input_sync from your threaded IRQ routine.

> > +
> > +static irqreturn_t tm2_touchkey_irq_handler(int irq, void *devid)
> > +{
> > +	struct tm2_touchkey_data *samsung_touchkey = devid;
> > +	u32 data;
> > +
> > +	data = i2c_smbus_read_byte_data(samsung_touchkey->client,
> > +					TM2_TOUCHKEY_KEYCODE_REG);
> > +
> > +	if (data < 0) {
> > +		dev_err(&samsung_touchkey->client->dev, "Failed to read i2c data\n");
> > +		return IRQ_HANDLED;
> > +	}
> > +
> > +	samsung_touchkey->keycode_type = data & TM2_TOUCHKEY_BIT_KEYCODE;
> > +	samsung_touchkey->pressed = !(data & TM2_TOUCHKEY_BIT_PRESS_EV);
> > +
> > +	if (samsung_touchkey->keycode_type != TM2_TOUCHKEY_KEY_MENU &&
> > +	    samsung_touchkey->keycode_type != TM2_TOUCHKEY_KEY_BACK)
> 
> Shouldn't at least a debug message be printed here so the user can
> know that an error occurred and a correct keycode was not received?
> 
> > +		return IRQ_HANDLED;
> > +
> > +	schedule_work(&samsung_touchkey->irq_work);
> > +
> > +	return IRQ_HANDLED;
> > +}
> > +
> > +static int tm2_touchkey_probe(struct i2c_client *client,
> > +				  const struct i2c_device_id *id)
> > +{
> > +	struct tm2_touchkey_data *samsung_touchkey;
> > +	int ret;
> > +
> > +	ret = i2c_check_functionality(client->adapter,
> > +				      I2C_FUNC_SMBUS_BYTE |
> > +				      I2C_FUNC_SMBUS_BYTE_DATA);
> > +	if (!ret) {
> > +		dev_err(&client->dev, "No I2C functionality found\n");
> > +		return -ENODEV;
> > +	}
> > +
> > +	samsung_touchkey = devm_kzalloc(&client->dev,
> > +			sizeof(struct tm2_touchkey_data), GFP_KERNEL);

sizeof(*touchkey)

> > +
> > +	if (!samsung_touchkey) {
> > +		dev_err(&client->dev, "Failed to allocate memory.\n");
> > +		return -ENOMEM;
> > +	}
> > +
> > +	samsung_touchkey->client = client;
> > +	i2c_set_clientdata(client, samsung_touchkey);
> > +	INIT_WORK(&samsung_touchkey->irq_work, tm2_touchkey_irq_work);

Work is not needed.

> > +
> > +	/* regulator */
> > +	samsung_touchkey->regulator_vcc =
> > +				devm_regulator_get(&client->dev, "vcc");
> > +	if (IS_ERR(samsung_touchkey->regulator_vcc)) {
> > +		dev_err(&client->dev, "Failed to get vcc regulator\n");
> > +		return PTR_ERR(samsung_touchkey->regulator_vcc);
> > +	}
> > +
> > +	samsung_touchkey->regulator_vdd =
> > +				devm_regulator_get(&client->dev, "vdd");
> > +	if (IS_ERR(samsung_touchkey->regulator_vdd)) {
> > +		dev_err(&client->dev, "Failed to get vdd regulator\n");
> > +		return PTR_ERR(samsung_touchkey->regulator_vcc);
> > +	}

devm_regulator_bulk_get

> > +
> > +	/* power */
> > +	ret = tm2_touchkey_power_enable(samsung_touchkey);
> > +	if (ret) {
> > +		dev_err(&client->dev, "Failed to enable power\n");
> > +		return ret;
> > +	}

You need to install devm action (devm_add_action_or_reset) to disable
power when unloading driver (or if initialization fails).

> > +
> > +	/* irq */
> > +	ret = devm_request_threaded_irq(&client->dev,
> > +					client->irq, NULL,
> > +					tm2_touchkey_irq_handler,
> > +					IRQF_TRIGGER_FALLING | IRQF_ONESHOT,

I'd rather we rely on IRQ trigger from DT, so just use IRQF_PNESHOT
here.

I'd rather you allocated input device before requesting IRQ. The
registering input device is fine to do after getting IRQ.

> > +					TM2_TOUCHKEY_DEV_NAME,
> > +					samsung_touchkey);
> > +	if (ret) {
> > +		dev_err(&client->dev, "Failed to request threaded irq\n");
> > +		return ret;
> > +	}
> > +
> > +	/* input device */
> > +	samsung_touchkey->input_dev = devm_input_allocate_device(&client->dev);
> > +	if (!samsung_touchkey->input_dev) {
> > +		dev_err(&client->dev, "Failed to alloc input device.\n");
> > +		return -ENOMEM;
> > +	}
> > +	samsung_touchkey->input_dev->name = TM2_TOUCHKEY_DEV_NAME;
> > +	samsung_touchkey->input_dev->id.bustype = BUS_I2C;
> > +	samsung_touchkey->input_dev->dev.parent = &client->dev;

No need to set parent when using devm_input_allocate_device(), it is
done automatically.

> > +
> > +	set_bit(EV_KEY, samsung_touchkey->input_dev->evbit);
> > +	set_bit(KEY_PHONE, samsung_touchkey->input_dev->keybit);
> > +	set_bit(KEY_BACK, samsung_touchkey->input_dev->keybit);


Just do
	input_set_capability(touchkey->input_dev, EV_KEY, KEY_PHONE);
	input_set_capability(touchkey->input_dev, EV_KEY, KEY_BACK);


> > +	input_set_drvdata(samsung_touchkey->input_dev, samsung_touchkey);
> > +
> > +	ret = input_register_device(samsung_touchkey->input_dev);
> > +	if (ret) {
> > +		dev_err(&client->dev, "Failed to register input device.\n");
> > +		return ret;
> > +	}
> > +
> > +	/* led device */
> > +	samsung_touchkey->led_dev.name = TM2_TOUCHKEY_DEV_NAME;
> > +	samsung_touchkey->led_dev.brightness = LED_FULL;
> > +	samsung_touchkey->led_dev.max_brightness = LED_FULL;
> > +	samsung_touchkey->led_dev.brightness_set =
> > +						tm2_touchkey_led_brightness_set;
> > +
> > +	ret = devm_led_classdev_register(&client->dev,
> > +					 &samsung_touchkey->led_dev);
> > +	if (ret < 0) {
> > +		dev_err(&client->dev, "Failed to register touchkey led\n");
> > +		return ret;
> > +	}
> > +
> > +	return 0;
> > +}
> > +
> > +static void tm2_touchkey_shutdown(struct i2c_client *client)
> > +{

This is something not normally done. Does your platform really keep
rails on when AP is off?

> > +	struct tm2_touchkey_data *samsung_touchkey =
> > +						i2c_get_clientdata(client);
> > +	int ret;
> > +
> > +	disable_irq(client->irq);
> > +	ret = tm2_touchkey_power_disable(samsung_touchkey);
> > +	if (ret)
> > +		dev_err(&client->dev, "Failed to disable power\n");
> > +}
> > +
> > +static int tm2_touchkey_suspend(struct device *dev)

__maybe_unused

> > +{
> > +	struct tm2_touchkey_data *samsung_touchkey = dev_get_drvdata(dev);
> > +	int ret;
> > +
> > +	disable_irq(samsung_touchkey->client->irq);
> > +	ret = tm2_touchkey_power_disable(samsung_touchkey);
> > +	if (ret)
> > +		dev_err(dev, "Failed to disable power\n");
> > +
> > +	return ret;
> > +}
> 
> These two functions are basically the same, can you factor it out?
> 
> > +
> > +static int tm2_touchkey_resume(struct device *dev)

__maybe_unused

> > +{
> > +	struct tm2_touchkey_data *samsung_touchkey = dev_get_drvdata(dev);
> > +	int ret;
> > +
> > +	enable_irq(samsung_touchkey->client->irq);
> > +	ret = tm2_touchkey_power_enable(samsung_touchkey);
> > +	if (ret)
> > +		dev_err(dev, "Failed to enable power\n");
> > +
> > +	return ret;
> > +}
> > +
> > +static SIMPLE_DEV_PM_OPS(tm2_touchkey_pm_ops, tm2_touchkey_suspend,
> > +							tm2_touchkey_resume);
> > +
> > +static const struct i2c_device_id tm2_touchkey_id_table[] = {
> > +	{TM2_TOUCHKEY_DEV_NAME, 0},
> > +	{},
> > +};
> > +
> 
> You need a MODULE_DEVICE_TABLE(i2c, tm2_touchkey_id_table) here so the
> module can be autoloaded when the device is registered.
> 
> > +static const struct of_device_id tm2_touchkey_of_match[] = {
> > +	{.compatible = "samsung,tm2-touchkey",},
> > +	{},
> > +};
> > +
> 
> Here a MODULE_DEVICE_TABLE(of, tm2_touchkey_of_match) is not strictly
> needed since the I2C core always reports MODALIAS of the form i2c:<dev>
> but still is good to have so the I2C core can be fixed at some point.

Yes, please add MODULE_DEVICE_TABLE(of, ...).

> 
> > +static struct i2c_driver tm2_touchkey_driver = {
> > +	.driver = {
> > +		.name = TM2_TOUCHKEY_DEV_NAME,
> > +		.pm = &tm2_touchkey_pm_ops,
> > +		.of_match_table = of_match_ptr(tm2_touchkey_of_match),
> > +	},
> > +	.probe = tm2_touchkey_probe,
> > +	.shutdown = tm2_touchkey_shutdown,
> > +	.id_table = tm2_touchkey_id_table,
> > +};
> > +
> > +module_i2c_driver(tm2_touchkey_driver);
> > +
> > +MODULE_AUTHOR("Beomho Seo <beomho.seo@samsung.com>");
> > +MODULE_AUTHOR("Jaechul Lee <jcsing.lee@samsung.com>");
> > +MODULE_DESCRIPTION("Samsung touchkey driver");
> > +MODULE_LICENSE("GPL v2");
> > 

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 61+ messages in thread

* Re: [PATCH 1/4] input: Add support for the tm2 touchkey device driver
  2017-01-03  7:57       ` Jaechul Lee
@ 2017-01-04 14:15         ` Rob Herring
  -1 siblings, 0 replies; 61+ messages in thread
From: Rob Herring @ 2017-01-04 14:15 UTC (permalink / raw)
  To: Jaechul Lee
  Cc: Dmitry Torokhov, Mark Rutland, Catalin Marinas, Will Deacon,
	Kukjin Kim, Krzysztof Kozlowski, Javier Martinez Canillas,
	Andi Shyti, Chanwoo Choi, beomho.seo, galaxyra, linux-arm-kernel,
	linux-input, devicetree, linux-kernel, linux-samsung-soc

On Tue, Jan 03, 2017 at 04:57:14PM +0900, Jaechul Lee wrote:
> This patch adds the binding description of the tm2 touchkey
> device driver.
> 
> Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> ---
>  .../bindings/input/samsung,tm2-touchkey.txt        | 27 ++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/input/samsung,tm2-touchkey.txt

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 61+ messages in thread

* [PATCH 1/4] input: Add support for the tm2 touchkey device driver
@ 2017-01-04 14:15         ` Rob Herring
  0 siblings, 0 replies; 61+ messages in thread
From: Rob Herring @ 2017-01-04 14:15 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jan 03, 2017 at 04:57:14PM +0900, Jaechul Lee wrote:
> This patch adds the binding description of the tm2 touchkey
> device driver.
> 
> Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
> ---
>  .../bindings/input/samsung,tm2-touchkey.txt        | 27 ++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/input/samsung,tm2-touchkey.txt

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 61+ messages in thread

end of thread, other threads:[~2017-01-04 14:16 UTC | newest]

Thread overview: 61+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170103075733epcas5p48985c789a816f1f2eae84c52e070cc14@epcas5p4.samsung.com>
2017-01-03  7:57 ` [PATCH 0/4] Add touch key driver support for TM2 Jaechul Lee
2017-01-03  7:57   ` Jaechul Lee
2017-01-03  7:57   ` Jaechul Lee
     [not found]   ` <CGME20170103075733epcas5p47dff8d21854938b2439c9843d91bc301@epcas5p4.samsung.com>
2017-01-03  7:57     ` [PATCH 1/4] input: Add support for the tm2 touchkey device driver Jaechul Lee
2017-01-03  7:57       ` Jaechul Lee
2017-01-03 12:26       ` Javier Martinez Canillas
2017-01-03 12:26         ` Javier Martinez Canillas
2017-01-04 14:15       ` Rob Herring
2017-01-04 14:15         ` Rob Herring
     [not found]   ` <CGME20170103075733epcas5p4a065198d4abf35081024af95055c67d2@epcas5p4.samsung.com>
2017-01-03  7:57     ` [PATCH 2/4] input: tm2-touchkey: Add touchkey driver support for TM2 Jaechul Lee
2017-01-03  7:57       ` Jaechul Lee
2017-01-03 13:11       ` Javier Martinez Canillas
2017-01-03 13:11         ` Javier Martinez Canillas
2017-01-03 13:11         ` Javier Martinez Canillas
2017-01-03 18:56         ` Dmitry Torokhov
2017-01-03 18:56           ` Dmitry Torokhov
2017-01-03 16:59       ` Krzysztof Kozlowski
2017-01-03 16:59         ` Krzysztof Kozlowski
2017-01-03 16:59         ` Krzysztof Kozlowski
     [not found]   ` <CGME20170103075734epcas5p43a9743131f63affd0a438d2ed342f22e@epcas5p4.samsung.com>
2017-01-03  7:57     ` [PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other Jaechul Lee
2017-01-03  7:57       ` Jaechul Lee
2017-01-03  8:16       ` Andi Shyti
2017-01-03  8:16         ` Andi Shyti
2017-01-03  8:27       ` Krzysztof Kozlowski
2017-01-03  8:27         ` Krzysztof Kozlowski
2017-01-03  9:58         ` Andi Shyti
2017-01-03  9:58           ` Andi Shyti
2017-01-03 10:01           ` Krzysztof Kozlowski
2017-01-03 10:01             ` Krzysztof Kozlowski
2017-01-03 10:01             ` Krzysztof Kozlowski
2017-01-03 10:25             ` Andi Shyti
2017-01-03 10:25               ` Andi Shyti
2017-01-03 11:47               ` Chanwoo Choi
2017-01-03 11:47                 ` Chanwoo Choi
2017-01-03 11:55                 ` Andi Shyti
2017-01-03 11:55                   ` Andi Shyti
2017-01-03 11:55                   ` Andi Shyti
2017-01-03 12:15                   ` Javier Martinez Canillas
2017-01-03 12:15                     ` Javier Martinez Canillas
2017-01-03 12:15                     ` Javier Martinez Canillas
2017-01-03 14:40                     ` Andi Shyti
2017-01-03 14:40                       ` Andi Shyti
2017-01-03 14:57                       ` Javier Martinez Canillas
2017-01-03 14:57                         ` Javier Martinez Canillas
2017-01-03 14:57                         ` Javier Martinez Canillas
2017-01-03 15:29                       ` Chanwoo Choi
2017-01-03 15:29                         ` Chanwoo Choi
2017-01-03 15:29                         ` Chanwoo Choi
2017-01-03 16:31                         ` Krzysztof Kozlowski
2017-01-03 16:31                           ` Krzysztof Kozlowski
2017-01-03 16:31                           ` Krzysztof Kozlowski
2017-01-03 16:41               ` Krzysztof Kozlowski
2017-01-03 16:41                 ` Krzysztof Kozlowski
2017-01-03 16:41                 ` Krzysztof Kozlowski
     [not found]   ` <CGME20170103075734epcas5p439b05860a3238ce638f683d9687786a3@epcas5p4.samsung.com>
2017-01-03  7:57     ` [PATCH 4/4] arm64: dts: exynos: Add tm2 touchkey node Jaechul Lee
2017-01-03  7:57       ` Jaechul Lee
2017-01-03 13:14       ` Javier Martinez Canillas
2017-01-03 13:14         ` Javier Martinez Canillas
2017-01-03 16:49       ` Krzysztof Kozlowski
2017-01-03 16:49         ` Krzysztof Kozlowski
2017-01-03 16:49         ` Krzysztof Kozlowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.