linux-samsung-espresso3g: Various fixes and improvements (MR 2789)

linux-samsung-espresso3g: Add support for gp2a light and proximity sensor

linux-samsung-espresso3g: Display now runs at 45Hz

linux-samsung-espresso3g: Add pinmux for wlan host wake

linux-samsung-espresso3g: Add TWL 6030 power off support

linux-samsung-espresso3g: Add TWL 6030 power button support

linux-samsung-espresso3g: Data Enable is active high

linux-samsung-espresso3g: Fix patch
This commit is contained in:
Mighty 2021-12-26 19:23:36 +05:30 committed by Bart Ribbers
parent b5c970e13e
commit 084076cab9
No known key found for this signature in database
GPG key ID: 0BF4C1B5988C50D8
5 changed files with 524 additions and 15 deletions

View file

@ -1,5 +1,5 @@
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 7e0934180724..cdf76c6cd05c 100644 index 7e0934180..cdf76c6cd 100644
--- a/arch/arm/boot/dts/Makefile --- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile
@@ -880,6 +880,7 @@ dtb-$(CONFIG_ARCH_OMAP4) += \ @@ -880,6 +880,7 @@ dtb-$(CONFIG_ARCH_OMAP4) += \
@ -12,10 +12,10 @@ index 7e0934180724..cdf76c6cd05c 100644
omap4-var-dvk-om44.dtb \ omap4-var-dvk-om44.dtb \
diff --git a/arch/arm/boot/dts/omap4-samsung-espresso3g.dts b/arch/arm/boot/dts/omap4-samsung-espresso3g.dts diff --git a/arch/arm/boot/dts/omap4-samsung-espresso3g.dts b/arch/arm/boot/dts/omap4-samsung-espresso3g.dts
new file mode 100644 new file mode 100644
index 000000000000..6a75c72d8f72 index 000000000..4dbc096ee
--- /dev/null --- /dev/null
+++ b/arch/arm/boot/dts/omap4-samsung-espresso3g.dts +++ b/arch/arm/boot/dts/omap4-samsung-espresso3g.dts
@@ -0,0 +1,584 @@ @@ -0,0 +1,632 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT) +// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/dts-v1/; +/dts-v1/;
+#include "dt-bindings/gpio/gpio.h" +#include "dt-bindings/gpio/gpio.h"
@ -223,7 +223,7 @@ index 000000000000..6a75c72d8f72
+ backlight = <&backlight>; + backlight = <&backlight>;
+ +
+ panel-timing { + panel-timing {
+ clock-frequency = <28444445>; + clock-frequency = <42666667>;
+ +
+ hback-porch = <210>; + hback-porch = <210>;
+ hactive = <1024>; + hactive = <1024>;
@ -237,7 +237,7 @@ index 000000000000..6a75c72d8f72
+ +
+ hsync-active = <0>; + hsync-active = <0>;
+ vsync-active = <0>; + vsync-active = <0>;
+ de-active = <0>; + de-active = <1>;
+ pixelclk-active = <0>; + pixelclk-active = <0>;
+ }; + };
+ +
@ -254,6 +254,14 @@ index 000000000000..6a75c72d8f72
+ pinctrl-names = "default"; + pinctrl-names = "default";
+ pinctrl-0 = <&vibrator_default>; + pinctrl-0 = <&vibrator_default>;
+ }; + };
+
+ gp2a_shunt: current-sense-shunt {
+ compatible = "current-sense-shunt";
+ io-channels = <&gpadc 4>;
+ shunt-resistor-micro-ohms = <47000000>; /* 47 ohms */
+ #io-channel-cells = <0>;
+ io-channel-ranges;
+ };
+}; +};
+ +
+&omap4_pmx_wkup { +&omap4_pmx_wkup {
@ -262,6 +270,12 @@ index 000000000000..6a75c72d8f72
+ OMAP4_IOPAD(0x56, PIN_OUTPUT_PULLUP | MUX_MODE2) /* fref_clk3_req.sys_drm_msecure */ + OMAP4_IOPAD(0x56, PIN_OUTPUT_PULLUP | MUX_MODE2) /* fref_clk3_req.sys_drm_msecure */
+ >; + >;
+ }; + };
+
+ prox_irq: pinmux_prox_irq {
+ pinctrl-single,pins = <
+ OMAP4_IOPAD(0x042, WAKEUP_EN | PIN_INPUT_PULLUP | MUX_MODE3)
+ >;
+ };
+}; +};
+ +
+&omap4_pmx_core { +&omap4_pmx_core {
@ -421,6 +435,12 @@ index 000000000000..6a75c72d8f72
+ >; + >;
+ }; + };
+ +
+ wlan_host_wake: pinmux_wlan_host_wake {
+ pinctrl-single,pins = <
+ OMAP4_IOPAD(0x0bc, WAKEUP_EN | PIN_INPUT | MUX_MODE3)
+ >;
+ };
+
+ touch_pins: pinmux_touch_pins { + touch_pins: pinmux_touch_pins {
+ pinctrl-single,pins = < + pinctrl-single,pins = <
+ OMAP4_IOPAD(0x06c, PIN_INPUT | MUX_MODE3) + OMAP4_IOPAD(0x06c, PIN_INPUT | MUX_MODE3)
@ -432,6 +452,12 @@ index 000000000000..6a75c72d8f72
+ OMAP4_IOPAD(0x05c, PIN_INPUT_PULLDOWN | MUX_MODE3) + OMAP4_IOPAD(0x05c, PIN_INPUT_PULLDOWN | MUX_MODE3)
+ >; + >;
+ }; + };
+
+ gp2a_irq: pinmux_gp2a_irq {
+ pinctrl-single,pins = <
+ OMAP4_IOPAD(0x052, WAKEUP_EN | PIN_INPUT | MUX_MODE3)
+ >;
+ };
+}; +};
+ +
+&i2c1 { +&i2c1 {
@ -454,6 +480,11 @@ index 000000000000..6a75c72d8f72
+ /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */ + /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
+ interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>; /* IRQ_SYS_1N cascaded to gic */ + interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>; /* IRQ_SYS_1N cascaded to gic */
+ interrupt-parent = <&gic>; + interrupt-parent = <&gic>;
+
+ twl_power: power {
+ compatible = "ti,twl6030-power";
+ ti,system-power-controller;
+ };
+ }; + };
+}; +};
+ +
@ -489,8 +520,8 @@ index 000000000000..6a75c72d8f72
+ accelerometer@18 { + accelerometer@18 {
+ compatible = "bosch,bma254"; + compatible = "bosch,bma254";
+ reg = <0x18>; + reg = <0x18>;
+ vdd-supply = <&ldo5>; + vdd-supply = <&vaux2>;
+ vddio-supply = <&vaux2>; + vddio-supply = <&ldo5>;
+ interrupt-parent = <&gpio4>; + interrupt-parent = <&gpio4>;
+ interrupts = <25 (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_EDGE_RISING)> , <26 (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_EDGE_RISING)>; + interrupts = <25 (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_EDGE_RISING)> , <26 (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_EDGE_RISING)>;
+ mount-matrix = "-1", "0", "0", + mount-matrix = "-1", "0", "0",
@ -501,11 +532,26 @@ index 000000000000..6a75c72d8f72
+ magnetometer@2e { + magnetometer@2e {
+ compatible = "yamaha,yas530"; + compatible = "yamaha,yas530";
+ reg = <0x2e>; + reg = <0x2e>;
+ vdd-supply = <&ldo5>; + vdd-supply = <&vaux2>;
+ iovdd-supply = <&vaux2>; + iovdd-supply = <&ldo5>;
+ reset-gpios = <&gpio5 29 GPIO_ACTIVE_LOW>; + reset-gpios = <&gpio5 29 GPIO_ACTIVE_LOW>;
+ interrupts = <&gpio6 10 IRQ_TYPE_EDGE_RISING>; + interrupts = <&gpio6 10 IRQ_TYPE_EDGE_RISING>;
+ }; + };
+
+ light-sensor@44 {
+ compatible = "sharp,gp2ap002a00f";
+ reg = <0x44>;
+ interrupt-parent = <&gpio1>;
+ interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
+ vdd-supply = <&vaux2>;
+ vio-supply = <&vaux2>;
+ io-channels = <&gp2a_shunt>;
+ io-channel-names = "alsout";
+ sharp,proximity-far-hysteresis = /bits/ 8 <0x40>;
+ sharp,proximity-close-hysteresis = /bits/ 8 <0x20>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&gp2a_irq &prox_irq>;
+ };
+}; +};
+ +
+&dss { +&dss {
@ -581,6 +627,8 @@ index 000000000000..6a75c72d8f72
+ interrupt-parent = <&gpio3>; + interrupt-parent = <&gpio3>;
+ interrupts = <17 IRQ_TYPE_LEVEL_HIGH>; + interrupts = <17 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-names = "host-wake"; + interrupt-names = "host-wake";
+ pinctrl-names = "default";
+ pinctrl-0 = <&wlan_host_wake>;
+ }; + };
+}; +};
+ +
@ -602,7 +650,7 @@ index 000000000000..6a75c72d8f72
+}; +};
diff --git a/arch/arm/boot/dts/twl6032.dtsi b/arch/arm/boot/dts/twl6032.dtsi diff --git a/arch/arm/boot/dts/twl6032.dtsi b/arch/arm/boot/dts/twl6032.dtsi
new file mode 100644 new file mode 100644
index 000000000000..f7b371179e44 index 000000000..f7b371179
--- /dev/null --- /dev/null
+++ b/arch/arm/boot/dts/twl6032.dtsi +++ b/arch/arm/boot/dts/twl6032.dtsi
@@ -0,0 +1,88 @@ @@ -0,0 +1,88 @@

View file

@ -0,0 +1,213 @@
diff --git a/Documentation/devicetree/bindings/mfd/twl6030-power.txt b/Documentation/devicetree/bindings/mfd/twl6030-power.txt
new file mode 100644
index 000000000..a78f0f842
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/twl6030-power.txt
@@ -0,0 +1,32 @@
+
+Texas Instruments TWL family (twl6030) reset and power management module
+
+For now, the binding only supports the complete shutdown of the system after
+poweroff.
+
+Required properties:
+- compatible : must be
+ "ti,twl6030-power"
+
+Optional properties:
+
+- ti,system-power-controller: This indicates that TWL6030 is the
+ power supply master of the system. With this flag, the chip will
+ initiate an ACTIVE-to-OFF or SLEEP-to-OFF transition when the
+ system poweroffs.
+
+Example:
+&i2c1 {
+ clock-frequency = <2600000>;
+
+ twl: twl@48 {
+ reg = <0x48>;
+ interrupts = <7>; /* SYS_NIRQ cascaded to intc */
+ interrupt-parent = <&intc>;
+
+ twl_power: power {
+ compatible = "ti,twl6030-power";
+ ti,system-power-controller;
+ };
+ };
+};
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 02c253de9..b27ae703f 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -140,7 +140,8 @@ config ARCH_OMAP2PLUS_TYPICAL
select REGULATOR
select REGULATOR_FIXED_VOLTAGE
select TWL4030_CORE if ARCH_OMAP3 || ARCH_OMAP4
- select TWL4030_POWER if ARCH_OMAP3 || ARCH_OMAP4
+ select TWL4030_POWER if ARCH_OMAP3
+ select TWL6030_POWER if ARCH_OMAP4
select VFP
help
Compile a kernel suitable for booting most boards
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index ca0edab91..525fdf347 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1671,6 +1671,16 @@ config MFD_TWL4030_AUDIO
select MFD_CORE
default n
+config TWL6030_POWER
+ bool "TI TWL6030 power resources"
+ depends on TWL4030_CORE && ARM
+ help
+ Say yes here if you want to use the power resources on the
+ TWL6030 family chips.
+
+ When used as system power controller, this driver allows turning off
+ the main power supply.
+
config TWL6040_CORE
bool "TI TWL6040 audio codec"
depends on I2C=y
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 2ba6646e8..ccdd8efa3 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -111,6 +111,7 @@ obj-$(CONFIG_MENELAUS) += menelaus.o
obj-$(CONFIG_TWL4030_CORE) += twl-core.o twl4030-irq.o twl6030-irq.o
obj-$(CONFIG_TWL4030_POWER) += twl4030-power.o
obj-$(CONFIG_MFD_TWL4030_AUDIO) += twl4030-audio.o
+obj-$(CONFIG_TWL6030_POWER) += twl6030-power.o
obj-$(CONFIG_TWL6040_CORE) += twl6040.o
obj-$(CONFIG_MFD_MX25_TSADC) += fsl-imx25-tsadc.o
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 289b556de..880ea446c 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -956,6 +956,14 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
return PTR_ERR(child);
}
+ if (IS_ENABLED(CONFIG_TWL6030_POWER) && pdata->power) {
+ child = add_child(TWL_MODULE_PM_MASTER, "twl6030_power",
+ pdata->power, sizeof(*pdata->power), false,
+ 0, 0);
+ if (IS_ERR(child))
+ return PTR_ERR(child);
+ }
+
return 0;
}
diff --git a/drivers/mfd/twl6030-power.c b/drivers/mfd/twl6030-power.c
new file mode 100644
index 000000000..f6bacdfc3
--- /dev/null
+++ b/drivers/mfd/twl6030-power.c
@@ -0,0 +1,103 @@
+
+/*
+ * TWL6030 power
+ *
+ * Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file "COPYING" in the main directory of this
+ * archive for more details.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <linux/module.h>
+#include <linux/pm.h>
+#include <linux/mfd/twl.h>
+#include <linux/platform_device.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+
+#define TWL6030_PHOENIX_DEV_ON 0x25
+
+#define TWL6030_PHOENIX_APP_DEVOFF (1 << 0)
+#define TWL6030_PHOENIX_CON_DEVOFF (1 << 1)
+#define TWL6030_PHOENIX_MOD_DEVOFF (1 << 2)
+
+void twl6030_power_off(void)
+{
+ int err;
+
+ err = twl_i2c_write_u8(TWL6030_MODULE_ID0, TWL6030_PHOENIX_APP_DEVOFF |
+ TWL6030_PHOENIX_CON_DEVOFF | TWL6030_PHOENIX_MOD_DEVOFF,
+ TWL6030_PHOENIX_DEV_ON);
+ if (err)
+ pr_err("TWL6030 Unable to power off\n");
+}
+
+static bool twl6030_power_use_poweroff(const struct twl4030_power_data *pdata,
+ struct device_node *node)
+{
+ if (pdata && pdata->use_poweroff)
+ return true;
+
+ if (of_property_read_bool(node, "ti,system-power-controller"))
+ return true;
+
+ return false;
+}
+
+#ifdef CONFIG_OF
+static const struct of_device_id twl6030_power_of_match[] = {
+ {
+ .compatible = "ti,twl6030-power",
+ },
+ { },
+};
+
+MODULE_DEVICE_TABLE(of, twl6030_power_of_match);
+#endif /* CONFIG_OF */
+
+static int twl6030_power_probe(struct platform_device *pdev)
+{
+ const struct twl4030_power_data *pdata = dev_get_platdata(&pdev->dev);
+ struct device_node *node = pdev->dev.of_node;
+
+ if (!pdata && !node) {
+ dev_err(&pdev->dev, "Platform data is missing\n");
+ return -EINVAL;
+ }
+
+ /* Board has to be wired properly to use this feature */
+ if (twl6030_power_use_poweroff(pdata, node) && !pm_power_off)
+ pm_power_off = twl6030_power_off;
+
+ return 0;
+}
+
+static int twl6030_power_remove(struct platform_device *pdev)
+{
+ return 0;
+}
+
+static struct platform_driver twl6030_power_driver = {
+ .driver = {
+ .name = "twl6030_power",
+ .of_match_table = of_match_ptr(twl6030_power_of_match),
+ },
+ .probe = twl6030_power_probe,
+ .remove = twl6030_power_remove,
+};
+
+module_platform_driver(twl6030_power_driver);
+
+MODULE_AUTHOR("Paul Kocialkowski <contact@paulk.fr>");
+MODULE_DESCRIPTION("Power management for TWL6030");
+MODULE_LICENSE("GPL");

View file

@ -0,0 +1,244 @@
diff --git a/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt b/Documentation/devicetree/bindings/input/twl-pwrbutton.txt
similarity index 64%
rename from Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
rename to Documentation/devicetree/bindings/input/twl-pwrbutton.txt
index f5021214e..b49e2608f 100644
--- a/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
+++ b/Documentation/devicetree/bindings/input/twl-pwrbutton.txt
@@ -1,6 +1,6 @@
-Texas Instruments TWL family (twl4030) pwrbutton module
+Texas Instruments TWL family pwrbutton module
-This module is part of the TWL4030. For more details about the whole
+This module is part of a TWL chip. For more details about the whole
chip see Documentation/devicetree/bindings/mfd/twl-family.txt.
This module provides a simple power button event via an Interrupt.
@@ -8,8 +8,9 @@ This module provides a simple power button event via an Interrupt.
Required properties:
- compatible: should be one of the following
- "ti,twl4030-pwrbutton": For controllers compatible with twl4030
+ - "ti,twl6030-pwrbutton": For controllers compatible with twl6030
- interrupts: should be one of the following
- - <8>: For controllers compatible with twl4030
+ - <8>: For controllers compatible with the twl
Example:
diff --git a/arch/arm/boot/dts/twl6030.dtsi b/arch/arm/boot/dts/twl6030.dtsi
index 9d588cfaa..ac033debf 100644
--- a/arch/arm/boot/dts/twl6030.dtsi
+++ b/arch/arm/boot/dts/twl6030.dtsi
@@ -102,4 +102,9 @@ gpadc {
interrupts = <3>;
#io-channel-cells = <1>;
};
+
+ twl_pwrbutton: pwrbutton {
+ compatible = "ti,twl6030-pwrbutton";
+ interrupts = <0>;
+ };
};
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index dd5227cf8..61e1075bd 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -479,15 +479,15 @@ config INPUT_AXP20X_PEK
be called axp20x-pek.
-config INPUT_TWL4030_PWRBUTTON
- tristate "TWL4030 Power button Driver"
+config INPUT_TWL_PWRBUTTON
+ tristate "TWL Power button Driver"
depends on TWL4030_CORE
help
Say Y here if you want to enable power key reporting via the
- TWL4030 family of chips.
+ TWL family of chips.
To compile this driver as a module, choose M here. The module will
- be called twl4030_pwrbutton.
+ be called twl_pwrbutton
config INPUT_TWL4030_VIBRA
tristate "Support for TWL4030 Vibrator"
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index b92c53a6b..03531e525 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -77,7 +77,7 @@ obj-$(CONFIG_INPUT_SOC_BUTTON_ARRAY) += soc_button_array.o
obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o
obj-$(CONFIG_INPUT_STPMIC1_ONKEY) += stpmic1_onkey.o
obj-$(CONFIG_INPUT_TPS65218_PWRBUTTON) += tps65218-pwrbutton.o
-obj-$(CONFIG_INPUT_TWL4030_PWRBUTTON) += twl4030-pwrbutton.o
+obj-$(CONFIG_INPUT_TWL_PWRBUTTON) += twl-pwrbutton.o
obj-$(CONFIG_INPUT_TWL4030_VIBRA) += twl4030-vibra.o
obj-$(CONFIG_INPUT_TWL6040_VIBRA) += twl6040-vibra.o
obj-$(CONFIG_INPUT_UINPUT) += uinput.o
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl-pwrbutton.c
similarity index 58%
rename from drivers/input/misc/twl4030-pwrbutton.c
rename to drivers/input/misc/twl-pwrbutton.c
index b307cca17..9f6081474 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl-pwrbutton.c
@@ -31,15 +31,22 @@
#define PWR_PWRON_IRQ (1 << 0)
-#define STS_HW_CONDITIONS 0xf
+#define TWL4030_STS_HW_CONDITIONS 0x0f
+#define TWL6030_STS_HW_CONDITIONS 0x21
-static irqreturn_t powerbutton_irq(int irq, void *_pwr)
+static irqreturn_t twl_pwrbutton_irq(int irq, void *_pwr)
{
struct input_dev *pwr = _pwr;
int err;
u8 value;
- err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &value, STS_HW_CONDITIONS);
+ if (twl_class_is_4030())
+ err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &value,
+ TWL4030_STS_HW_CONDITIONS);
+ else
+ err = twl_i2c_read_u8(TWL6030_MODULE_ID0, &value,
+ TWL6030_STS_HW_CONDITIONS);
+
if (!err) {
pm_wakeup_event(pwr->dev.parent, 0);
input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ);
@@ -52,7 +59,7 @@ static irqreturn_t powerbutton_irq(int irq, void *_pwr)
return IRQ_HANDLED;
}
-static int twl4030_pwrbutton_probe(struct platform_device *pdev)
+static int twl_pwrbutton_probe(struct platform_device *pdev)
{
struct input_dev *pwr;
int irq = platform_get_irq(pdev, 0);
@@ -64,15 +71,23 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
return -ENOMEM;
}
- input_set_capability(pwr, EV_KEY, KEY_POWER);
- pwr->name = "twl4030_pwrbutton";
- pwr->phys = "twl4030_pwrbutton/input0";
+ pwr->evbit[0] = BIT_MASK(EV_KEY);
+ pwr->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER);
+ pwr->name = "twl_pwrbutton";
+ pwr->phys = "twl_pwrbutton/input0";
pwr->dev.parent = &pdev->dev;
- err = devm_request_threaded_irq(&pdev->dev, irq, NULL, powerbutton_irq,
+ if (twl_class_is_6030()) {
+ twl6030_interrupt_unmask(TWL6030_PWRON_INT_MASK,
+ REG_INT_MSK_LINE_A);
+ twl6030_interrupt_unmask(TWL6030_PWRON_INT_MASK,
+ REG_INT_MSK_STS_A);
+ }
+
+ err = devm_request_threaded_irq(&pwr->dev, irq, NULL, twl_pwrbutton_irq,
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING |
IRQF_ONESHOT,
- "twl4030_pwrbutton", pwr);
+ "twl_pwrbutton", pwr);
if (err < 0) {
dev_err(&pdev->dev, "Can't get IRQ for pwrbutton: %d\n", err);
return err;
@@ -84,31 +99,45 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
return err;
}
+ platform_set_drvdata(pdev, pwr);
device_init_wakeup(&pdev->dev, true);
return 0;
}
+static int twl_pwrbutton_remove(struct platform_device *pdev)
+{
+ if (twl_class_is_6030()) {
+ twl6030_interrupt_mask(TWL6030_PWRON_INT_MASK,
+ REG_INT_MSK_LINE_A);
+ twl6030_interrupt_mask(TWL6030_PWRON_INT_MASK,
+ REG_INT_MSK_STS_A);
+ }
+
+ return 0;
+}
+
#ifdef CONFIG_OF
-static const struct of_device_id twl4030_pwrbutton_dt_match_table[] = {
+static const struct of_device_id twl_pwrbutton_dt_match_table[] = {
{ .compatible = "ti,twl4030-pwrbutton" },
+ { .compatible = "ti,twl6030-pwrbutton" },
{},
};
-MODULE_DEVICE_TABLE(of, twl4030_pwrbutton_dt_match_table);
+MODULE_DEVICE_TABLE(of, twl_pwrbutton_dt_match_table);
#endif
-static struct platform_driver twl4030_pwrbutton_driver = {
- .probe = twl4030_pwrbutton_probe,
+static struct platform_driver twl_pwrbutton_driver = {
+ .probe = twl_pwrbutton_probe,
+ .remove = twl_pwrbutton_remove,
.driver = {
- .name = "twl4030_pwrbutton",
- .of_match_table = of_match_ptr(twl4030_pwrbutton_dt_match_table),
+ .name = "twl_pwrbutton",
+ .of_match_table = of_match_ptr(twl_pwrbutton_dt_match_table),
},
};
-module_platform_driver(twl4030_pwrbutton_driver);
+module_platform_driver(twl_pwrbutton_driver);
-MODULE_ALIAS("platform:twl4030_pwrbutton");
-MODULE_DESCRIPTION("Triton2 Power Button");
+MODULE_ALIAS("platform:twl_pwrbutton");
+MODULE_DESCRIPTION("TWL Power Button");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Peter De Schrijver <peter.de-schrijver@nokia.com>");
MODULE_AUTHOR("Felipe Balbi <felipe.balbi@nokia.com>");
-
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 289b556de..04c0b036e 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -832,13 +832,20 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
return PTR_ERR(child);
}
- if (IS_ENABLED(CONFIG_INPUT_TWL4030_PWRBUTTON) && twl_class_is_4030()) {
- child = add_child(TWL_MODULE_PM_MASTER, "twl4030_pwrbutton",
+ if (IS_ENABLED(CONFIG_INPUT_TWL_PWRBUTTON) && twl_class_is_4030()) {
+ child = add_child(TWL_MODULE_PM_MASTER, "twl_pwrbutton",
NULL, 0, true, irq_base + 8 + 0, 0);
if (IS_ERR(child))
return PTR_ERR(child);
}
+ if (IS_ENABLED(CONFIG_INPUT_TWL_PWRBUTTON) && twl_class_is_6030()) {
+ child = add_child(TWL_MODULE_PM_MASTER, "twl_pwrbutton",
+ NULL, 0, true, irq_base + 0, 0);
+ if (IS_ERR(child))
+ return PTR_ERR(child);
+ }
+
if (IS_ENABLED(CONFIG_MFD_TWL4030_AUDIO) && pdata->audio &&
twl_class_is_4030()) {
child = add_child(TWL4030_MODULE_AUDIO_VOICE, "twl4030-audio",
diff --git a/include/linux/mfd/twl.h b/include/linux/mfd/twl.h
index 8871cc518..108138c99 100644
--- a/include/linux/mfd/twl.h
+++ b/include/linux/mfd/twl.h
@@ -113,6 +113,7 @@ enum twl6030_module_ids {
#define REG_INT_MSK_STS_C 0x08
/* MASK INT REG GROUP A */
+#define TWL6030_PWRON_INT_MASK 0x01
#define TWL6030_PWR_INT_MASK 0x07
#define TWL6030_RTC_INT_MASK 0x18
#define TWL6030_HOTDIE_INT_MASK 0x20

View file

@ -2,7 +2,7 @@
# Co-Maintainer: Antoni Aloy <aaloytorrens@gmail.com> # Co-Maintainer: Antoni Aloy <aaloytorrens@gmail.com>
pkgname=linux-samsung-espresso3g pkgname=linux-samsung-espresso3g
pkgver=5.15.2 pkgver=5.15.2
pkgrel=2 pkgrel=3
pkgdesc="Samsung Galaxy Tab 2 (7.0 inch) mainline kernel" pkgdesc="Samsung Galaxy Tab 2 (7.0 inch) mainline kernel"
arch="armv7" arch="armv7"
_carch="arm" _carch="arm"
@ -23,6 +23,8 @@ source="
00-add-espresso-dts.patch 00-add-espresso-dts.patch
02-CVE-2021-39685-USB-gadget-detect-too-big-endpoint-0-requests.patch 02-CVE-2021-39685-USB-gadget-detect-too-big-endpoint-0-requests.patch
03-CVE-2021-39685-USB-gadget-zero-allocate-endpoint-0-buffers.patch 03-CVE-2021-39685-USB-gadget-zero-allocate-endpoint-0-buffers.patch
04-Add-TWL6030-power-driver-with-minimal-support-for-power-off.patch
05-Add-TWL6030-power-button-support-to-twl-pwrbutton.patch
$_config $_config
" "
builddir="$srcdir/linux_openpvrsgx-$_commit" builddir="$srcdir/linux_openpvrsgx-$_commit"
@ -53,8 +55,10 @@ package() {
sha512sums=" sha512sums="
c1f1372afc303cabb55210c7c46a694eff3bc0d7871efee7a690488b782b0c2cb48dbccc43b454a7cf96cfea796397f621d338e791172a8d1f62b26b2e1d54cb linux-samsung-espresso3g-6ba3430a6fad45bf35f2634809e4f3a12f85cb89.tar.gz c1f1372afc303cabb55210c7c46a694eff3bc0d7871efee7a690488b782b0c2cb48dbccc43b454a7cf96cfea796397f621d338e791172a8d1f62b26b2e1d54cb linux-samsung-espresso3g-6ba3430a6fad45bf35f2634809e4f3a12f85cb89.tar.gz
c914516703fdb42f3b33ee3f449222a81c06b3c9a3dd4f9a24ad55a9b32cf0828bf557897157296a9e5edbe92a898cdd42d147b196162750010e1d087f80ab39 00-add-espresso-dts.patch e3e6ecc15b477531cb06200dbe17d1a3f8ddf6c403b8a8ec78ed73b5b1497fbf3492f074ac9e44bd252d8e8fb311ee910113ac1890de93adee445de3a644ea33 00-add-espresso-dts.patch
c83480686caa35c51bce654104082e51d2569850bbbdcdb8479fb756ffb7907aefce685b2cfa748bbed0da7b585be83a08d194d0ff315a070a5b5a07c8dbc1d2 02-CVE-2021-39685-USB-gadget-detect-too-big-endpoint-0-requests.patch c83480686caa35c51bce654104082e51d2569850bbbdcdb8479fb756ffb7907aefce685b2cfa748bbed0da7b585be83a08d194d0ff315a070a5b5a07c8dbc1d2 02-CVE-2021-39685-USB-gadget-detect-too-big-endpoint-0-requests.patch
7b76e82bca21c9746bb37df2e840b43a0628a8a00b45ee43dd38ce742d7b99e30faf4bd11c99f1a20299b486885cbb9f62502400544a6a7e319292b97331581d 03-CVE-2021-39685-USB-gadget-zero-allocate-endpoint-0-buffers.patch 7b76e82bca21c9746bb37df2e840b43a0628a8a00b45ee43dd38ce742d7b99e30faf4bd11c99f1a20299b486885cbb9f62502400544a6a7e319292b97331581d 03-CVE-2021-39685-USB-gadget-zero-allocate-endpoint-0-buffers.patch
188175b358be4c44967961052fb5499d6a17ec98700506dbd020b84f5c939b70f8f7d1876587c6ff947ebf85ae33c0847cce5fc0c5086e42294cfbfb1df9b478 config-samsung-espresso3g.armv7 a483b1a322f3fe47c7bb6514f34cca69ad1b806487596ffab69078acb6e83e99ed39ffb4d5b4ecd17035d118a75ce5bac6761b9e42d01608f1e6a53d59b27806 04-Add-TWL6030-power-driver-with-minimal-support-for-power-off.patch
b3d6114c5c60fc2820856c89ea6f09c369d857ae79a79f0eeb0f83f5401dc2253e11f7dac6869eb1095d3e0b3a68126246762e2f406ffae5b5ef0a60d5563bac 05-Add-TWL6030-power-button-support-to-twl-pwrbutton.patch
f5d1b1ae3a776b4f68914b0ba00bbce8e00122028eb1141ea57dbe8d6d652d9a407f13df3d36e553e21c4b2d576bb0f8978b396a7af4511fad9a321e0ffc38ed config-samsung-espresso3g.armv7
" "

View file

@ -2716,7 +2716,7 @@ CONFIG_INPUT_CPCAP_PWRBUTTON=m
# CONFIG_INPUT_CM109 is not set # CONFIG_INPUT_CM109 is not set
# CONFIG_INPUT_REGULATOR_HAPTIC is not set # CONFIG_INPUT_REGULATOR_HAPTIC is not set
CONFIG_INPUT_TPS65218_PWRBUTTON=m CONFIG_INPUT_TPS65218_PWRBUTTON=m
CONFIG_INPUT_TWL4030_PWRBUTTON=m CONFIG_INPUT_TWL_PWRBUTTON=m
# CONFIG_INPUT_TWL4030_VIBRA is not set # CONFIG_INPUT_TWL4030_VIBRA is not set
# CONFIG_INPUT_TWL6040_VIBRA is not set # CONFIG_INPUT_TWL6040_VIBRA is not set
CONFIG_INPUT_UINPUT=y CONFIG_INPUT_UINPUT=y