blob: 816b899a5769689a195e562981b4bf6273dc1cfb [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/*******************************************************************************
2 * Copyright (C) 2016, ZIXC Corporation.
3 *
4 * File Name: drvs_led.h
5 * File Mark:
6 * Description:
7 * Others:
8 * Version: V1.0
9 * Author: yuxiang
10 * Date: 2014-07-07
11 * History 1:
12 * Date:
13 * Version:
14 * Author:
15 * Modification:
16 * History 2:
17 ********************************************************************************/
18
19#ifndef _DRVS_LED_H
20#define _DRVS_LED_H
21#include "board.h"
22
23/****************************************************************************
24* Include files
25****************************************************************************/
26
27/****************************************************************************
28* Macros
29****************************************************************************/
30
31#include <linux/types.h>
32
33
34/*00h*/
35
36/*03h*/
37
38/****************************************************************************
39* Types
40****************************************************************************/
41
42typedef enum
43{
44 /* 0 ~ -29: commom */
45 DRV_SUCCESS = 0, /* successed */
46 DRV_ERROR = -1, /* failed */
47 DRV_ERR_INVALID_IOCTL_CMD = -2, /* no this control command branch */
48 DRV_ERR_NOT_SUPPORTED = -3, /* this function hasn't been supported */
49 DRV_ERR_INVALID_PARAM = -4, /* the input parameter is invalid */
50 DRV_ERR_MEM_ALLOC = -5, /* failed to malloc memory */
51 DRV_ERR_HISR_CREATE_FAIL = -6, /* failed to create hisr */
52 DRV_ERR_TIMEOUT = -7, /* timeout for a block waitting operation */
53 DRV_ERR_BUSY = -8, /* busy now to do the request operation */
54 DRV_ERR_NOT_OPENED = -9, /* the device to operate hasn't been opened yet */
55 DRV_ERR_OPEN_TIMES = -10, /* try to open a device which has been opened already */
56 DRV_ERR_NOT_STARTED = -11, /* the device to operate hasn't been started yet */
57 DRV_ERR_START_TIMES = -12, /* try to open a device which has been opened already */
58 /* reserved */
59
60}T_DRVS_RETURN_TYPE;
61
62/****************************************************************************
63* Constants
64****************************************************************************/
65
66/****************************************************************************
67* Global Variables
68****************************************************************************/
69
70/****************************************************************************
71* Function Prototypes
72****************************************************************************/
73
74typedef signed char SINT8;
75typedef unsigned char UINT8;
76
77typedef signed short SINT16;
78typedef unsigned short UINT16;
79
80typedef signed int SINT32;
81typedef unsigned int UINT32;
82
83#if defined(CONFIG_ZX297520V3E_MIFI_MINI_XR819)||defined(CONFIG_ZX297520V3E_MIFI_MINI)
84#define LED_WIFI_BLUE_GPIO GPIO39 //real wifi green led
85#define LED_SMS_BLUE_GPIO GPIO40 //real sms green led
86#define LED_BAT_RED_GPIO GPIO41
87#define LED_BAT_GREEN_GPIO GPIO42
88#define LED_MODEM_RED_GPIO GPIO124
89#define LED_MODEM_BLUE_GPIO GPIO125 //real modem green
90#define LED_WIFI_BLUE_GPIO_FUN GPIO39_GPIO39
91#define LED_SMS_BLUE_GPIO_FUN GPIO40_GPIO40
92#define LED_BAT_RED_GPIO_FUN GPIO41_GPIO41
93#define LED_BAT_GREEN_GPIO_FUN GPIO42_GPIO42
94#define LED_MODEM_RED_GPIO_FUN GPIO124_GPIO124
95#define LED_MODEM_BLUE_GPIO_FUN GPIO125_GPIO125
96
97#elif defined(CONFIG_ZX297520V3E_CPE_SWITCH)
98#define LED_LTE_RED GPIO45
99#define LED_LTE_BLUE GPIO46
100#define LED_WIFI GPIO86
101#define LED_WPS GPIO72
102#define LED_RJ11 GPIO22
103#define LED_4G_1 GPIO29
104#define LED_4G_2 GPIO30
105#define LED_4G_3 GPIO73
106#define LED_4G_4 GPIO74
107#define LED_4G_5 GPIO75
108
109#define LED_POWER_FUNC_SEL GPIO21_GPIO21
110#define LED_LTE_RED_FUNC_SEL GPIO45_GPIO45
111#define LED_LTE_BLUE_FUNC_SEL GPIO46_GPIO46
112#define LED_WIFI_FUNC_SEL GPIO86_GPIO86
113#define LED_WPS_FUNC_SEL GPIO72_GPIO72
114#define LED_RJ11_FUNC_SEL GPIO22_GPIO22
115#define LED_4G_1_FUNC_SEL GPIO29_GPIO29
116#define LED_4G_2_FUNC_SEL GPIO30_GPIO30
117#define LED_4G_3_FUNC_SEL GPIO73_GPIO73
118#define LED_4G_4_FUNC_SEL GPIO74_GPIO74
119#define LED_4G_5_FUNC_SEL GPIO75_GPIO75
120
121#else
122#define LED_WIFI_BLUE_GPIO GPIO39 //wifi blue led
123#define LED_SMS_BLUE_GPIO GPIO40 //sms blue led
124#define LED_BAT_RED_GPIO GPIO42 //bat red led
125#define LED_BAT_GREEN_GPIO GPIO41 //bat_green led
126#define LED_MODEM_RED_GPIO GPIO124
127#define LED_MODEM_BLUE_GPIO GPIO123
128#define LED_WIFI_BLUE_GPIO_FUN GPIO39_GPIO39//wifi blue led
129#define LED_SMS_BLUE_GPIO_FUN GPIO40_GPIO40//sms blue led
130#define LED_BAT_RED_GPIO_FUN GPIO42_GPIO42//bat red led change to green
131#define LED_BAT_GREEN_GPIO_FUN GPIO41_GPIO41//bat_green led
132#define LED_MODEM_RED_GPIO_FUN GPIO124_GPIO124
133#define LED_MODEM_BLUE_GPIO_FUN GPIO123_GPIO123
134#endif
135
136#define LED_BITFVAL(var, lsh) ( (var) << (lsh) )
137#define LED_BITFMASK(wid, lsh) ( ((1U << (wid)) - 1) << (lsh) )
138#define LED_BITFEXT(var, wid, lsh) ((var & LED_BITFMASK(wid, lsh)) >> (lsh))
139
140/* adc & sink and sink current select */
141#if 0/* adc & sink and sink current select */
142#define ZX234290_REG_ADDR_SYS_CTRL 0x07
143#define ZX234290_REG_ADDR_SINK2_CUR_SEL 0x08
144#define ZX234290_REG_ADDR_SINK1_CUR_SEL 0x09
145#endif
146typedef enum led_channel {
147 LED_WIFI_BLUE =0x0, //wifi green led
148 LED_SMS_BLUE, //sms green led
149 LED_BAT_RED, //bat red led
150 LED_BAT_GREEN, //bat_green led
151 LED_MODEM_BLUE, //modem green led
152 LED_MODEM_GREEN, //no
153 LED_MODEM_RED, //modem red
154 LED_CHANNEL_MAX,
155}led_channel;
156
157typedef enum led_current {
158 LED_CURRENT_0 =0x0,
159 LED_CURRENT_5,
160 LED_CURRENT_10,
161 LED_CURRENT_15,
162 LED_CURRENT_20,
163 LED_CURRENT_25,
164 LED_CURRENT_30,
165 LED_CURRENT_35,
166 LED_CURRENT_40,
167
168 SM5201_CURRENT_MAX,
169}led_current;
170
171typedef enum led_status {
172 LED_STATUS_OFF = 0x0,
173 LED_STATUS_ON = 0x1,
174
175 LED_STATUS_MAX,
176}led_status;
177
178
179/****************************************************************************
180* Constants
181****************************************************************************/
182
183/****************************************************************************
184* Global Variables
185****************************************************************************/
186
187/****************************************************************************
188* Function Prototypes
189****************************************************************************/
190
191SINT32 led_SetStatus(led_channel channel, led_status status);
192SINT32 led_SetBlink(led_channel channel, UINT32 delay_on, UINT32 delay_off);
193SINT32 led_SetLEDcurrent(UINT8 sink, led_current current);
194
195void zx29_led_init(void);
196void zx29_led_PowerOnLedOn(void);
197
198void zx29_led_PowerOnLedOff(void);
199
200#endif/*_DRVS_LED_H*/