aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorOlivier Grenie <olivier.grenie@dibcom.fr>2011-08-05 12:49:33 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-11-24 17:48:11 -0500
commit6724a2f4f7a6cb9251641a46e1ab06bb85adf1b5 (patch)
treeb924ea227c503e0db722baad647983ce1f16bfb2 /drivers/media/dvb
parent2e802861403c95ad6a566ff6d7a1a1a45d29c30e (diff)
[media] dib7090: add the reference board TFE7090E
The intend of this patch is to add the support for the DiBcom reference board TFE7090E. Signed-off-by: Olivier Grenie <olivier.grenie@dibcom.fr> Signed-off-by: Patrick Boettcher <patrick.boettcher@dibcom.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_devices.c196
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-ids.h1
-rw-r--r--drivers/media/dvb/frontends/dib0090.c146
-rw-r--r--drivers/media/dvb/frontends/dib0090.h46
-rw-r--r--drivers/media/dvb/frontends/dib7000p.c18
-rw-r--r--drivers/media/dvb/frontends/dib7000p.h9
6 files changed, 406 insertions, 10 deletions
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c
index 771dfdaa232c..aeab321cc212 100644
--- a/drivers/media/dvb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c
@@ -1518,7 +1518,7 @@ static int dib8096_set_param_override(struct dvb_frontend *fe,
1518 if (ret < 0) 1518 if (ret < 0)
1519 return ret; 1519 return ret;
1520 1520
1521 target = (dib0090_get_wbd_offset(fe) * 8 * 18 / 33 + 1) / 2; 1521 target = (dib0090_get_wbd_target(fe) * 8 * 18 / 33 + 1) / 2;
1522 dib8000_set_wbd_ref(fe, target); 1522 dib8000_set_wbd_ref(fe, target);
1523 1523
1524 1524
@@ -2079,7 +2079,7 @@ static int dib7090_agc_startup(struct dvb_frontend *fe, struct dvb_frontend_para
2079 2079
2080 memset(&pll, 0, sizeof(struct dibx000_bandwidth_config)); 2080 memset(&pll, 0, sizeof(struct dibx000_bandwidth_config));
2081 dib0090_pwm_gain_reset(fe); 2081 dib0090_pwm_gain_reset(fe);
2082 target = (dib0090_get_wbd_offset(fe) * 8 + 1) / 2; 2082 target = (dib0090_get_wbd_target(fe) * 8 + 1) / 2;
2083 dib7000p_set_wbd_ref(fe, target); 2083 dib7000p_set_wbd_ref(fe, target);
2084 2084
2085 if (dib7090p_get_best_sampling(fe, &adc) == 0) { 2085 if (dib7090p_get_best_sampling(fe, &adc) == 0) {
@@ -2100,6 +2100,41 @@ static int dib7090_agc_restart(struct dvb_frontend *fe, u8 restart)
2100 return 0; 2100 return 0;
2101} 2101}
2102 2102
2103static int dib7090e_update_lna(struct dvb_frontend *fe, u16 agc_global)
2104{
2105 u16 agc1 = 0, agc2, wbd = 0, wbd_target, wbd_offset, threshold_agc1;
2106 s16 wbd_delta;
2107
2108 if ((fe->dtv_property_cache.frequency) < 400000000)
2109 threshold_agc1 = 25000;
2110 else
2111 threshold_agc1 = 30000;
2112
2113 wbd_target = (dib0090_get_wbd_target(fe)*8+1)/2;
2114 wbd_offset = dib0090_get_wbd_offset(fe);
2115 dib7000p_get_agc_values(fe, NULL, &agc1, &agc2, &wbd);
2116 wbd_delta = (s16)wbd - (((s16)wbd_offset+10)*4) ;
2117
2118 deb_info("update lna, agc_global=%d agc1=%d agc2=%d",
2119 agc_global, agc1, agc2);
2120 deb_info("update lna, wbd=%d wbd target=%d wbd offset=%d wbd delta=%d",
2121 wbd, wbd_target, wbd_offset, wbd_delta);
2122
2123 if ((agc1 < threshold_agc1) && (wbd_delta > 0)) {
2124 dib0090_set_switch(fe, 1, 1, 1);
2125 dib0090_set_vga(fe, 0);
2126 dib0090_update_rframp_7090(fe, 0);
2127 dib0090_update_tuning_table_7090(fe, 0);
2128 } else {
2129 dib0090_set_vga(fe, 1);
2130 dib0090_update_rframp_7090(fe, 1);
2131 dib0090_update_tuning_table_7090(fe, 1);
2132 dib0090_set_switch(fe, 0, 0, 0);
2133 }
2134
2135 return 0;
2136}
2137
2103static struct dib0090_wbd_slope dib7090_wbd_table[] = { 2138static struct dib0090_wbd_slope dib7090_wbd_table[] = {
2104 { 380, 81, 850, 64, 540, 4}, 2139 { 380, 81, 850, 64, 540, 4},
2105 { 860, 51, 866, 21, 375, 4}, 2140 { 860, 51, 866, 21, 375, 4},
@@ -2108,6 +2143,15 @@ static struct dib0090_wbd_slope dib7090_wbd_table[] = {
2108 { 0xFFFF, 0, 0, 0, 0, 0}, 2143 { 0xFFFF, 0, 0, 0, 0, 0},
2109}; 2144};
2110 2145
2146static struct dib0090_wbd_slope dib7090e_wbd_table[] = {
2147 { 380, 81, 850, 64, 540, 4},
2148 { 700, 51, 866, 21, 320, 4},
2149 { 860, 48, 666, 18, 330, 6},
2150 {1700, 0, 250, 0, 100, 6},
2151 {2600, 0, 250, 0, 100, 6},
2152 { 0xFFFF, 0, 0, 0, 0, 0},
2153};
2154
2111struct dibx000_agc_config dib7090_agc_config[2] = { 2155struct dibx000_agc_config dib7090_agc_config[2] = {
2112 { 2156 {
2113 .band_caps = BAND_UHF, 2157 .band_caps = BAND_UHF,
@@ -2286,6 +2330,34 @@ static struct dib7000p_config tfe7090pvr_dib7000p_config[2] = {
2286 } 2330 }
2287}; 2331};
2288 2332
2333static struct dib7000p_config tfe7090e_dib7000p_config = {
2334 .output_mpeg2_in_188_bytes = 1,
2335 .hostbus_diversity = 1,
2336 .tuner_is_baseband = 1,
2337 .update_lna = dib7090e_update_lna,
2338
2339 .agc_config_count = 2,
2340 .agc = dib7090_agc_config,
2341
2342 .bw = &dib7090_clock_config_12_mhz,
2343
2344 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2345 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2346 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2347
2348 .pwm_freq_div = 0,
2349
2350 .agc_control = dib7090_agc_restart,
2351
2352 .spur_protect = 0,
2353 .disable_sample_and_hold = 0,
2354 .enable_current_mirror = 0,
2355 .diversity_delay = 0,
2356
2357 .output_mode = OUTMODE_MPEG2_FIFO,
2358 .enMpegOutput = 1,
2359};
2360
2289static const struct dib0090_config nim7090_dib0090_config = { 2361static const struct dib0090_config nim7090_dib0090_config = {
2290 .io.clock_khz = 12000, 2362 .io.clock_khz = 12000,
2291 .io.pll_bypass = 0, 2363 .io.pll_bypass = 0,
@@ -2320,6 +2392,42 @@ static const struct dib0090_config nim7090_dib0090_config = {
2320 .in_soc = 1, 2392 .in_soc = 1,
2321}; 2393};
2322 2394
2395static const struct dib0090_config tfe7090e_dib0090_config = {
2396 .io.clock_khz = 12000,
2397 .io.pll_bypass = 0,
2398 .io.pll_range = 0,
2399 .io.pll_prediv = 3,
2400 .io.pll_loopdiv = 6,
2401 .io.adc_clock_ratio = 0,
2402 .io.pll_int_loop_filt = 0,
2403 .reset = dib7090_tuner_sleep,
2404 .sleep = dib7090_tuner_sleep,
2405
2406 .freq_offset_khz_uhf = 0,
2407 .freq_offset_khz_vhf = 0,
2408
2409 .get_adc_power = dib7090_get_adc_power,
2410
2411 .clkouttobamse = 1,
2412 .analog_output = 0,
2413
2414 .wbd_vhf_offset = 0,
2415 .wbd_cband_offset = 0,
2416 .use_pwm_agc = 1,
2417 .clkoutdrive = 0,
2418
2419 .fref_clock_ratio = 0,
2420
2421 .wbd = dib7090e_wbd_table,
2422
2423 .ls_cfg_pad_drv = 0,
2424 .data_tx_drv = 0,
2425 .low_if = NULL,
2426 .in_soc = 1,
2427 .force_cband_input = 1,
2428 .is_dib7090e = 1,
2429};
2430
2323static const struct dib0090_config tfe7090pvr_dib0090_config[2] = { 2431static const struct dib0090_config tfe7090pvr_dib0090_config[2] = {
2324 { 2432 {
2325 .io.clock_khz = 12000, 2433 .io.clock_khz = 12000,
@@ -2512,6 +2620,49 @@ static int tfe7090pvr_tuner1_attach(struct dvb_usb_adapter *adap)
2512 return 0; 2620 return 0;
2513} 2621}
2514 2622
2623static int tfe7090e_frontend_attach(struct dvb_usb_adapter *adap)
2624{
2625 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2626 msleep(20);
2627 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2628 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2629 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2630 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2631
2632 msleep(20);
2633 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2634 msleep(20);
2635 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2636
2637 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap,
2638 1, 0x10, &tfe7090e_dib7000p_config) != 0) {
2639 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
2640 __func__);
2641 return -ENODEV;
2642 }
2643 adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,
2644 0x80, &tfe7090e_dib7000p_config);
2645
2646 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
2647}
2648
2649static int tfe7090e_tuner_attach(struct dvb_usb_adapter *adap)
2650{
2651 struct dib0700_adapter_state *st = adap->priv;
2652 struct i2c_adapter *tun_i2c =
2653 dib7090_get_i2c_tuner(adap->fe_adap[0].fe);
2654
2655 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c,
2656 &tfe7090e_dib0090_config) == NULL)
2657 return -ENODEV;
2658
2659 dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
2660
2661 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
2662 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
2663 return 0;
2664}
2665
2515/* STK7070PD */ 2666/* STK7070PD */
2516static struct dib7000p_config stk7070pd_dib7000p_config[2] = { 2667static struct dib7000p_config stk7070pd_dib7000p_config[2] = {
2517 { 2668 {
@@ -2968,6 +3119,7 @@ struct usb_device_id dib0700_usb_id_table[] = {
2968/* 75 */{ USB_DEVICE(USB_VID_MEDION, USB_PID_CREATIX_CTX1921) }, 3119/* 75 */{ USB_DEVICE(USB_VID_MEDION, USB_PID_CREATIX_CTX1921) },
2969 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV340E) }, 3120 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV340E) },
2970 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV340E_SE) }, 3121 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV340E_SE) },
3122 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7090E) },
2971 { 0 } /* Terminating entry */ 3123 { 0 } /* Terminating entry */
2972}; 3124};
2973MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table); 3125MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
@@ -4033,6 +4185,46 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4033 RC_TYPE_NEC, 4185 RC_TYPE_NEC,
4034 .change_protocol = dib0700_change_protocol, 4186 .change_protocol = dib0700_change_protocol,
4035 }, 4187 },
4188 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4189 .num_adapters = 1,
4190 .adapter = {
4191 {
4192 .num_frontends = 1,
4193 .fe = {{
4194 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4195 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4196 .pid_filter_count = 32,
4197 .pid_filter = stk70x0p_pid_filter,
4198 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4199 .frontend_attach = tfe7090e_frontend_attach,
4200 .tuner_attach = tfe7090e_tuner_attach,
4201
4202 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4203 } },
4204
4205 .size_of_priv =
4206 sizeof(struct dib0700_adapter_state),
4207 },
4208 },
4209
4210 .num_device_descs = 1,
4211 .devices = {
4212 { "DiBcom TFE7090E reference design",
4213 { &dib0700_usb_id_table[78], NULL },
4214 { NULL },
4215 },
4216 },
4217
4218 .rc.core = {
4219 .rc_interval = DEFAULT_RC_INTERVAL,
4220 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4221 .module_name = "dib0700",
4222 .rc_query = dib0700_rc_query_old_firmware,
4223 .allowed_protos = RC_TYPE_RC5 |
4224 RC_TYPE_RC6 |
4225 RC_TYPE_NEC,
4226 .change_protocol = dib0700_change_protocol,
4227 },
4036 }, 4228 },
4037}; 4229};
4038 4230
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
index 0040aa24f89f..908a61627b83 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
@@ -113,6 +113,7 @@
113#define USB_PID_DIBCOM_STK7770P 0x1e80 113#define USB_PID_DIBCOM_STK7770P 0x1e80
114#define USB_PID_DIBCOM_NIM7090 0x1bb2 114#define USB_PID_DIBCOM_NIM7090 0x1bb2
115#define USB_PID_DIBCOM_TFE7090PVR 0x1bb4 115#define USB_PID_DIBCOM_TFE7090PVR 0x1bb4
116#define USB_PID_DIBCOM_TFE7090E 0x1bb7
116#define USB_PID_DIBCOM_NIM9090M 0x2383 117#define USB_PID_DIBCOM_NIM9090M 0x2383
117#define USB_PID_DIBCOM_NIM9090MD 0x2384 118#define USB_PID_DIBCOM_NIM9090MD 0x2384
118#define USB_PID_DPOSH_M9206_COLD 0x9206 119#define USB_PID_DPOSH_M9206_COLD 0x9206
diff --git a/drivers/media/dvb/frontends/dib0090.c b/drivers/media/dvb/frontends/dib0090.c
index 9030f3dc95f9..26c6c615f18d 100644
--- a/drivers/media/dvb/frontends/dib0090.c
+++ b/drivers/media/dvb/frontends/dib0090.c
@@ -717,6 +717,34 @@ static const u16 rf_ramp_pwm_cband_7090[] = {
717 (0 << 10) | 109, /* RF_RAMP4, LNA 4 */ 717 (0 << 10) | 109, /* RF_RAMP4, LNA 4 */
718}; 718};
719 719
720static const uint16_t rf_ramp_pwm_cband_7090e_sensitivity[] = {
721 186,
722 40,
723 746,
724 (10 << 10) | 345,
725 (0 << 10) | 746,
726 (0 << 10) | 0,
727 (0 << 10) | 0,
728 (28 << 10) | 200,
729 (0 << 10) | 345,
730 (20 << 10) | 0,
731 (0 << 10) | 200,
732};
733
734static const uint16_t rf_ramp_pwm_cband_7090e_aci[] = {
735 86,
736 40,
737 345,
738 (0 << 10) | 0,
739 (0 << 10) | 0,
740 (0 << 10) | 0,
741 (0 << 10) | 0,
742 (28 << 10) | 200,
743 (0 << 10) | 345,
744 (20 << 10) | 0,
745 (0 << 10) | 200,
746};
747
720static const u16 rf_ramp_pwm_cband_8090[] = { 748static const u16 rf_ramp_pwm_cband_8090[] = {
721 345, /* max RF gain in 10th of dB */ 749 345, /* max RF gain in 10th of dB */
722 29, /* ramp_slope = 1dB of gain -> clock_ticks_per_db = clk_khz / ramp_slope -> RF_RAMP2 */ 750 29, /* ramp_slope = 1dB of gain -> clock_ticks_per_db = clk_khz / ramp_slope -> RF_RAMP2 */
@@ -1076,8 +1104,16 @@ void dib0090_pwm_gain_reset(struct dvb_frontend *fe)
1076 dib0090_set_bbramp_pwm(state, bb_ramp_pwm_normal_socs); 1104 dib0090_set_bbramp_pwm(state, bb_ramp_pwm_normal_socs);
1077 if (state->identity.version == SOC_8090_P1G_11R1 || state->identity.version == SOC_8090_P1G_21R1) 1105 if (state->identity.version == SOC_8090_P1G_11R1 || state->identity.version == SOC_8090_P1G_21R1)
1078 dib0090_set_rframp_pwm(state, rf_ramp_pwm_cband_8090); 1106 dib0090_set_rframp_pwm(state, rf_ramp_pwm_cband_8090);
1079 else if (state->identity.version == SOC_7090_P1G_11R1 || state->identity.version == SOC_7090_P1G_21R1) 1107 else if (state->identity.version == SOC_7090_P1G_11R1
1080 dib0090_set_rframp_pwm(state, rf_ramp_pwm_cband_7090); 1108 || state->identity.version == SOC_7090_P1G_21R1) {
1109 if (state->config->is_dib7090e) {
1110 if (state->rf_ramp == NULL)
1111 dib0090_set_rframp_pwm(state, rf_ramp_pwm_cband_7090e_sensitivity);
1112 else
1113 dib0090_set_rframp_pwm(state, state->rf_ramp);
1114 } else
1115 dib0090_set_rframp_pwm(state, rf_ramp_pwm_cband_7090);
1116 }
1081 } else { 1117 } else {
1082 dib0090_set_rframp_pwm(state, rf_ramp_pwm_cband); 1118 dib0090_set_rframp_pwm(state, rf_ramp_pwm_cband);
1083 dib0090_set_bbramp_pwm(state, bb_ramp_pwm_normal); 1119 dib0090_set_bbramp_pwm(state, bb_ramp_pwm_normal);
@@ -1313,7 +1349,7 @@ void dib0090_get_current_gain(struct dvb_frontend *fe, u16 * rf, u16 * bb, u16 *
1313 1349
1314EXPORT_SYMBOL(dib0090_get_current_gain); 1350EXPORT_SYMBOL(dib0090_get_current_gain);
1315 1351
1316u16 dib0090_get_wbd_offset(struct dvb_frontend *fe) 1352u16 dib0090_get_wbd_target(struct dvb_frontend *fe)
1317{ 1353{
1318 struct dib0090_state *state = fe->tuner_priv; 1354 struct dib0090_state *state = fe->tuner_priv;
1319 u32 f_MHz = state->fe->dtv_property_cache.frequency / 1000000; 1355 u32 f_MHz = state->fe->dtv_property_cache.frequency / 1000000;
@@ -1350,9 +1386,57 @@ u16 dib0090_get_wbd_offset(struct dvb_frontend *fe)
1350 1386
1351 return state->wbd_offset + wbd_tcold; 1387 return state->wbd_offset + wbd_tcold;
1352} 1388}
1389EXPORT_SYMBOL(dib0090_get_wbd_target);
1353 1390
1391u16 dib0090_get_wbd_offset(struct dvb_frontend *fe)
1392{
1393 struct dib0090_state *state = fe->tuner_priv;
1394 return state->wbd_offset;
1395}
1354EXPORT_SYMBOL(dib0090_get_wbd_offset); 1396EXPORT_SYMBOL(dib0090_get_wbd_offset);
1355 1397
1398int dib0090_set_switch(struct dvb_frontend *fe, u8 sw1, u8 sw2, u8 sw3)
1399{
1400 struct dib0090_state *state = fe->tuner_priv;
1401
1402 dib0090_write_reg(state, 0x0b, (dib0090_read_reg(state, 0x0b) & 0xfff8)
1403 | ((sw3 & 1) << 2) | ((sw2 & 1) << 1) | (sw1 & 1));
1404
1405 return 0;
1406}
1407EXPORT_SYMBOL(dib0090_set_switch);
1408
1409int dib0090_set_vga(struct dvb_frontend *fe, u8 onoff)
1410{
1411 struct dib0090_state *state = fe->tuner_priv;
1412
1413 dib0090_write_reg(state, 0x09, (dib0090_read_reg(state, 0x09) & 0x7fff)
1414 | ((onoff & 1) << 15));
1415 return 0;
1416}
1417EXPORT_SYMBOL(dib0090_set_vga);
1418
1419int dib0090_update_rframp_7090(struct dvb_frontend *fe, u8 cfg_sensitivity)
1420{
1421 struct dib0090_state *state = fe->tuner_priv;
1422
1423 if ((!state->identity.p1g) || (!state->identity.in_soc)
1424 || ((state->identity.version != SOC_7090_P1G_21R1)
1425 && (state->identity.version != SOC_7090_P1G_11R1))) {
1426 dprintk("%s() function can only be used for dib7090P", __func__);
1427 return -ENODEV;
1428 }
1429
1430 if (cfg_sensitivity)
1431 state->rf_ramp = (const u16 *)&rf_ramp_pwm_cband_7090e_sensitivity;
1432 else
1433 state->rf_ramp = (const u16 *)&rf_ramp_pwm_cband_7090e_aci;
1434 dib0090_pwm_gain_reset(fe);
1435
1436 return 0;
1437}
1438EXPORT_SYMBOL(dib0090_update_rframp_7090);
1439
1356static const u16 dib0090_defaults[] = { 1440static const u16 dib0090_defaults[] = {
1357 1441
1358 25, 0x01, 1442 25, 0x01,
@@ -1962,6 +2046,52 @@ static const struct dib0090_tuning dib0090_tuning_table_cband_7090[] = {
1962#endif 2046#endif
1963}; 2047};
1964 2048
2049static const struct dib0090_tuning dib0090_tuning_table_cband_7090e_sensitivity[] = {
2050#ifdef CONFIG_BAND_CBAND
2051 { 300000, 0 , 3, 0x8105, 0x2c0, 0x2d12, 0xb84e, EN_CAB },
2052 { 380000, 0 , 10, 0x810F, 0x2c0, 0x2d12, 0xb84e, EN_CAB },
2053 { 600000, 0 , 10, 0x815E, 0x280, 0x2d12, 0xb84e, EN_CAB },
2054 { 660000, 0 , 5, 0x85E3, 0x280, 0x2d12, 0xb84e, EN_CAB },
2055 { 720000, 0 , 5, 0x852E, 0x280, 0x2d12, 0xb84e, EN_CAB },
2056 { 860000, 0 , 4, 0x85E5, 0x280, 0x2d12, 0xb84e, EN_CAB },
2057#endif
2058};
2059
2060int dib0090_update_tuning_table_7090(struct dvb_frontend *fe,
2061 u8 cfg_sensitivity)
2062{
2063 struct dib0090_state *state = fe->tuner_priv;
2064 const struct dib0090_tuning *tune =
2065 dib0090_tuning_table_cband_7090e_sensitivity;
2066 const struct dib0090_tuning dib0090_tuning_table_cband_7090e_aci[] = {
2067 { 300000, 0 , 3, 0x8165, 0x2c0, 0x2d12, 0xb84e, EN_CAB },
2068 { 650000, 0 , 4, 0x815B, 0x280, 0x2d12, 0xb84e, EN_CAB },
2069 { 860000, 0 , 5, 0x84EF, 0x280, 0x2d12, 0xb84e, EN_CAB },
2070 };
2071
2072 if ((!state->identity.p1g) || (!state->identity.in_soc)
2073 || ((state->identity.version != SOC_7090_P1G_21R1)
2074 && (state->identity.version != SOC_7090_P1G_11R1))) {
2075 dprintk("%s() function can only be used for dib7090", __func__);
2076 return -ENODEV;
2077 }
2078
2079 if (cfg_sensitivity)
2080 tune = dib0090_tuning_table_cband_7090e_sensitivity;
2081 else
2082 tune = dib0090_tuning_table_cband_7090e_aci;
2083
2084 while (state->rf_request > tune->max_freq)
2085 tune++;
2086
2087 dib0090_write_reg(state, 0x09, (dib0090_read_reg(state, 0x09) & 0x8000)
2088 | (tune->lna_bias & 0x7fff));
2089 dib0090_write_reg(state, 0x0b, (dib0090_read_reg(state, 0x0b) & 0xf83f)
2090 | ((tune->lna_tune << 6) & 0x07c0));
2091 return 0;
2092}
2093EXPORT_SYMBOL(dib0090_update_tuning_table_7090);
2094
1965static int dib0090_captrim_search(struct dib0090_state *state, enum frontend_tune_state *tune_state) 2095static int dib0090_captrim_search(struct dib0090_state *state, enum frontend_tune_state *tune_state)
1966{ 2096{
1967 int ret = 0; 2097 int ret = 0;
@@ -2210,12 +2340,18 @@ static int dib0090_tune(struct dvb_frontend *fe)
2210 if (state->current_band & BAND_CBAND || state->current_band & BAND_FM || state->current_band & BAND_VHF 2340 if (state->current_band & BAND_CBAND || state->current_band & BAND_FM || state->current_band & BAND_VHF
2211 || state->current_band & BAND_UHF) { 2341 || state->current_band & BAND_UHF) {
2212 state->current_band = BAND_CBAND; 2342 state->current_band = BAND_CBAND;
2213 tune = dib0090_tuning_table_cband_7090; 2343 if (state->config->is_dib7090e)
2344 tune = dib0090_tuning_table_cband_7090e_sensitivity;
2345 else
2346 tune = dib0090_tuning_table_cband_7090;
2214 } 2347 }
2215 } else { /* Use the CBAND input for all band under UHF */ 2348 } else { /* Use the CBAND input for all band under UHF */
2216 if (state->current_band & BAND_CBAND || state->current_band & BAND_FM || state->current_band & BAND_VHF) { 2349 if (state->current_band & BAND_CBAND || state->current_band & BAND_FM || state->current_band & BAND_VHF) {
2217 state->current_band = BAND_CBAND; 2350 state->current_band = BAND_CBAND;
2218 tune = dib0090_tuning_table_cband_7090; 2351 if (state->config->is_dib7090e)
2352 tune = dib0090_tuning_table_cband_7090e_sensitivity;
2353 else
2354 tune = dib0090_tuning_table_cband_7090;
2219 } 2355 }
2220 } 2356 }
2221 } else 2357 } else
diff --git a/drivers/media/dvb/frontends/dib0090.h b/drivers/media/dvb/frontends/dib0090.h
index 648318ae40d2..781dc49de45b 100644
--- a/drivers/media/dvb/frontends/dib0090.h
+++ b/drivers/media/dvb/frontends/dib0090.h
@@ -80,14 +80,21 @@ extern struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c
80extern struct dvb_frontend *dib0090_fw_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config); 80extern struct dvb_frontend *dib0090_fw_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config);
81extern void dib0090_dcc_freq(struct dvb_frontend *fe, u8 fast); 81extern void dib0090_dcc_freq(struct dvb_frontend *fe, u8 fast);
82extern void dib0090_pwm_gain_reset(struct dvb_frontend *fe); 82extern void dib0090_pwm_gain_reset(struct dvb_frontend *fe);
83extern u16 dib0090_get_wbd_offset(struct dvb_frontend *tuner); 83extern u16 dib0090_get_wbd_target(struct dvb_frontend *tuner);
84extern u16 dib0090_get_wbd_offset(struct dvb_frontend *fe);
84extern int dib0090_gain_control(struct dvb_frontend *fe); 85extern int dib0090_gain_control(struct dvb_frontend *fe);
85extern enum frontend_tune_state dib0090_get_tune_state(struct dvb_frontend *fe); 86extern enum frontend_tune_state dib0090_get_tune_state(struct dvb_frontend *fe);
86extern int dib0090_set_tune_state(struct dvb_frontend *fe, enum frontend_tune_state tune_state); 87extern int dib0090_set_tune_state(struct dvb_frontend *fe, enum frontend_tune_state tune_state);
87extern void dib0090_get_current_gain(struct dvb_frontend *fe, u16 * rf, u16 * bb, u16 * rf_gain_limit, u16 * rflt); 88extern void dib0090_get_current_gain(struct dvb_frontend *fe, u16 * rf, u16 * bb, u16 * rf_gain_limit, u16 * rflt);
88extern void dib0090_set_dc_servo(struct dvb_frontend *fe, u8 DC_servo_cutoff); 89extern void dib0090_set_dc_servo(struct dvb_frontend *fe, u8 DC_servo_cutoff);
90extern int dib0090_set_switch(struct dvb_frontend *fe, u8 sw1, u8 sw2, u8 sw3);
91extern int dib0090_set_vga(struct dvb_frontend *fe, u8 onoff);
92extern int dib0090_update_rframp_7090(struct dvb_frontend *fe,
93 u8 cfg_sensitivity);
94extern int dib0090_update_tuning_table_7090(struct dvb_frontend *fe,
95 u8 cfg_sensitivity);
89#else 96#else
90static inline struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dib0090_config *config) 97static inline struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config)
91{ 98{
92 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 99 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
93 return NULL; 100 return NULL;
@@ -109,7 +116,13 @@ static inline void dib0090_pwm_gain_reset(struct dvb_frontend *fe)
109 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 116 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
110} 117}
111 118
112static inline u16 dib0090_get_wbd_offset(struct dvb_frontend *tuner) 119static inline u16 dib0090_get_wbd_target(struct dvb_frontend *tuner)
120{
121 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
122 return 0;
123}
124
125static inline u16 dib0090_get_wbd_offset(struct dvb_frontend *fe)
113{ 126{
114 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 127 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
115 return 0; 128 return 0;
@@ -142,6 +155,33 @@ static inline void dib0090_set_dc_servo(struct dvb_frontend *fe, u8 DC_servo_cut
142{ 155{
143 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 156 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
144} 157}
158
159static inline int dib0090_set_switch(struct dvb_frontend *fe,
160 u8 sw1, u8 sw2, u8 sw3)
161{
162 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
163 return -ENODEV;
164}
165
166static inline int dib0090_set_vga(struct dvb_frontend *fe, u8 onoff)
167{
168 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
169 return -ENODEV;
170}
171
172static inline int dib0090_update_rframp_7090(struct dvb_frontend *fe,
173 u8 cfg_sensitivity)
174{
175 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
176 return -ENODEV;
177}
178
179static inline int dib0090_update_tuning_table_7090(struct dvb_frontend *fe,
180 u8 cfg_sensitivity)
181{
182 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
183 return -ENODEV;
184}
145#endif 185#endif
146 186
147#endif 187#endif
diff --git a/drivers/media/dvb/frontends/dib7000p.c b/drivers/media/dvb/frontends/dib7000p.c
index 08e62a4c9603..2b52542cf5fe 100644
--- a/drivers/media/dvb/frontends/dib7000p.c
+++ b/drivers/media/dvb/frontends/dib7000p.c
@@ -418,6 +418,24 @@ int dib7000p_set_wbd_ref(struct dvb_frontend *demod, u16 value)
418} 418}
419EXPORT_SYMBOL(dib7000p_set_wbd_ref); 419EXPORT_SYMBOL(dib7000p_set_wbd_ref);
420 420
421int dib7000p_get_agc_values(struct dvb_frontend *fe,
422 u16 *agc_global, u16 *agc1, u16 *agc2, u16 *wbd)
423{
424 struct dib7000p_state *state = fe->demodulator_priv;
425
426 if (agc_global != NULL)
427 *agc_global = dib7000p_read_word(state, 394);
428 if (agc1 != NULL)
429 *agc1 = dib7000p_read_word(state, 392);
430 if (agc2 != NULL)
431 *agc2 = dib7000p_read_word(state, 393);
432 if (wbd != NULL)
433 *wbd = dib7000p_read_word(state, 397);
434
435 return 0;
436}
437EXPORT_SYMBOL(dib7000p_get_agc_values);
438
421static void dib7000p_reset_pll(struct dib7000p_state *state) 439static void dib7000p_reset_pll(struct dib7000p_state *state)
422{ 440{
423 struct dibx000_bandwidth_config *bw = &state->cfg.bw[0]; 441 struct dibx000_bandwidth_config *bw = &state->cfg.bw[0];
diff --git a/drivers/media/dvb/frontends/dib7000p.h b/drivers/media/dvb/frontends/dib7000p.h
index 58f907ccf845..b61b03a6e1ed 100644
--- a/drivers/media/dvb/frontends/dib7000p.h
+++ b/drivers/media/dvb/frontends/dib7000p.h
@@ -60,6 +60,8 @@ extern int dib7090_tuner_sleep(struct dvb_frontend *fe, int onoff);
60extern int dib7090_get_adc_power(struct dvb_frontend *fe); 60extern int dib7090_get_adc_power(struct dvb_frontend *fe);
61extern struct i2c_adapter *dib7090_get_i2c_tuner(struct dvb_frontend *fe); 61extern struct i2c_adapter *dib7090_get_i2c_tuner(struct dvb_frontend *fe);
62extern int dib7090_slave_reset(struct dvb_frontend *fe); 62extern int dib7090_slave_reset(struct dvb_frontend *fe);
63extern int dib7000p_get_agc_values(struct dvb_frontend *fe,
64 u16 *agc_global, u16 *agc1, u16 *agc2, u16 *wbd);
63#else 65#else
64static inline struct dvb_frontend *dib7000p_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib7000p_config *cfg) 66static inline struct dvb_frontend *dib7000p_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib7000p_config *cfg)
65{ 67{
@@ -144,6 +146,13 @@ static inline int dib7090_slave_reset(struct dvb_frontend *fe)
144 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 146 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
145 return -ENODEV; 147 return -ENODEV;
146} 148}
149
150static inline int dib7000p_get_agc_values(struct dvb_frontend *fe,
151 u16 *agc_global, u16 *agc1, u16 *agc2, u16 *wbd)
152{
153 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
154 return -ENODEV;
155}
147#endif 156#endif
148 157
149#endif 158#endif