blob: 460c9a28e9f8821d5cc1e78421d62112ef9613c6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
/*
* maxim_dsm_power.c -- Module for Power Measurement
*
* Copyright 2015 Maxim Integrated Products
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef __SOUND_MAXIM_DSM_POWER_H__
#define MAXDSM_POWER_WQ_NAME "maxdsm_power_wq"
#define MAXDSM_POWER_CLASS_NAME "maxdsm_power"
#define MAXDSM_POWER_DSM_NAME "dsm"
#define MAXDSM_POWER_START_DELAY 1000
enum maxdsm_ppr_channel {
MAXDSM_LEFT = 0,
MAXDSM_RIGHT = 1,
MAXDSM_CHANNEL = 2,
};
enum maxdsm_ppr_state {
PPR_OFF = 0,
PPR_ON,
PPR_NORMAL,
PPR_RUN,
};
struct maxim_dsm_power_info {
int interval;
int duration;
int remaining;
unsigned long previous_jiffies;
};
struct maxim_dsm_power_values {
uint32_t status;
int power;
int power_r;
uint64_t avg;
uint64_t avg_r;
int count;
};
struct maxim_dsm_power_ppr_info {
int interval;
int duration;
int target_min_time_ms;
int global_enable;
unsigned long previous_jiffies;
unsigned long amp_uptime_jiffies;
};
struct maxim_dsm_ppr_values {
int status;
int target_temp;
int exit_temp;
int cutoff_frequency;
int threshold_level;
int env_temp;
int spk_t;
};
struct maxim_dsm_power {
struct device *dev;
struct class *class;
struct mutex mutex;
struct workqueue_struct *wq;
struct delayed_work work;
struct delayed_work work_ppr;
struct maxim_dsm_power_values values;
struct maxim_dsm_power_info info;
struct maxim_dsm_ppr_values values_ppr[MAXDSM_CHANNEL];
struct maxim_dsm_power_ppr_info info_ppr;
uint32_t platform_type;
};
struct maxim_dsm_ppr_init_values {
int target_temp[MAXDSM_CHANNEL];
int exit_temp[MAXDSM_CHANNEL];
};
void maxdsm_power_ppr_control(int state);
void maxdsm_power_control(int state);
int maxdsm_update_ppr_info(uint32_t *ppr_info);
#endif /* __SOUND_MAXIM_DSM_POWER_H__ */
|