#include <linux/err.h> /*IS_ERR*/
#include <linux/clk.h> /*clk tree*/
#include <linux/of_device.h>
+#include <linux/of_reserved_mem.h>
#ifdef ARC_700
{
/*struct dtv_frontend_properties *c = &fe->dtv_property_cache;*/
int ret = 0;
- unsigned int up_delay;
+// unsigned int up_delay;
unsigned int firstdetet;
return ret;
}
-#if 0 /**/
+#if 1 /**/
*delay = HZ / 4;
gxtv_demod_dtmb_read_status_old(fe, status);
#else /*try polling*/
PR_DBG("%s:\n", __func__);
+ ret = of_reserved_mem_device_init(&pdev->dev);
+ if (ret != 0)
+ PR_INFO("no reserved mem.\n");
+
/*agc pinmux: option*/
ret = of_property_read_string(pdev->dev.of_node, "pinctrl-names",
PR_INFO("[amldtvdemod..]%s: driver removed ok.\n", __func__);
}
-
+#if 0
static int delsys_confirm(struct dvb_frontend *fe)
{
enum fe_delivery_system ldelsys = dtvdd_devp->last_delsys;
return 0;
}
-
+#endif
static int delsys_set(struct dvb_frontend *fe, unsigned int delsys)
{
enum fe_delivery_system ldelsys = dtvdd_devp->last_delsys;
fe->ops.info.type = FE_ATSC;
else if (mode == AM_FE_OFDM_N || mode == AM_FE_ISDBT_N)
fe->ops.info.type = FE_OFDM;
-
+ else if (mode == AM_FE_DTMB_N)
+ fe->ops.info.type = FE_DTMB;
+ else if (mode == AM_FE_QAM_N)
+ fe->ops.info.type = FE_QAM;
fe->ops.tuner_ops.set_config(fe, NULL);
#endif
}
static int aml_dtvdm_sleep(struct dvb_frontend *fe)
{
+ enum aml_fe_n_mode_t nmode = dtvdd_devp->n_mode;
+
+ if (get_dtvpll_init_flag()) {
+ PR_INFO("%s\n", __func__);
+ leave_mode(nmode);
+ if (fe->ops.tuner_ops.release)
+ fe->ops.tuner_ops.release(fe);
+ dtvdd_devp->last_delsys = SYS_UNDEFINED;
+ dtvdd_devp->n_mode = AM_FE_UNKNOWN_N;
+ }
return 0;
}
static int aml_dtvdm_set_parameters(struct dvb_frontend *fe)
PR_INFO("%s", __func__);
- delsys_confirm(fe);
+ /*delsys_confirm(fe);*/
if (is_not_active(fe)) {
PR_DBG("set parm:not active\n");
return 0;
break;
}
+
+ if (get_dtvpll_init_flag()) {
+ PR_INFO("%s\n", __func__);
+ leave_mode(nmode);
+ if (fe->ops.tuner_ops.release)
+ fe->ops.tuner_ops.release(fe);
+ dtvdd_devp->last_delsys = SYS_UNDEFINED;
+ dtvdd_devp->n_mode = AM_FE_UNKNOWN_N;
+ }
}
static int flg; /*debug only*/
if (re_tune)
- delsys_confirm(fe);
+ ;//delsys_confirm(fe);
if (nmode == AM_FE_UNKNOWN_N) {
*delay = HZ * 5;
};
static struct dvb_frontend_ops aml_dtvdm_txl_ops = {
- .delsys = { SYS_DVBC_ANNEX_A, SYS_DTMB},
+ .delsys = { /*SYS_DVBC_ANNEX_A,*/ SYS_DTMB, SYS_ANALOG},
.info = {
/*in aml_fe, it is 'amlogic dvb frontend' */
- .name = "amlogic dtv demod txlx",
+ .name = "amlogic dtv demod txl",
.frequency_min = 51000000,
.frequency_max = 900000000,
.frequency_stepsize = 0,
int time_cnt;
time_cnt = 0;
- /*ary temp dtmb_information();*/
+ dtmb_information();
if (check_dtmb_fec_lock() != 1) {
while ((time_cnt < 10) && (check_dtmb_fec_lock() != 1)) {
msleep(demod_timeout);
time_cnt++;
- /*ary temp dtmb_information();*/
+ dtmb_information();
if (((dtmb_read_reg(DTMB_TOP_CTRL_CHE_WORKCNT)
>> 21) & 0x1) == 0x1) {
PR_DTMB("4qam-nr,need set spectrum\n");
}
}
if (time_cnt > 8)
- PR_DTMB
- ("* time_cnt = %d\n", time_cnt);
+ PR_DTMB("* time_cnt = %d\n", time_cnt);
}
if (time_cnt >= 10 && (check_dtmb_fec_lock() != 1)) {
time_cnt = 0;
dtmb_spectrum = 1;
else
dtmb_spectrum = 0;
- PR_DTMB
- ("*all reset,timeout is %d\n", demod_timeout);
+ PR_DTMB("*all reset,timeout is %d\n", demod_timeout);
}
} else {
dtmb_bch_check();
/*fsm status is 4,maybe analog signal*/
dtmb_status = dtmb_read_reg(DTMB_TOP_CTRL_FSM_STATE0);
+ PR_DTMB("fsm_status is %x\n", dtmb_status);
for (i = 0 ; i < 8 ; i++) {
if (((dtmb_status >> (i*4)) & 0xf) > 4) {
/*(7->8) 8ms,(8->9) 55ms, (9->a) 350ms*/
msleep(500);
dtmb_status = dtmb_read_reg(DTMB_TOP_CTRL_FSM_STATE0);
+ PR_DTMB("fsm_status2 is %x\n", dtmb_status);
for (i = 0 ; i < 8 ; i++) {
if (((dtmb_status >> (i*4))
& 0xf) > 6) {
PR_DTMB("[DTV]has_signal is %d\n", has_signal);
if ((has_signal == 0) || (has_signal == 0x1)) {
- timeout = 1; /*FE_TIMEDOUT;*/
+ //timeout = 1; /*FE_TIMEDOUT;*/
+ timeout = 0; /*FE_TIMEDOUT;*/
PR_DTMB("\t timeout\n");
} else {