2 * /drivers/mfd/twl6030-poweroff.c
6 * Copyright (C) 2011 Texas Instruments Corporation
8 * Written by Rajeev Kulkarni <rajeevk@ti.com>
10 * This file is subject to the terms and conditions of the GNU General
11 * Public License. See the file "COPYING" in the main directory of this
12 * archive for more details.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include <linux/module.h>
26 #include <linux/i2c/twl.h>
28 #define APP_DEVOFF (1<<0)
29 #define CON_DEVOFF (1<<1)
30 #define MOD_DEVOFF (1<<2)
32 void twl6030_poweroff(void)
37 err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &val,
38 TWL6030_PHOENIX_DEV_ON);
40 pr_warning("I2C error %d reading PHOENIX_DEV_ON\n", err);
44 val |= APP_DEVOFF | CON_DEVOFF | MOD_DEVOFF;
46 err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, val,
47 TWL6030_PHOENIX_DEV_ON);
50 pr_warning("I2C error %d writing PHOENIX_DEV_ON\n", err);
57 static int __init twl6030_poweroff_init(void)
59 pm_power_off = twl6030_poweroff;
64 static void __exit twl6030_poweroff_exit(void)
69 module_init(twl6030_poweroff_init);
70 module_exit(twl6030_poweroff_exit);
72 MODULE_DESCRIPTION("TLW6030 device power off");
73 MODULE_LICENSE("GPL");
74 MODULE_AUTHOR("Rajeev Kulkarni");