Bladeren bron

V4L/DVB (13838): atbm8830: use AGC setting from config

Improves ATBM8830 reception by using per card AGC configuration rather
than register default.

Signed-off-by: David T. L. Wong <davidtlwong@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
David Wong 15 jaren geleden
bovenliggende
commit
c245c75c41

+ 3 - 0
drivers/media/dvb/dvb-usb/cxusb.c

@@ -1184,6 +1184,9 @@ static struct atbm8830_config mygica_d689_atbm8830_cfg = {
 	.osc_clk_freq = 30400, /* in kHz */
 	.osc_clk_freq = 30400, /* in kHz */
 	.if_freq = 0, /* zero IF */
 	.if_freq = 0, /* zero IF */
 	.zif_swap_iq = 1,
 	.zif_swap_iq = 1,
+	.agc_min = 0x2E,
+	.agc_max = 0x90,
+	.agc_hold_loop = 0,
 };
 };
 
 
 static int cxusb_mygica_d689_frontend_attach(struct dvb_usb_adapter *adap)
 static int cxusb_mygica_d689_frontend_attach(struct dvb_usb_adapter *adap)

+ 16 - 0
drivers/media/dvb/frontends/atbm8830.c

@@ -170,6 +170,19 @@ static int is_locked(struct atbm_state *priv, u8 *locked)
 	return 0;
 	return 0;
 }
 }
 
 
+static int set_agc_config(struct atbm_state *priv,
+	u8 min, u8 max, u8 hold_loop)
+{
+	/* no effect if both min and max are zero */
+	if (!min && !max)
+	    return 0;
+
+	atbm8830_write_reg(priv, REG_AGC_MIN, min);
+	atbm8830_write_reg(priv, REG_AGC_MAX, max);
+	atbm8830_write_reg(priv, REG_AGC_HOLD_LOOP, hold_loop);
+
+	return 0;
+}
 
 
 static int set_static_channel_mode(struct atbm_state *priv)
 static int set_static_channel_mode(struct atbm_state *priv)
 {
 {
@@ -227,6 +240,9 @@ static int atbm8830_init(struct dvb_frontend *fe)
 	/*Set IF frequency*/
 	/*Set IF frequency*/
 	set_if_freq(priv, cfg->if_freq);
 	set_if_freq(priv, cfg->if_freq);
 
 
+	/*Set AGC Config*/
+	set_agc_config(priv, cfg->agc_min, cfg->agc_max,
+		cfg->agc_hold_loop);
 
 
 	/*Set static channel mode*/
 	/*Set static channel mode*/
 	set_static_channel_mode(priv);
 	set_static_channel_mode(priv);

+ 6 - 0
drivers/media/video/cx23885/cx23885-dvb.c

@@ -542,6 +542,9 @@ static struct atbm8830_config mygica_x8558pro_atbm8830_cfg1 = {
 	.osc_clk_freq = 30400, /* in kHz */
 	.osc_clk_freq = 30400, /* in kHz */
 	.if_freq = 0, /* zero IF */
 	.if_freq = 0, /* zero IF */
 	.zif_swap_iq = 1,
 	.zif_swap_iq = 1,
+	.agc_min = 0x2E,
+	.agc_max = 0xFF,
+	.agc_hold_loop = 0,
 };
 };
 
 
 static struct max2165_config mygic_x8558pro_max2165_cfg1 = {
 static struct max2165_config mygic_x8558pro_max2165_cfg1 = {
@@ -558,6 +561,9 @@ static struct atbm8830_config mygica_x8558pro_atbm8830_cfg2 = {
 	.osc_clk_freq = 30400, /* in kHz */
 	.osc_clk_freq = 30400, /* in kHz */
 	.if_freq = 0, /* zero IF */
 	.if_freq = 0, /* zero IF */
 	.zif_swap_iq = 1,
 	.zif_swap_iq = 1,
+	.agc_min = 0x2E,
+	.agc_max = 0xFF,
+	.agc_hold_loop = 0,
 };
 };
 
 
 static struct max2165_config mygic_x8558pro_max2165_cfg2 = {
 static struct max2165_config mygic_x8558pro_max2165_cfg2 = {