[Armadeus-commitlog] armadeus branch, master, updated. armadeus-5.3-551-g3eda3ca
Brought to you by:
sszy
|
From: Sébastien S. <ss...@us...> - 2015-01-15 13:05:50
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "armadeus".
The branch, master has been updated
via 3eda3ca1a7d6440c5ca59c940fdb45a36aad79e3 (commit)
via cb6d54e1569c560eecfea4522f920580d26cbe31 (commit)
from e2858fae2090650fee618d52317c492482ec79dd (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 3eda3ca1a7d6440c5ca59c940fdb45a36aad79e3
Author: Sébastien Szymanski <seb...@ar...>
Date: Thu Jan 15 14:10:10 2015 +0100
[LINUX] 2.6.38: apf51: add pm_power_off function
commit cb6d54e1569c560eecfea4522f920580d26cbe31
Author: Sébastien Szymanski <seb...@ar...>
Date: Thu Jan 15 14:09:28 2015 +0100
[LINUX] 2.6.38: apf51v2: add button of PMIC MC13892 support
-----------------------------------------------------------------------
Summary of changes:
.../armadeus/apf51/apf51-linux-2.6.38.config | 1 +
.../455-armadeus-add_mc13892_button_support.patch | 401 ++++++++++++++++++++
.../456-armadeus-add_poweroff_function.patch | 34 ++
3 files changed, 436 insertions(+), 0 deletions(-)
create mode 100644 patches/linux/2.6.38/455-armadeus-add_mc13892_button_support.patch
create mode 100644 patches/linux/2.6.38/456-armadeus-add_poweroff_function.patch
diff --git a/buildroot/target/device/armadeus/apf51/apf51-linux-2.6.38.config b/buildroot/target/device/armadeus/apf51/apf51-linux-2.6.38.config
index 7155247..6643bc3 100644
--- a/buildroot/target/device/armadeus/apf51/apf51-linux-2.6.38.config
+++ b/buildroot/target/device/armadeus/apf51/apf51-linux-2.6.38.config
@@ -123,6 +123,7 @@ CONFIG_KEYBOARD_IMX=m
CONFIG_INPUT_TOUCHSCREEN=y
CONFIG_TOUCHSCREEN_WM831X=y
CONFIG_INPUT_MISC=y
+CONFIG_INPUT_MC13892_PWRBUTTON=m
CONFIG_INPUT_UINPUT=m
CONFIG_INPUT_WM831X_ON=y
CONFIG_SERIAL_8250=m
diff --git a/patches/linux/2.6.38/455-armadeus-add_mc13892_button_support.patch b/patches/linux/2.6.38/455-armadeus-add_mc13892_button_support.patch
new file mode 100644
index 0000000..dae9717
--- /dev/null
+++ b/patches/linux/2.6.38/455-armadeus-add_mc13892_button_support.patch
@@ -0,0 +1,401 @@
+Index: linux-2.6.38.8/drivers/input/misc/Kconfig
+===================================================================
+--- linux-2.6.38.8.orig/drivers/input/misc/Kconfig
++++ linux-2.6.38.8/drivers/input/misc/Kconfig
+@@ -100,6 +100,16 @@ config INPUT_MAX8925_ONKEY
+ To compile this driver as a module, choose M here: the module
+ will be called max8925_onkey.
+
++config INPUT_MC13892_PWRBUTTON
++ tristate "MC13892 ON buttons"
++ depends on MFD_MC13XXX
++ help
++ Support the ON buttons of MC13892 PMIC as an input device
++ reporting power button status.
++
++ To compile this driver as a module, choose M here: the module
++ will be called mc13892-pwrbutton.
++
+ config INPUT_APANEL
+ tristate "Fujitsu Lifebook Application Panel buttons"
+ depends on X86 && I2C && LEDS_CLASS
+Index: linux-2.6.38.8/drivers/mfd/mc13xxx-core.c
+===================================================================
+--- linux-2.6.38.8.orig/drivers/mfd/mc13xxx-core.c
++++ linux-2.6.38.8/drivers/mfd/mc13xxx-core.c
+@@ -696,6 +696,11 @@ static int mc13xxx_probe(struct i2c_clie
+ if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
+ return -EINVAL;
+
++ if (!pdata) {
++ dev_err(&i2c->dev, "invalid platform data\n");
++ return -EINVAL;
++ }
++
+ mc13xxx = kzalloc(sizeof(*mc13xxx), GFP_KERNEL);
+ if (!mc13xxx)
+ return -ENOMEM;
+@@ -775,6 +780,10 @@ err_revision:
+ if (pdata->flags & MC13XXX_USE_GPO)
+ mc13xxx_add_subdevice(mc13xxx, "%s-gpio");
+
++ if (pdata->buttons)
++ mc13xxx_add_subdevice_pdata(mc13xxx, "%s-pwrbutton",
++ pdata->buttons, sizeof(*pdata->buttons));
++
+ return 0;
+ }
+
+Index: linux-2.6.38.8/include/linux/mfd/mc13xxx.h
+===================================================================
+--- linux-2.6.38.8.orig/include/linux/mfd/mc13xxx.h
++++ linux-2.6.38.8/include/linux/mfd/mc13xxx.h
+@@ -54,6 +54,9 @@ int mc13xxx_adc_do_conversion(struct mc1
+ #define MC13XXX_IRQ_LOBATH 14
+ #define MC13XXX_IRQ_1HZ 24
+ #define MC13XXX_IRQ_TODA 25
++#define MC13XXX_IRQ_PWR0N3 26
++#define MC13XXX_IRQ_PWR0N1 27
++#define MC13XXX_IRQ_PWR0N2 28
+ #define MC13XXX_IRQ_SYSRST 30
+ #define MC13XXX_IRQ_RTCRST 31
+ #define MC13XXX_IRQ_PC 32
+@@ -153,6 +156,21 @@ struct mc13xxx_ts_platform_data {
+ bool atox;
+ };
+
++struct mc13xxx_buttons_platform_data {
++#define MC13XXX_BUTTON_DBNC_0MS 0
++#define MC13XXX_BUTTON_DBNC_30MS 1
++#define MC13XXX_BUTTON_DBNC_150MS 2
++#define MC13XXX_BUTTON_DBNC_750MS 3
++#define MC13XXX_BUTTON_ENABLE (1 << 2)
++#define MC13XXX_BUTTON_POL_INVERT (1 << 3)
++ int b1on_flags;
++ unsigned short b1on_key;
++ int b2on_flags;
++ unsigned short b2on_key;
++ int b3on_flags;
++ unsigned short b3on_key;
++};
++
+ struct mc13xxx_platform_data {
+ #define MC13XXX_USE_TOUCHSCREEN (1 << 0)
+ #define MC13XXX_USE_CODEC (1 << 1)
+@@ -167,6 +185,7 @@ struct mc13xxx_platform_data {
+ struct mc13xxx_regulator_init_data *regulators;
+ struct mc13xxx_leds_platform_data *leds;
+ struct mc13xxx_ts_platform_data touch;
++ struct mc13xxx_buttons_platform_data *buttons;
+ };
+
+ #define MC13XXX_ADC_MODE_TS 1
+Index: linux-2.6.38.8/drivers/input/misc/Makefile
+===================================================================
+--- linux-2.6.38.8.orig/drivers/input/misc/Makefile
++++ linux-2.6.38.8/drivers/input/misc/Makefile
+@@ -27,6 +27,7 @@ obj-$(CONFIG_INPUT_IXP4XX_BEEPER) += ixp
+ obj-$(CONFIG_INPUT_KEYSPAN_REMOTE) += keyspan_remote.o
+ obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o
+ obj-$(CONFIG_INPUT_MAX8925_ONKEY) += max8925_onkey.o
++obj-$(CONFIG_INPUT_MC13892_PWRBUTTON) += mc13892-pwrbutton.o
+ obj-$(CONFIG_INPUT_PCAP) += pcap_keys.o
+ obj-$(CONFIG_INPUT_PCF50633_PMU) += pcf50633-input.o
+ obj-$(CONFIG_INPUT_PCF8574) += pcf8574_keypad.o
+Index: linux-2.6.38.8/drivers/input/misc/mc13892-pwrbutton.c
+===================================================================
+--- /dev/null
++++ linux-2.6.38.8/drivers/input/misc/mc13892-pwrbutton.c
+@@ -0,0 +1,273 @@
++/**
++ * Copyright (C) 2015 Sébastien Szymanski
++ *
++ * Based on mc13783-pwrbutton.c driver by:
++ * Philippe Rétornaz
++ *
++ * Based on twl4030-pwrbutton driver by:
++ * Peter De Schrijver <pet...@no...>
++ * Felipe Balbi <fel...@no...>
++ *
++ * 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., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
++ */
++
++#include <linux/module.h>
++#include <linux/init.h>
++#include <linux/kernel.h>
++#include <linux/errno.h>
++#include <linux/input.h>
++#include <linux/interrupt.h>
++#include <linux/platform_device.h>
++#include <linux/mfd/mc13783.h>
++#include <linux/sched.h>
++#include <linux/slab.h>
++
++struct mc13892_pwrb {
++ struct input_dev *pwr;
++ struct mc13xxx *mc13xxx;
++#define MC13892_PWRB_B1_POL_INVERT (1 << 0)
++#define MC13892_PWRB_B2_POL_INVERT (1 << 1)
++#define MC13892_PWRB_B3_POL_INVERT (1 << 2)
++ int flags;
++ unsigned short keymap[3];
++};
++
++#define MC13892_REG_INTERRUPT_SENSE_1 5
++#define MC13892_IRQSENSE1_PWRON3S (1 << 2)
++#define MC13892_IRQSENSE1_PWRON1S (1 << 3)
++#define MC13892_IRQSENSE1_PWRON2S (1 << 4)
++
++#define MC13892_REG_POWER_CONTROL_2 15
++#define MC13892_POWER_CONTROL_2_ON1BDBNC 4
++#define MC13892_POWER_CONTROL_2_ON2BDBNC 6
++#define MC13892_POWER_CONTROL_2_ON3BDBNC 8
++
++static irqreturn_t button_irq(int irq, void *_priv)
++{
++ struct mc13892_pwrb *priv = _priv;
++ int val;
++
++ mc13xxx_irq_ack(priv->mc13xxx, irq);
++ mc13xxx_reg_read(priv->mc13xxx, MC13892_REG_INTERRUPT_SENSE_1, &val);
++
++ switch (irq) {
++ case MC13XXX_IRQ_PWR0N1:
++ val = val & MC13892_IRQSENSE1_PWRON1S ? 1 : 0;
++ if (priv->flags & MC13892_PWRB_B1_POL_INVERT)
++ val ^= 1;
++ input_report_key(priv->pwr, priv->keymap[0], val);
++ break;
++
++ case MC13XXX_IRQ_PWR0N2:
++ val = val & MC13892_IRQSENSE1_PWRON2S ? 1 : 0;
++ if (priv->flags & MC13892_PWRB_B2_POL_INVERT)
++ val ^= 1;
++ input_report_key(priv->pwr, priv->keymap[1], val);
++ break;
++
++ case MC13XXX_IRQ_PWR0N3:
++ val = val & MC13892_IRQSENSE1_PWRON3S ? 1 : 0;
++ if (priv->flags & MC13892_PWRB_B3_POL_INVERT)
++ val ^= 1;
++ input_report_key(priv->pwr, priv->keymap[2], val);
++ break;
++ }
++
++ input_sync(priv->pwr);
++
++ return IRQ_HANDLED;
++}
++
++static int __devinit mc13892_pwrbutton_probe(struct platform_device *pdev)
++{
++ const struct mc13xxx_buttons_platform_data *pdata;
++ struct mc13xxx *mc13xxx = dev_get_drvdata(pdev->dev.parent);
++ struct input_dev *pwr;
++ struct mc13892_pwrb *priv;
++ int err = 0;
++ int reg = 0;
++
++ pdata = dev_get_platdata(&pdev->dev);
++ if (!pdata) {
++ dev_err(&pdev->dev, "missing platform data\n");
++ return -ENODEV;
++ }
++
++ pwr = input_allocate_device();
++ if (!pwr) {
++ dev_dbg(&pdev->dev, "Can't allocate power button\n");
++ return -ENOMEM;
++ }
++
++ priv = kzalloc(sizeof(*priv), GFP_KERNEL);
++ if (!priv) {
++ err = -ENOMEM;
++ dev_dbg(&pdev->dev, "Can't allocate power button\n");
++ goto free_input_dev;
++ }
++
++ reg |= (pdata->b1on_flags & 0x3) << MC13892_POWER_CONTROL_2_ON1BDBNC;
++ reg |= (pdata->b2on_flags & 0x3) << MC13892_POWER_CONTROL_2_ON2BDBNC;
++ reg |= (pdata->b3on_flags & 0x3) << MC13892_POWER_CONTROL_2_ON3BDBNC;
++
++ priv->pwr = pwr;
++ priv->mc13xxx = mc13xxx;
++
++ mc13xxx_lock(mc13xxx);
++
++ if (pdata->b1on_flags & MC13XXX_BUTTON_ENABLE) {
++ priv->keymap[0] = pdata->b1on_key;
++ if (pdata->b1on_key != KEY_RESERVED)
++ __set_bit(pdata->b1on_key, pwr->keybit);
++
++ if (pdata->b1on_flags & MC13XXX_BUTTON_POL_INVERT)
++ priv->flags |= MC13892_PWRB_B1_POL_INVERT;
++
++ err = mc13xxx_irq_request(mc13xxx, MC13XXX_IRQ_PWR0N1,
++ button_irq, "b1on", priv);
++ if (err) {
++ dev_dbg(&pdev->dev, "Can't request irq\n");
++ goto free_priv;
++ }
++ }
++
++ if (pdata->b2on_flags & MC13XXX_BUTTON_ENABLE) {
++ priv->keymap[1] = pdata->b2on_key;
++ if (pdata->b2on_key != KEY_RESERVED)
++ __set_bit(pdata->b2on_key, pwr->keybit);
++
++ if (pdata->b2on_flags & MC13XXX_BUTTON_POL_INVERT)
++ priv->flags |= MC13892_PWRB_B2_POL_INVERT;
++
++ err = mc13xxx_irq_request(mc13xxx, MC13XXX_IRQ_PWR0N2,
++ button_irq, "b2on", priv);
++ if (err) {
++ dev_dbg(&pdev->dev, "Can't request irq\n");
++ goto free_irq_b1;
++ }
++ }
++
++ if (pdata->b3on_flags & MC13XXX_BUTTON_ENABLE) {
++ priv->keymap[2] = pdata->b3on_key;
++ if (pdata->b3on_key != KEY_RESERVED)
++ __set_bit(pdata->b3on_key, pwr->keybit);
++
++ if (pdata->b3on_flags & MC13XXX_BUTTON_POL_INVERT)
++ priv->flags |= MC13892_PWRB_B3_POL_INVERT;
++
++ err = mc13xxx_irq_request(mc13xxx, MC13XXX_IRQ_PWR0N3,
++ button_irq, "b3on", priv);
++ if (err) {
++ dev_dbg(&pdev->dev, "Can't request irq: %d\n", err);
++ goto free_irq_b2;
++ }
++ }
++
++ mc13xxx_reg_rmw(mc13xxx, MC13892_REG_POWER_CONTROL_2, 0x3F0, reg);
++
++ mc13xxx_unlock(mc13xxx);
++
++ pwr->name = "mc13892_pwrbutton";
++ pwr->phys = "mc13892_pwrbutton/input0";
++ pwr->dev.parent = &pdev->dev;
++
++ pwr->keycode = priv->keymap;
++ pwr->keycodemax = ARRAY_SIZE(priv->keymap);
++ pwr->keycodesize = sizeof(priv->keymap[0]);
++ __set_bit(EV_KEY, pwr->evbit);
++
++ err = input_register_device(pwr);
++ if (err) {
++ dev_dbg(&pdev->dev, "Can't register power button: %d\n", err);
++ goto free_irq;
++ }
++
++ platform_set_drvdata(pdev, priv);
++
++ return 0;
++
++free_irq:
++ mc13xxx_lock(mc13xxx);
++
++ if (pdata->b3on_flags & MC13XXX_BUTTON_ENABLE)
++ mc13xxx_irq_free(mc13xxx, MC13XXX_IRQ_PWR0N3, priv);
++
++free_irq_b2:
++ if (pdata->b2on_flags & MC13XXX_BUTTON_ENABLE)
++ mc13xxx_irq_free(mc13xxx, MC13XXX_IRQ_PWR0N2, priv);
++
++free_irq_b1:
++ if (pdata->b1on_flags & MC13XXX_BUTTON_ENABLE)
++ mc13xxx_irq_free(mc13xxx, MC13XXX_IRQ_PWR0N1, priv);
++
++free_priv:
++ mc13xxx_unlock(mc13xxx);
++ kfree(priv);
++
++free_input_dev:
++ input_free_device(pwr);
++
++ return err;
++}
++
++static int __devexit mc13892_pwrbutton_remove(struct platform_device *pdev)
++{
++ struct mc13892_pwrb *priv = platform_get_drvdata(pdev);
++ const struct mc13xxx_buttons_platform_data *pdata;
++
++ pdata = dev_get_platdata(&pdev->dev);
++
++ mc13xxx_lock(priv->mc13xxx);
++
++ if (pdata->b3on_flags & MC13XXX_BUTTON_ENABLE)
++ mc13xxx_irq_free(priv->mc13xxx, MC13XXX_IRQ_PWR0N3, priv);
++ if (pdata->b2on_flags & MC13XXX_BUTTON_ENABLE)
++ mc13xxx_irq_free(priv->mc13xxx, MC13XXX_IRQ_PWR0N2, priv);
++ if (pdata->b1on_flags & MC13XXX_BUTTON_ENABLE)
++ mc13xxx_irq_free(priv->mc13xxx, MC13XXX_IRQ_PWR0N1, priv);
++
++ mc13xxx_unlock(priv->mc13xxx);
++
++ input_unregister_device(priv->pwr);
++ kfree(priv);
++ platform_set_drvdata(pdev, NULL);
++
++ return 0;
++}
++
++struct platform_driver mc13892_pwrbutton_driver = {
++ .probe = mc13892_pwrbutton_probe,
++ .remove = __devexit_p(mc13892_pwrbutton_remove),
++ .driver = {
++ .name = "mc13892-pwrbutton",
++ .owner = THIS_MODULE,
++ },
++};
++
++static int __init mc13892_pwrbutton_init(void)
++{
++ return platform_driver_register(&mc13892_pwrbutton_driver);
++}
++module_init(mc13892_pwrbutton_init);
++
++static void __exit mc13892_pwrbutton_exit(void)
++{
++ platform_driver_unregister(&mc13892_pwrbutton_driver);
++}
++module_exit(mc13892_pwrbutton_exit);
++
++MODULE_ALIAS("platform:mc13892-pwrbutton");
++MODULE_DESCRIPTION("MC13892 Power Button");
++MODULE_LICENSE("GPL v2");
++MODULE_AUTHOR("Sébastien Szymanski");
+Index: linux-2.6.38.8/arch/arm/mach-mx5/board-apf51.c
+===================================================================
+--- linux-2.6.38.8.orig/arch/arm/mach-mx5/board-apf51.c
++++ linux-2.6.38.8/arch/arm/mach-mx5/board-apf51.c
+@@ -400,8 +400,14 @@ static struct i2c_board_info apf51_i2c1_
+ },
+ };
+
++static struct mc13xxx_buttons_platform_data mc13xxx_buttons_pdata = {
++ .b3on_flags = MC13XXX_BUTTON_ENABLE | MC13XXX_BUTTON_POL_INVERT,
++ .b3on_key = 116, /* KEY_POWER */
++};
++
+ static struct mc13xxx_platform_data apf51_mc13xxx_pdata = {
+ .flags = MC13XXX_USE_RTC | MC13XXX_USE_GPO | MC13XXX_USE_ADC,
++ .buttons = &mc13xxx_buttons_pdata,
+ };
+
+ static struct i2c_board_info apf51v2_i2c1_devices[] __initdata = {
diff --git a/patches/linux/2.6.38/456-armadeus-add_poweroff_function.patch b/patches/linux/2.6.38/456-armadeus-add_poweroff_function.patch
new file mode 100644
index 0000000..41a2ced
--- /dev/null
+++ b/patches/linux/2.6.38/456-armadeus-add_poweroff_function.patch
@@ -0,0 +1,34 @@
+Index: linux-2.6.38.8/arch/arm/mach-mx5/board-apf51.c
+===================================================================
+--- linux-2.6.38.8.orig/arch/arm/mach-mx5/board-apf51.c
++++ linux-2.6.38.8/arch/arm/mach-mx5/board-apf51.c
+@@ -132,6 +132,8 @@ static iomux_v3_cfg_t apf51_pads[] = {
+ MX51_PAD_CSI2_D13__GPIO4_10, /* CONFIG_SYS_FPGA_DONE */
+ MX51_PAD_DISPB2_SER_DIO__GPIO3_6, /* CONFIG_SYS_FPGA_SUSPEND */
+ (_MX51_PAD_GPIO1_5__GPIO1_5 | MUX_PAD_CTRL(APF51_GPIO_SPECIAL_PAD_CTRL)), /* CLK0 as gpio */
++
++ MX51_PAD_DISPB2_SER_RS__GPIO3_8, /* PMIC OFF */
+ };
+
+
+@@ -458,12 +460,20 @@ static int apf51_fpga_init(void)
+ }
+
+ #define APF51_VERSION_GPIO (2*32 + 12) /* GPIO3_12 */
++#define APF51_PMIC_OFF_GPIO (2*32 + 8) /* GPIO3_8 */
++
++static void apf51_power_off(void) {
++ gpio_request(APF51_PMIC_OFF_GPIO, "apf51-pmic-off-gpio");
++ gpio_direction_output(APF51_PMIC_OFF_GPIO, 0);
++}
+
+ /*
+ * Board specific initialization.
+ */
+ static void __init apf51_board_init(void)
+ {
++ pm_power_off = apf51_power_off;
++
+ #if defined(CONFIG_CPU_FREQ_IMX)
+ get_cpu_op = mx51_get_cpu_op;
+ #endif
hooks/post-receive
--
armadeus
|