From 7bf2a98a436ebc60b5388b1cb5fd3d0fbf78814c Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Sat, 13 Jul 2013 13:36:19 -0700 Subject: Input: twl6040-vibra - remove support for legacy (pdata) mode TWL6040 is used only with OMAP4/5 SoCs and they can only boot in in DT mode. The support for pdata/legacy boot can be removed. Signed-off-by: Peter Ujfalusi Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/misc/twl6040-vibra.c b/drivers/input/misc/twl6040-vibra.c index 0c2dfc8..7864b0c 100644 --- a/drivers/input/misc/twl6040-vibra.c +++ b/drivers/input/misc/twl6040-vibra.c @@ -257,7 +257,6 @@ static SIMPLE_DEV_PM_OPS(twl6040_vibra_pm_ops, twl6040_vibra_suspend, NULL); static int twl6040_vibra_probe(struct platform_device *pdev) { - struct twl6040_vibra_data *pdata = pdev->dev.platform_data; struct device *twl6040_core_dev = pdev->dev.parent; struct device_node *twl6040_core_node = NULL; struct vibra_info *info; @@ -270,8 +269,8 @@ static int twl6040_vibra_probe(struct platform_device *pdev) "vibra"); #endif - if (!pdata && !twl6040_core_node) { - dev_err(&pdev->dev, "platform_data not available\n"); + if (!twl6040_core_node) { + dev_err(&pdev->dev, "parent of node is missing?\n"); return -EINVAL; } @@ -284,27 +283,17 @@ static int twl6040_vibra_probe(struct platform_device *pdev) info->dev = &pdev->dev; info->twl6040 = dev_get_drvdata(pdev->dev.parent); - if (pdata) { - info->vibldrv_res = pdata->vibldrv_res; - info->vibrdrv_res = pdata->vibrdrv_res; - info->viblmotor_res = pdata->viblmotor_res; - info->vibrmotor_res = pdata->vibrmotor_res; - vddvibl_uV = pdata->vddvibl_uV; - vddvibr_uV = pdata->vddvibr_uV; - } else { - of_property_read_u32(twl6040_core_node, "ti,vibldrv-res", - &info->vibldrv_res); - of_property_read_u32(twl6040_core_node, "ti,vibrdrv-res", - &info->vibrdrv_res); - of_property_read_u32(twl6040_core_node, "ti,viblmotor-res", - &info->viblmotor_res); - of_property_read_u32(twl6040_core_node, "ti,vibrmotor-res", - &info->vibrmotor_res); - of_property_read_u32(twl6040_core_node, "ti,vddvibl-uV", - &vddvibl_uV); - of_property_read_u32(twl6040_core_node, "ti,vddvibr-uV", - &vddvibr_uV); - } + + of_property_read_u32(twl6040_core_node, "ti,vibldrv-res", + &info->vibldrv_res); + of_property_read_u32(twl6040_core_node, "ti,vibrdrv-res", + &info->vibrdrv_res); + of_property_read_u32(twl6040_core_node, "ti,viblmotor-res", + &info->viblmotor_res); + of_property_read_u32(twl6040_core_node, "ti,vibrmotor-res", + &info->vibrmotor_res); + of_property_read_u32(twl6040_core_node, "ti,vddvibl-uV", &vddvibl_uV); + of_property_read_u32(twl6040_core_node, "ti,vddvibr-uV", &vddvibr_uV); if ((!info->vibldrv_res && !info->viblmotor_res) || (!info->vibrdrv_res && !info->vibrmotor_res)) { @@ -334,8 +323,8 @@ static int twl6040_vibra_probe(struct platform_device *pdev) * When booted with Device tree the regulators are attached to the * parent device (twl6040 MFD core) */ - ret = regulator_bulk_get(pdata ? info->dev : twl6040_core_dev, - ARRAY_SIZE(info->supplies), info->supplies); + ret = regulator_bulk_get(twl6040_core_dev, ARRAY_SIZE(info->supplies), + info->supplies); if (ret) { dev_err(info->dev, "couldn't get regulators %d\n", ret); return ret; -- cgit v0.10.2 From 401d7d108fc19595f6a7d7dd7d553458155e31fa Mon Sep 17 00:00:00 2001 From: Ping Cheng Date: Sun, 28 Jul 2013 00:38:54 -0700 Subject: Input: wacom - integrate resolution calculation Reviewed-by: Jason Gerecke Tested-by: Jason Gerecke Signed-off-by: Ping Cheng Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index aaf23ae..1ad3e07 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c @@ -221,39 +221,6 @@ static int wacom_calc_hid_res(int logical_extents, int physical_extents, return logical_extents / physical_extents; } -/* - * The physical dimension specified by the HID descriptor is likely not in - * the "100th of a mm" units expected by wacom_calculate_touch_res. This - * function adjusts the value of [xy]_phy based on the unit and exponent - * provided by the HID descriptor. If an error occurs durring conversion - * (e.g. from the unit being left unspecified) [xy]_phy is not modified. - */ -static void wacom_fix_phy_from_hid(struct wacom_features *features) -{ - int xres = wacom_calc_hid_res(features->x_max, features->x_phy, - features->unit, features->unitExpo); - int yres = wacom_calc_hid_res(features->y_max, features->y_phy, - features->unit, features->unitExpo); - - if (xres > 0 && yres > 0) { - features->x_phy = (100 * features->x_max) / xres; - features->y_phy = (100 * features->y_max) / yres; - } -} - -/* - * Static values for max X/Y and resolution of Pen interface is stored in - * features. This mean physical size of active area can be computed. - * This is useful to do when Pen and Touch have same active area of tablet. - * This means for Touch device, we only need to find max X/Y value and we - * have enough information to compute resolution of touch. - */ -static void wacom_set_phy_from_res(struct wacom_features *features) -{ - features->x_phy = (features->x_max * 100) / features->x_resolution; - features->y_phy = (features->y_max * 100) / features->y_resolution; -} - static int wacom_parse_logical_collection(unsigned char *report, struct wacom_features *features) { @@ -265,8 +232,6 @@ static int wacom_parse_logical_collection(unsigned char *report, features->pktlen = WACOM_PKGLEN_BBTOUCH3; features->device_type = BTN_TOOL_FINGER; - wacom_set_phy_from_res(features); - features->x_max = features->y_max = get_unaligned_le16(&report[10]); @@ -640,9 +605,6 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf, } } error = wacom_parse_hid(intf, hid_desc, features); - if (error) - goto out; - wacom_fix_phy_from_hid(features); out: return error; @@ -1228,7 +1190,6 @@ static void wacom_wireless_work(struct work_struct *work) *((struct wacom_features *)id->driver_info); wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3; wacom_wac2->features.device_type = BTN_TOOL_FINGER; - wacom_set_phy_from_res(&wacom_wac2->features); wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096; error = wacom_register_input(wacom2); if (error) @@ -1251,6 +1212,33 @@ fail1: return; } +/* + * Not all devices report physical dimensions from HID. + * Compute the default from hardcoded logical dimension + * and resolution before driver overwrites them. + */ +static void wacom_set_default_phy(struct wacom_features *features) +{ + if (features->x_resolution) { + features->x_phy = (features->x_max * 100) / + features->x_resolution; + features->y_phy = (features->y_max * 100) / + features->y_resolution; + } +} + +static void wacom_calculate_res(struct wacom_features *features) +{ + features->x_resolution = wacom_calc_hid_res(features->x_max, + features->x_phy, + features->unit, + features->unitExpo); + features->y_resolution = wacom_calc_hid_res(features->y_max, + features->y_phy, + features->unit, + features->unitExpo); +} + static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id) { struct usb_device *dev = interface_to_usbdev(intf); @@ -1297,6 +1285,9 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i endpoint = &intf->cur_altsetting->endpoint[0].desc; + /* set the default size in case we do not get them from hid */ + wacom_set_default_phy(features); + /* Retrieve the physical and logical size for touch devices */ error = wacom_retrieve_hid_descriptor(intf, features); if (error) @@ -1312,8 +1303,6 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i features->device_type = BTN_TOOL_FINGER; features->pktlen = WACOM_PKGLEN_BBTOUCH3; - wacom_set_phy_from_res(features); - features->x_max = 4096; features->y_max = 4096; } else { @@ -1323,6 +1312,13 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i wacom_setup_device_quirks(features); + /* set unit to "100th of a mm" for devices not reported by HID */ + if (!features->unit) { + features->unit = 0x11; + features->unitExpo = 16 - 3; + } + wacom_calculate_res(features); + strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name)); if (features->quirks & WACOM_QUIRK_MULTI_INPUT) { @@ -1334,7 +1330,6 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i " Pen" : " Finger", sizeof(wacom_wac->name)); - other_dev = wacom_get_sibling(dev, features->oVid, features->oPid); if (other_dev == NULL || wacom_get_usbdev_data(other_dev) == NULL) other_dev = dev; diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 518282d..541197b 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c @@ -1443,13 +1443,6 @@ void wacom_setup_device_quirks(struct wacom_features *features) } } -static unsigned int wacom_calculate_touch_res(unsigned int logical_max, - unsigned int physical_max) -{ - /* Touch physical dimensions are in 100th of mm */ - return (logical_max * 100) / physical_max; -} - static void wacom_abs_set_axis(struct input_dev *input_dev, struct wacom_wac *wacom_wac) { @@ -1473,11 +1466,9 @@ static void wacom_abs_set_axis(struct input_dev *input_dev, input_set_abs_params(input_dev, ABS_Y, 0, features->y_max, features->y_fuzz, 0); input_abs_set_res(input_dev, ABS_X, - wacom_calculate_touch_res(features->x_max, - features->x_phy)); + features->x_resolution); input_abs_set_res(input_dev, ABS_Y, - wacom_calculate_touch_res(features->y_max, - features->y_phy)); + features->y_resolution); } if (features->touch_max > 1) { @@ -1486,11 +1477,9 @@ static void wacom_abs_set_axis(struct input_dev *input_dev, input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, features->y_max, features->y_fuzz, 0); input_abs_set_res(input_dev, ABS_MT_POSITION_X, - wacom_calculate_touch_res(features->x_max, - features->x_phy)); + features->x_resolution); input_abs_set_res(input_dev, ABS_MT_POSITION_Y, - wacom_calculate_touch_res(features->y_max, - features->y_phy)); + features->y_resolution); } } } -- cgit v0.10.2 From 4c076eb0cfd9fa3f8900ac3dbdcaaca2f5fc2c1e Mon Sep 17 00:00:00 2001 From: "Mathieu J. Poirier" Date: Sat, 3 Aug 2013 17:22:08 -0700 Subject: Input: sysrq - DT binding for key sequence Adding a simple device tree binding for the specification of key sequences. Definition of the keys found in the sequence are located in 'include/uapi/linux/input.h'. For the sysrq driver, holding the sequence of keys down for a specific amount of time will reset the system. Signed-off-by: Mathieu Poirier Acked-by: Grant Likely Signed-off-by: Dmitry Torokhov diff --git a/Documentation/devicetree/bindings/input/input-reset.txt b/Documentation/devicetree/bindings/input/input-reset.txt new file mode 100644 index 0000000..2bb2626 --- /dev/null +++ b/Documentation/devicetree/bindings/input/input-reset.txt @@ -0,0 +1,33 @@ +Input: sysrq reset sequence + +A simple binding to represent a set of keys as described in +include/uapi/linux/input.h. This is to communicate a sequence of keys to the +sysrq driver. Upon holding the keys for a specified amount of time (if +specified) the system is sync'ed and reset. + +Key sequences are global to the system but all the keys in a set must be coming +from the same input device. + +The /chosen node should contain a 'linux,sysrq-reset-seq' child node to define +a set of keys. + +Required property: +sysrq-reset-seq: array of Linux keycodes, one keycode per cell. + +Optional property: +timeout-ms: duration keys must be pressed together in milliseconds before +generating a sysrq. If omitted the system is rebooted immediately when a valid +sequence has been recognized. + +Example: + + chosen { + linux,sysrq-reset-seq { + keyset = <0x03 + 0x04 + 0x0a>; + timeout-ms = <3000>; + }; + }; + +Would represent KEY_2, KEY_3 and KEY_9. diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c index 55ba46f..749dae8 100644 --- a/drivers/tty/sysrq.c +++ b/drivers/tty/sysrq.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -681,6 +682,40 @@ static void sysrq_detect_reset_sequence(struct sysrq_state *state, } } +#ifdef CONFIG_OF +static void sysrq_of_get_keyreset_config(void) +{ + u32 key; + struct device_node *np; + struct property *prop; + const __be32 *p; + + np = of_find_node_by_path("/chosen/linux,sysrq-reset-seq"); + if (!np) { + pr_debug("No sysrq node found"); + return; + } + + /* Reset in case a __weak definition was present */ + sysrq_reset_seq_len = 0; + + of_property_for_each_u32(np, "keyset", prop, p, key) { + if (key == KEY_RESERVED || key > KEY_MAX || + sysrq_reset_seq_len == SYSRQ_KEY_RESET_MAX) + break; + + sysrq_reset_seq[sysrq_reset_seq_len++] = (unsigned short)key; + } + + /* Get reset timeout if any. */ + of_property_read_u32(np, "timeout-ms", &sysrq_reset_downtime_ms); +} +#else +static void sysrq_of_get_keyreset_config(void) +{ +} +#endif + static void sysrq_reinject_alt_sysrq(struct work_struct *work) { struct sysrq_state *sysrq = @@ -914,6 +949,7 @@ static inline void sysrq_register_handler(void) int error; int i; + /* First check if a __weak interface was instantiated. */ for (i = 0; i < ARRAY_SIZE(sysrq_reset_seq); i++) { key = platform_sysrq_reset_seq[i]; if (key == KEY_RESERVED || key > KEY_MAX) @@ -922,6 +958,12 @@ static inline void sysrq_register_handler(void) sysrq_reset_seq[sysrq_reset_seq_len++] = key; } + /* + * DT configuration takes precedence over anything that would + * have been defined via the __weak interface. + */ + sysrq_of_get_keyreset_config(); + error = input_register_handler(&sysrq_handler); if (error) pr_err("Failed to register input handler, error %d", error); -- cgit v0.10.2 From 1bc754579ff17288d7dc69d2c3e38e4e6bf4960e Mon Sep 17 00:00:00 2001 From: Jingoo Han Date: Mon, 5 Aug 2013 09:04:18 -0700 Subject: Input: max7359 - add CONFIG_PM_SLEEP to suspend/resume Add CONFIG_PM_SLEEP to suspend/resume functions to fix the build warnings when CONFIG_PM_SLEEP is not selected. This is because sleep PM callbacks defined by SET_SYSTEM_SLEEP_PM_OPS are only used when the CONFIG_PM_SLEEP is enabled. drivers/input/keyboard/max7359_keypad.c:275:12: warning: 'max7359_suspend' defined but not used [-Wunused-function] drivers/input/keyboard/max7359_keypad.c:287:12: warning: 'max7359_resume' defined but not used [-Wunused-function] Signed-off-by: Jingoo Han Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/keyboard/max7359_keypad.c b/drivers/input/keyboard/max7359_keypad.c index 7c7af2b..bc2cdaf 100644 --- a/drivers/input/keyboard/max7359_keypad.c +++ b/drivers/input/keyboard/max7359_keypad.c @@ -271,7 +271,7 @@ static int max7359_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM +#ifdef CONFIG_PM_SLEEP static int max7359_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); -- cgit v0.10.2 From 04245e9fde5708ae5d44cece1e3d7b64f3f62513 Mon Sep 17 00:00:00 2001 From: Jingoo Han Date: Mon, 5 Aug 2013 09:04:23 -0700 Subject: Input: cy8ctmg110_ts - add CONFIG_PM_SLEEP to suspend/resume Add CONFIG_PM_SLEEP to suspend/resume functions to fix the build warnings when CONFIG_PM_SLEEP is not selected. This is because sleep PM callbacks defined by SET_SYSTEM_SLEEP_PM_OPS are only used when the CONFIG_PM_SLEEP is enabled. drivers/input/touchscreen/cy8ctmg110_ts.c:295:12: warning: 'cy8ctmg110_suspend' defined but not used [-Wunused-function] drivers/input/touchscreen/cy8ctmg110_ts.c:309:12: warning: 'cy8ctmg110_resume' defined but not used [-Wunused-function] Signed-off-by: Jingoo Han Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/touchscreen/cy8ctmg110_ts.c b/drivers/input/touchscreen/cy8ctmg110_ts.c index 96e0eedc..8c65198 100644 --- a/drivers/input/touchscreen/cy8ctmg110_ts.c +++ b/drivers/input/touchscreen/cy8ctmg110_ts.c @@ -291,7 +291,7 @@ err_free_mem: return err; } -#ifdef CONFIG_PM +#ifdef CONFIG_PM_SLEEP static int cy8ctmg110_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -319,9 +319,9 @@ static int cy8ctmg110_resume(struct device *dev) } return 0; } +#endif static SIMPLE_DEV_PM_OPS(cy8ctmg110_pm, cy8ctmg110_suspend, cy8ctmg110_resume); -#endif static int cy8ctmg110_remove(struct i2c_client *client) { @@ -351,9 +351,7 @@ static struct i2c_driver cy8ctmg110_driver = { .driver = { .owner = THIS_MODULE, .name = CY8CTMG110_DRIVER_NAME, -#ifdef CONFIG_PM .pm = &cy8ctmg110_pm, -#endif }, .id_table = cy8ctmg110_idtable, .probe = cy8ctmg110_probe, -- cgit v0.10.2 From 54e9f4501079c837bbcc535c8de5a2e2fcbf6782 Mon Sep 17 00:00:00 2001 From: Jingoo Han Date: Mon, 5 Aug 2013 09:06:00 -0700 Subject: Input: eeti_ts - add CONFIG_PM_SLEEP to suspend/resume Add CONFIG_PM_SLEEP to suspend/resume functions to fix the build warnings when CONFIG_PM_SLEEP is not selected. This is because sleep PM callbacks defined by SET_SYSTEM_SLEEP_PM_OPS are only used when the CONFIG_PM_SLEEP is enabled. drivers/input/touchscreen/eeti_ts.c:268:12: warning: 'eeti_ts_suspend' defined but not used [-Wunused-function] drivers/input/touchscreen/eeti_ts.c:287:12: warning: 'eeti_ts_resume' defined but not used [-Wunused-function] Signed-off-by: Jingoo Han Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c index 8fe5086..1ce3d29 100644 --- a/drivers/input/touchscreen/eeti_ts.c +++ b/drivers/input/touchscreen/eeti_ts.c @@ -264,7 +264,7 @@ static int eeti_ts_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM +#ifdef CONFIG_PM_SLEEP static int eeti_ts_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -302,9 +302,9 @@ static int eeti_ts_resume(struct device *dev) return 0; } +#endif static SIMPLE_DEV_PM_OPS(eeti_ts_pm, eeti_ts_suspend, eeti_ts_resume); -#endif static const struct i2c_device_id eeti_ts_id[] = { { "eeti_ts", 0 }, @@ -315,9 +315,7 @@ MODULE_DEVICE_TABLE(i2c, eeti_ts_id); static struct i2c_driver eeti_ts_driver = { .driver = { .name = "eeti_ts", -#ifdef CONFIG_PM .pm = &eeti_ts_pm, -#endif }, .probe = eeti_ts_probe, .remove = eeti_ts_remove, -- cgit v0.10.2 From 7f26282f0511839059ca35c0594863575bf7ccf5 Mon Sep 17 00:00:00 2001 From: Jingoo Han Date: Mon, 5 Aug 2013 09:06:42 -0700 Subject: Input: pwm-beeper - add CONFIG_PM_SLEEP to suspend/resume Add CONFIG_PM_SLEEP to suspend/resume functions to fix the build warnings when CONFIG_PM_SLEEP is not selected. This is because sleep PM callbacks defined by SET_SYSTEM_SLEEP_PM_OPS are only used when the CONFIG_PM_SLEEP is enabled. drivers/input/misc/pwm-beeper.c:147:12: warning: 'pwm_beeper_suspend' defined but not used [-Wunused-function] drivers/input/misc/pwm-beeper.c:157:12: warning: 'pwm_beeper_resume' defined but not used [-Wunused-function] Signed-off-by: Jingoo Han Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c index a37f0c9..2ff4d1c 100644 --- a/drivers/input/misc/pwm-beeper.c +++ b/drivers/input/misc/pwm-beeper.c @@ -143,7 +143,7 @@ static int pwm_beeper_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM +#ifdef CONFIG_PM_SLEEP static int pwm_beeper_suspend(struct device *dev) { struct pwm_beeper *beeper = dev_get_drvdata(dev); -- cgit v0.10.2 From 846fc20ff76ae10793c0f02b67f0308234fb7539 Mon Sep 17 00:00:00 2001 From: Jingoo Han Date: Mon, 5 Aug 2013 09:13:27 -0700 Subject: Input: joysticks - use dev_get_platdata() Use the wrapper function for retrieving the platform data instead of accessing dev->platform_data directly. Signed-off-by: Jingoo Han Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/joystick/as5011.c b/drivers/input/joystick/as5011.c index 121cd63..13eba2a 100644 --- a/drivers/input/joystick/as5011.c +++ b/drivers/input/joystick/as5011.c @@ -234,7 +234,7 @@ static int as5011_probe(struct i2c_client *client, int irq; int error; - plat_data = client->dev.platform_data; + plat_data = dev_get_platdata(&client->dev); if (!plat_data) return -EINVAL; diff --git a/drivers/input/joystick/maplecontrol.c b/drivers/input/joystick/maplecontrol.c index 59c10ec..8aa6e4c 100644 --- a/drivers/input/joystick/maplecontrol.c +++ b/drivers/input/joystick/maplecontrol.c @@ -61,7 +61,7 @@ static void dc_pad_callback(struct mapleq *mq) static int dc_pad_open(struct input_dev *dev) { - struct dc_pad *pad = dev->dev.platform_data; + struct dc_pad *pad = dev_get_platdata(&dev->dev); maple_getcond_callback(pad->mdev, dc_pad_callback, HZ/20, MAPLE_FUNC_CONTROLLER); @@ -71,7 +71,7 @@ static int dc_pad_open(struct input_dev *dev) static void dc_pad_close(struct input_dev *dev) { - struct dc_pad *pad = dev->dev.platform_data; + struct dc_pad *pad = dev_get_platdata(&dev->dev); maple_getcond_callback(pad->mdev, dc_pad_callback, 0, MAPLE_FUNC_CONTROLLER); -- cgit v0.10.2 From 98f6e5d1a39ee05c0c2a3a9f60bbc0e475bf9563 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Mon, 12 Aug 2013 11:05:18 -0700 Subject: Input: wistron_btns - fix incorrect placement of __initconst __initconst should be placed between the variable name and equal sign for the variable to be placed in the intended section. Signed-off-by: Sachin Kamat Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c index 56536f4b9..35c33c6 100644 --- a/drivers/input/misc/wistron_btns.c +++ b/drivers/input/misc/wistron_btns.c @@ -635,7 +635,7 @@ static struct key_entry keymap_prestigio[] __initdata = { * a list of buttons and their key codes (reported when loading this module * with force=1) and the output of dmidecode to $MODULE_AUTHOR. */ -static const struct dmi_system_id __initconst dmi_ids[] = { +static const struct dmi_system_id dmi_ids[] __initconst = { { /* Fujitsu-Siemens Amilo Pro V2000 */ .callback = dmi_matched, -- cgit v0.10.2 From 3bd8a8b4595c2464fbb426696c2f58b242017388 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Mon, 12 Aug 2013 11:05:43 -0700 Subject: Input: lifebook - fix incorrect placement of __initconst __initconst should be placed between the variable name and equal sign for the variable to be placed in the intended section. Signed-off-by: Sachin Kamat Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c index 2c4db63..23222dd 100644 --- a/drivers/input/mouse/lifebook.c +++ b/drivers/input/mouse/lifebook.c @@ -44,7 +44,7 @@ static int lifebook_set_6byte_proto(const struct dmi_system_id *d) return 1; } -static const struct dmi_system_id __initconst lifebook_dmi_table[] = { +static const struct dmi_system_id lifebook_dmi_table[] __initconst = { { /* FLORA-ie 55mi */ .matches = { -- cgit v0.10.2 From c963156c44e3cbc12cf26b09ff28a05a1847aadc Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Mon, 12 Aug 2013 11:05:58 -0700 Subject: Input: synaptics - fix incorrect placement of __initconst __initconst should be placed between the variable name and equal sign for the variable to be placed in the intended section. Signed-off-by: Sachin Kamat Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index b2420ae..26386f9 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c @@ -1433,7 +1433,7 @@ static int synaptics_reconnect(struct psmouse *psmouse) static bool impaired_toshiba_kbc; -static const struct dmi_system_id __initconst toshiba_dmi_table[] = { +static const struct dmi_system_id toshiba_dmi_table[] __initconst = { #if defined(CONFIG_DMI) && defined(CONFIG_X86) { /* Toshiba Satellite */ @@ -1472,7 +1472,7 @@ static const struct dmi_system_id __initconst toshiba_dmi_table[] = { static bool broken_olpc_ec; -static const struct dmi_system_id __initconst olpc_dmi_table[] = { +static const struct dmi_system_id olpc_dmi_table[] __initconst = { #if defined(CONFIG_DMI) && defined(CONFIG_OLPC) { /* OLPC XO-1 or XO-1.5 */ -- cgit v0.10.2 From 4485455dbb0546b185197746c500100a364b59b3 Mon Sep 17 00:00:00 2001 From: Stefan Lippers-Hollmann Date: Mon, 12 Aug 2013 22:45:23 -0700 Subject: Input: wistron_btns - drop bogus MODULE_VERSION macro MODULE_VERSION is pointless for an in-kernel module and git log confirms that it has never been actually maintained as well (bumped a single time, despite quite major feature additions later on, which haven't been reflected in MODULE_VERSION). Signed-off-by: Stefan Lippers-Hollmann Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c index 35c33c6..26d5156 100644 --- a/drivers/input/misc/wistron_btns.c +++ b/drivers/input/misc/wistron_btns.c @@ -46,7 +46,6 @@ MODULE_AUTHOR("Miloslav Trmac "); MODULE_DESCRIPTION("Wistron laptop button driver"); MODULE_LICENSE("GPL v2"); -MODULE_VERSION("0.3"); static bool force; /* = 0; */ module_param(force, bool, 0); -- cgit v0.10.2 From 53e88754a28c15ac9feb9ca786174c9546098dcd Mon Sep 17 00:00:00 2001 From: Stefan Lippers-Hollmann Date: Mon, 12 Aug 2013 22:45:38 -0700 Subject: Input: wistron_btns - mark the Medion MD96500 keymap as tested DMI: MEDIONPC WIM 2040/WIM 2040, BIOS R01-A0O 11/04/2005 wistron_btns: BIOS signature found at c00f6b00, entry point 000FDD50 input: Wistron laptop buttons as /devices/platform/wistron-bios/input/input5 Signed-off-by: Stefan Lippers-Hollmann Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c index 26d5156..bef5b47 100644 --- a/drivers/input/misc/wistron_btns.c +++ b/drivers/input/misc/wistron_btns.c @@ -562,7 +562,7 @@ static struct key_entry keymap_wistron_md96500[] __initdata = { { KE_KEY, 0x36, {KEY_WWW} }, { KE_WIFI, 0x30 }, { KE_BLUETOOTH, 0x44 }, - { KE_END, FE_UNTESTED } + { KE_END, 0 } }; static struct key_entry keymap_wistron_generic[] __initdata = { -- cgit v0.10.2 From ac67be927b21c6928f4870c34f57b7fe6f3ad2fc Mon Sep 17 00:00:00 2001 From: Stefan Lippers-Hollmann Date: Mon, 12 Aug 2013 22:45:58 -0700 Subject: Input: wistron_btns - add MODULE_DEVICE_TABLE This allows the wistron_btns module to be autoloaded on boot, its functionality is required to support the hardware rfkill switches on most of the supported notebooks, in order to unblock the hard blocked rfkill state for wireless and bluetooth devices. Tested on a Medion MD96500: alias: dmi*:svn*MEDIONPC*:pn*WIM2040*: Signed-off-by: Stefan Lippers-Hollmann Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c index bef5b47..b650545 100644 --- a/drivers/input/misc/wistron_btns.c +++ b/drivers/input/misc/wistron_btns.c @@ -971,6 +971,7 @@ static const struct dmi_system_id dmi_ids[] __initconst = { }, { NULL, } }; +MODULE_DEVICE_TABLE(dmi, dmi_ids); /* Copy the good keymap, as the original ones are free'd */ static int __init copy_keymap(void) -- cgit v0.10.2 From 3719b54bc62318db7dd8ac7c39a09dfb991a208f Mon Sep 17 00:00:00 2001 From: Bo Shen Date: Tue, 13 Aug 2013 09:46:40 -0700 Subject: Input: qt1070 - add power management ops Add power management ops for qt1070, it may be a wakeup source. Signed-off-by: Bo Shen Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/keyboard/qt1070.c b/drivers/input/keyboard/qt1070.c index 42b773b..6c561ec 100644 --- a/drivers/input/keyboard/qt1070.c +++ b/drivers/input/keyboard/qt1070.c @@ -243,6 +243,32 @@ static int qt1070_remove(struct i2c_client *client) return 0; } +#ifdef CONFIG_PM_SLEEP +static int qt1070_suspend(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct qt1070_data *data = i2c_get_clientdata(client); + + if (device_may_wakeup(dev)) + enable_irq_wake(data->irq); + + return 0; +} + +static int qt1070_resume(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct qt1070_data *data = i2c_get_clientdata(client); + + if (device_may_wakeup(dev)) + disable_irq_wake(data->irq); + + return 0; +} +#endif + +static SIMPLE_DEV_PM_OPS(qt1070_pm_ops, qt1070_suspend, qt1070_resume); + static const struct i2c_device_id qt1070_id[] = { { "qt1070", 0 }, { }, @@ -253,6 +279,7 @@ static struct i2c_driver qt1070_driver = { .driver = { .name = "qt1070", .owner = THIS_MODULE, + .pm = &qt1070_pm_ops, }, .id_table = qt1070_id, .probe = qt1070_probe, -- cgit v0.10.2 From f01868dcb13e7eb064910e8afe391c1846b9e73b Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Wed, 14 Aug 2013 23:50:48 -0700 Subject: Input: htcpen - fix incorrect placement of __initdata __initdata should be placed between the variable name and equal sign for the variable to be placed in the intended section. Signed-off-by: Sachin Kamat Cc: Pau Oliva Fora Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/touchscreen/htcpen.c b/drivers/input/touchscreen/htcpen.c index 6c4fb84..6650085 100644 --- a/drivers/input/touchscreen/htcpen.c +++ b/drivers/input/touchscreen/htcpen.c @@ -221,7 +221,7 @@ static struct isa_driver htcpen_isa_driver = { } }; -static struct dmi_system_id __initdata htcshift_dmi_table[] = { +static struct dmi_system_id htcshift_dmi_table[] __initdata = { { .ident = "Shift", .matches = { -- cgit v0.10.2 From eacd0c47966b918f10c7ac1a91dd9fccb0f58ddd Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Thu, 15 Aug 2013 00:07:43 -0700 Subject: Input: tegra-kbc - simplify use of devm_ioremap_resource Remove unneeded error handling on the result of a call to platform_get_resource when the value is passed to devm_ioremap_resource. Move the call to platform_get_resource adjacent to the call to devm_ioremap_resource to make the connection between them more clear. A simplified version of the semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression pdev,res,n,e,e1; expression ret != 0; identifier l; @@ - res = platform_get_resource(pdev, IORESOURCE_MEM, n); ... when != res - if (res == NULL) { ... \(goto l;\|return ret;\) } ... when != res + res = platform_get_resource(pdev, IORESOURCE_MEM, n); e = devm_ioremap_resource(e1, res); // Signed-off-by: Julia Lawall Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c index b46142f..9cd20e6 100644 --- a/drivers/input/keyboard/tegra-kbc.c +++ b/drivers/input/keyboard/tegra-kbc.c @@ -638,12 +638,6 @@ static int tegra_kbc_probe(struct platform_device *pdev) if (!tegra_kbc_check_pin_cfg(kbc, &num_rows)) return -EINVAL; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(&pdev->dev, "failed to get I/O memory\n"); - return -ENXIO; - } - kbc->irq = platform_get_irq(pdev, 0); if (kbc->irq < 0) { dev_err(&pdev->dev, "failed to get keyboard IRQ\n"); @@ -658,6 +652,7 @@ static int tegra_kbc_probe(struct platform_device *pdev) setup_timer(&kbc->timer, tegra_kbc_keypress_timer, (unsigned long)kbc); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); kbc->mmio = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(kbc->mmio)) return PTR_ERR(kbc->mmio); -- cgit v0.10.2 From ef0aca7f2f94a24d82aea0b74ae7a71c611e4895 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Thu, 15 Aug 2013 00:08:17 -0700 Subject: Input: keyboard, serio - simplify use of devm_ioremap_resource Remove unneeded error handling on the result of a call to platform_get_resource when the value is passed to devm_ioremap_resource. Move the call to platform_get_resource adjacent to the call to devm_ioremap_resource to make the connection between them more clear. A simplified version of the semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression pdev,res,n,e,e1; expression ret != 0; identifier l; @@ - res = platform_get_resource(pdev, IORESOURCE_MEM, n); ... when != res - if (res == NULL) { ... \(goto l;\|return ret;\) } ... when != res + res = platform_get_resource(pdev, IORESOURCE_MEM, n); e = devm_ioremap_resource(e1, res); // Signed-off-by: Julia Lawall Acked-by: Viresh Kumar Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/keyboard/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c index 03c8cc5..328cfc1 100644 --- a/drivers/input/keyboard/imx_keypad.c +++ b/drivers/input/keyboard/imx_keypad.c @@ -442,12 +442,6 @@ static int imx_keypad_probe(struct platform_device *pdev) return -EINVAL; } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (res == NULL) { - dev_err(&pdev->dev, "no I/O memory defined in platform data\n"); - return -EINVAL; - } - input_dev = devm_input_allocate_device(&pdev->dev); if (!input_dev) { dev_err(&pdev->dev, "failed to allocate the input device\n"); @@ -468,6 +462,7 @@ static int imx_keypad_probe(struct platform_device *pdev) setup_timer(&keypad->check_matrix_timer, imx_keypad_check_for_events, (unsigned long) keypad); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); keypad->mmio_base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(keypad->mmio_base)) return PTR_ERR(keypad->mmio_base); diff --git a/drivers/input/keyboard/nspire-keypad.c b/drivers/input/keyboard/nspire-keypad.c index 20d872d..b3e3eda 100644 --- a/drivers/input/keyboard/nspire-keypad.c +++ b/drivers/input/keyboard/nspire-keypad.c @@ -171,12 +171,6 @@ static int nspire_keypad_probe(struct platform_device *pdev) return -EINVAL; } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(&pdev->dev, "missing platform resources\n"); - return -EINVAL; - } - keypad = devm_kzalloc(&pdev->dev, sizeof(struct nspire_keypad), GFP_KERNEL); if (!keypad) { @@ -208,6 +202,7 @@ static int nspire_keypad_probe(struct platform_device *pdev) return PTR_ERR(keypad->clk); } + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); keypad->reg_base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(keypad->reg_base)) return PTR_ERR(keypad->reg_base); diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c index 7111124..85ff530 100644 --- a/drivers/input/keyboard/spear-keyboard.c +++ b/drivers/input/keyboard/spear-keyboard.c @@ -191,12 +191,6 @@ static int spear_kbd_probe(struct platform_device *pdev) int irq; int error; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(&pdev->dev, "no keyboard resource defined\n"); - return -EBUSY; - } - irq = platform_get_irq(pdev, 0); if (irq < 0) { dev_err(&pdev->dev, "not able to get irq for the device\n"); @@ -228,6 +222,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); if (IS_ERR(kbd->io_base)) return PTR_ERR(kbd->io_base); diff --git a/drivers/input/serio/arc_ps2.c b/drivers/input/serio/arc_ps2.c index 3fb7727..8024a6d 100644 --- a/drivers/input/serio/arc_ps2.c +++ b/drivers/input/serio/arc_ps2.c @@ -189,12 +189,6 @@ static int arc_ps2_probe(struct platform_device *pdev) int irq; int error, id, i; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(&pdev->dev, "no IO memory defined\n"); - return -EINVAL; - } - irq = platform_get_irq_byname(pdev, "arc_ps2_irq"); if (irq < 0) { dev_err(&pdev->dev, "no IRQ defined\n"); @@ -208,6 +202,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); 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 818aa46..51b1d40 100644 --- a/drivers/input/serio/olpc_apsp.c +++ b/drivers/input/serio/olpc_apsp.c @@ -183,9 +183,6 @@ static int olpc_apsp_probe(struct platform_device *pdev) np = pdev->dev.of_node; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) - return -ENOENT; - priv->base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(priv->base)) { dev_err(&pdev->dev, "Failed to map WTM registers\n"); -- cgit v0.10.2 From 67b3bfd0c22274f1b3c40f0820cbdc1d71f7d0cd Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Sat, 24 Aug 2013 16:39:26 -0700 Subject: Input: as5011 - fix error return code in as5011_probe() Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/joystick/as5011.c b/drivers/input/joystick/as5011.c index 13eba2a..005d852 100644 --- a/drivers/input/joystick/as5011.c +++ b/drivers/input/joystick/as5011.c @@ -288,6 +288,7 @@ static int as5011_probe(struct i2c_client *client, if (irq < 0) { dev_err(&client->dev, "Failed to get irq number for button gpio\n"); + error = irq; goto err_free_button_gpio; } -- cgit v0.10.2 From d4879c9e0fee98dca512acd7c9b045c1b73091d6 Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Sat, 24 Aug 2013 16:41:56 -0700 Subject: Input: wacom - fix error return code in wacom_probe() Fix to return a negative error code from the urb submit error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 1ad3e07..79b69ea 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c @@ -1361,8 +1361,10 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i usb_set_intfdata(intf, wacom); if (features->quirks & WACOM_QUIRK_MONITOR) { - if (usb_submit_urb(wacom->irq, GFP_KERNEL)) + if (usb_submit_urb(wacom->irq, GFP_KERNEL)) { + error = -EIO; goto fail5; + } } return 0; @@ -1417,8 +1419,8 @@ static int wacom_resume(struct usb_interface *intf) wacom_query_tablet_data(intf, features); wacom_led_control(wacom); - if ((wacom->open || features->quirks & WACOM_QUIRK_MONITOR) - && usb_submit_urb(wacom->irq, GFP_NOIO) < 0) + if ((wacom->open || (features->quirks & WACOM_QUIRK_MONITOR)) && + usb_submit_urb(wacom->irq, GFP_NOIO) < 0) rv = -EIO; mutex_unlock(&wacom->lock); -- cgit v0.10.2 From e87ca42464b9ec2946ed5a4a921f292834bb494f Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Sun, 25 Aug 2013 23:24:35 -0700 Subject: Input: cyttsp4 - remove useless NULL test from cyttsp4_watchdog_timer() Remove useless NULL test from cyttsp4_watchdog_timer(). Signed-off-by: Wei Yongjun Acked-by: Ferruh Yigit Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c index 963da05..8238d98 100644 --- a/drivers/input/touchscreen/cyttsp4_core.c +++ b/drivers/input/touchscreen/cyttsp4_core.c @@ -1246,9 +1246,6 @@ static void cyttsp4_watchdog_timer(unsigned long handle) dev_vdbg(cd->dev, "%s: Watchdog timer triggered\n", __func__); - if (!cd) - return; - if (!work_pending(&cd->watchdog_work)) schedule_work(&cd->watchdog_work); -- cgit v0.10.2 From 875ad6966ec6f7c4ddb36cf363bffbffa6961ab5 Mon Sep 17 00:00:00 2001 From: Illia Smyrnov Date: Sun, 25 Aug 2013 23:25:18 -0700 Subject: Input: omap-keypad - use bitfiled instead of hardcoded values Use bitfiled instead of hardcoded values to set KBD_CTRL, use BIT macro, remove unused defines. Signed-off-by: Illia Smyrnov Reviewed-by: Felipe Balbi Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c index f4aa53a..c727548 100644 --- a/drivers/input/keyboard/omap4-keypad.c +++ b/drivers/input/keyboard/omap4-keypad.c @@ -53,21 +53,17 @@ #define OMAP4_KBD_FULLCODE63_32 0x48 /* OMAP4 bit definitions */ -#define OMAP4_DEF_IRQENABLE_EVENTEN (1 << 0) -#define OMAP4_DEF_IRQENABLE_LONGKEY (1 << 1) -#define OMAP4_DEF_IRQENABLE_TIMEOUTEN (1 << 2) -#define OMAP4_DEF_WUP_EVENT_ENA (1 << 0) -#define OMAP4_DEF_WUP_LONG_KEY_ENA (1 << 1) -#define OMAP4_DEF_CTRL_NOSOFTMODE (1 << 1) -#define OMAP4_DEF_CTRLPTVVALUE (1 << 2) -#define OMAP4_DEF_CTRLPTV (1 << 1) +#define OMAP4_DEF_IRQENABLE_EVENTEN BIT(0) +#define OMAP4_DEF_IRQENABLE_LONGKEY BIT(1) +#define OMAP4_DEF_WUP_EVENT_ENA BIT(0) +#define OMAP4_DEF_WUP_LONG_KEY_ENA BIT(1) +#define OMAP4_DEF_CTRL_NOSOFTMODE BIT(1) +#define OMAP4_DEF_CTRL_PTV_SHIFT 2 /* OMAP4 values */ -#define OMAP4_VAL_IRQDISABLE 0x00 -#define OMAP4_VAL_DEBOUNCINGTIME 0x07 -#define OMAP4_VAL_FUNCTIONALCFG 0x1E - -#define OMAP4_MASK_IRQSTATUSDISABLE 0xFFFF +#define OMAP4_VAL_IRQDISABLE 0x0 +#define OMAP4_VAL_DEBOUNCINGTIME 0x7 +#define OMAP4_VAL_PVT 0x7 enum { KBD_REVISION_OMAP4 = 0, @@ -175,7 +171,8 @@ static int omap4_keypad_open(struct input_dev *input) disable_irq(keypad_data->irq); kbd_writel(keypad_data, OMAP4_KBD_CTRL, - OMAP4_VAL_FUNCTIONALCFG); + OMAP4_DEF_CTRL_NOSOFTMODE | + (OMAP4_VAL_PVT << OMAP4_DEF_CTRL_PTV_SHIFT)); kbd_writel(keypad_data, OMAP4_KBD_DEBOUNCINGTIME, OMAP4_VAL_DEBOUNCINGTIME); kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS, -- cgit v0.10.2 From c683da3ec985bcf0e69890f372cffaba47a1a537 Mon Sep 17 00:00:00 2001 From: Illia Smyrnov Date: Sun, 25 Aug 2013 23:25:50 -0700 Subject: Input: omap-keypad - convert to threaded IRQ Convert to use threaded IRQ. Signed-off-by: Illia Smyrnov Reviewed-by: Felipe Balbi Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c index c727548..b876a0d 100644 --- a/drivers/input/keyboard/omap4-keypad.c +++ b/drivers/input/keyboard/omap4-keypad.c @@ -112,8 +112,22 @@ static void kbd_write_irqreg(struct omap4_keypad *keypad_data, } -/* Interrupt handler */ -static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id) +/* Interrupt handlers */ +static irqreturn_t omap4_keypad_irq_handler(int irq, void *dev_id) +{ + struct omap4_keypad *keypad_data = dev_id; + + if (kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS)) { + /* Disable interrupts */ + kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE, + OMAP4_VAL_IRQDISABLE); + return IRQ_WAKE_THREAD; + } + + return IRQ_NONE; +} + +static irqreturn_t omap4_keypad_irq_thread_fn(int irq, void *dev_id) { struct omap4_keypad *keypad_data = dev_id; struct input_dev *input_dev = keypad_data->input; @@ -121,10 +135,6 @@ static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id) unsigned int col, row, code, changed; u32 *new_state = (u32 *) key_state; - /* Disable interrupts */ - kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE, - OMAP4_VAL_IRQDISABLE); - *new_state = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE31_0); *(new_state + 1) = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE63_32); @@ -360,9 +370,10 @@ static int omap4_keypad_probe(struct platform_device *pdev) goto err_free_keymap; } - error = request_irq(keypad_data->irq, omap4_keypad_interrupt, - IRQF_TRIGGER_RISING, - "omap4-keypad", keypad_data); + error = request_threaded_irq(keypad_data->irq, omap4_keypad_irq_handler, + omap4_keypad_irq_thread_fn, + IRQF_TRIGGER_RISING, + "omap4-keypad", keypad_data); if (error) { dev_err(&pdev->dev, "failed to register interrupt\n"); goto err_free_input; -- cgit v0.10.2 From afbac60b0c535189a76855a04d85492cf2d992e1 Mon Sep 17 00:00:00 2001 From: Illia Smyrnov Date: Sun, 25 Aug 2013 23:26:16 -0700 Subject: Input: omap-keypad - clear interrupts on open According to TRM, the recommended way for keyboard controller initialization is clear the interrupt-status register, then set up certain keyboard events for generating an interrupt request and set up expected source of wake-up event that generates a wake-up request. Signed-off-by: Illia Smyrnov Reviewed-by: Felipe Balbi Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c index b876a0d..0244262 100644 --- a/drivers/input/keyboard/omap4-keypad.c +++ b/drivers/input/keyboard/omap4-keypad.c @@ -185,8 +185,9 @@ static int omap4_keypad_open(struct input_dev *input) (OMAP4_VAL_PVT << OMAP4_DEF_CTRL_PTV_SHIFT)); kbd_writel(keypad_data, OMAP4_KBD_DEBOUNCINGTIME, OMAP4_VAL_DEBOUNCINGTIME); + /* clear pending interrupts */ kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS, - OMAP4_VAL_IRQDISABLE); + kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS)); kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE, OMAP4_DEF_IRQENABLE_EVENTEN | OMAP4_DEF_IRQENABLE_LONGKEY); -- cgit v0.10.2 From 78608a0d940982e926401b4fa5e4a9061e9b53f3 Mon Sep 17 00:00:00 2001 From: Illia Smyrnov Date: Sun, 25 Aug 2013 23:29:30 -0700 Subject: Input: omap-keypad - enable wakeup capability for keypad. Enable/disable IRQ wake in suspend/resume handlers to make the keypad wakeup capable. Signed-off-by: Illia Smyrnov Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c index 0244262..cd6b917 100644 --- a/drivers/input/keyboard/omap4-keypad.c +++ b/drivers/input/keyboard/omap4-keypad.c @@ -74,6 +74,7 @@ struct omap4_keypad { struct input_dev *input; void __iomem *base; + bool irq_wake_enabled; unsigned int irq; unsigned int rows; @@ -380,6 +381,7 @@ static int omap4_keypad_probe(struct platform_device *pdev) goto err_free_input; } + device_init_wakeup(&pdev->dev, true); pm_runtime_put_sync(&pdev->dev); error = input_register_device(keypad_data->input); @@ -393,6 +395,7 @@ static int omap4_keypad_probe(struct platform_device *pdev) err_pm_disable: pm_runtime_disable(&pdev->dev); + device_init_wakeup(&pdev->dev, false); free_irq(keypad_data->irq, keypad_data); err_free_keymap: kfree(keypad_data->keymap); @@ -418,6 +421,8 @@ static int omap4_keypad_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); + device_init_wakeup(&pdev->dev, false); + input_unregister_device(keypad_data->input); iounmap(keypad_data->base); @@ -439,12 +444,46 @@ static const struct of_device_id omap_keypad_dt_match[] = { MODULE_DEVICE_TABLE(of, omap_keypad_dt_match); #endif +#ifdef CONFIG_PM_SLEEP +static int omap4_keypad_suspend(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct omap4_keypad *keypad_data = platform_get_drvdata(pdev); + int error; + + if (device_may_wakeup(&pdev->dev)) { + error = enable_irq_wake(keypad_data->irq); + if (!error) + keypad_data->irq_wake_enabled = true; + } + + return 0; +} + +static int omap4_keypad_resume(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct omap4_keypad *keypad_data = platform_get_drvdata(pdev); + + if (device_may_wakeup(&pdev->dev) && keypad_data->irq_wake_enabled) { + disable_irq_wake(keypad_data->irq); + keypad_data->irq_wake_enabled = false; + } + + return 0; +} +#endif + +static SIMPLE_DEV_PM_OPS(omap4_keypad_pm_ops, + omap4_keypad_suspend, omap4_keypad_resume); + static struct platform_driver omap4_keypad_driver = { .probe = omap4_keypad_probe, .remove = omap4_keypad_remove, .driver = { .name = "omap4-keypad", .owner = THIS_MODULE, + .pm = &omap4_keypad_pm_ops, .of_match_table = of_match_ptr(omap_keypad_dt_match), }, }; -- cgit v0.10.2 From 50f3c163751f84bd572a712a255cd69903e232e2 Mon Sep 17 00:00:00 2001 From: Illia Smyrnov Date: Sun, 25 Aug 2013 23:32:45 -0700 Subject: Input: omap-keypad - set up irq type from DT OMAP4 is DT only, so read the keypad IRQ type from DT instead hard-coding it in the driver. Signed-off-by: Illia Smyrnov Reviewed-by: Felipe Balbi Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c index cd6b917..30acfd4 100644 --- a/drivers/input/keyboard/omap4-keypad.c +++ b/drivers/input/keyboard/omap4-keypad.c @@ -373,8 +373,7 @@ static int omap4_keypad_probe(struct platform_device *pdev) } error = request_threaded_irq(keypad_data->irq, omap4_keypad_irq_handler, - omap4_keypad_irq_thread_fn, - IRQF_TRIGGER_RISING, + omap4_keypad_irq_thread_fn, 0, "omap4-keypad", keypad_data); if (error) { dev_err(&pdev->dev, "failed to register interrupt\n"); -- cgit v0.10.2 From 1ea4c16120f529d811de0a35db6b252352268e95 Mon Sep 17 00:00:00 2001 From: Andrey Moiseev Date: Sun, 25 Aug 2013 22:51:15 -0700 Subject: Input: add driver for slidebar on Lenovo IdeaPad laptops This driver adds support for slidebars found on some Lenovo IdeaPad laptops (the slidebars work with SlideNav/Desktop Navigator under Windows). Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=16004 Registers 'IdeaPad Slidebar' input device and /sys/devices/platform/ideapad_slidebar/slidebar_mode for switching slidebar's modes. Now works on: IdeaPad Y550, Y550P. May work on (testing and adding new models is needed): Ideapad Y560, Y460, Y450, Y650, and, probably, some others. Signed-off-by: Andrey Moiseev Signed-off-by: Dmitry Torokhov diff --git a/MAINTAINERS b/MAINTAINERS index 250dc97..bd1c48e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4038,6 +4038,13 @@ W: http://launchpad.net/ideapad-laptop S: Maintained F: drivers/platform/x86/ideapad-laptop.c +IDEAPAD LAPTOP SLIDEBAR DRIVER +M: Andrey Moiseev +L: linux-input@vger.kernel.org +W: https://github.com/o2genum/ideapad-slidebar +S: Maintained +F: drivers/input/misc/ideapad_slidebar.c + IDE/ATAPI DRIVERS M: Borislav Petkov L: linux-ide@vger.kernel.org diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index 0b541cd..aa51baa 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig @@ -647,4 +647,14 @@ config INPUT_SIRFSOC_ONKEY If unsure, say N. +config INPUT_IDEAPAD_SLIDEBAR + tristate "IdeaPad Laptop Slidebar" + depends on INPUT + depends on SERIO_I8042 + help + Say Y here if you have an IdeaPad laptop with a slidebar. + + To compile this driver as a module, choose M here: the + module will be called ideapad_slidebar. + endif diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile index 829de43..0ebfb6d 100644 --- a/drivers/input/misc/Makefile +++ b/drivers/input/misc/Makefile @@ -61,3 +61,4 @@ obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o obj-$(CONFIG_INPUT_WM831X_ON) += wm831x-on.o obj-$(CONFIG_INPUT_XEN_KBDDEV_FRONTEND) += xen-kbdfront.o obj-$(CONFIG_INPUT_YEALINK) += yealink.o +obj-$(CONFIG_INPUT_IDEAPAD_SLIDEBAR) += ideapad_slidebar.o diff --git a/drivers/input/misc/ideapad_slidebar.c b/drivers/input/misc/ideapad_slidebar.c new file mode 100644 index 0000000..edfd623 --- /dev/null +++ b/drivers/input/misc/ideapad_slidebar.c @@ -0,0 +1,358 @@ +/* + * Input driver for slidebars on some Lenovo IdeaPad laptops + * + * Copyright (C) 2013 Andrey Moiseev + * + * Reverse-engineered from Lenovo SlideNav software (SBarHook.dll). + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * Trademarks are the property of their respective owners. + */ + +/* + * Currently tested and works on: + * Lenovo IdeaPad Y550 + * Lenovo IdeaPad Y550P + * + * Other models can be added easily. To test, + * load with 'force' parameter set 'true'. + * + * LEDs blinking and input mode are managed via sysfs, + * (hex, unsigned byte value): + * /sys/devices/platform/ideapad_slidebar/slidebar_mode + * + * The value is in byte range, however, I only figured out + * how bits 0b10011001 work. Some other bits, probably, + * are meaningfull too. + * + * Possible states: + * + * STD_INT, ONMOV_INT, OFF_INT, LAST_POLL, OFF_POLL + * + * Meaning: + * released touched + * STD 'heartbeat' lights follow the finger + * ONMOV no lights lights follow the finger + * LAST at last pos lights follow the finger + * OFF no lights no lights + * + * INT all input events are generated, interrupts are used + * POLL no input events by default, to get them, + * send 0b10000000 (read below) + * + * Commands: write + * + * All | 0b01001 -> STD_INT + * possible | 0b10001 -> ONMOV_INT + * states | 0b01000 -> OFF_INT + * + * | 0b0 -> LAST_POLL + * STD_INT or ONMOV_INT | + * | 0b1 -> STD_INT + * + * | 0b0 -> OFF_POLL + * OFF_INT or OFF_POLL | + * | 0b1 -> OFF_INT + * + * Any state | 0b10000000 -> if the slidebar has updated data, + * produce one input event (last position), + * switch to respective POLL mode + * (like 0x0), if not in POLL mode yet. + * + * Get current state: read + * + * masked by 0x11 read value means: + * + * 0x00 LAST + * 0x01 STD + * 0x10 OFF + * 0x11 ONMOV + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define IDEAPAD_BASE 0xff29 + +static bool force; +module_param(force, bool, 0); +MODULE_PARM_DESC(force, "Force driver load, ignore DMI data"); + +static DEFINE_SPINLOCK(io_lock); + +static struct input_dev *slidebar_input_dev; +static struct platform_device *slidebar_platform_dev; + +static u8 slidebar_pos_get(void) +{ + u8 res; + unsigned long flags; + + spin_lock_irqsave(&io_lock, flags); + outb(0xf4, 0xff29); + outb(0xbf, 0xff2a); + res = inb(0xff2b); + spin_unlock_irqrestore(&io_lock, flags); + + return res; +} + +static u8 slidebar_mode_get(void) +{ + u8 res; + unsigned long flags; + + spin_lock_irqsave(&io_lock, flags); + outb(0xf7, 0xff29); + outb(0x8b, 0xff2a); + res = inb(0xff2b); + spin_unlock_irqrestore(&io_lock, flags); + + return res; +} + +static void slidebar_mode_set(u8 mode) +{ + unsigned long flags; + + spin_lock_irqsave(&io_lock, flags); + outb(0xf7, 0xff29); + outb(0x8b, 0xff2a); + outb(mode, 0xff2b); + spin_unlock_irqrestore(&io_lock, flags); +} + +static bool slidebar_i8042_filter(unsigned char data, unsigned char str, + struct serio *port) +{ + static bool extended = false; + + /* We are only interested in data coming form KBC port */ + if (str & I8042_STR_AUXDATA) + return false; + + /* Scancodes: e03b on move, e0bb on release. */ + if (data == 0xe0) { + extended = true; + return true; + } + + if (!extended) + return false; + + extended = false; + + if (likely((data & 0x7f) != 0x3b)) { + serio_interrupt(port, 0xe0, 0); + return false; + } + + if (data & 0x80) { + input_report_key(slidebar_input_dev, BTN_TOUCH, 0); + } else { + input_report_key(slidebar_input_dev, BTN_TOUCH, 1); + input_report_abs(slidebar_input_dev, ABS_X, slidebar_pos_get()); + } + input_sync(slidebar_input_dev); + + return true; +} + +static ssize_t show_slidebar_mode(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + return sprintf(buf, "%x\n", slidebar_mode_get()); +} + +static ssize_t store_slidebar_mode(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + u8 mode; + int error; + + error = kstrtou8(buf, 0, &mode); + if (error) + return error; + + slidebar_mode_set(mode); + + return count; +} + +static DEVICE_ATTR(slidebar_mode, S_IWUSR | S_IRUGO, + show_slidebar_mode, store_slidebar_mode); + +static struct attribute *ideapad_attrs[] = { + &dev_attr_slidebar_mode.attr, + NULL +}; + +static struct attribute_group ideapad_attr_group = { + .attrs = ideapad_attrs +}; + +static const struct attribute_group *ideapad_attr_groups[] = { + &ideapad_attr_group, + NULL +}; + +static int __init ideapad_probe(struct platform_device* pdev) +{ + int err; + + if (!request_region(IDEAPAD_BASE, 3, "ideapad_slidebar")) { + dev_err(&pdev->dev, "IO ports are busy\n"); + return -EBUSY; + } + + slidebar_input_dev = input_allocate_device(); + if (!slidebar_input_dev) { + dev_err(&pdev->dev, "Failed to allocate input device\n"); + err = -ENOMEM; + goto err_release_ports; + } + + slidebar_input_dev->name = "IdeaPad Slidebar"; + slidebar_input_dev->id.bustype = BUS_HOST; + slidebar_input_dev->dev.parent = &pdev->dev; + input_set_capability(slidebar_input_dev, EV_KEY, BTN_TOUCH); + input_set_capability(slidebar_input_dev, EV_ABS, ABS_X); + input_set_abs_params(slidebar_input_dev, ABS_X, 0, 0xff, 0, 0); + + err = i8042_install_filter(slidebar_i8042_filter); + if (err) { + dev_err(&pdev->dev, + "Failed to install i8042 filter: %d\n", err); + goto err_free_dev; + } + + err = input_register_device(slidebar_input_dev); + if (err) { + dev_err(&pdev->dev, + "Failed to register input device: %d\n", err); + goto err_remove_filter; + } + + return 0; + +err_remove_filter: + i8042_remove_filter(slidebar_i8042_filter); +err_free_dev: + input_free_device(slidebar_input_dev); +err_release_ports: + release_region(IDEAPAD_BASE, 3); + return err; +} + +static int ideapad_remove(struct platform_device *pdev) +{ + i8042_remove_filter(slidebar_i8042_filter); + input_unregister_device(slidebar_input_dev); + release_region(IDEAPAD_BASE, 3); + + return 0; +} + +static struct platform_driver slidebar_drv = { + .driver = { + .name = "ideapad_slidebar", + .owner = THIS_MODULE, + }, + .remove = ideapad_remove, +}; + +static int __init ideapad_dmi_check(const struct dmi_system_id *id) +{ + pr_info("Laptop model '%s'\n", id->ident); + return 1; +} + +static const struct dmi_system_id ideapad_dmi[] __initconst = { + { + .ident = "Lenovo IdeaPad Y550", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "20017"), + DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Y550") + }, + .callback = ideapad_dmi_check + }, + { + .ident = "Lenovo IdeaPad Y550P", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "20035"), + DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Y550P") + }, + .callback = ideapad_dmi_check + }, + { NULL, } +}; +MODULE_DEVICE_TABLE(dmi, ideapad_dmi); + +static int __init slidebar_init(void) +{ + int err; + + if (!force && !dmi_check_system(ideapad_dmi)) { + pr_err("DMI does not match\n"); + return -ENODEV; + } + + slidebar_platform_dev = platform_device_alloc("ideapad_slidebar", -1); + if (!slidebar_platform_dev) { + pr_err("Not enough memory\n"); + return -ENOMEM; + } + + slidebar_platform_dev->dev.groups = ideapad_attr_groups; + + err = platform_device_add(slidebar_platform_dev); + if (err) { + pr_err("Failed to register platform device\n"); + goto err_free_dev; + } + + err = platform_driver_probe(&slidebar_drv, ideapad_probe); + if (err) { + pr_err("Failed to register platform driver\n"); + goto err_delete_dev; + } + + return 0; + +err_delete_dev: + platform_device_del(slidebar_platform_dev); +err_free_dev: + platform_device_put(slidebar_platform_dev); + return err; +} + +static void __exit slidebar_exit(void) +{ + platform_device_unregister(slidebar_platform_dev); + platform_driver_unregister(&slidebar_drv); +} + +module_init(slidebar_init); +module_exit(slidebar_exit); + +MODULE_AUTHOR("Andrey Moiseev "); +MODULE_DESCRIPTION("Slidebar input support for some Lenovo IdeaPad laptops"); +MODULE_LICENSE("GPL"); diff --git a/drivers/input/serio/i8042.h b/drivers/input/serio/i8042.h index 3452708..fc080be 100644 --- a/drivers/input/serio/i8042.h +++ b/drivers/input/serio/i8042.h @@ -41,30 +41,6 @@ #define I8042_CTL_TIMEOUT 10000 /* - * Status register bits. - */ - -#define I8042_STR_PARITY 0x80 -#define I8042_STR_TIMEOUT 0x40 -#define I8042_STR_AUXDATA 0x20 -#define I8042_STR_KEYLOCK 0x10 -#define I8042_STR_CMDDAT 0x08 -#define I8042_STR_MUXERR 0x04 -#define I8042_STR_IBF 0x02 -#define I8042_STR_OBF 0x01 - -/* - * Control register bits. - */ - -#define I8042_CTR_KBDINT 0x01 -#define I8042_CTR_AUXINT 0x02 -#define I8042_CTR_IGNKEYLOCK 0x08 -#define I8042_CTR_KBDDIS 0x10 -#define I8042_CTR_AUXDIS 0x20 -#define I8042_CTR_XLATE 0x40 - -/* * Return codes. */ diff --git a/include/linux/i8042.h b/include/linux/i8042.h index a986ff5..0f9bafa 100644 --- a/include/linux/i8042.h +++ b/include/linux/i8042.h @@ -31,6 +31,30 @@ #define I8042_CMD_MUX_PFX 0x0090 #define I8042_CMD_MUX_SEND 0x1090 +/* + * Status register bits. + */ + +#define I8042_STR_PARITY 0x80 +#define I8042_STR_TIMEOUT 0x40 +#define I8042_STR_AUXDATA 0x20 +#define I8042_STR_KEYLOCK 0x10 +#define I8042_STR_CMDDAT 0x08 +#define I8042_STR_MUXERR 0x04 +#define I8042_STR_IBF 0x02 +#define I8042_STR_OBF 0x01 + +/* + * Control register bits. + */ + +#define I8042_CTR_KBDINT 0x01 +#define I8042_CTR_AUXINT 0x02 +#define I8042_CTR_IGNKEYLOCK 0x08 +#define I8042_CTR_KBDDIS 0x10 +#define I8042_CTR_AUXDIS 0x20 +#define I8042_CTR_XLATE 0x40 + struct serio; #if defined(CONFIG_SERIO_I8042) || defined(CONFIG_SERIO_I8042_MODULE) -- cgit v0.10.2 From ca0abe3d89fd95b80654e3429d84e4aad567a395 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Thu, 29 Aug 2013 08:40:42 -0700 Subject: Input: cyttsp4 - kill 'defined but not used' compiler warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If both CONFIG_PM_SLEEP and CONFIG_PM_RUNTIME are unset: drivers/input/touchscreen/cyttsp4_core.c:1556: warning: ‘cyttsp4_core_sleep’ defined but not used drivers/input/touchscreen/cyttsp4_core.c:1634: warning: ‘cyttsp4_core_wake’ defined but not used Move cyttsp4_core_sleep(), cyttsp4_core_wake(), and cyttsp4_core_wake_() (which is called from cyttsp4_core_wake() only) inside the existing section protected by #if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_RUNTIME) Signed-off-by: Geert Uytterhoeven Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c index 8238d98..5800040 100644 --- a/drivers/input/touchscreen/cyttsp4_core.c +++ b/drivers/input/touchscreen/cyttsp4_core.c @@ -1554,106 +1554,6 @@ exit: return rc; } -static int cyttsp4_core_sleep(struct cyttsp4 *cd) -{ - int rc; - - rc = cyttsp4_request_exclusive(cd, cd->dev, - CY_CORE_SLEEP_REQUEST_EXCLUSIVE_TIMEOUT); - if (rc < 0) { - dev_err(cd->dev, "%s: fail get exclusive ex=%p own=%p\n", - __func__, cd->exclusive_dev, cd->dev); - return 0; - } - - rc = cyttsp4_core_sleep_(cd); - - if (cyttsp4_release_exclusive(cd, cd->dev) < 0) - dev_err(cd->dev, "%s: fail to release exclusive\n", __func__); - else - dev_vdbg(cd->dev, "%s: pass release exclusive\n", __func__); - - return rc; -} - -static int cyttsp4_core_wake_(struct cyttsp4 *cd) -{ - struct device *dev = cd->dev; - int rc; - u8 mode; - int t; - - /* Already woken? */ - mutex_lock(&cd->system_lock); - if (cd->sleep_state == SS_SLEEP_OFF) { - mutex_unlock(&cd->system_lock); - return 0; - } - cd->int_status &= ~CY_INT_IGNORE; - cd->int_status |= CY_INT_AWAKE; - cd->sleep_state = SS_WAKING; - - if (cd->cpdata->power) { - dev_dbg(dev, "%s: Power up HW\n", __func__); - rc = cd->cpdata->power(cd->cpdata, 1, dev, &cd->ignore_irq); - } else { - dev_dbg(dev, "%s: No power function\n", __func__); - rc = -ENOSYS; - } - if (rc < 0) { - dev_err(dev, "%s: HW Power up fails r=%d\n", - __func__, rc); - - /* Initiate a read transaction to wake up */ - cyttsp4_adap_read(cd, CY_REG_BASE, sizeof(mode), &mode); - } else - dev_vdbg(cd->dev, "%s: HW power up succeeds\n", - __func__); - mutex_unlock(&cd->system_lock); - - t = wait_event_timeout(cd->wait_q, - (cd->int_status & CY_INT_AWAKE) == 0, - msecs_to_jiffies(CY_CORE_WAKEUP_TIMEOUT)); - if (IS_TMO(t)) { - dev_err(dev, "%s: TMO waiting for wakeup\n", __func__); - mutex_lock(&cd->system_lock); - cd->int_status &= ~CY_INT_AWAKE; - /* Try starting up */ - cyttsp4_queue_startup_(cd); - mutex_unlock(&cd->system_lock); - } - - mutex_lock(&cd->system_lock); - cd->sleep_state = SS_SLEEP_OFF; - mutex_unlock(&cd->system_lock); - - cyttsp4_start_wd_timer(cd); - - return 0; -} - -static int cyttsp4_core_wake(struct cyttsp4 *cd) -{ - int rc; - - rc = cyttsp4_request_exclusive(cd, cd->dev, - CY_CORE_REQUEST_EXCLUSIVE_TIMEOUT); - if (rc < 0) { - dev_err(cd->dev, "%s: fail get exclusive ex=%p own=%p\n", - __func__, cd->exclusive_dev, cd->dev); - return 0; - } - - rc = cyttsp4_core_wake_(cd); - - if (cyttsp4_release_exclusive(cd, cd->dev) < 0) - dev_err(cd->dev, "%s: fail to release exclusive\n", __func__); - else - dev_vdbg(cd->dev, "%s: pass release exclusive\n", __func__); - - return rc; -} - static int cyttsp4_startup_(struct cyttsp4 *cd) { int retry = CY_CORE_STARTUP_RETRY_COUNT; @@ -1823,6 +1723,106 @@ static void cyttsp4_free_si_ptrs(struct cyttsp4 *cd) } #if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_RUNTIME) +static int cyttsp4_core_sleep(struct cyttsp4 *cd) +{ + int rc; + + rc = cyttsp4_request_exclusive(cd, cd->dev, + CY_CORE_SLEEP_REQUEST_EXCLUSIVE_TIMEOUT); + if (rc < 0) { + dev_err(cd->dev, "%s: fail get exclusive ex=%p own=%p\n", + __func__, cd->exclusive_dev, cd->dev); + return 0; + } + + rc = cyttsp4_core_sleep_(cd); + + if (cyttsp4_release_exclusive(cd, cd->dev) < 0) + dev_err(cd->dev, "%s: fail to release exclusive\n", __func__); + else + dev_vdbg(cd->dev, "%s: pass release exclusive\n", __func__); + + return rc; +} + +static int cyttsp4_core_wake_(struct cyttsp4 *cd) +{ + struct device *dev = cd->dev; + int rc; + u8 mode; + int t; + + /* Already woken? */ + mutex_lock(&cd->system_lock); + if (cd->sleep_state == SS_SLEEP_OFF) { + mutex_unlock(&cd->system_lock); + return 0; + } + cd->int_status &= ~CY_INT_IGNORE; + cd->int_status |= CY_INT_AWAKE; + cd->sleep_state = SS_WAKING; + + if (cd->cpdata->power) { + dev_dbg(dev, "%s: Power up HW\n", __func__); + rc = cd->cpdata->power(cd->cpdata, 1, dev, &cd->ignore_irq); + } else { + dev_dbg(dev, "%s: No power function\n", __func__); + rc = -ENOSYS; + } + if (rc < 0) { + dev_err(dev, "%s: HW Power up fails r=%d\n", + __func__, rc); + + /* Initiate a read transaction to wake up */ + cyttsp4_adap_read(cd, CY_REG_BASE, sizeof(mode), &mode); + } else + dev_vdbg(cd->dev, "%s: HW power up succeeds\n", + __func__); + mutex_unlock(&cd->system_lock); + + t = wait_event_timeout(cd->wait_q, + (cd->int_status & CY_INT_AWAKE) == 0, + msecs_to_jiffies(CY_CORE_WAKEUP_TIMEOUT)); + if (IS_TMO(t)) { + dev_err(dev, "%s: TMO waiting for wakeup\n", __func__); + mutex_lock(&cd->system_lock); + cd->int_status &= ~CY_INT_AWAKE; + /* Try starting up */ + cyttsp4_queue_startup_(cd); + mutex_unlock(&cd->system_lock); + } + + mutex_lock(&cd->system_lock); + cd->sleep_state = SS_SLEEP_OFF; + mutex_unlock(&cd->system_lock); + + cyttsp4_start_wd_timer(cd); + + return 0; +} + +static int cyttsp4_core_wake(struct cyttsp4 *cd) +{ + int rc; + + rc = cyttsp4_request_exclusive(cd, cd->dev, + CY_CORE_REQUEST_EXCLUSIVE_TIMEOUT); + if (rc < 0) { + dev_err(cd->dev, "%s: fail get exclusive ex=%p own=%p\n", + __func__, cd->exclusive_dev, cd->dev); + return 0; + } + + rc = cyttsp4_core_wake_(cd); + + if (cyttsp4_release_exclusive(cd, cd->dev) < 0) + dev_err(cd->dev, "%s: fail to release exclusive\n", __func__); + else + dev_vdbg(cd->dev, "%s: pass release exclusive\n", __func__); + + return rc; +} + static int cyttsp4_core_suspend(struct device *dev) { struct cyttsp4 *cd = dev_get_drvdata(dev); -- cgit v0.10.2 From be9a6f4025f7044cd7edf4db07f7184e742d0fbd Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 29 Aug 2013 08:43:58 -0700 Subject: Input: MAINTAINERS - change maintainer for cyttsp driver I haven't had time to work on this driver for a long time and Ferruh has been doing a great job making it more generic, adding support for new hardware and providing bug fixes. So, let's make MAINTAINERS reflect reality and add him as the cyttsp maintainer instead of me. Also, since Ferruh works for Cypress, we may change the driver status from Maintained to Supported. Signed-off-by: Javier Martinez Canillas Acked-by: Ferruh Yigit Signed-off-by: Dmitry Torokhov diff --git a/MAINTAINERS b/MAINTAINERS index bd1c48e..15c2d21 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2411,9 +2411,9 @@ S: Maintained F: drivers/media/common/cypress_firmware* CYTTSP TOUCHSCREEN DRIVER -M: Javier Martinez Canillas +M: Ferruh Yigit L: linux-input@vger.kernel.org -S: Maintained +S: Supported F: drivers/input/touchscreen/cyttsp* F: include/linux/input/cyttsp.h -- cgit v0.10.2 From c9eb303bd12be8446e672e0a42d41a5b88c7b5cb Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Thu, 29 Aug 2013 09:12:08 -0700 Subject: Input: egalax-ts - fix typo and improve text Signed-off-by: Fabio Estevam Signed-off-by: Dmitry Torokhov diff --git a/Documentation/devicetree/bindings/input/touchscreen/egalax-ts.txt b/Documentation/devicetree/bindings/input/touchscreen/egalax-ts.txt index df70318..49fa14ed 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/egalax-ts.txt +++ b/Documentation/devicetree/bindings/input/touchscreen/egalax-ts.txt @@ -6,7 +6,7 @@ Required properties: - interrupt-parent: the phandle for the interrupt controller - interrupts: touch controller interrupt - wakeup-gpios: the gpio pin to be used for waking up the controller - as well as uased as irq pin + and also used as irq pin Example: -- cgit v0.10.2 From d33c4aa32d426a7c00d33b5b1212720d5bc3fa44 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Thu, 29 Aug 2013 09:13:35 -0700 Subject: Input: max11801_ts - convert to devm Converting to devm functions can make the code smaller and cleaner. Signed-off-by: Fabio Estevam Signed-off-by: Dmitry Torokhov diff --git a/drivers/input/touchscreen/max11801_ts.c b/drivers/input/touchscreen/max11801_ts.c index 00bc6ca..9f84fcd 100644 --- a/drivers/input/touchscreen/max11801_ts.c +++ b/drivers/input/touchscreen/max11801_ts.c @@ -181,12 +181,11 @@ static int max11801_ts_probe(struct i2c_client *client, struct input_dev *input_dev; int error; - data = kzalloc(sizeof(struct max11801_data), GFP_KERNEL); - input_dev = input_allocate_device(); + data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + input_dev = devm_input_allocate_device(&client->dev); if (!data || !input_dev) { dev_err(&client->dev, "Failed to allocate memory\n"); - error = -ENOMEM; - goto err_free_mem; + return -ENOMEM; } data->client = client; @@ -205,38 +204,21 @@ static int max11801_ts_probe(struct i2c_client *client, max11801_ts_phy_init(data); - error = request_threaded_irq(client->irq, NULL, max11801_ts_interrupt, - IRQF_TRIGGER_LOW | IRQF_ONESHOT, - "max11801_ts", data); + error = devm_request_threaded_irq(&client->dev, client->irq, NULL, + max11801_ts_interrupt, + IRQF_TRIGGER_LOW | IRQF_ONESHOT, + "max11801_ts", data); if (error) { dev_err(&client->dev, "Failed to register interrupt\n"); - goto err_free_mem; + return error; } error = input_register_device(data->input_dev); if (error) - goto err_free_irq; + return error; i2c_set_clientdata(client, data); return 0; - -err_free_irq: - free_irq(client->irq, data); -err_free_mem: - input_free_device(input_dev); - kfree(data); - return error; -} - -static int max11801_ts_remove(struct i2c_client *client) -{ - struct max11801_data *data = i2c_get_clientdata(client); - - free_irq(client->irq, data); - input_unregister_device(data->input_dev); - kfree(data); - - return 0; } static const struct i2c_device_id max11801_ts_id[] = { @@ -252,7 +234,6 @@ static struct i2c_driver max11801_ts_driver = { }, .id_table = max11801_ts_id, .probe = max11801_ts_probe, - .remove = max11801_ts_remove, }; module_i2c_driver(max11801_ts_driver); -- cgit v0.10.2 From 52764fed5049655926bcecaefd52f0a415ceb105 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Thu, 29 Aug 2013 09:35:11 -0700 Subject: Input: add SYN_MAX and SYN_CNT constants SYN_* events are special and not enabled via set_bit() for devices. Hence, they haven't been really needed, yet. However, user-space can still make great use of that for int->string debugging helpers or alike. Also, I haven't seen any reason not to define these, so here they are. Signed-off-by: David Herrmann Acked-by: Peter Hutterer Signed-off-by: Dmitry Torokhov diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h index 4649ee3..2fb6fae 100644 --- a/include/uapi/linux/input.h +++ b/include/uapi/linux/input.h @@ -194,6 +194,8 @@ struct input_keymap_entry { #define SYN_CONFIG 1 #define SYN_MT_REPORT 2 #define SYN_DROPPED 3 +#define SYN_MAX 0xf +#define SYN_CNT (SYN_MAX+1) /* * Keys and buttons -- cgit v0.10.2