1 /*
2 * include/linux/amlogic/aml_dtvdemod.h
3 *
4 * Copyright (C) 2017 Amlogic, Inc. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 */
17
18 #ifndef __AML_DTVDEMOD_H__
19 #define __AML_DTVDEMOD_H__
20
21 #include <linux/amlogic/aml_demod_common.h>
22 #include <dvb_frontend.h>
23
24 /* For demod ctrl */
25 struct demod_priv {
26 bool inited;
27 bool suspended;
28 bool serial_mode;
29
30 struct mutex mutex;
31
32 struct dvb_frontend fe;
33 struct demod_config cfg;
34 enum fe_delivery_system delivery_system;
35
36 void *private;
37
38 int index;
39 };
40
41 /* For demod */
42 struct demod_frontend {
43 struct platform_device *pdev;
44 struct class class;
45 struct mutex mutex;
46
47 struct list_head demod_list;
48 int demod_count;
49 };
50
51 #if (defined CONFIG_AMLOGIC_DTV_DEMOD)
52 struct dvb_frontend *aml_dtvdm_attach(const struct demod_config *cfg);
53 #else
aml_dtvdm_attach(const struct demod_config * cfg)54 static inline __maybe_unused struct dvb_frontend *aml_dtvdm_attach(
55 const struct demod_config *cfg)
56 {
57 return NULL;
58 }
59 #endif
60
61 #if (defined CONFIG_AMLOGIC_DVB_EXTERN)
62 enum dtv_demod_type aml_get_dtvdemod_type(const char *name);
63
64 struct dvb_frontend *aml_attach_detach_dtvdemod(
65 enum dtv_demod_type type,
66 struct demod_config *cfg,
67 int attch);
68 #else
aml_get_dtvdemod_type(const char * name)69 static inline __maybe_unused enum dtv_demod_type aml_get_dtvdemod_type(
70 const char *name)
71 {
72 return AM_DTV_DEMOD_NONE;
73 }
74
aml_attach_detach_dtvdemod(enum dtv_demod_type type,struct demod_config * cfg,int attch)75 static inline __maybe_unused struct dvb_frontend *aml_attach_detach_dtvdemod(
76 enum dtv_demod_type type,
77 struct demod_config *cfg,
78 int attch)
79 {
80 return NULL;
81 }
82 #endif
83
aml_attach_dtvdemod(enum dtv_demod_type type,struct demod_config * cfg)84 static inline __maybe_unused struct dvb_frontend *aml_attach_dtvdemod(
85 enum dtv_demod_type type,
86 struct demod_config *cfg)
87 {
88 return aml_attach_detach_dtvdemod(type, cfg, 1);
89 }
90
aml_detach_dtvdemod(const enum dtv_demod_type type)91 static inline __maybe_unused int aml_detach_dtvdemod(
92 const enum dtv_demod_type type)
93 {
94 aml_attach_detach_dtvdemod(type, NULL, 0);
95
96 return 0;
97 }
98
99 #if (defined CONFIG_AMLOGIC_DVB_EXTERN)
100 int aml_get_dts_demod_config(struct device_node *node,
101 struct demod_config *cfg, int index);
102 #else
aml_get_dts_demod_config(struct device_node * node,struct demod_config * cfg,int index)103 static inline __maybe_unused int aml_get_dts_demod_config(
104 struct device_node *node, struct demod_config *cfg, int index)
105 {
106 return 0;
107 }
108 #endif
109
110 /* For attach demod driver end*/
111 #endif /* __AML_DTVDEMOD_H__ */
112