[PATCH v2 0/4] Add touch key driver support for TM2
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. The patchset applies on next-20170105. Changes in v2: - fixed reviews from Javier, Dmitry - refactored power enable/disable functions. - reordered signed-offs in patch 2, while patch 4 is left as it was as Andi copy pasted the node to the new tm2.dts file - added Jarvier's (patch 1,2,4) and Krzysztof's (patch 4) reviews and Rob's Ack - patch 3 diff has been generated with -B50% 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 | 1116 arch/arm64/boot/dts/exynos/exynos5433-tm2.dts | 1105 +-- 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 | 280 + 7 files changed, 1445 insertions(+), 1097 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
[PATCH v2 4/4] arm64: dts: exynos: Add tm2 touchkey node
Add DT node support for TM2 touchkey device. Signed-off-by: Beomho Seo Signed-off-by: Jaechul Lee Signed-off-by: Andi Shyti Reviewed-by: Javier Martinez Canillas Reviewed-by: Krzysztof Kozlowski --- arch/arm64/boot/dts/exynos/exynos5433-tm2.dts | 13 + 1 file changed, 13 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts b/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts index aa8584a..dad6fb8 100644 --- a/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts +++ b/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts @@ -17,3 +17,16 @@ model = "Samsung TM2 board"; compatible = "samsung,tm2", "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
[PATCH v2 2/4] input: tm2-touchkey: Add touchkey driver support for TM2
This patch adds support for the TM2 touch key and led 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: Beomho Seo Signed-off-by: Jaechul Lee Reviewed-by: Javier Martinez Canillas Reviewed-by: Andi Shyti --- drivers/input/keyboard/Kconfig| 11 ++ drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/tm2-touchkey.c | 280 ++ 3 files changed, 292 insertions(+) create mode 100644 drivers/input/keyboard/tm2-touchkey.c diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index cbd75cf..e6e9858 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 + depends on LEDS_CLASS + help + Say Y here to enable device driver for tm2-touchkey with + LED control for the Exynos5433 TM2 board. + + 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 000..92eacb6 --- /dev/null +++ b/drivers/input/keyboard/tm2-touchkey.c @@ -0,0 +1,280 @@ +/* + * TM2 touchkey device driver + * + * Copyright 2005 Phil Blundell + * Copyright 2016 Samsung Electronics Co., Ltd. + * + * Author: Beomho Seo + * Author: Jaechul Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define TM2_TOUCHKEY_DEV_NAME "tm2-touchkey" +#define TM2_TOUCHKEY_KEYCODE_REG 0x03 +#define TM2_TOUCHKEY_BASE_REG 0x00 +#define TM2_TOUCHKEY_CMD_LED_ON0x10 +#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 250 +#define TM2_TOUCHKEY_LED_VOLTAGE_MAX 330 + +enum { + TM2_TOUCHKEY_KEY_MENU = 0x1, + TM2_TOUCHKEY_KEY_BACK, +}; + +struct tm2_touchkey_data { + struct i2c_client *client; + struct input_dev *input_dev; + struct led_classdev led_dev; + struct regulator_bulk_data regulators[2]; + + u8 keycode_type; + u8 pressed; +}; + +static void tm2_touchkey_led_brightness_set(struct led_classdev *led_dev, + enum led_brightness brightness) +{ + struct tm2_touchkey_data *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(touchkey->regulators[1].consumer, volt, volt); + i2c_smbus_write_byte_data(touchkey->client, + TM2_TOUCHKEY_BASE_REG, data); +} + +static int tm2_touchkey_power_enable(struct tm2_touchkey_data *touchkey) +{ + int ret = 0; + + ret = regulator_bulk_enable(ARRAY_SIZE(touchkey->regulators), + touchkey->regulators); + if (ret) + return ret; + + /* waiting for device initialization, at least 150ms */ + msleep(150); + + return 0; +} + +static void tm2_touchkey_power_disable(void *data) +{ + struct tm2_touchkey_data *touchkey = data; + + re
[PATCH v2 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
From: Andi Shyti 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 Signed-off-by: Jaechul Lee --- .../boot/dts/exynos/exynos5433-tm2-common.dtsi | 1116 +++ arch/arm64/boot/dts/exynos/exynos5433-tm2.dts | 1138 +--- arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts |2 +- 3 files changed, 1136 insertions(+), 1120 deletions(-) create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi rewrite arch/arm64/boot/dts/exynos/exynos5433-tm2.dts (98%) 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 000..7ad0019 --- /dev/null +++ b/arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi @@ -0,0 +1,1116 @@ +/* + * 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 +#include +#include +#include + +/ { + 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@2000 { + device_type = "memory"; + reg = <0x0 0x2000 0x0 0xc000>; + }; + + gpio-keys { + compatible = "gpio-keys"; + + power-key { + gpios = <&gpa2 7 GPIO_ACTIVE_LOW>; + linux,code = ; + label = "power key"; + debounce-interval = <10>; + }; + + volume-up-key { + gpios = <&gpa2 0 GPIO_ACTIVE_LOW>; + linux,code = ; + label = "volume-up key"; + debounce-interval = <10>; + }; + + volume-down-key { + gpios = <&gpa2 1 GPIO_ACTIVE_LOW>; + linux,code = ; + label = "volume-down key"; + debounce-interval = <10>; + }; + + homepage-key { + gpios = <&gpa0 3 GPIO_ACTIVE_LOW>; + linux,code = ; + 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>;
[PATCH v2 1/4] input: Add support for the tm2 touchkey device driver
This patch adds the binding description of the tm2 touchkey device driver. Signed-off-by: Jaechul Lee Reviewed-by: Javier Martinez Canillas Reviewed-by: Andi Shyti Acked-by: Rob Herring --- .../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 000..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
[PATCH v3 0/5] Add touch key driver support for TM2
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. This patch need to apply after this one: https://lkml.org/lkml/2016/12/29/319 Changes in v3: - Changed the commit ordering, the tm2-touchkey related patches are the last 3. - Added Chanwoo's patch which fixes the wrong voltage of ldo23 and ldo25. - Andi (patch 3) moves the ldo31 and ldo38 in the tm2 and tm2e files as they have different values. Changes in v2: - fixed reviews from Javier, Dmitry - refactored power enable/disable functions. - reordered signed-offs in patch 2, while patch 4 is left as it was as Andi copy pasted the node to the new tm2.dts file - added Jarvier's (patch 1,2,4) and Krzysztof's (patch 4) reviews and Rob's Ack - patch 3 diff has been generated with -B50% Andi Shyti (1): arm64: dts: exynos: make tm2 and tm2e independent from each other Chanwoo Choi (1): arm64: dts: exynos5433: TM2/E: Fix wrong information of ldo23 and ldo25 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 | 1118 arch/arm64/boot/dts/exynos/exynos5433-tm2.dts | 1113 +-- arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts | 32 +- drivers/input/keyboard/Kconfig | 11 + drivers/input/keyboard/Makefile|1 + drivers/input/keyboard/tm2-touchkey.c | 280 + 7 files changed, 1469 insertions(+), 1113 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
[PATCH v3 3/5] input: Add support for the tm2 touchkey device driver
This patch adds the binding description of the tm2 touchkey device driver. Signed-off-by: Jaechul Lee Reviewed-by: Javier Martinez Canillas Reviewed-by: Andi Shyti Acked-by: Rob Herring --- .../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 000..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
[PATCH v3 2/5] arm64: dts: exynos: make tm2 and tm2e independent from each other
From: Andi Shyti 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. At the current status the only two differences between the two dts files (besides the board name) are ldo31 and ldo38. Signed-off-by: Andi Shyti Signed-off-by: Jaechul Lee --- .../boot/dts/exynos/exynos5433-tm2-common.dtsi | 1118 +++ arch/arm64/boot/dts/exynos/exynos5433-tm2.dts | 1153 +--- arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts | 22 +- 3 files changed, 1163 insertions(+), 1130 deletions(-) create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi rewrite arch/arm64/boot/dts/exynos/exynos5433-tm2.dts (98%) 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 000..c43f9a3 --- /dev/null +++ b/arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi @@ -0,0 +1,1118 @@ +/* + * SAMSUNG Exynos5433 TM2 board device tree source + * + * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * + * Common device tree source file for Samsung's TM2 and TM2E boards + * which are 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 +#include +#include +#include + +/ { + 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@2000 { + device_type = "memory"; + reg = <0x0 0x2000 0x0 0xc000>; + }; + + gpio-keys { + compatible = "gpio-keys"; + + power-key { + gpios = <&gpa2 7 GPIO_ACTIVE_LOW>; + linux,code = ; + label = "power key"; + debounce-interval = <10>; + }; + + volume-up-key { + gpios = <&gpa2 0 GPIO_ACTIVE_LOW>; + linux,code = ; + label = "volume-up key"; + debounce-interval = <10>; + }; + + volume-down-key { + gpios = <&gpa2 1 GPIO_ACTIVE_LOW>; + linux,code = ; + label = "volume-down key"; + debounce-interval = <10>; + }; + + homepage-key { + gpios = <&gpa0 3 GPIO_ACTIVE_LOW>; + linux,code = ; + 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-channe
[PATCH v3 5/5] arm64: dts: exynos: Add tm2 touchkey node
Add DT node support for TM2 touchkey device. Signed-off-by: Beomho Seo Signed-off-by: Jaechul Lee Signed-off-by: Andi Shyti Reviewed-by: Javier Martinez Canillas --- arch/arm64/boot/dts/exynos/exynos5433-tm2.dts | 13 + 1 file changed, 13 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts b/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts index d30b45a..15bdc2e 100644 --- a/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts +++ b/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts @@ -18,6 +18,19 @@ 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>; + }; +}; + ®ulators { ldo31_reg: LDO31 { regulator-name = "TSP_VDD_1.85V_AP"; -- 2.7.4
[PATCH v3 4/5] input: tm2-touchkey: Add touchkey driver support for TM2
This patch adds support for the TM2 touch key and led 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: Beomho Seo Signed-off-by: Jaechul Lee Reviewed-by: Javier Martinez Canillas Reviewed-by: Andi Shyti --- drivers/input/keyboard/Kconfig| 11 ++ drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/tm2-touchkey.c | 280 ++ 3 files changed, 292 insertions(+) create mode 100644 drivers/input/keyboard/tm2-touchkey.c diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index cbd75cf..e6e9858 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 + depends on LEDS_CLASS + help + Say Y here to enable device driver for tm2-touchkey with + LED control for the Exynos5433 TM2 board. + + 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 000..92eacb6 --- /dev/null +++ b/drivers/input/keyboard/tm2-touchkey.c @@ -0,0 +1,280 @@ +/* + * TM2 touchkey device driver + * + * Copyright 2005 Phil Blundell + * Copyright 2016 Samsung Electronics Co., Ltd. + * + * Author: Beomho Seo + * Author: Jaechul Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define TM2_TOUCHKEY_DEV_NAME "tm2-touchkey" +#define TM2_TOUCHKEY_KEYCODE_REG 0x03 +#define TM2_TOUCHKEY_BASE_REG 0x00 +#define TM2_TOUCHKEY_CMD_LED_ON0x10 +#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 250 +#define TM2_TOUCHKEY_LED_VOLTAGE_MAX 330 + +enum { + TM2_TOUCHKEY_KEY_MENU = 0x1, + TM2_TOUCHKEY_KEY_BACK, +}; + +struct tm2_touchkey_data { + struct i2c_client *client; + struct input_dev *input_dev; + struct led_classdev led_dev; + struct regulator_bulk_data regulators[2]; + + u8 keycode_type; + u8 pressed; +}; + +static void tm2_touchkey_led_brightness_set(struct led_classdev *led_dev, + enum led_brightness brightness) +{ + struct tm2_touchkey_data *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(touchkey->regulators[1].consumer, volt, volt); + i2c_smbus_write_byte_data(touchkey->client, + TM2_TOUCHKEY_BASE_REG, data); +} + +static int tm2_touchkey_power_enable(struct tm2_touchkey_data *touchkey) +{ + int ret = 0; + + ret = regulator_bulk_enable(ARRAY_SIZE(touchkey->regulators), + touchkey->regulators); + if (ret) + return ret; + + /* waiting for device initialization, at least 150ms */ + msleep(150); + + return 0; +} + +static void tm2_touchkey_power_disable(void *data) +{ + struct tm2_touchkey_data *touchkey = data; + + re
[PATCH v3 1/5] arm64: dts: exynos5433: TM2/E: Fix wrong information of ldo23 and ldo25
From: Chanwoo Choi This patch fixes the wrong information of ldo23 and ldo25 on both TM2 and TM2E. Fixes: 01e5d2352152 ("arm64: dts: exynos: Add dts file for Exynos5433-based TM2 board") Signed-off-by: Chanwoo Choi Signed-off-by: Andi Shyti Signed-off-by: Jaechul Lee --- arch/arm64/boot/dts/exynos/exynos5433-tm2.dts | 7 --- arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts | 10 -- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts b/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts index 3b5215c..e8971f4 100644 --- a/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts +++ b/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts @@ -504,9 +504,9 @@ }; ldo23_reg: LDO23 { - regulator-name = "CAM_SEN_CORE_1.2V_AP"; + regulator-name = "CAM_SEN_CORE_1.05V_AP"; regulator-min-microvolt = <105>; - regulator-max-microvolt = <120>; + regulator-max-microvolt = <105>; }; ldo24_reg: LDO24 { @@ -516,9 +516,10 @@ }; ldo25_reg: LDO25 { - regulator-name = "CAM_SEN_A2.8V_AP"; + regulator-name = "UNUSED_LDO25"; regulator-min-microvolt = <280>; regulator-max-microvolt = <280>; + regulator-always-off; }; ldo26_reg: LDO26 { diff --git a/arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts b/arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts index 1db4e7f..854c583 100644 --- a/arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts +++ b/arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts @@ -18,16 +18,6 @@ compatible = "samsung,tm2e", "samsung,exynos5433"; }; -&ldo23_reg { - regulator-name = "CAM_SEN_CORE_1.025V_AP"; - regulator-max-microvolt = <105>; -}; - -&ldo25_reg { - regulator-name = "UNUSED_LDO25"; - regulator-always-off; -}; - &ldo31_reg { regulator-name = "TSP_VDD_1.8V_AP"; regulator-min-microvolt = <180>; -- 2.7.4
Re: [PATCH v6 2/3] input: tm2-touchkey: Add touchkey driver support for TM2
Dear Dmitry Torokhov, On Sat, Jan 14, 2017 at 11:11:10PM -0800, Dmitry Torokhov wrote: > Hi Jaechul, > > On Mon, Jan 09, 2017 at 04:22:14PM +0900, Jaechul Lee wrote: > > +static irqreturn_t tm2_touchkey_irq_handler(int irq, void *devid) > > +{ > > + struct tm2_touchkey_data *touchkey = devid; > > + u32 data; > > + > > + data = i2c_smbus_read_byte_data(touchkey->client, > > + TM2_TOUCHKEY_KEYCODE_REG); > > + > > + if (data < 0) { > > You declared data as u32 so it will never be negative. Yes, it won't be negative. > > > + dev_err(&touchkey->client->dev, "Failed to read i2c data\n"); > > + return IRQ_HANDLED; > > + } > > + > > + touchkey->keycode_type = data & TM2_TOUCHKEY_BIT_KEYCODE; > > + touchkey->pressed = !(data & TM2_TOUCHKEY_BIT_PRESS_EV); > > There is no need to store this in touchkey structure as you are not > going to use it past this function. I agree with you. it doesn't need to store variables in touchkey structure. > > Does the version of the patch below work for you? I found that the condition is inverted. if data & TM2_TOUCHKEY_BIT_PRESS_EV is true, it means touchkey is released. it should be changed like this. if (data & TM2_TOUCHKEY_BIT_PRESS_EV) { input_report_key(touchkey->input_dev, KEY_PHONE, 0); input_report_key(touchkey->input_dev, KEY_BACK, 0); } else { input_report_key(touchkey->input_dev, key, 1); } I will prepare for patch v7 based on your modifications. Thank you very much for your reviews. Best Regards, Jaechul > > Thanks. > > -- > Dmitry > > > Input: tm2-touchkey - add touchkey driver support for TM2 > > From: Jaechul Lee > > This patch adds support for the TM2 touch key and led 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: Beomho Seo > Signed-off-by: Jaechul Lee > Reviewed-by: Javier Martinez Canillas > Reviewed-by: Andi Shyti > Acked-by: Krzysztof Kozlowski > Patchwork-Id: 9504149 > Signed-off-by: Dmitry Torokhov > --- > drivers/input/keyboard/Kconfig| 11 + > drivers/input/keyboard/Makefile |1 > drivers/input/keyboard/tm2-touchkey.c | 286 > + > 3 files changed, 298 insertions(+) > create mode 100644 drivers/input/keyboard/tm2-touchkey.c > > diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig > index cbd75cf44739..97acd6524ad7 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 > + depends on LEDS_CLASS > + help > + Say Y here to enable device driver for tm2-touchkey with > + LED control for the Exynos5433 TM2 board. > + > + 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 d9f4cfcf3410..7d9acff819a7 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 ..79bc2d2bd4b9 > --- /dev/null > +++ b/drivers/input/keyboard/tm2-touchkey.c > @@ -0,0 +1,286 @@ > +/* > + * TM2 touchkey device driver > + * > + * Copyright 2005 Phil Blundell > + * Copyright 2016 Samsung Electronics Co., Ltd. > + * > + * Author: Beomho Seo > + * Author: Jaechul Lee > + * > + *
[PATCH v7 3/3] arm64: dts: exynos: Add tm2 touchkey node
Add DT node support for TM2 touchkey device. Signed-off-by: Beomho Seo Signed-off-by: Jaechul Lee Signed-off-by: Andi Shyti Reviewed-by: Javier Martinez Canillas --- arch/arm64/boot/dts/exynos/exynos5433-tm2.dts | 13 + 1 file changed, 13 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts b/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts index 2449266..ddba2f8 100644 --- a/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts +++ b/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts @@ -18,6 +18,19 @@ compatible = "samsung,tm2", "samsung,exynos5433"; }; +&hsi2c_9 { + status = "okay"; + + touchkey@20 { + compatible = "cypress,tm2-touchkey"; + reg = <0x20>; + interrupt-parent = <&gpa3>; + interrupts = <2 IRQ_TYPE_EDGE_FALLING>; + vcc-supply = <&ldo32_reg>; + vdd-supply = <&ldo33_reg>; + }; +}; + &ldo31_reg { regulator-name = "TSP_VDD_1.85V_AP"; regulator-min-microvolt = <185>; -- 2.7.4
[PATCH v7 1/3] input: Add support for the tm2 touchkey device driver
This patch adds the binding description of the tm2 touchkey device driver. Signed-off-by: Jaechul Lee Reviewed-by: Javier Martinez Canillas Reviewed-by: Andi Shyti Reviewed-by: Chanwoo Choi Acked-by: Rob Herring Acked-by: Krzysztof Kozlowski --- .../bindings/input/cypress,tm2-touchkey.txt| 27 ++ 1 file changed, 27 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt diff --git a/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt b/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt new file mode 100644 index 000..635f62c --- /dev/null +++ b/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt @@ -0,0 +1,27 @@ +Samsung tm2-touchkey + +Required properties: +- compatible: must be "cypress,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 = "cypress,tm2-touchkey"; + reg = <0x20>; + interrupt-parent = <&gpa3>; + interrupts = <2 IRQ_TYPE_EDGE_FALLING>; + vcc-supply=<&ldo32_reg>; + vdd-supply=<&ldo33_reg>; + }; + }; -- 2.7.4
[PATCH v7 0/3] Add touch key driver support for TM2
Hi, This patch is last three patch from https://lkml.org/lkml/2017/1/6/277. because 1 and 2 patches have already been merged by Krzysztof. 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. Best Regard, Jaechul Changes in v7 - added Chanwoo's reviewed and tested. - fixed reviews from Dmitry. Changes in v6: - changed compatible name from samsaung to cypress. - updated commit tags. - removed first two patches from the original patchset. Changes in v5: - patch 1: removed a spurious regulator-always-off inherited from a different patch. Thanks Krzysztof. - patch 2: fixed a slip on the model, thanks Javier (this patch confuses me quite a lot, this was all right some patches ago and re appeared on this one). - patch 2: removed 'regulator' label and used the original ldo3x labels. Krzysztof: it looks better indeed. - added Javier's reviews and Krzysztof's acks on the related patches. Changes in v4: - patch 1 has been rebased on top of 7c294e002641 (arm64: dts: exynos: Remove unsupported regulator-always-off property from TM2E) - patch 2 has been generated with -B50% diff option using git 2.11 Changes in v3: - Changed the commit ordering, the tm2-touchkey related patches are the last 3. - Added Chanwoo's patch which fixes the wrong voltage of ldo23 and ldo25. - Andi (patch 3) moves the ldo31 and ldo38 in the tm2 and tm2e files as they have different values. Changes in v2: - fixed reviews from Javier, Dmitry - refactored power enable/disable functions. - reordered signed-offs in patch 2, while patch 4 is left as it was as Andi copy pasted the node to the new tm2.dts file - added Jarvier's (patch 1,2,4) and Krzysztof's (patch 4) reviews and Rob's Ack - patch 3 diff has been generated with -B50% 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/cypress,tm2-touchkey.txt| 27 ++ arch/arm64/boot/dts/exynos/exynos5433-tm2.dts | 13 + drivers/input/keyboard/Kconfig | 11 + drivers/input/keyboard/Makefile| 1 + drivers/input/keyboard/tm2-touchkey.c | 287 + 5 files changed, 339 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt create mode 100644 drivers/input/keyboard/tm2-touchkey.c -- 2.7.4
[PATCH v7 2/3] input: tm2-touchkey: Add touchkey driver support for TM2
This patch adds support for the TM2 touch key and led 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: Beomho Seo Signed-off-by: Jaechul Lee Reviewed-by: Javier Martinez Canillas Reviewed-by: Andi Shyti Reviewed-by: Chanwoo Choi Tested-by: Chanwoo Choi Acked-by: Krzysztof Kozlowski Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/Kconfig| 11 ++ drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/tm2-touchkey.c | 286 ++ 3 files changed, 298 insertions(+) create mode 100644 drivers/input/keyboard/tm2-touchkey.c diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index cbd75cf..97acd65 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 + depends on LEDS_CLASS + help + Say Y here to enable device driver for tm2-touchkey with + LED control for the Exynos5433 TM2 board. + + 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 000..916e2f3 --- /dev/null +++ b/drivers/input/keyboard/tm2-touchkey.c @@ -0,0 +1,286 @@ +/* + * TM2 touchkey device driver + * + * Copyright 2005 Phil Blundell + * Copyright 2016 Samsung Electronics Co., Ltd. + * + * Author: Beomho Seo + * Author: Jaechul Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define TM2_TOUCHKEY_DEV_NAME "tm2-touchkey" +#define TM2_TOUCHKEY_KEYCODE_REG 0x03 +#define TM2_TOUCHKEY_BASE_REG 0x00 +#define TM2_TOUCHKEY_CMD_LED_ON0x10 +#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 250 +#define TM2_TOUCHKEY_LED_VOLTAGE_MAX 330 + +enum { + TM2_TOUCHKEY_KEY_MENU = 0x1, + TM2_TOUCHKEY_KEY_BACK, +}; + +struct tm2_touchkey_data { + struct i2c_client *client; + struct input_dev *input_dev; + struct led_classdev led_dev; + struct regulator *vdd; + struct regulator_bulk_data regulators[2]; +}; + +static void tm2_touchkey_led_brightness_set(struct led_classdev *led_dev, + enum led_brightness brightness) +{ + struct tm2_touchkey_data *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(touchkey->vdd, volt, volt); + i2c_smbus_write_byte_data(touchkey->client, + TM2_TOUCHKEY_BASE_REG, data); +} + +static int tm2_touchkey_power_enable(struct tm2_touchkey_data *touchkey) +{ + int error; + + error = regulator_bulk_enable(ARRAY_SIZE(touchkey->regulators), + touchkey->regulators); + if (error) + return error; + + /* waiting for device initialization, at least 150ms */ + msleep(150); + + return 0; +} + +static void tm2_touchkey_power_disable(void *data)
[PATCH v6 1/3] input: Add support for the tm2 touchkey device driver
This patch adds the binding description of the tm2 touchkey device driver. Signed-off-by: Jaechul Lee Reviewed-by: Javier Martinez Canillas Reviewed-by: Andi Shyti Reviewed-by: Chanwoo Choi Acked-by: Rob Herring Acked-by: Krzysztof Kozlowski --- .../bindings/input/cypress,tm2-touchkey.txt| 27 ++ 1 file changed, 27 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt diff --git a/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt b/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt new file mode 100644 index 000..635f62c --- /dev/null +++ b/Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt @@ -0,0 +1,27 @@ +Samsung tm2-touchkey + +Required properties: +- compatible: must be "cypress,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 = "cypress,tm2-touchkey"; + reg = <0x20>; + interrupt-parent = <&gpa3>; + interrupts = <2 IRQ_TYPE_EDGE_FALLING>; + vcc-supply=<&ldo32_reg>; + vdd-supply=<&ldo33_reg>; + }; + }; -- 2.7.4
[PATCH v6 2/3] input: tm2-touchkey: Add touchkey driver support for TM2
This patch adds support for the TM2 touch key and led 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: Beomho Seo Signed-off-by: Jaechul Lee Reviewed-by: Javier Martinez Canillas Reviewed-by: Andi Shyti Acked-by: Krzysztof Kozlowski --- drivers/input/keyboard/Kconfig| 11 ++ drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/tm2-touchkey.c | 287 ++ 3 files changed, 299 insertions(+) create mode 100644 drivers/input/keyboard/tm2-touchkey.c diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index cbd75cf..97acd65 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 + depends on LEDS_CLASS + help + Say Y here to enable device driver for tm2-touchkey with + LED control for the Exynos5433 TM2 board. + + 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 000..e927d06 --- /dev/null +++ b/drivers/input/keyboard/tm2-touchkey.c @@ -0,0 +1,287 @@ +/* + * TM2 touchkey device driver + * + * Copyright 2005 Phil Blundell + * Copyright 2016 Samsung Electronics Co., Ltd. + * + * Author: Beomho Seo + * Author: Jaechul Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define TM2_TOUCHKEY_DEV_NAME "tm2-touchkey" +#define TM2_TOUCHKEY_KEYCODE_REG 0x03 +#define TM2_TOUCHKEY_BASE_REG 0x00 +#define TM2_TOUCHKEY_CMD_LED_ON0x10 +#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 250 +#define TM2_TOUCHKEY_LED_VOLTAGE_MAX 330 + +enum { + TM2_TOUCHKEY_KEY_MENU = 0x1, + TM2_TOUCHKEY_KEY_BACK, +}; + +enum { + TM2_TOUCHKEY_SUPPLIES_VCC, + TM2_TOUCHKEY_SUPPLIES_VDD, +}; + +struct tm2_touchkey_data { + struct i2c_client *client; + struct input_dev *input_dev; + struct led_classdev led_dev; + struct regulator_bulk_data regulators[2]; + + u8 keycode_type; + u8 pressed; +}; + +static void tm2_touchkey_led_brightness_set(struct led_classdev *led_dev, + enum led_brightness brightness) +{ + struct tm2_touchkey_data *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( + touchkey->regulators[TM2_TOUCHKEY_SUPPLIES_VDD].consumer, + volt, volt); + i2c_smbus_write_byte_data(touchkey->client, + TM2_TOUCHKEY_BASE_REG, data); +} + +static int tm2_touchkey_power_enable(struct tm2_touchkey_data *touchkey) +{ + int ret = 0; + + ret = regulator_bulk_enable(ARRAY_SIZE(touchkey->regulators), + touchkey->regulators); + if (ret) + return ret; + + /* waiting for device initialization, at least 150ms */ +
[PATCH v6 0/3] Add touch key driver support for TM2
Hi, This patch is last three patch from https://lkml.org/lkml/2017/1/6/277. because 1 and 2 patches have already been merged by Krzysztof. 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. Best Regard, Jaechul Changes in v6: - changed compatible name from samsaung to cypress. - updated commit tags. - removed first two patches from the original patchset. Changes in v5: - patch 1: removed a spurious regulator-always-off inherited from a different patch. Thanks Krzysztof. - patch 2: fixed a slip on the model, thanks Javier (this patch confuses me quite a lot, this was all right some patches ago and re appeared on this one). - patch 2: removed 'regulator' label and used the original ldo3x labels. Krzysztof: it looks better indeed. - added Javier's reviews and Krzysztof's acks on the related patches. Changes in v4: - patch 1 has been rebased on top of 7c294e002641 (arm64: dts: exynos: Remove unsupported regulator-always-off property from TM2E) - patch 2 has been generated with -B50% diff option using git 2.11 Changes in v3: - Changed the commit ordering, the tm2-touchkey related patches are the last 3. - Added Chanwoo's patch which fixes the wrong voltage of ldo23 and ldo25. - Andi (patch 3) moves the ldo31 and ldo38 in the tm2 and tm2e files as they have different values. Changes in v2: - fixed reviews from Javier, Dmitry - refactored power enable/disable functions. - reordered signed-offs in patch 2, while patch 4 is left as it was as Andi copy pasted the node to the new tm2.dts file - added Jarvier's (patch 1,2,4) and Krzysztof's (patch 4) reviews and Rob's Ack - patch 3 diff has been generated with -B50% 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/cypress,tm2-touchkey.txt| 27 ++ arch/arm64/boot/dts/exynos/exynos5433-tm2.dts | 13 + drivers/input/keyboard/Kconfig | 11 + drivers/input/keyboard/Makefile| 1 + drivers/input/keyboard/tm2-touchkey.c | 287 + 5 files changed, 339 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/cypress,tm2-touchkey.txt create mode 100644 drivers/input/keyboard/tm2-touchkey.c -- 2.7.4
[PATCH v6 3/3] arm64: dts: exynos: Add tm2 touchkey node
Add DT node support for TM2 touchkey device. Signed-off-by: Beomho Seo Signed-off-by: Jaechul Lee Signed-off-by: Andi Shyti Reviewed-by: Javier Martinez Canillas --- arch/arm64/boot/dts/exynos/exynos5433-tm2.dts | 13 + 1 file changed, 13 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts b/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts index 2449266..ddba2f8 100644 --- a/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts +++ b/arch/arm64/boot/dts/exynos/exynos5433-tm2.dts @@ -18,6 +18,19 @@ compatible = "samsung,tm2", "samsung,exynos5433"; }; +&hsi2c_9 { + status = "okay"; + + touchkey@20 { + compatible = "cypress,tm2-touchkey"; + reg = <0x20>; + interrupt-parent = <&gpa3>; + interrupts = <2 IRQ_TYPE_EDGE_FALLING>; + vcc-supply = <&ldo32_reg>; + vdd-supply = <&ldo33_reg>; + }; +}; + &ldo31_reg { regulator-name = "TSP_VDD_1.85V_AP"; regulator-min-microvolt = <185>; -- 2.7.4
[PATCH 0/4] Add touch key driver support for TM2
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
[PATCH 2/4] input: tm2-touchkey: Add touchkey driver support for TM2
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 Signed-off-by: Beomho Seo --- 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 000..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 + * Author: Jaechul Lee + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define TM2_TOUCHKEY_DEV_NAME "tm2-touchkey" +#define TM2_TOUCHKEY_KEYCODE_REG 0x03 +#define TM2_TOUCHKEY_BASE_REG 0x00 +#define TM2_TOUCHKEY_CMD_LED_ON0x10 +#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 250 +#define TM2_TOUCHKEY_LED_VOLTAGE_MAX 330 + +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 + *samsun
[PATCH 3/4] arm64: dts: exynos: make tm2 and tm2e independent from each other
From: Andi Shyti 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 Signed-off-by: Jaechul Lee --- .../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 000..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 +#include +#include +#include + +/ { + 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@2000 { + device_type = "memory"; + reg = <0x0 0x2000 0x0 0xc000>; + }; + + gpio-keys { + compatible = "gpio-keys"; + + power-key { + gpios = <&gpa2 7 GPIO_ACTIVE_LOW>; + linux,code = ; + label = "power key"; + debounce-interval = <10>; + }; + + volume-up-key { + gpios = <&gpa2 0 GPIO_ACTIVE_LOW>; + linux,code = ; + label = "volume-up key"; + debounce-interval = <10>; + }; + + volume-down-key { + gpios = <&gpa2 1 GPIO_ACTIVE_LOW>; + linux,code = ; + label = "volume-down key"; + debounce-interval = <10>; + }; + + homepage-key { + gpios = <&gpa0 3 GPIO_ACTIVE_LOW>; + linux,code = ; + 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 =
[PATCH 4/4] arm64: dts: exynos: Add tm2 touchkey node
Add DT node support for TM2 touchkey device. Signed-off-by: Jaechul Lee Signed-off-by: Beomho Seo Signed-off-by: Andi Shyti --- 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
[PATCH 1/4] input: Add support for the tm2 touchkey device driver
This patch adds the binding description of the tm2 touchkey device driver. Signed-off-by: Jaechul Lee --- .../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 000..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
Re: [PATCH] Input: tm2-touchkey - use LEN_ON as boolean value instead of LED_FULL
Hello, There is a typing error at the subject.(LEN_ON->LED_ON) Anyway, your patch is working well and looks good to me. I reviewed and tested with this patch on TM2. Reviewed-by: Jaechul Lee Tested-by: Jaechul Lee Best Regards, Jaechul Lee On Mon, Mar 27, 2017 at 10:29:05PM +0900, Andi Shyti wrote: > Commit 4e552c8cb5bc ("leds: add LED_ON brightness as boolean value") > has introduced the LED_ON enumeration value that can be used > instead of LED_FULL which has more of a linear value. > > Because the tm2-touchscreen doesn't have brightness levels, but > it's a simple on/off led, use LED_ON instead of LED_FULL. > > Signed-off-by: Andi Shyti > --- > drivers/input/keyboard/tm2-touchkey.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/input/keyboard/tm2-touchkey.c > b/drivers/input/keyboard/tm2-touchkey.c > index 485900f953e0..abc266e40e17 100644 > --- a/drivers/input/keyboard/tm2-touchkey.c > +++ b/drivers/input/keyboard/tm2-touchkey.c > @@ -213,7 +213,7 @@ static int tm2_touchkey_probe(struct i2c_client *client, > /* led device */ > touchkey->led_dev.name = TM2_TOUCHKEY_DEV_NAME; > touchkey->led_dev.brightness = LED_FULL; > - touchkey->led_dev.max_brightness = LED_FULL; > + touchkey->led_dev.max_brightness = LED_ON; > touchkey->led_dev.brightness_set = tm2_touchkey_led_brightness_set; > > error = devm_led_classdev_register(&client->dev, &touchkey->led_dev); > -- > 2.11.0 >
[PATCH] ASoC: samsung: i2s: Supported high resolution rates
This driver can support more frequencies over 96KHz. There are no reasons to limit the frequency range below 96KHz. If codecs/amps or something else can't support high resolution rates, the constraints would be set rates properly because each drivers have its own limits. Signed-off-by: Jaechul Lee --- sound/soc/samsung/i2s.c | 19 +++ 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index af3ba4d4ccc5..fc34af6a2c1e 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -50,6 +50,7 @@ struct samsung_i2s_variant_regs { struct samsung_i2s_dai_data { u32 quirks; + unsigned int rates; const struct samsung_i2s_variant_regs *i2s_variant_regs; }; @@ -1076,20 +1077,25 @@ static const struct snd_soc_component_driver samsung_i2s_component = { .name = "samsung-i2s", }; -#define SAMSUNG_I2S_RATES SNDRV_PCM_RATE_8000_96000 - #define SAMSUNG_I2S_FMTS (SNDRV_PCM_FMTBIT_S8 | \ SNDRV_PCM_FMTBIT_S16_LE | \ SNDRV_PCM_FMTBIT_S24_LE) static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec) { + const struct samsung_i2s_dai_data *i2s_dai_data; struct i2s_dai *i2s; i2s = devm_kzalloc(&pdev->dev, sizeof(struct i2s_dai), GFP_KERNEL); if (i2s == NULL) return NULL; + if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) + i2s_dai_data = of_device_get_match_data(&pdev->dev); + else + i2s_dai_data = (struct samsung_i2s_dai_data *) + platform_get_device_id(pdev)->driver_data; + i2s->pdev = pdev; i2s->pri_dai = NULL; i2s->sec_dai = NULL; @@ -1101,13 +1107,13 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec) i2s->i2s_dai_drv.resume = i2s_resume; i2s->i2s_dai_drv.playback.channels_min = 1; i2s->i2s_dai_drv.playback.channels_max = 2; - i2s->i2s_dai_drv.playback.rates = SAMSUNG_I2S_RATES; + i2s->i2s_dai_drv.playback.rates = i2s_dai_data->rates; i2s->i2s_dai_drv.playback.formats = SAMSUNG_I2S_FMTS; if (!sec) { i2s->i2s_dai_drv.capture.channels_min = 1; i2s->i2s_dai_drv.capture.channels_max = 2; - i2s->i2s_dai_drv.capture.rates = SAMSUNG_I2S_RATES; + i2s->i2s_dai_drv.capture.rates = i2s_dai_data->rates; i2s->i2s_dai_drv.capture.formats = SAMSUNG_I2S_FMTS; } return i2s; @@ -1452,29 +1458,34 @@ static const struct samsung_i2s_variant_regs i2sv5_i2s1_regs = { static const struct samsung_i2s_dai_data i2sv3_dai_type = { .quirks = QUIRK_NO_MUXPSR, + .rates = SNDRV_PCM_RATE_8000_96000, .i2s_variant_regs = &i2sv3_regs, }; static const struct samsung_i2s_dai_data i2sv5_dai_type = { .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI | QUIRK_NEED_RSTCLR | QUIRK_SUPPORTS_IDMA, + .rates = SNDRV_PCM_RATE_8000_96000, .i2s_variant_regs = &i2sv3_regs, }; static const struct samsung_i2s_dai_data i2sv6_dai_type = { .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI | QUIRK_NEED_RSTCLR | QUIRK_SUPPORTS_TDM | QUIRK_SUPPORTS_IDMA, + .rates = SNDRV_PCM_RATE_8000_96000, .i2s_variant_regs = &i2sv6_regs, }; static const struct samsung_i2s_dai_data i2sv7_dai_type = { .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI | QUIRK_NEED_RSTCLR | QUIRK_SUPPORTS_TDM, + .rates = SNDRV_PCM_RATE_8000_192000, .i2s_variant_regs = &i2sv7_regs, }; static const struct samsung_i2s_dai_data i2sv5_dai_type_i2s1 = { .quirks = QUIRK_PRI_6CHAN | QUIRK_NEED_RSTCLR, + .rates = SNDRV_PCM_RATE_8000_96000, .i2s_variant_regs = &i2sv5_i2s1_regs, }; -- 2.11.0
[PATCH v2] ASoC: samsung: i2s: Support more resolution rates
This driver can support more frequencies over 96KHz. There are no reasons to limit the frequency range below 96KHz. If codecs/amps or something else can't support higher resolution rates, the constraints would be set rates properly because each drivers have its own limits. I added the 'pcm_rates' field to the dai_data to be set rates by the compatibilities. As a result, rates will be set each devices respectively. For example of exynos5433, rates will be set from 8KHz to 192KHz. Signed-off-by: Jaechul Lee --- v2: - changed the name of variable to pcm_rates. - removed duplicated code. - modified commit message. --- sound/soc/samsung/i2s.c | 20 +--- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index af3ba4d4ccc5..c9f87f7bae99 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -50,6 +50,7 @@ struct samsung_i2s_variant_regs { struct samsung_i2s_dai_data { u32 quirks; + unsigned int pcm_rates; const struct samsung_i2s_variant_regs *i2s_variant_regs; }; @@ -1076,13 +1077,13 @@ static const struct snd_soc_component_driver samsung_i2s_component = { .name = "samsung-i2s", }; -#define SAMSUNG_I2S_RATES SNDRV_PCM_RATE_8000_96000 - #define SAMSUNG_I2S_FMTS (SNDRV_PCM_FMTBIT_S8 | \ SNDRV_PCM_FMTBIT_S16_LE | \ SNDRV_PCM_FMTBIT_S24_LE) -static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec) +static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, + const struct samsung_i2s_dai_data *i2s_dai_data, + bool sec) { struct i2s_dai *i2s; @@ -1101,13 +1102,13 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec) i2s->i2s_dai_drv.resume = i2s_resume; i2s->i2s_dai_drv.playback.channels_min = 1; i2s->i2s_dai_drv.playback.channels_max = 2; - i2s->i2s_dai_drv.playback.rates = SAMSUNG_I2S_RATES; + i2s->i2s_dai_drv.playback.rates = i2s_dai_data->pcm_rates; i2s->i2s_dai_drv.playback.formats = SAMSUNG_I2S_FMTS; if (!sec) { i2s->i2s_dai_drv.capture.channels_min = 1; i2s->i2s_dai_drv.capture.channels_max = 2; - i2s->i2s_dai_drv.capture.rates = SAMSUNG_I2S_RATES; + i2s->i2s_dai_drv.capture.rates = i2s_dai_data->pcm_rates; i2s->i2s_dai_drv.capture.formats = SAMSUNG_I2S_FMTS; } return i2s; @@ -1242,7 +1243,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) i2s_dai_data = (struct samsung_i2s_dai_data *) platform_get_device_id(pdev)->driver_data; - pri_dai = i2s_alloc_dai(pdev, false); + pri_dai = i2s_alloc_dai(pdev, i2s_dai_data, false); if (!pri_dai) { dev_err(&pdev->dev, "Unable to alloc I2S_pri\n"); return -ENOMEM; @@ -1316,7 +1317,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) goto err_disable_clk; if (quirks & QUIRK_SEC_DAI) { - sec_dai = i2s_alloc_dai(pdev, true); + sec_dai = i2s_alloc_dai(pdev, i2s_dai_data, true); if (!sec_dai) { dev_err(&pdev->dev, "Unable to alloc I2S_sec\n"); ret = -ENOMEM; @@ -1452,29 +1453,34 @@ static const struct samsung_i2s_variant_regs i2sv5_i2s1_regs = { static const struct samsung_i2s_dai_data i2sv3_dai_type = { .quirks = QUIRK_NO_MUXPSR, + .pcm_rates = SNDRV_PCM_RATE_8000_96000, .i2s_variant_regs = &i2sv3_regs, }; static const struct samsung_i2s_dai_data i2sv5_dai_type = { .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI | QUIRK_NEED_RSTCLR | QUIRK_SUPPORTS_IDMA, + .pcm_rates = SNDRV_PCM_RATE_8000_96000, .i2s_variant_regs = &i2sv3_regs, }; static const struct samsung_i2s_dai_data i2sv6_dai_type = { .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI | QUIRK_NEED_RSTCLR | QUIRK_SUPPORTS_TDM | QUIRK_SUPPORTS_IDMA, + .pcm_rates = SNDRV_PCM_RATE_8000_96000, .i2s_variant_regs = &i2sv6_regs, }; static const struct samsung_i2s_dai_data i2sv7_dai_type = { .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI | QUIRK_NEED_RSTCLR | QUIRK_SUPPORTS_TDM, + .pcm_rates = SNDRV_PCM_RATE_8000_192000, .i2s_variant_regs = &i2sv7_regs, }; static const struct samsung_i2s_dai_data i2sv5_dai_type_i2s1 = { .quirks = QUIRK_PRI_6CHAN | QUIRK_NEED_RSTCLR, + .pcm_rates = SNDRV_PCM_RATE_8000_96000, .i2s_variant_regs = &i2sv5_i2s1_regs, }; -- 2.11.0
[PATCH 1/3] ASoC: samsung: i2s: Use specific name for i2s dais
Add specific dais name when components are registered. Component and dai name will follow their parent dev name, if the name isn't described. In case of this driver, each dais will have same name like '1144.i2s0' by fmt_single_name function. The problem having same name is that TM2 machine driver can't detect capture devices correctly. Machine driver doesn't know which one is proper to use for cpu dai. The driver just selects to use 'samsung-i2c-sec' that doesn't have capture functionality because the component of samsung-i2s-sec is located in the first of the component_list. I add dai name like 'samsung-i2s', 'samsung-i2s-sec' for each dais. The reason why adding dai id to 1 is that it doesn't allow to use particular dai name in case of when I use 0 for dai id. Signed-off-by: Jaechul Lee --- sound/soc/samsung/i2s.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index af3ba4d4ccc5..9cdd36b9711c 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -1076,6 +1076,8 @@ static const struct snd_soc_component_driver samsung_i2s_component = { .name = "samsung-i2s", }; +#define SAMSUNG_I2S_DAI"samsung-i2s" +#define SAMSUNG_I2S_DAI_SEC"samsung-i2s-sec" #define SAMSUNG_I2S_RATES SNDRV_PCM_RATE_8000_96000 #define SAMSUNG_I2S_FMTS (SNDRV_PCM_FMTBIT_S8 | \ @@ -1093,6 +1095,7 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec) i2s->pdev = pdev; i2s->pri_dai = NULL; i2s->sec_dai = NULL; + i2s->i2s_dai_drv.id = 1; i2s->i2s_dai_drv.symmetric_rates = 1; i2s->i2s_dai_drv.probe = samsung_i2s_dai_probe; i2s->i2s_dai_drv.remove = samsung_i2s_dai_remove; @@ -1105,10 +1108,13 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec) i2s->i2s_dai_drv.playback.formats = SAMSUNG_I2S_FMTS; if (!sec) { + i2s->i2s_dai_drv.name = SAMSUNG_I2S_DAI; i2s->i2s_dai_drv.capture.channels_min = 1; i2s->i2s_dai_drv.capture.channels_max = 2; i2s->i2s_dai_drv.capture.rates = SAMSUNG_I2S_RATES; i2s->i2s_dai_drv.capture.formats = SAMSUNG_I2S_FMTS; + } else { + i2s->i2s_dai_drv.name = SAMSUNG_I2S_DAI_SEC; } return i2s; } -- 2.14.1
[PATCH 3/3] ASoC: samsung: Fix invalid argument when devm_gpiod_get is called
devm_gpiod_get is called with GPIOF_OUT_INIT_LOW but the function doesn't allow the parameters. Unluckily, GPIOF_OUT_INIT_LOW is same value as GPIOD_IN so it works like input gpio. Muted stream comes up when I try recording some sounds on TM2. mic-bias gpiod state can't be changed because the gpiod is created with the invalid parameter. The gpio should be set GPIOD_OUT_HIGH. Fixes: 1bfbc260a5b4 ("ASoC: samsung: Add machine driver for Exynos5433 based TM2 board") Signed-off-by: Jaechul Lee --- sound/soc/samsung/tm2_wm5110.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/soc/samsung/tm2_wm5110.c b/sound/soc/samsung/tm2_wm5110.c index f467ad06e827..76abe45ed537 100644 --- a/sound/soc/samsung/tm2_wm5110.c +++ b/sound/soc/samsung/tm2_wm5110.c @@ -439,8 +439,7 @@ static int tm2_probe(struct platform_device *pdev) snd_soc_card_set_drvdata(card, priv); card->dev = dev; - priv->gpio_mic_bias = devm_gpiod_get(dev, "mic-bias", - GPIOF_OUT_INIT_LOW); + priv->gpio_mic_bias = devm_gpiod_get(dev, "mic-bias", GPIOD_OUT_HIGH); if (IS_ERR(priv->gpio_mic_bias)) { dev_err(dev, "Failed to get mic bias gpio\n"); return PTR_ERR(priv->gpio_mic_bias); -- 2.14.1
[PATCH 2/3] ASoC: samsung: Use 'samsung-i2s' cpu_dai for dai_links
Add specific cpu_dai_name to dai_link because samsung i2s driver registers two dais and components. Selecting one of them clearly is needed more information like cpu_dai_name, of_node. The reason why the dai_links have to use 'samsung-i2s' for cpu_dai is that 'samsung-i2s-sec' doesn't have a capture functionality. Without this code, cpu_dai will be selected the first one of the component_list. For example, if I describe nothing to cpu_dai_name, 'samsung-i2s-sec' might be selected to HiFi Primay. Signed-off-by: Jaechul Lee --- sound/soc/samsung/tm2_wm5110.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/samsung/tm2_wm5110.c b/sound/soc/samsung/tm2_wm5110.c index 24cc9d63ce87..f467ad06e827 100644 --- a/sound/soc/samsung/tm2_wm5110.c +++ b/sound/soc/samsung/tm2_wm5110.c @@ -383,6 +383,7 @@ static struct snd_soc_dai_link tm2_dai_links[] = { { .name = "WM5110 AIF1", .stream_name= "HiFi Primary", + .cpu_dai_name = "samsung-i2s", .codec_dai_name = "wm5110-aif1", .ops= &tm2_aif1_ops, .dai_fmt= SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | @@ -390,6 +391,7 @@ static struct snd_soc_dai_link tm2_dai_links[] = { }, { .name = "WM5110 Voice", .stream_name= "Voice call", + .cpu_dai_name = "samsung-i2s", .codec_dai_name = "wm5110-aif2", .ops= &tm2_aif2_ops, .dai_fmt= SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | @@ -398,6 +400,7 @@ static struct snd_soc_dai_link tm2_dai_links[] = { }, { .name = "WM5110 BT", .stream_name= "Bluetooth", + .cpu_dai_name = "samsung-i2s", .codec_dai_name = "wm5110-aif3", .dai_fmt= SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM, @@ -477,7 +480,6 @@ static int tm2_probe(struct platform_device *pdev) } for (i = 0; i < card->num_links; i++) { - card->dai_link[i].cpu_dai_name = NULL; card->dai_link[i].cpu_name = NULL; card->dai_link[i].platform_name = NULL; card->dai_link[i].codec_of_node = codec_dai_node; -- 2.14.1
[PATCH 0/3] Fix capture devices functionality on TM2
Hello, This patchset makes capture functionality working on TM2. Capture devices can't be detected because I2S doesn't have appropriate dai name. Therefore, TM2 will select unexpected cpu dai which is named "i2s-samsung-sec" that doesn't have a capture functionality. In samsung I2S driver, it tries to register two components without specific name. The driver finally has components having same name: dai name as well. As a result, dai_link doesn't have enough information to select cpu_dai properly. Jaechul Lee (3): ASoC: samsung: i2s: Use specific name for i2s dais ASoC: samsung: Use 'samsung-i2s' cpu_dai for dai_links ASoC: samsung: Fix invalid argument when devm_gpiod_get is called sound/soc/samsung/i2s.c| 6 ++ sound/soc/samsung/tm2_wm5110.c | 7 --- 2 files changed, 10 insertions(+), 3 deletions(-) -- 2.14.1
[PATCH v2 0/3] Fix capture devices functionality on TM2
Hello, This patchset makes capture functionality working on TM2. Capture devices can't be detected because I2S doesn't have appropriate dai name. Therefore, TM2 will select unexpected cpu dai which is named "i2s-samsung-sec" that doesn't have a capture functionality. In samsung I2S driver, it tries to register two components without specific name. The driver finally has components having same name: dai name as well. As a result, dai_link doesn't have enough information to select cpu_dai properly. Changes in v2: - defined SAMSUNG_I2S_DAI_* in i2s.h and removed duplicated code - modified commit message about invalid parameter that Krzystof mentioned - rebased code because of conflicts in i2s.c Jaechul Lee (3): ASoC: samsung: i2s: Use specific name for i2s dais ASoC: samsung: Use 'samsung-i2s' cpu_dai for dai_links ASoC: samsung: Fix invalid argument when devm_gpiod_get is called sound/soc/samsung/i2s.c| 4 sound/soc/samsung/i2s.h| 3 +++ sound/soc/samsung/tm2_wm5110.c | 7 --- 3 files changed, 11 insertions(+), 3 deletions(-) -- 2.14.1
[PATCH v2 3/3] ASoC: samsung: Fix invalid argument when devm_gpiod_get is called
devm_gpiod_get is called with GPIOF_OUT_INIT_LOW but the function doesn't allow the parameters. Unluckily, GPIOF_OUT_INIT_LOW is same value as GPIOD_ASIS and gpio direction isn't set properly. Muted stream comes up when I try recording some sounds on TM2. mic-bias gpiod state can't be changed because the gpiod is created with the invalid parameter. The gpio should be set GPIOD_OUT_HIGH. Fixes: 1bfbc260a5b4 ("ASoC: samsung: Add machine driver for Exynos5433 based TM2 board") Signed-off-by: Jaechul Lee --- sound/soc/samsung/tm2_wm5110.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/soc/samsung/tm2_wm5110.c b/sound/soc/samsung/tm2_wm5110.c index 710e2151141f..a55d18703fe7 100644 --- a/sound/soc/samsung/tm2_wm5110.c +++ b/sound/soc/samsung/tm2_wm5110.c @@ -439,8 +439,7 @@ static int tm2_probe(struct platform_device *pdev) snd_soc_card_set_drvdata(card, priv); card->dev = dev; - priv->gpio_mic_bias = devm_gpiod_get(dev, "mic-bias", - GPIOF_OUT_INIT_LOW); + priv->gpio_mic_bias = devm_gpiod_get(dev, "mic-bias", GPIOD_OUT_HIGH); if (IS_ERR(priv->gpio_mic_bias)) { dev_err(dev, "Failed to get mic bias gpio\n"); return PTR_ERR(priv->gpio_mic_bias); -- 2.14.1
[PATCH v2 2/3] ASoC: samsung: Use 'samsung-i2s' cpu_dai for dai_links
Add specific cpu_dai_name to dai_link because samsung i2s driver registers two dais and components. Selecting one of them clearly is needed more information like cpu_dai_name, of_node. The reason why the dai_links have to use 'samsung-i2s' for cpu_dai is that 'samsung-i2s-sec' doesn't have a capture functionality. Without this code, cpu_dai will be selected the first one of the component_list. For example, if I describe nothing to cpu_dai_name, 'samsung-i2s-sec' might be selected to HiFi Primay. Signed-off-by: Jaechul Lee --- sound/soc/samsung/tm2_wm5110.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/samsung/tm2_wm5110.c b/sound/soc/samsung/tm2_wm5110.c index 68698f3d72f9..710e2151141f 100644 --- a/sound/soc/samsung/tm2_wm5110.c +++ b/sound/soc/samsung/tm2_wm5110.c @@ -383,6 +383,7 @@ static struct snd_soc_dai_link tm2_dai_links[] = { { .name = "WM5110 AIF1", .stream_name= "HiFi Primary", + .cpu_dai_name = SAMSUNG_I2S_DAI, .codec_dai_name = "wm5110-aif1", .ops= &tm2_aif1_ops, .dai_fmt= SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | @@ -390,6 +391,7 @@ static struct snd_soc_dai_link tm2_dai_links[] = { }, { .name = "WM5110 Voice", .stream_name= "Voice call", + .cpu_dai_name = SAMSUNG_I2S_DAI, .codec_dai_name = "wm5110-aif2", .ops= &tm2_aif2_ops, .dai_fmt= SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | @@ -398,6 +400,7 @@ static struct snd_soc_dai_link tm2_dai_links[] = { }, { .name = "WM5110 BT", .stream_name= "Bluetooth", + .cpu_dai_name = SAMSUNG_I2S_DAI, .codec_dai_name = "wm5110-aif3", .dai_fmt= SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM, @@ -477,7 +480,6 @@ static int tm2_probe(struct platform_device *pdev) } for (i = 0; i < card->num_links; i++) { - card->dai_link[i].cpu_dai_name = NULL; card->dai_link[i].cpu_name = NULL; card->dai_link[i].platform_name = NULL; card->dai_link[i].codec_of_node = codec_dai_node; -- 2.14.1
[PATCH v2 1/3] ASoC: samsung: i2s: Use specific name for i2s dais
Add specific dais name when components are registered. Component and dai name will follow their parent dev name, if the name isn't described. In case of this driver, each dais will have same name like '1144.i2s0' by fmt_single_name function. The problem having same name is that TM2 machine driver can't detect capture devices correctly. Machine driver doesn't know which one is proper to use for cpu dai. The driver just selects to use 'samsung-i2c-sec' that doesn't have capture functionality because the component of samsung-i2s-sec is located in the first of the component_list. I add dai name like 'samsung-i2s', 'samsung-i2s-sec' for each dais. The reason why adding dai id to 1 is that it doesn't allow to use particular dai name in case of when I use 0 for dai id. Signed-off-by: Jaechul Lee --- sound/soc/samsung/i2s.c | 4 sound/soc/samsung/i2s.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 10a4da06c0a1..3aa2e7d54ea9 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -1096,6 +1096,7 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, i2s->pdev = pdev; i2s->pri_dai = NULL; i2s->sec_dai = NULL; + i2s->i2s_dai_drv.id = 1; i2s->i2s_dai_drv.symmetric_rates = 1; i2s->i2s_dai_drv.probe = samsung_i2s_dai_probe; i2s->i2s_dai_drv.remove = samsung_i2s_dai_remove; @@ -1108,10 +1109,13 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, i2s->i2s_dai_drv.playback.formats = SAMSUNG_I2S_FMTS; if (!sec) { + i2s->i2s_dai_drv.name = SAMSUNG_I2S_DAI; i2s->i2s_dai_drv.capture.channels_min = 1; i2s->i2s_dai_drv.capture.channels_max = 2; i2s->i2s_dai_drv.capture.rates = i2s_dai_data->pcm_rates; i2s->i2s_dai_drv.capture.formats = SAMSUNG_I2S_FMTS; + } else { + i2s->i2s_dai_drv.name = SAMSUNG_I2S_DAI_SEC; } return i2s; } diff --git a/sound/soc/samsung/i2s.h b/sound/soc/samsung/i2s.h index 21ff24e930db..79781de2f247 100644 --- a/sound/soc/samsung/i2s.h +++ b/sound/soc/samsung/i2s.h @@ -13,6 +13,9 @@ #ifndef __SND_SOC_SAMSUNG_I2S_H #define __SND_SOC_SAMSUNG_I2S_H +#define SAMSUNG_I2S_DAI"samsung-i2s" +#define SAMSUNG_I2S_DAI_SEC"samsung-i2s-sec" + #define SAMSUNG_I2S_DIV_BCLK 1 #define SAMSUNG_I2S_RCLKSRC_0 0 -- 2.14.1