Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
menelaus.c File Reference
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/sched.h>
#include <linux/mutex.h>
#include <linux/workqueue.h>
#include <linux/delay.h>
#include <linux/rtc.h>
#include <linux/bcd.h>
#include <linux/slab.h>
#include <asm/mach/irq.h>
#include <asm/gpio.h>
#include <plat/menelaus.h>

Go to the source code of this file.

Data Structures

struct  menelaus_chip
 
struct  menelaus_vtg
 
struct  menelaus_vtg_value
 

Macros

#define DRIVER_NAME   "menelaus"
 
#define MENELAUS_I2C_ADDRESS   0x72
 
#define MENELAUS_REV   0x01
 
#define MENELAUS_VCORE_CTRL1   0x02
 
#define MENELAUS_VCORE_CTRL2   0x03
 
#define MENELAUS_VCORE_CTRL3   0x04
 
#define MENELAUS_VCORE_CTRL4   0x05
 
#define MENELAUS_VCORE_CTRL5   0x06
 
#define MENELAUS_DCDC_CTRL1   0x07
 
#define MENELAUS_DCDC_CTRL2   0x08
 
#define MENELAUS_DCDC_CTRL3   0x09
 
#define MENELAUS_LDO_CTRL1   0x0A
 
#define MENELAUS_LDO_CTRL2   0x0B
 
#define MENELAUS_LDO_CTRL3   0x0C
 
#define MENELAUS_LDO_CTRL4   0x0D
 
#define MENELAUS_LDO_CTRL5   0x0E
 
#define MENELAUS_LDO_CTRL6   0x0F
 
#define MENELAUS_LDO_CTRL7   0x10
 
#define MENELAUS_LDO_CTRL8   0x11
 
#define MENELAUS_SLEEP_CTRL1   0x12
 
#define MENELAUS_SLEEP_CTRL2   0x13
 
#define MENELAUS_DEVICE_OFF   0x14
 
#define MENELAUS_OSC_CTRL   0x15
 
#define MENELAUS_DETECT_CTRL   0x16
 
#define MENELAUS_INT_MASK1   0x17
 
#define MENELAUS_INT_MASK2   0x18
 
#define MENELAUS_INT_STATUS1   0x19
 
#define MENELAUS_INT_STATUS2   0x1A
 
#define MENELAUS_INT_ACK1   0x1B
 
#define MENELAUS_INT_ACK2   0x1C
 
#define MENELAUS_GPIO_CTRL   0x1D
 
#define MENELAUS_GPIO_IN   0x1E
 
#define MENELAUS_GPIO_OUT   0x1F
 
#define MENELAUS_BBSMS   0x20
 
#define MENELAUS_RTC_CTRL   0x21
 
#define MENELAUS_RTC_UPDATE   0x22
 
#define MENELAUS_RTC_SEC   0x23
 
#define MENELAUS_RTC_MIN   0x24
 
#define MENELAUS_RTC_HR   0x25
 
#define MENELAUS_RTC_DAY   0x26
 
#define MENELAUS_RTC_MON   0x27
 
#define MENELAUS_RTC_YR   0x28
 
#define MENELAUS_RTC_WKDAY   0x29
 
#define MENELAUS_RTC_AL_SEC   0x2A
 
#define MENELAUS_RTC_AL_MIN   0x2B
 
#define MENELAUS_RTC_AL_HR   0x2C
 
#define MENELAUS_RTC_AL_DAY   0x2D
 
#define MENELAUS_RTC_AL_MON   0x2E
 
#define MENELAUS_RTC_AL_YR   0x2F
 
#define MENELAUS_RTC_COMP_MSB   0x30
 
#define MENELAUS_RTC_COMP_LSB   0x31
 
#define MENELAUS_S1_PULL_EN   0x32
 
#define MENELAUS_S1_PULL_DIR   0x33
 
#define MENELAUS_S2_PULL_EN   0x34
 
#define MENELAUS_S2_PULL_DIR   0x35
 
#define MENELAUS_MCT_CTRL1   0x36
 
#define MENELAUS_MCT_CTRL2   0x37
 
#define MENELAUS_MCT_CTRL3   0x38
 
#define MENELAUS_MCT_PIN_ST   0x39
 
#define MENELAUS_DEBOUNCE1   0x3A
 
#define IH_MENELAUS_IRQS   12
 
#define MENELAUS_MMC_S1CD_IRQ   0 /* MMC slot 1 card change */
 
#define MENELAUS_MMC_S2CD_IRQ   1 /* MMC slot 2 card change */
 
#define MENELAUS_MMC_S1D1_IRQ   2 /* MMC DAT1 low in slot 1 */
 
#define MENELAUS_MMC_S2D1_IRQ   3 /* MMC DAT1 low in slot 2 */
 
#define MENELAUS_LOWBAT_IRQ   4 /* Low battery */
 
#define MENELAUS_HOTDIE_IRQ   5 /* Hot die detect */
 
#define MENELAUS_UVLO_IRQ   6 /* UVLO detect */
 
#define MENELAUS_TSHUT_IRQ   7 /* Thermal shutdown */
 
#define MENELAUS_RTCTMR_IRQ   8 /* RTC timer */
 
#define MENELAUS_RTCALM_IRQ   9 /* RTC alarm */
 
#define MENELAUS_RTCERR_IRQ   10 /* RTC error */
 
#define MENELAUS_PSHBTN_IRQ   11 /* Push button */
 
#define MENELAUS_RESERVED12_IRQ   12 /* Reserved */
 
#define MENELAUS_RESERVED13_IRQ   13 /* Reserved */
 
#define MENELAUS_RESERVED14_IRQ   14 /* Reserved */
 
#define MENELAUS_RESERVED15_IRQ   15 /* Reserved */
 
#define VCORE_CTRL1_BYP_COMP   (1 << 5)
 
#define VCORE_CTRL1_HW_NSW   (1 << 7)
 
#define GPIO_CTRL_SLOTSELEN   (1 << 5)
 
#define GPIO_CTRL_SLPCTLEN   (1 << 6)
 
#define GPIO1_DIR_INPUT   (1 << 0)
 
#define GPIO2_DIR_INPUT   (1 << 1)
 
#define GPIO3_DIR_INPUT   (1 << 2)
 
#define MCT_CTRL1_S1_CMD_OD   (1 << 2)
 
#define MCT_CTRL1_S2_CMD_OD   (1 << 3)
 
#define MCT_CTRL2_VS2_SEL_D0   (1 << 0)
 
#define MCT_CTRL2_VS2_SEL_D1   (1 << 1)
 
#define MCT_CTRL2_S1CD_BUFEN   (1 << 4)
 
#define MCT_CTRL2_S2CD_BUFEN   (1 << 5)
 
#define MCT_CTRL2_S1CD_DBEN   (1 << 6)
 
#define MCT_CTRL2_S2CD_BEN   (1 << 7)
 
#define MCT_CTRL3_SLOT1_EN   (1 << 0)
 
#define MCT_CTRL3_SLOT2_EN   (1 << 1)
 
#define MCT_CTRL3_S1_AUTO_EN   (1 << 2)
 
#define MCT_CTRL3_S2_AUTO_EN   (1 << 3)
 
#define MCT_PIN_ST_S1_CD_ST   (1 << 0)
 
#define MCT_PIN_ST_S2_CD_ST   (1 << 1)
 

Functions

int menelaus_set_mmc_opendrain (int slot, int enable)
 
 EXPORT_SYMBOL (menelaus_set_mmc_opendrain)
 
int menelaus_set_slot_sel (int enable)
 
 EXPORT_SYMBOL (menelaus_set_slot_sel)
 
int menelaus_set_mmc_slot (int slot, int enable, int power, int cd_en)
 
 EXPORT_SYMBOL (menelaus_set_mmc_slot)
 
int menelaus_register_mmc_callback (void(*callback)(void *data, u8 card_mask), void *data)
 
 EXPORT_SYMBOL (menelaus_register_mmc_callback)
 
void menelaus_unregister_mmc_callback (void)
 
 EXPORT_SYMBOL (menelaus_unregister_mmc_callback)
 
int menelaus_set_vcore_sw (unsigned int mV)
 
int menelaus_set_vcore_hw (unsigned int roof_mV, unsigned int floor_mV)
 
int menelaus_set_vmem (unsigned int mV)
 
 EXPORT_SYMBOL (menelaus_set_vmem)
 
int menelaus_set_vio (unsigned int mV)
 
 EXPORT_SYMBOL (menelaus_set_vio)
 
int menelaus_set_vdcdc (int dcdc, unsigned int mV)
 
int menelaus_set_vmmc (unsigned int mV)
 
 EXPORT_SYMBOL (menelaus_set_vmmc)
 
int menelaus_set_vaux (unsigned int mV)
 
 EXPORT_SYMBOL (menelaus_set_vaux)
 
int menelaus_get_slot_pin_states (void)
 
 EXPORT_SYMBOL (menelaus_get_slot_pin_states)
 
int menelaus_set_regulator_sleep (int enable, u32 val)
 
 MODULE_DEVICE_TABLE (i2c, menelaus_id)
 
 MODULE_AUTHOR ("Texas Instruments, Inc. (and others)")
 
 MODULE_DESCRIPTION ("I2C interface for Menelaus.")
 
 MODULE_LICENSE ("GPL")
 
 module_init (menelaus_init)
 
 module_exit (menelaus_exit)
 

Macro Definition Documentation

#define DRIVER_NAME   "menelaus"

Definition at line 50 of file menelaus.c.

#define GPIO1_DIR_INPUT   (1 << 0)

Definition at line 138 of file menelaus.c.

#define GPIO2_DIR_INPUT   (1 << 1)

Definition at line 139 of file menelaus.c.

#define GPIO3_DIR_INPUT   (1 << 2)

Definition at line 140 of file menelaus.c.

#define GPIO_CTRL_SLOTSELEN   (1 << 5)

Definition at line 136 of file menelaus.c.

#define GPIO_CTRL_SLPCTLEN   (1 << 6)

Definition at line 137 of file menelaus.c.

#define IH_MENELAUS_IRQS   12

Definition at line 113 of file menelaus.c.

#define MCT_CTRL1_S1_CMD_OD   (1 << 2)

Definition at line 143 of file menelaus.c.

#define MCT_CTRL1_S2_CMD_OD   (1 << 3)

Definition at line 144 of file menelaus.c.

#define MCT_CTRL2_S1CD_BUFEN   (1 << 4)

Definition at line 149 of file menelaus.c.

#define MCT_CTRL2_S1CD_DBEN   (1 << 6)

Definition at line 151 of file menelaus.c.

#define MCT_CTRL2_S2CD_BEN   (1 << 7)

Definition at line 152 of file menelaus.c.

#define MCT_CTRL2_S2CD_BUFEN   (1 << 5)

Definition at line 150 of file menelaus.c.

#define MCT_CTRL2_VS2_SEL_D0   (1 << 0)

Definition at line 147 of file menelaus.c.

#define MCT_CTRL2_VS2_SEL_D1   (1 << 1)

Definition at line 148 of file menelaus.c.

#define MCT_CTRL3_S1_AUTO_EN   (1 << 2)

Definition at line 157 of file menelaus.c.

#define MCT_CTRL3_S2_AUTO_EN   (1 << 3)

Definition at line 158 of file menelaus.c.

#define MCT_CTRL3_SLOT1_EN   (1 << 0)

Definition at line 155 of file menelaus.c.

#define MCT_CTRL3_SLOT2_EN   (1 << 1)

Definition at line 156 of file menelaus.c.

#define MCT_PIN_ST_S1_CD_ST   (1 << 0)

Definition at line 161 of file menelaus.c.

#define MCT_PIN_ST_S2_CD_ST   (1 << 1)

Definition at line 162 of file menelaus.c.

#define MENELAUS_BBSMS   0x20

Definition at line 85 of file menelaus.c.

#define MENELAUS_DCDC_CTRL1   0x07

Definition at line 60 of file menelaus.c.

#define MENELAUS_DCDC_CTRL2   0x08

Definition at line 61 of file menelaus.c.

#define MENELAUS_DCDC_CTRL3   0x09

Definition at line 62 of file menelaus.c.

#define MENELAUS_DEBOUNCE1   0x3A

Definition at line 111 of file menelaus.c.

#define MENELAUS_DETECT_CTRL   0x16

Definition at line 75 of file menelaus.c.

#define MENELAUS_DEVICE_OFF   0x14

Definition at line 73 of file menelaus.c.

#define MENELAUS_GPIO_CTRL   0x1D

Definition at line 82 of file menelaus.c.

#define MENELAUS_GPIO_IN   0x1E

Definition at line 83 of file menelaus.c.

#define MENELAUS_GPIO_OUT   0x1F

Definition at line 84 of file menelaus.c.

#define MENELAUS_HOTDIE_IRQ   5 /* Hot die detect */

Definition at line 119 of file menelaus.c.

#define MENELAUS_I2C_ADDRESS   0x72

Definition at line 52 of file menelaus.c.

#define MENELAUS_INT_ACK1   0x1B

Definition at line 80 of file menelaus.c.

#define MENELAUS_INT_ACK2   0x1C

Definition at line 81 of file menelaus.c.

#define MENELAUS_INT_MASK1   0x17

Definition at line 76 of file menelaus.c.

#define MENELAUS_INT_MASK2   0x18

Definition at line 77 of file menelaus.c.

#define MENELAUS_INT_STATUS1   0x19

Definition at line 78 of file menelaus.c.

#define MENELAUS_INT_STATUS2   0x1A

Definition at line 79 of file menelaus.c.

#define MENELAUS_LDO_CTRL1   0x0A

Definition at line 63 of file menelaus.c.

#define MENELAUS_LDO_CTRL2   0x0B

Definition at line 64 of file menelaus.c.

#define MENELAUS_LDO_CTRL3   0x0C

Definition at line 65 of file menelaus.c.

#define MENELAUS_LDO_CTRL4   0x0D

Definition at line 66 of file menelaus.c.

#define MENELAUS_LDO_CTRL5   0x0E

Definition at line 67 of file menelaus.c.

#define MENELAUS_LDO_CTRL6   0x0F

Definition at line 68 of file menelaus.c.

#define MENELAUS_LDO_CTRL7   0x10

Definition at line 69 of file menelaus.c.

#define MENELAUS_LDO_CTRL8   0x11

Definition at line 70 of file menelaus.c.

#define MENELAUS_LOWBAT_IRQ   4 /* Low battery */

Definition at line 118 of file menelaus.c.

#define MENELAUS_MCT_CTRL1   0x36

Definition at line 107 of file menelaus.c.

#define MENELAUS_MCT_CTRL2   0x37

Definition at line 108 of file menelaus.c.

#define MENELAUS_MCT_CTRL3   0x38

Definition at line 109 of file menelaus.c.

#define MENELAUS_MCT_PIN_ST   0x39

Definition at line 110 of file menelaus.c.

#define MENELAUS_MMC_S1CD_IRQ   0 /* MMC slot 1 card change */

Definition at line 114 of file menelaus.c.

#define MENELAUS_MMC_S1D1_IRQ   2 /* MMC DAT1 low in slot 1 */

Definition at line 116 of file menelaus.c.

#define MENELAUS_MMC_S2CD_IRQ   1 /* MMC slot 2 card change */

Definition at line 115 of file menelaus.c.

#define MENELAUS_MMC_S2D1_IRQ   3 /* MMC DAT1 low in slot 2 */

Definition at line 117 of file menelaus.c.

#define MENELAUS_OSC_CTRL   0x15

Definition at line 74 of file menelaus.c.

#define MENELAUS_PSHBTN_IRQ   11 /* Push button */

Definition at line 125 of file menelaus.c.

#define MENELAUS_RESERVED12_IRQ   12 /* Reserved */

Definition at line 126 of file menelaus.c.

#define MENELAUS_RESERVED13_IRQ   13 /* Reserved */

Definition at line 127 of file menelaus.c.

#define MENELAUS_RESERVED14_IRQ   14 /* Reserved */

Definition at line 128 of file menelaus.c.

#define MENELAUS_RESERVED15_IRQ   15 /* Reserved */

Definition at line 129 of file menelaus.c.

#define MENELAUS_REV   0x01

Definition at line 54 of file menelaus.c.

#define MENELAUS_RTC_AL_DAY   0x2D

Definition at line 98 of file menelaus.c.

#define MENELAUS_RTC_AL_HR   0x2C

Definition at line 97 of file menelaus.c.

#define MENELAUS_RTC_AL_MIN   0x2B

Definition at line 96 of file menelaus.c.

#define MENELAUS_RTC_AL_MON   0x2E

Definition at line 99 of file menelaus.c.

#define MENELAUS_RTC_AL_SEC   0x2A

Definition at line 95 of file menelaus.c.

#define MENELAUS_RTC_AL_YR   0x2F

Definition at line 100 of file menelaus.c.

#define MENELAUS_RTC_COMP_LSB   0x31

Definition at line 102 of file menelaus.c.

#define MENELAUS_RTC_COMP_MSB   0x30

Definition at line 101 of file menelaus.c.

#define MENELAUS_RTC_CTRL   0x21

Definition at line 86 of file menelaus.c.

#define MENELAUS_RTC_DAY   0x26

Definition at line 91 of file menelaus.c.

#define MENELAUS_RTC_HR   0x25

Definition at line 90 of file menelaus.c.

#define MENELAUS_RTC_MIN   0x24

Definition at line 89 of file menelaus.c.

#define MENELAUS_RTC_MON   0x27

Definition at line 92 of file menelaus.c.

#define MENELAUS_RTC_SEC   0x23

Definition at line 88 of file menelaus.c.

#define MENELAUS_RTC_UPDATE   0x22

Definition at line 87 of file menelaus.c.

#define MENELAUS_RTC_WKDAY   0x29

Definition at line 94 of file menelaus.c.

#define MENELAUS_RTC_YR   0x28

Definition at line 93 of file menelaus.c.

#define MENELAUS_RTCALM_IRQ   9 /* RTC alarm */

Definition at line 123 of file menelaus.c.

#define MENELAUS_RTCERR_IRQ   10 /* RTC error */

Definition at line 124 of file menelaus.c.

#define MENELAUS_RTCTMR_IRQ   8 /* RTC timer */

Definition at line 122 of file menelaus.c.

#define MENELAUS_S1_PULL_DIR   0x33

Definition at line 104 of file menelaus.c.

#define MENELAUS_S1_PULL_EN   0x32

Definition at line 103 of file menelaus.c.

#define MENELAUS_S2_PULL_DIR   0x35

Definition at line 106 of file menelaus.c.

#define MENELAUS_S2_PULL_EN   0x34

Definition at line 105 of file menelaus.c.

#define MENELAUS_SLEEP_CTRL1   0x12

Definition at line 71 of file menelaus.c.

#define MENELAUS_SLEEP_CTRL2   0x13

Definition at line 72 of file menelaus.c.

#define MENELAUS_TSHUT_IRQ   7 /* Thermal shutdown */

Definition at line 121 of file menelaus.c.

#define MENELAUS_UVLO_IRQ   6 /* UVLO detect */

Definition at line 120 of file menelaus.c.

#define MENELAUS_VCORE_CTRL1   0x02

Definition at line 55 of file menelaus.c.

#define MENELAUS_VCORE_CTRL2   0x03

Definition at line 56 of file menelaus.c.

#define MENELAUS_VCORE_CTRL3   0x04

Definition at line 57 of file menelaus.c.

#define MENELAUS_VCORE_CTRL4   0x05

Definition at line 58 of file menelaus.c.

#define MENELAUS_VCORE_CTRL5   0x06

Definition at line 59 of file menelaus.c.

#define VCORE_CTRL1_BYP_COMP   (1 << 5)

Definition at line 132 of file menelaus.c.

#define VCORE_CTRL1_HW_NSW   (1 << 7)

Definition at line 133 of file menelaus.c.

Function Documentation

EXPORT_SYMBOL ( menelaus_set_mmc_opendrain  )
EXPORT_SYMBOL ( menelaus_set_slot_sel  )
EXPORT_SYMBOL ( menelaus_set_mmc_slot  )
EXPORT_SYMBOL ( menelaus_register_mmc_callback  )
EXPORT_SYMBOL ( menelaus_unregister_mmc_callback  )
EXPORT_SYMBOL ( menelaus_set_vmem  )
EXPORT_SYMBOL ( menelaus_set_vio  )
EXPORT_SYMBOL ( menelaus_set_vmmc  )
EXPORT_SYMBOL ( menelaus_set_vaux  )
EXPORT_SYMBOL ( menelaus_get_slot_pin_states  )
int menelaus_get_slot_pin_states ( void  )

Definition at line 764 of file menelaus.c.

int menelaus_register_mmc_callback ( void(*)(void *data, u8 card_mask)  callback,
void data 
)

Definition at line 411 of file menelaus.c.

int menelaus_set_mmc_opendrain ( int  slot,
int  enable 
)

Definition at line 298 of file menelaus.c.

int menelaus_set_mmc_slot ( int  slot,
int  enable,
int  power,
int  cd_en 
)

Definition at line 349 of file menelaus.c.

int menelaus_set_regulator_sleep ( int  enable,
u32  val 
)

Definition at line 770 of file menelaus.c.

int menelaus_set_slot_sel ( int  enable)

Definition at line 329 of file menelaus.c.

int menelaus_set_vaux ( unsigned int  mV)

Definition at line 750 of file menelaus.c.

int menelaus_set_vcore_hw ( unsigned int  roof_mV,
unsigned int  floor_mV 
)

Definition at line 561 of file menelaus.c.

int menelaus_set_vcore_sw ( unsigned int  mV)

Definition at line 538 of file menelaus.c.

int menelaus_set_vdcdc ( int  dcdc,
unsigned int  mV 
)

Definition at line 683 of file menelaus.c.

int menelaus_set_vio ( unsigned int  mV)

Definition at line 642 of file menelaus.c.

int menelaus_set_vmem ( unsigned int  mV)

Definition at line 613 of file menelaus.c.

int menelaus_set_vmmc ( unsigned int  mV)

Definition at line 720 of file menelaus.c.

void menelaus_unregister_mmc_callback ( void  )

Definition at line 437 of file menelaus.c.

MODULE_AUTHOR ( "Texas  Instruments,
Inc.(and others)"   
)
MODULE_DESCRIPTION ( "I2C interface for Menelaus."  )
MODULE_DEVICE_TABLE ( i2c  ,
menelaus_id   
)
module_exit ( menelaus_exit  )
module_init ( menelaus_init  )
MODULE_LICENSE ( "GPL"  )