From: Greg Kroah-Hartman Date: Mon, 10 Feb 2014 19:50:57 +0000 (-0800) Subject: 3.13-stable patches X-Git-Tag: v3.4.80~41 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=61aeab7d96d137ed6a20dd9d0bf5e97038d8d8b4;p=thirdparty%2Fkernel%2Fstable-queue.git 3.13-stable patches added patches: dib8000-fix-regression-with-dib807x.patch dib8000-make-32-bits-read-atomic.patch it913x-add-support-for-avermedia-h335-id-0x0335.patch m88rs2000-add-m88rs2000_set_carrieroffset.patch m88rs2000-set-symbol-rate-accurately.patch media-anysee-fix-non-working-e30-combo-plus-dvb-t.patch media-media-v4l2-dev-fix-video-device-index-assignment.patch media-s5p_mfc-remove-s5p_mfc_get_node_type-function.patch mm-oom-base-root-bonus-on-current-usage.patch nxt200x-increase-write-buffer-size.patch --- diff --git a/queue-3.13/dib8000-fix-regression-with-dib807x.patch b/queue-3.13/dib8000-fix-regression-with-dib807x.patch new file mode 100644 index 00000000000..a1cb8bcc369 --- /dev/null +++ b/queue-3.13/dib8000-fix-regression-with-dib807x.patch @@ -0,0 +1,56 @@ +From d67350f8c4e67f5eba627e1fd111f16257ca9c95 Mon Sep 17 00:00:00 2001 +From: Olivier Grenie +Date: Thu, 12 Dec 2013 09:26:22 -0300 +Subject: [media] dib8000: fix regression with dib807x + +From: Olivier Grenie + +commit d67350f8c4e67f5eba627e1fd111f16257ca9c95 upstream. + +Commit 173a64cb3fcf broke support for some dib807x versions. + +Fix it by providing backward compatibility with the older versions. + +[mkrufky@linuxtv.org: conflict handling and CodingStyle fixes] + +Signed-off-by: Olivier Grenie +Acked-by: Patrick Boettcher +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/media/dvb-frontends/dib8000.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +--- a/drivers/media/dvb-frontends/dib8000.c ++++ b/drivers/media/dvb-frontends/dib8000.c +@@ -2462,7 +2462,8 @@ static int dib8000_autosearch_start(stru + if (state->revision == 0x8090) + internal = dib8000_read32(state, 23) / 1000; + +- if (state->autosearch_state == AS_SEARCHING_FFT) { ++ if ((state->revision >= 0x8002) && ++ (state->autosearch_state == AS_SEARCHING_FFT)) { + dib8000_write_word(state, 37, 0x0065); /* P_ctrl_pha_off_max default values */ + dib8000_write_word(state, 116, 0x0000); /* P_ana_gain to 0 */ + +@@ -2498,7 +2499,8 @@ static int dib8000_autosearch_start(stru + dib8000_write_word(state, 770, (dib8000_read_word(state, 770) & 0xdfff) | (1 << 13)); /* P_restart_ccg = 1 */ + dib8000_write_word(state, 770, (dib8000_read_word(state, 770) & 0xdfff) | (0 << 13)); /* P_restart_ccg = 0 */ + dib8000_write_word(state, 0, (dib8000_read_word(state, 0) & 0x7ff) | (0 << 15) | (1 << 13)); /* P_restart_search = 0; */ +- } else if (state->autosearch_state == AS_SEARCHING_GUARD) { ++ } else if ((state->revision >= 0x8002) && ++ (state->autosearch_state == AS_SEARCHING_GUARD)) { + c->transmission_mode = TRANSMISSION_MODE_8K; + c->guard_interval = GUARD_INTERVAL_1_8; + c->inversion = 0; +@@ -2600,7 +2602,8 @@ static int dib8000_autosearch_irq(struct + struct dib8000_state *state = fe->demodulator_priv; + u16 irq_pending = dib8000_read_word(state, 1284); + +- if (state->autosearch_state == AS_SEARCHING_FFT) { ++ if ((state->revision >= 0x8002) && ++ (state->autosearch_state == AS_SEARCHING_FFT)) { + if (irq_pending & 0x1) { + dprintk("dib8000_autosearch_irq: max correlation result available"); + return 3; diff --git a/queue-3.13/dib8000-make-32-bits-read-atomic.patch b/queue-3.13/dib8000-make-32-bits-read-atomic.patch new file mode 100644 index 00000000000..703cfbbeadf --- /dev/null +++ b/queue-3.13/dib8000-make-32-bits-read-atomic.patch @@ -0,0 +1,89 @@ +From 5ac64ba12aca3bef18e61c866583155a3bbf81c4 Mon Sep 17 00:00:00 2001 +From: Mauro Carvalho Chehab +Date: Fri, 13 Dec 2013 10:35:03 -0300 +Subject: [media] dib8000: make 32 bits read atomic + +From: Mauro Carvalho Chehab + +commit 5ac64ba12aca3bef18e61c866583155a3bbf81c4 upstream. + +As the dvb-frontend kthread can be called anytime, it can race +with some get status ioctl. So, it seems better to avoid one to +race with the other while reading a 32 bits register. +I can't see any other reason for having a mutex there at I2C, except +to provide such kind of protection, as the I2C core already has a +mutex to protect I2C transfers. + +Note: instead of this approach, it could eventually remove the dib8000 +specific mutex for it, and either group the 4 ops into one xfer or +to manually control the I2C mutex. The main advantage of the current +approach is that the changes are smaller and more puntual. + +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Mauro Carvalho Chehab +Acked-by: Patrick Boettcher +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/media/dvb-frontends/dib8000.c | 33 +++++++++++++++++++++++++-------- + 1 file changed, 25 insertions(+), 8 deletions(-) + +--- a/drivers/media/dvb-frontends/dib8000.c ++++ b/drivers/media/dvb-frontends/dib8000.c +@@ -157,15 +157,10 @@ static u16 dib8000_i2c_read16(struct i2c + return ret; + } + +-static u16 dib8000_read_word(struct dib8000_state *state, u16 reg) ++static u16 __dib8000_read_word(struct dib8000_state *state, u16 reg) + { + u16 ret; + +- if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) { +- dprintk("could not acquire lock"); +- return 0; +- } +- + state->i2c_write_buffer[0] = reg >> 8; + state->i2c_write_buffer[1] = reg & 0xff; + +@@ -183,6 +178,21 @@ static u16 dib8000_read_word(struct dib8 + dprintk("i2c read error on %d", reg); + + ret = (state->i2c_read_buffer[0] << 8) | state->i2c_read_buffer[1]; ++ ++ return ret; ++} ++ ++static u16 dib8000_read_word(struct dib8000_state *state, u16 reg) ++{ ++ u16 ret; ++ ++ if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) { ++ dprintk("could not acquire lock"); ++ return 0; ++ } ++ ++ ret = __dib8000_read_word(state, reg); ++ + mutex_unlock(&state->i2c_buffer_lock); + + return ret; +@@ -192,8 +202,15 @@ static u32 dib8000_read32(struct dib8000 + { + u16 rw[2]; + +- rw[0] = dib8000_read_word(state, reg + 0); +- rw[1] = dib8000_read_word(state, reg + 1); ++ if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) { ++ dprintk("could not acquire lock"); ++ return 0; ++ } ++ ++ rw[0] = __dib8000_read_word(state, reg + 0); ++ rw[1] = __dib8000_read_word(state, reg + 1); ++ ++ mutex_unlock(&state->i2c_buffer_lock); + + return ((rw[0] << 16) | (rw[1])); + } diff --git a/queue-3.13/it913x-add-support-for-avermedia-h335-id-0x0335.patch b/queue-3.13/it913x-add-support-for-avermedia-h335-id-0x0335.patch new file mode 100644 index 00000000000..2d6480c87b0 --- /dev/null +++ b/queue-3.13/it913x-add-support-for-avermedia-h335-id-0x0335.patch @@ -0,0 +1,42 @@ +From 17f335c304ac19d9b11814238fe8a7519d80e2ff Mon Sep 17 00:00:00 2001 +From: Malcolm Priestley +Date: Thu, 12 Dec 2013 16:38:51 -0300 +Subject: [media] it913x: Add support for Avermedia H335 id 0x0335 + +From: Malcolm Priestley + +commit 17f335c304ac19d9b11814238fe8a7519d80e2ff upstream. + +Trivial USB ID addition for Avermedia H335. + +Signed-off-by: Malcolm Priestley +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/media/dvb-core/dvb-usb-ids.h | 1 + + drivers/media/usb/dvb-usb-v2/it913x.c | 3 +++ + 2 files changed, 4 insertions(+) + +--- a/drivers/media/dvb-core/dvb-usb-ids.h ++++ b/drivers/media/dvb-core/dvb-usb-ids.h +@@ -239,6 +239,7 @@ + #define USB_PID_AVERMEDIA_A835B_4835 0x4835 + #define USB_PID_AVERMEDIA_1867 0x1867 + #define USB_PID_AVERMEDIA_A867 0xa867 ++#define USB_PID_AVERMEDIA_H335 0x0335 + #define USB_PID_AVERMEDIA_TWINSTAR 0x0825 + #define USB_PID_TECHNOTREND_CONNECT_S2400 0x3006 + #define USB_PID_TECHNOTREND_CONNECT_S2400_8KEEPROM 0x3009 +--- a/drivers/media/usb/dvb-usb-v2/it913x.c ++++ b/drivers/media/usb/dvb-usb-v2/it913x.c +@@ -799,6 +799,9 @@ static const struct usb_device_id it913x + { DVB_USB_DEVICE(USB_VID_KWORLD_2, USB_PID_CTVDIGDUAL_V2, + &it913x_properties, "Digital Dual TV Receiver CTVDIGDUAL_V2", + RC_MAP_IT913X_V1) }, ++ { DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_H335, ++ &it913x_properties, "Avermedia H335", ++ RC_MAP_IT913X_V2) }, + {} /* Terminating entry */ + }; + diff --git a/queue-3.13/m88rs2000-add-m88rs2000_set_carrieroffset.patch b/queue-3.13/m88rs2000-add-m88rs2000_set_carrieroffset.patch new file mode 100644 index 00000000000..427928f0ace --- /dev/null +++ b/queue-3.13/m88rs2000-add-m88rs2000_set_carrieroffset.patch @@ -0,0 +1,147 @@ +From 06af15d1b6f45c60358feab88004472e5428f01c Mon Sep 17 00:00:00 2001 +From: Malcolm Priestley +Date: Tue, 24 Dec 2013 13:17:12 -0300 +Subject: [media] m88rs2000: add m88rs2000_set_carrieroffset + +From: Malcolm Priestley + +commit 06af15d1b6f45c60358feab88004472e5428f01c upstream. + +Set the carrier offset correctly using the default mclk values. + +Add function m88rs2000_get_mclk to calculate the mclk value +against crystal frequency which will later be used for +other functions. + +Add function m88rs2000_set_carrieroffset to calculate +and set the offset value. + +variable offset becomes a signed value. + +Register 0x86 is set the appropriate value according to +remainder value of frequency % 192857 calculation as +shown. + +Signed-off-by: Malcolm Priestley +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/media/dvb-frontends/m88rs2000.c | 77 +++++++++++++++++++++++--------- + drivers/media/dvb-frontends/m88rs2000.h | 2 + 2 files changed, 59 insertions(+), 20 deletions(-) + +--- a/drivers/media/dvb-frontends/m88rs2000.c ++++ b/drivers/media/dvb-frontends/m88rs2000.c +@@ -110,6 +110,52 @@ static u8 m88rs2000_readreg(struct m88rs + return b1[0]; + } + ++static u32 m88rs2000_get_mclk(struct dvb_frontend *fe) ++{ ++ struct m88rs2000_state *state = fe->demodulator_priv; ++ u32 mclk; ++ u8 reg; ++ /* Must not be 0x00 or 0xff */ ++ reg = m88rs2000_readreg(state, 0x86); ++ if (!reg || reg == 0xff) ++ return 0; ++ ++ reg /= 2; ++ reg += 1; ++ ++ mclk = (u32)(reg * RS2000_FE_CRYSTAL_KHZ + 28 / 2) / 28; ++ ++ return mclk; ++} ++ ++static int m88rs2000_set_carrieroffset(struct dvb_frontend *fe, s16 offset) ++{ ++ struct m88rs2000_state *state = fe->demodulator_priv; ++ u32 mclk; ++ s32 tmp; ++ u8 reg; ++ int ret; ++ ++ mclk = m88rs2000_get_mclk(fe); ++ if (!mclk) ++ return -EINVAL; ++ ++ tmp = (offset * 4096 + (s32)mclk / 2) / (s32)mclk; ++ if (tmp < 0) ++ tmp += 4096; ++ ++ /* Carrier Offset */ ++ ret = m88rs2000_writereg(state, 0x9c, (u8)(tmp >> 4)); ++ ++ reg = m88rs2000_readreg(state, 0x9d); ++ reg &= 0xf; ++ reg |= (u8)(tmp & 0xf) << 4; ++ ++ ret |= m88rs2000_writereg(state, 0x9d, reg); ++ ++ return ret; ++} ++ + static int m88rs2000_set_symbolrate(struct dvb_frontend *fe, u32 srate) + { + struct m88rs2000_state *state = fe->demodulator_priv; +@@ -540,9 +586,8 @@ static int m88rs2000_set_frontend(struct + struct dtv_frontend_properties *c = &fe->dtv_property_cache; + fe_status_t status; + int i, ret = 0; +- s32 tmp; + u32 tuner_freq; +- u16 offset = 0; ++ s16 offset = 0; + u8 reg; + + state->no_lock_count = 0; +@@ -567,26 +612,18 @@ static int m88rs2000_set_frontend(struct + if (ret < 0) + return -ENODEV; + +- offset = tuner_freq - c->frequency; ++ offset = (s16)((s32)tuner_freq - c->frequency); + +- /* calculate offset assuming 96000kHz*/ +- tmp = offset; +- tmp *= 65536; +- +- tmp = (2 * tmp + 96000) / (2 * 96000); +- if (tmp < 0) +- tmp += 65536; +- +- offset = tmp & 0xffff; +- +- ret = m88rs2000_writereg(state, 0x9a, 0x30); +- /* Unknown usually 0xc6 sometimes 0xc1 */ +- reg = m88rs2000_readreg(state, 0x86); +- ret |= m88rs2000_writereg(state, 0x86, reg); +- /* Offset lower nibble always 0 */ +- ret |= m88rs2000_writereg(state, 0x9c, (offset >> 8)); +- ret |= m88rs2000_writereg(state, 0x9d, offset & 0xf0); ++ /* default mclk value 96.4285 * 2 * 1000 = 192857 */ ++ if (((c->frequency % 192857) >= (192857 - 3000)) || ++ (c->frequency % 192857) <= 3000) ++ ret = m88rs2000_writereg(state, 0x86, 0xc2); ++ else ++ ret = m88rs2000_writereg(state, 0x86, 0xc6); + ++ ret |= m88rs2000_set_carrieroffset(fe, offset); ++ if (ret < 0) ++ return -ENODEV; + + /* Reset Demod */ + ret = m88rs2000_tab_set(state, fe_reset); +--- a/drivers/media/dvb-frontends/m88rs2000.h ++++ b/drivers/media/dvb-frontends/m88rs2000.h +@@ -53,6 +53,8 @@ static inline struct dvb_frontend *m88rs + } + #endif /* CONFIG_DVB_M88RS2000 */ + ++#define RS2000_FE_CRYSTAL_KHZ 27000 ++ + enum { + DEMOD_WRITE = 0x1, + WRITE_DELAY = 0x10, diff --git a/queue-3.13/m88rs2000-set-symbol-rate-accurately.patch b/queue-3.13/m88rs2000-set-symbol-rate-accurately.patch new file mode 100644 index 00000000000..8abfd75bd7b --- /dev/null +++ b/queue-3.13/m88rs2000-set-symbol-rate-accurately.patch @@ -0,0 +1,120 @@ +From dd4491dfb9eb4fa3bfa7dc73ba989e69fbce2e10 Mon Sep 17 00:00:00 2001 +From: Malcolm Priestley +Date: Tue, 24 Dec 2013 13:18:46 -0300 +Subject: [media] m88rs2000: set symbol rate accurately + +From: Malcolm Priestley + +commit dd4491dfb9eb4fa3bfa7dc73ba989e69fbce2e10 upstream. + +Current setting of symbol rate is not very actuate causing +loss of lock. + +Covert temp to u64 and use mclk to calculate from big number. + +Calculate symbol rate by dividing symbol rate by 1000 times +1 << 24 and dividing sum by mclk. + +Add other symbol rate settings to function registers 0xa0-0xa3. + +In set_frontend add changes to register 0xf1 this must be done +prior call to fe_reset. Register 0x00 doesn't need a second +write of 0x1 + +Applied after patch +m88rs2000: add m88rs2000_set_carrieroffset + +Signed-off-by: Malcolm Priestley +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/media/dvb-frontends/m88rs2000.c | 42 +++++++++++++++++++++++--------- + 1 file changed, 31 insertions(+), 11 deletions(-) + +--- a/drivers/media/dvb-frontends/m88rs2000.c ++++ b/drivers/media/dvb-frontends/m88rs2000.c +@@ -160,24 +160,44 @@ static int m88rs2000_set_symbolrate(stru + { + struct m88rs2000_state *state = fe->demodulator_priv; + int ret; +- u32 temp; ++ u64 temp; ++ u32 mclk; + u8 b[3]; + + if ((srate < 1000000) || (srate > 45000000)) + return -EINVAL; + ++ mclk = m88rs2000_get_mclk(fe); ++ if (!mclk) ++ return -EINVAL; ++ + temp = srate / 1000; +- temp *= 11831; +- temp /= 68; +- temp -= 3; ++ temp *= 1 << 24; ++ ++ do_div(temp, mclk); + + b[0] = (u8) (temp >> 16) & 0xff; + b[1] = (u8) (temp >> 8) & 0xff; + b[2] = (u8) temp & 0xff; ++ + ret = m88rs2000_writereg(state, 0x93, b[2]); + ret |= m88rs2000_writereg(state, 0x94, b[1]); + ret |= m88rs2000_writereg(state, 0x95, b[0]); + ++ if (srate > 10000000) ++ ret |= m88rs2000_writereg(state, 0xa0, 0x20); ++ else ++ ret |= m88rs2000_writereg(state, 0xa0, 0x60); ++ ++ ret |= m88rs2000_writereg(state, 0xa1, 0xe0); ++ ++ if (srate > 12000000) ++ ret |= m88rs2000_writereg(state, 0xa3, 0x20); ++ else if (srate > 2800000) ++ ret |= m88rs2000_writereg(state, 0xa3, 0x98); ++ else ++ ret |= m88rs2000_writereg(state, 0xa3, 0x90); ++ + deb_info("m88rs2000: m88rs2000_set_symbolrate\n"); + return ret; + } +@@ -307,8 +327,6 @@ struct inittab m88rs2000_shutdown[] = { + + struct inittab fe_reset[] = { + {DEMOD_WRITE, 0x00, 0x01}, +- {DEMOD_WRITE, 0xf1, 0xbf}, +- {DEMOD_WRITE, 0x00, 0x01}, + {DEMOD_WRITE, 0x20, 0x81}, + {DEMOD_WRITE, 0x21, 0x80}, + {DEMOD_WRITE, 0x10, 0x33}, +@@ -351,9 +369,6 @@ struct inittab fe_trigger[] = { + {DEMOD_WRITE, 0x9b, 0x64}, + {DEMOD_WRITE, 0x9e, 0x00}, + {DEMOD_WRITE, 0x9f, 0xf8}, +- {DEMOD_WRITE, 0xa0, 0x20}, +- {DEMOD_WRITE, 0xa1, 0xe0}, +- {DEMOD_WRITE, 0xa3, 0x38}, + {DEMOD_WRITE, 0x98, 0xff}, + {DEMOD_WRITE, 0xc0, 0x0f}, + {DEMOD_WRITE, 0x89, 0x01}, +@@ -625,8 +640,13 @@ static int m88rs2000_set_frontend(struct + if (ret < 0) + return -ENODEV; + +- /* Reset Demod */ +- ret = m88rs2000_tab_set(state, fe_reset); ++ /* Reset demod by symbol rate */ ++ if (c->symbol_rate > 27500000) ++ ret = m88rs2000_writereg(state, 0xf1, 0xa4); ++ else ++ ret = m88rs2000_writereg(state, 0xf1, 0xbf); ++ ++ ret |= m88rs2000_tab_set(state, fe_reset); + if (ret < 0) + return -ENODEV; + diff --git a/queue-3.13/media-anysee-fix-non-working-e30-combo-plus-dvb-t.patch b/queue-3.13/media-anysee-fix-non-working-e30-combo-plus-dvb-t.patch new file mode 100644 index 00000000000..097f3b484e0 --- /dev/null +++ b/queue-3.13/media-anysee-fix-non-working-e30-combo-plus-dvb-t.patch @@ -0,0 +1,39 @@ +From c57f87e62368c33ebda11a4993380c8e5a19a5c5 Mon Sep 17 00:00:00 2001 +From: Antti Palosaari +Date: Mon, 16 Dec 2013 21:08:04 -0300 +Subject: media: anysee: fix non-working E30 Combo Plus DVB-T + +From: Antti Palosaari + +commit c57f87e62368c33ebda11a4993380c8e5a19a5c5 upstream. + +PLL was attached twice to frontend0 leaving frontend1 without a tuner. +frontend0 is DVB-C and frontend1 is DVB-T. + +Signed-off-by: Antti Palosaari +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/media/usb/dvb-usb-v2/anysee.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/media/usb/dvb-usb-v2/anysee.c ++++ b/drivers/media/usb/dvb-usb-v2/anysee.c +@@ -442,6 +442,7 @@ static struct cxd2820r_config anysee_cxd + * IOD[0] ZL10353 1=enabled + * IOE[0] tuner 0=enabled + * tuner is behind ZL10353 I2C-gate ++ * tuner is behind TDA10023 I2C-gate + * + * E7 TC VID=1c73 PID=861f HW=18 FW=0.7 AMTCI=0.5 "anysee-E7TC(LP)" + * PCB: 508TC (rev0.6) +@@ -956,7 +957,7 @@ static int anysee_tuner_attach(struct dv + + if (fe && adap->fe[1]) { + /* attach tuner for 2nd FE */ +- fe = dvb_attach(dvb_pll_attach, adap->fe[0], ++ fe = dvb_attach(dvb_pll_attach, adap->fe[1], + (0xc0 >> 1), &d->i2c_adap, + DVB_PLL_SAMSUNG_DTOS403IH102A); + } diff --git a/queue-3.13/media-media-v4l2-dev-fix-video-device-index-assignment.patch b/queue-3.13/media-media-v4l2-dev-fix-video-device-index-assignment.patch new file mode 100644 index 00000000000..035e376fa2b --- /dev/null +++ b/queue-3.13/media-media-v4l2-dev-fix-video-device-index-assignment.patch @@ -0,0 +1,40 @@ +From 6c3df5da67f1f53df78c7e20cd53a481dc28eade Mon Sep 17 00:00:00 2001 +From: Marek Szyprowski +Date: Tue, 3 Dec 2013 10:14:29 -0300 +Subject: media: media: v4l2-dev: fix video device index assignment + +From: Marek Szyprowski + +commit 6c3df5da67f1f53df78c7e20cd53a481dc28eade upstream. + +The side effect of commit 1056e4388b045 ("v4l2-dev: Fix race condition on +__video_register_device") is the increased number of index value assigned +on video_device registration. Before that commit video_devices were +numbered from 0, after it, the indexes starts from 1, because get_index() +always count the device, which is being registered. Some device drivers +rely on video_device index number for internal purposes, i.e. s5p-mfc +driver stopped working after that patch. This patch restores the old method +of numbering the video_device indexes. + +Signed-off-by: Marek Szyprowski +Acked-by: Sakari Ailus +Acked-by: Ricardo Ribalda +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/media/v4l2-core/v4l2-dev.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/media/v4l2-core/v4l2-dev.c ++++ b/drivers/media/v4l2-core/v4l2-dev.c +@@ -872,8 +872,8 @@ int __video_register_device(struct video + + /* Should not happen since we thought this minor was free */ + WARN_ON(video_device[vdev->minor] != NULL); +- video_device[vdev->minor] = vdev; + vdev->index = get_index(vdev); ++ video_device[vdev->minor] = vdev; + mutex_unlock(&videodev_lock); + + if (vdev->ioctl_ops) diff --git a/queue-3.13/media-s5p_mfc-remove-s5p_mfc_get_node_type-function.patch b/queue-3.13/media-s5p_mfc-remove-s5p_mfc_get_node_type-function.patch new file mode 100644 index 00000000000..7fb854eec1e --- /dev/null +++ b/queue-3.13/media-s5p_mfc-remove-s5p_mfc_get_node_type-function.patch @@ -0,0 +1,121 @@ +From b80cb8dc4162bc954cc71efec192ed89f2061573 Mon Sep 17 00:00:00 2001 +From: Marek Szyprowski +Date: Tue, 3 Dec 2013 10:12:51 -0300 +Subject: [media] media: s5p_mfc: remove s5p_mfc_get_node_type() function + +From: Marek Szyprowski + +commit b80cb8dc4162bc954cc71efec192ed89f2061573 upstream. + +s5p_mfc_get_node_type() relies on get_index() helper function, which in +turn relies on video_device index numbers assigned on driver +registration. All this code is not really needed, because there is +already access to respective video_device structures via common +s5p_mfc_dev structure. This fixes the issues introduced by patch +1056e4388b0454917a512618c8416a98628fc9ce ("v4l2-dev: Fix race condition +on __video_register_device"), which has been merged in v3.12-rc1. + +Signed-off-by: Marek Szyprowski +Signed-off-by: Kamil Debski +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/media/platform/s5p-mfc/s5p_mfc.c | 28 ++++++------------------ + drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 9 ------- + 2 files changed, 7 insertions(+), 30 deletions(-) + +--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c ++++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c +@@ -177,21 +177,6 @@ unlock: + mutex_unlock(&dev->mfc_mutex); + } + +-static enum s5p_mfc_node_type s5p_mfc_get_node_type(struct file *file) +-{ +- struct video_device *vdev = video_devdata(file); +- +- if (!vdev) { +- mfc_err("failed to get video_device"); +- return MFCNODE_INVALID; +- } +- if (vdev->index == 0) +- return MFCNODE_DECODER; +- else if (vdev->index == 1) +- return MFCNODE_ENCODER; +- return MFCNODE_INVALID; +-} +- + static void s5p_mfc_clear_int_flags(struct s5p_mfc_dev *dev) + { + mfc_write(dev, 0, S5P_FIMV_RISC_HOST_INT); +@@ -705,6 +690,7 @@ irq_cleanup_hw: + /* Open an MFC node */ + static int s5p_mfc_open(struct file *file) + { ++ struct video_device *vdev = video_devdata(file); + struct s5p_mfc_dev *dev = video_drvdata(file); + struct s5p_mfc_ctx *ctx = NULL; + struct vb2_queue *q; +@@ -742,7 +728,7 @@ static int s5p_mfc_open(struct file *fil + /* Mark context as idle */ + clear_work_bit_irqsave(ctx); + dev->ctx[ctx->num] = ctx; +- if (s5p_mfc_get_node_type(file) == MFCNODE_DECODER) { ++ if (vdev == dev->vfd_dec) { + ctx->type = MFCINST_DECODER; + ctx->c_ops = get_dec_codec_ops(); + s5p_mfc_dec_init(ctx); +@@ -752,7 +738,7 @@ static int s5p_mfc_open(struct file *fil + mfc_err("Failed to setup mfc controls\n"); + goto err_ctrls_setup; + } +- } else if (s5p_mfc_get_node_type(file) == MFCNODE_ENCODER) { ++ } else if (vdev == dev->vfd_enc) { + ctx->type = MFCINST_ENCODER; + ctx->c_ops = get_enc_codec_ops(); + /* only for encoder */ +@@ -797,10 +783,10 @@ static int s5p_mfc_open(struct file *fil + q = &ctx->vq_dst; + q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; + q->drv_priv = &ctx->fh; +- if (s5p_mfc_get_node_type(file) == MFCNODE_DECODER) { ++ if (vdev == dev->vfd_dec) { + q->io_modes = VB2_MMAP; + q->ops = get_dec_queue_ops(); +- } else if (s5p_mfc_get_node_type(file) == MFCNODE_ENCODER) { ++ } else if (vdev == dev->vfd_enc) { + q->io_modes = VB2_MMAP | VB2_USERPTR; + q->ops = get_enc_queue_ops(); + } else { +@@ -819,10 +805,10 @@ static int s5p_mfc_open(struct file *fil + q->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; + q->io_modes = VB2_MMAP; + q->drv_priv = &ctx->fh; +- if (s5p_mfc_get_node_type(file) == MFCNODE_DECODER) { ++ if (vdev == dev->vfd_dec) { + q->io_modes = VB2_MMAP; + q->ops = get_dec_queue_ops(); +- } else if (s5p_mfc_get_node_type(file) == MFCNODE_ENCODER) { ++ } else if (vdev == dev->vfd_enc) { + q->io_modes = VB2_MMAP | VB2_USERPTR; + q->ops = get_enc_queue_ops(); + } else { +--- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h ++++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h +@@ -115,15 +115,6 @@ enum s5p_mfc_fmt_type { + }; + + /** +- * enum s5p_mfc_node_type - The type of an MFC device node. +- */ +-enum s5p_mfc_node_type { +- MFCNODE_INVALID = -1, +- MFCNODE_DECODER = 0, +- MFCNODE_ENCODER = 1, +-}; +- +-/** + * enum s5p_mfc_inst_type - The type of an MFC instance. + */ + enum s5p_mfc_inst_type { diff --git a/queue-3.13/mm-oom-base-root-bonus-on-current-usage.patch b/queue-3.13/mm-oom-base-root-bonus-on-current-usage.patch new file mode 100644 index 00000000000..479476139d3 --- /dev/null +++ b/queue-3.13/mm-oom-base-root-bonus-on-current-usage.patch @@ -0,0 +1,74 @@ +From 778c14affaf94a9e4953179d3e13a544ccce7707 Mon Sep 17 00:00:00 2001 +From: David Rientjes +Date: Thu, 30 Jan 2014 15:46:11 -0800 +Subject: mm, oom: base root bonus on current usage + +From: David Rientjes + +commit 778c14affaf94a9e4953179d3e13a544ccce7707 upstream. + +A 3% of system memory bonus is sometimes too excessive in comparison to +other processes. + +With commit a63d83f427fb ("oom: badness heuristic rewrite"), the OOM +killer tries to avoid killing privileged tasks by subtracting 3% of +overall memory (system or cgroup) from their per-task consumption. But +as a result, all root tasks that consume less than 3% of overall memory +are considered equal, and so it only takes 33+ privileged tasks pushing +the system out of memory for the OOM killer to do something stupid and +kill dhclient or other root-owned processes. For example, on a 32G +machine it can't tell the difference between the 1M agetty and the 10G +fork bomb member. + +The changelog describes this 3% boost as the equivalent to the global +overcommit limit being 3% higher for privileged tasks, but this is not +the same as discounting 3% of overall memory from _every privileged task +individually_ during OOM selection. + +Replace the 3% of system memory bonus with a 3% of current memory usage +bonus. + +By giving root tasks a bonus that is proportional to their actual size, +they remain comparable even when relatively small. In the example +above, the OOM killer will discount the 1M agetty's 256 badness points +down to 179, and the 10G fork bomb's 262144 points down to 183500 points +and make the right choice, instead of discounting both to 0 and killing +agetty because it's first in the task list. + +Signed-off-by: David Rientjes +Reported-by: Johannes Weiner +Acked-by: Johannes Weiner +Cc: Michal Hocko +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + Documentation/filesystems/proc.txt | 4 ++-- + mm/oom_kill.c | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +--- a/Documentation/filesystems/proc.txt ++++ b/Documentation/filesystems/proc.txt +@@ -1377,8 +1377,8 @@ may allocate from based on an estimation + For example, if a task is using all allowed memory, its badness score will be + 1000. If it is using half of its allowed memory, its score will be 500. + +-There is an additional factor included in the badness score: root +-processes are given 3% extra memory over other tasks. ++There is an additional factor included in the badness score: the current memory ++and swap usage is discounted by 3% for root processes. + + The amount of "allowed" memory depends on the context in which the oom killer + was called. If it is due to the memory assigned to the allocating task's cpuset +--- a/mm/oom_kill.c ++++ b/mm/oom_kill.c +@@ -170,7 +170,7 @@ unsigned long oom_badness(struct task_st + * implementation used by LSMs. + */ + if (has_capability_noaudit(p, CAP_SYS_ADMIN)) +- adj -= 30; ++ points -= (points * 3) / 100; + + /* Normalize to oom_score_adj units */ + adj *= totalpages / 1000; diff --git a/queue-3.13/nxt200x-increase-write-buffer-size.patch b/queue-3.13/nxt200x-increase-write-buffer-size.patch new file mode 100644 index 00000000000..6e56715bc46 --- /dev/null +++ b/queue-3.13/nxt200x-increase-write-buffer-size.patch @@ -0,0 +1,36 @@ +From fa1e1de6bb679f2c86da3311bbafee7eaf78f125 Mon Sep 17 00:00:00 2001 +From: Mauro Carvalho Chehab +Date: Mon, 13 Jan 2014 05:59:30 -0200 +Subject: [media] nxt200x: increase write buffer size + +From: Mauro Carvalho Chehab + +commit fa1e1de6bb679f2c86da3311bbafee7eaf78f125 upstream. + +The buffer size on nxt200x is not enough: + + ... + > Dec 20 10:52:04 rich kernel: [ 31.747949] nxt200x: nxt200x_writebytes: i2c wr reg=002c: len=255 is too big! + ... + +Increase it to 256 bytes. + +Reported-by: Rich Freeman +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/media/dvb-frontends/nxt200x.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/media/dvb-frontends/nxt200x.c ++++ b/drivers/media/dvb-frontends/nxt200x.c +@@ -40,7 +40,7 @@ + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + + /* Max transfer size done by I2C transfer functions */ +-#define MAX_XFER_SIZE 64 ++#define MAX_XFER_SIZE 256 + + #define NXT2002_DEFAULT_FIRMWARE "dvb-fe-nxt2002.fw" + #define NXT2004_DEFAULT_FIRMWARE "dvb-fe-nxt2004.fw" diff --git a/queue-3.13/series b/queue-3.13/series index 58ee0dd2311..5440aa3ef9e 100644 --- a/queue-3.13/series +++ b/queue-3.13/series @@ -63,3 +63,13 @@ percpu_ida-make-percpu_ida_alloc-callers-accept-task-state-bitmask.patch iscsi-target-fix-connection-reset-hang-with-percpu_ida_alloc.patch numa-add-a-sysctl-for-numa_balancing.patch mm-numa-initialise-numa-balancing-after-jump-label-initialisation.patch +mm-oom-base-root-bonus-on-current-usage.patch +media-media-v4l2-dev-fix-video-device-index-assignment.patch +media-anysee-fix-non-working-e30-combo-plus-dvb-t.patch +dib8000-make-32-bits-read-atomic.patch +media-s5p_mfc-remove-s5p_mfc_get_node_type-function.patch +it913x-add-support-for-avermedia-h335-id-0x0335.patch +nxt200x-increase-write-buffer-size.patch +dib8000-fix-regression-with-dib807x.patch +m88rs2000-add-m88rs2000_set_carrieroffset.patch +m88rs2000-set-symbol-rate-accurately.patch