aboutsummaryrefslogtreecommitdiff
path: root/include/linux/tfa9895.h
blob: b4e58ba28015b31bd78e6a16a012138d7bab5c31 (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
/*
 * Definitions for tfa9895 speaker amp chip.
 */
#ifndef TFA9895_H
#define TFA9895_H

#include <linux/ioctl.h>

#define TFA9895_I2C_NAME "tfa9895"
#define TFA9895L_I2C_NAME "tfa9895l"

#define MSM8994_LDO_WR (1) /* Workaround for 8994 AKM current leakage issue, defined same as in msm8994.c */

#define TFA9895_IOCTL_MAGIC 'a'
#define TFA9895_WRITE_CONFIG_NR     0x01
#define TFA9895_READ_CONFIG_NR      0x02
#define TFA9895_ENABLE_DSP_NR       0x03
#define TFA9895_WRITE_L_CONFIG_NR   0x04
#define TFA9895_READ_L_CONFIG_NR    0x05
#define TFA9895_KERNEL_LOCK_NR      0x06
#define TFA9895_KERNEL_INIT_NR      0x07

#define TFA9895_WRITE_CONFIG(size)   _IOW(TFA9895_IOCTL_MAGIC, TFA9895_WRITE_CONFIG_NR, (size))
#define TFA9895_READ_CONFIG(size)    _IOWR(TFA9895_IOCTL_MAGIC, TFA9895_READ_CONFIG_NR, (size))
#define TFA9895_ENABLE_DSP(size)     _IOW(TFA9895_IOCTL_MAGIC, TFA9895_ENABLE_DSP_NR, (size))
#define TFA9895_WRITE_L_CONFIG(size) _IOW(TFA9895_IOCTL_MAGIC, TFA9895_WRITE_L_CONFIG_NR , (size))
#define TFA9895_READ_L_CONFIG(size)  _IOWR(TFA9895_IOCTL_MAGIC, TFA9895_READ_L_CONFIG_NR, (size))
#define TFA9895_KERNEL_LOCK(size)    _IOW(TPA9887_IOCTL_MAGIC, TFA9895_KERNEL_LOCK_NR, (size))
#define TFA9895_KERNEL_LOCK_INIT(size)  _IOW(TPA9887_IOCTL_MAGIC, TFA9895_KERNEL_INIT_NR, (size))

struct tfa9895_platform_data {
	uint32_t tfa9895_power_enable;
};

struct tfa9895_i2c_buffer {
	int size;
	unsigned char buffer[255];
};

int set_tfa9895_spkamp(int en, int dsp_mode);
int set_tfa9895l_spkamp(int en, int dsp_mode);
int tfa9895_l_write(char *txdata, int length);
int tfa9895_l_read(char *rxdata, int length);
int tfa9895_disable(bool disable);
int tfa9895l_disable(bool disable);

#if MSM8994_LDO_WR
extern int msm8994_hph_en_ready(void);
#endif

#endif