Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/upstream-linus
[linux-btrfs-devel.git] / drivers / staging / bcm / led_control.h
blob0711ac20f6fcc6cc36970709f267f4ab22fa44eb
1 #ifndef _LED_CONTROL_H
2 #define _LED_CONTROL_H
4 /*************************TYPE DEF**********************/
5 #define NUM_OF_LEDS 4
7 #define DSD_START_OFFSET 0x0200
8 #define EEPROM_VERSION_OFFSET 0x020E
9 #define EEPROM_HW_PARAM_POINTER_ADDRESS 0x0218
10 #define EEPROM_HW_PARAM_POINTER_ADDRRES_MAP5 0x0220
11 #define GPIO_SECTION_START_OFFSET 0x03
13 #define COMPATIBILITY_SECTION_LENGTH 42
14 #define COMPATIBILITY_SECTION_LENGTH_MAP5 84
17 #define EEPROM_MAP5_MAJORVERSION 5
18 #define EEPROM_MAP5_MINORVERSION 0
21 #define MAX_NUM_OF_BLINKS 10
22 #define NUM_OF_GPIO_PINS 16
24 #define DISABLE_GPIO_NUM 0xFF
25 #define EVENT_SIGNALED 1
27 #define MAX_FILE_NAME_BUFFER_SIZE 100
29 #define TURN_ON_LED(GPIO, index) do{ \
30 UINT gpio_val = GPIO; \
31 (Adapter->LEDInfo.LEDState[index].BitPolarity == 1) ? \
32 wrmaltWithLock(Adapter,BCM_GPIO_OUTPUT_SET_REG, &gpio_val ,sizeof(gpio_val)) : \
33 wrmaltWithLock(Adapter,BCM_GPIO_OUTPUT_CLR_REG, &gpio_val, sizeof(gpio_val)); \
34 }while(0);
36 #define TURN_OFF_LED(GPIO, index) do { \
37 UINT gpio_val = GPIO; \
38 (Adapter->LEDInfo.LEDState[index].BitPolarity == 1) ? \
39 wrmaltWithLock(Adapter,BCM_GPIO_OUTPUT_CLR_REG,&gpio_val ,sizeof(gpio_val)) : \
40 wrmaltWithLock(Adapter,BCM_GPIO_OUTPUT_SET_REG,&gpio_val ,sizeof(gpio_val)); \
41 }while(0);
43 #define B_ULONG32 unsigned long
45 /*******************************************************/
48 typedef enum _LEDColors{
49 RED_LED = 1,
50 BLUE_LED = 2,
51 YELLOW_LED = 3,
52 GREEN_LED = 4
53 } LEDColors; /*Enumerated values of different LED types*/
55 typedef enum LedEvents {
56 SHUTDOWN_EXIT = 0x00,
57 DRIVER_INIT = 0x1,
58 FW_DOWNLOAD = 0x2,
59 FW_DOWNLOAD_DONE = 0x4,
60 NO_NETWORK_ENTRY = 0x8,
61 NORMAL_OPERATION = 0x10,
62 LOWPOWER_MODE_ENTER = 0x20,
63 IDLEMODE_CONTINUE = 0x40,
64 IDLEMODE_EXIT = 0x80,
65 LED_THREAD_INACTIVE = 0x100, //Makes the LED thread Inactivce. It wil be equivallent to putting the thread on hold.
66 LED_THREAD_ACTIVE = 0x200 //Makes the LED Thread Active back.
67 } LedEventInfo_t; /*Enumerated values of different driver states*/
69 #define DRIVER_HALT 0xff
72 /*Structure which stores the information of different LED types
73 * and corresponding LED state information of driver states*/
74 typedef struct LedStateInfo_t
76 UCHAR LED_Type; /* specify GPIO number - use 0xFF if not used */
77 UCHAR LED_On_State; /* Bits set or reset for different states */
78 UCHAR LED_Blink_State; /* Bits set or reset for blinking LEDs for different states */
79 UCHAR GPIO_Num;
80 UCHAR BitPolarity; /*To represent whether H/W is normal polarity or reverse
81 polarity*/
82 }LEDStateInfo, *pLEDStateInfo;
85 typedef struct _LED_INFO_STRUCT
87 LEDStateInfo LEDState[NUM_OF_LEDS];
88 BOOLEAN bIdleMode_tx_from_host; /*Variable to notify whether driver came out
89 from idlemode due to Host or target*/
90 BOOLEAN bIdle_led_off;
91 wait_queue_head_t notify_led_event;
92 wait_queue_head_t idleModeSyncEvent;
93 struct task_struct *led_cntrl_threadid;
94 int led_thread_running;
95 BOOLEAN bLedInitDone;
97 } LED_INFO_STRUCT, *PLED_INFO_STRUCT;
98 //LED Thread state.
99 #define BCM_LED_THREAD_DISABLED 0 //LED Thread is not running.
100 #define BCM_LED_THREAD_RUNNING_ACTIVELY 1 //LED thread is running.
101 #define BCM_LED_THREAD_RUNNING_INACTIVELY 2 //LED thread has been put on hold
105 #endif