From 2ceac4ec08ccc51e90aa09404787d60bdbff0d2f Mon Sep 17 00:00:00 2001 From: "nengwen.chen" Date: Tue, 14 Jan 2020 20:08:48 +0800 Subject: [PATCH] demod: optimize the loading of demod and tuner [1/3] PD#SWPL-20095 Problem: 1.optimize the loading of demod and tuner. Solution: 1.optimize the loading of demod and tuner. 2.DVB uniformly calls the attach interface to load demod or tuner. 3.Demod and Tuner internal structure is independent of DVB structure. 4.All demod and tuner configuration parameters are passed on attach. Verify: Verified by x301 and ac214. Change-Id: If5f485cebeadb7ec54cf5b10ef1424065c13b388 Signed-off-by: nengwen.chen --- MAINTAINERS | 2 + .../arm/boot/dts/amlogic/sm1_s905x3_ac213.dts | 3 +- .../amlogic/sm1_s905x3_ac213_buildroot.dts | 3 +- .../arm/boot/dts/amlogic/sm1_s905x3_ac214.dts | 15 ++- .../amlogic/sm1_s905x3_ac214_buildroot.dts | 3 +- .../arm/boot/dts/amlogic/sm1_s905y3_ac223.dts | 3 +- .../boot/dts/amlogic/sm1_s905x3_ac213.dts | 2 + .../amlogic/sm1_s905x3_ac213_buildroot.dts | 2 + .../boot/dts/amlogic/sm1_s905x3_ac214.dts | 15 ++- .../amlogic/sm1_s905x3_ac214_buildroot.dts | 4 +- .../boot/dts/amlogic/sm1_s905y3_ac223.dts | 2 + drivers/amlogic/atv_demod/atv_demod_driver.c | 44 +++++-- drivers/amlogic/atv_demod/atv_demod_driver.h | 6 - drivers/amlogic/media/dtv_demod/amlfrontend.c | 3 +- .../media/dtv_demod/include/amlfrontend.h | 5 - include/linux/amlogic/aml_atvdemod.h | 53 +++----- include/linux/amlogic/aml_demod_common.h | 121 ++++++++++++++++++ include/linux/amlogic/aml_dtvdemod.h | 26 ++++ 18 files changed, 231 insertions(+), 81 deletions(-) create mode 100644 include/linux/amlogic/aml_demod_common.h create mode 100644 include/linux/amlogic/aml_dtvdemod.h diff --git a/MAINTAINERS b/MAINTAINERS index 68278a5b8530..a29ebb624367 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14488,6 +14488,8 @@ AMLOGIC ATV DEMOD DRIVER M: nengwen.chen F: drivers/amlogic/atv_demod/* F: include/linux/amlogic/aml_atvdemod.h +F: include/linux/amlogic/aml_dtvdemod.h +F: include/linux/amlogic/aml_demod_common.h AMLOGIC ADD EXT MIPI DEFAULT DRIVER M: Weiming Liu diff --git a/arch/arm/boot/dts/amlogic/sm1_s905x3_ac213.dts b/arch/arm/boot/dts/amlogic/sm1_s905x3_ac213.dts index c65327b70dd3..ba699fc8727a 100644 --- a/arch/arm/boot/dts/amlogic/sm1_s905x3_ac213.dts +++ b/arch/arm/boot/dts/amlogic/sm1_s905x3_ac213.dts @@ -342,7 +342,8 @@ fe0_ts = <0>; fe0_reset_value = <0>; fe0_reset_gpio = <&gpio GPIOZ_10 GPIO_ACTIVE_HIGH>; - dtv_demod0_ant_poweron_value = <0>; + fe0_ant_poweron_value = <0>; + fe0_ant_power_gpio = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>; ts0 = "serial"; ts0_control = <0x800>; diff --git a/arch/arm/boot/dts/amlogic/sm1_s905x3_ac213_buildroot.dts b/arch/arm/boot/dts/amlogic/sm1_s905x3_ac213_buildroot.dts index ef338543d5e3..a9adfcac4113 100644 --- a/arch/arm/boot/dts/amlogic/sm1_s905x3_ac213_buildroot.dts +++ b/arch/arm/boot/dts/amlogic/sm1_s905x3_ac213_buildroot.dts @@ -333,7 +333,8 @@ fe0_ts = <0>; fe0_reset_value = <0>; fe0_reset_gpio = <&gpio GPIOZ_10 GPIO_ACTIVE_HIGH>; - dtv_demod0_ant_poweron_value = <0>; + fe0_ant_poweron_value = <0>; + fe0_ant_power_gpio = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>; ts0 = "serial"; ts0_control = <0x800>; diff --git a/arch/arm/boot/dts/amlogic/sm1_s905x3_ac214.dts b/arch/arm/boot/dts/amlogic/sm1_s905x3_ac214.dts index 9fbc83e529c1..97318c44b691 100644 --- a/arch/arm/boot/dts/amlogic/sm1_s905x3_ac214.dts +++ b/arch/arm/boot/dts/amlogic/sm1_s905x3_ac214.dts @@ -352,13 +352,14 @@ dvb { compatible = "amlogic, dvb"; dev_name = "dvb"; - dtv_demod0 = "cxd2856"; - dtv_demod0_i2c_adap = <&i2c3>; - dtv_demod0_i2c_addr = <0xD8>; - dtv_demod0_reset_value = <0>; - dtv_demod0_reset_gpio = <&gpio_ao GPIOAO_10 GPIO_ACTIVE_HIGH>; - dtv_demod0_ant_poweron_value = <0>; - dtv_demod0_ant_power_gpio = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>; + fe0_mode = "external"; + fe0_demod = "cxd2856"; + fe0_i2c_adap_id = <&i2c3>; + fe0_demod_i2c_addr = <0xD8>; + fe0_reset_value = <0>; + fe0_reset_gpio = <&gpio_ao GPIOAO_10 GPIO_ACTIVE_HIGH>; + fe0_ant_poweron_value = <0>; + fe0_ant_power_gpio = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>; fe0_dtv_demod = <0>; fe0_ts = <0>; diff --git a/arch/arm/boot/dts/amlogic/sm1_s905x3_ac214_buildroot.dts b/arch/arm/boot/dts/amlogic/sm1_s905x3_ac214_buildroot.dts index d9c3628512a5..d9b51539c97e 100644 --- a/arch/arm/boot/dts/amlogic/sm1_s905x3_ac214_buildroot.dts +++ b/arch/arm/boot/dts/amlogic/sm1_s905x3_ac214_buildroot.dts @@ -333,7 +333,8 @@ fe0_ts = <0>; fe0_reset_value = <0>; fe0_reset_gpio = <&gpio GPIOZ_10 GPIO_ACTIVE_HIGH>; - dtv_demod0_ant_poweron_value = <0>; + fe0_ant_poweron_value = <0>; + fe0_ant_power_gpio = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>; ts0 = "serial"; ts0_control = <0x800>; diff --git a/arch/arm/boot/dts/amlogic/sm1_s905y3_ac223.dts b/arch/arm/boot/dts/amlogic/sm1_s905y3_ac223.dts index 740eb97c081b..288b8a18fff1 100644 --- a/arch/arm/boot/dts/amlogic/sm1_s905y3_ac223.dts +++ b/arch/arm/boot/dts/amlogic/sm1_s905y3_ac223.dts @@ -342,7 +342,8 @@ fe0_ts = <0>; fe0_reset_value = <0>; fe0_reset_gpio = <&gpio GPIOZ_10 GPIO_ACTIVE_HIGH>; - dtv_demod0_ant_poweron_value = <0>; + fe0_ant_poweron_value = <0>; + fe0_ant_power_gpio = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>; ts0 = "serial"; ts0_control = <0x800>; diff --git a/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac213.dts b/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac213.dts index 62c7755828d1..112c5afbc52d 100644 --- a/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac213.dts +++ b/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac213.dts @@ -335,6 +335,8 @@ fe0_ts = <0>; fe0_reset_value = <0>; fe0_reset_gpio = <&gpio GPIOZ_10 GPIO_ACTIVE_HIGH>; + fe0_ant_poweron_value = <0>; + fe0_ant_power_gpio = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>; ts0 = "serial"; ts0_control = <0x800>; diff --git a/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac213_buildroot.dts b/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac213_buildroot.dts index afdfd89f74b7..5f9b16d36194 100644 --- a/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac213_buildroot.dts +++ b/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac213_buildroot.dts @@ -326,6 +326,8 @@ fe0_ts = <0>; fe0_reset_value = <0>; fe0_reset_gpio = <&gpio GPIOZ_10 GPIO_ACTIVE_HIGH>; + fe0_ant_poweron_value = <0>; + fe0_ant_power_gpio = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>; ts0 = "serial"; ts0_control = <0x800>; diff --git a/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac214.dts b/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac214.dts index 57cc1d0cde1b..9cd3c59d9ede 100644 --- a/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac214.dts +++ b/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac214.dts @@ -329,13 +329,14 @@ dvb { compatible = "amlogic, dvb"; dev_name = "dvb"; - dtv_demod0 = "cxd2856"; - dtv_demod0_i2c_adap = <&i2c3>; - dtv_demod0_i2c_addr = <0xD8>; - dtv_demod0_reset_value = <0>; - dtv_demod0_reset_gpio = <&gpio_ao GPIOAO_10 GPIO_ACTIVE_HIGH>; - dtv_demod0_ant_poweron_value = <0>; - dtv_demod0_ant_power_gpio = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>; + fe0_mode = "external"; + fe0_demod = "cxd2856"; + fe0_i2c_adap_id = <&i2c3>; + fe0_demod_i2c_addr = <0xD8>; + fe0_reset_value = <0>; + fe0_reset_gpio = <&gpio_ao GPIOAO_10 GPIO_ACTIVE_HIGH>; + fe0_ant_poweron_value = <0>; + fe0_ant_power_gpio = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>; fe0_dtv_demod = <0>; fe0_ts = <0>; diff --git a/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac214_buildroot.dts b/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac214_buildroot.dts index 37c06e499805..202eb970ca6d 100644 --- a/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac214_buildroot.dts +++ b/arch/arm64/boot/dts/amlogic/sm1_s905x3_ac214_buildroot.dts @@ -325,7 +325,9 @@ fe0_demod_i2c_addr = <0x14>; fe0_ts = <0>; fe0_reset_value = <0>; - fe0_reset_gpio = <&gpio GPIOZ_10 GPIO_ACTIVE_HIGH>; + fe0_reset_gpio = <&gpio_ao GPIOAO_10 GPIO_ACTIVE_HIGH>; + fe0_ant_poweron_value = <0>; + fe0_ant_power_gpio = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>; ts0 = "serial"; ts0_control = <0x800>; diff --git a/arch/arm64/boot/dts/amlogic/sm1_s905y3_ac223.dts b/arch/arm64/boot/dts/amlogic/sm1_s905y3_ac223.dts index a8ae5f2a7a0a..985ffe4981be 100644 --- a/arch/arm64/boot/dts/amlogic/sm1_s905y3_ac223.dts +++ b/arch/arm64/boot/dts/amlogic/sm1_s905y3_ac223.dts @@ -335,6 +335,8 @@ fe0_ts = <0>; fe0_reset_value = <0>; fe0_reset_gpio = <&gpio GPIOZ_10 GPIO_ACTIVE_HIGH>; + fe0_ant_poweron_value = <0>; + fe0_ant_power_gpio = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>; ts0 = "serial"; ts0_control = <0x800>; diff --git a/drivers/amlogic/atv_demod/atv_demod_driver.c b/drivers/amlogic/atv_demod/atv_demod_driver.c index b7aadef5afe1..0d082e959a46 100644 --- a/drivers/amlogic/atv_demod/atv_demod_driver.c +++ b/drivers/amlogic/atv_demod/atv_demod_driver.c @@ -68,7 +68,7 @@ static ssize_t aml_atvdemod_store(struct class *class, unsigned long tmp = 0, data = 0; struct aml_atvdemod_device *dev = container_of(class, struct aml_atvdemod_device, cls); - /*struct atv_demod_priv *priv = dev->v4l2_fe.fe.analog_demod_priv;*/ + struct atv_demod_priv *priv = dev->v4l2_fe.fe.analog_demod_priv; buf_orig = kstrdup(buf, GFP_KERNEL); ps = buf_orig; @@ -312,23 +312,41 @@ static ssize_t aml_atvdemod_store(struct class *class, pr_info("audio_set std %d\n", std); } else if (!strncmp(parm[0], "atvdemod_status", 15)) { struct v4l2_analog_parameters *p = &dev->v4l2_fe.params; + int vpll_lock = 0; + int line_lock = 0; - pr_info("[atvdemod] afc_range: %d\n", p->afc_range); - pr_info("[atvdemod] frequency: %d\n", p->frequency); - pr_info("[atvdemod] soundsys: %d\n", p->soundsys); - pr_info("[atvdemod] std: 0x%x (%s %s)\n", + if (priv->state == ATVDEMOD_STATE_WORK) { + retrieve_vpll_carrier_lock(&vpll_lock); + pr_info("vpp lock: %s.\n", + vpll_lock == 0 ? "Locked" : "Unlocked"); + + retrieve_vpll_carrier_line_lock(&line_lock); + pr_info("line lock: %s.\n", + line_lock == 0 ? "Locked" : "Unlocked"); + + data_afc = retrieve_vpll_carrier_afc(); + pr_info("afc: %d Khz.\n", data_afc); + + data_snr_avg = atvdemod_get_snr_val(); + pr_info("snr: %d.\n", data_snr_avg); + } + + pr_info("[params] afc_range: %d\n", p->afc_range); + pr_info("[params] frequency: %d\n", p->frequency); + pr_info("[params] soundsys: %d\n", p->soundsys); + pr_info("[params] std: 0x%x (%s %s)\n", (unsigned int) dev->std, v4l2_std_to_str((0xff000000 & dev->std)), v4l2_std_to_str((0xffffff & dev->std))); - pr_info("[atvdemod] audmode: 0x%x\n", dev->audmode); - pr_info("[atvdemod] flag: %d\n", p->flag); - pr_info("[atvdemod] tuner_cur: %d\n", dev->tuner_cur); - pr_info("[atvdemod] tuner_id: %d\n", + pr_info("[params] audmode: 0x%x\n", dev->audmode); + pr_info("[params] flag: %d\n", p->flag); + pr_info("[params] tuner_cur: %d\n", dev->tuner_cur); + pr_info("[params] tuner_id: %d\n", dev->tuners[dev->tuner_cur].cfg.id); - pr_info("[atvdemod] if_freq: %d\n", dev->if_freq); - pr_info("[atvdemod] if_inv: %d\n", dev->if_inv); - pr_info("[atvdemod] fre_offset: %d\n", dev->fre_offset); - pr_info("[atvdemod] version: %s.\n", AMLATVDEMOD_VER); + pr_info("[params] if_freq: %d\n", dev->if_freq); + pr_info("[params] if_inv: %d\n", dev->if_inv); + pr_info("[params] fre_offset: %d\n", dev->fre_offset); + pr_info("version: %s.\n", AMLATVDEMOD_VER); } else if (!strncmp(parm[0], "attach_tuner", 12)) { int tuner_id = 0; diff --git a/drivers/amlogic/atv_demod/atv_demod_driver.h b/drivers/amlogic/atv_demod/atv_demod_driver.h index 3b5e1d8e6adf..23180b15e850 100644 --- a/drivers/amlogic/atv_demod/atv_demod_driver.h +++ b/drivers/amlogic/atv_demod/atv_demod_driver.h @@ -24,12 +24,6 @@ #include "atv_demod_v4l2.h" -struct aml_tuner { - struct tuner_config cfg; - unsigned int i2c_adapter_id; - struct i2c_adapter *i2c_adp; -}; - struct aml_atvdemod_device { char *name; struct class cls; diff --git a/drivers/amlogic/media/dtv_demod/amlfrontend.c b/drivers/amlogic/media/dtv_demod/amlfrontend.c index 4b49646e9293..c028daca3893 100644 --- a/drivers/amlogic/media/dtv_demod/amlfrontend.c +++ b/drivers/amlogic/media/dtv_demod/amlfrontend.c @@ -57,6 +57,7 @@ #include #include +#include MODULE_PARM_DESC(debug_aml, "\n\t\t Enable frontend debug information"); @@ -4925,7 +4926,7 @@ static struct dvb_frontend_ops aml_dtvdm_tm2_ops = { }; -struct dvb_frontend *aml_dtvdm_attach(const struct amlfe_exp_config *config) +struct dvb_frontend *aml_dtvdm_attach(const struct demod_config *config) { int ic_version = get_ic_ver(); diff --git a/drivers/amlogic/media/dtv_demod/include/amlfrontend.h b/drivers/amlogic/media/dtv_demod/include/amlfrontend.h index affdaa3acc1a..87fa0b8cabd1 100644 --- a/drivers/amlogic/media/dtv_demod/include/amlfrontend.h +++ b/drivers/amlogic/media/dtv_demod/include/amlfrontend.h @@ -217,11 +217,6 @@ struct poll_machie_s { }; -struct amlfe_exp_config { - /*config by aml_fe ?*/ - /* */ - int set_mode; -}; struct amldtvdemod_device_s { diff --git a/include/linux/amlogic/aml_atvdemod.h b/include/linux/amlogic/aml_atvdemod.h index b60d9016dfbb..afc765116c25 100644 --- a/include/linux/amlogic/aml_atvdemod.h +++ b/include/linux/amlogic/aml_atvdemod.h @@ -1,14 +1,18 @@ /* - * amlogic atv demod driver + * include/linux/amlogic/aml_atvdemod.h * - * Author: nengwen.chen - * - * - * Copyright (C) 2018 Amlogic Inc. + * Copyright (C) 2017 Amlogic, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * */ #ifndef __AML_ATVDEMOD_H__ @@ -17,6 +21,8 @@ #include #include +#include + /*COLOR MODULATION TYPE*/ #define V4L2_COLOR_STD_PAL ((v4l2_std_id) 0x04000000) #define V4L2_COLOR_STD_NTSC ((v4l2_std_id) 0x08000000) @@ -122,35 +128,6 @@ static inline const char *v4l2_std_to_str(v4l2_std_id std) /* For audio driver get atv audio state */ extern void aml_fe_get_atvaudio_state(int *state); -/* For attach tuner driver start*/ -enum tuner_type { - AM_TUNER_NONE = 0, - AM_TUNER_SI2176 = 1, - AM_TUNER_SI2196 = 2, - AM_TUNER_FQ1216 = 3, - AM_TUNER_HTM = 4, - AM_TUNER_CTC703 = 5, - AM_TUNER_SI2177 = 6, - AM_TUNER_R840 = 7, - AM_TUNER_SI2157 = 8, - AM_TUNER_SI2151 = 9, - AM_TUNER_MXL661 = 10, - AM_TUNER_MXL608 = 11, - AM_TUNER_SI2159 = 12, - AM_TUNER_R842 = 13, - AM_TUNER_ATBM2040 = 14, -}; - -/* For configure different tuners */ -/* It can add fields as extensions */ -struct tuner_config { - u8 id; - u8 i2c_addr; - u8 xtal; /* 0: 16MHz, 1: 24MHz, 3: 27MHz */ - u8 xtal_cap; - u8 xtal_mode; -}; - extern struct dvb_frontend *mxl661_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c_adap, struct tuner_config *cfg); extern struct dvb_frontend *si2151_attach(struct dvb_frontend *fe, @@ -163,6 +140,8 @@ extern struct dvb_frontend *r842_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c_adap, struct tuner_config *cfg); extern struct dvb_frontend *atbm2040_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c_adap, struct tuner_config *cfg); -/* For attach tuner driver end*/ +extern struct dvb_frontend *atbm253_attach(struct dvb_frontend *fe, + struct i2c_adapter *i2c_adap, struct tuner_config *cfg); +/* For attach tuner driver end */ #endif /* __AML_ATVDEMOD_H__ */ diff --git a/include/linux/amlogic/aml_demod_common.h b/include/linux/amlogic/aml_demod_common.h new file mode 100644 index 000000000000..5425a20689c2 --- /dev/null +++ b/include/linux/amlogic/aml_demod_common.h @@ -0,0 +1,121 @@ +/* + * include/linux/amlogic/aml_demod_common.h + * + * Copyright (C) 2017 Amlogic, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + */ + +#ifndef __AML_DEMOD_COMMON_H__ +#define __AML_DEMOD_COMMON_H__ + +#include +#include + +enum tuner_type { + AM_TUNER_NONE = 0, + AM_TUNER_SI2176 = 1, + AM_TUNER_SI2196 = 2, + AM_TUNER_FQ1216 = 3, + AM_TUNER_HTM = 4, + AM_TUNER_CTC703 = 5, + AM_TUNER_SI2177 = 6, + AM_TUNER_R840 = 7, + AM_TUNER_SI2157 = 8, + AM_TUNER_SI2151 = 9, + AM_TUNER_MXL661 = 10, + AM_TUNER_MXL608 = 11, + AM_TUNER_SI2159 = 12, + AM_TUNER_R842 = 13, + AM_TUNER_ATBM2040 = 14, + AM_TUNER_ATBM253 = 15 +}; + +enum atv_demod_type { + AM_ATV_DEMOD_NONE = 0, + AM_ATV_DEMOD_SI2176 = 1, + AM_ATV_DEMOD_SI2196 = 2, + AM_ATV_DEMOD_FQ1216 = 3, + AM_ATV_DEMOD_HTM = 4, + AM_ATV_DEMOD_CTC703 = 5, + AM_ATV_DEMOD_SI2177 = 6, + AM_ATV_DEMOD_AML = 7, + AM_ATV_DEMOD_R840 = 8 +}; + +enum dtv_demod_type { + AM_DTV_DEMOD_NONE = 0, + AM_DTV_DEMOD_AML = 1, + AM_DTV_DEMOD_M1 = 2, + AM_DTV_DEMOD_SI2176 = 3, + AM_DTV_DEMOD_MXL101 = 4, + AM_DTV_DEMOD_SI2196 = 5, + AM_DTV_DEMOD_AVL6211 = 6, + AM_DTV_DEMOD_SI2168 = 7, + AM_DTV_DEMOD_SI2168_1 = 8, + AM_DTV_DEMOD_ITE9133 = 9, + AM_DTV_DEMOD_ITE9173 = 10, + AM_DTV_DEMOD_DIB8096 = 11, + AM_DTV_DEMOD_ATBM8869 = 12, + AM_DTV_DEMOD_MXL241 = 13, + AM_DTV_DEMOD_AVL68xx = 14, + AM_DTV_DEMOD_MXL683 = 15, + AM_DTV_DEMOD_ATBM8881 = 16, + AM_DTV_DEMOD_ATBM7821 = 17, + AM_DTV_DEMOD_AVL6762 = 18, + AM_DTV_DEMOD_CXD2856 = 19, + AM_DTV_DEMOD_MXL248 = 20 +}; + +enum aml_fe_dev_type { + AM_DEV_TUNER, + AM_DEV_ATV_DEMOD, + AM_DEV_DTV_DEMOD +}; + +/* For configure different tuners */ +/* It can add fields as extensions */ +struct tuner_config { + u8 id; + u8 i2c_addr; + u8 xtal; /* 0: 16MHz, 1: 24MHz, 3: 27MHz */ + u8 xtal_cap; + u8 xtal_mode; +}; + +/* For configure different demod */ +struct demod_config { + int mode; /* 0: internal, 1: external */ + int dev_id; + u32 ts; + int ts_out_mode; /* serial or parallel; 0:serial, 1:parallel */ + struct i2c_adapter *i2c_adap; + int i2c_addr; + int reset_gpio; + int reset_value; + int ant_power_gpio; + int ant_power_value; + + int tuner0_i2c_addr; + int tuner1_i2c_addr; + int tuner0_code; + int tuner1_code; +}; + +/* For configure multi-tuner */ +struct aml_tuner { + struct tuner_config cfg; + unsigned int i2c_adapter_id; + struct i2c_adapter *i2c_adp; +}; + +#endif /* __AML_DEMOD_COMMON_H__ */ diff --git a/include/linux/amlogic/aml_dtvdemod.h b/include/linux/amlogic/aml_dtvdemod.h new file mode 100644 index 000000000000..d22967317b24 --- /dev/null +++ b/include/linux/amlogic/aml_dtvdemod.h @@ -0,0 +1,26 @@ +/* + * include/linux/amlogic/aml_dtvdemod.h + * + * Copyright (C) 2017 Amlogic, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + */ + +#ifndef __AML_DTVDEMOD_H__ +#define __AML_DTVDEMOD_H__ + +#include + +extern struct dvb_frontend *aml_dtvdm_attach(const struct demod_config *cfg); + +/* For attach demod driver end*/ +#endif /* __AML_DTVDEMOD_H__ */