blob: 63266a84c7b4af976a1fb5bd78a76a658d9dfb65 [file] [log] [blame]
Laxminath Kasame562a362018-04-12 00:39:08 +05301/* Copyright (c) 2018, 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#ifndef _BOLERO_INTERNAL_H
14#define _BOLERO_INTERNAL_H
15
16#include "bolero_cdc_registers.h"
17
18enum {
19 REG_NO_ACCESS,
20 RD_REG,
21 WR_REG,
22 RD_WR_REG
23};
24
25struct bolero_priv {
26 struct device *dev;
27 struct snd_soc_codec *codec;
28 struct regmap *regmap;
29 struct mutex io_lock;
30 bool va_without_decimation;
31 bool macros_supported[MAX_MACRO];
32 struct macro_ops macro_params[MAX_MACRO];
33 struct snd_soc_dai_driver *bolero_dais;
34 u16 num_dais;
35 u16 num_macros_registered;
36 u16 child_num;
37 struct platform_device *pdev_child_devices[MAX_MACRO];
38
39 struct work_struct bolero_add_child_devices_work;
40
41 int (*read_dev)(struct bolero_priv *priv,
42 u16 macro_id, u16 reg, u8 *val);
43 int (*write_dev)(struct bolero_priv *priv,
44 u16 macro_id, u16 reg, u8 val);
45};
46
47struct regmap *bolero_regmap_init(struct device *dev,
48 const struct regmap_config *config);
49int bolero_get_macro_id(bool va_no_dec_flag, u16 reg);
50
51extern const struct regmap_config bolero_regmap_config;
52extern u8 *bolero_reg_access[MAX_MACRO];
53extern u8 bolero_va_top_reg_access[BOLERO_CDC_VA_MACRO_TOP_MAX];
54extern const u16 macro_id_base_offset[MAX_MACRO];
55
56#endif