From 742d6f75ea8def9df4feb7576e5c42bbc37338ec Mon Sep 17 00:00:00 2001 From: cvh Date: Sun, 15 Jan 2017 21:05:32 +0100 Subject: [PATCH 1/3] linux: remove ds3000 dvb patch --- .../linux-227-ds3000-invalid-symbol-rate.patch | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 packages/linux-drivers/media_build/sources/media_build/backports/linux-227-ds3000-invalid-symbol-rate.patch diff --git a/packages/linux-drivers/media_build/sources/media_build/backports/linux-227-ds3000-invalid-symbol-rate.patch b/packages/linux-drivers/media_build/sources/media_build/backports/linux-227-ds3000-invalid-symbol-rate.patch deleted file mode 100644 index 79e04f2f82..0000000000 --- a/packages/linux-drivers/media_build/sources/media_build/backports/linux-227-ds3000-invalid-symbol-rate.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff -rupN a/drivers/media/dvb-frontends/ds3000.c b/drivers/media/dvb-frontends/ds3000.c ---- a/drivers/media/dvb-frontends/ds3000.c 2015-01-28 23:24:59.000000000 +0100 -+++ b/drivers/media/dvb-frontends/ds3000.c 2015-01-29 21:57:56.000000000 +0100 -@@ -958,6 +958,14 @@ static int ds3000_set_frontend(struct dv - /* enable ac coupling */ - ds3000_writereg(state, 0x25, 0x8a); - -+ dprintk("%s() frequency:%u symbol_rate:%u\n", __func__, c->frequency, c->symbol_rate); -+ -+ if (c->symbol_rate < ds3000_ops.info.symbol_rate_min || c->symbol_rate > ds3000_ops.info.symbol_rate_max ) { -+ dprintk("%s() symbol_rate %u out of range (%u ... %u)\n", __func__, c->symbol_rate, -+ ds3000_ops.info.symbol_rate_min, ds3000_ops.info.symbol_rate_max); -+ return 1; -+ } -+ - /* enhance symbol rate performance */ - if ((c->symbol_rate / 1000) <= 5000) { - value = 29777 / (c->symbol_rate / 1000) + 1; \ No newline at end of file From af7486cb27bd6a20d0ea29088cc8999e58b2dd9b Mon Sep 17 00:00:00 2001 From: cvh Date: Sun, 15 Jan 2017 21:05:50 +0100 Subject: [PATCH 2/3] linux: remove stb0899 dvb patch --- ...linux-212-mantis_stb0899_faster_lock.patch | 138 ------------------ 1 file changed, 138 deletions(-) delete mode 100644 packages/linux-drivers/media_build/sources/media_build/backports/linux-212-mantis_stb0899_faster_lock.patch diff --git a/packages/linux-drivers/media_build/sources/media_build/backports/linux-212-mantis_stb0899_faster_lock.patch b/packages/linux-drivers/media_build/sources/media_build/backports/linux-212-mantis_stb0899_faster_lock.patch deleted file mode 100644 index eef4e1effc..0000000000 --- a/packages/linux-drivers/media_build/sources/media_build/backports/linux-212-mantis_stb0899_faster_lock.patch +++ /dev/null @@ -1,138 +0,0 @@ -diff -Naur linux-3.7.2/drivers/media/dvb-frontends/stb0899_algo.c linux-3.7.2.patch/drivers/media/dvb-frontends/stb0899_algo.c ---- linux-3.7.2/drivers/media/dvb-frontends/stb0899_algo.c 2013-01-11 18:19:28.000000000 +0100 -+++ linux-3.7.2.patch/drivers/media/dvb-frontends/stb0899_algo.c 2013-01-16 10:28:33.633409961 +0100 -@@ -206,7 +206,6 @@ - static enum stb0899_status stb0899_search_tmg(struct stb0899_state *state) - { - struct stb0899_internal *internal = &state->internal; -- struct stb0899_params *params = &state->params; - - short int derot_step, derot_freq = 0, derot_limit, next_loop = 3; - int index = 0; -@@ -216,10 +215,9 @@ - - /* timing loop computation & symbol rate optimisation */ - derot_limit = (internal->sub_range / 2L) / internal->mclk; -- derot_step = (params->srate / 2L) / internal->mclk; -+ derot_step = internal->derot_step * 4; /* dertot_step = decreasing delta */ - - while ((stb0899_check_tmg(state) != TIMINGOK) && next_loop) { -- index++; - derot_freq += index * internal->direction * derot_step; /* next derot zig zag position */ - - if (abs(derot_freq) > derot_limit) -@@ -230,6 +228,7 @@ - STB0899_SETFIELD_VAL(CFRL, cfr[1], LSB(state->config->inversion * derot_freq)); - stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* derotator frequency */ - } -+ index++; - internal->direction = -internal->direction; /* Change zigzag direction */ - } - -@@ -278,14 +277,18 @@ - { - struct stb0899_internal *internal = &state->internal; - -- short int derot_freq = 0, last_derot_freq = 0, derot_limit, next_loop = 3; -+ short int derot_freq = 0, last_derot_freq = 0, derot_limit, derot_step, next_loop = 3; - int index = 0; -+ int base_freq; - u8 cfr[2]; - u8 reg; - - internal->status = NOCARRIER; - derot_limit = (internal->sub_range / 2L) / internal->mclk; - derot_freq = internal->derot_freq; -+ derot_step = internal->derot_step * 2; -+ last_derot_freq = internal->derot_freq; -+ base_freq = internal->derot_freq; - - reg = stb0899_read_reg(state, STB0899_CFD); - STB0899_SETFIELD_VAL(CFD_ON, reg, 1); -@@ -294,11 +297,10 @@ - do { - dprintk(state->verbose, FE_DEBUG, 1, "Derot Freq=%d, mclk=%d", derot_freq, internal->mclk); - if (stb0899_check_carrier(state) == NOCARRIER) { -- index++; - last_derot_freq = derot_freq; -- derot_freq += index * internal->direction * internal->derot_step; /* next zig zag derotator position */ -+ derot_freq += index * internal->direction * derot_step; /* next zig zag derotator position */ - -- if(abs(derot_freq) > derot_limit) -+ if (derot_freq > base_freq + derot_limit || derot_freq < base_freq - derot_limit) - next_loop--; - - if (next_loop) { -@@ -310,9 +312,10 @@ - STB0899_SETFIELD_VAL(CFRL, cfr[1], LSB(state->config->inversion * derot_freq)); - stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* derotator frequency */ - } -+ index++; -+ internal->direction = -internal->direction; /* Change zigzag direction */ - } - -- internal->direction = -internal->direction; /* Change zigzag direction */ - } while ((internal->status != CARRIEROK) && next_loop); - - if (internal->status == CARRIEROK) { -@@ -338,6 +341,7 @@ - int lock = 0, index = 0, dataTime = 500, loop; - u8 reg; - -+ msleep(1); - internal->status = NODATA; - - /* RESET FEC */ -@@ -348,6 +352,7 @@ - reg = stb0899_read_reg(state, STB0899_TSTRES); - STB0899_SETFIELD_VAL(FRESACS, reg, 0); - stb0899_write_reg(state, STB0899_TSTRES, reg); -+ msleep(1); - - if (params->srate <= 2000000) - dataTime = 2000; -@@ -363,6 +368,7 @@ - - stb0899_write_reg(state, STB0899_DSTATUS2, 0x00); /* force search loop */ - while (1) { -+ msleep(1); // Alex: added 1 mSec - /* WARNING! VIT LOCKED has to be tested before VIT_END_LOOOP */ - reg = stb0899_read_reg(state, STB0899_VSTATUS); - lock = STB0899_GETFIELD(VSTATUS_LOCKEDVIT, reg); -@@ -390,20 +396,21 @@ - short int derot_freq, derot_step, derot_limit, next_loop = 3; - u8 cfr[2]; - u8 reg; -- int index = 1; -+ int index = 0; -+ int base_freq; - - struct stb0899_internal *internal = &state->internal; -- struct stb0899_params *params = &state->params; - -- derot_step = (params->srate / 4L) / internal->mclk; -+ derot_step = internal->derot_step; - derot_limit = (internal->sub_range / 2L) / internal->mclk; - derot_freq = internal->derot_freq; -+ base_freq = internal->derot_freq; - - do { - if ((internal->status != CARRIEROK) || (stb0899_check_data(state) != DATAOK)) { - - derot_freq += index * internal->direction * derot_step; /* next zig zag derotator position */ -- if (abs(derot_freq) > derot_limit) -+ if (derot_freq > base_freq + derot_limit || derot_freq < base_freq - derot_limit) - next_loop--; - - if (next_loop) { -@@ -417,9 +424,9 @@ - stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* derotator frequency */ - - stb0899_check_carrier(state); -- index++; - } - } -+ index++; - internal->direction = -internal->direction; /* change zig zag direction */ - } while ((internal->status != DATAOK) && next_loop); - From a1ae875a65d08a3429b6aa82617c62ba552e6457 Mon Sep 17 00:00:00 2001 From: cvh Date: Sun, 15 Jan 2017 21:06:46 +0100 Subject: [PATCH 3/3] media_build: cleaned up patches -rebased ontop 4.9 kernel --- .../media_build-02-add-to-backports.patch | 9 +++----- ...lnbp22_patch_for_more_power_if_rotor.patch | 21 +++++++++---------- ...x-203-stb0899_enable_low_symbol_rate.patch | 7 +++---- .../linux-222-stb0899_signal_quality.patch | 13 ++++++------ 4 files changed, 22 insertions(+), 28 deletions(-) diff --git a/packages/linux-drivers/media_build/patches/media_build-02-add-to-backports.patch b/packages/linux-drivers/media_build/patches/media_build-02-add-to-backports.patch index 87e0524391..5321820b79 100644 --- a/packages/linux-drivers/media_build/patches/media_build-02-add-to-backports.patch +++ b/packages/linux-drivers/media_build/patches/media_build-02-add-to-backports.patch @@ -1,15 +1,12 @@ -diff --git a/media_build/backports/backports.txt b/media_build/backports/backports.txt -index 2a6006b..8c7c3de 100644 --- a/media_build/backports/backports.txt +++ b/media_build/backports/backports.txt -@@ -25,6 +25,10 @@ +@@ -25,6 +25,9 @@ add pr_fmt.patch add debug.patch add drx39xxj.patch ++add linux-202-lnbp22_patch_for_more_power_if_rotor.patch +add linux-203-stb0899_enable_low_symbol_rate.patch -+add linux-212-mantis_stb0899_faster_lock.patch +add linux-222-stb0899_signal_quality.patch -+add linux-227-ds3000-invalid-symbol-rate.patch - + [4.8.255] add v4.8_user_pages_flag.patch diff --git a/packages/linux-drivers/media_build/sources/media_build/backports/linux-202-lnbp22_patch_for_more_power_if_rotor.patch b/packages/linux-drivers/media_build/sources/media_build/backports/linux-202-lnbp22_patch_for_more_power_if_rotor.patch index d8111ab0ae..f4d48b9739 100755 --- a/packages/linux-drivers/media_build/sources/media_build/backports/linux-202-lnbp22_patch_for_more_power_if_rotor.patch +++ b/packages/linux-drivers/media_build/sources/media_build/backports/linux-202-lnbp22_patch_for_more_power_if_rotor.patch @@ -6,10 +6,9 @@ and https://github.com/LibreELEC/LibreELEC.tv/pull/1118 tested with TT S2-3650CI and a HH90 rotor -diff -Naur linux-4.9.orig/drivers/media/dvb-frontends/lnbp22.c linux-4.9/drivers/media/dvb-frontends/lnbp22.c ---- linux-4.9.orig/drivers/media/dvb-frontends/lnbp22.c 2017-01-07 18:58:55.306001049 +0100 -+++ linux-4.9/drivers/media/dvb-frontends/lnbp22.c 2017-01-07 19:39:06.204887989 +0100 -@@ -48,47 +48,95 @@ +--- a/drivers/media/dvb-frontends/lnbp22.c ++++ b/drivers/media/dvb-frontends/lnbp22.c +@@ -48,47 +48,95 @@ struct lnbp22 { struct i2c_adapter *i2c; }; @@ -68,7 +67,6 @@ diff -Naur linux-4.9.orig/drivers/media/dvb-frontends/lnbp22.c linux-4.9/drivers - break; - default: - return -EINVAL; -- } + case SEC_VOLTAGE_OFF: + lnbp22->config[3] &= ~LNBP22_EN; + return lnbp22_write_config(fe, lnbp22->config); @@ -105,9 +103,7 @@ diff -Naur linux-4.9.orig/drivers/media/dvb-frontends/lnbp22.c linux-4.9/drivers + return status; + } + while( (config[0] & (1<<2)) && retries-- ); - -- dprintk(1, "%s: 0x%02x)\n", __func__, lnbp22->config[3]); -- return (i2c_transfer(lnbp22->i2c, &msg, 1) == 1) ? 0 : -EIO; ++ + dprintk(1, "%s status=0x%02X\n", __FUNCTION__, config[0]); + + if( retries < 0 ) @@ -115,7 +111,10 @@ diff -Naur linux-4.9.orig/drivers/media/dvb-frontends/lnbp22.c linux-4.9/drivers + + if( config[0] & (1<<3) ) + return -ENOLINK; /* open loop */ -+ } + } +- +- dprintk(1, "%s: 0x%02x)\n", __func__, lnbp22->config[3]); +- return (i2c_transfer(lnbp22->i2c, &msg, 1) == 1) ? 0 : -EIO; + return status; } @@ -131,7 +130,7 @@ diff -Naur linux-4.9.orig/drivers/media/dvb-frontends/lnbp22.c linux-4.9/drivers dprintk(1, "%s: %d\n", __func__, (int)arg); if (arg) -@@ -96,7 +144,7 @@ +@@ -96,7 +144,7 @@ static int lnbp22_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg) else lnbp22->config[3] &= ~LNBP22_LLC; @@ -140,7 +139,7 @@ diff -Naur linux-4.9.orig/drivers/media/dvb-frontends/lnbp22.c linux-4.9/drivers } static void lnbp22_release(struct dvb_frontend *fe) -@@ -118,20 +166,14 @@ +@@ -118,20 +166,14 @@ struct dvb_frontend *lnbp22_attach(struct dvb_frontend *fe, return NULL; /* default configuration */ diff --git a/packages/linux-drivers/media_build/sources/media_build/backports/linux-203-stb0899_enable_low_symbol_rate.patch b/packages/linux-drivers/media_build/sources/media_build/backports/linux-203-stb0899_enable_low_symbol_rate.patch index f302b6ce1b..3624c9fa00 100644 --- a/packages/linux-drivers/media_build/sources/media_build/backports/linux-203-stb0899_enable_low_symbol_rate.patch +++ b/packages/linux-drivers/media_build/sources/media_build/backports/linux-203-stb0899_enable_low_symbol_rate.patch @@ -1,7 +1,6 @@ -diff -Naur linux-3.7.2/drivers/media/dvb-frontends/stb0899_drv.c linux-3.7.2.patch/drivers/media/dvb-frontends/stb0899_drv.c ---- linux-3.7.2/drivers/media/dvb-frontends/stb0899_drv.c 2013-01-11 18:19:28.000000000 +0100 -+++ linux-3.7.2.patch/drivers/media/dvb-frontends/stb0899_drv.c 2013-01-16 10:25:43.479645317 +0100 -@@ -1581,7 +1581,7 @@ +--- a/drivers/media/dvb-frontends/stb0899_drv.c ++++ b/drivers/media/dvb-frontends/stb0899_drv.c +@@ -1618,7 +1618,7 @@ static const struct dvb_frontend_ops stb0899_ops = { .frequency_max = 2150000, .frequency_stepsize = 0, .frequency_tolerance = 0, diff --git a/packages/linux-drivers/media_build/sources/media_build/backports/linux-222-stb0899_signal_quality.patch b/packages/linux-drivers/media_build/sources/media_build/backports/linux-222-stb0899_signal_quality.patch index fd6539d2bf..2e2ab8e6f7 100644 --- a/packages/linux-drivers/media_build/sources/media_build/backports/linux-222-stb0899_signal_quality.patch +++ b/packages/linux-drivers/media_build/sources/media_build/backports/linux-222-stb0899_signal_quality.patch @@ -1,7 +1,6 @@ -diff -Naur linux-3.7.2/drivers/media/dvb-frontends/stb0899_drv.c linux-3.7.2.patch/drivers/media/dvb-frontends/stb0899_drv.c ---- linux-3.7.2/drivers/media/dvb-frontends/stb0899_drv.c 2013-01-11 18:19:28.000000000 +0100 -+++ linux-3.7.2.patch/drivers/media/dvb-frontends/stb0899_drv.c 2013-01-16 10:33:10.323380937 +0100 -@@ -971,6 +971,16 @@ +--- a/drivers/media/dvb-frontends/stb0899_drv.c ++++ b/drivers/media/dvb-frontends/stb0899_drv.c +@@ -976,6 +976,16 @@ static int stb0899_read_signal_strength(struct dvb_frontend *fe, u16 *strength) *strength = stb0899_table_lookup(stb0899_dvbsrf_tab, ARRAY_SIZE(stb0899_dvbsrf_tab) - 1, val); *strength += 750; @@ -18,7 +17,7 @@ diff -Naur linux-3.7.2/drivers/media/dvb-frontends/stb0899_drv.c linux-3.7.2.pat dprintk(state->verbose, FE_DEBUG, 1, "AGCIQVALUE = 0x%02x, C = %d * 0.1 dBm", val & 0xff, *strength); } -@@ -983,6 +993,7 @@ +@@ -988,6 +998,7 @@ static int stb0899_read_signal_strength(struct dvb_frontend *fe, u16 *strength) *strength = stb0899_table_lookup(stb0899_dvbs2rf_tab, ARRAY_SIZE(stb0899_dvbs2rf_tab) - 1, val); *strength += 950; @@ -26,7 +25,7 @@ diff -Naur linux-3.7.2/drivers/media/dvb-frontends/stb0899_drv.c linux-3.7.2.pat dprintk(state->verbose, FE_DEBUG, 1, "IF_AGC_GAIN = 0x%04x, C = %d * 0.1 dBm", val & 0x3fff, *strength); } -@@ -1016,6 +1027,16 @@ +@@ -1021,6 +1032,16 @@ static int stb0899_read_snr(struct dvb_frontend *fe, u16 *snr) val = MAKEWORD16(buf[0], buf[1]); *snr = stb0899_table_lookup(stb0899_cn_tab, ARRAY_SIZE(stb0899_cn_tab) - 1, val); @@ -43,7 +42,7 @@ diff -Naur linux-3.7.2/drivers/media/dvb-frontends/stb0899_drv.c linux-3.7.2.pat dprintk(state->verbose, FE_DEBUG, 1, "NIR = 0x%02x%02x = %u, C/N = %d * 0.1 dBm\n", buf[0], buf[1], val, *snr); } -@@ -1040,6 +1061,16 @@ +@@ -1045,6 +1066,16 @@ static int stb0899_read_snr(struct dvb_frontend *fe, u16 *snr) val = (quantn - estn) / 10; } *snr = val;