Commit 9d49df73 authored by Peter 'p2' De Schrijver's avatar Peter 'p2' De Schrijver Committed by Tony Lindgren

OMAP34xx poweroff

Add support for software controlled power off of omap34xx and TWL4030
based devices.
Signed-off-by: default avatarPeter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 3887ae26
......@@ -157,8 +157,13 @@ config TWL4030_USB_HS_ULPI
help
Say Y here if the TWL4030 is connected to high-speed USB
controller through a ULPI interface.
endchoice
config TWL4030_POWEROFF
bool "TWL4030 device poweroff"
depends on TWL4030_CORE
config SENSORS_M41T00
tristate "ST M41T00 RTC chip (DEPRECATED)"
depends on PPC32
......
......@@ -20,6 +20,7 @@ obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o
obj-$(CONFIG_TWL4030_CORE) += twl4030_core.o
obj-$(CONFIG_TWL4030_GPIO) += twl4030_gpio.o
obj-$(CONFIG_TWL4030_USB) += twl4030_usb.o
obj-$(CONFIG_TWL4030_POWEROFF) += twl4030_poweroff.o
obj-$(CONFIG_RTC_X1205_I2C) += x1205.o
ifeq ($(CONFIG_I2C_DEBUG_CHIP),y)
......
/*
* linux/drivers/i2c/chips/twl4030_poweroff.c
*
* Power off device
*
* Copyright (C) 2008 Nokia Corporation
*
* Written by Peter De Schrijver <peter.de-schrijver@nokia.com>
*
* 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 <asm/arch/twl4030.h>
#define PWR_P1_SW_EVENTS 0x10
#define PWR_DEVOFF (1<<0)
void twl4030_poweroff(void)
{
u8 val;
int err;
err = twl4030_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &val,
PWR_P1_SW_EVENTS);
if (err) {
printk(KERN_WARNING "I2C error %d while reading TWL4030"
"PM_MASTER P1_SW_EVENTS\n", err);
return ;
}
val |= PWR_DEVOFF;
err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, val,
PWR_P1_SW_EVENTS);
if (err) {
printk(KERN_WARNING "I2C error %d while writing TWL4030"
"PM_MASTER P1_SW_EVENTS\n", err);
return ;
}
return;
}
static int __init twl4030_poweroff_init(void)
{
pm_power_off = twl4030_poweroff;
return 0;
}
static void __exit twl4030_poweroff_exit(void)
{
pm_power_off = NULL;
}
module_init(twl4030_poweroff_init);
module_exit(twl4030_poweroff_exit);
MODULE_DESCRIPTION("Triton2 device power off");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Peter De Schrijver");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment