blob: f7e95eeae2f928f46c9d2accdbe9ff2a2387165c [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_CDC_H
14#define BOLERO_CDC_H
15
16#include <sound/soc.h>
17#include <linux/regmap.h>
18
19enum {
20 START_MACRO,
21 TX_MACRO = START_MACRO,
22 RX_MACRO,
23 WSA_MACRO,
24 VA_MACRO,
25 MAX_MACRO
26};
27
Laxminath Kasam2df2d612018-05-22 15:45:42 +053028enum mclk_mux {
29 MCLK_MUX0,
30 MCLK_MUX1,
31 MCLK_MUX_MAX
32};
33
Laxminath Kasame562a362018-04-12 00:39:08 +053034struct macro_ops {
35 int (*init)(struct snd_soc_codec *codec);
36 int (*exit)(struct snd_soc_codec *codec);
37 u16 num_dais;
38 struct device *dev;
39 struct snd_soc_dai_driver *dai_ptr;
40 int (*mclk_fn)(struct device *dev, bool enable);
41 char __iomem *io_base;
42};
43
44#if IS_ENABLED(CONFIG_SND_SOC_BOLERO)
45int bolero_register_macro(struct device *dev, u16 macro_id,
46 struct macro_ops *ops);
47void bolero_unregister_macro(struct device *dev, u16 macro_id);
48struct device *bolero_get_device_ptr(struct device *dev, u16 macro_id);
Laxminath Kasam2df2d612018-05-22 15:45:42 +053049int bolero_request_clock(struct device *dev, u16 macro_id,
50 enum mclk_mux mclk_mux_id,
51 bool enable);
Laxminath Kasam21c8b222018-06-21 18:47:22 +053052int bolero_info_create_codec_entry(
53 struct snd_info_entry *codec_root,
54 struct snd_soc_codec *codec);
Laxminath Kasame562a362018-04-12 00:39:08 +053055#else
56static inline int bolero_register_macro(struct device *dev,
57 u16 macro_id,
58 struct macro_ops *ops)
59{
60 return 0;
61}
62
63static inline void bolero_unregister_macro(struct device *dev, u16 macro_id)
64{
65}
66
67static inline struct device *bolero_get_device_ptr(struct device *dev,
Laxminath Kasam2df2d612018-05-22 15:45:42 +053068 u16 macro_id)
Laxminath Kasame562a362018-04-12 00:39:08 +053069{
70 return NULL;
71}
Laxminath Kasam21c8b222018-06-21 18:47:22 +053072
Laxminath Kasam2df2d612018-05-22 15:45:42 +053073static inline int bolero_request_clock(struct device *dev, u16 macro_id,
74 enum mclk_mux mclk_mux_id,
75 bool enable)
76{
77 return 0;
78}
Laxminath Kasam21c8b222018-06-21 18:47:22 +053079
80static int bolero_info_create_codec_entry(
81 struct snd_info_entry *codec_root,
82 struct snd_soc_codec *codec)
83{
84 return 0;
85}
Laxminath Kasame562a362018-04-12 00:39:08 +053086#endif /* CONFIG_SND_SOC_BOLERO */
87#endif /* BOLERO_CDC_H */