blob: 9004da86d1dafa3a2c752cb919eec332045147fd [file] [log] [blame]
you.chen91163202025-07-11 19:27:34 +08001/*******************************************************************************
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
you.chenf56445b2025-07-11 19:30:10 +0800122#define LED_WIFI_BLUE_GPIO GPIO121 //wifi blue led
123#define LED_4G_GREEN_GPIO GPIO123 //4g led
124#define LED_ETH_GREEN_GPIO GPIO124 //eth led
125#define LED_BAT_RED_GPIO GPIO81 //bat red led
126#define LED_BAT_GREEN_GPIO GPIO78 //bat_green led
127#define LED_MODEM_RED_GPIO GPIO31
128#define LED_MODEM_GREEN_GPIO GPIO29
129#define LED_MODEM_BLUE_GPIO GPIO122
130#define LED_WIFI_BLUE_GPIO_FUN GPIO121_GPIO121//wifi blue led
131#define LED_4G_GREEN_GPIO_FUN GPIO123_GPIO123//4g led
132#define LED_ETH_GREEN_GPIO_FUN GPIO124_GPIO124//eth led
133#define LED_BAT_RED_GPIO_FUN GPIO81_GPIO81//bat red led change to green
134#define LED_BAT_GREEN_GPIO_FUN GPIO78_GPIO78//bat_green led
135#define LED_MODEM_RED_GPIO_FUN GPIO31_GPIO31
136#define LED_MODEM_GREEN_GPIO_FUN GPIO29_GPIO29
137#define LED_MODEM_BLUE_GPIO_FUN GPIO122_GPIO122
you.chen91163202025-07-11 19:27:34 +0800138#endif
139
140#define LED_BITFVAL(var, lsh) ( (var) << (lsh) )
141#define LED_BITFMASK(wid, lsh) ( ((1U << (wid)) - 1) << (lsh) )
142#define LED_BITFEXT(var, wid, lsh) ((var & LED_BITFMASK(wid, lsh)) >> (lsh))
143
144/* adc & sink and sink current select */
145#if 0/* adc & sink and sink current select */
146#define ZX234290_REG_ADDR_SYS_CTRL 0x07
147#define ZX234290_REG_ADDR_SINK2_CUR_SEL 0x08
148#define ZX234290_REG_ADDR_SINK1_CUR_SEL 0x09
149#endif
150typedef enum led_channel {
151 LED_WIFI_BLUE =0x0, //wifi green led
you.chenf56445b2025-07-11 19:30:10 +0800152 LED_4G_GREEN, //sms green led
you.chen91163202025-07-11 19:27:34 +0800153 LED_BAT_RED, //bat red led
154 LED_BAT_GREEN, //bat_green led
155 LED_MODEM_BLUE, //modem green led
156 LED_MODEM_GREEN, //no
157 LED_MODEM_RED, //modem red
you.chenf56445b2025-07-11 19:30:10 +0800158 LED_ETH_GREEN,
you.chen91163202025-07-11 19:27:34 +0800159 LED_CHANNEL_MAX,
160}led_channel;
161
162typedef enum led_current {
163 LED_CURRENT_0 =0x0,
164 LED_CURRENT_5,
165 LED_CURRENT_10,
166 LED_CURRENT_15,
167 LED_CURRENT_20,
168 LED_CURRENT_25,
169 LED_CURRENT_30,
170 LED_CURRENT_35,
171 LED_CURRENT_40,
172
173 SM5201_CURRENT_MAX,
174}led_current;
175
176typedef enum led_status {
177 LED_STATUS_OFF = 0x0,
178 LED_STATUS_ON = 0x1,
179
180 LED_STATUS_MAX,
181}led_status;
182
183
184/****************************************************************************
185* Constants
186****************************************************************************/
187
188/****************************************************************************
189* Global Variables
190****************************************************************************/
191
192/****************************************************************************
193* Function Prototypes
194****************************************************************************/
195
196SINT32 led_SetStatus(led_channel channel, led_status status);
197SINT32 led_SetBlink(led_channel channel, UINT32 delay_on, UINT32 delay_off);
198SINT32 led_SetLEDcurrent(UINT8 sink, led_current current);
199
200void zx29_led_init(void);
201void zx29_led_PowerOnLedOn(void);
202
203void zx29_led_PowerOnLedOff(void);
204
205#endif/*_DRVS_LED_H*/