• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * include/linux/amlogic/aml_tuner.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_TUNER_H__
19 #define __AML_TUNER_H__
20 
21 #include <linux/amlogic/aml_demod_common.h>
22 #include <dvb_frontend.h>
23 
24 struct tuner_frontend {
25 	struct platform_device *pdev;
26 	struct class class;
27 	struct mutex mutex;
28 
29 	struct tuner_config cfg;
30 	struct analog_parameters param;
31 
32 	enum fe_type fe_type;
33 
34 	void *private;
35 };
36 
37 #if (defined CONFIG_AMLOGIC_DVB_EXTERN)
38 enum tuner_type aml_get_tuner_type(const char *name);
39 
40 struct dvb_frontend *aml_attach_detach_tuner(
41 		const enum tuner_type type,
42 		struct dvb_frontend *fe,
43 		struct tuner_config *cfg,
44 		int attach);
45 #else
aml_get_tuner_type(const char * name)46 static inline __maybe_unused enum tuner_type aml_get_tuner_type(
47 		const char *name)
48 {
49 	return AM_TUNER_NONE;
50 }
51 
aml_attach_detach_tuner(const enum tuner_type type,struct dvb_frontend * fe,struct tuner_config * cfg,int attach)52 static inline __maybe_unused struct dvb_frontend *aml_attach_detach_tuner(
53 		const enum tuner_type type,
54 		struct dvb_frontend *fe,
55 		struct tuner_config *cfg,
56 		int attach)
57 {
58 	return NULL;
59 }
60 #endif
61 
aml_attach_tuner(const enum tuner_type type,struct dvb_frontend * fe,struct tuner_config * cfg)62 static __maybe_unused struct dvb_frontend *aml_attach_tuner(
63 		const enum tuner_type type,
64 		struct dvb_frontend *fe,
65 		struct tuner_config *cfg)
66 {
67 	return aml_attach_detach_tuner(type, fe, cfg, 1);
68 }
69 
aml_detach_tuner(const enum tuner_type type)70 static __maybe_unused int aml_detach_tuner(const enum tuner_type type)
71 {
72 	aml_attach_detach_tuner(type, NULL, NULL, 0);
73 
74 	return 0;
75 }
76 
77 #if (defined CONFIG_AMLOGIC_DVB_EXTERN)
78 int aml_get_dts_tuner_config(struct device_node *node,
79 		struct tuner_config *cfg, int index);
80 #else
aml_get_dts_tuner_config(struct device_node * node,struct tuner_config * cfg,int index)81 static inline __maybe_unused int aml_get_dts_tuner_config(
82 		struct device_node *node, struct tuner_config *cfg, int index)
83 {
84 	return 0;
85 }
86 #endif
87 
88 #endif /* __AML_TUNER_H__ */
89