--- /dev/null
+From d67350f8c4e67f5eba627e1fd111f16257ca9c95 Mon Sep 17 00:00:00 2001
+From: Olivier Grenie <olivier.grenie@parrot.com>
+Date: Thu, 12 Dec 2013 09:26:22 -0300
+Subject: [media] dib8000: fix regression with dib807x
+
+From: Olivier Grenie <olivier.grenie@parrot.com>
+
+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 <olivier.grenie@parrot.com>
+Acked-by: Patrick Boettcher <pboettcher@kernellabs.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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;
--- /dev/null
+From 5ac64ba12aca3bef18e61c866583155a3bbf81c4 Mon Sep 17 00:00:00 2001
+From: Mauro Carvalho Chehab <m.chehab@samsung.com>
+Date: Fri, 13 Dec 2013 10:35:03 -0300
+Subject: [media] dib8000: make 32 bits read atomic
+
+From: Mauro Carvalho Chehab <m.chehab@samsung.com>
+
+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 <m.chehab@samsung.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+Acked-by: Patrick Boettcher <pboettcher@kernellabs.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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]));
+ }
--- /dev/null
+From 06af15d1b6f45c60358feab88004472e5428f01c Mon Sep 17 00:00:00 2001
+From: Malcolm Priestley <tvboxspy@gmail.com>
+Date: Tue, 24 Dec 2013 13:17:12 -0300
+Subject: [media] m88rs2000: add m88rs2000_set_carrieroffset
+
+From: Malcolm Priestley <tvboxspy@gmail.com>
+
+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 <tvboxspy@gmail.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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,
--- /dev/null
+From dd4491dfb9eb4fa3bfa7dc73ba989e69fbce2e10 Mon Sep 17 00:00:00 2001
+From: Malcolm Priestley <tvboxspy@gmail.com>
+Date: Tue, 24 Dec 2013 13:18:46 -0300
+Subject: [media] m88rs2000: set symbol rate accurately
+
+From: Malcolm Priestley <tvboxspy@gmail.com>
+
+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 <tvboxspy@gmail.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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;
+
--- /dev/null
+From c57f87e62368c33ebda11a4993380c8e5a19a5c5 Mon Sep 17 00:00:00 2001
+From: Antti Palosaari <crope@iki.fi>
+Date: Mon, 16 Dec 2013 21:08:04 -0300
+Subject: media: anysee: fix non-working E30 Combo Plus DVB-T
+
+From: Antti Palosaari <crope@iki.fi>
+
+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 <crope@iki.fi>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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);
+ }
--- /dev/null
+From b80cb8dc4162bc954cc71efec192ed89f2061573 Mon Sep 17 00:00:00 2001
+From: Marek Szyprowski <m.szyprowski@samsung.com>
+Date: Tue, 3 Dec 2013 10:12:51 -0300
+Subject: [media] media: s5p_mfc: remove s5p_mfc_get_node_type() function
+
+From: Marek Szyprowski <m.szyprowski@samsung.com>
+
+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 <m.szyprowski@samsung.com>
+Signed-off-by: Kamil Debski <k.debski@samsung.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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);
+@@ -701,6 +686,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;
+@@ -738,7 +724,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);
+@@ -748,7 +734,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 */
+@@ -793,10 +779,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 {
+@@ -815,10 +801,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
+@@ -113,15 +113,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 {
--- /dev/null
+From 778c14affaf94a9e4953179d3e13a544ccce7707 Mon Sep 17 00:00:00 2001
+From: David Rientjes <rientjes@google.com>
+Date: Thu, 30 Jan 2014 15:46:11 -0800
+Subject: mm, oom: base root bonus on current usage
+
+From: David Rientjes <rientjes@google.com>
+
+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 <rientjes@google.com>
+Reported-by: Johannes Weiner <hannes@cmpxchg.org>
+Acked-by: Johannes Weiner <hannes@cmpxchg.org>
+Cc: Michal Hocko <mhocko@suse.cz>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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
+@@ -1372,8 +1372,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;
--- /dev/null
+From fa1e1de6bb679f2c86da3311bbafee7eaf78f125 Mon Sep 17 00:00:00 2001
+From: Mauro Carvalho Chehab <m.chehab@samsung.com>
+Date: Mon, 13 Jan 2014 05:59:30 -0200
+Subject: [media] nxt200x: increase write buffer size
+
+From: Mauro Carvalho Chehab <m.chehab@samsung.com>
+
+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 <rich0@gentoo.org>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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"
dm-space-map-metadata-fix-bug-in-resizing-of-thin-metadata.patch
drm-radeon-warn-users-when-hw_i2c-is-enabled-v2.patch
radeon-pm-guard-access-to-rdev-pm.power_state-array.patch
+mm-oom-base-root-bonus-on-current-usage.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
+nxt200x-increase-write-buffer-size.patch
+dib8000-fix-regression-with-dib807x.patch
+m88rs2000-add-m88rs2000_set_carrieroffset.patch
+m88rs2000-set-symbol-rate-accurately.patch