From patchwork Tue Mar 30 20:43:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Bruno_Pr=C3=A9mont?= X-Patchwork-Id: 89401 X-Patchwork-Delegate: jikos@jikos.cz Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2UKmLTY022629 for ; Tue, 30 Mar 2010 20:48:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756124Ab0C3UrZ (ORCPT ); Tue, 30 Mar 2010 16:47:25 -0400 Received: from legolas.restena.lu ([158.64.1.34]:54823 "EHLO legolas.restena.lu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755631Ab0C3Uq2 convert rfc822-to-8bit (ORCPT ); Tue, 30 Mar 2010 16:46:28 -0400 Received: from legolas.restena.lu (localhost [127.0.0.1]) by legolas.restena.lu (Postfix) with ESMTP id 84ABCA98CD; Tue, 30 Mar 2010 22:46:26 +0200 (CEST) Received: from neptune.home (unknown [158.64.15.115]) by legolas.restena.lu (Postfix) with ESMTP id 352D8AF4D9; Tue, 30 Mar 2010 22:46:26 +0200 (CEST) Date: Tue, 30 Mar 2010 22:43:28 +0200 From: Bruno =?UTF-8?B?UHLDqW1vbnQ=?= To: Jiri Kosina Cc: Dmitry Torokhov , linux-input@vger.kernel.org, linux-usb@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Rick L. Vinyard Jr." , Nicu Pavel , Oliver Neukum , Jaya Kumar Subject: [PATCH v6 8/8] hid: add PM support to PicoLCD device Message-ID: <20100330224328.685f74ef@neptune.home> In-Reply-To: <20100330223224.18fe4f3e@neptune.home> References: <20100324233707.7243b04d@neptune.home> <20100324234022.0361bd80@neptune.home> <20100326065656.GC26602@core.coreip.homeip.net> <20100326102951.3b9ecda1@neptune.home> <20100327012245.0ace6a09@neptune.home> <20100329121611.0c22dcaf@pluto.restena.lu> <20100330223224.18fe4f3e@neptune.home> X-Mailer: Claws Mail 3.7.5 (GTK+ 2.18.6; i686-pc-linux-gnu) Mime-Version: 1.0 X-Virus-Scanned: ClamAV Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 30 Mar 2010 20:48:23 +0000 (UTC) diff --git a/drivers/hid/hid-picolcd.c b/drivers/hid/hid-picolcd.c index fe1f772..daa7c5d 100644 --- a/drivers/hid/hid-picolcd.c +++ b/drivers/hid/hid-picolcd.c @@ -2255,6 +2255,43 @@ static int picolcd_raw_event(struct hid_device *hdev, return 1; } +#ifdef CONFIG_PM +static int picolcd_suspend(struct hid_device *hdev) +{ + picolcd_suspend_backlight(hid_get_drvdata(hdev)); + dbg_hid(PICOLCD_NAME " device ready for suspend\n"); + return 0; +} + +static int picolcd_resume(struct hid_device *hdev) +{ + int ret; + ret = picolcd_resume_backlight(hid_get_drvdata(hdev)); + if (ret) + dbg_hid(PICOLCD_NAME " restoring backlight failed: %d\n", ret); + return 0; +} + +static int picolcd_reset_resume(struct hid_device *hdev) +{ + int ret; + ret = picolcd_reset(hdev); + if (ret) + dbg_hid(PICOLCD_NAME " resetting our device failed: %d\n", ret); + ret = picolcd_fb_reset(hid_get_drvdata(hdev), 0); + if (ret) + dbg_hid(PICOLCD_NAME " restoring framebuffer content failed: %d\n", ret); + ret = picolcd_resume_lcd(hid_get_drvdata(hdev)); + if (ret) + dbg_hid(PICOLCD_NAME " restoring lcd failed: %d\n", ret); + ret = picolcd_resume_backlight(hid_get_drvdata(hdev)); + if (ret) + dbg_hid(PICOLCD_NAME " restoring backlight failed: %d\n", ret); + picolcd_leds_set(hid_get_drvdata(hdev)); + return 0; +} +#endif + /* initialize keypad input device */ static int picolcd_init_keys(struct picolcd_data *data, struct hid_report *report) @@ -2530,6 +2567,11 @@ static struct hid_driver picolcd_driver = { .probe = picolcd_probe, .remove = picolcd_remove, .raw_event = picolcd_raw_event, +#ifdef CONFIG_PM + .suspend = picolcd_suspend, + .resume = picolcd_resume, + .reset_resume = picolcd_reset_resume, +#endif }; static int __init picolcd_init(void)