blob: 979513f6ac142ba8418248fe441530f5475003d5 [file] [log] [blame]
Ashok Jammigumpulaa1b7ec12017-11-23 15:37:44 +05301/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13
14#define TSENS_NUM_MTC_ZONES_SUPPORT 3
15#define TSENS_TM_MTC_ZONE0_SW_MASK_ADDR(n) ((n) + 0x140)
16#define TSENS_TM_MTC_ZONE0_LOG(n) ((n) + 0x150)
17#define TSENS_TM_MTC_ZONE0_HISTORY(n) ((n) + 0x160)
18#define TSENS_SN_ADDR_OFFSET 0x4
19#define TSENS_RESET_HISTORY_MASK 0x4
20#define TSENS_ZONEMASK_PARAMS 3
21#define TSENS_MTC_ZONE_LOG_SIZE 6
22#define TSENS_MTC_ZONE_HISTORY_SIZE 3
23
24#define TSENS_TH1_MTC_IN_EFFECT BIT(0)
25#define TSENS_TH2_MTC_IN_EFFECT BIT(1)
26#define TSENS_MTC_IN_EFFECT 0x3
27#define TSENS_MTC_DISABLE 0x0
28
29#define TSENS_LOGS_VALID_MASK 0x40000000
30#define TSENS_LOGS_VALID_SHIFT 30
31#define TSENS_LOGS_LATEST_MASK 0x0000001f
32#define TSENS_LOGS_LOG1_MASK 0x000003e0
33#define TSENS_LOGS_LOG2_MASK 0x00007c00
34#define TSENS_LOGS_LOG3_MASK 0x000f8000
35#define TSENS_LOGS_LOG4_MASK 0x01f00000
36#define TSENS_LOGS_LOG5_MASK 0x3e000000
37#define TSENS_LOGS_LOG1_SHIFT 5
38#define TSENS_LOGS_LOG2_SHIFT 10
39#define TSENS_LOGS_LOG3_SHIFT 15
40#define TSENS_LOGS_LOG4_SHIFT 20
41#define TSENS_LOGS_LOG5_SHIFT 25
42
43#define TSENS_PS_RED_CMD_MASK 0x3ff00000
44#define TSENS_PS_YELLOW_CMD_MASK 0x000ffc00
45#define TSENS_PS_COOL_CMD_MASK 0x000003ff
46#define TSENS_PS_YELLOW_CMD_SHIFT 0xa
47#define TSENS_PS_RED_CMD_SHIFT 0x14
48
49#define TSENS_RESET_HISTORY_SHIFT 2
50
51#define TSENS_ZONEMASK_PARAMS 3
52#define TSENS_MTC_ZONE_LOG_SIZE 6
53#define TSENS_MTC_ZONE_HISTORY_SIZE 3
54
55extern int tsens_get_mtc_zone_history(unsigned int zone, void *zone_hist);
56extern struct tsens_device *tsens_controller_is_present(void);
57extern int tsens_set_mtc_zone_sw_mask(unsigned int zone,
58 unsigned int th1_enable, unsigned int th2_enable);
59extern int tsens_get_mtc_zone_log(unsigned int zone, void *zone_log);