diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2023-02-25 15:01:32 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2023-02-25 15:01:32 -0800 |
commit | 60e2bf7d10e9cd5641f4a5183a19058d9a2c8782 (patch) | |
tree | 93f8015c5b8c081293419931777cc4c8814508b1 /drivers/input | |
parent | 116b41162f8b267987ea9a73eb7e73eaa7c2cce5 (diff) | |
parent | 7ae9fb1b7ecbb5d85d07857943f677fd1a559b18 (diff) |
Merge tag 'input-for-v6.3-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input updates from Dmitry Torokhov:
- a set of tweaks to iqs269a touch controller driver
- a fix for ads7846 driver to properly handle 7845 chip
- cap11xx driver will support cap1203, cap1293 and cap1298 models
- xpad driver will support 8BitDo Pro 2 Wired Controller
- input drivers have been switched to DEFINE_SIMPLE_DEV_PM_OPS() and
pm_sleep_ptr()
- other miscellaneous fixes and tweaks
* tag 'input-for-v6.3-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (113 commits)
dt-bindings: input: iqs626a: Redefine trackpad property types
Input: iqs626a - drop unused device node references
dt-bindings: input: touchscreen: st,stmfts: convert to dtschema
Input: cyttsp5 - fix bitmask for touch buttons
Input: exc3000 - properly stop timer on shutdown
Input: synaptics-rmi4 - fix SPI device ID
Input: cap11xx - add support for cap1203, cap1293 and cap1298
dt-bindings: input: microchip,cap11xx: add cap1203, cap1293 and cap1298
Input: pmic8xxx-keypad - fix a Kconfig spelling mistake & hyphenation
Input: edt-ft5x06 - fix typo in a comment
Input: tegra-kbc - use devm_platform_get_and_ioremap_resource()
Input: st-keyscan - use devm_platform_get_and_ioremap_resource()
Input: spear-keyboard - use devm_platform_get_and_ioremap_resource()
Input: olpc_apsp - use devm_platform_get_and_ioremap_resource()
Input: arc_ps2 - use devm_platform_get_and_ioremap_resource()
Input: apbps2 - use devm_platform_get_and_ioremap_resource()
Input: altera_ps2 - use devm_platform_get_and_ioremap_resource()
Input: ads7846 - don't check penirq immediately for 7845
Input: ads7846 - always set last command to PWRDOWN
Input: ads7846 - don't report pressure for ads7845
...
Diffstat (limited to 'drivers/input')
111 files changed, 665 insertions, 815 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c index 0336e799d713..37e876d45eb9 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -19,6 +19,7 @@ #include <linux/proc_fs.h> #include <linux/sched.h> #include <linux/seq_file.h> +#include <linux/pm.h> #include <linux/poll.h> #include <linux/device.h> #include <linux/kstrtox.h> @@ -1828,7 +1829,6 @@ out: return ret; } -#ifdef CONFIG_PM_SLEEP static int input_dev_suspend(struct device *dev) { struct input_dev *input_dev = to_input_dev(dev); @@ -1903,15 +1903,12 @@ static const struct dev_pm_ops input_dev_pm_ops = { .poweroff = input_dev_poweroff, .restore = input_dev_resume, }; -#endif /* CONFIG_PM */ static const struct device_type input_dev_type = { .groups = input_dev_attr_groups, .release = input_dev_release, .uevent = input_dev_uevent, -#ifdef CONFIG_PM_SLEEP - .pm = &input_dev_pm_ops, -#endif + .pm = pm_sleep_ptr(&input_dev_pm_ops), }; static char *input_devnode(const struct device *dev, umode_t *mode) diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 2959d80f7fdb..f642ec8e92dd 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -359,6 +359,7 @@ static const struct xpad_device { { 0x24c6, 0xfafe, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, { 0x2563, 0x058d, "OneXPlayer Gamepad", 0, XTYPE_XBOX360 }, { 0x2dc8, 0x2000, "8BitDo Pro 2 Wired Controller fox Xbox", 0, XTYPE_XBOXONE }, + { 0x2dc8, 0x3106, "8BitDo Pro 2 Wired Controller", 0, XTYPE_XBOX360 }, { 0x31e3, 0x1100, "Wooting One", 0, XTYPE_XBOX360 }, { 0x31e3, 0x1200, "Wooting Two", 0, XTYPE_XBOX360 }, { 0x31e3, 0x1210, "Wooting Lekker", 0, XTYPE_XBOX360 }, @@ -492,6 +493,7 @@ static const struct usb_device_id xpad_table[] = { XPAD_XBOXONE_VENDOR(0x24c6), /* PowerA Controllers */ XPAD_XBOX360_VENDOR(0x2563), /* OneXPlayer Gamepad */ XPAD_XBOX360_VENDOR(0x260d), /* Dareu H101 */ + XPAD_XBOX360_VENDOR(0x2dc8), /* 8BitDo Pro 2 Wired Controller */ XPAD_XBOXONE_VENDOR(0x2dc8), /* 8BitDo Pro 2 Wired Controller for Xbox */ XPAD_XBOXONE_VENDOR(0x2e24), /* Hyperkin Duke X-Box One pad */ XPAD_XBOX360_VENDOR(0x2f24), /* GameSir Controllers */ diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index d98650426dc2..1d0c5f4c0f99 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig @@ -557,7 +557,7 @@ config KEYBOARD_PMIC8XXX help Say Y here if you want to enable the driver for the PMIC8XXX keypad provided as a reference design from Qualcomm. This is intended - to support upto 18x8 matrix based keypad design. + to support up to 18x8 matrix-based keypad design. To compile this driver as a module, choose M here: the module will be called pmic8xxx-keypad. diff --git a/drivers/input/keyboard/applespi.c b/drivers/input/keyboard/applespi.c index 91a9810f6980..cf25177b4830 100644 --- a/drivers/input/keyboard/applespi.c +++ b/drivers/input/keyboard/applespi.c @@ -1876,7 +1876,7 @@ static int applespi_poweroff_late(struct device *dev) return 0; } -static int __maybe_unused applespi_suspend(struct device *dev) +static int applespi_suspend(struct device *dev) { struct spi_device *spi = to_spi_device(dev); struct applespi_data *applespi = spi_get_drvdata(spi); @@ -1903,7 +1903,7 @@ static int __maybe_unused applespi_suspend(struct device *dev) return 0; } -static int __maybe_unused applespi_resume(struct device *dev) +static int applespi_resume(struct device *dev) { struct spi_device *spi = to_spi_device(dev); struct applespi_data *applespi = spi_get_drvdata(spi); @@ -1947,15 +1947,15 @@ static const struct acpi_device_id applespi_acpi_match[] = { MODULE_DEVICE_TABLE(acpi, applespi_acpi_match); static const struct dev_pm_ops applespi_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(applespi_suspend, applespi_resume) - .poweroff_late = applespi_poweroff_late, + SYSTEM_SLEEP_PM_OPS(applespi_suspend, applespi_resume) + .poweroff_late = pm_sleep_ptr(applespi_poweroff_late), }; static struct spi_driver applespi_driver = { .driver = { .name = "applespi", .acpi_match_table = applespi_acpi_match, - .pm = &applespi_pm_ops, + .pm = pm_sleep_ptr(&applespi_pm_ops), }, .probe = applespi_probe, .remove = applespi_remove, diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c index 79afd0386e3f..040696d0e49c 100644 --- a/drivers/input/keyboard/cap11xx.c +++ b/drivers/input/keyboard/cap11xx.c @@ -98,14 +98,20 @@ enum { CAP1106, CAP1126, CAP1188, + CAP1203, CAP1206, + CAP1293, + CAP1298 }; static const struct cap11xx_hw_model cap11xx_devices[] = { [CAP1106] = { .product_id = 0x55, .num_channels = 6, .num_leds = 0, .no_gain = false }, [CAP1126] = { .product_id = 0x53, .num_channels = 6, .num_leds = 2, .no_gain = false }, [CAP1188] = { .product_id = 0x50, .num_channels = 8, .num_leds = 8, .no_gain = false }, + [CAP1203] = { .product_id = 0x6d, .num_channels = 3, .num_leds = 0, .no_gain = true }, [CAP1206] = { .product_id = 0x67, .num_channels = 6, .num_leds = 0, .no_gain = true }, + [CAP1293] = { .product_id = 0x6f, .num_channels = 3, .num_leds = 0, .no_gain = false }, + [CAP1298] = { .product_id = 0x71, .num_channels = 8, .num_leds = 0, .no_gain = false }, }; static const struct reg_default cap11xx_reg_defaults[] = { @@ -377,7 +383,8 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client) if (error < 0) return error; - dev_info(dev, "CAP11XX detected, revision 0x%02x\n", rev); + dev_info(dev, "CAP11XX detected, model %s, revision 0x%02x\n", + id->name, rev); node = dev->of_node; if (!of_property_read_u32(node, "microchip,sensor-gain", &gain32)) { @@ -390,7 +397,9 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client) dev_err(dev, "Invalid sensor-gain value %d\n", gain32); } - if (id->driver_data != CAP1206) { + if (id->driver_data == CAP1106 || + id->driver_data == CAP1126 || + id->driver_data == CAP1188) { if (of_property_read_bool(node, "microchip,irq-active-high")) { error = regmap_update_bits(priv->regmap, CAP11XX_REG_CONFIG2, @@ -483,7 +492,10 @@ static const struct of_device_id cap11xx_dt_ids[] = { { .compatible = "microchip,cap1106", }, { .compatible = "microchip,cap1126", }, { .compatible = "microchip,cap1188", }, + { .compatible = "microchip,cap1203", }, { .compatible = "microchip,cap1206", }, + { .compatible = "microchip,cap1293", }, + { .compatible = "microchip,cap1298", }, {} }; MODULE_DEVICE_TABLE(of, cap11xx_dt_ids); @@ -492,7 +504,10 @@ static const struct i2c_device_id cap11xx_i2c_ids[] = { { "cap1106", CAP1106 }, { "cap1126", CAP1126 }, { "cap1188", CAP1188 }, + { "cap1203", CAP1203 }, { "cap1206", CAP1206 }, + { "cap1293", CAP1293 }, + { "cap1298", CAP1298 }, {} }; MODULE_DEVICE_TABLE(i2c, cap11xx_i2c_ids); diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c index 6f435125ec03..e7ecfca838df 100644 --- a/drivers/input/keyboard/cros_ec_keyb.c +++ b/drivers/input/keyboard/cros_ec_keyb.c @@ -100,6 +100,21 @@ static const struct cros_ec_bs_map cros_ec_keyb_bs[] = { .code = KEY_VOLUMEDOWN, .bit = EC_MKBP_VOL_DOWN, }, + { + .ev_type = EV_KEY, + .code = KEY_BRIGHTNESSUP, + .bit = EC_MKBP_BRI_UP, + }, + { + .ev_type = EV_KEY, + .code = KEY_BRIGHTNESSDOWN, + .bit = EC_MKBP_BRI_DOWN, + }, + { + .ev_type = EV_KEY, + .code = KEY_SCREENLOCK, + .bit = EC_MKBP_SCREEN_LOCK, + }, /* Switches */ { diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c index ee9d04a3f0d5..4426120398b0 100644 --- a/drivers/input/keyboard/omap4-keypad.c +++ b/drivers/input/keyboard/omap4-keypad.c @@ -310,7 +310,7 @@ static int omap4_keypad_check_revision(struct device *dev, * Interrupt may not happen for key-up events. We must clear stuck * key-up events after the keyboard hardware has auto-idled. */ -static int __maybe_unused omap4_keypad_runtime_suspend(struct device *dev) +static int omap4_keypad_runtime_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct omap4_keypad *keypad_data = platform_get_drvdata(pdev); @@ -328,7 +328,7 @@ static int __maybe_unused omap4_keypad_runtime_suspend(struct device *dev) } static const struct dev_pm_ops omap4_keypad_pm_ops = { - SET_RUNTIME_PM_OPS(omap4_keypad_runtime_suspend, NULL, NULL) + RUNTIME_PM_OPS(omap4_keypad_runtime_suspend, NULL, NULL) }; static void omap4_disable_pm(void *d) @@ -488,7 +488,7 @@ static struct platform_driver omap4_keypad_driver = { .driver = { .name = "omap4-keypad", .of_match_table = omap_keypad_dt_match, - .pm = &omap4_keypad_pm_ops, + .pm = pm_ptr(&omap4_keypad_pm_ops), }, }; module_platform_driver(omap4_keypad_driver); diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c index df0258dcf89e..09e883ea1352 100644 --- a/drivers/input/keyboard/samsung-keypad.c +++ b/drivers/input/keyboard/samsung-keypad.c @@ -458,7 +458,6 @@ static int samsung_keypad_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM static int samsung_keypad_runtime_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); @@ -503,9 +502,7 @@ static int samsung_keypad_runtime_resume(struct device *dev) return 0; } -#endif -#ifdef CONFIG_PM_SLEEP static void samsung_keypad_toggle_wakeup(struct samsung_keypad *keypad, bool enable) { @@ -563,12 +560,11 @@ static int samsung_keypad_resume(struct device *dev) return 0; } -#endif static const struct dev_pm_ops samsung_keypad_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(samsung_keypad_suspend, samsung_keypad_resume) - SET_RUNTIME_PM_OPS(samsung_keypad_runtime_suspend, - samsung_keypad_runtime_resume, NULL) + SYSTEM_SLEEP_PM_OPS(samsung_keypad_suspend, samsung_keypad_resume) + RUNTIME_PM_OPS(samsung_keypad_runtime_suspend, + samsung_keypad_runtime_resume, NULL) }; #ifdef CONFIG_OF @@ -598,7 +594,7 @@ static struct platform_driver samsung_keypad_driver = { .driver = { .name = "samsung-keypad", .of_match_table = of_match_ptr(samsung_keypad_dt_match), - .pm = &samsung_keypad_pm_ops, + .pm = pm_ptr(&samsung_keypad_pm_ops), }, .id_table = samsung_keypad_driver_ids, }; diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c index 4bb7c533147c..a50fa9915381 100644 --- a/drivers/input/keyboard/spear-keyboard.c +++ b/drivers/input/keyboard/spear-keyboard.c @@ -186,7 +186,6 @@ static int spear_kbd_probe(struct platform_device *pdev) const struct matrix_keymap_data *keymap = pdata ? pdata->keymap : NULL; struct spear_kbd *kbd; struct input_dev *input_dev; - struct resource *res; int irq; int error; @@ -219,8 +218,7 @@ static int spear_kbd_probe(struct platform_device *pdev) kbd->suspended_rate = pdata->suspended_rate; } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - kbd->io_base = devm_ioremap_resource(&pdev->dev, res); + kbd->io_base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); if (IS_ERR(kbd->io_base)) return PTR_ERR(kbd->io_base); diff --git a/drivers/input/keyboard/st-keyscan.c b/drivers/input/keyboard/st-keyscan.c index 13735a5e8391..b6e83324f97a 100644 --- a/drivers/input/keyboard/st-keyscan.c +++ b/drivers/input/keyboard/st-keyscan.c @@ -125,7 +125,6 @@ static int keyscan_probe(struct platform_device *pdev) { struct st_keyscan *keypad_data; struct input_dev *input_dev; - struct resource *res; int error; if (!pdev->dev.of_node) { @@ -169,8 +168,7 @@ static int keyscan_probe(struct platform_device *pdev) input_set_drvdata(input_dev, keypad_data); - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - keypad_data->base = devm_ioremap_resource(&pdev->dev, res); + keypad_data->base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); if (IS_ERR(keypad_data->base)) return PTR_ERR(keypad_data->base); diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c index 1eba06bcf27a..da4019cf0c83 100644 --- a/drivers/input/keyboard/tegra-kbc.c +++ b/drivers/input/keyboard/tegra-kbc.c @@ -598,7 +598,6 @@ MODULE_DEVICE_TABLE(of, tegra_kbc_of_match); static int tegra_kbc_probe(struct platform_device *pdev) { struct tegra_kbc *kbc; - struct resource *res; int err; int num_rows = 0; unsigned int debounce_cnt; @@ -642,8 +641,7 @@ static int tegra_kbc_probe(struct platform_device *pdev) timer_setup(&kbc->timer, tegra_kbc_keypress_timer, 0); - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - kbc->mmio = devm_ioremap_resource(&pdev->dev, res); + kbc->mmio = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); if (IS_ERR(kbc->mmio)) return PTR_ERR(kbc->mmio); diff --git a/drivers/input/misc/88pm860x_onkey.c b/drivers/input/misc/88pm860x_onkey.c index 685995cad73f..0f8b7ffb3aff 100644 --- a/drivers/input/misc/88pm860x_onkey.c +++ b/drivers/input/misc/88pm860x_onkey.c @@ -110,7 +110,7 @@ static int pm860x_onkey_probe(struct platform_device *pdev) return 0; } -static int __maybe_unused pm860x_onkey_suspend(struct device *dev) +static int pm860x_onkey_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); @@ -119,7 +119,7 @@ static int __maybe_unused pm860x_onkey_suspend(struct device *dev) chip->wakeup_flag |= 1 << PM8607_IRQ_ONKEY; return 0; } -static int __maybe_unused pm860x_onkey_resume(struct device *dev) +static int pm860x_onkey_resume(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); @@ -129,12 +129,13 @@ static int __maybe_unused pm860x_onkey_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(pm860x_onkey_pm_ops, pm860x_onkey_suspend, pm860x_onkey_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(pm860x_onkey_pm_ops, + pm860x_onkey_suspend, pm860x_onkey_resume); static struct platform_driver pm860x_onkey_driver = { .driver = { .name = "88pm860x-onkey", - .pm = &pm860x_onkey_pm_ops, + .pm = pm_sleep_ptr(&pm860x_onkey_pm_ops), }, .probe = pm860x_onkey_probe, }; diff --git a/drivers/input/misc/ad714x-i2c.c b/drivers/input/misc/ad714x-i2c.c index 5ef518a50e63..d8e39f4a57ac 100644 --- a/drivers/input/misc/ad714x-i2c.c +++ b/drivers/input/misc/ad714x-i2c.c @@ -12,18 +12,6 @@ #include <linux/pm.h> #include "ad714x.h" -static int __maybe_unused ad714x_i2c_suspend(struct device *dev) -{ - return ad714x_disable(i2c_get_clientdata(to_i2c_client(dev))); -} - -static int __maybe_unused ad714x_i2c_resume(struct device *dev) -{ - return ad714x_enable(i2c_get_clientdata(to_i2c_client(dev))); -} - -static SIMPLE_DEV_PM_OPS(ad714x_i2c_pm, ad714x_i2c_suspend, ad714x_i2c_resume); - static int ad714x_i2c_write(struct ad714x_chip *chip, unsigned short reg, unsigned short data) { @@ -96,7 +84,7 @@ MODULE_DEVICE_TABLE(i2c, ad714x_id); static struct i2c_driver ad714x_i2c_driver = { .driver = { .name = "ad714x_captouch", - .pm = &ad714x_i2c_pm, + .pm = pm_sleep_ptr(&ad714x_pm), }, .probe_new = ad714x_i2c_probe, .id_table = ad714x_id, diff --git a/drivers/input/misc/ad714x-spi.c b/drivers/input/misc/ad714x-spi.c index 7d3bf434620f..eb13b4cd6594 100644 --- a/drivers/input/misc/ad714x-spi.c +++ b/drivers/input/misc/ad714x-spi.c @@ -15,18 +15,6 @@ #define AD714x_SPI_CMD_PREFIX 0xE000 /* bits 15:11 */ #define AD714x_SPI_READ BIT(10) -static int __maybe_unused ad714x_spi_suspend(struct device *dev) -{ - return ad714x_disable(spi_get_drvdata(to_spi_device(dev))); -} - -static int __maybe_unused ad714x_spi_resume(struct device *dev) -{ - return ad714x_enable(spi_get_drvdata(to_spi_device(dev))); -} - -static SIMPLE_DEV_PM_OPS(ad714x_spi_pm, ad714x_spi_suspend, ad714x_spi_resume); - static int ad714x_spi_read(struct ad714x_chip *chip, unsigned short reg, unsigned short *data, size_t len) { @@ -103,7 +91,7 @@ static int ad714x_spi_probe(struct spi_device *spi) static struct spi_driver ad714x_spi_driver = { .driver = { .name = "ad714x_captouch", - .pm = &ad714x_spi_pm, + .pm = pm_sleep_ptr(&ad714x_pm), }, .probe = ad714x_spi_probe, }; diff --git a/drivers/input/misc/ad714x.c b/drivers/input/misc/ad714x.c index 43132d98feda..1acd8429c56c 100644 --- a/drivers/input/misc/ad714x.c +++ b/drivers/input/misc/ad714x.c @@ -1162,9 +1162,9 @@ struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq, } EXPORT_SYMBOL(ad714x_probe); -#ifdef CONFIG_PM -int ad714x_disable(struct ad714x_chip *ad714x) +static int ad714x_suspend(struct device *dev) { + struct ad714x_chip *ad714x = dev_get_drvdata(dev); unsigned short data; dev_dbg(ad714x->dev, "%s enter\n", __func__); @@ -1178,10 +1178,10 @@ int ad714x_disable(struct ad714x_chip *ad714x) return 0; } -EXPORT_SYMBOL(ad714x_disable); -int ad714x_enable(struct ad714x_chip *ad714x) +static int ad714x_resume(struct device *dev) { + struct ad714x_chip *ad714x = dev_get_drvdata(dev); dev_dbg(ad714x->dev, "%s enter\n", __func__); mutex_lock(&ad714x->mutex); @@ -1201,8 +1201,8 @@ int ad714x_enable(struct ad714x_chip *ad714x) return 0; } -EXPORT_SYMBOL(ad714x_enable); -#endif + +EXPORT_SIMPLE_DEV_PM_OPS(ad714x_pm, ad714x_suspend, ad714x_resume); MODULE_DESCRIPTION("Analog Devices AD714X Capacitance Touch Sensor Driver"); MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); diff --git a/drivers/input/misc/ad714x.h b/drivers/input/misc/ad714x.h index af847b5f0d0e..dafa12325f27 100644 --- a/drivers/input/misc/ad714x.h +++ b/drivers/input/misc/ad714x.h @@ -8,6 +8,7 @@ #ifndef _AD714X_H_ #define _AD714X_H_ +#include <linux/pm.h> #include <linux/types.h> #define STAGE_NUM 12 @@ -45,8 +46,7 @@ struct ad714x_chip { }; -int ad714x_disable(struct ad714x_chip *ad714x); -int ad714x_enable(struct ad714x_chip *ad714x); +extern const struct dev_pm_ops ad714x_pm; struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq, ad714x_read_t read, ad714x_write_t write); diff --git a/drivers/input/misc/adxl34x-i2c.c b/drivers/input/misc/adxl34x-i2c.c index a8ceea36d80a..1c75d98c85a7 100644 --- a/drivers/input/misc/adxl34x-i2c.c +++ b/drivers/input/misc/adxl34x-i2c.c @@ -105,29 +105,6 @@ static void adxl34x_i2c_remove(struct i2c_client *client) adxl34x_remove(ac); } -static int __maybe_unused adxl34x_i2c_suspend(struct device *dev) -{ - struct i2c_client *client = to_i2c_client(dev); - struct adxl34x *ac = i2c_get_clientdata(client); - - adxl34x_suspend(ac); - - return 0; -} - -static int __maybe_unused adxl34x_i2c_resume(struct device *dev) -{ - struct i2c_client *client = to_i2c_client(dev); - struct adxl34x *ac = i2c_get_clientdata(client); - - adxl34x_resume(ac); - - return 0; -} - -static SIMPLE_DEV_PM_OPS(adxl34x_i2c_pm, adxl34x_i2c_suspend, - adxl34x_i2c_resume); - static const struct i2c_device_id adxl34x_id[] = { { "adxl34x", 0 }, { } @@ -155,7 +132,7 @@ MODULE_DEVICE_TABLE(of, adxl34x_of_id); static struct i2c_driver adxl34x_driver = { .driver = { .name = "adxl34x", - .pm = &adxl34x_i2c_pm, + .pm = pm_sleep_ptr(&adxl34x_pm), .of_match_table = adxl34x_of_id, }, .probe_new = adxl34x_i2c_probe, diff --git a/drivers/input/misc/adxl34x-spi.c b/drivers/input/misc/adxl34x-spi.c index 91e44d4c66f7..f1094a8ccdd5 100644 --- a/drivers/input/misc/adxl34x-spi.c +++ b/drivers/input/misc/adxl34x-spi.c @@ -94,33 +94,10 @@ static void adxl34x_spi_remove(struct spi_device *spi) adxl34x_remove(ac); } -static int __maybe_unused adxl34x_spi_suspend(struct device *dev) -{ - struct spi_device *spi = to_spi_device(dev); - struct adxl34x *ac = spi_get_drvdata(spi); - - adxl34x_suspend(ac); - - return 0; -} - -static int __maybe_unused adxl34x_spi_resume(struct device *dev) -{ - struct spi_device *spi = to_spi_device(dev); - struct adxl34x *ac = spi_get_drvdata(spi); - - adxl34x_resume(ac); - - return 0; -} - -static SIMPLE_DEV_PM_OPS(adxl34x_spi_pm, adxl34x_spi_suspend, - adxl34x_spi_resume); - static struct spi_driver adxl34x_driver = { .driver = { .name = "adxl34x", - .pm = &adxl34x_spi_pm, + .pm = pm_sleep_ptr(&adxl34x_pm), }, .probe = adxl34x_spi_probe, .remove = adxl34x_spi_remove, diff --git a/drivers/input/misc/adxl34x.c b/drivers/input/misc/adxl34x.c index a4af314392a9..eecca671b588 100644 --- a/drivers/input/misc/adxl34x.c +++ b/drivers/input/misc/adxl34x.c @@ -412,8 +412,10 @@ static void __adxl34x_enable(struct adxl34x *ac) AC_WRITE(ac, POWER_CTL, ac->pdata.power_mode | PCTL_MEASURE); } -void adxl34x_suspend(struct adxl34x *ac) +static int adxl34x_suspend(struct device *dev) { + struct adxl34x *ac = dev_get_drvdata(dev); + mutex_lock(&ac->mutex); if (!ac->suspended && !ac->disabled && ac->opened) @@ -422,11 +424,14 @@ void adxl34x_suspend(struct adxl34x *ac) ac->suspended = true; mutex_unlock(&ac->mutex); + + return 0; } -EXPORT_SYMBOL_GPL(adxl34x_suspend); -void adxl34x_resume(struct adxl34x *ac) +static int adxl34x_resume(struct device *dev) { + struct adxl34x *ac = dev_get_drvdata(dev); + mutex_lock(&ac->mutex); if (ac->suspended && !ac->disabled && ac->opened) @@ -435,8 +440,9 @@ void adxl34x_resume(struct adxl34x *ac) ac->suspended = false; mutex_unlock(&ac->mutex); + + return 0; } -EXPORT_SYMBOL_GPL(adxl34x_resume); static ssize_t adxl34x_disable_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -906,6 +912,8 @@ void adxl34x_remove(struct adxl34x *ac) } EXPORT_SYMBOL_GPL(adxl34x_remove); +EXPORT_GPL_SIMPLE_DEV_PM_OPS(adxl34x_pm, adxl34x_suspend, adxl34x_resume); + MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); MODULE_DESCRIPTION("ADXL345/346 Three-Axis Digital Accelerometer Driver"); MODULE_LICENSE("GPL"); diff --git a/drivers/input/misc/adxl34x.h b/drivers/input/misc/adxl34x.h index febf85270fff..f9272a2e7a96 100644 --- a/drivers/input/misc/adxl34x.h +++ b/drivers/input/misc/adxl34x.h @@ -20,11 +20,11 @@ struct adxl34x_bus_ops { int (*write)(struct device *, unsigned char, unsigned char); }; -void adxl34x_suspend(struct adxl34x *ac); -void adxl34x_resume(struct adxl34x *ac); struct adxl34x *adxl34x_probe(struct device *dev, int irq, bool fifo_delay_default, const struct adxl34x_bus_ops *bops); void adxl34x_remove(struct adxl34x *ac); +extern const struct dev_pm_ops adxl34x_pm; + #endif diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c index 04da7916eb70..4581606a28d6 100644 --- a/drivers/input/misc/axp20x-pek.c +++ b/drivers/input/misc/axp20x-pek.c @@ -336,7 +336,7 @@ static int axp20x_pek_probe(struct platform_device *pdev) return 0; } -static int __maybe_unused axp20x_pek_suspend(struct device *dev) +static int axp20x_pek_suspend(struct device *dev) { struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev); @@ -355,7 +355,7 @@ static int __maybe_unused axp20x_pek_suspend(struct device *dev) return 0; } -static int __maybe_unused axp20x_pek_resume(struct device *dev) +static int axp20x_pek_resume(struct device *dev) { struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev); @@ -389,10 +389,8 @@ static int __maybe_unused axp20x_pek_resume_noirq(struct device *dev) } static const struct dev_pm_ops axp20x_pek_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(axp20x_pek_suspend, axp20x_pek_resume) -#ifdef CONFIG_PM_SLEEP - .resume_noirq = axp20x_pek_resume_noirq, -#endif + SYSTEM_SLEEP_PM_OPS(axp20x_pek_suspend, axp20x_pek_resume) + .resume_noirq = pm_sleep_ptr(axp20x_pek_resume_noirq), }; static const struct platform_device_id axp_pek_id_match[] = { @@ -413,7 +411,7 @@ static struct platform_driver axp20x_pek_driver = { .id_table = axp_pek_id_match, .driver = { .name = "axp20x-pek", - .pm = &axp20x_pek_pm_ops, + .pm = pm_sleep_ptr(&axp20x_pek_pm_ops), .dev_groups = axp20x_groups, }, }; diff --git a/drivers/input/misc/cma3000_d0x_i2c.c b/drivers/input/misc/cma3000_d0x_i2c.c index 75442c1230b1..136eb3715870 100644 --- a/drivers/input/misc/cma3000_d0x_i2c.c +++ b/drivers/input/misc/cma3000_d0x_i2c.c @@ -64,7 +64,6 @@ static void cma3000_i2c_remove(struct i2c_client *client) cma3000_exit(data); } -#ifdef CONFIG_PM static int cma3000_i2c_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -89,7 +88,6 @@ static const struct dev_pm_ops cma3000_i2c_pm_ops = { .suspend = cma3000_i2c_suspend, .resume = cma3000_i2c_resume, }; -#endif static const struct i2c_device_id cma3000_i2c_id[] = { { "cma3000_d01", 0 }, @@ -104,9 +102,7 @@ static struct i2c_driver cma3000_i2c_driver = { .id_table = cma3000_i2c_id, .driver = { .name = "cma3000_i2c_accl", -#ifdef CONFIG_PM - .pm = &cma3000_i2c_pm_ops, -#endif + .pm = pm_sleep_ptr(&cma3000_i2c_pm_ops), }, }; diff --git a/drivers/input/misc/da7280.c b/drivers/input/misc/da7280.c index dcdea33b1a8f..b85a19e3554f 100644 --- a/drivers/input/misc/da7280.c +++ b/drivers/input/misc/da7280.c @@ -1260,7 +1260,7 @@ static int da7280_probe(struct i2c_client *client) return 0; } -static int __maybe_unused da7280_suspend(struct device *dev) +static int da7280_suspend(struct device *dev) { struct da7280_haptic *haptics = dev_get_drvdata(dev); @@ -1281,7 +1281,7 @@ static int __maybe_unused da7280_suspend(struct device *dev) return 0; } -static int __maybe_unused da7280_resume(struct device *dev) +static int da7280_resume(struct device *dev) { struct da7280_haptic *haptics = dev_get_drvdata(dev); int retval; @@ -1313,13 +1313,13 @@ static const struct i2c_device_id da7280_i2c_id[] = { }; MODULE_DEVICE_TABLE(i2c, da7280_i2c_id); -static SIMPLE_DEV_PM_OPS(da7280_pm_ops, da7280_suspend, da7280_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(da7280_pm_ops, da7280_suspend, da7280_resume); static struct i2c_driver da7280_driver = { .driver = { .name = "da7280", .of_match_table = of_match_ptr(da7280_of_match), - .pm = &da7280_pm_ops, + .pm = pm_sleep_ptr(&da7280_pm_ops), }, .probe_new = da7280_probe, .id_table = da7280_i2c_id, diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c index 3a51ee5e935a..8a9ebfc04a2d 100644 --- a/drivers/input/misc/drv260x.c +++ b/drivers/input/misc/drv260x.c @@ -572,7 +572,7 @@ static int drv260x_probe(struct i2c_client *client) return 0; } -static int __maybe_unused drv260x_suspend(struct device *dev) +static int drv260x_suspend(struct device *dev) { struct drv260x_data *haptics = dev_get_drvdata(dev); int ret = 0; @@ -604,7 +604,7 @@ out: return ret; } -static int __maybe_unused drv260x_resume(struct device *dev) +static int drv260x_resume(struct device *dev) { struct drv260x_data *haptics = dev_get_drvdata(dev); int ret = 0; @@ -635,7 +635,7 @@ out: return ret; } -static SIMPLE_DEV_PM_OPS(drv260x_pm_ops, drv260x_suspend, drv260x_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(drv260x_pm_ops, drv260x_suspend, drv260x_resume); static const struct i2c_device_id drv260x_id[] = { { "drv2605l", 0 }, @@ -657,7 +657,7 @@ static struct i2c_driver drv260x_driver = { .driver = { .name = "drv260x-haptics", .of_match_table = drv260x_of_match, - .pm = &drv260x_pm_ops, + .pm = pm_sleep_ptr(&drv260x_pm_ops), }, .id_table = drv260x_id, }; diff --git a/drivers/input/misc/drv2665.c b/drivers/input/misc/drv2665.c index c2a2ff980c06..9145096f80ea 100644 --- a/drivers/input/misc/drv2665.c +++ b/drivers/input/misc/drv2665.c @@ -222,7 +222,7 @@ static int drv2665_probe(struct i2c_client *client) return 0; } -static int __maybe_unused drv2665_suspend(struct device *dev) +static int drv2665_suspend(struct device *dev) { struct drv2665_data *haptics = dev_get_drvdata(dev); int ret = 0; @@ -251,7 +251,7 @@ out: return ret; } -static int __maybe_unused drv2665_resume(struct device *dev) +static int drv2665_resume(struct device *dev) { struct drv2665_data *haptics = dev_get_drvdata(dev); int ret = 0; @@ -280,7 +280,7 @@ out: return ret; } -static SIMPLE_DEV_PM_OPS(drv2665_pm_ops, drv2665_suspend, drv2665_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(drv2665_pm_ops, drv2665_suspend, drv2665_resume); static const struct i2c_device_id drv2665_id[] = { { "drv2665", 0 }, @@ -301,7 +301,7 @@ static struct i2c_driver drv2665_driver = { .driver = { .name = "drv2665-haptics", .of_match_table = of_match_ptr(drv2665_of_match), - .pm = &drv2665_pm_ops, + .pm = pm_sleep_ptr(&drv2665_pm_ops), }, .id_table = drv2665_id, }; diff --git a/drivers/input/misc/drv2667.c b/drivers/input/misc/drv2667.c index da7ac63dce4c..88b4dbe3e5b5 100644 --- a/drivers/input/misc/drv2667.c +++ b/drivers/input/misc/drv2667.c @@ -399,7 +399,7 @@ static int drv2667_probe(struct i2c_client *client) return 0; } -static int __maybe_unused drv2667_suspend(struct device *dev) +static int drv2667_suspend(struct device *dev) { struct drv2667_data *haptics = dev_get_drvdata(dev); int ret = 0; @@ -428,7 +428,7 @@ out: return ret; } -static int __maybe_unused drv2667_resume(struct device *dev) +static int drv2667_resume(struct device *dev) { struct drv2667_data *haptics = dev_get_drvdata(dev); int ret = 0; @@ -457,7 +457,7 @@ out: return ret; } -static SIMPLE_DEV_PM_OPS(drv2667_pm_ops, drv2667_suspend, drv2667_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(drv2667_pm_ops, drv2667_suspend, drv2667_resume); static const struct i2c_device_id drv2667_id[] = { { "drv2667", 0 }, @@ -478,7 +478,7 @@ static struct i2c_driver drv2667_driver = { .driver = { .name = "drv2667-haptics", .of_match_table = of_match_ptr(drv2667_of_match), - .pm = &drv2667_pm_ops, + .pm = pm_sleep_ptr(&drv2667_pm_ops), }, .id_table = drv2667_id, }; diff --git a/drivers/input/misc/e3x0-button.c b/drivers/input/misc/e3x0-button.c index e2fde6e1553f..5bd527117470 100644 --- a/drivers/input/misc/e3x0-button.c +++ b/drivers/input/misc/e3x0-button.c @@ -35,7 +35,7 @@ static irqreturn_t e3x0_button_press_handler(int irq, void *data) return IRQ_HANDLED; } -static int __maybe_unused e3x0_button_suspend(struct device *dev) +static int e3x0_button_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); @@ -45,7 +45,7 @@ static int __maybe_unused e3x0_button_suspend(struct device *dev) return 0; } -static int __maybe_unused e3x0_button_resume(struct device *dev) +static int e3x0_button_resume(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); @@ -55,8 +55,8 @@ static int __maybe_unused e3x0_button_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(e3x0_button_pm_ops, - e3x0_button_suspend, e3x0_button_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(e3x0_button_pm_ops, + e3x0_button_suspend, e3x0_button_resume); static int e3x0_button_probe(struct platform_device *pdev) { @@ -122,7 +122,7 @@ static struct platform_driver e3x0_button_driver = { .driver = { .name = "e3x0-button", .of_match_table = of_match_ptr(e3x0_button_match), - .pm = &e3x0_button_pm_ops, + .pm = pm_sleep_ptr(&e3x0_button_pm_ops), }, .probe = e3x0_button_probe, }; diff --git a/drivers/input/misc/gpio-vibra.c b/drivers/input/misc/gpio-vibra.c index f79f75595dd7..134a1309ba92 100644 --- a/drivers/input/misc/gpio-vibra.c +++ b/drivers/input/misc/gpio-vibra.c @@ -157,7 +157,7 @@ static int gpio_vibrator_probe(struct platform_device *pdev) return 0; } -static int __maybe_unused gpio_vibrator_suspend(struct device *dev) +static int gpio_vibrator_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct gpio_vibrator *vibrator = platform_get_drvdata(pdev); @@ -169,7 +169,7 @@ static int __maybe_unused gpio_vibrator_suspend(struct device *dev) return 0; } -static int __maybe_unused gpio_vibrator_resume(struct device *dev) +static int gpio_vibrator_resume(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct gpio_vibrator *vibrator = platform_get_drvdata(pdev); @@ -180,8 +180,8 @@ static int __maybe_unused gpio_vibrator_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(gpio_vibrator_pm_ops, - gpio_vibrator_suspend, gpio_vibrator_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(gpio_vibrator_pm_ops, + gpio_vibrator_suspend, gpio_vibrator_resume); #ifdef CONFIG_OF static const struct of_device_id gpio_vibra_dt_match_table[] = { @@ -195,7 +195,7 @@ static struct platform_driver gpio_vibrator_driver = { .probe = gpio_vibrator_probe, .driver = { .name = "gpio-vibrator", - .pm = &gpio_vibrator_pm_ops, + .pm = pm_sleep_ptr(&gpio_vibrator_pm_ops), .of_match_table = of_match_ptr(gpio_vibra_dt_match_table), }, }; diff --git a/drivers/input/misc/iqs269a.c b/drivers/input/misc/iqs269a.c index a348247d3d38..f4c3aff3895b 100644 --- a/drivers/input/misc/iqs269a.c +++ b/drivers/input/misc/iqs269a.c @@ -9,6 +9,7 @@ * axial sliders presented by the device. */ +#include <linux/completion.h> #include <linux/delay.h> #include <linux/device.h> #include <linux/err.h> @@ -96,8 +97,6 @@ #define IQS269_MISC_B_TRACKING_UI_ENABLE BIT(4) #define IQS269_MISC_B_FILT_STR_SLIDER GENMASK(1, 0) -#define IQS269_CHx_SETTINGS 0x8C - #define IQS269_CHx_ENG_A_MEAS_CAP_SIZE BIT(15) #define IQS269_CHx_ENG_A_RX_GND_INACTIVE BIT(13) #define IQS269_CHx_ENG_A_LOCAL_CAP_SIZE BIT(12) @@ -146,14 +145,7 @@ #define IQS269_NUM_CH 8 #define IQS269_NUM_SL 2 -#define IQS269_ATI_POLL_SLEEP_US (iqs269->delay_mult * 10000) -#define IQS269_ATI_POLL_TIMEOUT_US (iqs269->delay_mult * 500000) -#define IQS269_ATI_STABLE_DELAY_MS (iqs269->delay_mult * 150) - -#define IQS269_PWR_MODE_POLL_SLEEP_US IQS269_ATI_POLL_SLEEP_US -#define IQS269_PWR_MODE_POLL_TIMEOUT_US IQS269_ATI_POLL_TIMEOUT_US - -#define iqs269_irq_wait() usleep_range(100, 150) +#define iqs269_irq_wait() usleep_range(200, 250) enum iqs269_local_cap_size { IQS269_LOCAL_CAP_SIZE_0, @@ -245,6 +237,18 @@ struct iqs269_ver_info { u8 padding; } __packed; +struct iqs269_ch_reg { + u8 rx_enable; + u8 tx_enable; + __be16 engine_a; + __be16 engine_b; + __be16 ati_comp; + u8 thresh[3]; + u8 hyst; + u8 assoc_select; + u8 assoc_weight; +} __packed; + struct iqs269_sys_reg { __be16 general; u8 active; @@ -266,18 +270,7 @@ struct iqs269_sys_reg { u8 timeout_swipe; u8 thresh_swipe; u8 redo_ati; -} __packed; - -struct iqs269_ch_reg { - u8 rx_enable; - u8 tx_enable; - __be16 engine_a; - __be16 engine_b; - __be16 ati_comp; - u8 thresh[3]; - u8 hyst; - u8 assoc_select; - u8 assoc_weight; + struct iqs269_ch_reg ch_reg[IQS269_NUM_CH]; } __packed; struct iqs269_flags { @@ -292,13 +285,11 @@ struct iqs269_private { struct regmap *regmap; struct mutex lock; struct iqs269_switch_desc switches[ARRAY_SIZE(iqs269_events)]; - struct iqs269_ch_reg ch_reg[IQS269_NUM_CH]; struct iqs269_sys_reg sys_reg; + struct completion ati_done; struct input_dev *keypad; struct input_dev *slider[IQS269_NUM_SL]; unsigned int keycode[ARRAY_SIZE(iqs269_events) * IQS269_NUM_CH]; - unsigned int suspend_mode; - unsigned int delay_mult; unsigned int ch_num; bool hall_enable; bool ati_current; @@ -307,6 +298,7 @@ struct iqs269_private { static int iqs269_ati_mode_set(struct iqs269_private *iqs269, unsigned int ch_num, unsigned int mode) { + struct iqs269_ch_reg *ch_reg = iqs269->sys_reg.ch_reg; u16 engine_a; if (ch_num >= IQS269_NUM_CH) @@ -317,12 +309,12 @@ static int iqs269_ati_mode_set(struct iqs269_private *iqs269, mutex_lock(&iqs269->lock); - engine_a = be16_to_cpu(iqs269->ch_reg[ch_num].engine_a); + engine_a = be16_to_cpu(ch_reg[ch_num].engine_a); engine_a &= ~IQS269_CHx_ENG_A_ATI_MODE_MASK; engine_a |= (mode << IQS269_CHx_ENG_A_ATI_MODE_SHIFT); - iqs269->ch_reg[ch_num].engine_a = cpu_to_be16(engine_a); + ch_reg[ch_num].engine_a = cpu_to_be16(engine_a); iqs269->ati_current = false; mutex_unlock(&iqs269->lock); @@ -333,13 +325,14 @@ static int iqs269_ati_mode_set(struct iqs269_private *iqs269, static int iqs269_ati_mode_get(struct iqs269_private *iqs269, unsigned int ch_num, unsigned int *mode) { + struct iqs269_ch_reg *ch_reg = iqs269->sys_reg.ch_reg; u16 engine_a; if (ch_num >= IQS269_NUM_CH) return -EINVAL; mutex_lock(&iqs269->lock); - engine_a = be16_to_cpu(iqs269->ch_reg[ch_num].engine_a); + engine_a = be16_to_cpu(ch_reg[ch_num].engine_a); mutex_unlock(&iqs269->lock); engine_a &= IQS269_CHx_ENG_A_ATI_MODE_MASK; @@ -351,6 +344,7 @@ static int iqs269_ati_mode_get(struct iqs269_private *iqs269, static int iqs269_ati_base_set(struct iqs269_private *iqs269, unsigned int ch_num, unsigned int base) { + struct iqs269_ch_reg *ch_reg = iqs269->sys_reg.ch_reg; u16 engine_b; if (ch_num >= IQS269_NUM_CH) @@ -379,12 +373,12 @@ static int iqs269_ati_base_set(struct iqs269_private *iqs269, mutex_lock(&iqs269->lock); - engine_b = be16_to_cpu(iqs269->ch_reg[ch_num].engine_b); + engine_b = be16_to_cpu(ch_reg[ch_num].engine_b); engine_b &= ~IQS269_CHx_ENG_B_ATI_BASE_MASK; engine_b |= base; - iqs269->ch_reg[ch_num].engine_b = cpu_to_be16(engine_b); + ch_reg[ch_num].engine_b = cpu_to_be16(engine_b); iqs269->ati_current = false; mutex_unlock(&iqs269->lock); @@ -395,13 +389,14 @@ static int iqs269_ati_base_set(struct iqs269_private *iqs269, static int iqs269_ati_base_get(struct iqs269_private *iqs269, unsigned int ch_num, unsigned int *base) { + struct iqs269_ch_reg *ch_reg = iqs269->sys_reg.ch_reg; u16 engine_b; if (ch_num >= IQS269_NUM_CH) return -EINVAL; mutex_lock(&iqs269->lock); - engine_b = be16_to_cpu(iqs269->ch_reg[ch_num].engine_b); + engine_b = be16_to_cpu(ch_reg[ch_num].engine_b); mutex_unlock(&iqs269->lock); switch (engine_b & IQS269_CHx_ENG_B_ATI_BASE_MASK) { @@ -429,6 +424,7 @@ static int iqs269_ati_base_get(struct iqs269_private *iqs269, static int iqs269_ati_target_set(struct iqs269_private *iqs269, unsigned int ch_num, unsigned int target) { + struct iqs269_ch_reg *ch_reg = iqs269->sys_reg.ch_reg; u16 engine_b; if (ch_num >= IQS269_NUM_CH) @@ -439,12 +435,12 @@ static int iqs269_ati_target_set(struct iqs269_private *iqs269, mutex_lock(&iqs269->lock); - engine_b = be16_to_cpu(iqs269->ch_reg[ch_num].engine_b); + engine_b = be16_to_cpu(ch_reg[ch_num].engine_b); engine_b &= ~IQS269_CHx_ENG_B_ATI_TARGET_MASK; engine_b |= target / 32; - iqs269->ch_reg[ch_num].engine_b = cpu_to_be16(engine_b); + ch_reg[ch_num].engine_b = cpu_to_be16(engine_b); iqs269->ati_current = false; mutex_unlock(&iqs269->lock); @@ -455,13 +451,14 @@ static int iqs269_ati_target_set(struct iqs269_private *iqs269, static int iqs269_ati_target_get(struct iqs269_private *iqs269, unsigned int ch_num, unsigned int *target) { + struct iqs269_ch_reg *ch_reg = iqs269->sys_reg.ch_reg; u16 engine_b; if (ch_num >= IQS269_NUM_CH) return -EINVAL; mutex_lock(&iqs269->lock); - engine_b = be16_to_cpu(iqs269->ch_reg[ch_num].engine_b); + engine_b = be16_to_cpu(ch_reg[ch_num].engine_b); mutex_unlock(&iqs269->lock); *target = (engine_b & IQS269_CHx_ENG_B_ATI_TARGET_MASK) * 32; @@ -531,13 +528,7 @@ static int iqs269_parse_chan(struct iqs269_private *iqs269, if (fwnode_property_present(ch_node, "azoteq,slider1-select")) iqs269->sys_reg.slider_select[1] |= BIT(reg); - ch_reg = &iqs269->ch_reg[reg]; - - error = regmap_raw_read(iqs269->regmap, - IQS269_CHx_SETTINGS + reg * sizeof(*ch_reg) / 2, - ch_reg, sizeof(*ch_reg)); - if (error) - return error; + ch_reg = &iqs269->sys_reg.ch_reg[reg]; error = iqs269_parse_mask(ch_node, "azoteq,rx-enable", &ch_reg->rx_enable); @@ -694,6 +685,7 @@ static int iqs269_parse_chan(struct iqs269_private *iqs269, dev_err(&client->dev, "Invalid channel %u threshold: %u\n", reg, val); + fwnode_handle_put(ev_node); return -EINVAL; } @@ -707,6 +699,7 @@ static int iqs269_parse_chan(struct iqs269_private *iqs269, dev_err(&client->dev, "Invalid channel %u hysteresis: %u\n", reg, val); + fwnode_handle_put(ev_node); return -EINVAL; } @@ -721,8 +714,16 @@ static int iqs269_parse_chan(struct iqs269_private *iqs269, } } - if (fwnode_property_read_u32(ev_node, "linux,code", &val)) + error = fwnode_property_read_u32(ev_node, "linux,code", &val); + fwnode_handle_put(ev_node); + if (error == -EINVAL) { continue; + } else if (error) { + dev_err(&client->dev, + "Failed to read channel %u code: %d\n", reg, + error); + return error; + } switch (reg) { case IQS269_CHx_HALL_ACTIVE: @@ -759,17 +760,6 @@ static int iqs269_parse_prop(struct iqs269_private *iqs269) iqs269->hall_enable = device_property_present(&client->dev, "azoteq,hall-enable"); - if (!device_property_read_u32(&client->dev, "azoteq,suspend-mode", - &val)) { - if (val > IQS269_SYS_SETTINGS_PWR_MODE_MAX) { - dev_err(&client->dev, "Invalid suspend mode: %u\n", - val); - return -EINVAL; - } - - iqs269->suspend_mode = val; - } - error = regmap_raw_read(iqs269->regmap, IQS269_SYS_SETTINGS, sys_reg, sizeof(*sys_reg)); if (error) @@ -980,13 +970,8 @@ static int iqs269_parse_prop(struct iqs269_private *iqs269) general = be16_to_cpu(sys_reg->general); - if (device_property_present(&client->dev, "azoteq,clk-div")) { + if (device_property_present(&client->dev, "azoteq,clk-div")) general |= IQS269_SYS_SETTINGS_CLK_DIV; - iqs269->delay_mult = 4; - } else { - general &= ~IQS269_SYS_SETTINGS_CLK_DIV; - iqs269->delay_mult = 1; - } /* * Configure the device to automatically switch between normal and low- @@ -997,6 +982,17 @@ static int iqs269_parse_prop(struct iqs269_private *iqs269) general &= ~IQS269_SYS_SETTINGS_DIS_AUTO; general &= ~IQS269_SYS_SETTINGS_PWR_MODE_MASK; + if (!device_property_read_u32(&client->dev, "azoteq,suspend-mode", + &val)) { + if (val > IQS269_SYS_SETTINGS_PWR_MODE_MAX) { + dev_err(&client->dev, "Invalid suspend mode: %u\n", + val); + return -EINVAL; + } + + general |= (val << IQS269_SYS_SETTINGS_PWR_MODE_SHIFT); + } + if (!device_property_read_u32(&client->dev, "azoteq,ulp-update", &val)) { if (val > IQS269_SYS_SETTINGS_ULP_UPDATE_MAX) { @@ -1032,10 +1028,7 @@ static int iqs269_parse_prop(struct iqs269_private *iqs269) static int iqs269_dev_init(struct iqs269_private *iqs269) { - struct iqs269_sys_reg *sys_reg = &iqs269->sys_reg; - struct iqs269_ch_reg *ch_reg; - unsigned int val; - int error, i; + int error; mutex_lock(&iqs269->lock); @@ -1045,38 +1038,17 @@ static int iqs269_dev_init(struct iqs269_private *iqs269) if (error) goto err_mutex; - for (i = 0; i < IQS269_NUM_CH; i++) { - if (!(sys_reg->active & BIT(i))) - continue; - - ch_reg = &iqs269->ch_reg[i]; - - error = regmap_raw_write(iqs269->regmap, - IQS269_CHx_SETTINGS + i * - sizeof(*ch_reg) / 2, ch_reg, - sizeof(*ch_reg)); - if (error) - goto err_mutex; - } - - /* - * The REDO-ATI and ATI channel selection fields must be written in the - * same block write, so every field between registers 0x80 through 0x8B - * (inclusive) must be written as well. - */ - error = regmap_raw_write(iqs269->regmap, IQS269_SYS_SETTINGS, sys_reg, - sizeof(*sys_reg)); + error = regmap_raw_write(iqs269->regmap, IQS269_SYS_SETTINGS, + &iqs269->sys_reg, sizeof(iqs269->sys_reg)); if (error) goto err_mutex; - error = regmap_read_poll_timeout(iqs269->regmap, IQS269_SYS_FLAGS, val, - !(val & IQS269_SYS_FLAGS_IN_ATI), - IQS269_ATI_POLL_SLEEP_US, - IQS269_ATI_POLL_TIMEOUT_US); - if (error) - goto err_mutex; + /* + * The following delay gives the device time to deassert its RDY output + * so as to prevent an interrupt from being serviced prematurely. + */ + usleep_range(2000, 2100); - msleep(IQS269_ATI_STABLE_DELAY_MS); iqs269->ati_current = true; err_mutex: @@ -1088,10 +1060,8 @@ err_mutex: static int iqs269_input_init(struct iqs269_private *iqs269) { struct i2c_client *client = iqs269->client; - struct iqs269_flags flags; unsigned int sw_code, keycode; int error, i, j; - u8 dir_mask, state; iqs269->keypad = devm_input_allocate_device(&client->dev); if (!iqs269->keypad) @@ -1104,23 +1074,7 @@ static int iqs269_input_init(struct iqs269_private *iqs269) iqs269->keypad->name = "iqs269a_keypad"; iqs269->keypad->id.bustype = BUS_I2C; - if (iqs269->hall_enable) { - error = regmap_raw_read(iqs269->regmap, IQS269_SYS_FLAGS, - &flags, sizeof(flags)); - if (error) { - dev_err(&client->dev, - "Failed to read initial status: %d\n", error); - return error; - } - } - for (i = 0; i < ARRAY_SIZE(iqs269_events); i++) { - dir_mask = flags.states[IQS269_ST_OFFS_DIR]; - if (!iqs269_events[i].dir_up) - dir_mask = ~dir_mask; - - state = flags.states[iqs269_events[i].st_offs] & dir_mask; - sw_code = iqs269->switches[i].code; for (j = 0; j < IQS269_NUM_CH; j++) { @@ -1133,13 +1087,9 @@ static int iqs269_input_init(struct iqs269_private *iqs269) switch (j) { case IQS269_CHx_HALL_ACTIVE: if (iqs269->hall_enable && - iqs269->switches[i].enabled) { + iqs269->switches[i].enabled) input_set_capability(iqs269->keypad, EV_SW, sw_code); - input_report_switch(iqs269->keypad, - sw_code, - state & BIT(j)); - } fallthrough; case IQS269_CHx_HALL_INACTIVE: @@ -1155,14 +1105,6 @@ static int iqs269_input_init(struct iqs269_private *iqs269) } } - input_sync(iqs269->keypad); - - error = input_register_device(iqs269->keypad); - if (error) { - dev_err(&client->dev, "Failed to register keypad: %d\n", error); - return error; - } - for (i = 0; i < IQS269_NUM_SL; i++) { if (!iqs269->sys_reg.slider_select[i]) continue; @@ -1222,6 +1164,9 @@ static int iqs269_report(struct iqs269_private *iqs269) return error; } + if (be16_to_cpu(flags.system) & IQS269_SYS_FLAGS_IN_ATI) + return 0; + error = regmap_raw_read(iqs269->regmap, IQS269_SLIDER_X, slider_x, sizeof(slider_x)); if (error) { @@ -1284,6 +1229,12 @@ static int iqs269_report(struct iqs269_private *iqs269) input_sync(iqs269->keypad); + /* + * The following completion signals that ATI has finished, any initial + * switch states have been reported and the keypad can be registered. + */ + complete_all(&iqs269->ati_done); + return 0; } @@ -1315,6 +1266,9 @@ static ssize_t counts_show(struct device *dev, if (!iqs269->ati_current || iqs269->hall_enable) return -EPERM; + if (!completion_done(&iqs269->ati_done)) + return -EBUSY; + /* * Unsolicited I2C communication prompts the device to assert its RDY * pin, so disable the interrupt line until the operation is finished @@ -1339,6 +1293,7 @@ static ssize_t hall_bin_show(struct device *dev, struct device_attribute *attr, char *buf) { struct iqs269_private *iqs269 = dev_get_drvdata(dev); + struct iqs269_ch_reg *ch_reg = iqs269->sys_reg.ch_reg; struct i2c_client *client = iqs269->client; unsigned int val; int error; @@ -1353,8 +1308,8 @@ static ssize_t hall_bin_show(struct device *dev, if (error) return error; - switch (iqs269->ch_reg[IQS269_CHx_HALL_ACTIVE].rx_enable & - iqs269->ch_reg[IQS269_CHx_HALL_INACTIVE].rx_enable) { + switch (ch_reg[IQS269_CHx_HALL_ACTIVE].rx_enable & + ch_reg[IQS269_CHx_HALL_INACTIVE].rx_enable) { case IQS269_HALL_PAD_R: val &= IQS269_CAL_DATA_A_HALL_BIN_R_MASK; val >>= IQS269_CAL_DATA_A_HALL_BIN_R_SHIFT; @@ -1434,9 +1389,10 @@ static ssize_t rx_enable_show(struct device *dev, struct device_attribute *attr, char *buf) { struct iqs269_private *iqs269 = dev_get_drvdata(dev); + struct iqs269_ch_reg *ch_reg = iqs269->sys_reg.ch_reg; return scnprintf(buf, PAGE_SIZE, "%u\n", - iqs269->ch_reg[iqs269->ch_num].rx_enable); + ch_reg[iqs269->ch_num].rx_enable); } static ssize_t rx_enable_store(struct device *dev, @@ -1444,6 +1400,7 @@ static ssize_t rx_enable_store(struct device *dev, size_t count) { struct iqs269_private *iqs269 = dev_get_drvdata(dev); + struct iqs269_ch_reg *ch_reg = iqs269->sys_reg.ch_reg; unsigned int val; int error; @@ -1456,7 +1413,7 @@ static ssize_t rx_enable_store(struct device *dev, mutex_lock(&iqs269->lock); - iqs269->ch_reg[iqs269->ch_num].rx_enable = val; + ch_reg[iqs269->ch_num].rx_enable = val; iqs269->ati_current = false; mutex_unlock(&iqs269->lock); @@ -1568,7 +1525,9 @@ static ssize_t ati_trigger_show(struct device *dev, { struct iqs269_private *iqs269 = dev_get_drvdata(dev); - return scnprintf(buf, PAGE_SIZE, "%u\n", iqs269->ati_current); + return scnprintf(buf, PAGE_SIZE, "%u\n", + iqs269->ati_current && + completion_done(&iqs269->ati_done)); } static ssize_t ati_trigger_store(struct device *dev, @@ -1588,6 +1547,7 @@ static ssize_t ati_trigger_store(struct device *dev, return count; disable_irq(client->irq); + reinit_completion(&iqs269->ati_done); error = iqs269_dev_init(iqs269); @@ -1597,6 +1557,10 @@ static ssize_t ati_trigger_store(struct device *dev, if (error) return error; + if (!wait_for_completion_timeout(&iqs269->ati_done, + msecs_to_jiffies(2000))) + return -ETIMEDOUT; + return count; } @@ -1655,6 +1619,7 @@ static int iqs269_probe(struct i2c_client *client) } mutex_init(&iqs269->lock); + init_completion(&iqs269->ati_done); error = regmap_raw_read(iqs269->regmap, IQS269_VER_INFO, &ver_info, sizeof(ver_info)); @@ -1690,6 +1655,22 @@ static int iqs269_probe(struct i2c_client *client) return error; } + if (!wait_for_completion_timeout(&iqs269->ati_done, + msecs_to_jiffies(2000))) { + dev_err(&client->dev, "Failed to complete ATI\n"); + return -ETIMEDOUT; + } + + /* + * The keypad may include one or more switches and is not registered + * until ATI is complete and the initial switch states are read. + */ + error = input_register_device(iqs269->keypad); + if (error) { + dev_err(&client->dev, "Failed to register keypad: %d\n", error); + return error; + } + error = devm_device_add_group(&client->dev, &iqs269_attr_group); if (error) dev_err(&client->dev, "Failed to add attributes: %d\n", error); @@ -1697,113 +1678,61 @@ static int iqs269_probe(struct i2c_client *client) return error; } -static int __maybe_unused iqs269_suspend(struct device *dev) +static u16 iqs269_general_get(struct iqs269_private *iqs269) +{ + u16 general = be16_to_cpu(iqs269->sys_reg.general); + + general &= ~IQS269_SYS_SETTINGS_REDO_ATI; + general &= ~IQS269_SYS_SETTINGS_ACK_RESET; + + return general | IQS269_SYS_SETTINGS_DIS_AUTO; +} + +static int iqs269_suspend(struct device *dev) { struct iqs269_private *iqs269 = dev_get_drvdata(dev); struct i2c_client *client = iqs269->client; - unsigned int val; int error; + u16 general = iqs269_general_get(iqs269); - if (!iqs269->suspend_mode) + if (!(general & IQS269_SYS_SETTINGS_PWR_MODE_MASK)) return 0; disable_irq(client->irq); - /* - * Automatic power mode switching must be disabled before the device is - * forced into any particular power mode. In this case, the device will - * transition into normal-power mode. - */ - error = regmap_update_bits(iqs269->regmap, IQS269_SYS_SETTINGS, - IQS269_SYS_SETTINGS_DIS_AUTO, ~0); - if (error) - goto err_irq; - - /* - * The following check ensures the device has completed its transition - * into normal-power mode before a manual mode switch is performed. - */ - error = regmap_read_poll_timeout(iqs269->regmap, IQS269_SYS_FLAGS, val, - !(val & IQS269_SYS_FLAGS_PWR_MODE_MASK), - IQS269_PWR_MODE_POLL_SLEEP_US, - IQS269_PWR_MODE_POLL_TIMEOUT_US); - if (error) - goto err_irq; - - error = regmap_update_bits(iqs269->regmap, IQS269_SYS_SETTINGS, - IQS269_SYS_SETTINGS_PWR_MODE_MASK, - iqs269->suspend_mode << - IQS269_SYS_SETTINGS_PWR_MODE_SHIFT); - if (error) - goto err_irq; + error = regmap_write(iqs269->regmap, IQS269_SYS_SETTINGS, general); - /* - * This last check ensures the device has completed its transition into - * the desired power mode to prevent any spurious interrupts from being - * triggered after iqs269_suspend has already returned. - */ - error = regmap_read_poll_timeout(iqs269->regmap, IQS269_SYS_FLAGS, val, - (val & IQS269_SYS_FLAGS_PWR_MODE_MASK) - == (iqs269->suspend_mode << - IQS269_SYS_FLAGS_PWR_MODE_SHIFT), - IQS269_PWR_MODE_POLL_SLEEP_US, - IQS269_PWR_MODE_POLL_TIMEOUT_US); - -err_irq: iqs269_irq_wait(); enable_irq(client->irq); return error; } -static int __maybe_unused iqs269_resume(struct device *dev) +static int iqs269_resume(struct device *dev) { struct iqs269_private *iqs269 = dev_get_drvdata(dev); struct i2c_client *client = iqs269->client; - unsigned int val; int error; + u16 general = iqs269_general_get(iqs269); - if (!iqs269->suspend_mode) + if (!(general & IQS269_SYS_SETTINGS_PWR_MODE_MASK)) return 0; disable_irq(client->irq); - error = regmap_update_bits(iqs269->regmap, IQS269_SYS_SETTINGS, - IQS269_SYS_SETTINGS_PWR_MODE_MASK, 0); - if (error) - goto err_irq; - - /* - * This check ensures the device has returned to normal-power mode - * before automatic power mode switching is re-enabled. - */ - error = regmap_read_poll_timeout(iqs269->regmap, IQS269_SYS_FLAGS, val, - !(val & IQS269_SYS_FLAGS_PWR_MODE_MASK), - IQS269_PWR_MODE_POLL_SLEEP_US, - IQS269_PWR_MODE_POLL_TIMEOUT_US); - if (error) - goto err_irq; - - error = regmap_update_bits(iqs269->regmap, IQS269_SYS_SETTINGS, - IQS269_SYS_SETTINGS_DIS_AUTO, 0); - if (error) - goto err_irq; - - /* - * This step reports any events that may have been "swallowed" as a - * result of polling PWR_MODE (which automatically acknowledges any - * pending interrupts). - */ - error = iqs269_report(iqs269); + error = regmap_write(iqs269->regmap, IQS269_SYS_SETTINGS, + general & ~IQS269_SYS_SETTINGS_PWR_MODE_MASK); + if (!error) + error = regmap_write(iqs269->regmap, IQS269_SYS_SETTINGS, + general & ~IQS269_SYS_SETTINGS_DIS_AUTO); -err_irq: iqs269_irq_wait(); enable_irq(client->irq); return error; } -static SIMPLE_DEV_PM_OPS(iqs269_pm, iqs269_suspend, iqs269_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(iqs269_pm, iqs269_suspend, iqs269_resume); static const struct of_device_id iqs269_of_match[] = { { .compatible = "azoteq,iqs269a" }, @@ -1815,7 +1744,7 @@ static struct i2c_driver iqs269_i2c_driver = { .driver = { .name = "iqs269a", .of_match_table = iqs269_of_match, - .pm = &iqs269_pm, + .pm = pm_sleep_ptr(&iqs269_pm), }, .probe_new = iqs269_probe, }; diff --git a/drivers/input/misc/iqs626a.c b/drivers/input/misc/iqs626a.c index 23b5dd9552dc..90f997a905b5 100644 --- a/drivers/input/misc/iqs626a.c +++ b/drivers/input/misc/iqs626a.c @@ -458,18 +458,15 @@ struct iqs626_private { static noinline_for_stack int iqs626_parse_events(struct iqs626_private *iqs626, - const struct fwnode_handle *ch_node, - enum iqs626_ch_id ch_id) + struct fwnode_handle *ch_node, enum iqs626_ch_id ch_id) { struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; struct i2c_client *client = iqs626->client; - const struct fwnode_handle *ev_node; + struct fwnode_handle *ev_node; const char *ev_name; u8 *thresh, *hyst; - unsigned int thresh_tp[IQS626_NUM_CH_TP_3]; unsigned int val; - int num_ch = iqs626_channels[ch_id].num_ch; - int error, i, j; + int i; switch (ch_id) { case IQS626_CH_ULP_0: @@ -509,7 +506,7 @@ iqs626_parse_events(struct iqs626_private *iqs626, * Trackpad touch events are simply described under the * trackpad child node. */ - ev_node = ch_node; + ev_node = fwnode_handle_get(ch_node); } else { ev_name = iqs626_events[i].name; ev_node = fwnode_get_named_child_node(ch_node, ev_name); @@ -533,6 +530,7 @@ iqs626_parse_events(struct iqs626_private *iqs626, dev_err(&client->dev, "Invalid input type: %u\n", val); + fwnode_handle_put(ev_node); return -EINVAL; } @@ -547,6 +545,7 @@ iqs626_parse_events(struct iqs626_private *iqs626, dev_err(&client->dev, "Invalid %s channel hysteresis: %u\n", fwnode_get_name(ch_node), val); + fwnode_handle_put(ev_node); return -EINVAL; } @@ -567,6 +566,7 @@ iqs626_parse_events(struct iqs626_private *iqs626, dev_err(&client->dev, "Invalid %s channel threshold: %u\n", fwnode_get_name(ch_node), val); + fwnode_handle_put(ev_node); return -EINVAL; } @@ -574,32 +574,9 @@ iqs626_parse_events(struct iqs626_private *iqs626, *thresh = val; else *(thresh + iqs626_events[i].th_offs) = val; - - continue; - } - - if (!fwnode_property_present(ev_node, "azoteq,thresh")) - continue; - - error = fwnode_property_read_u32_array(ev_node, "azoteq,thresh", - thresh_tp, num_ch); - if (error) { - dev_err(&client->dev, - "Failed to read %s channel thresholds: %d\n", - fwnode_get_name(ch_node), error); - return error; } - for (j = 0; j < num_ch; j++) { - if (thresh_tp[j] > IQS626_CHx_THRESH_MAX) { - dev_err(&client->dev, - "Invalid %s channel threshold: %u\n", - fwnode_get_name(ch_node), thresh_tp[j]); - return -EINVAL; - } - - sys_reg->tp_grp_reg.ch_reg_tp[j].thresh = thresh_tp[j]; - } + fwnode_handle_put(ev_node); } return 0; @@ -607,16 +584,13 @@ iqs626_parse_events(struct iqs626_private *iqs626, static noinline_for_stack int iqs626_parse_ati_target(struct iqs626_private *iqs626, - const struct fwnode_handle *ch_node, - enum iqs626_ch_id ch_id) + struct fwnode_handle *ch_node, enum iqs626_ch_id ch_id) { struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; struct i2c_client *client = iqs626->client; - unsigned int ati_base[IQS626_NUM_CH_TP_3]; unsigned int val; u8 *ati_target; - int num_ch = iqs626_channels[ch_id].num_ch; - int error, i; + int i; switch (ch_id) { case IQS626_CH_ULP_0: @@ -683,40 +657,13 @@ iqs626_parse_ati_target(struct iqs626_private *iqs626, *ati_target &= ~IQS626_CHx_ATI_BASE_MASK; *ati_target |= val; - - return 0; - } - - if (!fwnode_property_present(ch_node, "azoteq,ati-base")) - return 0; - - error = fwnode_property_read_u32_array(ch_node, "azoteq,ati-base", - ati_base, num_ch); - if (error) { - dev_err(&client->dev, - "Failed to read %s channel ATI bases: %d\n", - fwnode_get_name(ch_node), error); - return error; - } - - for (i = 0; i < num_ch; i++) { - if (ati_base[i] < IQS626_TPx_ATI_BASE_MIN || - ati_base[i] > IQS626_TPx_ATI_BASE_MAX) { - dev_err(&client->dev, - "Invalid %s channel ATI base: %u\n", - fwnode_get_name(ch_node), ati_base[i]); - return -EINVAL; - } - - ati_base[i] -= IQS626_TPx_ATI_BASE_MIN; - sys_reg->tp_grp_reg.ch_reg_tp[i].ati_base = ati_base[i]; } return 0; } static int iqs626_parse_pins(struct iqs626_private *iqs626, - const struct fwnode_handle *ch_node, + struct fwnode_handle *ch_node, const char *propname, u8 *enable) { struct i2c_client *client = iqs626->client; @@ -764,13 +711,14 @@ static int iqs626_parse_pins(struct iqs626_private *iqs626, } static int iqs626_parse_trackpad(struct iqs626_private *iqs626, - const struct fwnode_handle *ch_node) + struct fwnode_handle *ch_node, + enum iqs626_ch_id ch_id) { struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; struct i2c_client *client = iqs626->client; u8 *hyst = &sys_reg->tp_grp_reg.hyst; + int error, count, i; unsigned int val; - int error, count; if (!fwnode_property_read_u32(ch_node, "azoteq,lta-update", &val)) { if (val > IQS626_MISC_A_TPx_LTA_UPDATE_MAX) { @@ -823,6 +771,48 @@ static int iqs626_parse_trackpad(struct iqs626_private *iqs626, *hyst |= (val << IQS626_FILT_STR_LP_TPx_SHIFT); } + for (i = 0; i < iqs626_channels[ch_id].num_ch; i++) { + u8 *ati_base = &sys_reg->tp_grp_reg.ch_reg_tp[i].ati_base; + u8 *thresh = &sys_reg->tp_grp_reg.ch_reg_tp[i].thresh; + struct fwnode_handle *tc_node; + char tc_name[10]; + + snprintf(tc_name, sizeof(tc_name), "channel-%d", i); + + tc_node = fwnode_get_named_child_node(ch_node, tc_name); + if (!tc_node) + continue; + + if (!fwnode_property_read_u32(tc_node, "azoteq,ati-base", + &val)) { + if (val < IQS626_TPx_ATI_BASE_MIN || + val > IQS626_TPx_ATI_BASE_MAX) { + dev_err(&client->dev, + "Invalid %s %s ATI base: %u\n", + fwnode_get_name(ch_node), tc_name, val); + fwnode_handle_put(tc_node); + return -EINVAL; + } + + *ati_base = val - IQS626_TPx_ATI_BASE_MIN; + } + + if (!fwnode_property_read_u32(tc_node, "azoteq,thresh", + &val)) { + if (val > IQS626_CHx_THRESH_MAX) { + dev_err(&client->dev, + "Invalid %s %s threshold: %u\n", + fwnode_get_name(ch_node), tc_name, val); + fwnode_handle_put(tc_node); + return -EINVAL; + } + + *thresh = val; + } + + fwnode_handle_put(tc_node); + } + if (!fwnode_property_present(ch_node, "linux,keycodes")) return 0; @@ -889,8 +879,7 @@ static int iqs626_parse_trackpad(struct iqs626_private *iqs626, static noinline_for_stack int iqs626_parse_channel(struct iqs626_private *iqs626, - const struct fwnode_handle *ch_node, - enum iqs626_ch_id ch_id) + struct fwnode_handle *ch_node, enum iqs626_ch_id ch_id) { struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg; struct i2c_client *client = iqs626->client; @@ -924,6 +913,20 @@ iqs626_parse_channel(struct iqs626_private *iqs626, return -EINVAL; } + error = iqs626_parse_ati_target(iqs626, ch_node, ch_id); + if (error) + return error; + + error = iqs626_parse_events(iqs626, ch_node, ch_id); + if (error) + return error; + + if (!fwnode_property_present(ch_node, "azoteq,ati-exclude")) + sys_reg->redo_ati |= iqs626_channels[ch_id].active; + + if (!fwnode_property_present(ch_node, "azoteq,reseed-disable")) + sys_reg->reseed |= iqs626_channels[ch_id].active; + *engine |= IQS626_CHx_ENG_0_MEAS_CAP_SIZE; if (fwnode_property_present(ch_node, "azoteq,meas-cap-decrease")) *engine &= ~IQS626_CHx_ENG_0_MEAS_CAP_SIZE; @@ -1057,7 +1060,7 @@ iqs626_parse_channel(struct iqs626_private *iqs626, *(engine + 1) |= IQS626_CHx_ENG_1_ATI_BAND_TIGHTEN; if (ch_id == IQS626_CH_TP_2 || ch_id == IQS626_CH_TP_3) - return iqs626_parse_trackpad(iqs626, ch_node); + return iqs626_parse_trackpad(iqs626, ch_node, ch_id); if (ch_id == IQS626_CH_ULP_0) { sys_reg->ch_reg_ulp.hyst &= ~IQS626_ULP_PROJ_ENABLE; @@ -1378,23 +1381,10 @@ static int iqs626_parse_prop(struct iqs626_private *iqs626) continue; error = iqs626_parse_channel(iqs626, ch_node, i); + fwnode_handle_put(ch_node); if (error) return error; - error = iqs626_parse_ati_target(iqs626, ch_node, i); - if (error) - return error; - - error = iqs626_parse_events(iqs626, ch_node, i); - if (error) - return error; - - if (!fwnode_property_present(ch_node, "azoteq,ati-exclude")) - sys_reg->redo_ati |= iqs626_channels[i].active; - - if (!fwnode_property_present(ch_node, "azoteq,reseed-disable")) - sys_reg->reseed |= iqs626_channels[i].active; - sys_reg->active |= iqs626_channels[i].active; } @@ -1712,7 +1702,7 @@ static int iqs626_probe(struct i2c_client *client) return error; } -static int __maybe_unused iqs626_suspend(struct device *dev) +static int iqs626_suspend(struct device *dev) { struct iqs626_private *iqs626 = dev_get_drvdata(dev); struct i2c_client *client = iqs626->client; @@ -1771,7 +1761,7 @@ err_irq: return error; } -static int __maybe_unused iqs626_resume(struct device *dev) +static int iqs626_resume(struct device *dev) { struct iqs626_private *iqs626 = dev_get_drvdata(dev); struct i2c_client *client = iqs626->client; @@ -1818,7 +1808,7 @@ err_irq: return error; } -static SIMPLE_DEV_PM_OPS(iqs626_pm, iqs626_suspend, iqs626_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(iqs626_pm, iqs626_suspend, iqs626_resume); static const struct of_device_id iqs626_of_match[] = { { .compatible = "azoteq,iqs626a" }, @@ -1830,7 +1820,7 @@ static struct i2c_driver iqs626_i2c_driver = { .driver = { .name = "iqs626a", .of_match_table = iqs626_of_match, - .pm = &iqs626_pm, + .pm = pm_sleep_ptr(&iqs626_pm), }, .probe_new = iqs626_probe, }; diff --git a/drivers/input/misc/kxtj9.c b/drivers/input/misc/kxtj9.c index 7e73e6e0730f..4e806d56c55d 100644 --- a/drivers/input/misc/kxtj9.c +++ b/drivers/input/misc/kxtj9.c @@ -494,7 +494,7 @@ static int kxtj9_probe(struct i2c_client *client) return 0; } -static int __maybe_unused kxtj9_suspend(struct device *dev) +static int kxtj9_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct kxtj9_data *tj9 = i2c_get_clientdata(client); @@ -509,7 +509,7 @@ static int __maybe_unused kxtj9_suspend(struct device *dev) return 0; } -static int __maybe_unused kxtj9_resume(struct device *dev) +static int kxtj9_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct kxtj9_data *tj9 = i2c_get_clientdata(client); @@ -524,7 +524,7 @@ static int __maybe_unused kxtj9_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(kxtj9_pm_ops, kxtj9_suspend, kxtj9_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(kxtj9_pm_ops, kxtj9_suspend, kxtj9_resume); static const struct i2c_device_id kxtj9_id[] = { { NAME, 0 }, @@ -536,7 +536,7 @@ MODULE_DEVICE_TABLE(i2c, kxtj9_id); static struct i2c_driver kxtj9_driver = { .driver = { .name = NAME, - .pm = &kxtj9_pm_ops, + .pm = pm_sleep_ptr(&kxtj9_pm_ops), }, .probe_new = kxtj9_probe, .id_table = kxtj9_id, diff --git a/drivers/input/misc/max77693-haptic.c b/drivers/input/misc/max77693-haptic.c index 4369d3c04d38..80f4416ffe2f 100644 --- a/drivers/input/misc/max77693-haptic.c +++ b/drivers/input/misc/max77693-haptic.c @@ -375,7 +375,7 @@ static int max77693_haptic_probe(struct platform_device *pdev) return 0; } -static int __maybe_unused max77693_haptic_suspend(struct device *dev) +static int max77693_haptic_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct max77693_haptic *haptic = platform_get_drvdata(pdev); @@ -388,7 +388,7 @@ static int __maybe_unused max77693_haptic_suspend(struct device *dev) return 0; } -static int __maybe_unused max77693_haptic_resume(struct device *dev) +static int max77693_haptic_resume(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct max77693_haptic *haptic = platform_get_drvdata(pdev); @@ -401,8 +401,9 @@ static int __maybe_unused max77693_haptic_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(max77693_haptic_pm_ops, - max77693_haptic_suspend, max77693_haptic_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(max77693_haptic_pm_ops, + max77693_haptic_suspend, + max77693_haptic_resume); static const struct platform_device_id max77693_haptic_id[] = { { "max77693-haptic", TYPE_MAX77693 }, @@ -414,7 +415,7 @@ MODULE_DEVICE_TABLE(platform, max77693_haptic_id); static struct platform_driver max77693_haptic_driver = { .driver = { .name = "max77693-haptic", - .pm = &max77693_haptic_pm_ops, + .pm = pm_sleep_ptr(&max77693_haptic_pm_ops), }, .probe = max77693_haptic_probe, .id_table = max77693_haptic_id, diff --git a/drivers/input/misc/max8925_onkey.c b/drivers/input/misc/max8925_onkey.c index 4770cb55631a..62619e4fed20 100644 --- a/drivers/input/misc/max8925_onkey.c +++ b/drivers/input/misc/max8925_onkey.c @@ -129,7 +129,7 @@ static int max8925_onkey_probe(struct platform_device *pdev) return 0; } -static int __maybe_unused max8925_onkey_suspend(struct device *dev) +static int max8925_onkey_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct max8925_onkey_info *info = platform_get_drvdata(pdev); @@ -143,7 +143,7 @@ static int __maybe_unused max8925_onkey_suspend(struct device *dev) return 0; } -static int __maybe_unused max8925_onkey_resume(struct device *dev) +static int max8925_onkey_resume(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct max8925_onkey_info *info = platform_get_drvdata(pdev); @@ -157,12 +157,13 @@ static int __maybe_unused max8925_onkey_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(max8925_onkey_pm_ops, max8925_onkey_suspend, max8925_onkey_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(max8925_onkey_pm_ops, + max8925_onkey_suspend, max8925_onkey_resume); static struct platform_driver max8925_onkey_driver = { .driver = { .name = "max8925-onkey", - .pm = &max8925_onkey_pm_ops, + .pm = pm_sleep_ptr(&max8925_onkey_pm_ops), }, .probe = max8925_onkey_probe, }; diff --git a/drivers/input/misc/max8997_haptic.c b/drivers/input/misc/max8997_haptic.c index 99cbc5ee89d1..c4dff476d479 100644 --- a/drivers/input/misc/max8997_haptic.c +++ b/drivers/input/misc/max8997_haptic.c @@ -366,7 +366,7 @@ static int max8997_haptic_remove(struct platform_device *pdev) return 0; } -static int __maybe_unused max8997_haptic_suspend(struct device *dev) +static int max8997_haptic_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct max8997_haptic *chip = platform_get_drvdata(pdev); @@ -376,7 +376,8 @@ static int __maybe_unused max8997_haptic_suspend(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(max8997_haptic_pm_ops, max8997_haptic_suspend, NULL); +static DEFINE_SIMPLE_DEV_PM_OPS(max8997_haptic_pm_ops, + max8997_haptic_suspend, NULL); static const struct platform_device_id max8997_haptic_id[] = { { "max8997-haptic", 0 }, @@ -387,7 +388,7 @@ MODULE_DEVICE_TABLE(platform, max8997_haptic_id); static struct platform_driver max8997_haptic_driver = { .driver = { .name = "max8997-haptic", - .pm = &max8997_haptic_pm_ops, + .pm = pm_sleep_ptr(&max8997_haptic_pm_ops), }, .probe = max8997_haptic_probe, .remove = max8997_haptic_remove, diff --git a/drivers/input/misc/palmas-pwrbutton.c b/drivers/input/misc/palmas-pwrbutton.c index 465e6693077a..7e361727b0d9 100644 --- a/drivers/input/misc/palmas-pwrbutton.c +++ b/drivers/input/misc/palmas-pwrbutton.c @@ -266,7 +266,7 @@ static int palmas_pwron_remove(struct platform_device *pdev) * * Return: 0 */ -static int __maybe_unused palmas_pwron_suspend(struct device *dev) +static int palmas_pwron_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct palmas_pwron *pwron = platform_get_drvdata(pdev); @@ -287,7 +287,7 @@ static int __maybe_unused palmas_pwron_suspend(struct device *dev) * * Return: 0 */ -static int __maybe_unused palmas_pwron_resume(struct device *dev) +static int palmas_pwron_resume(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct palmas_pwron *pwron = platform_get_drvdata(pdev); @@ -298,8 +298,8 @@ static int __maybe_unused palmas_pwron_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(palmas_pwron_pm, - palmas_pwron_suspend, palmas_pwron_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(palmas_pwron_pm, + palmas_pwron_suspend, palmas_pwron_resume); #ifdef CONFIG_OF static const struct of_device_id of_palmas_pwr_match[] = { @@ -316,7 +316,7 @@ static struct platform_driver palmas_pwron_driver = { .driver = { .name = "palmas_pwrbutton", .of_match_table = of_match_ptr(of_palmas_pwr_match), - .pm = &palmas_pwron_pm, + .pm = pm_sleep_ptr(&palmas_pwron_pm), }, }; module_platform_driver(palmas_pwron_driver); diff --git a/drivers/input/misc/pcf8574_keypad.c b/drivers/input/misc/pcf8574_keypad.c index fd1ff3f1cd92..6323c3d37ef7 100644 --- a/drivers/input/misc/pcf8574_keypad.c +++ b/drivers/input/misc/pcf8574_keypad.c @@ -167,7 +167,6 @@ static void pcf8574_kp_remove(struct i2c_client *client) kfree(lp); } -#ifdef CONFIG_PM static int pcf8574_kp_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -186,15 +185,8 @@ static int pcf8574_kp_suspend(struct device *dev) return 0; } -static const struct dev_pm_ops pcf8574_kp_pm_ops = { - .suspend = pcf8574_kp_suspend, - .resume = pcf8574_kp_resume, -}; - -#else -# define pcf8574_kp_resume NULL -# define pcf8574_kp_suspend NULL -#endif +static DEFINE_SIMPLE_DEV_PM_OPS(pcf8574_kp_pm_ops, + pcf8574_kp_suspend, pcf8574_kp_resume); static const struct i2c_device_id pcf8574_kp_id[] = { { DRV_NAME, 0 }, @@ -205,9 +197,7 @@ MODULE_DEVICE_TABLE(i2c, pcf8574_kp_id); static struct i2c_driver pcf8574_kp_driver = { .driver = { .name = DRV_NAME, -#ifdef CONFIG_PM - .pm = &pcf8574_kp_pm_ops, -#endif + .pm = pm_sleep_ptr(&pcf8574_kp_pm_ops), }, .probe_new = pcf8574_kp_probe, .remove = pcf8574_kp_remove, diff --git a/drivers/input/misc/pm8941-pwrkey.c b/drivers/input/misc/pm8941-pwrkey.c index 549df01b6ee3..b6a27ebae977 100644 --- a/drivers/input/misc/pm8941-pwrkey.c +++ b/drivers/input/misc/pm8941-pwrkey.c @@ -217,7 +217,7 @@ static int pm8941_pwrkey_sw_debounce_init(struct pm8941_pwrkey *pwrkey) return 0; } -static int __maybe_unused pm8941_pwrkey_suspend(struct device *dev) +static int pm8941_pwrkey_suspend(struct device *dev) { struct pm8941_pwrkey *pwrkey = dev_get_drvdata(dev); @@ -227,7 +227,7 @@ static int __maybe_unused pm8941_pwrkey_suspend(struct device *dev) return 0; } -static int __maybe_unused pm8941_pwrkey_resume(struct device *dev) +static int pm8941_pwrkey_resume(struct device *dev) { struct pm8941_pwrkey *pwrkey = dev_get_drvdata(dev); @@ -237,8 +237,8 @@ static int __maybe_unused pm8941_pwrkey_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(pm8941_pwr_key_pm_ops, - pm8941_pwrkey_suspend, pm8941_pwrkey_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(pm8941_pwr_key_pm_ops, + pm8941_pwrkey_suspend, pm8941_pwrkey_resume); static int pm8941_pwrkey_probe(struct platform_device *pdev) { @@ -460,7 +460,7 @@ static struct platform_driver pm8941_pwrkey_driver = { .remove = pm8941_pwrkey_remove, .driver = { .name = "pm8941-pwrkey", - .pm = &pm8941_pwr_key_pm_ops, + .pm = pm_sleep_ptr(&pm8941_pwr_key_pm_ops), .of_match_table = of_match_ptr(pm8941_pwr_key_id_table), }, }; diff --git a/drivers/input/misc/pm8xxx-vibrator.c b/drivers/input/misc/pm8xxx-vibrator.c index 53ad25eaf1a2..04cb87efd799 100644 --- a/drivers/input/misc/pm8xxx-vibrator.c +++ b/drivers/input/misc/pm8xxx-vibrator.c @@ -226,7 +226,7 @@ static int pm8xxx_vib_probe(struct platform_device *pdev) return 0; } -static int __maybe_unused pm8xxx_vib_suspend(struct device *dev) +static int pm8xxx_vib_suspend(struct device *dev) { struct pm8xxx_vib *vib = dev_get_drvdata(dev); @@ -236,7 +236,7 @@ static int __maybe_unused pm8xxx_vib_suspend(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(pm8xxx_vib_pm_ops, pm8xxx_vib_suspend, NULL); +static DEFINE_SIMPLE_DEV_PM_OPS(pm8xxx_vib_pm_ops, pm8xxx_vib_suspend, NULL); static const struct of_device_id pm8xxx_vib_id_table[] = { { .compatible = "qcom,pm8058-vib", .data = &pm8058_regs }, @@ -250,7 +250,7 @@ static struct platform_driver pm8xxx_vib_driver = { .probe = pm8xxx_vib_probe, .driver = { .name = "pm8xxx-vib", - .pm = &pm8xxx_vib_pm_ops, + .pm = pm_sleep_ptr(&pm8xxx_vib_pm_ops), .of_match_table = pm8xxx_vib_id_table, }, }; diff --git a/drivers/input/misc/pmic8xxx-pwrkey.c b/drivers/input/misc/pmic8xxx-pwrkey.c index 0e818a3d28c5..89fb137e3715 100644 --- a/drivers/input/misc/pmic8xxx-pwrkey.c +++ b/drivers/input/misc/pmic8xxx-pwrkey.c @@ -100,7 +100,7 @@ static irqreturn_t pwrkey_release_irq(int irq, void *_pwr) return IRQ_HANDLED; } -static int __maybe_unused pmic8xxx_pwrkey_suspend(struct device *dev) +static int pmic8xxx_pwrkey_suspend(struct device *dev) { struct pmic8xxx_pwrkey *pwrkey = dev_get_drvdata(dev); @@ -110,7 +110,7 @@ static int __maybe_unused pmic8xxx_pwrkey_suspend(struct device *dev) return 0; } -static int __maybe_unused pmic8xxx_pwrkey_resume(struct device *dev) +static int pmic8xxx_pwrkey_resume(struct device *dev) { struct pmic8xxx_pwrkey *pwrkey = dev_get_drvdata(dev); @@ -120,7 +120,7 @@ static int __maybe_unused pmic8xxx_pwrkey_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(pm8xxx_pwr_key_pm_ops, +static DEFINE_SIMPLE_DEV_PM_OPS(pm8xxx_pwr_key_pm_ops, pmic8xxx_pwrkey_suspend, pmic8xxx_pwrkey_resume); static void pmic8xxx_pwrkey_shutdown(struct platform_device *pdev) @@ -442,7 +442,7 @@ static struct platform_driver pmic8xxx_pwrkey_driver = { .shutdown = pmic8xxx_pwrkey_shutdown, .driver = { .name = "pm8xxx-pwrkey", - .pm = &pm8xxx_pwr_key_pm_ops, + .pm = pm_sleep_ptr(&pm8xxx_pwr_key_pm_ops), .of_match_table = pm8xxx_pwr_key_id_table, }, }; diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c index d6b12477748a..3cf1812384e6 100644 --- a/drivers/input/misc/pwm-beeper.c +++ b/drivers/input/misc/pwm-beeper.c @@ -203,7 +203,7 @@ static int pwm_beeper_probe(struct platform_device *pdev) return 0; } -static int __maybe_unused pwm_beeper_suspend(struct device *dev) +static int pwm_beeper_suspend(struct device *dev) { struct pwm_beeper *beeper = dev_get_drvdata(dev); @@ -221,7 +221,7 @@ static int __maybe_unused pwm_beeper_suspend(struct device *dev) return 0; } -static int __maybe_unused pwm_beeper_resume(struct device *dev) +static int pwm_beeper_resume(struct device *dev) { struct pwm_beeper *beeper = dev_get_drvdata(dev); @@ -235,8 +235,8 @@ static int __maybe_unused pwm_beeper_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(pwm_beeper_pm_ops, - pwm_beeper_suspend, pwm_beeper_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(pwm_beeper_pm_ops, + pwm_beeper_suspend, pwm_beeper_resume); #ifdef CONFIG_OF static const struct of_device_id pwm_beeper_match[] = { @@ -250,7 +250,7 @@ static struct platform_driver pwm_beeper_driver = { .probe = pwm_beeper_probe, .driver = { .name = "pwm-beeper", - .pm = &pwm_beeper_pm_ops, + .pm = pm_sleep_ptr(&pwm_beeper_pm_ops), .of_match_table = of_match_ptr(pwm_beeper_match), }, }; diff --git a/drivers/input/misc/pwm-vibra.c b/drivers/input/misc/pwm-vibra.c index 81e777a04b88..d0e58a7cdfa3 100644 --- a/drivers/input/misc/pwm-vibra.c +++ b/drivers/input/misc/pwm-vibra.c @@ -222,7 +222,7 @@ static int pwm_vibrator_probe(struct platform_device *pdev) return 0; } -static int __maybe_unused pwm_vibrator_suspend(struct device *dev) +static int pwm_vibrator_suspend(struct device *dev) { struct pwm_vibrator *vibrator = dev_get_drvdata(dev); @@ -233,7 +233,7 @@ static int __maybe_unused pwm_vibrator_suspend(struct device *dev) return 0; } -static int __maybe_unused pwm_vibrator_resume(struct device *dev) +static int pwm_vibrator_resume(struct device *dev) { struct pwm_vibrator *vibrator = dev_get_drvdata(dev); @@ -243,8 +243,8 @@ static int __maybe_unused pwm_vibrator_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(pwm_vibrator_pm_ops, - pwm_vibrator_suspend, pwm_vibrator_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(pwm_vibrator_pm_ops, + pwm_vibrator_suspend, pwm_vibrator_resume); #ifdef CONFIG_OF static const struct of_device_id pwm_vibra_dt_match_table[] = { @@ -258,7 +258,7 @@ static struct platform_driver pwm_vibrator_driver = { .probe = pwm_vibrator_probe, .driver = { .name = "pwm-vibrator", - .pm = &pwm_vibrator_pm_ops, + .pm = pm_sleep_ptr(&pwm_vibrator_pm_ops), .of_match_table = of_match_ptr(pwm_vibra_dt_match_table), }, }; diff --git a/drivers/input/misc/regulator-haptic.c b/drivers/input/misc/regulator-haptic.c index a661e77545c5..02f73b7c0462 100644 --- a/drivers/input/misc/regulator-haptic.c +++ b/drivers/input/misc/regulator-haptic.c @@ -201,7 +201,7 @@ static int regulator_haptic_probe(struct platform_device *pdev) return 0; } -static int __maybe_unused regulator_haptic_suspend(struct device *dev) +static int regulator_haptic_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct regulator_haptic *haptic = platform_get_drvdata(pdev); @@ -220,7 +220,7 @@ static int __maybe_unused regulator_haptic_suspend(struct device *dev) return 0; } -static int __maybe_unused regulator_haptic_resume(struct device *dev) +static int regulator_haptic_resume(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct regulator_haptic *haptic = platform_get_drvdata(pdev); @@ -239,7 +239,7 @@ static int __maybe_unused regulator_haptic_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(regulator_haptic_pm_ops, +static DEFINE_SIMPLE_DEV_PM_OPS(regulator_haptic_pm_ops, regulator_haptic_suspend, regulator_haptic_resume); static const struct of_device_id regulator_haptic_dt_match[] = { @@ -253,7 +253,7 @@ static struct platform_driver regulator_haptic_driver = { .driver = { .name = "regulator-haptic", .of_match_table = regulator_haptic_dt_match, - .pm = ®ulator_haptic_pm_ops, + .pm = pm_sleep_ptr(®ulator_haptic_pm_ops), }, }; module_platform_driver(regulator_haptic_driver); diff --git a/drivers/input/misc/rotary_encoder.c b/drivers/input/misc/rotary_encoder.c index 6d613f2a017c..22ec62083065 100644 --- a/drivers/input/misc/rotary_encoder.c +++ b/drivers/input/misc/rotary_encoder.c @@ -317,7 +317,7 @@ static int rotary_encoder_probe(struct platform_device *pdev) return 0; } -static int __maybe_unused rotary_encoder_suspend(struct device *dev) +static int rotary_encoder_suspend(struct device *dev) { struct rotary_encoder *encoder = dev_get_drvdata(dev); unsigned int i; @@ -330,7 +330,7 @@ static int __maybe_unused rotary_encoder_suspend(struct device *dev) return 0; } -static int __maybe_unused rotary_encoder_resume(struct device *dev) +static int rotary_encoder_resume(struct device *dev) { struct rotary_encoder *encoder = dev_get_drvdata(dev); unsigned int i; @@ -343,8 +343,8 @@ static int __maybe_unused rotary_encoder_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(rotary_encoder_pm_ops, - rotary_encoder_suspend, rotary_encoder_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(rotary_encoder_pm_ops, + rotary_encoder_suspend, rotary_encoder_resume); #ifdef CONFIG_OF static const struct of_device_id rotary_encoder_of_match[] = { @@ -358,7 +358,7 @@ static struct platform_driver rotary_encoder_driver = { .probe = rotary_encoder_probe, .driver = { .name = DRV_NAME, - .pm = &rotary_encoder_pm_ops, + .pm = pm_sleep_ptr(&rotary_encoder_pm_ops), .of_match_table = of_match_ptr(rotary_encoder_of_match), } }; diff --git a/drivers/input/misc/stpmic1_onkey.c b/drivers/input/misc/stpmic1_onkey.c index d8dc2f2f8000..d5ebca7b90a5 100644 --- a/drivers/input/misc/stpmic1_onkey.c +++ b/drivers/input/misc/stpmic1_onkey.c @@ -142,7 +142,7 @@ static int stpmic1_onkey_probe(struct platform_device *pdev) return 0; } -static int __maybe_unused stpmic1_onkey_suspend(struct device *dev) +static int stpmic1_onkey_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct stpmic1_onkey *onkey = platform_get_drvdata(pdev); @@ -154,7 +154,7 @@ static int __maybe_unused stpmic1_onkey_suspend(struct device *dev) return 0; } -static int __maybe_unused stpmic1_onkey_resume(struct device *dev) +static int stpmic1_onkey_resume(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct stpmic1_onkey *onkey = platform_get_drvdata(pdev); @@ -166,9 +166,9 @@ static int __maybe_unused stpmic1_onkey_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(stpmic1_onkey_pm, - stpmic1_onkey_suspend, - stpmic1_onkey_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(stpmic1_onkey_pm, + stpmic1_onkey_suspend, + stpmic1_onkey_resume); static const struct of_device_id of_stpmic1_onkey_match[] = { { .compatible = "st,stpmic1-onkey" }, @@ -182,7 +182,7 @@ static struct platform_driver stpmic1_onkey_driver = { .driver = { .name = "stpmic1_onkey", .of_match_table = of_match_ptr(of_stpmic1_onkey_match), - .pm = &stpmic1_onkey_pm, + .pm = pm_sleep_ptr(&stpmic1_onkey_pm), }, }; module_platform_driver(stpmic1_onkey_driver); diff --git a/drivers/input/misc/twl4030-vibra.c b/drivers/input/misc/twl4030-vibra.c index 5619996da86f..101548b35ee3 100644 --- a/drivers/input/misc/twl4030-vibra.c +++ b/drivers/input/misc/twl4030-vibra.c @@ -143,7 +143,7 @@ static void twl4030_vibra_close(struct input_dev *input) } /*** Module ***/ -static int __maybe_unused twl4030_vibra_suspend(struct device *dev) +static int twl4030_vibra_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct vibra_info *info = platform_get_drvdata(pdev); @@ -154,14 +154,14 @@ static int __maybe_unused twl4030_vibra_suspend(struct device *dev) return 0; } -static int __maybe_unused twl4030_vibra_resume(struct device *dev) +static int twl4030_vibra_resume(struct device *dev) { vibra_disable_leds(); return 0; } -static SIMPLE_DEV_PM_OPS(twl4030_vibra_pm_ops, - twl4030_vibra_suspend, twl4030_vibra_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(twl4030_vibra_pm_ops, + twl4030_vibra_suspend, twl4030_vibra_resume); static bool twl4030_vibra_check_coexist(struct device_node *parent) { @@ -234,7 +234,7 @@ static struct platform_driver twl4030_vibra_driver = { .probe = twl4030_vibra_probe, .driver = { .name = "twl4030-vibra", - .pm = &twl4030_vibra_pm_ops, + .pm = pm_sleep_ptr(&twl4030_vibra_pm_ops), }, }; module_platform_driver(twl4030_vibra_driver); diff --git a/drivers/input/misc/twl6040-vibra.c b/drivers/input/misc/twl6040-vibra.c index bf6644927630..78f0b63e5c20 100644 --- a/drivers/input/misc/twl6040-vibra.c +++ b/drivers/input/misc/twl6040-vibra.c @@ -210,7 +210,7 @@ static void twl6040_vibra_close(struct input_dev *input) twl6040_vibra_disable(info); } -static int __maybe_unused twl6040_vibra_suspend(struct device *dev) +static int twl6040_vibra_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct vibra_info *info = platform_get_drvdata(pdev); @@ -223,7 +223,8 @@ static int __maybe_unused twl6040_vibra_suspend(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(twl6040_vibra_pm_ops, twl6040_vibra_suspend, NULL); +static DEFINE_SIMPLE_DEV_PM_OPS(twl6040_vibra_pm_ops, + twl6040_vibra_suspend, NULL); static int twl6040_vibra_probe(struct platform_device *pdev) { @@ -354,7 +355,7 @@ static struct platform_driver twl6040_vibra_driver = { .probe = twl6040_vibra_probe, .driver = { .name = "twl6040-vibra", - .pm = &twl6040_vibra_pm_ops, + .pm = pm_sleep_ptr(&twl6040_vibra_pm_ops), }, }; module_platform_driver(twl6040_vibra_driver); diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c index 80dfd72a02d3..111cb70cde46 100644 --- a/drivers/input/misc/wistron_btns.c +++ b/drivers/input/misc/wistron_btns.c @@ -1295,7 +1295,6 @@ static int wistron_remove(struct platform_device *dev) return 0; } -#ifdef CONFIG_PM static int wistron_suspend(struct device *dev) { if (have_wifi) @@ -1330,14 +1329,11 @@ static const struct dev_pm_ops wistron_pm_ops = { .poweroff = wistron_suspend, .restore = wistron_resume, }; -#endif static struct platform_driver wistron_driver = { .driver = { .name = "wistron-bios", -#ifdef CONFIG_PM - .pm = &wistron_pm_ops, -#endif + .pm = pm_sleep_ptr(&wistron_pm_ops), }, .probe = wistron_probe, .remove = wistron_remove, diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c index 7e88a6ec7989..dd7b0d70d791 100644 --- a/drivers/input/mouse/cyapa.c +++ b/drivers/input/mouse/cyapa.c @@ -1349,7 +1349,7 @@ static int cyapa_probe(struct i2c_client *client) return 0; } -static int __maybe_unused cyapa_suspend(struct device *dev) +static int cyapa_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct cyapa *cyapa = i2c_get_clientdata(client); @@ -1397,7 +1397,7 @@ static int __maybe_unused cyapa_suspend(struct device *dev) return 0; } -static int __maybe_unused cyapa_resume(struct device *dev) +static int cyapa_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct cyapa *cyapa = i2c_get_clientdata(client); @@ -1424,7 +1424,7 @@ static int __maybe_unused cyapa_resume(struct device *dev) return 0; } -static int __maybe_unused cyapa_runtime_suspend(struct device *dev) +static int cyapa_runtime_suspend(struct device *dev) { struct cyapa *cyapa = dev_get_drvdata(dev); int error; @@ -1439,7 +1439,7 @@ static int __maybe_unused cyapa_runtime_suspend(struct device *dev) return 0; } -static int __maybe_unused cyapa_runtime_resume(struct device *dev) +static int cyapa_runtime_resume(struct device *dev) { struct cyapa *cyapa = dev_get_drvdata(dev); int error; @@ -1453,8 +1453,8 @@ static int __maybe_unused cyapa_runtime_resume(struct device *dev) } static const struct dev_pm_ops cyapa_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(cyapa_suspend, cyapa_resume) - SET_RUNTIME_PM_OPS(cyapa_runtime_suspend, cyapa_runtime_resume, NULL) + SYSTEM_SLEEP_PM_OPS(cyapa_suspend, cyapa_resume) + RUNTIME_PM_OPS(cyapa_runtime_suspend, cyapa_runtime_resume, NULL) }; static const struct i2c_device_id cyapa_id_table[] = { @@ -1484,7 +1484,7 @@ MODULE_DEVICE_TABLE(of, cyapa_of_match); static struct i2c_driver cyapa_driver = { .driver = { .name = "cyapa", - .pm = &cyapa_pm_ops, + .pm = pm_ptr(&cyapa_pm_ops), .acpi_match_table = ACPI_PTR(cyapa_acpi_id), .of_match_table = of_match_ptr(cyapa_of_match), }, diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index 76729ada1582..5f0d75a45c80 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -1328,7 +1328,7 @@ static int elan_probe(struct i2c_client *client) return 0; } -static int __maybe_unused elan_suspend(struct device *dev) +static int elan_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct elan_tp_data *data = i2c_get_clientdata(client); @@ -1365,7 +1365,7 @@ err: return ret; } -static int __maybe_unused elan_resume(struct device *dev) +static int elan_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct elan_tp_data *data = i2c_get_clientdata(client); @@ -1394,7 +1394,7 @@ err: return error; } -static SIMPLE_DEV_PM_OPS(elan_pm_ops, elan_suspend, elan_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(elan_pm_ops, elan_suspend, elan_resume); static const struct i2c_device_id elan_id[] = { { DRIVER_NAME, 0 }, @@ -1418,7 +1418,7 @@ MODULE_DEVICE_TABLE(of, elan_of_match); static struct i2c_driver elan_driver = { .driver = { .name = DRIVER_NAME, - .pm = &elan_pm_ops, + .pm = pm_sleep_ptr(&elan_pm_ops), .acpi_match_table = ACPI_PTR(elan_acpi_id), .of_match_table = of_match_ptr(elan_of_match), .probe_type = PROBE_PREFER_ASYNCHRONOUS, diff --git a/drivers/input/mouse/navpoint.c b/drivers/input/mouse/navpoint.c index 4d67575bb276..2b7b86eef280 100644 --- a/drivers/input/mouse/navpoint.c +++ b/drivers/input/mouse/navpoint.c @@ -315,7 +315,7 @@ static int navpoint_remove(struct platform_device *pdev) return 0; } -static int __maybe_unused navpoint_suspend(struct device *dev) +static int navpoint_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct navpoint *navpoint = platform_get_drvdata(pdev); @@ -329,7 +329,7 @@ static int __maybe_unused navpoint_suspend(struct device *dev) return 0; } -static int __maybe_unused navpoint_resume(struct device *dev) +static int navpoint_resume(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct navpoint *navpoint = platform_get_drvdata(pdev); @@ -343,14 +343,15 @@ static int __maybe_unused navpoint_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(navpoint_pm_ops, navpoint_suspend, navpoint_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(navpoint_pm_ops, + navpoint_suspend, navpoint_resume); static struct platform_driver navpoint_driver = { .probe = navpoint_probe, .remove = navpoint_remove, .driver = { .name = "navpoint", - .pm = &navpoint_pm_ops, + .pm = pm_sleep_ptr(&navpoint_pm_ops), }, }; diff --git a/drivers/input/mouse/synaptics_i2c.c b/drivers/input/mouse/synaptics_i2c.c index 6487c8c60d5e..068692a8aba5 100644 --- a/drivers/input/mouse/synaptics_i2c.c +++ b/drivers/input/mouse/synaptics_i2c.c @@ -597,7 +597,7 @@ static void synaptics_i2c_remove(struct i2c_client *client) kfree(touch); } -static int __maybe_unused synaptics_i2c_suspend(struct device *dev) +static int synaptics_i2c_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct synaptics_i2c *touch = i2c_get_clientdata(client); @@ -610,7 +610,7 @@ static int __maybe_unused synaptics_i2c_suspend(struct device *dev) return 0; } -static int __maybe_unused synaptics_i2c_resume(struct device *dev) +static int synaptics_i2c_resume(struct device *dev) { int ret; struct i2c_client *client = to_i2c_client(dev); @@ -626,8 +626,8 @@ static int __maybe_unused synaptics_i2c_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(synaptics_i2c_pm, synaptics_i2c_suspend, - synaptics_i2c_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(synaptics_i2c_pm, synaptics_i2c_suspend, + synaptics_i2c_resume); static const struct i2c_device_id synaptics_i2c_id_table[] = { { "synaptics_i2c", 0 }, @@ -647,7 +647,7 @@ static struct i2c_driver synaptics_i2c_driver = { .driver = { .name = DRIVER_NAME, .of_match_table = of_match_ptr(synaptics_i2c_of_match), - .pm = &synaptics_i2c_pm, + .pm = pm_sleep_ptr(&synaptics_i2c_pm), }, .probe_new = synaptics_i2c_probe, diff --git a/drivers/input/rmi4/rmi_i2c.c b/drivers/input/rmi4/rmi_i2c.c index f2b75c6d3224..d69569ce8d8d 100644 --- a/drivers/input/rmi4/rmi_i2c.c +++ b/drivers/input/rmi4/rmi_i2c.c @@ -287,7 +287,6 @@ static int rmi_i2c_probe(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP static int rmi_i2c_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -323,9 +322,7 @@ static int rmi_i2c_resume(struct device *dev) return ret; } -#endif -#ifdef CONFIG_PM static int rmi_i2c_runtime_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -361,12 +358,10 @@ static int rmi_i2c_runtime_resume(struct device *dev) return 0; } -#endif static const struct dev_pm_ops rmi_i2c_pm = { - SET_SYSTEM_SLEEP_PM_OPS(rmi_i2c_suspend, rmi_i2c_resume) - SET_RUNTIME_PM_OPS(rmi_i2c_runtime_suspend, rmi_i2c_runtime_resume, - NULL) + SYSTEM_SLEEP_PM_OPS(rmi_i2c_suspend, rmi_i2c_resume) + RUNTIME_PM_OPS(rmi_i2c_runtime_suspend, rmi_i2c_runtime_resume, NULL) }; static const struct i2c_device_id rmi_id[] = { @@ -378,7 +373,7 @@ MODULE_DEVICE_TABLE(i2c, rmi_id); static struct i2c_driver rmi_i2c_driver = { .driver = { .name = "rmi4_i2c", - .pm = &rmi_i2c_pm, + .pm = pm_ptr(&rmi_i2c_pm), .of_match_table = of_match_ptr(rmi_i2c_of_match), }, .id_table = rmi_id, diff --git a/drivers/input/rmi4/rmi_smbus.c b/drivers/input/rmi4/rmi_smbus.c index 8a9ee2bd7402..4bf0e1df6a4a 100644 --- a/drivers/input/rmi4/rmi_smbus.c +++ b/drivers/input/rmi4/rmi_smbus.c @@ -344,7 +344,7 @@ static void rmi_smb_remove(struct i2c_client *client) rmi_unregister_transport_device(&rmi_smb->xport); } -static int __maybe_unused rmi_smb_suspend(struct device *dev) +static int rmi_smb_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct rmi_smb_xport *rmi_smb = i2c_get_clientdata(client); @@ -357,7 +357,7 @@ static int __maybe_unused rmi_smb_suspend(struct device *dev) return ret; } -static int __maybe_unused rmi_smb_runtime_suspend(struct device *dev) +static int rmi_smb_runtime_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct rmi_smb_xport *rmi_smb = i2c_get_clientdata(client); @@ -370,7 +370,7 @@ static int __maybe_unused rmi_smb_runtime_suspend(struct device *dev) return ret; } -static int __maybe_unused rmi_smb_resume(struct device *dev) +static int rmi_smb_resume(struct device *dev) { struct i2c_client *client = container_of(dev, struct i2c_client, dev); struct rmi_smb_xport *rmi_smb = i2c_get_clientdata(client); @@ -388,7 +388,7 @@ static int __maybe_unused rmi_smb_resume(struct device *dev) return 0; } -static int __maybe_unused rmi_smb_runtime_resume(struct device *dev) +static int rmi_smb_runtime_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct rmi_smb_xport *rmi_smb = i2c_get_clientdata(client); @@ -402,9 +402,8 @@ static int __maybe_unused rmi_smb_runtime_resume(struct device *dev) } static const struct dev_pm_ops rmi_smb_pm = { - SET_SYSTEM_SLEEP_PM_OPS(rmi_smb_suspend, rmi_smb_resume) - SET_RUNTIME_PM_OPS(rmi_smb_runtime_suspend, rmi_smb_runtime_resume, - NULL) + SYSTEM_SLEEP_PM_OPS(rmi_smb_suspend, rmi_smb_resume) + RUNTIME_PM_OPS(rmi_smb_runtime_suspend, rmi_smb_runtime_resume, NULL) }; static const struct i2c_device_id rmi_id[] = { @@ -416,7 +415,7 @@ MODULE_DEVICE_TABLE(i2c, rmi_id); static struct i2c_driver rmi_smb_driver = { .driver = { .name = "rmi4_smbus", - .pm = &rmi_smb_pm, + .pm = pm_ptr(&rmi_smb_pm), }, .id_table = rmi_id, .probe_new = rmi_smb_probe, diff --git a/drivers/input/rmi4/rmi_spi.c b/drivers/input/rmi4/rmi_spi.c index c82edda66b23..852aeb0b2c07 100644 --- a/drivers/input/rmi4/rmi_spi.c +++ b/drivers/input/rmi4/rmi_spi.c @@ -447,7 +447,6 @@ static int rmi_spi_probe(struct spi_device *spi) return 0; } -#ifdef CONFIG_PM_SLEEP static int rmi_spi_suspend(struct device *dev) { struct spi_device *spi = to_spi_device(dev); @@ -473,9 +472,7 @@ static int rmi_spi_resume(struct device *dev) return ret; } -#endif -#ifdef CONFIG_PM static int rmi_spi_runtime_suspend(struct device *dev) { struct spi_device *spi = to_spi_device(dev); @@ -501,16 +498,14 @@ static int rmi_spi_runtime_resume(struct device *dev) return 0; } -#endif static const struct dev_pm_ops rmi_spi_pm = { - SET_SYSTEM_SLEEP_PM_OPS(rmi_spi_suspend, rmi_spi_resume) - SET_RUNTIME_PM_OPS(rmi_spi_runtime_suspend, rmi_spi_runtime_resume, - NULL) + SYSTEM_SLEEP_PM_OPS(rmi_spi_suspend, rmi_spi_resume) + RUNTIME_PM_OPS(rmi_spi_runtime_suspend, rmi_spi_runtime_resume, NULL) }; static const struct spi_device_id rmi_id[] = { - { "rmi4_spi", 0 }, + { "rmi4-spi", 0 }, { } }; MODULE_DEVICE_TABLE(spi, rmi_id); @@ -518,7 +513,7 @@ MODULE_DEVICE_TABLE(spi, rmi_id); static struct spi_driver rmi_spi_driver = { .driver = { .name = "rmi4_spi", - .pm = &rmi_spi_pm, + .pm = pm_ptr(&rmi_spi_pm), .of_match_table = of_match_ptr(rmi_spi_of_match), }, .id_table = rmi_id, diff --git a/drivers/input/serio/altera_ps2.c b/drivers/input/serio/altera_ps2.c index 3a92304f64fb..9f8d7b332d1b 100644 --- a/drivers/input/serio/altera_ps2.c +++ b/drivers/input/serio/altera_ps2.c @@ -78,7 +78,6 @@ static void altera_ps2_close(struct serio *io) static int altera_ps2_probe(struct platform_device *pdev) { struct ps2if *ps2if; - struct resource *res; struct serio *serio; int error, irq; @@ -86,8 +85,7 @@ static int altera_ps2_probe(struct platform_device *pdev) if (!ps2if) return -ENOMEM; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - ps2if->base = devm_ioremap_resource(&pdev->dev, res); + ps2if->base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); if (IS_ERR(ps2if->base)) return PTR_ERR(ps2if->base); diff --git a/drivers/input/serio/ambakmi.c b/drivers/input/serio/ambakmi.c index c391700fc4ae..8fbfa448be4a 100644 --- a/drivers/input/serio/ambakmi.c +++ b/drivers/input/serio/ambakmi.c @@ -170,7 +170,7 @@ static void amba_kmi_remove(struct amba_device *dev) amba_release_regions(dev); } -static int __maybe_unused amba_kmi_resume(struct device *dev) +static int amba_kmi_resume(struct device *dev) { struct amba_kmi_port *kmi = dev_get_drvdata(dev); @@ -180,7 +180,7 @@ static int __maybe_unused amba_kmi_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(amba_kmi_dev_pm_ops, NULL, amba_kmi_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(amba_kmi_dev_pm_ops, NULL, amba_kmi_resume); static const struct amba_id amba_kmi_idtable[] = { { @@ -196,7 +196,7 @@ static struct amba_driver ambakmi_driver = { .drv = { .name = "kmi-pl050", .owner = THIS_MODULE, - .pm = &amba_kmi_dev_pm_ops, + .pm = pm_sleep_ptr(&amba_kmi_dev_pm_ops), }, .id_table = amba_kmi_idtable, .probe = amba_kmi_probe, diff --git a/drivers/input/serio/apbps2.c b/drivers/input/serio/apbps2.c index 9c9ce097f8bf..513d96e40e0e 100644 --- a/drivers/input/serio/apbps2.c +++ b/drivers/input/serio/apbps2.c @@ -132,7 +132,6 @@ static int apbps2_of_probe(struct platform_device *ofdev) struct apbps2_priv *priv; int irq, err; u32 freq_hz; - struct resource *res; priv = devm_kzalloc(&ofdev->dev, sizeof(*priv), GFP_KERNEL); if (!priv) { @@ -141,8 +140,7 @@ static int apbps2_of_probe(struct platform_device *ofdev) } /* Find Device Address */ - res = platform_get_resource(ofdev, IORESOURCE_MEM, 0); - priv->regs = devm_ioremap_resource(&ofdev->dev, res); + priv->regs = devm_platform_get_and_ioremap_resource(ofdev, 0, NULL); if (IS_ERR(priv->regs)) return PTR_ERR(priv->regs); diff --git a/drivers/input/serio/arc_ps2.c b/drivers/input/serio/arc_ps2.c index 0af9fba5d16d..a6debb13d527 100644 --- a/drivers/input/serio/arc_ps2.c +++ b/drivers/input/serio/arc_ps2.c @@ -182,7 +182,6 @@ static int arc_ps2_create_port(struct platform_device *pdev, static int arc_ps2_probe(struct platform_device *pdev) { struct arc_ps2_data *arc_ps2; - struct resource *res; int irq; int error, id, i; @@ -197,8 +196,7 @@ static int arc_ps2_probe(struct platform_device *pdev) return -ENOMEM; } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - arc_ps2->addr = devm_ioremap_resource(&pdev->dev, res); + arc_ps2->addr = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); if (IS_ERR(arc_ps2->addr)) return PTR_ERR(arc_ps2->addr); diff --git a/drivers/input/serio/olpc_apsp.c b/drivers/input/serio/olpc_apsp.c index 04d2db982fb8..33a8e5889bd8 100644 --- a/drivers/input/serio/olpc_apsp.c +++ b/drivers/input/serio/olpc_apsp.c @@ -169,7 +169,6 @@ static int olpc_apsp_probe(struct platform_device *pdev) { struct serio *kb_serio, *pad_serio; struct olpc_apsp *priv; - struct resource *res; int error; priv = devm_kzalloc(&pdev->dev, sizeof(struct olpc_apsp), GFP_KERNEL); @@ -178,8 +177,7 @@ static int olpc_apsp_probe(struct platform_device *pdev) priv->dev = &pdev->dev; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - priv->base = devm_ioremap_resource(&pdev->dev, res); + priv->base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); if (IS_ERR(priv->base)) { dev_err(&pdev->dev, "Failed to map WTM registers\n"); return PTR_ERR(priv->base); diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c index 08f5372f0bfd..edb36d663f22 100644 --- a/drivers/input/touchscreen/ad7877.c +++ b/drivers/input/touchscreen/ad7877.c @@ -788,7 +788,7 @@ static int ad7877_probe(struct spi_device *spi) return 0; } -static int __maybe_unused ad7877_suspend(struct device *dev) +static int ad7877_suspend(struct device *dev) { struct ad7877 *ts = dev_get_drvdata(dev); @@ -797,7 +797,7 @@ static int __maybe_unused ad7877_suspend(struct device *dev) return 0; } -static int __maybe_unused ad7877_resume(struct device *dev) +static int ad7877_resume(struct device *dev) { struct ad7877 *ts = dev_get_drvdata(dev); @@ -806,12 +806,12 @@ static int __maybe_unused ad7877_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(ad7877_pm, ad7877_suspend, ad7877_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(ad7877_pm, ad7877_suspend, ad7877_resume); static struct spi_driver ad7877_driver = { .driver = { .name = "ad7877", - .pm = &ad7877_pm, + .pm = pm_sleep_ptr(&ad7877_pm), }, .probe = ad7877_probe, }; diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index bed68a68f330..17f11bce8113 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c @@ -843,14 +843,8 @@ static void ads7846_report_state(struct ads7846 *ts) if (x == MAX_12BIT) x = 0; - if (ts->model == 7843) { + if (ts->model == 7843 || ts->model == 7845) { Rt = ts->pressure_max / 2; - } else if (ts->model == 7845) { - if (get_pendown_state(ts)) - Rt = ts->pressure_max / 2; - else - Rt = 0; - dev_vdbg(&ts->spi->dev, "x/y: %d/%d, PD %d\n", x, y, Rt); } else if (likely(x && z1)) { /* compute touch pressure resistance using equation #2 */ Rt = z2; @@ -944,7 +938,7 @@ static irqreturn_t ads7846_irq(int irq, void *handle) return IRQ_HANDLED; } -static int __maybe_unused ads7846_suspend(struct device *dev) +static int ads7846_suspend(struct device *dev) { struct ads7846 *ts = dev_get_drvdata(dev); @@ -966,7 +960,7 @@ static int __maybe_unused ads7846_suspend(struct device *dev) return 0; } -static int __maybe_unused ads7846_resume(struct device *dev) +static int ads7846_resume(struct device *dev) { struct ads7846 *ts = dev_get_drvdata(dev); @@ -988,7 +982,7 @@ static int __maybe_unused ads7846_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(ads7846_pm, ads7846_suspend, ads7846_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(ads7846_pm, ads7846_suspend, ads7846_resume); static int ads7846_setup_pendown(struct spi_device *spi, struct ads7846 *ts, @@ -1066,6 +1060,9 @@ static int ads7846_setup_spi_msg(struct ads7846 *ts, struct ads7846_buf_layout *l = &packet->l[cmd_idx]; unsigned int max_count; + if (cmd_idx == packet->cmds - 1) + cmd_idx = ADS7846_PWDOWN; + if (ads7846_cmd_need_settle(cmd_idx)) max_count = packet->count + packet->count_skip; else @@ -1102,7 +1099,12 @@ static int ads7846_setup_spi_msg(struct ads7846 *ts, for (cmd_idx = 0; cmd_idx < packet->cmds; cmd_idx++) { struct ads7846_buf_layout *l = &packet->l[cmd_idx]; - u8 cmd = ads7846_get_cmd(cmd_idx, vref); + u8 cmd; + + if (cmd_idx == packet->cmds - 1) + cmd_idx = ADS7846_PWDOWN; + + cmd = ads7846_get_cmd(cmd_idx, vref); for (b = 0; b < l->count; b++) packet->tx[l->offset + b].cmd = cmd; @@ -1316,8 +1318,9 @@ static int ads7846_probe(struct spi_device *spi) pdata->y_min ? : 0, pdata->y_max ? : MAX_12BIT, 0, 0); - input_set_abs_params(input_dev, ABS_PRESSURE, - pdata->pressure_min, pdata->pressure_max, 0, 0); + if (ts->model != 7845) + input_set_abs_params(input_dev, ABS_PRESSURE, + pdata->pressure_min, pdata->pressure_max, 0, 0); /* * Parse common framework properties. Must be done here to ensure the @@ -1421,7 +1424,7 @@ static void ads7846_remove(struct spi_device *spi) static struct spi_driver ads7846_driver = { .driver = { .name = "ads7846", - .pm = &ads7846_pm, + .pm = pm_sleep_ptr(&ads7846_pm), .of_match_table = of_match_ptr(ads7846_dt_ids), }, .probe = ads7846_probe, diff --git a/drivers/input/touchscreen/ar1021_i2c.c b/drivers/input/touchscreen/ar1021_i2c.c index 25bcc677e98b..3a5b65cae360 100644 --- a/drivers/input/touchscreen/ar1021_i2c.c +++ b/drivers/input/touchscreen/ar1021_i2c.c @@ -142,7 +142,7 @@ static int ar1021_i2c_probe(struct i2c_client *client) return 0; } -static int __maybe_unused ar1021_i2c_suspend(struct device *dev) +static int ar1021_i2c_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -151,7 +151,7 @@ static int __maybe_unused ar1021_i2c_suspend(struct device *dev) return 0; } -static int __maybe_unused ar1021_i2c_resume(struct device *dev) +static int ar1021_i2c_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -160,7 +160,8 @@ static int __maybe_unused ar1021_i2c_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(ar1021_i2c_pm, ar1021_i2c_suspend, ar1021_i2c_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(ar1021_i2c_pm, + ar1021_i2c_suspend, ar1021_i2c_resume); static const struct i2c_device_id ar1021_i2c_id[] = { { "ar1021", 0 }, @@ -177,7 +178,7 @@ MODULE_DEVICE_TABLE(of, ar1021_i2c_of_match); static struct i2c_driver ar1021_i2c_driver = { .driver = { .name = "ar1021_i2c", - .pm = &ar1021_i2c_pm, + .pm = pm_sleep_ptr(&ar1021_i2c_pm), .of_match_table = ar1021_i2c_of_match, }, diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 39ef2664b852..996bf434e1cb 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -3296,7 +3296,7 @@ static void mxt_remove(struct i2c_client *client) data->regulators); } -static int __maybe_unused mxt_suspend(struct device *dev) +static int mxt_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct mxt_data *data = i2c_get_clientdata(client); @@ -3317,7 +3317,7 @@ static int __maybe_unused mxt_suspend(struct device *dev) return 0; } -static int __maybe_unused mxt_resume(struct device *dev) +static int mxt_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct mxt_data *data = i2c_get_clientdata(client); @@ -3338,7 +3338,7 @@ static int __maybe_unused mxt_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(mxt_pm_ops, mxt_suspend, mxt_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(mxt_pm_ops, mxt_suspend, mxt_resume); static const struct of_device_id mxt_of_match[] = { { .compatible = "atmel,maxtouch", }, @@ -3375,7 +3375,7 @@ static struct i2c_driver mxt_driver = { .name = "atmel_mxt_ts", .of_match_table = mxt_of_match, .acpi_match_table = ACPI_PTR(mxt_acpi_id), - .pm = &mxt_pm_ops, + .pm = pm_sleep_ptr(&mxt_pm_ops), }, .probe_new = mxt_probe, .remove = mxt_remove, diff --git a/drivers/input/touchscreen/auo-pixcir-ts.c b/drivers/input/touchscreen/auo-pixcir-ts.c index a4a1d58aeeac..5359efc80b2b 100644 --- a/drivers/input/touchscreen/auo-pixcir-ts.c +++ b/drivers/input/touchscreen/auo-pixcir-ts.c @@ -410,7 +410,7 @@ static void auo_pixcir_input_close(struct input_dev *dev) auo_pixcir_stop(ts); } -static int __maybe_unused auo_pixcir_suspend(struct device *dev) +static int auo_pixcir_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct auo_pixcir_ts *ts = i2c_get_clientdata(client); @@ -442,7 +442,7 @@ unlock: return ret; } -static int __maybe_unused auo_pixcir_resume(struct device *dev) +static int auo_pixcir_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct auo_pixcir_ts *ts = i2c_get_clientdata(client); @@ -472,8 +472,8 @@ unlock: return ret; } -static SIMPLE_DEV_PM_OPS(auo_pixcir_pm_ops, - auo_pixcir_suspend, auo_pixcir_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(auo_pixcir_pm_ops, + auo_pixcir_suspend, auo_pixcir_resume); static void auo_pixcir_reset(void *data) { @@ -633,7 +633,7 @@ MODULE_DEVICE_TABLE(of, auo_pixcir_ts_dt_idtable); static struct i2c_driver auo_pixcir_driver = { .driver = { .name = "auo_pixcir_ts", - .pm = &auo_pixcir_pm_ops, + .pm = pm_sleep_ptr(&auo_pixcir_pm_ops), .of_match_table = of_match_ptr(auo_pixcir_ts_dt_idtable), }, .probe_new = auo_pixcir_probe, diff --git a/drivers/input/touchscreen/bu21013_ts.c b/drivers/input/touchscreen/bu21013_ts.c index 5a4dbd39a372..c994ab6f4e58 100644 --- a/drivers/input/touchscreen/bu21013_ts.c +++ b/drivers/input/touchscreen/bu21013_ts.c @@ -560,7 +560,7 @@ static void bu21013_remove(struct i2c_client *client) /* The resources will be freed by devm */ } -static int __maybe_unused bu21013_suspend(struct device *dev) +static int bu21013_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct bu21013_ts *ts = i2c_get_clientdata(client); @@ -575,7 +575,7 @@ static int __maybe_unused bu21013_suspend(struct device *dev) return 0; } -static int __maybe_unused bu21013_resume(struct device *dev) +static int bu21013_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct bu21013_ts *ts = i2c_get_clientdata(client); @@ -604,7 +604,7 @@ static int __maybe_unused bu21013_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(bu21013_dev_pm_ops, bu21013_suspend, bu21013_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(bu21013_dev_pm_ops, bu21013_suspend, bu21013_resume); static const struct i2c_device_id bu21013_id[] = { { DRIVER_TP, 0 }, @@ -615,7 +615,7 @@ MODULE_DEVICE_TABLE(i2c, bu21013_id); static struct i2c_driver bu21013_driver = { .driver = { .name = DRIVER_TP, - .pm = &bu21013_dev_pm_ops, + .pm = pm_sleep_ptr(&bu21013_dev_pm_ops), }, .probe_new = bu21013_probe, .remove = bu21013_remove, diff --git a/drivers/input/touchscreen/bu21029_ts.c b/drivers/input/touchscreen/bu21029_ts.c index 215f4dc5105d..8f1442894ff9 100644 --- a/drivers/input/touchscreen/bu21029_ts.c +++ b/drivers/input/touchscreen/bu21029_ts.c @@ -422,7 +422,7 @@ static int bu21029_probe(struct i2c_client *client) return 0; } -static int __maybe_unused bu21029_suspend(struct device *dev) +static int bu21029_suspend(struct device *dev) { struct i2c_client *i2c = to_i2c_client(dev); struct bu21029_ts_data *bu21029 = i2c_get_clientdata(i2c); @@ -437,7 +437,7 @@ static int __maybe_unused bu21029_suspend(struct device *dev) return 0; } -static int __maybe_unused bu21029_resume(struct device *dev) +static int bu21029_resume(struct device *dev) { struct i2c_client *i2c = to_i2c_client(dev); struct bu21029_ts_data *bu21029 = i2c_get_clientdata(i2c); @@ -451,7 +451,7 @@ static int __maybe_unused bu21029_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(bu21029_pm_ops, bu21029_suspend, bu21029_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(bu21029_pm_ops, bu21029_suspend, bu21029_resume); static const struct i2c_device_id bu21029_ids[] = { { DRIVER_NAME, 0 }, @@ -471,7 +471,7 @@ static struct i2c_driver bu21029_driver = { .driver = { .name = DRIVER_NAME, .of_match_table = of_match_ptr(bu21029_of_ids), - .pm = &bu21029_pm_ops, + .pm = pm_sleep_ptr(&bu21029_pm_ops), }, .id_table = bu21029_ids, .probe_new = bu21029_probe, diff --git a/drivers/input/touchscreen/chipone_icn8318.c b/drivers/input/touchscreen/chipone_icn8318.c index f6769e4bd4f2..32b714a6ed2d 100644 --- a/drivers/input/touchscreen/chipone_icn8318.c +++ b/drivers/input/touchscreen/chipone_icn8318.c @@ -148,7 +148,6 @@ static void icn8318_stop(struct input_dev *dev) gpiod_set_value_cansleep(data->wake_gpio, 0); } -#ifdef CONFIG_PM_SLEEP static int icn8318_suspend(struct device *dev) { struct icn8318_data *data = i2c_get_clientdata(to_i2c_client(dev)); @@ -172,9 +171,8 @@ static int icn8318_resume(struct device *dev) return 0; } -#endif -static SIMPLE_DEV_PM_OPS(icn8318_pm_ops, icn8318_suspend, icn8318_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(icn8318_pm_ops, icn8318_suspend, icn8318_resume); static int icn8318_probe(struct i2c_client *client) { @@ -263,7 +261,7 @@ MODULE_DEVICE_TABLE(i2c, icn8318_i2c_id); static struct i2c_driver icn8318_driver = { .driver = { .name = "chipone_icn8318", - .pm = &icn8318_pm_ops, + .pm = pm_sleep_ptr(&icn8318_pm_ops), .of_match_table = icn8318_of_match, }, .probe_new = icn8318_probe, diff --git a/drivers/input/touchscreen/chipone_icn8505.c b/drivers/input/touchscreen/chipone_icn8505.c index c421f4be2700..246bee0bee53 100644 --- a/drivers/input/touchscreen/chipone_icn8505.c +++ b/drivers/input/touchscreen/chipone_icn8505.c @@ -460,7 +460,7 @@ static int icn8505_probe(struct i2c_client *client) return 0; } -static int __maybe_unused icn8505_suspend(struct device *dev) +static int icn8505_suspend(struct device *dev) { struct icn8505_data *icn8505 = i2c_get_clientdata(to_i2c_client(dev)); @@ -471,7 +471,7 @@ static int __maybe_unused icn8505_suspend(struct device *dev) return 0; } -static int __maybe_unused icn8505_resume(struct device *dev) +static int icn8505_resume(struct device *dev) { struct icn8505_data *icn8505 = i2c_get_clientdata(to_i2c_client(dev)); int error; @@ -484,7 +484,7 @@ static int __maybe_unused icn8505_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(icn8505_pm_ops, icn8505_suspend, icn8505_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(icn8505_pm_ops, icn8505_suspend, icn8505_resume); static const struct acpi_device_id icn8505_acpi_match[] = { { "CHPN0001" }, @@ -495,7 +495,7 @@ MODULE_DEVICE_TABLE(acpi, icn8505_acpi_match); static struct i2c_driver icn8505_driver = { .driver = { .name = "chipone_icn8505", - .pm = &icn8505_pm_ops, + .pm = pm_sleep_ptr(&icn8505_pm_ops), .acpi_match_table = icn8505_acpi_match, }, .probe_new = icn8505_probe, diff --git a/drivers/input/touchscreen/cy8ctma140.c b/drivers/input/touchscreen/cy8ctma140.c index 3a91d948b7f6..cd86477d971a 100644 --- a/drivers/input/touchscreen/cy8ctma140.c +++ b/drivers/input/touchscreen/cy8ctma140.c @@ -296,7 +296,7 @@ static int cy8ctma140_probe(struct i2c_client *client) return 0; } -static int __maybe_unused cy8ctma140_suspend(struct device *dev) +static int cy8ctma140_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct cy8ctma140 *ts = i2c_get_clientdata(client); @@ -307,7 +307,7 @@ static int __maybe_unused cy8ctma140_suspend(struct device *dev) return 0; } -static int __maybe_unused cy8ctma140_resume(struct device *dev) +static int cy8ctma140_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct cy8ctma140 *ts = i2c_get_clientdata(client); @@ -322,7 +322,8 @@ static int __maybe_unused cy8ctma140_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(cy8ctma140_pm, cy8ctma140_suspend, cy8ctma140_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(cy8ctma140_pm, + cy8ctma140_suspend, cy8ctma140_resume); static const struct i2c_device_id cy8ctma140_idtable[] = { { CY8CTMA140_NAME, 0 }, @@ -339,7 +340,7 @@ MODULE_DEVICE_TABLE(of, cy8ctma140_of_match); static struct i2c_driver cy8ctma140_driver = { .driver = { .name = CY8CTMA140_NAME, - .pm = &cy8ctma140_pm, + .pm = pm_sleep_ptr(&cy8ctma140_pm), .of_match_table = cy8ctma140_of_match, }, .id_table = cy8ctma140_idtable, diff --git a/drivers/input/touchscreen/cy8ctmg110_ts.c b/drivers/input/touchscreen/cy8ctmg110_ts.c index 7c2b7309dbaf..dcf50fbf6dc7 100644 --- a/drivers/input/touchscreen/cy8ctmg110_ts.c +++ b/drivers/input/touchscreen/cy8ctmg110_ts.c @@ -237,7 +237,7 @@ static int cy8ctmg110_probe(struct i2c_client *client) return 0; } -static int __maybe_unused cy8ctmg110_suspend(struct device *dev) +static int cy8ctmg110_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct cy8ctmg110 *ts = i2c_get_clientdata(client); @@ -250,7 +250,7 @@ static int __maybe_unused cy8ctmg110_suspend(struct device *dev) return 0; } -static int __maybe_unused cy8ctmg110_resume(struct device *dev) +static int cy8ctmg110_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct cy8ctmg110 *ts = i2c_get_clientdata(client); @@ -263,7 +263,8 @@ static int __maybe_unused cy8ctmg110_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(cy8ctmg110_pm, cy8ctmg110_suspend, cy8ctmg110_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(cy8ctmg110_pm, + cy8ctmg110_suspend, cy8ctmg110_resume); static const struct i2c_device_id cy8ctmg110_idtable[] = { { CY8CTMG110_DRIVER_NAME, 1 }, @@ -275,7 +276,7 @@ MODULE_DEVICE_TABLE(i2c, cy8ctmg110_idtable); static struct i2c_driver cy8ctmg110_driver = { .driver = { .name = CY8CTMG110_DRIVER_NAME, - .pm = &cy8ctmg110_pm, + .pm = pm_sleep_ptr(&cy8ctmg110_pm), }, .id_table = cy8ctmg110_idtable, .probe_new = cy8ctmg110_probe, diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c index dccbcb942fe5..0cd6f626adec 100644 --- a/drivers/input/touchscreen/cyttsp4_core.c +++ b/drivers/input/touchscreen/cyttsp4_core.c @@ -1744,7 +1744,6 @@ static void cyttsp4_free_si_ptrs(struct cyttsp4 *cd) kfree(si->btn_rec_data); } -#ifdef CONFIG_PM static int cyttsp4_core_sleep(struct cyttsp4 *cd) { int rc; @@ -1877,13 +1876,9 @@ static int cyttsp4_core_resume(struct device *dev) return 0; } -#endif -const struct dev_pm_ops cyttsp4_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(cyttsp4_core_suspend, cyttsp4_core_resume) - SET_RUNTIME_PM_OPS(cyttsp4_core_suspend, cyttsp4_core_resume, NULL) -}; -EXPORT_SYMBOL_GPL(cyttsp4_pm_ops); +EXPORT_GPL_RUNTIME_DEV_PM_OPS(cyttsp4_pm_ops, + cyttsp4_core_suspend, cyttsp4_core_resume, NULL); static int cyttsp4_mt_open(struct input_dev *input) { diff --git a/drivers/input/touchscreen/cyttsp4_i2c.c b/drivers/input/touchscreen/cyttsp4_i2c.c index c260bab0c62c..ec7a4779f3fb 100644 --- a/drivers/input/touchscreen/cyttsp4_i2c.c +++ b/drivers/input/touchscreen/cyttsp4_i2c.c @@ -58,7 +58,7 @@ MODULE_DEVICE_TABLE(i2c, cyttsp4_i2c_id); static struct i2c_driver cyttsp4_i2c_driver = { .driver = { .name = CYTTSP4_I2C_NAME, - .pm = &cyttsp4_pm_ops, + .pm = pm_ptr(&cyttsp4_pm_ops), }, .probe_new = cyttsp4_i2c_probe, .remove = cyttsp4_i2c_remove, diff --git a/drivers/input/touchscreen/cyttsp4_spi.c b/drivers/input/touchscreen/cyttsp4_spi.c index 5d7db84f2749..944fbbe9113e 100644 --- a/drivers/input/touchscreen/cyttsp4_spi.c +++ b/drivers/input/touchscreen/cyttsp4_spi.c @@ -173,7 +173,7 @@ static void cyttsp4_spi_remove(struct spi_device *spi) static struct spi_driver cyttsp4_spi_driver = { .driver = { .name = CYTTSP4_SPI_NAME, - .pm = &cyttsp4_pm_ops, + .pm = pm_ptr(&cyttsp4_pm_ops), }, .probe = cyttsp4_spi_probe, .remove = cyttsp4_spi_remove, diff --git a/drivers/input/touchscreen/cyttsp5.c b/drivers/input/touchscreen/cyttsp5.c index 4a23d6231382..16caffa35dd9 100644 --- a/drivers/input/touchscreen/cyttsp5.c +++ b/drivers/input/touchscreen/cyttsp5.c @@ -29,7 +29,7 @@ #define CY_MAX_INPUT 512 #define CYTTSP5_PREALLOCATED_CMD_BUFFER 32 #define CY_BITS_PER_BTN 1 -#define CY_NUM_BTN_EVENT_ID GENMASK(CY_BITS_PER_BTN, 0) +#define CY_NUM_BTN_EVENT_ID GENMASK(CY_BITS_PER_BTN - 1, 0) #define MAX_AREA 255 #define HID_OUTPUT_BL_SOP 0x1 diff --git a/drivers/input/touchscreen/cyttsp_core.c b/drivers/input/touchscreen/cyttsp_core.c index 1dbd849c9613..132ed5786e84 100644 --- a/drivers/input/touchscreen/cyttsp_core.c +++ b/drivers/input/touchscreen/cyttsp_core.c @@ -491,7 +491,7 @@ static int cyttsp_disable(struct cyttsp *ts) return 0; } -static int __maybe_unused cyttsp_suspend(struct device *dev) +static int cyttsp_suspend(struct device *dev) { struct cyttsp *ts = dev_get_drvdata(dev); int retval = 0; @@ -509,7 +509,7 @@ static int __maybe_unused cyttsp_suspend(struct device *dev) return retval; } -static int __maybe_unused cyttsp_resume(struct device *dev) +static int cyttsp_resume(struct device *dev) { struct cyttsp *ts = dev_get_drvdata(dev); @@ -525,8 +525,7 @@ static int __maybe_unused cyttsp_resume(struct device *dev) return 0; } -SIMPLE_DEV_PM_OPS(cyttsp_pm_ops, cyttsp_suspend, cyttsp_resume); -EXPORT_SYMBOL_GPL(cyttsp_pm_ops); +EXPORT_GPL_SIMPLE_DEV_PM_OPS(cyttsp_pm_ops, cyttsp_suspend, cyttsp_resume); static int cyttsp_open(struct input_dev *dev) { diff --git a/drivers/input/touchscreen/cyttsp_i2c.c b/drivers/input/touchscreen/cyttsp_i2c.c index 0155a1626adf..3f91cb43ec82 100644 --- a/drivers/input/touchscreen/cyttsp_i2c.c +++ b/drivers/input/touchscreen/cyttsp_i2c.c @@ -63,7 +63,7 @@ MODULE_DEVICE_TABLE(of, cyttsp_of_i2c_match); static struct i2c_driver cyttsp_i2c_driver = { .driver = { .name = CY_I2C_NAME, - .pm = &cyttsp_pm_ops, + .pm = pm_sleep_ptr(&cyttsp_pm_ops), .of_match_table = cyttsp_of_i2c_match, }, .probe_new = cyttsp_i2c_probe, diff --git a/drivers/input/touchscreen/cyttsp_spi.c b/drivers/input/touchscreen/cyttsp_spi.c index 30c6fbf86a86..ada17f2dadf3 100644 --- a/drivers/input/touchscreen/cyttsp_spi.c +++ b/drivers/input/touchscreen/cyttsp_spi.c @@ -172,7 +172,7 @@ MODULE_DEVICE_TABLE(of, cyttsp_of_spi_match); static struct spi_driver cyttsp_spi_driver = { .driver = { .name = CY_SPI_NAME, - .pm = &cyttsp_pm_ops, + .pm = pm_sleep_ptr(&cyttsp_pm_ops), .of_match_table = cyttsp_of_spi_match, }, .probe = cyttsp_spi_probe, diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index ddd0f1f62458..2746649561c7 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -931,7 +931,7 @@ static int edt_ft5x06_ts_identify(struct i2c_client *client, } else { /* If it is not an EDT M06/M12 touchscreen, then the model * detection is a bit hairy. The different ft5x06 - * firmares around don't reliably implement the + * firmwares around don't reliably implement the * identification registers. Well, we'll take a shot. * * The main difference between generic focaltec based @@ -1353,7 +1353,7 @@ static void edt_ft5x06_ts_remove(struct i2c_client *client) edt_ft5x06_ts_teardown_debugfs(tsdata); } -static int __maybe_unused edt_ft5x06_ts_suspend(struct device *dev) +static int edt_ft5x06_ts_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client); @@ -1396,7 +1396,7 @@ static int __maybe_unused edt_ft5x06_ts_suspend(struct device *dev) return 0; } -static int __maybe_unused edt_ft5x06_ts_resume(struct device *dev) +static int edt_ft5x06_ts_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client); @@ -1459,8 +1459,8 @@ static int __maybe_unused edt_ft5x06_ts_resume(struct device *dev) return ret; } -static SIMPLE_DEV_PM_OPS(edt_ft5x06_ts_pm_ops, - edt_ft5x06_ts_suspend, edt_ft5x06_ts_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(edt_ft5x06_ts_pm_ops, + edt_ft5x06_ts_suspend, edt_ft5x06_ts_resume); static const struct edt_i2c_chip_data edt_ft5x06_data = { .max_support_points = 5, @@ -1500,7 +1500,7 @@ static struct i2c_driver edt_ft5x06_ts_driver = { .driver = { .name = "edt_ft5x06", .of_match_table = edt_ft5x06_of_match, - .pm = &edt_ft5x06_ts_pm_ops, + .pm = pm_sleep_ptr(&edt_ft5x06_ts_pm_ops), .probe_type = PROBE_PREFER_ASYNCHRONOUS, }, .id_table = edt_ft5x06_ts_id, diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c index c8ab03f49227..56fa21688bdb 100644 --- a/drivers/input/touchscreen/eeti_ts.c +++ b/drivers/input/touchscreen/eeti_ts.c @@ -232,7 +232,7 @@ static int eeti_ts_probe(struct i2c_client *client) return 0; } -static int __maybe_unused eeti_ts_suspend(struct device *dev) +static int eeti_ts_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct eeti_ts *eeti = i2c_get_clientdata(client); @@ -251,7 +251,7 @@ static int __maybe_unused eeti_ts_suspend(struct device *dev) return 0; } -static int __maybe_unused eeti_ts_resume(struct device *dev) +static int eeti_ts_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct eeti_ts *eeti = i2c_get_clientdata(client); @@ -270,7 +270,7 @@ static int __maybe_unused eeti_ts_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(eeti_ts_pm, eeti_ts_suspend, eeti_ts_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(eeti_ts_pm, eeti_ts_suspend, eeti_ts_resume); static const struct i2c_device_id eeti_ts_id[] = { { "eeti_ts", 0 }, @@ -288,7 +288,7 @@ static const struct of_device_id of_eeti_ts_match[] = { static struct i2c_driver eeti_ts_driver = { .driver = { .name = "eeti_ts", - .pm = &eeti_ts_pm, + .pm = pm_sleep_ptr(&eeti_ts_pm), .of_match_table = of_match_ptr(of_eeti_ts_match), }, .probe_new = eeti_ts_probe, diff --git a/drivers/input/touchscreen/egalax_ts.c b/drivers/input/touchscreen/egalax_ts.c index 742d47a75ac1..1a9805938e6d 100644 --- a/drivers/input/touchscreen/egalax_ts.c +++ b/drivers/input/touchscreen/egalax_ts.c @@ -223,7 +223,7 @@ static const struct i2c_device_id egalax_ts_id[] = { }; MODULE_DEVICE_TABLE(i2c, egalax_ts_id); -static int __maybe_unused egalax_ts_suspend(struct device *dev) +static int egalax_ts_suspend(struct device *dev) { static const u8 suspend_cmd[MAX_I2C_DATA_LEN] = { 0x3, 0x6, 0xa, 0x3, 0x36, 0x3f, 0x2, 0, 0, 0 @@ -238,7 +238,7 @@ static int __maybe_unused egalax_ts_suspend(struct device *dev) return ret > 0 ? 0 : ret; } -static int __maybe_unused egalax_ts_resume(struct device *dev) +static int egalax_ts_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -248,7 +248,8 @@ static int __maybe_unused egalax_ts_resume(struct device *dev) return egalax_wake_up_device(client); } -static SIMPLE_DEV_PM_OPS(egalax_ts_pm_ops, egalax_ts_suspend, egalax_ts_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(egalax_ts_pm_ops, + egalax_ts_suspend, egalax_ts_resume); static const struct of_device_id egalax_ts_dt_ids[] = { { .compatible = "eeti,egalax_ts" }, @@ -259,7 +260,7 @@ MODULE_DEVICE_TABLE(of, egalax_ts_dt_ids); static struct i2c_driver egalax_ts_driver = { .driver = { .name = "egalax_ts", - .pm = &egalax_ts_pm_ops, + .pm = pm_sleep_ptr(&egalax_ts_pm_ops), .of_match_table = egalax_ts_dt_ids, }, .id_table = egalax_ts_id, diff --git a/drivers/input/touchscreen/ektf2127.c b/drivers/input/touchscreen/ektf2127.c index 328841eaa1b7..e6f1e46d003d 100644 --- a/drivers/input/touchscreen/ektf2127.c +++ b/drivers/input/touchscreen/ektf2127.c @@ -177,7 +177,7 @@ static void ektf2127_stop(struct input_dev *dev) gpiod_set_value_cansleep(ts->power_gpios, 0); } -static int __maybe_unused ektf2127_suspend(struct device *dev) +static int ektf2127_suspend(struct device *dev) { struct ektf2127_ts *ts = i2c_get_clientdata(to_i2c_client(dev)); @@ -189,7 +189,7 @@ static int __maybe_unused ektf2127_suspend(struct device *dev) return 0; } -static int __maybe_unused ektf2127_resume(struct device *dev) +static int ektf2127_resume(struct device *dev) { struct ektf2127_ts *ts = i2c_get_clientdata(to_i2c_client(dev)); @@ -201,8 +201,8 @@ static int __maybe_unused ektf2127_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(ektf2127_pm_ops, ektf2127_suspend, - ektf2127_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(ektf2127_pm_ops, ektf2127_suspend, + ektf2127_resume); static int ektf2127_query_dimension(struct i2c_client *client, bool width) { @@ -348,7 +348,7 @@ MODULE_DEVICE_TABLE(i2c, ektf2127_i2c_id); static struct i2c_driver ektf2127_driver = { .driver = { .name = "elan_ektf2127", - .pm = &ektf2127_pm_ops, + .pm = pm_sleep_ptr(&ektf2127_pm_ops), .of_match_table = of_match_ptr(ektf2127_of_match), }, .probe_new = ektf2127_probe, diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c index 5452b50f8a77..8a16eb51481f 100644 --- a/drivers/input/touchscreen/elants_i2c.c +++ b/drivers/input/touchscreen/elants_i2c.c @@ -1572,7 +1572,7 @@ static int elants_i2c_probe(struct i2c_client *client) return 0; } -static int __maybe_unused elants_i2c_suspend(struct device *dev) +static int elants_i2c_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct elants_data *ts = i2c_get_clientdata(client); @@ -1611,7 +1611,7 @@ static int __maybe_unused elants_i2c_suspend(struct device *dev) return 0; } -static int __maybe_unused elants_i2c_resume(struct device *dev) +static int elants_i2c_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct elants_data *ts = i2c_get_clientdata(client); @@ -1644,8 +1644,8 @@ static int __maybe_unused elants_i2c_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(elants_i2c_pm_ops, - elants_i2c_suspend, elants_i2c_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(elants_i2c_pm_ops, + elants_i2c_suspend, elants_i2c_resume); static const struct i2c_device_id elants_i2c_id[] = { { DEVICE_NAME, EKTH3500 }, @@ -1677,7 +1677,7 @@ static struct i2c_driver elants_i2c_driver = { .id_table = elants_i2c_id, .driver = { .name = DEVICE_NAME, - .pm = &elants_i2c_pm_ops, + .pm = pm_sleep_ptr(&elants_i2c_pm_ops), .acpi_match_table = ACPI_PTR(elants_acpi_id), .of_match_table = of_match_ptr(elants_of_match), .probe_type = PROBE_PREFER_ASYNCHRONOUS, diff --git a/drivers/input/touchscreen/exc3000.c b/drivers/input/touchscreen/exc3000.c index 4b7eee01c6aa..69eae79e2087 100644 --- a/drivers/input/touchscreen/exc3000.c +++ b/drivers/input/touchscreen/exc3000.c @@ -109,6 +109,11 @@ static inline void exc3000_schedule_timer(struct exc3000_data *data) mod_timer(&data->timer, jiffies + msecs_to_jiffies(EXC3000_TIMEOUT_MS)); } +static void exc3000_shutdown_timer(void *timer) +{ + timer_shutdown_sync(timer); +} + static int exc3000_read_frame(struct exc3000_data *data, u8 *buf) { struct i2c_client *client = data->client; @@ -386,6 +391,11 @@ static int exc3000_probe(struct i2c_client *client) if (error) return error; + error = devm_add_action_or_reset(&client->dev, exc3000_shutdown_timer, + &data->timer); + if (error) + return error; + error = devm_request_threaded_irq(&client->dev, client->irq, NULL, exc3000_interrupt, IRQF_ONESHOT, client->name, data); diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index 8a0a8078de8f..b348172f19c3 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -1401,7 +1401,7 @@ static void goodix_ts_remove(struct i2c_client *client) wait_for_completion(&ts->firmware_loading_complete); } -static int __maybe_unused goodix_suspend(struct device *dev) +static int goodix_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct goodix_ts_data *ts = i2c_get_clientdata(client); @@ -1448,7 +1448,7 @@ static int __maybe_unused goodix_suspend(struct device *dev) return 0; } -static int __maybe_unused goodix_resume(struct device *dev) +static int goodix_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct goodix_ts_data *ts = i2c_get_clientdata(client); @@ -1497,7 +1497,7 @@ static int __maybe_unused goodix_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(goodix_pm_ops, goodix_suspend, goodix_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(goodix_pm_ops, goodix_suspend, goodix_resume); static const struct i2c_device_id goodix_ts_id[] = { { "GDIX1001:00", 0 }, @@ -1543,7 +1543,7 @@ static struct i2c_driver goodix_ts_driver = { .name = "Goodix-TS", .acpi_match_table = ACPI_PTR(goodix_acpi_match), .of_match_table = of_match_ptr(goodix_of_match), - .pm = &goodix_pm_ops, + .pm = pm_sleep_ptr(&goodix_pm_ops), }, }; module_i2c_driver(goodix_ts_driver); diff --git a/drivers/input/touchscreen/hideep.c b/drivers/input/touchscreen/hideep.c index ff4bb4c14898..bd454d93f1f7 100644 --- a/drivers/input/touchscreen/hideep.c +++ b/drivers/input/touchscreen/hideep.c @@ -959,7 +959,7 @@ static const struct attribute_group hideep_ts_attr_group = { .attrs = hideep_ts_sysfs_entries, }; -static int __maybe_unused hideep_suspend(struct device *dev) +static int hideep_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct hideep_ts *ts = i2c_get_clientdata(client); @@ -970,7 +970,7 @@ static int __maybe_unused hideep_suspend(struct device *dev) return 0; } -static int __maybe_unused hideep_resume(struct device *dev) +static int hideep_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct hideep_ts *ts = i2c_get_clientdata(client); @@ -987,7 +987,7 @@ static int __maybe_unused hideep_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(hideep_pm_ops, hideep_suspend, hideep_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(hideep_pm_ops, hideep_suspend, hideep_resume); static const struct regmap_config hideep_regmap_config = { .reg_bits = 16, @@ -1108,7 +1108,7 @@ static struct i2c_driver hideep_driver = { .name = HIDEEP_I2C_NAME, .of_match_table = of_match_ptr(hideep_match_table), .acpi_match_table = ACPI_PTR(hideep_acpi_id), - .pm = &hideep_pm_ops, + .pm = pm_sleep_ptr(&hideep_pm_ops), }, .id_table = hideep_i2c_id, .probe_new = hideep_probe, diff --git a/drivers/input/touchscreen/ilitek_ts_i2c.c b/drivers/input/touchscreen/ilitek_ts_i2c.c index e6ade3775a8a..d69809338498 100644 --- a/drivers/input/touchscreen/ilitek_ts_i2c.c +++ b/drivers/input/touchscreen/ilitek_ts_i2c.c @@ -604,7 +604,7 @@ static int ilitek_ts_i2c_probe(struct i2c_client *client) return 0; } -static int __maybe_unused ilitek_suspend(struct device *dev) +static int ilitek_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct ilitek_ts_data *ts = i2c_get_clientdata(client); @@ -621,7 +621,7 @@ static int __maybe_unused ilitek_suspend(struct device *dev) return 0; } -static int __maybe_unused ilitek_resume(struct device *dev) +static int ilitek_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct ilitek_ts_data *ts = i2c_get_clientdata(client); @@ -640,7 +640,7 @@ static int __maybe_unused ilitek_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(ilitek_pm_ops, ilitek_suspend, ilitek_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(ilitek_pm_ops, ilitek_suspend, ilitek_resume); static const struct i2c_device_id ilitek_ts_i2c_id[] = { { ILITEK_TS_NAME, 0 }, @@ -675,7 +675,7 @@ MODULE_DEVICE_TABLE(of, ilitek_ts_i2c_match); static struct i2c_driver ilitek_ts_i2c_driver = { .driver = { .name = ILITEK_TS_NAME, - .pm = &ilitek_pm_ops, + .pm = pm_sleep_ptr(&ilitek_pm_ops), .of_match_table = of_match_ptr(ilitek_ts_i2c_match), .acpi_match_table = ACPI_PTR(ilitekts_acpi_id), }, diff --git a/drivers/input/touchscreen/imagis.c b/drivers/input/touchscreen/imagis.c index e2697e6c6d2a..de1b16e94bb8 100644 --- a/drivers/input/touchscreen/imagis.c +++ b/drivers/input/touchscreen/imagis.c @@ -309,7 +309,7 @@ static int imagis_probe(struct i2c_client *i2c) return 0; } -static int __maybe_unused imagis_suspend(struct device *dev) +static int imagis_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct imagis_ts *ts = i2c_get_clientdata(client); @@ -325,7 +325,7 @@ static int __maybe_unused imagis_suspend(struct device *dev) return retval; } -static int __maybe_unused imagis_resume(struct device *dev) +static int imagis_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct imagis_ts *ts = i2c_get_clientdata(client); @@ -341,7 +341,7 @@ static int __maybe_unused imagis_resume(struct device *dev) return retval; } -static SIMPLE_DEV_PM_OPS(imagis_pm_ops, imagis_suspend, imagis_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(imagis_pm_ops, imagis_suspend, imagis_resume); #ifdef CONFIG_OF static const struct of_device_id imagis_of_match[] = { @@ -354,7 +354,7 @@ MODULE_DEVICE_TABLE(of, imagis_of_match); static struct i2c_driver imagis_ts_driver = { .driver = { .name = "imagis-touchscreen", - .pm = &imagis_pm_ops, + .pm = pm_sleep_ptr(&imagis_pm_ops), .of_match_table = of_match_ptr(imagis_of_match), }, .probe_new = imagis_probe, diff --git a/drivers/input/touchscreen/imx6ul_tsc.c b/drivers/input/touchscreen/imx6ul_tsc.c index 2d4facf70cdb..6ac8fa84ed9f 100644 --- a/drivers/input/touchscreen/imx6ul_tsc.c +++ b/drivers/input/touchscreen/imx6ul_tsc.c @@ -512,7 +512,7 @@ static int imx6ul_tsc_probe(struct platform_device *pdev) return 0; } -static int __maybe_unused imx6ul_tsc_suspend(struct device *dev) +static int imx6ul_tsc_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct imx6ul_tsc *tsc = platform_get_drvdata(pdev); @@ -528,7 +528,7 @@ static int __maybe_unused imx6ul_tsc_suspend(struct device *dev) return 0; } -static int __maybe_unused imx6ul_tsc_resume(struct device *dev) +static int imx6ul_tsc_resume(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct imx6ul_tsc *tsc = platform_get_drvdata(pdev); @@ -545,8 +545,8 @@ static int __maybe_unused imx6ul_tsc_resume(struct device *dev) return retval; } -static SIMPLE_DEV_PM_OPS(imx6ul_tsc_pm_ops, - imx6ul_tsc_suspend, imx6ul_tsc_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(imx6ul_tsc_pm_ops, + imx6ul_tsc_suspend, imx6ul_tsc_resume); static const struct of_device_id imx6ul_tsc_match[] = { { .compatible = "fsl,imx6ul-tsc", }, @@ -558,7 +558,7 @@ static struct platform_driver imx6ul_tsc_driver = { .driver = { .name = "imx6ul-tsc", .of_match_table = imx6ul_tsc_match, - .pm = &imx6ul_tsc_pm_ops, + .pm = pm_sleep_ptr(&imx6ul_tsc_pm_ops), }, .probe = imx6ul_tsc_probe, }; diff --git a/drivers/input/touchscreen/ipaq-micro-ts.c b/drivers/input/touchscreen/ipaq-micro-ts.c index 0eb5689fe65f..94720c41c9be 100644 --- a/drivers/input/touchscreen/ipaq-micro-ts.c +++ b/drivers/input/touchscreen/ipaq-micro-ts.c @@ -119,7 +119,7 @@ static int micro_ts_probe(struct platform_device *pdev) return 0; } -static int __maybe_unused micro_ts_suspend(struct device *dev) +static int micro_ts_suspend(struct device *dev) { struct touchscreen_data *ts = dev_get_drvdata(dev); @@ -128,7 +128,7 @@ static int __maybe_unused micro_ts_suspend(struct device *dev) return 0; } -static int __maybe_unused micro_ts_resume(struct device *dev) +static int micro_ts_resume(struct device *dev) { struct touchscreen_data *ts = dev_get_drvdata(dev); struct input_dev *input = ts->input; @@ -143,14 +143,13 @@ static int __maybe_unused micro_ts_resume(struct device *dev) return 0; } -static const struct dev_pm_ops micro_ts_dev_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(micro_ts_suspend, micro_ts_resume) -}; +static DEFINE_SIMPLE_DEV_PM_OPS(micro_ts_dev_pm_ops, + micro_ts_suspend, micro_ts_resume); static struct platform_driver micro_ts_device_driver = { .driver = { .name = "ipaq-micro-ts", - .pm = µ_ts_dev_pm_ops, + .pm = pm_sleep_ptr(µ_ts_dev_pm_ops), }, .probe = micro_ts_probe, }; diff --git a/drivers/input/touchscreen/iqs5xx.c b/drivers/input/touchscreen/iqs5xx.c index dc3137a34f35..c73e9c5c0077 100644 --- a/drivers/input/touchscreen/iqs5xx.c +++ b/drivers/input/touchscreen/iqs5xx.c @@ -979,7 +979,7 @@ static const struct attribute_group iqs5xx_attr_group = { .attrs = iqs5xx_attrs, }; -static int __maybe_unused iqs5xx_suspend(struct device *dev) +static int iqs5xx_suspend(struct device *dev) { struct iqs5xx_private *iqs5xx = dev_get_drvdata(dev); struct input_dev *input = iqs5xx->input; @@ -998,7 +998,7 @@ static int __maybe_unused iqs5xx_suspend(struct device *dev) return error; } -static int __maybe_unused iqs5xx_resume(struct device *dev) +static int iqs5xx_resume(struct device *dev) { struct iqs5xx_private *iqs5xx = dev_get_drvdata(dev); struct input_dev *input = iqs5xx->input; @@ -1017,7 +1017,7 @@ static int __maybe_unused iqs5xx_resume(struct device *dev) return error; } -static SIMPLE_DEV_PM_OPS(iqs5xx_pm, iqs5xx_suspend, iqs5xx_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(iqs5xx_pm, iqs5xx_suspend, iqs5xx_resume); static int iqs5xx_probe(struct i2c_client *client) { @@ -1090,7 +1090,7 @@ static struct i2c_driver iqs5xx_i2c_driver = { .driver = { .name = "iqs5xx", .of_match_table = iqs5xx_of_match, - .pm = &iqs5xx_pm, + .pm = pm_sleep_ptr(&iqs5xx_pm), }, .id_table = iqs5xx_id, .probe_new = iqs5xx_probe, diff --git a/drivers/input/touchscreen/mcs5000_ts.c b/drivers/input/touchscreen/mcs5000_ts.c index ea9517cad695..704e36087ca2 100644 --- a/drivers/input/touchscreen/mcs5000_ts.c +++ b/drivers/input/touchscreen/mcs5000_ts.c @@ -241,7 +241,7 @@ static int mcs5000_ts_probe(struct i2c_client *client) return 0; } -static int __maybe_unused mcs5000_ts_suspend(struct device *dev) +static int mcs5000_ts_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -251,7 +251,7 @@ static int __maybe_unused mcs5000_ts_suspend(struct device *dev) return 0; } -static int __maybe_unused mcs5000_ts_resume(struct device *dev) +static int mcs5000_ts_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct mcs5000_ts_data *data = i2c_get_clientdata(client); @@ -262,7 +262,8 @@ static int __maybe_unused mcs5000_ts_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(mcs5000_ts_pm, mcs5000_ts_suspend, mcs5000_ts_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(mcs5000_ts_pm, + mcs5000_ts_suspend, mcs5000_ts_resume); static const struct i2c_device_id mcs5000_ts_id[] = { { "mcs5000_ts", 0 }, @@ -274,7 +275,7 @@ static struct i2c_driver mcs5000_ts_driver = { .probe_new = mcs5000_ts_probe, .driver = { .name = "mcs5000_ts", - .pm = &mcs5000_ts_pm, + .pm = pm_sleep_ptr(&mcs5000_ts_pm), }, .id_table = mcs5000_ts_id, }; diff --git a/drivers/input/touchscreen/melfas_mip4.c b/drivers/input/touchscreen/melfas_mip4.c index 4ee8ed4c930c..acdfbdea2b6e 100644 --- a/drivers/input/touchscreen/melfas_mip4.c +++ b/drivers/input/touchscreen/melfas_mip4.c @@ -1528,7 +1528,7 @@ static int mip4_probe(struct i2c_client *client) return 0; } -static int __maybe_unused mip4_suspend(struct device *dev) +static int mip4_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct mip4_ts *ts = i2c_get_clientdata(client); @@ -1546,7 +1546,7 @@ static int __maybe_unused mip4_suspend(struct device *dev) return 0; } -static int __maybe_unused mip4_resume(struct device *dev) +static int mip4_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct mip4_ts *ts = i2c_get_clientdata(client); @@ -1564,7 +1564,7 @@ static int __maybe_unused mip4_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(mip4_pm_ops, mip4_suspend, mip4_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(mip4_pm_ops, mip4_suspend, mip4_resume); #ifdef CONFIG_OF static const struct of_device_id mip4_of_match[] = { @@ -1595,7 +1595,7 @@ static struct i2c_driver mip4_driver = { .name = MIP4_DEVICE_NAME, .of_match_table = of_match_ptr(mip4_of_match), .acpi_match_table = ACPI_PTR(mip4_acpi_match), - .pm = &mip4_pm_ops, + .pm = pm_sleep_ptr(&mip4_pm_ops), }, }; module_i2c_driver(mip4_driver); diff --git a/drivers/input/touchscreen/migor_ts.c b/drivers/input/touchscreen/migor_ts.c index ff0f605f3a3a..69fcc88d4f80 100644 --- a/drivers/input/touchscreen/migor_ts.c +++ b/drivers/input/touchscreen/migor_ts.c @@ -186,7 +186,7 @@ static void migor_ts_remove(struct i2c_client *client) dev_set_drvdata(&client->dev, NULL); } -static int __maybe_unused migor_ts_suspend(struct device *dev) +static int migor_ts_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct migor_ts_priv *priv = i2c_get_clientdata(client); @@ -197,7 +197,7 @@ static int __maybe_unused migor_ts_suspend(struct device *dev) return 0; } -static int __maybe_unused migor_ts_resume(struct device *dev) +static int migor_ts_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct migor_ts_priv *priv = i2c_get_clientdata(client); @@ -208,7 +208,7 @@ static int __maybe_unused migor_ts_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(migor_ts_pm, migor_ts_suspend, migor_ts_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(migor_ts_pm, migor_ts_suspend, migor_ts_resume); static const struct i2c_device_id migor_ts_id[] = { { "migor_ts", 0 }, @@ -219,7 +219,7 @@ MODULE_DEVICE_TABLE(i2c, migor_ts_id); static struct i2c_driver migor_ts_driver = { .driver = { .name = "migor_ts", - .pm = &migor_ts_pm, + .pm = pm_sleep_ptr(&migor_ts_pm), }, .probe_new = migor_ts_probe, .remove = migor_ts_remove, diff --git a/drivers/input/touchscreen/mms114.c b/drivers/input/touchscreen/mms114.c index 758b669391a7..4dbca1aad89d 100644 --- a/drivers/input/touchscreen/mms114.c +++ b/drivers/input/touchscreen/mms114.c @@ -557,7 +557,7 @@ static int mms114_probe(struct i2c_client *client) return 0; } -static int __maybe_unused mms114_suspend(struct device *dev) +static int mms114_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct mms114_data *data = i2c_get_clientdata(client); @@ -581,7 +581,7 @@ static int __maybe_unused mms114_suspend(struct device *dev) return 0; } -static int __maybe_unused mms114_resume(struct device *dev) +static int mms114_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct mms114_data *data = i2c_get_clientdata(client); @@ -601,7 +601,7 @@ static int __maybe_unused mms114_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(mms114_pm_ops, mms114_suspend, mms114_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(mms114_pm_ops, mms114_suspend, mms114_resume); static const struct i2c_device_id mms114_id[] = { { "mms114", 0 }, @@ -635,7 +635,7 @@ MODULE_DEVICE_TABLE(of, mms114_dt_match); static struct i2c_driver mms114_driver = { .driver = { .name = "mms114", - .pm = &mms114_pm_ops, + .pm = pm_sleep_ptr(&mms114_pm_ops), .of_match_table = of_match_ptr(mms114_dt_match), }, .probe_new = mms114_probe, diff --git a/drivers/input/touchscreen/msg2638.c b/drivers/input/touchscreen/msg2638.c index 4c0816b09d33..b23db689d995 100644 --- a/drivers/input/touchscreen/msg2638.c +++ b/drivers/input/touchscreen/msg2638.c @@ -441,7 +441,7 @@ static int msg2638_ts_probe(struct i2c_client *client) return 0; } -static int __maybe_unused msg2638_suspend(struct device *dev) +static int msg2638_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct msg2638_ts_data *msg2638 = i2c_get_clientdata(client); @@ -456,7 +456,7 @@ static int __maybe_unused msg2638_suspend(struct device *dev) return 0; } -static int __maybe_unused msg2638_resume(struct device *dev) +static int msg2638_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct msg2638_ts_data *msg2638 = i2c_get_clientdata(client); @@ -472,7 +472,7 @@ static int __maybe_unused msg2638_resume(struct device *dev) return ret; } -static SIMPLE_DEV_PM_OPS(msg2638_pm_ops, msg2638_suspend, msg2638_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(msg2638_pm_ops, msg2638_suspend, msg2638_resume); static const struct msg_chip_data msg2138_data = { .irq_handler = msg2138_ts_irq_handler, @@ -495,7 +495,7 @@ static struct i2c_driver msg2638_ts_driver = { .probe_new = msg2638_ts_probe, .driver = { .name = "MStar-TS", - .pm = &msg2638_pm_ops, + .pm = pm_sleep_ptr(&msg2638_pm_ops), .of_match_table = msg2638_of_match, }, }; diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c index 7959947a3458..f09f4831bad4 100644 --- a/drivers/input/touchscreen/pixcir_i2c_ts.c +++ b/drivers/input/touchscreen/pixcir_i2c_ts.c @@ -405,7 +405,7 @@ static void pixcir_input_close(struct input_dev *dev) pixcir_stop(ts); } -static int __maybe_unused pixcir_i2c_ts_suspend(struct device *dev) +static int pixcir_i2c_ts_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct pixcir_i2c_ts_data *ts = i2c_get_clientdata(client); @@ -432,7 +432,7 @@ unlock: return ret; } -static int __maybe_unused pixcir_i2c_ts_resume(struct device *dev) +static int pixcir_i2c_ts_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct pixcir_i2c_ts_data *ts = i2c_get_clientdata(client); @@ -459,8 +459,8 @@ unlock: return ret; } -static SIMPLE_DEV_PM_OPS(pixcir_dev_pm_ops, - pixcir_i2c_ts_suspend, pixcir_i2c_ts_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(pixcir_dev_pm_ops, + pixcir_i2c_ts_suspend, pixcir_i2c_ts_resume); static int pixcir_i2c_ts_probe(struct i2c_client *client) { @@ -614,7 +614,7 @@ MODULE_DEVICE_TABLE(of, pixcir_of_match); static struct i2c_driver pixcir_i2c_ts_driver = { .driver = { .name = "pixcir_ts", - .pm = &pixcir_dev_pm_ops, + .pm = pm_sleep_ptr(&pixcir_dev_pm_ops), .of_match_table = of_match_ptr(pixcir_of_match), }, .probe_new = pixcir_i2c_ts_probe, diff --git a/drivers/input/touchscreen/raydium_i2c_ts.c b/drivers/input/touchscreen/raydium_i2c_ts.c index d690a17240c2..49a06d3876cf 100644 --- a/drivers/input/touchscreen/raydium_i2c_ts.c +++ b/drivers/input/touchscreen/raydium_i2c_ts.c @@ -1197,7 +1197,7 @@ static int raydium_i2c_probe(struct i2c_client *client) return 0; } -static void __maybe_unused raydium_enter_sleep(struct i2c_client *client) +static void raydium_enter_sleep(struct i2c_client *client) { static const u8 sleep_cmd[] = { 0x5A, 0xff, 0x00, 0x0f }; int error; @@ -1209,7 +1209,7 @@ static void __maybe_unused raydium_enter_sleep(struct i2c_client *client) "sleep command failed: %d\n", error); } -static int __maybe_unused raydium_i2c_suspend(struct device *dev) +static int raydium_i2c_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct raydium_data *ts = i2c_get_clientdata(client); @@ -1229,7 +1229,7 @@ static int __maybe_unused raydium_i2c_suspend(struct device *dev) return 0; } -static int __maybe_unused raydium_i2c_resume(struct device *dev) +static int raydium_i2c_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct raydium_data *ts = i2c_get_clientdata(client); @@ -1246,8 +1246,8 @@ static int __maybe_unused raydium_i2c_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(raydium_i2c_pm_ops, - raydium_i2c_suspend, raydium_i2c_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(raydium_i2c_pm_ops, + raydium_i2c_suspend, raydium_i2c_resume); static const struct i2c_device_id raydium_i2c_id[] = { { "raydium_i2c", 0 }, @@ -1277,7 +1277,7 @@ static struct i2c_driver raydium_i2c_driver = { .id_table = raydium_i2c_id, .driver = { .name = "raydium_ts", - .pm = &raydium_i2c_pm_ops, + .pm = pm_sleep_ptr(&raydium_i2c_pm_ops), .acpi_match_table = ACPI_PTR(raydium_acpi_id), .of_match_table = of_match_ptr(raydium_of_match), }, diff --git a/drivers/input/touchscreen/s6sy761.c b/drivers/input/touchscreen/s6sy761.c index cc417c03aaca..371cf4848ad5 100644 --- a/drivers/input/touchscreen/s6sy761.c +++ b/drivers/input/touchscreen/s6sy761.c @@ -479,7 +479,7 @@ static void s6sy761_remove(struct i2c_client *client) pm_runtime_disable(&client->dev); } -static int __maybe_unused s6sy761_runtime_suspend(struct device *dev) +static int s6sy761_runtime_suspend(struct device *dev) { struct s6sy761_data *sdata = dev_get_drvdata(dev); @@ -487,7 +487,7 @@ static int __maybe_unused s6sy761_runtime_suspend(struct device *dev) S6SY761_APPLICATION_MODE, S6SY761_APP_SLEEP); } -static int __maybe_unused s6sy761_runtime_resume(struct device *dev) +static int s6sy761_runtime_resume(struct device *dev) { struct s6sy761_data *sdata = dev_get_drvdata(dev); @@ -495,7 +495,7 @@ static int __maybe_unused s6sy761_runtime_resume(struct device *dev) S6SY761_APPLICATION_MODE, S6SY761_APP_NORMAL); } -static int __maybe_unused s6sy761_suspend(struct device *dev) +static int s6sy761_suspend(struct device *dev) { struct s6sy761_data *sdata = dev_get_drvdata(dev); @@ -504,7 +504,7 @@ static int __maybe_unused s6sy761_suspend(struct device *dev) return 0; } -static int __maybe_unused s6sy761_resume(struct device *dev) +static int s6sy761_resume(struct device *dev) { struct s6sy761_data *sdata = dev_get_drvdata(dev); @@ -514,9 +514,8 @@ static int __maybe_unused s6sy761_resume(struct device *dev) } static const struct dev_pm_ops s6sy761_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(s6sy761_suspend, s6sy761_resume) - SET_RUNTIME_PM_OPS(s6sy761_runtime_suspend, - s6sy761_runtime_resume, NULL) + SYSTEM_SLEEP_PM_OPS(s6sy761_suspend, s6sy761_resume) + RUNTIME_PM_OPS(s6sy761_runtime_suspend, s6sy761_runtime_resume, NULL) }; #ifdef CONFIG_OF @@ -537,7 +536,7 @@ static struct i2c_driver s6sy761_driver = { .driver = { .name = S6SY761_DEV_NAME, .of_match_table = of_match_ptr(s6sy761_of_match), - .pm = &s6sy761_pm_ops, + .pm = pm_ptr(&s6sy761_pm_ops), }, .probe_new = s6sy761_probe, .remove = s6sy761_remove, diff --git a/drivers/input/touchscreen/silead.c b/drivers/input/touchscreen/silead.c index 8a7351c4414c..a37fac089010 100644 --- a/drivers/input/touchscreen/silead.c +++ b/drivers/input/touchscreen/silead.c @@ -736,7 +736,7 @@ static int silead_ts_probe(struct i2c_client *client) return 0; } -static int __maybe_unused silead_ts_suspend(struct device *dev) +static int silead_ts_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -745,7 +745,7 @@ static int __maybe_unused silead_ts_suspend(struct device *dev) return 0; } -static int __maybe_unused silead_ts_resume(struct device *dev) +static int silead_ts_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); bool second_try = false; @@ -784,7 +784,7 @@ static int __maybe_unused silead_ts_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(silead_ts_pm, silead_ts_suspend, silead_ts_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(silead_ts_pm, silead_ts_suspend, silead_ts_resume); static const struct i2c_device_id silead_ts_id[] = { { "gsl1680", 0 }, @@ -832,7 +832,7 @@ static struct i2c_driver silead_ts_driver = { .name = SILEAD_TS_NAME, .acpi_match_table = ACPI_PTR(silead_ts_acpi_match), .of_match_table = of_match_ptr(silead_ts_of_match), - .pm = &silead_ts_pm, + .pm = pm_sleep_ptr(&silead_ts_pm), }, }; module_i2c_driver(silead_ts_driver); diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c index bd68633dc6c0..f49566dc96f8 100644 --- a/drivers/input/touchscreen/st1232.c +++ b/drivers/input/touchscreen/st1232.c @@ -340,7 +340,7 @@ static int st1232_ts_probe(struct i2c_client *client) return 0; } -static int __maybe_unused st1232_ts_suspend(struct device *dev) +static int st1232_ts_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct st1232_ts_data *ts = i2c_get_clientdata(client); @@ -353,7 +353,7 @@ static int __maybe_unused st1232_ts_suspend(struct device *dev) return 0; } -static int __maybe_unused st1232_ts_resume(struct device *dev) +static int st1232_ts_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct st1232_ts_data *ts = i2c_get_clientdata(client); @@ -366,8 +366,8 @@ static int __maybe_unused st1232_ts_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(st1232_ts_pm_ops, - st1232_ts_suspend, st1232_ts_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(st1232_ts_pm_ops, + st1232_ts_suspend, st1232_ts_resume); static const struct i2c_device_id st1232_ts_id[] = { { ST1232_TS_NAME, (unsigned long)&st1232_chip_info }, @@ -390,7 +390,7 @@ static struct i2c_driver st1232_ts_driver = { .name = ST1232_TS_NAME, .of_match_table = st1232_ts_dt_ids, .probe_type = PROBE_PREFER_ASYNCHRONOUS, - .pm = &st1232_ts_pm_ops, + .pm = pm_sleep_ptr(&st1232_ts_pm_ops), }, }; diff --git a/drivers/input/touchscreen/stmfts.c b/drivers/input/touchscreen/stmfts.c index d092e89d40e8..fdbf5e68943c 100644 --- a/drivers/input/touchscreen/stmfts.c +++ b/drivers/input/touchscreen/stmfts.c @@ -742,7 +742,7 @@ static void stmfts_remove(struct i2c_client *client) pm_runtime_disable(&client->dev); } -static int __maybe_unused stmfts_runtime_suspend(struct device *dev) +static int stmfts_runtime_suspend(struct device *dev) { struct stmfts_data *sdata = dev_get_drvdata(dev); int ret; @@ -754,7 +754,7 @@ static int __maybe_unused stmfts_runtime_suspend(struct device *dev) return ret; } -static int __maybe_unused stmfts_runtime_resume(struct device *dev) +static int stmfts_runtime_resume(struct device *dev) { struct stmfts_data *sdata = dev_get_drvdata(dev); int ret; @@ -766,7 +766,7 @@ static int __maybe_unused stmfts_runtime_resume(struct device *dev) return ret; } -static int __maybe_unused stmfts_suspend(struct device *dev) +static int stmfts_suspend(struct device *dev) { struct stmfts_data *sdata = dev_get_drvdata(dev); @@ -775,7 +775,7 @@ static int __maybe_unused stmfts_suspend(struct device *dev) return 0; } -static int __maybe_unused stmfts_resume(struct device *dev) +static int stmfts_resume(struct device *dev) { struct stmfts_data *sdata = dev_get_drvdata(dev); @@ -783,8 +783,8 @@ static int __maybe_unused stmfts_resume(struct device *dev) } static const struct dev_pm_ops stmfts_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(stmfts_suspend, stmfts_resume) - SET_RUNTIME_PM_OPS(stmfts_runtime_suspend, stmfts_runtime_resume, NULL) + SYSTEM_SLEEP_PM_OPS(stmfts_suspend, stmfts_resume) + RUNTIME_PM_OPS(stmfts_runtime_suspend, stmfts_runtime_resume, NULL) }; #ifdef CONFIG_OF @@ -805,7 +805,7 @@ static struct i2c_driver stmfts_driver = { .driver = { .name = STMFTS_DEV_NAME, .of_match_table = of_match_ptr(stmfts_of_match), - .pm = &stmfts_pm_ops, + .pm = pm_ptr(&stmfts_pm_ops), .probe_type = PROBE_PREFER_ASYNCHRONOUS, }, .probe_new = stmfts_probe, diff --git a/drivers/input/touchscreen/surface3_spi.c b/drivers/input/touchscreen/surface3_spi.c index 1da23e5585a0..31d140248f2e 100644 --- a/drivers/input/touchscreen/surface3_spi.c +++ b/drivers/input/touchscreen/surface3_spi.c @@ -369,7 +369,7 @@ static int surface3_spi_probe(struct spi_device *spi) return 0; } -static int __maybe_unused surface3_spi_suspend(struct device *dev) +static int surface3_spi_suspend(struct device *dev) { struct spi_device *spi = to_spi_device(dev); struct surface3_ts_data *data = spi_get_drvdata(spi); @@ -381,7 +381,7 @@ static int __maybe_unused surface3_spi_suspend(struct device *dev) return 0; } -static int __maybe_unused surface3_spi_resume(struct device *dev) +static int surface3_spi_resume(struct device *dev) { struct spi_device *spi = to_spi_device(dev); struct surface3_ts_data *data = spi_get_drvdata(spi); @@ -393,9 +393,9 @@ static int __maybe_unused surface3_spi_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(surface3_spi_pm_ops, - surface3_spi_suspend, - surface3_spi_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(surface3_spi_pm_ops, + surface3_spi_suspend, + surface3_spi_resume); #ifdef CONFIG_ACPI static const struct acpi_device_id surface3_spi_acpi_match[] = { @@ -409,7 +409,7 @@ static struct spi_driver surface3_spi_driver = { .driver = { .name = "Surface3-spi", .acpi_match_table = ACPI_PTR(surface3_spi_acpi_match), - .pm = &surface3_spi_pm_ops, + .pm = pm_sleep_ptr(&surface3_spi_pm_ops), }, .probe = surface3_spi_probe, }; diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c index f2fb6a9a1a57..decf2d24a115 100644 --- a/drivers/input/touchscreen/ti_am335x_tsc.c +++ b/drivers/input/touchscreen/ti_am335x_tsc.c @@ -512,7 +512,7 @@ static int titsc_remove(struct platform_device *pdev) return 0; } -static int __maybe_unused titsc_suspend(struct device *dev) +static int titsc_suspend(struct device *dev) { struct titsc *ts_dev = dev_get_drvdata(dev); unsigned int idle; @@ -527,7 +527,7 @@ static int __maybe_unused titsc_suspend(struct device *dev) return 0; } -static int __maybe_unused titsc_resume(struct device *dev) +static int titsc_resume(struct device *dev) { struct titsc *ts_dev = dev_get_drvdata(dev); @@ -543,7 +543,7 @@ static int __maybe_unused titsc_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(titsc_pm_ops, titsc_suspend, titsc_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(titsc_pm_ops, titsc_suspend, titsc_resume); static const struct of_device_id ti_tsc_dt_ids[] = { { .compatible = "ti,am3359-tsc", }, @@ -556,7 +556,7 @@ static struct platform_driver ti_tsc_driver = { .remove = titsc_remove, .driver = { .name = "TI-am335x-tsc", - .pm = &titsc_pm_ops, + .pm = pm_sleep_ptr(&titsc_pm_ops), .of_match_table = ti_tsc_dt_ids, }, }; diff --git a/drivers/input/touchscreen/tsc2004.c b/drivers/input/touchscreen/tsc2004.c index 575768b587bb..45f39eb20638 100644 --- a/drivers/input/touchscreen/tsc2004.c +++ b/drivers/input/touchscreen/tsc2004.c @@ -65,7 +65,7 @@ static struct i2c_driver tsc2004_driver = { .driver = { .name = "tsc2004", .of_match_table = of_match_ptr(tsc2004_of_match), - .pm = &tsc200x_pm_ops, + .pm = pm_sleep_ptr(&tsc200x_pm_ops), }, .id_table = tsc2004_idtable, .probe_new = tsc2004_probe, diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c index 555dfe98b3c4..b6dfbcfc8c19 100644 --- a/drivers/input/touchscreen/tsc2005.c +++ b/drivers/input/touchscreen/tsc2005.c @@ -81,7 +81,7 @@ static struct spi_driver tsc2005_driver = { .driver = { .name = "tsc2005", .of_match_table = of_match_ptr(tsc2005_of_match), - .pm = &tsc200x_pm_ops, + .pm = pm_sleep_ptr(&tsc200x_pm_ops), }, .probe = tsc2005_probe, .remove = tsc2005_remove, diff --git a/drivers/input/touchscreen/tsc200x-core.c b/drivers/input/touchscreen/tsc200x-core.c index 72c7258b93a5..b799f26fcf8f 100644 --- a/drivers/input/touchscreen/tsc200x-core.c +++ b/drivers/input/touchscreen/tsc200x-core.c @@ -588,7 +588,7 @@ void tsc200x_remove(struct device *dev) } EXPORT_SYMBOL_GPL(tsc200x_remove); -static int __maybe_unused tsc200x_suspend(struct device *dev) +static int tsc200x_suspend(struct device *dev) { struct tsc200x *ts = dev_get_drvdata(dev); @@ -604,7 +604,7 @@ static int __maybe_unused tsc200x_suspend(struct device *dev) return 0; } -static int __maybe_unused tsc200x_resume(struct device *dev) +static int tsc200x_resume(struct device *dev) { struct tsc200x *ts = dev_get_drvdata(dev); @@ -620,8 +620,7 @@ static int __maybe_unused tsc200x_resume(struct device *dev) return 0; } -SIMPLE_DEV_PM_OPS(tsc200x_pm_ops, tsc200x_suspend, tsc200x_resume); -EXPORT_SYMBOL_GPL(tsc200x_pm_ops); +EXPORT_GPL_SIMPLE_DEV_PM_OPS(tsc200x_pm_ops, tsc200x_suspend, tsc200x_resume); MODULE_AUTHOR("Lauri Leukkunen <lauri.leukkunen@nokia.com>"); MODULE_DESCRIPTION("TSC200x Touchscreen Driver Core"); diff --git a/drivers/input/touchscreen/wacom_i2c.c b/drivers/input/touchscreen/wacom_i2c.c index c9188ee00c62..a145b9105255 100644 --- a/drivers/input/touchscreen/wacom_i2c.c +++ b/drivers/input/touchscreen/wacom_i2c.c @@ -232,7 +232,7 @@ static int wacom_i2c_probe(struct i2c_client *client) return 0; } -static int __maybe_unused wacom_i2c_suspend(struct device *dev) +static int wacom_i2c_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -241,7 +241,7 @@ static int __maybe_unused wacom_i2c_suspend(struct device *dev) return 0; } -static int __maybe_unused wacom_i2c_resume(struct device *dev) +static int wacom_i2c_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -250,7 +250,7 @@ static int __maybe_unused wacom_i2c_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(wacom_i2c_pm, wacom_i2c_suspend, wacom_i2c_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(wacom_i2c_pm, wacom_i2c_suspend, wacom_i2c_resume); static const struct i2c_device_id wacom_i2c_id[] = { { "WAC_I2C_EMR", 0 }, @@ -261,7 +261,7 @@ MODULE_DEVICE_TABLE(i2c, wacom_i2c_id); static struct i2c_driver wacom_i2c_driver = { .driver = { .name = "wacom_i2c", - .pm = &wacom_i2c_pm, + .pm = pm_sleep_ptr(&wacom_i2c_pm), }, .probe_new = wacom_i2c_probe, diff --git a/drivers/input/touchscreen/wdt87xx_i2c.c b/drivers/input/touchscreen/wdt87xx_i2c.c index 3f87db5cdca4..771962af3d0a 100644 --- a/drivers/input/touchscreen/wdt87xx_i2c.c +++ b/drivers/input/touchscreen/wdt87xx_i2c.c @@ -1113,7 +1113,7 @@ static int wdt87xx_ts_probe(struct i2c_client *client) return 0; } -static int __maybe_unused wdt87xx_suspend(struct device *dev) +static int wdt87xx_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); int error; @@ -1132,7 +1132,7 @@ static int __maybe_unused wdt87xx_suspend(struct device *dev) return 0; } -static int __maybe_unused wdt87xx_resume(struct device *dev) +static int wdt87xx_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); int error; @@ -1154,7 +1154,7 @@ static int __maybe_unused wdt87xx_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(wdt87xx_pm_ops, wdt87xx_suspend, wdt87xx_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(wdt87xx_pm_ops, wdt87xx_suspend, wdt87xx_resume); static const struct i2c_device_id wdt87xx_dev_id[] = { { WDT87XX_NAME, 0 }, @@ -1173,7 +1173,7 @@ static struct i2c_driver wdt87xx_driver = { .id_table = wdt87xx_dev_id, .driver = { .name = WDT87XX_NAME, - .pm = &wdt87xx_pm_ops, + .pm = pm_sleep_ptr(&wdt87xx_pm_ops), .acpi_match_table = ACPI_PTR(wdt87xx_acpi_id), }, }; diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c index f51ab5614532..ac3b3dd59488 100644 --- a/drivers/input/touchscreen/wm97xx-core.c +++ b/drivers/input/touchscreen/wm97xx-core.c @@ -763,7 +763,7 @@ static int wm97xx_mfd_remove(struct platform_device *pdev) return 0; } -static int __maybe_unused wm97xx_suspend(struct device *dev) +static int wm97xx_suspend(struct device *dev) { struct wm97xx *wm = dev_get_drvdata(dev); u16 reg; @@ -797,7 +797,7 @@ static int __maybe_unused wm97xx_suspend(struct device *dev) return 0; } -static int __maybe_unused wm97xx_resume(struct device *dev) +static int wm97xx_resume(struct device *dev) { struct wm97xx *wm = dev_get_drvdata(dev); @@ -833,7 +833,7 @@ static int __maybe_unused wm97xx_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(wm97xx_pm_ops, wm97xx_suspend, wm97xx_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(wm97xx_pm_ops, wm97xx_suspend, wm97xx_resume); /* * Machine specific operations @@ -869,13 +869,13 @@ static struct device_driver wm97xx_driver = { .owner = THIS_MODULE, .probe = wm97xx_probe, .remove = wm97xx_remove, - .pm = &wm97xx_pm_ops, + .pm = pm_sleep_ptr(&wm97xx_pm_ops), }; static struct platform_driver wm97xx_mfd_driver = { .driver = { .name = "wm97xx-ts", - .pm = &wm97xx_pm_ops, + .pm = pm_sleep_ptr(&wm97xx_pm_ops), }, .probe = wm97xx_mfd_probe, .remove = wm97xx_mfd_remove, diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index 24e78ca83fa3..76b194285e1c 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c @@ -608,7 +608,7 @@ static void zforce_input_close(struct input_dev *dev) return; } -static int __maybe_unused zforce_suspend(struct device *dev) +static int zforce_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct zforce_ts *ts = i2c_get_clientdata(client); @@ -653,7 +653,7 @@ unlock: return ret; } -static int __maybe_unused zforce_resume(struct device *dev) +static int zforce_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct zforce_ts *ts = i2c_get_clientdata(client); @@ -691,7 +691,7 @@ unlock: return ret; } -static SIMPLE_DEV_PM_OPS(zforce_pm_ops, zforce_suspend, zforce_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(zforce_pm_ops, zforce_suspend, zforce_resume); static void zforce_reset(void *data) { @@ -941,7 +941,7 @@ MODULE_DEVICE_TABLE(of, zforce_dt_idtable); static struct i2c_driver zforce_driver = { .driver = { .name = "zforce-ts", - .pm = &zforce_pm_ops, + .pm = pm_sleep_ptr(&zforce_pm_ops), .of_match_table = of_match_ptr(zforce_dt_idtable), }, .probe_new = zforce_probe, diff --git a/drivers/input/touchscreen/zinitix.c b/drivers/input/touchscreen/zinitix.c index 52f9e9eaab14..cdf9bcd744db 100644 --- a/drivers/input/touchscreen/zinitix.c +++ b/drivers/input/touchscreen/zinitix.c @@ -562,7 +562,7 @@ static int zinitix_ts_probe(struct i2c_client *client) return 0; } -static int __maybe_unused zinitix_suspend(struct device *dev) +static int zinitix_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct bt541_ts_data *bt541 = i2c_get_clientdata(client); @@ -577,7 +577,7 @@ static int __maybe_unused zinitix_suspend(struct device *dev) return 0; } -static int __maybe_unused zinitix_resume(struct device *dev) +static int zinitix_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct bt541_ts_data *bt541 = i2c_get_clientdata(client); @@ -593,7 +593,7 @@ static int __maybe_unused zinitix_resume(struct device *dev) return ret; } -static SIMPLE_DEV_PM_OPS(zinitix_pm_ops, zinitix_suspend, zinitix_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(zinitix_pm_ops, zinitix_suspend, zinitix_resume); #ifdef CONFIG_OF static const struct of_device_id zinitix_of_match[] = { @@ -620,7 +620,7 @@ static struct i2c_driver zinitix_ts_driver = { .probe_new = zinitix_ts_probe, .driver = { .name = "Zinitix-TS", - .pm = &zinitix_pm_ops, + .pm = pm_sleep_ptr(&zinitix_pm_ops), .of_match_table = of_match_ptr(zinitix_of_match), }, }; |