Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
via-pmu.c File Reference
#include <stdarg.h>
#include <linux/mutex.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/sched.h>
#include <linux/miscdevice.h>
#include <linux/blkdev.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/poll.h>
#include <linux/adb.h>
#include <linux/pmu.h>
#include <linux/cuda.h>
#include <linux/module.h>
#include <linux/spinlock.h>
#include <linux/pm.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/device.h>
#include <linux/syscore_ops.h>
#include <linux/freezer.h>
#include <linux/syscalls.h>
#include <linux/suspend.h>
#include <linux/cpu.h>
#include <linux/compat.h>
#include <asm/prom.h>
#include <asm/machdep.h>
#include <asm/io.h>
#include <asm/pgtable.h>
#include <asm/sections.h>
#include <asm/irq.h>
#include <asm/pmac_feature.h>
#include <asm/pmac_pfunc.h>
#include <asm/pmac_low_i2c.h>
#include <asm/uaccess.h>
#include <asm/mmu_context.h>
#include <asm/cputable.h>
#include <asm/time.h>
#include <asm/backlight.h>
#include "via-pmu-event.h"

Go to the source code of this file.

Data Structures

struct  pmu_private
 
struct  pmu_private::rb_entry
 

Macros

#define PMU_MINOR   154
 
#define BATTERY_POLLING_COUNT   2
 
#define RS   0x200 /* skip between registers */
 
#define B   0 /* B-side data */
 
#define A   RS /* A-side data */
 
#define DIRB   (2*RS) /* B-side direction (1=output) */
 
#define DIRA   (3*RS) /* A-side direction (1=output) */
 
#define T1CL   (4*RS) /* Timer 1 ctr/latch (low 8 bits) */
 
#define T1CH   (5*RS) /* Timer 1 counter (high 8 bits) */
 
#define T1LL   (6*RS) /* Timer 1 latch (low 8 bits) */
 
#define T1LH   (7*RS) /* Timer 1 latch (high 8 bits) */
 
#define T2CL   (8*RS) /* Timer 2 ctr/latch (low 8 bits) */
 
#define T2CH   (9*RS) /* Timer 2 counter (high 8 bits) */
 
#define SR   (10*RS) /* Shift register */
 
#define ACR   (11*RS) /* Auxiliary control register */
 
#define PCR   (12*RS) /* Peripheral control register */
 
#define IFR   (13*RS) /* Interrupt flag register */
 
#define IER   (14*RS) /* Interrupt enable register */
 
#define ANH   (15*RS) /* A-side data, no handshake */
 
#define TACK   0x08 /* Transfer acknowledge (input) */
 
#define TREQ   0x10 /* Transfer request (output) */
 
#define SR_CTRL   0x1c /* Shift register control bits */
 
#define SR_EXT   0x0c /* Shift on external clock */
 
#define SR_OUT   0x10 /* Shift out if 1 */
 
#define IER_SET   0x80 /* set bits in IER */
 
#define IER_CLR   0 /* clear bits in IER */
 
#define SR_INT   0x04 /* Shift register full/empty */
 
#define CB2_INT   0x08
 
#define CB1_INT   0x10 /* transition on CB1 input */
 
#define RB_SIZE   0x10
 

Enumerations

enum  pmu_state {
  idle, sending, intack, reading,
  reading_intr, locked, idle, sending,
  intack, reading, reading_intr
}
 
enum  int_data_state { int_data_empty, int_data_fill, int_data_ready, int_data_flush }
 

Functions

void low_sleep_handler (void)
 
void enable_kernel_altivec (void)
 
void enable_kernel_fp (void)
 
int __init find_via_pmu (void)
 
 arch_initcall (via_pmu_start)
 
 device_initcall (via_pmu_dev_init)
 
int pmu_get_model (void)
 
int pmu_request (struct adb_request *req, void(*done)(struct adb_request *), int nbytes,...)
 
int pmu_queue_request (struct adb_request *req)
 
void pmu_poll (void)
 
void pmu_poll_adb (void)
 
void pmu_wait_complete (struct adb_request *req)
 
void pmu_suspend (void)
 
void pmu_resume (void)
 
void pmu_unlock (void)
 
void pmu_enable_irled (int on)
 
void pmu_restart (void)
 
void pmu_shutdown (void)
 
int pmu_present (void)
 
 device_initcall (pmu_device_init)
 
 EXPORT_SYMBOL (pmu_request)
 
 EXPORT_SYMBOL (pmu_queue_request)
 
 EXPORT_SYMBOL (pmu_poll)
 
 EXPORT_SYMBOL (pmu_poll_adb)
 
 EXPORT_SYMBOL (pmu_wait_complete)
 
 EXPORT_SYMBOL (pmu_suspend)
 
 EXPORT_SYMBOL (pmu_resume)
 
 EXPORT_SYMBOL (pmu_unlock)
 

Variables

int pmu_battery_count
 
int pmu_cur_battery
 
unsigned int pmu_power_flags = PMU_PWR_AC_PRESENT
 
struct pmu_battery_info pmu_batteries [PMU_MAX_BATTERIES]
 
int __fake_sleep
 
int asleep
 

Macro Definition Documentation

#define A   RS /* A-side data */

Definition at line 81 of file via-pmu.c.

#define ACR   (11*RS) /* Auxiliary control register */

Definition at line 91 of file via-pmu.c.

#define ANH   (15*RS) /* A-side data, no handshake */

Definition at line 95 of file via-pmu.c.

#define B   0 /* B-side data */

Definition at line 80 of file via-pmu.c.

#define BATTERY_POLLING_COUNT   2

Definition at line 73 of file via-pmu.c.

#define CB1_INT   0x10 /* transition on CB1 input */

Definition at line 111 of file via-pmu.c.

#define CB2_INT   0x08

Definition at line 110 of file via-pmu.c.

#define DIRA   (3*RS) /* A-side direction (1=output) */

Definition at line 83 of file via-pmu.c.

#define DIRB   (2*RS) /* B-side direction (1=output) */

Definition at line 82 of file via-pmu.c.

#define IER   (14*RS) /* Interrupt enable register */

Definition at line 94 of file via-pmu.c.

#define IER_CLR   0 /* clear bits in IER */

Definition at line 108 of file via-pmu.c.

#define IER_SET   0x80 /* set bits in IER */

Definition at line 107 of file via-pmu.c.

#define IFR   (13*RS) /* Interrupt flag register */

Definition at line 93 of file via-pmu.c.

#define PCR   (12*RS) /* Peripheral control register */

Definition at line 92 of file via-pmu.c.

#define PMU_MINOR   154

Definition at line 70 of file via-pmu.c.

#define RB_SIZE   0x10

Definition at line 2021 of file via-pmu.c.

#define RS   0x200 /* skip between registers */

Definition at line 79 of file via-pmu.c.

#define SR   (10*RS) /* Shift register */

Definition at line 90 of file via-pmu.c.

#define SR_CTRL   0x1c /* Shift register control bits */

Definition at line 102 of file via-pmu.c.

#define SR_EXT   0x0c /* Shift on external clock */

Definition at line 103 of file via-pmu.c.

#define SR_INT   0x04 /* Shift register full/empty */

Definition at line 109 of file via-pmu.c.

#define SR_OUT   0x10 /* Shift out if 1 */

Definition at line 104 of file via-pmu.c.

#define T1CH   (5*RS) /* Timer 1 counter (high 8 bits) */

Definition at line 85 of file via-pmu.c.

#define T1CL   (4*RS) /* Timer 1 ctr/latch (low 8 bits) */

Definition at line 84 of file via-pmu.c.

#define T1LH   (7*RS) /* Timer 1 latch (high 8 bits) */

Definition at line 87 of file via-pmu.c.

#define T1LL   (6*RS) /* Timer 1 latch (low 8 bits) */

Definition at line 86 of file via-pmu.c.

#define T2CH   (9*RS) /* Timer 2 counter (high 8 bits) */

Definition at line 89 of file via-pmu.c.

#define T2CL   (8*RS) /* Timer 2 ctr/latch (low 8 bits) */

Definition at line 88 of file via-pmu.c.

#define TACK   0x08 /* Transfer acknowledge (input) */

Definition at line 98 of file via-pmu.c.

#define TREQ   0x10 /* Transfer request (output) */

Definition at line 99 of file via-pmu.c.

Enumeration Type Documentation

Enumerator:
int_data_empty 
int_data_fill 
int_data_ready 
int_data_flush 

Definition at line 122 of file via-pmu.c.

enum pmu_state
Enumerator:
idle 
sending 
intack 
reading 
reading_intr 
locked 
idle 
sending 
intack 
reading 
reading_intr 

Definition at line 113 of file via-pmu.c.

Function Documentation

arch_initcall ( via_pmu_start  )
device_initcall ( via_pmu_dev_init  )
device_initcall ( pmu_device_init  )
void enable_kernel_altivec ( void  )
void enable_kernel_fp ( void  )

Definition at line 103 of file process.c.

EXPORT_SYMBOL ( pmu_request  )
EXPORT_SYMBOL ( pmu_queue_request  )
EXPORT_SYMBOL ( pmu_poll  )
EXPORT_SYMBOL ( pmu_poll_adb  )
EXPORT_SYMBOL ( pmu_wait_complete  )
EXPORT_SYMBOL ( pmu_suspend  )
EXPORT_SYMBOL ( pmu_resume  )
EXPORT_SYMBOL ( pmu_unlock  )
int __init find_via_pmu ( void  )

Definition at line 269 of file via-pmu.c.

void low_sleep_handler ( void  )
void pmu_enable_irled ( int  on)

Definition at line 1672 of file via-pmu.c.

int pmu_get_model ( void  )

Definition at line 585 of file via-pmu.c.

void pmu_poll ( void  )

Definition at line 1239 of file via-pmu.c.

void pmu_poll_adb ( void  )

Definition at line 1249 of file via-pmu.c.

int pmu_present ( void  )

Definition at line 1742 of file via-pmu.c.

int pmu_queue_request ( struct adb_request req)

Definition at line 1123 of file via-pmu.c.

int pmu_request ( struct adb_request req,
void(*)(struct adb_request *)  done,
int  nbytes,
  ... 
)

Definition at line 1097 of file via-pmu.c.

void pmu_restart ( void  )

Definition at line 1687 of file via-pmu.c.

void pmu_resume ( void  )

Definition at line 1309 of file via-pmu.c.

void pmu_shutdown ( void  )

Definition at line 1712 of file via-pmu.c.

void pmu_suspend ( void  )

Definition at line 1278 of file via-pmu.c.

void pmu_unlock ( void  )

Definition at line 1639 of file via-pmu.c.

void pmu_wait_complete ( struct adb_request req)

Definition at line 1264 of file via-pmu.c.

Variable Documentation

int __fake_sleep

Definition at line 173 of file via-pmu.c.

int asleep

Definition at line 174 of file via-pmu.c.

Definition at line 168 of file via-pmu.c.

int pmu_battery_count

Definition at line 165 of file via-pmu.c.

int pmu_cur_battery

Definition at line 166 of file via-pmu.c.

unsigned int pmu_power_flags = PMU_PWR_AC_PRESENT

Definition at line 167 of file via-pmu.c.