mma7660.c (542898c5aa5c6a3179dffb1d1606884a63f75fed) mma7660.c (812c5f31b1b937d4407b16648ceb16bee16c0cf1)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Freescale MMA7660FC 3-Axis Accelerometer
4 *
5 * Copyright (c) 2016, Intel Corporation.
6 *
7 * IIO driver for Freescale MMA7660FC; 7-bit I2C address: 0x4c.
8 */

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

217 ret = mma7660_set_mode(iio_priv(indio_dev), MMA7660_MODE_STANDBY);
218 if (ret)
219 dev_warn(&client->dev, "Failed to put device in stand-by mode (%pe), ignoring\n",
220 ERR_PTR(ret));
221
222 return 0;
223}
224
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Freescale MMA7660FC 3-Axis Accelerometer
4 *
5 * Copyright (c) 2016, Intel Corporation.
6 *
7 * IIO driver for Freescale MMA7660FC; 7-bit I2C address: 0x4c.
8 */

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

217 ret = mma7660_set_mode(iio_priv(indio_dev), MMA7660_MODE_STANDBY);
218 if (ret)
219 dev_warn(&client->dev, "Failed to put device in stand-by mode (%pe), ignoring\n",
220 ERR_PTR(ret));
221
222 return 0;
223}
224
225#ifdef CONFIG_PM_SLEEP
226static int mma7660_suspend(struct device *dev)
227{
228 struct mma7660_data *data;
229
230 data = iio_priv(i2c_get_clientdata(to_i2c_client(dev)));
231
232 return mma7660_set_mode(data, MMA7660_MODE_STANDBY);
233}
234
235static int mma7660_resume(struct device *dev)
236{
237 struct mma7660_data *data;
238
239 data = iio_priv(i2c_get_clientdata(to_i2c_client(dev)));
240
241 return mma7660_set_mode(data, MMA7660_MODE_ACTIVE);
242}
243
225static int mma7660_suspend(struct device *dev)
226{
227 struct mma7660_data *data;
228
229 data = iio_priv(i2c_get_clientdata(to_i2c_client(dev)));
230
231 return mma7660_set_mode(data, MMA7660_MODE_STANDBY);
232}
233
234static int mma7660_resume(struct device *dev)
235{
236 struct mma7660_data *data;
237
238 data = iio_priv(i2c_get_clientdata(to_i2c_client(dev)));
239
240 return mma7660_set_mode(data, MMA7660_MODE_ACTIVE);
241}
242
244static SIMPLE_DEV_PM_OPS(mma7660_pm_ops, mma7660_suspend, mma7660_resume);
243static DEFINE_SIMPLE_DEV_PM_OPS(mma7660_pm_ops, mma7660_suspend,
244 mma7660_resume);
245
245
246#define MMA7660_PM_OPS (&mma7660_pm_ops)
247#else
248#define MMA7660_PM_OPS NULL
249#endif
250
251static const struct i2c_device_id mma7660_i2c_id[] = {
252 {"mma7660", 0},
253 {}
254};
255MODULE_DEVICE_TABLE(i2c, mma7660_i2c_id);
256
257static const struct of_device_id mma7660_of_match[] = {
258 { .compatible = "fsl,mma7660" },

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

265 {}
266};
267
268MODULE_DEVICE_TABLE(acpi, mma7660_acpi_id);
269
270static struct i2c_driver mma7660_driver = {
271 .driver = {
272 .name = "mma7660",
246static const struct i2c_device_id mma7660_i2c_id[] = {
247 {"mma7660", 0},
248 {}
249};
250MODULE_DEVICE_TABLE(i2c, mma7660_i2c_id);
251
252static const struct of_device_id mma7660_of_match[] = {
253 { .compatible = "fsl,mma7660" },

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

260 {}
261};
262
263MODULE_DEVICE_TABLE(acpi, mma7660_acpi_id);
264
265static struct i2c_driver mma7660_driver = {
266 .driver = {
267 .name = "mma7660",
273 .pm = MMA7660_PM_OPS,
268 .pm = pm_sleep_ptr(&mma7660_pm_ops),
274 .of_match_table = mma7660_of_match,
275 .acpi_match_table = ACPI_PTR(mma7660_acpi_id),
276 },
277 .probe = mma7660_probe,
278 .remove = mma7660_remove,
279 .id_table = mma7660_i2c_id,
280};
281
282module_i2c_driver(mma7660_driver);
283
284MODULE_AUTHOR("Constantin Musca <constantin.musca@intel.com>");
285MODULE_DESCRIPTION("Freescale MMA7660FC 3-Axis Accelerometer driver");
286MODULE_LICENSE("GPL v2");
269 .of_match_table = mma7660_of_match,
270 .acpi_match_table = ACPI_PTR(mma7660_acpi_id),
271 },
272 .probe = mma7660_probe,
273 .remove = mma7660_remove,
274 .id_table = mma7660_i2c_id,
275};
276
277module_i2c_driver(mma7660_driver);
278
279MODULE_AUTHOR("Constantin Musca <constantin.musca@intel.com>");
280MODULE_DESCRIPTION("Freescale MMA7660FC 3-Axis Accelerometer driver");
281MODULE_LICENSE("GPL v2");