Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / sound / oss / cs4281 / cs4281pm-24.c
blobd2a453aff0aa17ee174101f60f150667ffab0680
1 /*******************************************************************************
3 * "cs4281pm.c" -- Cirrus Logic-Crystal CS4281 linux audio driver.
5 * Copyright (C) 2000,2001 Cirrus Logic Corp.
6 * -- tom woller (twoller@crystal.cirrus.com) or
7 * (audio@crystal.cirrus.com).
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 * 12/22/00 trw - new file.
25 *******************************************************************************/
27 #ifndef NOT_CS4281_PM
28 #include <linux/pm.h>
30 #define cs_pm_register(a, b, c) pm_register((a), (b), (c));
31 #define cs_pm_unregister_all(a) pm_unregister_all((a));
33 static int cs4281_suspend(struct cs4281_state *s);
34 static int cs4281_resume(struct cs4281_state *s);
35 /*
36 * for now (12/22/00) only enable the pm_register PM support.
37 * allow these table entries to be null.
38 #define CS4281_SUSPEND_TBL cs4281_suspend_tbl
39 #define CS4281_RESUME_TBL cs4281_resume_tbl
41 #define CS4281_SUSPEND_TBL cs4281_suspend_null
42 #define CS4281_RESUME_TBL cs4281_resume_null
44 static int cs4281_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data)
46 struct cs4281_state *state;
48 CS_DBGOUT(CS_PM, 2, printk(KERN_INFO
49 "cs4281: cs4281_pm_callback dev=%p rqst=0x%x state=%p\n",
50 dev,(unsigned)rqst,data));
51 state = (struct cs4281_state *) dev->data;
52 if (state) {
53 switch(rqst) {
54 case PM_SUSPEND:
55 CS_DBGOUT(CS_PM, 2, printk(KERN_INFO
56 "cs4281: PM suspend request\n"));
57 if(cs4281_suspend(state))
59 CS_DBGOUT(CS_ERROR, 2, printk(KERN_INFO
60 "cs4281: PM suspend request refused\n"));
61 return 1;
63 break;
64 case PM_RESUME:
65 CS_DBGOUT(CS_PM, 2, printk(KERN_INFO
66 "cs4281: PM resume request\n"));
67 if(cs4281_resume(state))
69 CS_DBGOUT(CS_ERROR, 2, printk(KERN_INFO
70 "cs4281: PM resume request refused\n"));
71 return 1;
73 break;
77 return 0;
80 #else /* CS4281_PM */
81 #define CS4281_SUSPEND_TBL cs4281_suspend_null
82 #define CS4281_RESUME_TBL cs4281_resume_null
83 #endif /* CS4281_PM */