blob: 7e6efdac57f4e27da43520a50b8c28d8bf9fbb5c [file] [log] [blame]
Mangesh Kunchamwar4e1e7182018-04-26 17:58:58 +05301/*
2 * Copyright (c) 2014,2018, The Linux Foundation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13#ifndef __Q6AFECAL_HWDEP_H__
14#define __Q6AFECAL_HWDEP_H__
15#include <sound/msmcal-hwdep.h>
16
17enum q6afe_cal_states {
18 Q6AFECAL_UNINITIALISED,
19 Q6AFECAL_INITIALISED,
20 Q6AFECAL_RECEIVED
21};
22
23struct afe_fw_info {
24 struct firmware_cal *fw[Q6AFE_MAX_CAL];
25 DECLARE_BITMAP(cal_bit, Q6AFE_MAX_CAL);
26 /* for calibration tracking */
27 unsigned long q6afecal_state[Q6AFE_MAX_CAL];
28 struct mutex lock;
29};
30
31struct firmware_cal {
32 u8 *data;
33 size_t size;
34};
35
36#if IS_ENABLED(CONFIG_AFE_HWDEP)
37int q6afe_cal_create_hwdep(void *fw, int node, void *card);
38struct firmware_cal *q6afecal_get_fw_cal(struct afe_fw_info *fw_data,
39 enum q6afe_cal_type type);
40#else /* CONFIG_AFE_HWDEP */
41static inline int q6afe_cal_create_hwdep(void *fw, int node, void *card)
42{
43 return 0;
44}
45
46static inline struct firmware_cal *q6afecal_get_fw_cal(
47 struct afe_fw_info *fw_data,
48 enum q6afe_cal_type type)
49{
50 return NULL;
51}
52#endif /* CONFIG_AFE_HWDEP */
53#endif /* __Q6AFECAL_HWDEP_H__ */