al3010.c (4b4193256c8d3bc3a5397b5cd9494c2ad386317d) | al3010.c (dc064f21ea80af2c372e2150f416de07f6461ac2) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * AL3010 - Dyna Image Ambient Light Sensor 4 * 5 * Copyright (c) 2014, Intel Corporation. 6 * Copyright (c) 2016, Dyna-Image Corp. 7 * Copyright (c) 2020, David Heidelberg, Michał Mirosław, Dmitry Osipenko 8 * --- 186 unchanged lines hidden (view full) --- 195 al3010_set_pwr_off, 196 data); 197 if (ret < 0) 198 return ret; 199 200 return devm_iio_device_register(&client->dev, indio_dev); 201} 202 | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * AL3010 - Dyna Image Ambient Light Sensor 4 * 5 * Copyright (c) 2014, Intel Corporation. 6 * Copyright (c) 2016, Dyna-Image Corp. 7 * Copyright (c) 2020, David Heidelberg, Michał Mirosław, Dmitry Osipenko 8 * --- 186 unchanged lines hidden (view full) --- 195 al3010_set_pwr_off, 196 data); 197 if (ret < 0) 198 return ret; 199 200 return devm_iio_device_register(&client->dev, indio_dev); 201} 202 |
203static int __maybe_unused al3010_suspend(struct device *dev) | 203static int al3010_suspend(struct device *dev) |
204{ 205 return al3010_set_pwr(to_i2c_client(dev), false); 206} 207 | 204{ 205 return al3010_set_pwr(to_i2c_client(dev), false); 206} 207 |
208static int __maybe_unused al3010_resume(struct device *dev) | 208static int al3010_resume(struct device *dev) |
209{ 210 return al3010_set_pwr(to_i2c_client(dev), true); 211} 212 | 209{ 210 return al3010_set_pwr(to_i2c_client(dev), true); 211} 212 |
213static SIMPLE_DEV_PM_OPS(al3010_pm_ops, al3010_suspend, al3010_resume); | 213static DEFINE_SIMPLE_DEV_PM_OPS(al3010_pm_ops, al3010_suspend, al3010_resume); |
214 215static const struct i2c_device_id al3010_id[] = { 216 {"al3010", }, 217 {} 218}; 219MODULE_DEVICE_TABLE(i2c, al3010_id); 220 221static const struct of_device_id al3010_of_match[] = { 222 { .compatible = "dynaimage,al3010", }, 223 {}, 224}; 225MODULE_DEVICE_TABLE(of, al3010_of_match); 226 227static struct i2c_driver al3010_driver = { 228 .driver = { 229 .name = AL3010_DRV_NAME, 230 .of_match_table = al3010_of_match, | 214 215static const struct i2c_device_id al3010_id[] = { 216 {"al3010", }, 217 {} 218}; 219MODULE_DEVICE_TABLE(i2c, al3010_id); 220 221static const struct of_device_id al3010_of_match[] = { 222 { .compatible = "dynaimage,al3010", }, 223 {}, 224}; 225MODULE_DEVICE_TABLE(of, al3010_of_match); 226 227static struct i2c_driver al3010_driver = { 228 .driver = { 229 .name = AL3010_DRV_NAME, 230 .of_match_table = al3010_of_match, |
231 .pm = &al3010_pm_ops, | 231 .pm = pm_sleep_ptr(&al3010_pm_ops), |
232 }, 233 .probe = al3010_probe, 234 .id_table = al3010_id, 235}; 236module_i2c_driver(al3010_driver); 237 238MODULE_AUTHOR("Daniel Baluta <daniel.baluta@nxp.com>"); 239MODULE_AUTHOR("David Heidelberg <david@ixit.cz>"); 240MODULE_DESCRIPTION("AL3010 Ambient Light Sensor driver"); 241MODULE_LICENSE("GPL v2"); | 232 }, 233 .probe = al3010_probe, 234 .id_table = al3010_id, 235}; 236module_i2c_driver(al3010_driver); 237 238MODULE_AUTHOR("Daniel Baluta <daniel.baluta@nxp.com>"); 239MODULE_AUTHOR("David Heidelberg <david@ixit.cz>"); 240MODULE_DESCRIPTION("AL3010 Ambient Light Sensor driver"); 241MODULE_LICENSE("GPL v2"); |