linux-old/drivers/sound/cs4281/cs4281pm-24.c
<<
>>
Prefs
   1/*******************************************************************************
   2*
   3*      "cs4281pm.c" --  Cirrus Logic-Crystal CS4281 linux audio driver.
   4*
   5*      Copyright (C) 2000,2001  Cirrus Logic Corp.  
   6*            -- tom woller (twoller@crystal.cirrus.com) or
   7*               (pcaudio@crystal.cirrus.com).
   8*
   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.
  13*
  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.
  18*
  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.
  22*
  23* 12/22/00 trw - new file. 
  24*
  25*******************************************************************************/
  26
  27#ifndef NOT_CS4281_PM
  28
  29#if CS4281_PCI_PM_SUPPORT_ENABLE
  30#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,12)
  31static int cs4281_suspend_tbl(struct pci_dev *pcidev, u32 unused)
  32{
  33        struct cs4281_state *s = pci_get_drvdata(pcidev);
  34        cs4281_suspend(s);
  35        return 0;
  36}
  37
  38static int cs4281_resume_tbl(struct pci_dev *pcidev)
  39{
  40        struct cs4281_state *s = pci_get_drvdata(pcidev);
  41        cs4281_resume(s);
  42        return 0;
  43}
  44#else
  45void cs4281_suspend_tbl(struct pci_dev *pcidev)
  46{
  47        struct cs4281_state *s = pci_get_drvdata(pcidev);
  48        cs4281_suspend(s);
  49        return;
  50}
  51
  52void cs4281_resume_tbl(struct pci_dev *pcidev)
  53{
  54        struct cs4281_state *s = pci_get_drvdata(pcidev);
  55        cs4281_resume(s);
  56        return;
  57}
  58#endif
  59#else
  60int cs4281_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data)
  61{
  62        struct cs4281_state *state;
  63
  64        CS_DBGOUT(CS_PM, 2, printk(
  65                "cs4281: cs4281_pm_callback()+ dev=0x%x rqst=0x%x state=%d\n",
  66                        (unsigned)dev,(unsigned)rqst,(unsigned)data));
  67        state = (struct cs4281_state *) dev->data;
  68        if (state) {
  69                switch(rqst) {
  70                        case PM_SUSPEND:
  71                                CS_DBGOUT(CS_PM, 2, printk(KERN_INFO
  72                                        "cs4281: PM suspend request\n"));
  73                                if(cs4281_suspend(state))
  74                                {
  75                                    CS_DBGOUT(CS_ERROR, 2, printk(KERN_INFO
  76                                        "cs4281: PM suspend request refused\n"));
  77                                        return 1; 
  78                                }
  79                                break;
  80                        case PM_RESUME:
  81                                CS_DBGOUT(CS_PM, 2, printk(KERN_INFO
  82                                        "cs4281: PM resume request\n"));
  83                                if(cs4281_resume(state))
  84                                {
  85                                    CS_DBGOUT(CS_ERROR, 2, printk(KERN_INFO
  86                                        "cs4281: PM resume request refused\n"));
  87                                        return 1;
  88                                }
  89                                break;
  90                }
  91        }
  92        CS_DBGOUT(CS_PM, 2, printk("cs4281: cs4281_pm_callback()- 0\n"));
  93
  94        return 0;
  95}
  96#endif //#if CS4281_PCI_PM_SUPPORT_ENABLE
  97
  98#else /* NOT_CS4281_PM */
  99#define CS4281_SUSPEND_TBL cs4281_null_suspend
 100#define CS4281_RESUME_TBL cs4281_null_resume
 101#endif /* NOT_CS4281_PM */
 102