summaryrefstree
path: root/kernel/include/linux/dbmdx.h
blob: 61d6e22e2af61b0171e3c439bbbdd27204260fa1 (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
91
92
/*
 * dbmdx-interface.h  --  DBMDX interface definitions
 *
 * Copyright (C) 2014 DSP Group
 *
 * 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 _DBMDX_H
#define _DBMDX_H

#include <linux/device.h>
#include <sound/soc.h>

enum dbmdx_va_speeds {
	DBMDX_VA_SPEED_NORMAL = 0,
	DBMDX_VA_SPEED_BUFFERING,
	DBMDX_VA_SPEED_MAX,
	DBMDX_VA_NR_OF_SPEEDS,
};

struct va_speed {
	u32	cfg;
	u32	uart_baud;
	u32	i2c_rate;
	u32	spi_rate;
};

enum dbmdx_clocks {
	DBMDX_CLK_CONSTANT = 0,
	DBMDX_CLK_MASTER,
	DBMDX_NR_OF_CLKS,
};

struct dbmdx_platform_data {
	int				gpio_wakeup;
	int				gpio_reset;
	int				gpio_sv;
	int				gpio_d2strap1;
	int				gpio_d2strap1_rst_val;
	int				wakeup_set_value;
	int				send_wakeup_seq;
	int				use_gpio_for_wakeup;

	const char			*va_firmware_name;
	const char			*vqe_firmware_name;
	const char			*vqe_non_overlay_firmware_name;
	int				firmware_id;

	int				clock_rates[DBMDX_NR_OF_CLKS];

	int				feature_va;
	int				feature_vqe;
	int				feature_fw_overlay;
	unsigned int			va_cfg_values;
	u32				*va_cfg_value;
	unsigned int			vqe_cfg_values;
	u32				*vqe_cfg_value;
	unsigned int			vqe_modes_values;
	u32				*vqe_modes_value;

	int				auto_buffering;
	int				auto_detection;
	int				detection_after_buffering;
	int				send_uevent_on_detection;
	int				uart_low_speed_enabled;

	int				detection_buffer_channels;
	u32				min_samples_chunk_size;
	u32				pcm_streaming_mode;

	struct va_speed	va_speed_cfg[DBMDX_VA_NR_OF_SPEEDS];
	u32				va_mic_config[5];
	u32				va_initial_mic_config;
	u32				va_mic_gain_config[3];
	int				va_audio_channels;
	u32				vqe_tdm_bypass_config;
	unsigned int			va_buffering_pcm_rate;

	unsigned int			va_recovery_disabled;
};
int dbmdx_get_samples(struct snd_soc_codec *codec,
	char *buffer, unsigned int samples);
int dbmdx_codec_lock(struct snd_soc_codec *codec);
int dbmdx_start_pcm_streaming(struct snd_soc_codec *codec,
	struct snd_pcm_substream *substream);
int dbmdx_stop_pcm_streaming(struct snd_soc_codec *codec);
int dbmdx_codec_unlock(struct snd_soc_codec *codec);

#endif