summaryrefslogtreecommitdiff
Diffstat
-rw-r--r--[-rwxr-xr-x]Media.mk1
-rw-r--r--drivers/amvdec_ports/Makefile1
-rw-r--r--drivers/amvdec_ports/aml_vcodec_adapt.c112
-rw-r--r--drivers/amvdec_ports/aml_vcodec_adapt.h5
-rw-r--r--drivers/amvdec_ports/aml_vcodec_dec.c992
-rw-r--r--drivers/amvdec_ports/aml_vcodec_dec.h2
-rw-r--r--drivers/amvdec_ports/aml_vcodec_dec_drv.c122
-rw-r--r--drivers/amvdec_ports/aml_vcodec_dec_pm.c206
-rw-r--r--drivers/amvdec_ports/aml_vcodec_dec_pm.h34
-rw-r--r--drivers/amvdec_ports/aml_vcodec_drv.h188
-rw-r--r--drivers/amvdec_ports/aml_vcodec_util.c34
-rw-r--r--drivers/amvdec_ports/aml_vcodec_util.h90
-rw-r--r--drivers/amvdec_ports/aml_vcodec_vfm.c28
-rw-r--r--drivers/amvdec_ports/decoder/aml_h264_parser.c81
-rw-r--r--drivers/amvdec_ports/decoder/aml_h264_parser.h1
-rw-r--r--drivers/amvdec_ports/decoder/aml_hevc_parser.c133
-rw-r--r--drivers/amvdec_ports/decoder/aml_hevc_parser.h1
-rw-r--r--drivers/amvdec_ports/decoder/aml_mjpeg_parser.c34
-rw-r--r--drivers/amvdec_ports/decoder/aml_mjpeg_parser.h1
-rw-r--r--drivers/amvdec_ports/decoder/aml_mpeg12_parser.h1
-rw-r--r--drivers/amvdec_ports/decoder/aml_mpeg4_parser.c178
-rw-r--r--drivers/amvdec_ports/decoder/aml_mpeg4_parser.h1
-rw-r--r--drivers/amvdec_ports/decoder/aml_vp9_parser.c26
-rw-r--r--drivers/amvdec_ports/decoder/aml_vp9_parser.h1
-rw-r--r--drivers/amvdec_ports/decoder/vdec_h264_if.c223
-rw-r--r--drivers/amvdec_ports/decoder/vdec_hevc_if.c194
-rw-r--r--drivers/amvdec_ports/decoder/vdec_mjpeg_if.c210
-rw-r--r--drivers/amvdec_ports/decoder/vdec_mpeg12_if.c304
-rw-r--r--drivers/amvdec_ports/decoder/vdec_mpeg4_if.c209
-rw-r--r--drivers/amvdec_ports/decoder/vdec_vp9_if.c195
-rw-r--r--drivers/amvdec_ports/vdec_drv_if.c6
-rw-r--r--drivers/amvdec_ports/vdec_drv_if.h21
-rw-r--r--drivers/common/chips/chips.c1
-rw-r--r--drivers/common/chips/decoder_cpu_ver_info.c8
-rw-r--r--drivers/common/chips/decoder_cpu_ver_info.h1
-rw-r--r--drivers/common/firmware/firmware_drv.c9
-rw-r--r--drivers/common/firmware/firmware_type.c1
-rw-r--r--drivers/common/firmware/firmware_type.h1
-rw-r--r--drivers/common/media_clock/clk/clk.c3
-rw-r--r--drivers/common/media_clock/clk/clkg12.c5
-rw-r--r--drivers/frame_provider/decoder/Makefile1
-rw-r--r--drivers/frame_provider/decoder/avs/avs.c60
-rw-r--r--drivers/frame_provider/decoder/avs2/avs2_bufmgr.c12
-rw-r--r--drivers/frame_provider/decoder/avs2/avs2_global.h3
-rw-r--r--drivers/frame_provider/decoder/avs2/vavs2.c115
-rw-r--r--drivers/frame_provider/decoder/avs_multi/Makefile2
-rw-r--r--drivers/frame_provider/decoder/avs_multi/avs_multi.c1633
-rw-r--r--drivers/frame_provider/decoder/avs_multi/avsp_trans_multi.c5065
-rw-r--r--drivers/frame_provider/decoder/h264/vh264.c58
-rw-r--r--drivers/frame_provider/decoder/h264_multi/h264_dpb.c50
-rw-r--r--drivers/frame_provider/decoder/h264_multi/h264_dpb.h34
-rw-r--r--drivers/frame_provider/decoder/h264_multi/vmh264.c1043
-rw-r--r--drivers/frame_provider/decoder/h265/vh265.c707
-rw-r--r--drivers/frame_provider/decoder/mjpeg/vmjpeg_multi.c60
-rw-r--r--drivers/frame_provider/decoder/mpeg12/vmpeg12_multi.c595
-rw-r--r--drivers/frame_provider/decoder/mpeg4/vmpeg4.c5
-rw-r--r--drivers/frame_provider/decoder/mpeg4/vmpeg4_multi.c80
-rw-r--r--drivers/frame_provider/decoder/utils/amvdec.c5
-rw-r--r--drivers/frame_provider/decoder/utils/frame_check.c178
-rw-r--r--drivers/frame_provider/decoder/utils/frame_check.h4
-rw-r--r--drivers/frame_provider/decoder/utils/vdec.c530
-rw-r--r--drivers/frame_provider/decoder/utils/vdec.h18
-rw-r--r--drivers/frame_provider/decoder/utils/vdec_input.c12
-rw-r--r--drivers/frame_provider/decoder/utils/vdec_input.h3
-rw-r--r--drivers/frame_provider/decoder/utils/vdec_v4l2_buffer_ops.c92
-rw-r--r--drivers/frame_provider/decoder/utils/vdec_v4l2_buffer_ops.h7
-rw-r--r--drivers/frame_provider/decoder/vav1/Makefile2
-rw-r--r--drivers/frame_provider/decoder/vav1/aom_av1_define.h171
-rw-r--r--drivers/frame_provider/decoder/vav1/av1_bufmgr.c3392
-rw-r--r--drivers/frame_provider/decoder/vav1/av1_global.h2310
-rw-r--r--drivers/frame_provider/decoder/vav1/vav1.c9946
-rw-r--r--drivers/frame_provider/decoder/vav1/vav1.h22
-rw-r--r--drivers/frame_provider/decoder/vc1/vvc1.c46
-rw-r--r--drivers/frame_provider/decoder/vp9/vvp9.c449
-rw-r--r--drivers/frame_sink/encoder/h264/encoder.c2
-rw-r--r--drivers/stream_input/Makefile5
-rw-r--r--drivers/stream_input/amports/amstream.c263
-rw-r--r--drivers/stream_input/parser/demux/aml_dvb.h5
-rw-r--r--drivers/stream_input/parser/demux/hw_demux/demod_gt.h62
-rw-r--r--drivers/stream_input/parser/demux/hw_demux/frontend.c293
-rw-r--r--drivers/stream_input/parser/dvb_common.c17
-rw-r--r--drivers/stream_input/parser/dvb_common.h26
-rw-r--r--drivers/stream_input/parser/esparser.c15
-rw-r--r--drivers/stream_input/parser/hw_demux/aml_demod_gt.h87
-rw-r--r--drivers/stream_input/parser/hw_demux/aml_dmx.c270
-rw-r--r--drivers/stream_input/parser/hw_demux/aml_dvb.c445
-rw-r--r--drivers/stream_input/parser/hw_demux/aml_dvb.h32
-rw-r--r--drivers/stream_input/parser/streambuf.c9
-rw-r--r--drivers/stream_input/parser/tsdemux.c14
-rw-r--r--drivers/stream_input/parser/tsdemux.h1
-rw-r--r--drivers/stream_input/tv_frontend/Makefile16
-rw-r--r--drivers/stream_input/tv_frontend/aml_fe.c1372
-rw-r--r--drivers/stream_input/tv_frontend/aml_fe.h213
-rw-r--r--drivers/stream_input/tv_frontend/atv_demod/atvdemod_frontend.c791
-rw-r--r--drivers/stream_input/tv_frontend/atv_demod/atvdemod_func.c2163
-rw-r--r--drivers/stream_input/tv_frontend/atv_demod/atvdemod_func.h323
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/aml_demod.c725
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/amlfrontend.c1402
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/demod_func.c2996
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/dvbc_func.c1331
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/dvbt_func.c2188
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/i2c_func.c42
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/include/acf_filter_coefficient.h414
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/include/addr_dtmb_che.h77
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/include/addr_dtmb_che_bit.h266
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/include/addr_dtmb_front.h70
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/include/addr_dtmb_front_bit.h331
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/include/addr_dtmb_sync.h53
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/include/addr_dtmb_sync_bit.h110
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/include/addr_dtmb_top.h90
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/include/addr_dtmb_top_bit.h178
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/include/aml_dtv_demod_reg.h28
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/include/amlfrontend.h86
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/include/demod_func.h626
-rw-r--r--drivers/stream_input/tv_frontend/dtv_demod/tuner_func.c189
-rw-r--r--firmware/video_ucode.bin14148
116 files changed, 25845 insertions, 36303 deletions
diff --git a/drivers/stream_input/parser/hw_demux/aml_dvb.c b/drivers/stream_input/parser/hw_demux/aml_dvb.c
index 1a5e174..7be153a 100644
--- a/drivers/stream_input/parser/hw_demux/aml_dvb.c
+++ b/drivers/stream_input/parser/hw_demux/aml_dvb.c
@@ -46,6 +46,7 @@
#include <linux/string.h>
#include <linux/pinctrl/consumer.h>
#include <linux/reset.h>
+#include <linux/of_gpio.h>
#include <linux/amlogic/media/utils/amstream.h>
#include <linux/amlogic/cpu_version.h>
#include <linux/clk.h>
@@ -54,33 +55,9 @@
#include "aml_dvb.h"
#include "aml_dvb_reg.h"
-#include "../../tv_frontend/aml_fe.h"
#include "aml_demod_gt.h"
#include "../../../common/media_clock/switch/amports_gate.h"
-typedef enum __demod_type
-{
- DEMOD_INVALID,
- DEMOD_INTERNAL,
- DEMOD_ATBM8881,
- DEMOD_SI2168,
- DEMOD_AVL6762,
- DEMOD_SI2168_1,
- DEMOD_MAX_NUM
-}demod_type;
-
-typedef enum __tuner_type
-{
- TUNER_INVALID,
- TUNER_SI2151,
- TUNER_MXL661,
- TUNER_SI2159,
- TUNER_R842,
- TUNER_R840,
- TUNER_ATBM2040,
- TUNER_MAX_NUM
-}tuner_type;
-
#define pr_dbg(args...)\
do {\
if (debug_dvb)\
@@ -95,7 +72,7 @@ module_param(debug_dvb, int, 0644);
#define CARD_NAME "amlogic-dvb"
-
+#define DVB_VERSION "V2.00"
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
@@ -107,8 +84,8 @@ static struct aml_dvb aml_dvb_device;
static struct class aml_stb_class;
static struct dvb_frontend *frontend[FE_DEV_COUNT] = {NULL, NULL};
-static demod_type s_demod_type[FE_DEV_COUNT] = {DEMOD_INVALID, DEMOD_INVALID};
-static tuner_type s_tuner_type[FE_DEV_COUNT] = {TUNER_INVALID, TUNER_INVALID};
+static enum dtv_demod_type s_demod_type[FE_DEV_COUNT] = {AM_DTV_DEMOD_NONE, AM_DTV_DEMOD_NONE};
+static enum tuner_type s_tuner_type[FE_DEV_COUNT] = {AM_TUNER_NONE, AM_TUNER_NONE};
static int dmx_reset_all_flag = 0;
#if 0
static struct reset_control *aml_dvb_demux_reset_ctl;
@@ -147,74 +124,6 @@ static struct tsdemux_ops aml_tsdemux_ops = {
.set_demux = aml_tsdemux_set_demux
};
-static int dvb_attach_tuner(struct dvb_frontend *fe, struct aml_tuner *tuner, tuner_type *type)
-{
- struct tuner_config *cfg = &tuner->cfg;
- struct i2c_adapter *i2c_adap = tuner->i2c_adp;
-
- switch (cfg->id) {
- case AM_TUNER_R840:
- if (!dvb_attach(r840_attach, fe, i2c_adap, cfg)) {
- pr_error("dvb attach r840_attach tuner error\n");
- return -1;
- } else {
- pr_inf("r840_attach attach sucess\n");
- *type = TUNER_R840;
- }
- break;
- case AM_TUNER_R842:
- if (!dvb_attach(r842_attach, fe, i2c_adap, cfg)) {
- pr_error("dvb attach r842_attach tuner error\n");
- return -1;
- } else {
- pr_inf("r842_attach attach sucess\n");
- *type = TUNER_R842;
- }
- break;
- case AM_TUNER_SI2151:
- if (!dvb_attach(si2151_attach, fe, i2c_adap, cfg)) {
- pr_error("dvb attach tuner error\n");
- return -1;
- } else {
- pr_inf("si2151 attach sucess\n");
- *type = TUNER_SI2151;
- }
- break;
- case AM_TUNER_SI2159:
- if (!dvb_attach(si2159_attach, fe, i2c_adap, cfg)) {
- pr_error("dvb attach si2159_attach tuner error\n");
- return -1;
- } else {
- pr_inf("si2159_attach attach sucess\n");
- *type = TUNER_SI2159;
- }
- break;
- case AM_TUNER_MXL661:
- if (!dvb_attach(mxl661_attach, fe, i2c_adap, cfg)) {
- pr_error("dvb attach mxl661_attach tuner error\n");
- return -1;
- } else {
- pr_inf("mxl661_attach attach sucess\n");
- *type = TUNER_MXL661;
- }
- break;
- case AM_TUNER_ATBM2040:
- if (!dvb_attach(atbm2040_attach, fe, i2c_adap, cfg)) {
- pr_error("dvb attach atbm2040_attach tuner error\n");
- return -1;
- } else {
- pr_inf("atbm2040_attach attach sucess\n");
- *type = TUNER_ATBM2040;
- }
- break;
- default:
- pr_error("can't support tuner type: %d\n", cfg->id);
- break;
- }
-
- return 0;
-}
-
long aml_stb_get_base(int id)
{
int newbase = 0;
@@ -786,7 +695,7 @@ static int aml_dvb_asyncfifo_init(struct aml_dvb *advb,
res = platform_get_resource_byname(advb->pdev, IORESOURCE_IRQ, buf);
if (res)
asyncfifo->asyncfifo_irq = res->start;
- pr_info("%s irq num:%d ", buf, asyncfifo->asyncfifo_irq);
+ pr_inf("%s irq num:%d \n", buf, asyncfifo->asyncfifo_irq);
asyncfifo->dvb = advb;
asyncfifo->id = id;
asyncfifo->init = 0;
@@ -1321,7 +1230,7 @@ static ssize_t demux##i##_reset_store(struct class *class, \
{\
if (!strncmp("1", buf, 1)) { \
struct aml_dvb *dvb = &aml_dvb_device; \
- pr_info("Reset demux["#i"], call dmx_reset_dmx_hw\n"); \
+ pr_inf("Reset demux["#i"], call dmx_reset_dmx_hw\n"); \
dmx_reset_dmx_id_hw_ex(dvb, i, 0); \
} \
return size; \
@@ -1843,9 +1752,13 @@ static ssize_t stb_store_tuner_setting(struct class *class,
if (frontend[i] == NULL)
continue;
- if (dvb_attach_tuner(frontend[i], tuner, &s_tuner_type[i]) < 0) {
- pr_error("attach tuner %d failed\n", dvb->tuner_cur);
+ if (aml_attach_tuner(tuner->cfg.id, frontend[i], &tuner->cfg) == NULL) {
+ s_tuner_type[i] = AM_TUNER_NONE;
+ pr_error("tuner[%d] [type = %d] attach error.\n", dvb->tuner_cur, tuner->cfg.id);
goto EXIT;
+ } else {
+ s_tuner_type[i] = tuner->cfg.id;
+ pr_error("tuner[%d] [type = %d] attach sucess.\n", dvb->tuner_cur, tuner->cfg.id);
}
}
@@ -2016,7 +1929,7 @@ static int aml_dvb_probe(struct platform_device *pdev)
int i, ret = 0;
struct devio_aml_platform_data *pd_dvb;
- pr_dbg("probe amlogic dvb driver\n");
+ pr_dbg("probe amlogic dvb driver [%s]\n", DVB_VERSION);
/*switch_mod_gate_by_name("demux", 1); */
#if 0
@@ -2251,6 +2164,7 @@ static int aml_dvb_probe(struct platform_device *pdev)
goto error;
}
+ aml_register_parser_mconfig();
#ifdef ENABLE_DEMUX_DRIVER
tsdemux_set_ops(&aml_tsdemux_ops);
#else
@@ -2259,32 +2173,34 @@ static int aml_dvb_probe(struct platform_device *pdev)
//pengcc add for dvb using linux TV frontend api init
{
- struct amlfe_exp_config config;
+ struct demod_config config;
+ struct tuner_config *tuner_cfg = NULL;
char buf[32];
const char *str = NULL;
struct device_node *node_tuner = NULL;
- struct device_node *node_i2c = NULL;
- u32 i2c_addr = 0xFFFFFFFF;
u32 value = 0;
int j = 0;
for (i=0; i<FE_DEV_COUNT; i++) {
+ memset(&config, 0, sizeof(struct demod_config));
+
memset(buf, 0, 32);
snprintf(buf, sizeof(buf), "fe%d_mode", i);
ret = of_property_read_string(pdev->dev.of_node, buf, &str);
if (ret) {
continue;
}
- if (!strcmp(str,"internal"))
- {
- config.set_mode = 0;
- frontend[i] = dvb_attach(aml_dtvdm_attach,&config);
+ if (!strcmp(str, "internal")) {
+ config.mode = 0;
+ config.id = AM_DTV_DEMOD_AMLDTV;
+ frontend[i] = aml_attach_dtvdemod(config.id, &config);
if (frontend[i] == NULL) {
- pr_error("dvb attach demod error\n");
+ s_demod_type[i] = AM_DTV_DEMOD_NONE;
+ pr_error("internal dtvdemod [type = %d] attach error.\n", config.id);
goto error_fe;
} else {
- pr_inf("dtvdemod attatch sucess\n");
- s_demod_type[i] = DEMOD_INTERNAL;
+ s_demod_type[i] = config.id;
+ pr_error("internal dtvdemod [type = %d] attach success.\n", config.id);
}
memset(buf, 0, 32);
@@ -2316,73 +2232,11 @@ static int aml_dvb_probe(struct platform_device *pdev)
advb->tuner_cur = value;
for (j = 0; j < advb->tuner_num; ++j) {
- snprintf(buf, sizeof(buf), "tuner_name_%d", j);
- ret = of_property_read_string(node_tuner, buf, &str);
+ ret = aml_get_dts_tuner_config(node_tuner, &advb->tuners[j].cfg, j);
if (ret) {
- //pr_error("tuner%d type error\n",i);
- ret = 0;
- continue;
- } else {
- if (!strncmp(str, "mxl661_tuner", 12))
- advb->tuners[j].cfg.id = AM_TUNER_MXL661;
- else if (!strncmp(str, "si2151_tuner", 12))
- advb->tuners[j].cfg.id = AM_TUNER_SI2151;
- else if (!strncmp(str, "si2159_tuner", 12))
- advb->tuners[j].cfg.id = AM_TUNER_SI2159;
- else if (!strncmp(str, "r840_tuner", 10))
- advb->tuners[j].cfg.id = AM_TUNER_R840;
- else if (!strncmp(str, "r842_tuner", 10))
- advb->tuners[j].cfg.id = AM_TUNER_R842;
- else if (!strncmp(str, "atbm2040_tuner", 14))
- advb->tuners[i].cfg.id = AM_TUNER_ATBM2040;
- else {
- pr_err("nonsupport tuner: %s.\n", str);
- advb->tuners[j].cfg.id = AM_TUNER_NONE;
- }
- }
-
- snprintf(buf, sizeof(buf), "tuner_i2c_adap_%d", j);
- node_i2c = of_parse_phandle(node_tuner, buf, 0);
- if (!node_i2c) {
- pr_error("tuner_i2c_adap_id error\n");
- } else {
- advb->tuners[j].i2c_adp = of_find_i2c_adapter_by_node(node_i2c);
- of_node_put(node_i2c);
- if (advb->tuners[j].i2c_adp == NULL) {
- pr_error("i2c_get_adapter error\n");
- of_node_put(node_tuner);
- goto error_fe;
- }
- }
-
- snprintf(buf, sizeof(buf), "tuner_i2c_addr_%d", j);
- ret = of_property_read_u32(node_tuner, buf, &i2c_addr);
- if (ret) {
- pr_error("i2c_addr error\n");
+ pr_err("can't find tuner.\n");
+ goto error_fe;
}
- else
- advb->tuners[j].cfg.i2c_addr = i2c_addr;
-
- snprintf(buf, sizeof(buf), "tuner_xtal_%d", j);
- ret = of_property_read_u32(node_tuner, buf, &value);
- if (ret)
- pr_err("tuner_xtal error.\n");
- else
- advb->tuners[j].cfg.xtal = value;
-
- snprintf(buf, sizeof(buf), "tuner_xtal_mode_%d", j);
- ret = of_property_read_u32(node_tuner, buf, &value);
- if (ret)
- pr_err("tuner_xtal_mode error.\n");
- else
- advb->tuners[j].cfg.xtal_mode = value;
-
- snprintf(buf, sizeof(buf), "tuner_xtal_cap_%d", j);
- ret = of_property_read_u32(node_tuner, buf, &value);
- if (ret)
- pr_err("tuner_xtal_cap error.\n");
- else
- advb->tuners[j].cfg.xtal_cap = value;
}
of_node_put(node_tuner);
@@ -2391,9 +2245,14 @@ static int aml_dvb_probe(struct platform_device *pdev)
frontend[i]->callback = NULL;
if (advb->tuner_cur >= 0) {
- if (dvb_attach_tuner(frontend[i], &advb->tuners[advb->tuner_cur], &s_tuner_type[i]) < 0) {
- pr_error("attach tuner failed\n");
+ tuner_cfg = &advb->tuners[advb->tuner_cur].cfg;
+ if (aml_attach_tuner(tuner_cfg->id, frontend[i], tuner_cfg) == NULL) {
+ s_tuner_type[i] = AM_TUNER_NONE;
+ pr_error("tuner [type = %d] attach error.\n", tuner_cfg->id);
goto error_fe;
+ } else {
+ s_tuner_type[i] = tuner_cfg->id;
+ pr_error("tuner [type = %d] attach sucess.\n", tuner_cfg->id);
}
}
@@ -2402,140 +2261,41 @@ static int aml_dvb_probe(struct platform_device *pdev)
pr_error("register dvb frontend failed\n");
goto error_fe;
}
- } else if(!strcmp(str,"external")) {
- const char *name = NULL;
- struct amlfe_demod_config config;
-
- config.dev_id = i;
- memset(buf, 0, 32);
- snprintf(buf, sizeof(buf), "fe%d_demod",i);
- ret = of_property_read_string(pdev->dev.of_node, buf, &name);
+ } else if(!strcmp(str, "external")) {
+ config.mode = 1;
+ config.id = AM_DTV_DEMOD_NONE;
+ ret = aml_get_dts_demod_config(pdev->dev.of_node, &config, i);
if (ret) {
- ret = 0;
+ pr_err("can't find demod %d.\n", i);
continue;
}
memset(buf, 0, 32);
- snprintf(buf, sizeof(buf), "fe%d_i2c_adap_id",i);
- node_i2c = of_parse_phandle(pdev->dev.of_node,buf,0);
- if (!node_i2c) {
- pr_error("demod%d_i2c_adap_id error\n", i);
- } else {
- config.i2c_adap = of_find_i2c_adapter_by_node(node_i2c);
- of_node_put(node_i2c);
- if (config.i2c_adap == NULL) {
- pr_error("i2c_get_adapter error\n");
- goto error_fe;
- }
- }
-
- memset(buf, 0, 32);
- snprintf(buf, sizeof(buf), "fe%d_demod_i2c_addr",i);
- ret = of_property_read_u32(pdev->dev.of_node, buf,&config.i2c_addr);
- if (ret) {
- pr_error("i2c_addr error\n");
- goto error_fe;
- }
+ snprintf(buf, sizeof(buf), "fe%d_tuner", i);
+ node_tuner = of_parse_phandle(pdev->dev.of_node, buf, 0);
+ if (node_tuner) {
+ aml_get_dts_tuner_config(node_tuner, &config.tuner0, 0);
+ aml_get_dts_tuner_config(node_tuner, &config.tuner1, 1);
+ } else
+ pr_err("can't find %s.\n", buf);
- memset(buf, 0, 32);
- snprintf(buf, sizeof(buf), "fe%d_ts",i);
- ret = of_property_read_u32(pdev->dev.of_node, buf,&config.ts);
- if (ret) {
- pr_error("ts error\n");
- goto error_fe;
- }
+ of_node_put(node_tuner);
- memset(buf, 0, 32);
- snprintf(buf, sizeof(buf), "fe%d_reset_gpio",i);
- ret = of_property_read_string(pdev->dev.of_node, buf, &str);
- if (!ret) {
- config.reset_gpio =
- of_get_named_gpio_flags(pdev->dev.of_node,
- buf, 0, NULL);
- pr_inf("%s: %d\n", buf, config.reset_gpio);
- } else {
- config.reset_gpio = -1;
- pr_error("cannot find resource \"%s\"\n", buf);
- goto error_fe;
- }
+ if (advb->ts[config.ts].mode == AM_TS_PARALLEL)
+ config.ts_out_mode = 1;
+ else
+ config.ts_out_mode = 0;
- memset(buf, 0, 32);
- snprintf(buf, sizeof(buf), "fe%d_reset_value",i);
- ret = of_property_read_u32(pdev->dev.of_node, buf,&config.reset_value);
- if (ret) {
- pr_error("reset_value error\n");
+ frontend[i] = aml_attach_dtvdemod(config.id, &config);
+ if (frontend[i] == NULL) {
+ s_demod_type[i] = AM_DTV_DEMOD_NONE;
+ pr_error("external dtvdemod [type = %d] attach error.\n", config.id);
goto error_fe;
- }
- memset(buf, 0, 32);
- snprintf(buf, sizeof(buf), "fe%d_tuner0_i2c_addr",i);
- ret = of_property_read_u32(pdev->dev.of_node, buf,&config.tuner0_i2c_addr);
- if (ret) {
- pr_error("no tuner0 i2c_addr define\n");
- }
- memset(buf, 0, 32);
- snprintf(buf, sizeof(buf), "fe%d_tuner1_i2c_addr",i);
- ret = of_property_read_u32(pdev->dev.of_node, buf,&config.tuner1_i2c_addr);
- if (ret) {
- pr_error("no tuner1 addr define\n");
- }
- memset(buf, 0, 32);
- snprintf(buf, sizeof(buf), "fe%d_tuner0_code",i);
- ret = of_property_read_u32(pdev->dev.of_node, buf,&config.tuner0_code);
- if (ret) {
- pr_error("no tuner0_code define\n");
- }
- memset(buf, 0, 32);
- snprintf(buf, sizeof(buf), "fe%d_tuner1_code",i);
- ret = of_property_read_u32(pdev->dev.of_node, buf,&config.tuner1_code);
- if (ret) {
- pr_error("no tuner1_code define\n");
- }
- if (advb->ts[config.ts].mode == AM_TS_PARALLEL) {
- config.ts_out_mode = 1;
} else {
- config.ts_out_mode = 0;
+ s_demod_type[i] = config.id;
+ pr_error("external dtvdemod [type = %d] attach success.\n", config.id);
}
- if (!strcmp(name,"Atbm8881")) {
- frontend[i] = dvb_attach(atbm8881_attach,&config);
- if (frontend[i] == NULL) {
- pr_error("dvb attach demod error\n");
- goto error_fe;
- } else {
- pr_inf("dtvdemod attatch sucess\n");
- s_demod_type[i] = DEMOD_ATBM8881;
- }
- }
- if (!strcmp(name,"Si2168")) {
- frontend[i] = dvb_attach(si2168_attach,&config);
- if (frontend[i] == NULL) {
- pr_error("dvb attach demod error\n");
- goto error_fe;
- } else {
- pr_inf("dtvdemod attatch sucess\n");
- s_demod_type[i] = DEMOD_SI2168;
- }
- }
- if (!strcmp(name,"Si2168-1")) {
- frontend[i] = dvb_attach(si2168_attach_1,&config);
- if (frontend[i] == NULL) {
- pr_error("dvb attach demod error\n");
- goto error_fe;
- } else {
- pr_inf("si2168_1 dtvdemod attatch sucess\n");
- s_demod_type[i] = DEMOD_SI2168_1;
- }
- }
- if (!strcmp(name,"Avl6762")) {
- frontend[i] = dvb_attach(avl6762_attach,&config);
- if (frontend[i] == NULL) {
- pr_error("dvb attach demod error\n");
- goto error_fe;
- } else {
- pr_inf("dtvdemod attatch sucess\n");
- s_demod_type[i] = DEMOD_AVL6762;
- }
- }
if (frontend[i]) {
ret = dvb_register_frontend(&advb->dvb_adapter, frontend[i]);
if (ret) {
@@ -2548,44 +2308,14 @@ static int aml_dvb_probe(struct platform_device *pdev)
return 0;
error_fe:
for (i=0; i<FE_DEV_COUNT; i++) {
- if (s_demod_type[i] == DEMOD_INTERNAL) {
- dvb_detach(aml_dtvdm_attach);
- frontend[i] = NULL;
- s_demod_type[i] = DEMOD_INVALID;
- }else if (s_demod_type[i] == DEMOD_ATBM8881) {
- dvb_detach(atbm8881_attach);
- frontend[i] = NULL;
- s_demod_type[i] = DEMOD_INVALID;
- }else if (s_demod_type[i] == DEMOD_SI2168) {
- dvb_detach(si2168_attach);
- frontend[i] = NULL;
- s_demod_type[i] = DEMOD_INVALID;
- }else if (s_demod_type[i] == DEMOD_SI2168_1) {
- dvb_detach(si2168_attach_1);
- frontend[i] = NULL;
- s_demod_type[i] = DEMOD_INVALID;
- }else if (s_demod_type[i] == DEMOD_AVL6762) {
- dvb_detach(avl6762_attach);
- frontend[i] = NULL;
- s_demod_type[i] = DEMOD_INVALID;
- }
- if (s_tuner_type[i] == TUNER_SI2151) {
- dvb_detach(si2151_attach);
- s_tuner_type[i] = TUNER_INVALID;
- }else if (s_tuner_type[i] == TUNER_MXL661) {
- dvb_detach(mxl661_attach);
- s_tuner_type[i] = TUNER_INVALID;
- }else if (s_tuner_type[i] == TUNER_SI2159) {
- dvb_detach(si2159_attach);
- s_tuner_type[i] = TUNER_INVALID;
- }else if (s_tuner_type[i] == TUNER_R842) {
- dvb_detach(r842_attach);
- s_tuner_type[i] = TUNER_INVALID;
- }else if (s_tuner_type[i] == TUNER_R840) {
- dvb_detach(r840_attach);
- s_tuner_type[i] = TUNER_INVALID;
- }
+ aml_detach_dtvdemod(s_demod_type[i]);
+ frontend[i] = NULL;
+ s_demod_type[i] = AM_DTV_DEMOD_NONE;
+
+ aml_detach_tuner(s_tuner_type[i]);
+ s_tuner_type[i] = AM_TUNER_NONE;
}
+
return 0;
}
@@ -2619,41 +2349,26 @@ static int aml_dvb_remove(struct platform_device *pdev)
int i;
for (i=0; i<FE_DEV_COUNT; i++) {
- if (s_demod_type[i] == DEMOD_INTERNAL) {
- dvb_detach(aml_dtvdm_attach);
- }else if (s_demod_type[i] == DEMOD_ATBM8881) {
- dvb_detach(atbm8881_attach);
- }else if (s_demod_type[i] == DEMOD_SI2168) {
- dvb_detach(si2168_attach);
- }else if (s_demod_type[i] == DEMOD_SI2168_1) {
- dvb_detach(si2168_attach_1);
- }else if (s_demod_type[i] == DEMOD_AVL6762) {
- dvb_detach(avl6762_attach);
- }
- if (s_tuner_type[i] == TUNER_SI2151) {
- dvb_detach(si2151_attach);
- }else if (s_tuner_type[i] == TUNER_MXL661) {
- dvb_detach(mxl661_attach);
- }else if (s_tuner_type[i] == TUNER_SI2159) {
- dvb_detach(si2159_attach);
- }else if (s_tuner_type[i] == TUNER_R842) {
- dvb_detach(r842_attach);
- }else if (s_tuner_type[i] == TUNER_R840) {
- dvb_detach(r840_attach);
- }
+ aml_detach_dtvdemod(s_demod_type[i]);
- if (frontend[i] && \
- ( (s_tuner_type[i] == TUNER_SI2151) || (s_tuner_type[i] == TUNER_MXL661) || (s_tuner_type[i] == TUNER_SI2159) || (s_tuner_type[i] == TUNER_R842) || (s_tuner_type[i] == TUNER_R840)) \
- )
- {
+ aml_detach_tuner(s_tuner_type[i]);
+
+ if (frontend[i] &&
+ ((s_tuner_type[i] == AM_TUNER_SI2151)
+ || (s_tuner_type[i] == AM_TUNER_MXL661)
+ || (s_tuner_type[i] == AM_TUNER_SI2159)
+ || (s_tuner_type[i] == AM_TUNER_R842)
+ || (s_tuner_type[i] == AM_TUNER_R840)
+ || (s_tuner_type[i] == AM_TUNER_ATBM2040))) {
dvb_unregister_frontend(frontend[i]);
dvb_frontend_detach(frontend[i]);
}
- frontend[i] = NULL;
- s_demod_type[i] = DEMOD_INVALID;
- s_tuner_type[i] = TUNER_INVALID;
+ frontend[i] = NULL;
+ s_demod_type[i] = AM_DTV_DEMOD_NONE;
+ s_tuner_type[i] = AM_TUNER_NONE;
}
+
tsdemux_set_ops(NULL);
aml_unregist_dmx_class();