OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [LINUX_2_4_26_OR32/] [linux/] [linux-2.4/] [include/] [linux/] [pm.h] - Diff between revs 1279 and 1765

Only display areas with differences | Details | Blame | View Log

Rev 1279 Rev 1765
/*
/*
 *  pm.h - Power management interface
 *  pm.h - Power management interface
 *
 *
 *  Copyright (C) 2000 Andrew Henroid
 *  Copyright (C) 2000 Andrew Henroid
 *
 *
 *  This program is free software; you can redistribute it and/or modify
 *  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
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *  (at your option) any later version.
 *
 *
 *  This program is distributed in the hope that it will be useful,
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *  GNU General Public License for more details.
 *
 *
 *  You should have received a copy of the GNU General Public License
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
 */
 
 
#ifndef _LINUX_PM_H
#ifndef _LINUX_PM_H
#define _LINUX_PM_H
#define _LINUX_PM_H
 
 
#ifdef __KERNEL__
#ifdef __KERNEL__
 
 
#include <linux/config.h>
#include <linux/config.h>
#include <linux/list.h>
#include <linux/list.h>
 
 
/*
/*
 * Power management requests
 * Power management requests
 */
 */
enum
enum
{
{
        PM_SUSPEND, /* enter D1-D3 */
        PM_SUSPEND, /* enter D1-D3 */
        PM_RESUME,  /* enter D0 */
        PM_RESUME,  /* enter D0 */
 
 
        PM_SAVE_STATE,  /* save device's state */
        PM_SAVE_STATE,  /* save device's state */
 
 
        /* enable wake-on */
        /* enable wake-on */
        PM_SET_WAKEUP,
        PM_SET_WAKEUP,
 
 
        /* bus resource management */
        /* bus resource management */
        PM_GET_RESOURCES,
        PM_GET_RESOURCES,
        PM_SET_RESOURCES,
        PM_SET_RESOURCES,
 
 
        /* base station management */
        /* base station management */
        PM_EJECT,
        PM_EJECT,
        PM_LOCK,
        PM_LOCK,
};
};
 
 
typedef int pm_request_t;
typedef int pm_request_t;
 
 
/*
/*
 * Device types
 * Device types
 */
 */
enum
enum
{
{
        PM_UNKNOWN_DEV = 0, /* generic */
        PM_UNKNOWN_DEV = 0, /* generic */
        PM_SYS_DEV,         /* system device (fan, KB controller, ...) */
        PM_SYS_DEV,         /* system device (fan, KB controller, ...) */
        PM_PCI_DEV,         /* PCI device */
        PM_PCI_DEV,         /* PCI device */
        PM_USB_DEV,         /* USB device */
        PM_USB_DEV,         /* USB device */
        PM_SCSI_DEV,        /* SCSI device */
        PM_SCSI_DEV,        /* SCSI device */
        PM_ISA_DEV,         /* ISA device */
        PM_ISA_DEV,         /* ISA device */
        PM_MTD_DEV,         /* Memory Technology Device */
        PM_MTD_DEV,         /* Memory Technology Device */
};
};
 
 
typedef int pm_dev_t;
typedef int pm_dev_t;
 
 
/*
/*
 * System device hardware ID (PnP) values
 * System device hardware ID (PnP) values
 */
 */
enum
enum
{
{
        PM_SYS_UNKNOWN = 0x00000000, /* generic */
        PM_SYS_UNKNOWN = 0x00000000, /* generic */
        PM_SYS_KBC =     0x41d00303, /* keyboard controller */
        PM_SYS_KBC =     0x41d00303, /* keyboard controller */
        PM_SYS_COM =     0x41d00500, /* serial port */
        PM_SYS_COM =     0x41d00500, /* serial port */
        PM_SYS_IRDA =    0x41d00510, /* IRDA controller */
        PM_SYS_IRDA =    0x41d00510, /* IRDA controller */
        PM_SYS_FDC =     0x41d00700, /* floppy controller */
        PM_SYS_FDC =     0x41d00700, /* floppy controller */
        PM_SYS_VGA =     0x41d00900, /* VGA controller */
        PM_SYS_VGA =     0x41d00900, /* VGA controller */
        PM_SYS_PCMCIA =  0x41d00e00, /* PCMCIA controller */
        PM_SYS_PCMCIA =  0x41d00e00, /* PCMCIA controller */
};
};
 
 
/*
/*
 * Device identifier
 * Device identifier
 */
 */
#define PM_PCI_ID(dev) ((dev)->bus->number << 16 | (dev)->devfn)
#define PM_PCI_ID(dev) ((dev)->bus->number << 16 | (dev)->devfn)
 
 
/*
/*
 * Request handler callback
 * Request handler callback
 */
 */
struct pm_dev;
struct pm_dev;
 
 
typedef int (*pm_callback)(struct pm_dev *dev, pm_request_t rqst, void *data);
typedef int (*pm_callback)(struct pm_dev *dev, pm_request_t rqst, void *data);
 
 
/*
/*
 * Dynamic device information
 * Dynamic device information
 */
 */
struct pm_dev
struct pm_dev
{
{
        pm_dev_t         type;
        pm_dev_t         type;
        unsigned long    id;
        unsigned long    id;
        pm_callback      callback;
        pm_callback      callback;
        void            *data;
        void            *data;
 
 
        unsigned long    flags;
        unsigned long    flags;
        unsigned long    state;
        unsigned long    state;
        unsigned long    prev_state;
        unsigned long    prev_state;
 
 
        struct list_head entry;
        struct list_head entry;
};
};
 
 
#ifdef CONFIG_PM
#ifdef CONFIG_PM
 
 
extern int pm_active;
extern int pm_active;
 
 
#define PM_IS_ACTIVE() (pm_active != 0)
#define PM_IS_ACTIVE() (pm_active != 0)
 
 
/*
/*
 * Register a device with power management
 * Register a device with power management
 */
 */
struct pm_dev *pm_register(pm_dev_t type,
struct pm_dev *pm_register(pm_dev_t type,
                           unsigned long id,
                           unsigned long id,
                           pm_callback callback);
                           pm_callback callback);
 
 
/*
/*
 * Unregister a device with power management
 * Unregister a device with power management
 */
 */
void pm_unregister(struct pm_dev *dev);
void pm_unregister(struct pm_dev *dev);
 
 
/*
/*
 * Unregister all devices with matching callback
 * Unregister all devices with matching callback
 */
 */
void pm_unregister_all(pm_callback callback);
void pm_unregister_all(pm_callback callback);
 
 
/*
/*
 * Send a request to a single device
 * Send a request to a single device
 */
 */
int pm_send(struct pm_dev *dev, pm_request_t rqst, void *data);
int pm_send(struct pm_dev *dev, pm_request_t rqst, void *data);
 
 
/*
/*
 * Send a request to all devices
 * Send a request to all devices
 */
 */
int pm_send_all(pm_request_t rqst, void *data);
int pm_send_all(pm_request_t rqst, void *data);
 
 
/*
/*
 * Find a device
 * Find a device
 */
 */
struct pm_dev *pm_find(pm_dev_t type, struct pm_dev *from);
struct pm_dev *pm_find(pm_dev_t type, struct pm_dev *from);
 
 
static inline void pm_access(struct pm_dev *dev) {}
static inline void pm_access(struct pm_dev *dev) {}
static inline void pm_dev_idle(struct pm_dev *dev) {}
static inline void pm_dev_idle(struct pm_dev *dev) {}
 
 
#else /* CONFIG_PM */
#else /* CONFIG_PM */
 
 
#define PM_IS_ACTIVE() 0
#define PM_IS_ACTIVE() 0
 
 
static inline struct pm_dev *pm_register(pm_dev_t type,
static inline struct pm_dev *pm_register(pm_dev_t type,
                                         unsigned long id,
                                         unsigned long id,
                                         pm_callback callback)
                                         pm_callback callback)
{
{
        return 0;
        return 0;
}
}
 
 
static inline void pm_unregister(struct pm_dev *dev) {}
static inline void pm_unregister(struct pm_dev *dev) {}
 
 
static inline void pm_unregister_all(pm_callback callback) {}
static inline void pm_unregister_all(pm_callback callback) {}
 
 
static inline int pm_send(struct pm_dev *dev, pm_request_t rqst, void *data)
static inline int pm_send(struct pm_dev *dev, pm_request_t rqst, void *data)
{
{
        return 0;
        return 0;
}
}
 
 
static inline int pm_send_all(pm_request_t rqst, void *data)
static inline int pm_send_all(pm_request_t rqst, void *data)
{
{
        return 0;
        return 0;
}
}
 
 
static inline struct pm_dev *pm_find(pm_dev_t type, struct pm_dev *from)
static inline struct pm_dev *pm_find(pm_dev_t type, struct pm_dev *from)
{
{
        return 0;
        return 0;
}
}
 
 
static inline void pm_access(struct pm_dev *dev) {}
static inline void pm_access(struct pm_dev *dev) {}
static inline void pm_dev_idle(struct pm_dev *dev) {}
static inline void pm_dev_idle(struct pm_dev *dev) {}
 
 
#endif /* CONFIG_PM */
#endif /* CONFIG_PM */
 
 
extern void (*pm_idle)(void);
extern void (*pm_idle)(void);
extern void (*pm_power_off)(void);
extern void (*pm_power_off)(void);
 
 
#endif /* __KERNEL__ */
#endif /* __KERNEL__ */
 
 
#endif /* _LINUX_PM_H */
#endif /* _LINUX_PM_H */
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.