Back to home page

OSCL-LXR

 
 

    


0001 /* linux/mfd/tps6507x.h
0002  *
0003  * Functions to access TPS65070 power management chip.
0004  *
0005  * Copyright (c) 2009 RidgeRun (todd.fischer@ridgerun.com)
0006  *
0007  *
0008  *  For licencing details see kernel-base/COPYING
0009  */
0010 
0011 #ifndef __LINUX_MFD_TPS6507X_H
0012 #define __LINUX_MFD_TPS6507X_H
0013 
0014 /*
0015  * ----------------------------------------------------------------------------
0016  * Registers, all 8 bits
0017  * ----------------------------------------------------------------------------
0018  */
0019 
0020 
0021 /* Register definitions */
0022 #define TPS6507X_REG_PPATH1         0X01
0023 #define TPS6507X_CHG_USB            BIT(7)
0024 #define TPS6507X_CHG_AC             BIT(6)
0025 #define TPS6507X_CHG_USB_PW_ENABLE      BIT(5)
0026 #define TPS6507X_CHG_AC_PW_ENABLE       BIT(4)
0027 #define TPS6507X_CHG_AC_CURRENT         BIT(2)
0028 #define TPS6507X_CHG_USB_CURRENT        BIT(0)
0029 
0030 #define TPS6507X_REG_INT            0X02
0031 #define TPS6507X_REG_MASK_AC_USB        BIT(7)
0032 #define TPS6507X_REG_MASK_TSC           BIT(6)
0033 #define TPS6507X_REG_MASK_PB_IN         BIT(5)
0034 #define TPS6507X_REG_TSC_INT            BIT(3)
0035 #define TPS6507X_REG_PB_IN_INT          BIT(2)
0036 #define TPS6507X_REG_AC_USB_APPLIED     BIT(1)
0037 #define TPS6507X_REG_AC_USB_REMOVED     BIT(0)
0038 
0039 #define TPS6507X_REG_CHGCONFIG0         0X03
0040 
0041 #define TPS6507X_REG_CHGCONFIG1         0X04
0042 #define TPS6507X_CON_CTRL1_DCDC1_ENABLE     BIT(4)
0043 #define TPS6507X_CON_CTRL1_DCDC2_ENABLE     BIT(3)
0044 #define TPS6507X_CON_CTRL1_DCDC3_ENABLE     BIT(2)
0045 #define TPS6507X_CON_CTRL1_LDO1_ENABLE      BIT(1)
0046 #define TPS6507X_CON_CTRL1_LDO2_ENABLE      BIT(0)
0047 
0048 #define TPS6507X_REG_CHGCONFIG2         0X05
0049 
0050 #define TPS6507X_REG_CHGCONFIG3         0X06
0051 
0052 #define TPS6507X_REG_ADCONFIG           0X07
0053 #define TPS6507X_ADCONFIG_AD_ENABLE     BIT(7)
0054 #define TPS6507X_ADCONFIG_START_CONVERSION  BIT(6)
0055 #define TPS6507X_ADCONFIG_CONVERSION_DONE   BIT(5)
0056 #define TPS6507X_ADCONFIG_VREF_ENABLE       BIT(4)
0057 #define TPS6507X_ADCONFIG_INPUT_AD_IN1      0
0058 #define TPS6507X_ADCONFIG_INPUT_AD_IN2      1
0059 #define TPS6507X_ADCONFIG_INPUT_AD_IN3      2
0060 #define TPS6507X_ADCONFIG_INPUT_AD_IN4      3
0061 #define TPS6507X_ADCONFIG_INPUT_TS_PIN      4
0062 #define TPS6507X_ADCONFIG_INPUT_BAT_CURRENT 5
0063 #define TPS6507X_ADCONFIG_INPUT_AC_VOLTAGE  6
0064 #define TPS6507X_ADCONFIG_INPUT_SYS_VOLTAGE 7
0065 #define TPS6507X_ADCONFIG_INPUT_CHARGER_VOLTAGE 8
0066 #define TPS6507X_ADCONFIG_INPUT_BAT_VOLTAGE 9
0067 #define TPS6507X_ADCONFIG_INPUT_THRESHOLD_VOLTAGE 10
0068 #define TPS6507X_ADCONFIG_INPUT_ISET1_VOLTAGE   11
0069 #define TPS6507X_ADCONFIG_INPUT_ISET2_VOLTAGE   12
0070 #define TPS6507X_ADCONFIG_INPUT_REAL_TSC    14
0071 #define TPS6507X_ADCONFIG_INPUT_TSC     15
0072 
0073 #define TPS6507X_REG_TSCMODE            0X08
0074 #define TPS6507X_TSCMODE_X_POSITION     0
0075 #define TPS6507X_TSCMODE_Y_POSITION     1
0076 #define TPS6507X_TSCMODE_PRESSURE       2
0077 #define TPS6507X_TSCMODE_X_PLATE        3
0078 #define TPS6507X_TSCMODE_Y_PLATE        4
0079 #define TPS6507X_TSCMODE_STANDBY        5
0080 #define TPS6507X_TSCMODE_ADC_INPUT      6
0081 #define TPS6507X_TSCMODE_DISABLE        7
0082 
0083 #define TPS6507X_REG_ADRESULT_1         0X09
0084 
0085 #define TPS6507X_REG_ADRESULT_2         0X0A
0086 #define TPS6507X_REG_ADRESULT_2_MASK        (BIT(1) | BIT(0))
0087 
0088 #define TPS6507X_REG_PGOOD          0X0B
0089 
0090 #define TPS6507X_REG_PGOODMASK          0X0C
0091 
0092 #define TPS6507X_REG_CON_CTRL1          0X0D
0093 #define TPS6507X_CON_CTRL1_DCDC1_ENABLE     BIT(4)
0094 #define TPS6507X_CON_CTRL1_DCDC2_ENABLE     BIT(3)
0095 #define TPS6507X_CON_CTRL1_DCDC3_ENABLE     BIT(2)
0096 #define TPS6507X_CON_CTRL1_LDO1_ENABLE      BIT(1)
0097 #define TPS6507X_CON_CTRL1_LDO2_ENABLE      BIT(0)
0098 
0099 #define TPS6507X_REG_CON_CTRL2          0X0E
0100 
0101 #define TPS6507X_REG_CON_CTRL3          0X0F
0102 
0103 #define TPS6507X_REG_DEFDCDC1           0X10
0104 #define TPS6507X_DEFDCDC1_DCDC1_EXT_ADJ_EN  BIT(7)
0105 #define TPS6507X_DEFDCDC1_DCDC1_MASK        0X3F
0106 
0107 #define TPS6507X_REG_DEFDCDC2_LOW       0X11
0108 #define TPS6507X_DEFDCDC2_LOW_DCDC2_MASK    0X3F
0109 
0110 #define TPS6507X_REG_DEFDCDC2_HIGH      0X12
0111 #define TPS6507X_DEFDCDC2_HIGH_DCDC2_MASK   0X3F
0112 
0113 #define TPS6507X_REG_DEFDCDC3_LOW       0X13
0114 #define TPS6507X_DEFDCDC3_LOW_DCDC3_MASK    0X3F
0115 
0116 #define TPS6507X_REG_DEFDCDC3_HIGH      0X14
0117 #define TPS6507X_DEFDCDC3_HIGH_DCDC3_MASK   0X3F
0118 
0119 #define TPS6507X_REG_DEFSLEW            0X15
0120 
0121 #define TPS6507X_REG_LDO_CTRL1          0X16
0122 #define TPS6507X_REG_LDO_CTRL1_LDO1_MASK    0X0F
0123 
0124 #define TPS6507X_REG_DEFLDO2            0X17
0125 #define TPS6507X_REG_DEFLDO2_LDO2_MASK      0X3F
0126 
0127 #define TPS6507X_REG_WLED_CTRL1         0X18
0128 
0129 #define TPS6507X_REG_WLED_CTRL2         0X19
0130 
0131 /* VDCDC MASK */
0132 #define TPS6507X_DEFDCDCX_DCDC_MASK     0X3F
0133 
0134 #define TPS6507X_MAX_REGISTER           0X19
0135 
0136 /**
0137  * struct tps6507x_board - packages regulator and touchscreen init data
0138  * @tps6507x_regulator_data: regulator initialization values
0139  *
0140  * Board data may be used to initialize regulator and touchscreen.
0141  */
0142 
0143 struct tps6507x_board {
0144     struct regulator_init_data *tps6507x_pmic_init_data;
0145     struct touchscreen_init_data *tps6507x_ts_init_data;
0146 };
0147 
0148 /**
0149  * struct tps6507x_dev - tps6507x sub-driver chip access routines
0150  * @read_dev() - I2C register read function
0151  * @write_dev() - I2C register write function
0152  *
0153  * Device data may be used to access the TPS6507x chip
0154  */
0155 
0156 struct tps6507x_dev {
0157     struct device *dev;
0158     struct i2c_client *i2c_client;
0159     int (*read_dev)(struct tps6507x_dev *tps6507x, char reg, int size,
0160             void *dest);
0161     int (*write_dev)(struct tps6507x_dev *tps6507x, char reg, int size,
0162              void *src);
0163 
0164     /* Client devices */
0165     struct tps6507x_pmic *pmic;
0166 };
0167 
0168 #endif /*  __LINUX_MFD_TPS6507X_H */