max8925_onkey.c (05e5bd0f3daddb0368a433af5b58be68c62dc365) max8925_onkey.c (adab30d73844076b6ca9cd3e6382f5db3a44ded4)
1/**
2 * max8925_onkey.c - MAX8925 ONKEY driver
3 *
4 * Copyright (C) 2009 Marvell International Ltd.
5 * Haojian Zhuang <haojian.zhuang@marvell.com>
6 *
7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file "COPYING" in the main directory of this

--- 108 unchanged lines hidden (view full) ---

117 info->idev->phys = "max8925_on/input0";
118 info->idev->id.bustype = BUS_I2C;
119 info->idev->dev.parent = &pdev->dev;
120 info->irq[0] = irq[0];
121 info->irq[1] = irq[1];
122 info->idev->evbit[0] = BIT_MASK(EV_KEY);
123 info->idev->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER);
124
1/**
2 * max8925_onkey.c - MAX8925 ONKEY driver
3 *
4 * Copyright (C) 2009 Marvell International Ltd.
5 * Haojian Zhuang <haojian.zhuang@marvell.com>
6 *
7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file "COPYING" in the main directory of this

--- 108 unchanged lines hidden (view full) ---

117 info->idev->phys = "max8925_on/input0";
118 info->idev->id.bustype = BUS_I2C;
119 info->idev->dev.parent = &pdev->dev;
120 info->irq[0] = irq[0];
121 info->irq[1] = irq[1];
122 info->idev->evbit[0] = BIT_MASK(EV_KEY);
123 info->idev->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER);
124
125 device_init_wakeup(&pdev->dev, 1);
125
126 error = input_register_device(info->idev);
127 if (error) {
128 dev_err(chip->dev, "Can't register input device: %d\n", error);
129 goto out_reg;
130 }
131
132 platform_set_drvdata(pdev, info);

--- 20 unchanged lines hidden (view full) ---

153 input_unregister_device(info->idev);
154 kfree(info);
155
156 platform_set_drvdata(pdev, NULL);
157
158 return 0;
159}
160
126
127 error = input_register_device(info->idev);
128 if (error) {
129 dev_err(chip->dev, "Can't register input device: %d\n", error);
130 goto out_reg;
131 }
132
133 platform_set_drvdata(pdev, info);

--- 20 unchanged lines hidden (view full) ---

154 input_unregister_device(info->idev);
155 kfree(info);
156
157 platform_set_drvdata(pdev, NULL);
158
159 return 0;
160}
161
162#ifdef CONFIG_PM_SLEEP
163static int max8925_onkey_suspend(struct device *dev)
164{
165 struct platform_device *pdev = to_platform_device(dev);
166 struct max8925_onkey_info *info = platform_get_drvdata(pdev);
167 struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
168
169 if (device_may_wakeup(dev)) {
170 chip->wakeup_flag |= 1 << (info->irq[0] - chip->irq_base);
171 chip->wakeup_flag |= 1 << (info->irq[1] - chip->irq_base);
172 }
173
174 return 0;
175}
176
177static int max8925_onkey_resume(struct device *dev)
178{
179 struct platform_device *pdev = to_platform_device(dev);
180 struct max8925_onkey_info *info = platform_get_drvdata(pdev);
181 struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
182
183 if (device_may_wakeup(dev)) {
184 chip->wakeup_flag &= ~(1 << (info->irq[0] - chip->irq_base));
185 chip->wakeup_flag &= ~(1 << (info->irq[1] - chip->irq_base));
186 }
187
188 return 0;
189}
190#endif
191
192static SIMPLE_DEV_PM_OPS(max8925_onkey_pm_ops, max8925_onkey_suspend, max8925_onkey_resume);
193
161static struct platform_driver max8925_onkey_driver = {
162 .driver = {
163 .name = "max8925-onkey",
164 .owner = THIS_MODULE,
194static struct platform_driver max8925_onkey_driver = {
195 .driver = {
196 .name = "max8925-onkey",
197 .owner = THIS_MODULE,
198 .pm = &max8925_onkey_pm_ops,
165 },
166 .probe = max8925_onkey_probe,
167 .remove = __devexit_p(max8925_onkey_remove),
168};
169module_platform_driver(max8925_onkey_driver);
170
171MODULE_DESCRIPTION("Maxim MAX8925 ONKEY driver");
172MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>");
173MODULE_LICENSE("GPL");
199 },
200 .probe = max8925_onkey_probe,
201 .remove = __devexit_p(max8925_onkey_remove),
202};
203module_platform_driver(max8925_onkey_driver);
204
205MODULE_DESCRIPTION("Maxim MAX8925 ONKEY driver");
206MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>");
207MODULE_LICENSE("GPL");