]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge commit '67dd8f35c2d8ed80f26c9654b474cffc11c6674d' into patchwork
authorMauro Carvalho Chehab <m.chehab@samsung.com>
Tue, 22 Jul 2014 05:03:59 +0000 (02:03 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Tue, 22 Jul 2014 05:03:59 +0000 (02:03 -0300)
* .: (268 commits)
  Linux 3.16-rc6
  um: segv: Save regs only in case of a kernel mode fault
  um: Fix hung task in fix_range_common()
  um: Ensure that a stub page cannot get unmapped
  Revert "um: Fix wait_stub_done() error handling"
  btrfs: test for valid bdev before kobj removal in btrfs_rm_device
  Btrfs: fix abnormal long waiting in fsync
  random: check for increase of entropy_count because of signed conversion
  ARM: EXYNOS: Fix core ID used by platsmp and hotplug code
  ahci: add support for the Promise FastTrak TX8660 SATA HBA (ahci mode)
  ARM: at91/dt: add missing clocks property to pwm node in sam9x5.dtsi
  ARM: at91/dt: fix usb0 clocks definition in sam9n12 dtsi
  ARM: at91: at91sam9x5: correct typo error for ohci clock
  irqchip: gic: Fix core ID calculation when topology is read from DT
  GFS2: fs/gfs2/rgrp.c: kernel-doc warning fixes
  GFS2: memcontrol: Spelling s/invlidate/invalidate/
  GFS2: Allow caching of glocks for flock
  GFS2: Allow flocks to use normal glock dq rather than dq_wait
  GFS2: replace count*size kzalloc by kcalloc
  GFS2: Use GFP_NOFS when allocating glocks
  ...

Conflicts:
drivers/media/dvb-frontends/si2168.c
drivers/media/dvb-frontends/si2168_priv.h
drivers/media/tuners/si2157.c

1  2 
MAINTAINERS
drivers/media/dvb-frontends/si2168.c
drivers/media/dvb-frontends/si2168_priv.h
drivers/media/pci/saa7134/saa7134-empress.c
drivers/media/platform/davinci/vpif_capture.c
drivers/media/platform/davinci/vpif_display.c
drivers/media/usb/gspca/pac7302.c
drivers/media/usb/hdpvr/hdpvr-video.c

diff --combined MAINTAINERS
index 43844648d8287864b3b65bdecc227ad8fa6a5148,d76e07798e052b8fcb558a3fb72d0321530d3f6d..8982036ffa4f1d75c0553d90eda89cbf0e8be9a5
@@@ -156,7 -156,6 +156,6 @@@ F: drivers/net/hamradio/6pack.
  
  8169 10/100/1000 GIGABIT ETHERNET DRIVER
  M:    Realtek linux nic maintainers <nic_swsd@realtek.com>
- M:    Francois Romieu <romieu@fr.zoreil.com>
  L:    netdev@vger.kernel.org
  S:    Maintained
  F:    drivers/net/ethernet/realtek/r8169.c
@@@ -515,16 -514,6 +514,16 @@@ S:       Supporte
  F:    fs/aio.c
  F:    include/linux/*aio*.h
  
 +AIRSPY MEDIA DRIVER
 +M:    Antti Palosaari <crope@iki.fi>
 +L:    linux-media@vger.kernel.org
 +W:    http://linuxtv.org/
 +W:    http://palosaari.fi/linux/
 +Q:    http://patchwork.linuxtv.org/project/linux-media/list/
 +T:    git git://linuxtv.org/anttip/media_tree.git
 +S:    Maintained
 +F:    drivers/media/usb/airspy/
 +
  ALCATEL SPEEDTOUCH USB DRIVER
  M:    Duncan Sands <duncan.sands@free.fr>
  L:    linux-usb@vger.kernel.org
@@@ -4521,8 -4510,7 +4520,7 @@@ S:      Supporte
  F:    drivers/idle/i7300_idle.c
  
  IEEE 802.15.4 SUBSYSTEM
- M:    Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
- M:    Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
+ M:    Alexander Aring <alex.aring@gmail.com>
  L:    linux-zigbee-devel@lists.sourceforge.net (moderated for non-subscribers)
  W:    http://apps.sourceforge.net/trac/linux-zigbee
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/lowpan/lowpan.git
@@@ -5967,9 -5955,9 +5965,9 @@@ W:      http://palosaari.fi/linux
  Q:    http://patchwork.linuxtv.org/project/linux-media/list/
  T:    git git://linuxtv.org/anttip/media_tree.git
  S:    Maintained
 -F:    drivers/staging/media/msi3101/msi001*
 +F:    drivers/media/tuners/msi001*
  
 -MSI3101 MEDIA DRIVER
 +MSI2500 MEDIA DRIVER
  M:    Antti Palosaari <crope@iki.fi>
  L:    linux-media@vger.kernel.org
  W:    http://linuxtv.org/
@@@ -5977,7 -5965,7 +5975,7 @@@ W:      http://palosaari.fi/linux
  Q:    http://patchwork.linuxtv.org/project/linux-media/list/
  T:    git git://linuxtv.org/anttip/media_tree.git
  S:    Maintained
 -F:    drivers/staging/media/msi3101/sdr-msi3101*
 +F:    drivers/media/usb/msi2500/
  
  MT9M032 APTINA SENSOR DRIVER
  M:    Laurent Pinchart <laurent.pinchart@ideasonboard.com>
@@@ -6501,12 -6489,11 +6499,12 @@@ L:   linux-omap@vger.kernel.or
  S:    Maintained
  F:    arch/arm/mach-omap2/omap_hwmod_44xx_data.c
  
 -OMAP IMAGE SIGNAL PROCESSOR (ISP)
 +OMAP IMAGING SUBSYSTEM (OMAP3 ISP and OMAP4 ISS)
  M:    Laurent Pinchart <laurent.pinchart@ideasonboard.com>
  L:    linux-media@vger.kernel.org
  S:    Maintained
  F:    drivers/media/platform/omap3isp/
 +F:    drivers/staging/media/omap4iss/
  
  OMAP USB SUPPORT
  M:    Felipe Balbi <balbi@ti.com>
@@@ -7595,7 -7582,7 +7593,7 @@@ W:      http://palosaari.fi/linux
  Q:    http://patchwork.linuxtv.org/project/linux-media/list/
  T:    git git://linuxtv.org/anttip/media_tree.git
  S:    Maintained
 -F:    drivers/staging/media/rtl2832u_sdr/rtl2832_sdr*
 +F:    drivers/media/dvb-frontends/rtl2832_sdr*
  
  RTL8180 WIRELESS DRIVER
  M:    "John W. Linville" <linville@tuxdriver.com>
@@@ -8032,6 -8019,16 +8030,16 @@@ F:    drivers/ata
  F:    include/linux/ata.h
  F:    include/linux/libata.h
  
+ SERIAL ATA AHCI PLATFORM devices support
+ M:    Hans de Goede <hdegoede@redhat.com>
+ M:    Tejun Heo <tj@kernel.org>
+ L:    linux-ide@vger.kernel.org
+ T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata.git
+ S:    Supported
+ F:    drivers/ata/ahci_platform.c
+ F:    drivers/ata/libahci_platform.c
+ F:    include/linux/ahci_platform.h
  SERVER ENGINES 10Gbps iSCSI - BladeEngine 2 DRIVER
  M:    Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
  L:    linux-scsi@vger.kernel.org
@@@ -9528,6 -9525,15 +9536,6 @@@ L:     netdev@vger.kernel.or
  S:    Maintained
  F:    drivers/net/usb/smsc95xx.*
  
 -USB SN9C1xx DRIVER
 -M:    Luca Risolia <luca.risolia@studio.unibo.it>
 -L:    linux-usb@vger.kernel.org
 -L:    linux-media@vger.kernel.org
 -T:    git git://linuxtv.org/media_tree.git
 -W:    http://www.linux-projects.org
 -S:    Maintained
 -F:    drivers/staging/media/sn9c102/
 -
  USB SUBSYSTEM
  M:    Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  L:    linux-usb@vger.kernel.org
index 97c46797aea6147c84e2a1562fc762c3abff794b,2e3cdcfa0a675b2f8835fde25924d262f6ed6264..41bdbc4d9f6c7afebecb705a32927b433a233f17
@@@ -60,7 -60,7 +60,7 @@@ static int si2168_cmd_execute(struct si
                                jiffies_to_msecs(jiffies) -
                                (jiffies_to_msecs(timeout) - TIMEOUT));
  
-               if (!(cmd->args[0] >> 7) & 0x01) {
+               if (!((cmd->args[0] >> 7) & 0x01)) {
                        ret = -ETIMEDOUT;
                        goto err_mutex_unlock;
                }
@@@ -95,17 -95,20 +95,17 @@@ static int si2168_read_status(struct dv
  
        switch (c->delivery_system) {
        case SYS_DVBT:
 -              cmd.args[0] = 0xa0;
 -              cmd.args[1] = 0x01;
 +              memcpy(cmd.args, "\xa0\x01", 2);
                cmd.wlen = 2;
                cmd.rlen = 13;
                break;
        case SYS_DVBC_ANNEX_A:
 -              cmd.args[0] = 0x90;
 -              cmd.args[1] = 0x01;
 +              memcpy(cmd.args, "\x90\x01", 2);
                cmd.wlen = 2;
                cmd.rlen = 9;
                break;
        case SYS_DVBT2:
 -              cmd.args[0] = 0x50;
 -              cmd.args[1] = 0x01;
 +              memcpy(cmd.args, "\x50\x01", 2);
                cmd.wlen = 2;
                cmd.rlen = 14;
                break;
  
        s->fe_status = *status;
  
 +      if (*status & FE_HAS_LOCK) {
 +              c->cnr.len = 1;
 +              c->cnr.stat[0].scale = FE_SCALE_DECIBEL;
 +              c->cnr.stat[0].svalue = cmd.args[3] * 1000 / 4;
 +      } else {
 +              c->cnr.len = 1;
 +              c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
 +      }
 +
        dev_dbg(&s->client->dev, "%s: status=%02x args=%*ph\n",
                        __func__, *status, cmd.rlen, cmd.args);
  
@@@ -249,23 -243,51 +249,23 @@@ static int si2168_set_frontend(struct d
        if (ret)
                goto err;
  
 -      memcpy(cmd.args, "\x14\x00\x01\x04\x00\x00", 6);
 -      cmd.wlen = 6;
 -      cmd.rlen = 1;
 -      ret = si2168_cmd_execute(s, &cmd);
 -      if (ret)
 -              goto err;
 -
 -      memcpy(cmd.args, "\x14\x00\x03\x10\x17\x00", 6);
 -      cmd.wlen = 6;
 -      cmd.rlen = 1;
 -      ret = si2168_cmd_execute(s, &cmd);
 -      if (ret)
 -              goto err;
 -
 -      memcpy(cmd.args, "\x14\x00\x02\x10\x15\x00", 6);
 -      cmd.wlen = 6;
 -      cmd.rlen = 1;
 -      ret = si2168_cmd_execute(s, &cmd);
 -      if (ret)
 -              goto err;
 -
        memcpy(cmd.args, "\x14\x00\x0c\x10\x12\x00", 6);
        cmd.wlen = 6;
 -      cmd.rlen = 1;
 +      cmd.rlen = 4;
        ret = si2168_cmd_execute(s, &cmd);
        if (ret)
                goto err;
  
        memcpy(cmd.args, "\x14\x00\x06\x10\x24\x00", 6);
        cmd.wlen = 6;
 -      cmd.rlen = 1;
 -      ret = si2168_cmd_execute(s, &cmd);
 -      if (ret)
 -              goto err;
 -
 -      memcpy(cmd.args, "\x14\x00\x0b\x10\x88\x13", 6);
 -      cmd.wlen = 6;
 -      cmd.rlen = 1;
 +      cmd.rlen = 4;
        ret = si2168_cmd_execute(s, &cmd);
        if (ret)
                goto err;
  
        memcpy(cmd.args, "\x14\x00\x07\x10\x00\x24", 6);
        cmd.wlen = 6;
 -      cmd.rlen = 1;
 +      cmd.rlen = 4;
        ret = si2168_cmd_execute(s, &cmd);
        if (ret)
                goto err;
        memcpy(cmd.args, "\x14\x00\x0a\x10\x00\x00", 6);
        cmd.args[4] = delivery_system | bandwidth;
        cmd.wlen = 6;
 -      cmd.rlen = 1;
 +      cmd.rlen = 4;
        ret = si2168_cmd_execute(s, &cmd);
        if (ret)
                goto err;
  
 -      memcpy(cmd.args, "\x14\x00\x04\x10\x15\x00", 6);
 -      cmd.wlen = 6;
 -      cmd.rlen = 1;
 -      ret = si2168_cmd_execute(s, &cmd);
 -      if (ret)
 -              goto err;
 -
 -      memcpy(cmd.args, "\x14\x00\x05\x10\xa1\x00", 6);
 -      cmd.wlen = 6;
 -      cmd.rlen = 1;
 -      ret = si2168_cmd_execute(s, &cmd);
 -      if (ret)
 -              goto err;
 +      /* set DVB-C symbol rate */
 +      if (c->delivery_system == SYS_DVBC_ANNEX_A) {
 +              memcpy(cmd.args, "\x14\x00\x02\x11", 4);
 +              cmd.args[4] = (c->symbol_rate / 1000) & 0xff;
 +              cmd.args[5] = ((c->symbol_rate / 1000) >> 8) & 0xff;
 +              cmd.wlen = 6;
 +              cmd.rlen = 4;
 +              ret = si2168_cmd_execute(s, &cmd);
 +              if (ret)
 +                      goto err;
 +      }
  
        memcpy(cmd.args, "\x14\x00\x0f\x10\x10\x00", 6);
        cmd.wlen = 6;
 -      cmd.rlen = 1;
 +      cmd.rlen = 4;
        ret = si2168_cmd_execute(s, &cmd);
        if (ret)
                goto err;
  
 -      memcpy(cmd.args, "\x14\x00\x0d\x10\xd0\x02", 6);
 -      cmd.wlen = 6;
 -      cmd.rlen = 1;
 -      ret = si2168_cmd_execute(s, &cmd);
 -      if (ret)
 -              goto err;
 -
 -      memcpy(cmd.args, "\x14\x00\x01\x10\x00\x00", 6);
 +      memcpy(cmd.args, "\x14\x00\x01\x10\x16\x00", 6);
        cmd.wlen = 6;
 -      cmd.rlen = 1;
 +      cmd.rlen = 4;
        ret = si2168_cmd_execute(s, &cmd);
        if (ret)
                goto err;
  
        memcpy(cmd.args, "\x14\x00\x09\x10\xe3\x18", 6);
        cmd.wlen = 6;
 -      cmd.rlen = 1;
 +      cmd.rlen = 4;
        ret = si2168_cmd_execute(s, &cmd);
        if (ret)
                goto err;
  
        memcpy(cmd.args, "\x14\x00\x08\x10\xd7\x15", 6);
        cmd.wlen = 6;
 -      cmd.rlen = 1;
 -      ret = si2168_cmd_execute(s, &cmd);
 -      if (ret)
 -              goto err;
 -
 -      memcpy(cmd.args, "\x14\x00\x04\x03\x00\x00", 6);
 -      cmd.wlen = 6;
 -      cmd.rlen = 1;
 -      ret = si2168_cmd_execute(s, &cmd);
 -      if (ret)
 -              goto err;
 -
 -      memcpy(cmd.args, "\x14\x00\x03\x03\x00\x00", 6);
 -      cmd.wlen = 6;
 -      cmd.rlen = 1;
 -      ret = si2168_cmd_execute(s, &cmd);
 -      if (ret)
 -              goto err;
 -
 -      memcpy(cmd.args, "\x14\x00\x08\x03\x00\x00", 6);
 -      cmd.wlen = 6;
 -      cmd.rlen = 1;
 -      ret = si2168_cmd_execute(s, &cmd);
 -      if (ret)
 -              goto err;
 -
 -      memcpy(cmd.args, "\x14\x00\x07\x03\x01\x02", 6);
 -      cmd.wlen = 6;
 -      cmd.rlen = 1;
 -      ret = si2168_cmd_execute(s, &cmd);
 -      if (ret)
 -              goto err;
 -
 -      memcpy(cmd.args, "\x14\x00\x06\x03\x00\x00", 6);
 -      cmd.wlen = 6;
 -      cmd.rlen = 1;
 -      ret = si2168_cmd_execute(s, &cmd);
 -      if (ret)
 -              goto err;
 -
 -      memcpy(cmd.args, "\x14\x00\x05\x03\x00\x00", 6);
 -      cmd.wlen = 6;
 -      cmd.rlen = 1;
 -      ret = si2168_cmd_execute(s, &cmd);
 -      if (ret)
 -              goto err;
 -
 -      memcpy(cmd.args, "\x14\x00\x01\x03\x0c\x40", 6);
 -      cmd.wlen = 6;
 -      cmd.rlen = 1;
 +      cmd.rlen = 4;
        ret = si2168_cmd_execute(s, &cmd);
        if (ret)
                goto err;
  
 -      memcpy(cmd.args, "\x14\x00\x01\x10\x16\x00", 6);
 +      memcpy(cmd.args, "\x14\x00\x01\x12\x00\x00", 6);
        cmd.wlen = 6;
 -      cmd.rlen = 1;
 +      cmd.rlen = 4;
        ret = si2168_cmd_execute(s, &cmd);
        if (ret)
                goto err;
  
 -      memcpy(cmd.args, "\x14\x00\x01\x12\x00\x00", 6);
 +      memcpy(cmd.args, "\x14\x00\x01\x03\x0c\x00", 6);
        cmd.wlen = 6;
 -      cmd.rlen = 1;
 +      cmd.rlen = 4;
        ret = si2168_cmd_execute(s, &cmd);
        if (ret)
                goto err;
  
 -      cmd.args[0] = 0x85;
 +      memcpy(cmd.args, "\x85", 1);
        cmd.wlen = 1;
        cmd.rlen = 1;
        ret = si2168_cmd_execute(s, &cmd);
@@@ -352,75 -432,59 +352,75 @@@ static int si2168_init(struct dvb_front
        struct si2168 *s = fe->demodulator_priv;
        int ret, len, remaining;
        const struct firmware *fw = NULL;
 -      u8 *fw_file = SI2168_FIRMWARE;
 +      u8 *fw_file;
        const unsigned int i2c_wr_max = 8;
        struct si2168_cmd cmd;
 +      unsigned int chip_id;
  
        dev_dbg(&s->client->dev, "%s:\n", __func__);
  
 -      cmd.args[0] = 0x13;
 -      cmd.wlen = 1;
 -      cmd.rlen = 0;
 -      ret = si2168_cmd_execute(s, &cmd);
 -      if (ret)
 -              goto err;
 -
 -      cmd.args[0] = 0xc0;
 -      cmd.args[1] = 0x12;
 -      cmd.args[2] = 0x00;
 -      cmd.args[3] = 0x0c;
 -      cmd.args[4] = 0x00;
 -      cmd.args[5] = 0x0d;
 -      cmd.args[6] = 0x16;
 -      cmd.args[7] = 0x00;
 -      cmd.args[8] = 0x00;
 -      cmd.args[9] = 0x00;
 -      cmd.args[10] = 0x00;
 -      cmd.args[11] = 0x00;
 -      cmd.args[12] = 0x00;
 +      memcpy(cmd.args, "\xc0\x12\x00\x0c\x00\x0d\x16\x00\x00\x00\x00\x00\x00", 13);
        cmd.wlen = 13;
        cmd.rlen = 0;
        ret = si2168_cmd_execute(s, &cmd);
        if (ret)
                goto err;
  
 -      cmd.args[0] = 0xc0;
 -      cmd.args[1] = 0x06;
 -      cmd.args[2] = 0x01;
 -      cmd.args[3] = 0x0f;
 -      cmd.args[4] = 0x00;
 -      cmd.args[5] = 0x20;
 -      cmd.args[6] = 0x20;
 -      cmd.args[7] = 0x01;
 +      memcpy(cmd.args, "\xc0\x06\x01\x0f\x00\x20\x20\x01", 8);
        cmd.wlen = 8;
        cmd.rlen = 1;
        ret = si2168_cmd_execute(s, &cmd);
        if (ret)
                goto err;
  
 -      cmd.args[0] = 0x02;
 +      /* query chip revision */
 +      memcpy(cmd.args, "\x02", 1);
        cmd.wlen = 1;
        cmd.rlen = 13;
        ret = si2168_cmd_execute(s, &cmd);
        if (ret)
                goto err;
  
 +      cmd.args[0] = 0x05;
 +      cmd.args[1] = 0x00;
 +      cmd.args[2] = 0xaa;
 +      cmd.args[3] = 0x4d;
 +      cmd.args[4] = 0x56;
 +      cmd.args[5] = 0x40;
 +      cmd.args[6] = 0x00;
 +      cmd.args[7] = 0x00;
 +      cmd.wlen = 8;
 +      cmd.rlen = 1;
 +      ret = si2168_cmd_execute(s, &cmd);
 +      if (ret)
 +              goto err;
 +
 +      chip_id = cmd.args[1] << 24 | cmd.args[2] << 16 | cmd.args[3] << 8 |
 +                      cmd.args[4] << 0;
 +
 +      #define SI2168_A20 ('A' << 24 | 68 << 16 | '2' << 8 | '0' << 0)
 +      #define SI2168_A30 ('A' << 24 | 68 << 16 | '3' << 8 | '0' << 0)
 +      #define SI2168_B40 ('B' << 24 | 68 << 16 | '4' << 8 | '0' << 0)
 +
 +      switch (chip_id) {
 +      case SI2168_A20:
 +              fw_file = SI2168_A20_FIRMWARE;
 +              break;
 +      case SI2168_A30:
 +              fw_file = SI2168_A30_FIRMWARE;
 +              break;
 +      case SI2168_B40:
 +              fw_file = SI2168_B40_FIRMWARE;
 +              break;
 +      default:
 +              dev_err(&s->client->dev,
 +                              "%s: unkown chip version Si21%d-%c%c%c\n",
 +                              KBUILD_MODNAME, cmd.args[2], cmd.args[1],
 +                              cmd.args[3], cmd.args[4]);
 +              ret = -EINVAL;
 +              goto err;
 +      }
 +
        /* cold state - try to download firmware */
        dev_info(&s->client->dev, "%s: found a '%s' in cold state\n",
                        KBUILD_MODNAME, si2168_ops.info.name);
        /* request the firmware, this will block and timeout */
        ret = request_firmware(&fw, fw_file, &s->client->dev);
        if (ret) {
 -              dev_err(&s->client->dev, "%s: firmare file '%s' not found\n",
 -                              KBUILD_MODNAME, fw_file);
 -              goto err;
 +              /* fallback mechanism to handle old name for Si2168 B40 fw */
 +              if (chip_id == SI2168_B40) {
 +                      fw_file = SI2168_B40_FIRMWARE_FALLBACK;
 +                      ret = request_firmware(&fw, fw_file, &s->client->dev);
 +              }
 +
 +              if (ret == 0) {
 +                      dev_notice(&s->client->dev,
 +                                      "%s: please install firmware file '%s'\n",
 +                                      KBUILD_MODNAME, SI2168_B40_FIRMWARE);
 +              } else {
 +                      dev_err(&s->client->dev,
 +                                      "%s: firmware file '%s' not found\n",
 +                                      KBUILD_MODNAME, fw_file);
 +                      goto err;
 +              }
        }
  
        dev_info(&s->client->dev, "%s: downloading firmware from file '%s'\n",
        release_firmware(fw);
        fw = NULL;
  
 -      cmd.args[0] = 0x01;
 -      cmd.args[1] = 0x01;
 +      memcpy(cmd.args, "\x01\x01", 2);
        cmd.wlen = 2;
        cmd.rlen = 1;
        ret = si2168_cmd_execute(s, &cmd);
@@@ -493,24 -545,12 +493,24 @@@ err
  static int si2168_sleep(struct dvb_frontend *fe)
  {
        struct si2168 *s = fe->demodulator_priv;
 +      int ret;
 +      struct si2168_cmd cmd;
  
        dev_dbg(&s->client->dev, "%s:\n", __func__);
  
        s->active = false;
  
 +      memcpy(cmd.args, "\x13", 1);
 +      cmd.wlen = 1;
 +      cmd.rlen = 0;
 +      ret = si2168_cmd_execute(s, &cmd);
 +      if (ret)
 +              goto err;
 +
        return 0;
 +err:
 +      dev_dbg(&s->client->dev, "%s: failed=%d\n", __func__, ret);
 +      return ret;
  }
  
  static int si2168_get_tune_settings(struct dvb_frontend *fe,
@@@ -620,6 -660,7 +620,6 @@@ static int si2168_probe(struct i2c_clie
        struct si2168_config *config = client->dev.platform_data;
        struct si2168 *s;
        int ret;
 -      struct si2168_cmd cmd;
  
        dev_dbg(&client->dev, "%s:\n", __func__);
  
        s->client = client;
        mutex_init(&s->i2c_mutex);
  
 -      /* check if the demod is there */
 -      cmd.wlen = 0;
 -      cmd.rlen = 1;
 -      ret = si2168_cmd_execute(s, &cmd);
 -      if (ret)
 -              goto err;
 -
        /* create mux i2c adapter for tuner */
        s->adapter = i2c_add_mux_adapter(client->adapter, &client->dev, s,
                        0, 0, 0, si2168_select, si2168_deselect);
 -      if (s->adapter == NULL)
 +      if (s->adapter == NULL) {
 +              ret = -ENODEV;
                goto err;
 +      }
  
        /* create dvb_frontend */
        memcpy(&s->fe.ops, &si2168_ops, sizeof(struct dvb_frontend_ops));
@@@ -697,6 -743,4 +697,6 @@@ module_i2c_driver(si2168_driver)
  MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
  MODULE_DESCRIPTION("Silicon Labs Si2168 DVB-T/T2/C demodulator driver");
  MODULE_LICENSE("GPL");
 -MODULE_FIRMWARE(SI2168_FIRMWARE);
 +MODULE_FIRMWARE(SI2168_A20_FIRMWARE);
 +MODULE_FIRMWARE(SI2168_A30_FIRMWARE);
 +MODULE_FIRMWARE(SI2168_B40_FIRMWARE);
index c1f7a4c39ab5bad873dab54e12dfad36d67f5c7c,53f7f06ae3437aca8981f8d63f8e6538f7a77978..ebbf502ec313cff28deecb7c2531ac8a04cbc75c
  #include <linux/firmware.h>
  #include <linux/i2c-mux.h>
  
 -#define SI2168_FIRMWARE "dvb-demod-si2168-02.fw"
 +#define SI2168_A20_FIRMWARE "dvb-demod-si2168-a20-01.fw"
 +#define SI2168_A30_FIRMWARE "dvb-demod-si2168-a30-01.fw"
 +#define SI2168_B40_FIRMWARE "dvb-demod-si2168-b40-01.fw"
- #define SI2168_B40_FIRMWARE_FALLBACK "dvb-demod-si2168-01.fw"
++#define SI2168_B40_FIRMWARE_FALLBACK "dvb-demod-si2168-02.fw"
  
  /* state struct */
  struct si2168 {
@@@ -39,9 -36,9 +39,9 @@@
  };
  
  /* firmare command struct */
 -#define SI2157_ARGLEN      30
 +#define SI2168_ARGLEN      30
  struct si2168_cmd {
 -      u8 args[SI2157_ARGLEN];
 +      u8 args[SI2168_ARGLEN];
        unsigned wlen;
        unsigned rlen;
  };
index ef39261c1f20365a84958e026b690f8d2ab6e90a,0006d6bf8c18a5015dea50cbd4e0386802b80bc6..e4ea85fd1b23b07ed75ff67bd5fe4f14ac5528ce
@@@ -130,6 -130,7 +130,6 @@@ static int empress_g_fmt_vid_cap(struc
        f->fmt.pix.pixelformat  = V4L2_PIX_FMT_MPEG;
        f->fmt.pix.sizeimage    = TS_PACKET_SIZE * dev->ts.nr_packets;
        f->fmt.pix.bytesperline = 0;
 -      f->fmt.pix.priv = 0;
  
        return 0;
  }
@@@ -147,6 -148,7 +147,6 @@@ static int empress_s_fmt_vid_cap(struc
        f->fmt.pix.pixelformat  = V4L2_PIX_FMT_MPEG;
        f->fmt.pix.sizeimage    = TS_PACKET_SIZE * dev->ts.nr_packets;
        f->fmt.pix.bytesperline = 0;
 -      f->fmt.pix.priv = 0;
  
        return 0;
  }
@@@ -164,6 -166,7 +164,6 @@@ static int empress_try_fmt_vid_cap(stru
        f->fmt.pix.pixelformat  = V4L2_PIX_FMT_MPEG;
        f->fmt.pix.sizeimage    = TS_PACKET_SIZE * dev->ts.nr_packets;
        f->fmt.pix.bytesperline = 0;
 -      f->fmt.pix.priv = 0;
  
        return 0;
  }
@@@ -176,7 -179,7 +176,7 @@@ static const struct v4l2_file_operation
        .read     = vb2_fop_read,
        .poll     = vb2_fop_poll,
        .mmap     = vb2_fop_mmap,
-       .ioctl    = video_ioctl2,
+       .unlocked_ioctl = video_ioctl2,
  };
  
  static const struct v4l2_ioctl_ops ts_ioctl_ops = {
@@@ -267,6 -270,7 +267,6 @@@ static int empress_init(struct saa7134_
        snprintf(dev->empress_dev->name, sizeof(dev->empress_dev->name),
                 "%s empress (%s)", dev->name,
                 saa7134_boards[dev->board].name);
 -      set_bit(V4L2_FL_USE_FH_PRIO, &dev->empress_dev->flags);
        v4l2_ctrl_handler_init(hdl, 21);
        v4l2_ctrl_add_handler(hdl, &dev->ctrl_handler, empress_ctrl_filter);
        if (dev->empress_sd)
index 3a85238afee372764ba960c5289d3c4b37ac269c,1e4ec697fb1054c69becb4f4483f228508c2efe7..b054b7eec53dc5a98dd43ba02dd8e343bbc19005
@@@ -39,10 -39,32 +39,10 @@@ MODULE_VERSION(VPIF_CAPTURE_VERSION)
                v4l2_dbg(level, debug, &vpif_obj.v4l2_dev, fmt, ## arg)
  
  static int debug = 1;
 -static u32 ch0_numbuffers = 3;
 -static u32 ch1_numbuffers = 3;
 -static u32 ch0_bufsize = 1920 * 1080 * 2;
 -static u32 ch1_bufsize = 720 * 576 * 2;
  
  module_param(debug, int, 0644);
 -module_param(ch0_numbuffers, uint, S_IRUGO);
 -module_param(ch1_numbuffers, uint, S_IRUGO);
 -module_param(ch0_bufsize, uint, S_IRUGO);
 -module_param(ch1_bufsize, uint, S_IRUGO);
  
  MODULE_PARM_DESC(debug, "Debug level 0-1");
 -MODULE_PARM_DESC(ch2_numbuffers, "Channel0 buffer count (default:3)");
 -MODULE_PARM_DESC(ch3_numbuffers, "Channel1 buffer count (default:3)");
 -MODULE_PARM_DESC(ch2_bufsize, "Channel0 buffer size (default:1920 x 1080 x 2)");
 -MODULE_PARM_DESC(ch3_bufsize, "Channel1 buffer size (default:720 x 576 x 2)");
 -
 -static struct vpif_config_params config_params = {
 -      .min_numbuffers = 3,
 -      .numbuffers[0] = 3,
 -      .numbuffers[1] = 3,
 -      .min_bufsize[0] = 720 * 480 * 2,
 -      .min_bufsize[1] = 720 * 480 * 2,
 -      .channel_bufsize[0] = 1920 * 1080 * 2,
 -      .channel_bufsize[1] = 720 * 576 * 2,
 -};
  
  #define VPIF_DRIVER_NAME      "vpif_capture"
  
@@@ -247,6 -269,7 +247,7 @@@ err
                list_del(&buf->list);
                vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED);
        }
+       spin_unlock_irqrestore(&common->irqlock, flags);
  
        return ret;
  }
@@@ -498,28 -521,10 +499,28 @@@ static int vpif_update_std_info(struct 
        common->width = std_info->width;
        common->fmt.fmt.pix.height = std_info->height;
        common->height = std_info->height;
 +      common->fmt.fmt.pix.sizeimage = common->height * common->width * 2;
        common->fmt.fmt.pix.bytesperline = std_info->width;
        vpifparams->video_params.hpitch = std_info->width;
        vpifparams->video_params.storage_mode = std_info->frm_fmt;
  
 +      if (vid_ch->stdid)
 +              common->fmt.fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
 +      else
 +              common->fmt.fmt.pix.colorspace = V4L2_COLORSPACE_REC709;
 +
 +      if (ch->vpifparams.std_info.frm_fmt)
 +              common->fmt.fmt.pix.field = V4L2_FIELD_NONE;
 +      else
 +              common->fmt.fmt.pix.field = V4L2_FIELD_INTERLACED;
 +
 +      if (ch->vpifparams.iface.if_type == VPIF_IF_RAW_BAYER)
 +              common->fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_SBGGR8;
 +      else
 +              common->fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUV422P;
 +
 +      common->fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 +
        return 0;
  }
  
@@@ -595,6 -600,27 +596,6 @@@ static void vpif_calculate_offsets(stru
        ch->vpifparams.video_params.stdid = vpifparams->std_info.stdid;
  }
  
 -/**
 - * vpif_config_format: configure default frame format in the device
 - * ch : ptr to channel object
 - */
 -static void vpif_config_format(struct channel_obj *ch)
 -{
 -      struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 -
 -      vpif_dbg(2, debug, "vpif_config_format\n");
 -
 -      common->fmt.fmt.pix.field = V4L2_FIELD_ANY;
 -      common->fmt.fmt.pix.sizeimage
 -          = config_params.channel_bufsize[ch->channel_id];
 -
 -      if (ch->vpifparams.iface.if_type == VPIF_IF_RAW_BAYER)
 -              common->fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_SBGGR8;
 -      else
 -              common->fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUV422P;
 -      common->fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 -}
 -
  /**
   * vpif_get_default_field() - Get default field type based on interface
   * @vpif_params - ptr to vpif params
@@@ -606,6 -632,112 +607,6 @@@ static inline enum v4l2_field vpif_get_
                                                V4L2_FIELD_INTERLACED;
  }
  
 -/**
 - * vpif_check_format()  - check given pixel format for compatibility
 - * @ch - channel  ptr
 - * @pixfmt - Given pixel format
 - * @update - update the values as per hardware requirement
 - *
 - * Check the application pixel format for S_FMT and update the input
 - * values as per hardware limits for TRY_FMT. The default pixel and
 - * field format is selected based on interface type.
 - */
 -static int vpif_check_format(struct channel_obj *ch,
 -                           struct v4l2_pix_format *pixfmt,
 -                           int update)
 -{
 -      struct common_obj *common = &(ch->common[VPIF_VIDEO_INDEX]);
 -      struct vpif_params *vpif_params = &ch->vpifparams;
 -      enum v4l2_field field = pixfmt->field;
 -      u32 sizeimage, hpitch, vpitch;
 -      int ret = -EINVAL;
 -
 -      vpif_dbg(2, debug, "vpif_check_format\n");
 -      /**
 -       * first check for the pixel format. If if_type is Raw bayer,
 -       * only V4L2_PIX_FMT_SBGGR8 format is supported. Otherwise only
 -       * V4L2_PIX_FMT_YUV422P is supported
 -       */
 -      if (vpif_params->iface.if_type == VPIF_IF_RAW_BAYER) {
 -              if (pixfmt->pixelformat != V4L2_PIX_FMT_SBGGR8) {
 -                      if (!update) {
 -                              vpif_dbg(2, debug, "invalid pix format\n");
 -                              goto exit;
 -                      }
 -                      pixfmt->pixelformat = V4L2_PIX_FMT_SBGGR8;
 -              }
 -      } else {
 -              if (pixfmt->pixelformat != V4L2_PIX_FMT_YUV422P) {
 -                      if (!update) {
 -                              vpif_dbg(2, debug, "invalid pixel format\n");
 -                              goto exit;
 -                      }
 -                      pixfmt->pixelformat = V4L2_PIX_FMT_YUV422P;
 -              }
 -      }
 -
 -      if (!(VPIF_VALID_FIELD(field))) {
 -              if (!update) {
 -                      vpif_dbg(2, debug, "invalid field format\n");
 -                      goto exit;
 -              }
 -              /**
 -               * By default use FIELD_NONE for RAW Bayer capture
 -               * and FIELD_INTERLACED for other interfaces
 -               */
 -              field = vpif_get_default_field(&vpif_params->iface);
 -      } else if (field == V4L2_FIELD_ANY)
 -              /* unsupported field. Use default */
 -              field = vpif_get_default_field(&vpif_params->iface);
 -
 -      /* validate the hpitch */
 -      hpitch = pixfmt->bytesperline;
 -      if (hpitch < vpif_params->std_info.width) {
 -              if (!update) {
 -                      vpif_dbg(2, debug, "invalid hpitch\n");
 -                      goto exit;
 -              }
 -              hpitch = vpif_params->std_info.width;
 -      }
 -
 -      sizeimage = pixfmt->sizeimage;
 -
 -      vpitch = sizeimage / (hpitch * 2);
 -
 -      /* validate the vpitch */
 -      if (vpitch < vpif_params->std_info.height) {
 -              if (!update) {
 -                      vpif_dbg(2, debug, "Invalid vpitch\n");
 -                      goto exit;
 -              }
 -              vpitch = vpif_params->std_info.height;
 -      }
 -
 -      /* Check for 8 byte alignment */
 -      if (!ALIGN(hpitch, 8)) {
 -              if (!update) {
 -                      vpif_dbg(2, debug, "invalid pitch alignment\n");
 -                      goto exit;
 -              }
 -              /* adjust to next 8 byte boundary */
 -              hpitch = (((hpitch + 7) / 8) * 8);
 -      }
 -      /* if update is set, modify the bytesperline and sizeimage */
 -      if (update) {
 -              pixfmt->bytesperline = hpitch;
 -              pixfmt->sizeimage = hpitch * vpitch * 2;
 -      }
 -      /**
 -       * Image width and height is always based on current standard width and
 -       * height
 -       */
 -      pixfmt->width = common->fmt.fmt.pix.width;
 -      pixfmt->height = common->fmt.fmt.pix.height;
 -      return 0;
 -exit:
 -      return ret;
 -}
 -
  /**
   * vpif_config_addr() - function to configure buffer address in vpif
   * @ch - channel ptr
@@@ -816,6 -948,9 +817,6 @@@ static int vpif_s_std(struct file *file
                return -EINVAL;
        }
  
 -      /* Configure the default format information */
 -      vpif_config_format(ch);
 -
        /* set standard in the sub device */
        ret = v4l2_subdev_call(ch->sd, video, s_std, std_id);
        if (ret && ret != -ENOIOCTLCMD && ret != -ENODEV) {
@@@ -842,8 -977,10 +843,8 @@@ static int vpif_enum_input(struct file 
  
        chan_cfg = &config->chan_config[ch->channel_id];
  
 -      if (input->index >= chan_cfg->input_count) {
 -              vpif_dbg(1, debug, "Invalid input index\n");
 +      if (input->index >= chan_cfg->input_count)
                return -EINVAL;
 -      }
  
        memcpy(input, &chan_cfg->inputs[input->index].input,
                sizeof(*input));
@@@ -932,34 -1069,8 +933,34 @@@ static int vpif_try_fmt_vid_cap(struct 
        struct video_device *vdev = video_devdata(file);
        struct channel_obj *ch = video_get_drvdata(vdev);
        struct v4l2_pix_format *pixfmt = &fmt->fmt.pix;
 +      struct common_obj *common = &(ch->common[VPIF_VIDEO_INDEX]);
 +      struct vpif_params *vpif_params = &ch->vpifparams;
  
 -      return vpif_check_format(ch, pixfmt, 1);
 +      /*
 +       * to supress v4l-compliance warnings silently correct
 +       * the pixelformat
 +       */
 +      if (vpif_params->iface.if_type == VPIF_IF_RAW_BAYER) {
 +              if (pixfmt->pixelformat != V4L2_PIX_FMT_SBGGR8)
 +                      pixfmt->pixelformat = V4L2_PIX_FMT_SBGGR8;
 +      } else {
 +              if (pixfmt->pixelformat != V4L2_PIX_FMT_YUV422P)
 +                      pixfmt->pixelformat = V4L2_PIX_FMT_YUV422P;
 +      }
 +
 +      common->fmt.fmt.pix.pixelformat = pixfmt->pixelformat;
 +
 +      vpif_update_std_info(ch);
 +
 +      pixfmt->field = common->fmt.fmt.pix.field;
 +      pixfmt->colorspace = common->fmt.fmt.pix.colorspace;
 +      pixfmt->bytesperline = common->fmt.fmt.pix.width;
 +      pixfmt->width = common->fmt.fmt.pix.width;
 +      pixfmt->height = common->fmt.fmt.pix.height;
 +      pixfmt->sizeimage = pixfmt->bytesperline * pixfmt->height * 2;
 +      pixfmt->priv = 0;
 +
 +      return 0;
  }
  
  
@@@ -997,17 -1108,20 +998,17 @@@ static int vpif_s_fmt_vid_cap(struct fi
        struct video_device *vdev = video_devdata(file);
        struct channel_obj *ch = video_get_drvdata(vdev);
        struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 -      struct v4l2_pix_format *pixfmt;
 -      int ret = 0;
 +      int ret;
  
        vpif_dbg(2, debug, "%s\n", __func__);
  
        if (vb2_is_busy(&common->buffer_queue))
                return -EBUSY;
  
 -      pixfmt = &fmt->fmt.pix;
 -      /* Check for valid field format */
 -      ret = vpif_check_format(ch, pixfmt, 0);
 -
 +      ret = vpif_try_fmt_vid_cap(file, priv, fmt);
        if (ret)
                return ret;
 +
        /* store the format in the channel object */
        common->fmt = *fmt;
        return 0;
@@@ -1297,9 -1411,36 +1298,9 @@@ static struct v4l2_file_operations vpif
   */
  static int initialize_vpif(void)
  {
 -      int err = 0, i, j;
 +      int err, i, j;
        int free_channel_objects_index;
  
 -      /* Default number of buffers should be 3 */
 -      if ((ch0_numbuffers > 0) &&
 -          (ch0_numbuffers < config_params.min_numbuffers))
 -              ch0_numbuffers = config_params.min_numbuffers;
 -      if ((ch1_numbuffers > 0) &&
 -          (ch1_numbuffers < config_params.min_numbuffers))
 -              ch1_numbuffers = config_params.min_numbuffers;
 -
 -      /* Set buffer size to min buffers size if it is invalid */
 -      if (ch0_bufsize < config_params.min_bufsize[VPIF_CHANNEL0_VIDEO])
 -              ch0_bufsize =
 -                  config_params.min_bufsize[VPIF_CHANNEL0_VIDEO];
 -      if (ch1_bufsize < config_params.min_bufsize[VPIF_CHANNEL1_VIDEO])
 -              ch1_bufsize =
 -                  config_params.min_bufsize[VPIF_CHANNEL1_VIDEO];
 -
 -      config_params.numbuffers[VPIF_CHANNEL0_VIDEO] = ch0_numbuffers;
 -      config_params.numbuffers[VPIF_CHANNEL1_VIDEO] = ch1_numbuffers;
 -      if (ch0_numbuffers) {
 -              config_params.channel_bufsize[VPIF_CHANNEL0_VIDEO]
 -                  = ch0_bufsize;
 -      }
 -      if (ch1_numbuffers) {
 -              config_params.channel_bufsize[VPIF_CHANNEL1_VIDEO]
 -                  = ch1_bufsize;
 -      }
 -
        /* Allocate memory for six channel objects */
        for (i = 0; i < VPIF_CAPTURE_MAX_DEVICES; i++) {
                vpif_obj.dev[i] =
@@@ -1355,11 -1496,6 +1356,11 @@@ static int vpif_probe_complete(void
                if (err)
                        goto probe_out;
  
 +              /* set initial format */
 +              ch->video.stdid = V4L2_STD_525_60;
 +              memset(&ch->video.dv_timings, 0, sizeof(ch->video.dv_timings));
 +              vpif_update_std_info(ch);
 +
                /* Initialize vb2 queue */
                q = &common->buffer_queue;
                q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
                vdev->vfl_dir = VFL_DIR_RX;
                vdev->queue = q;
                vdev->lock = &common->lock;
 -              set_bit(V4L2_FL_USE_FH_PRIO, &vdev->flags);
                video_set_drvdata(ch->video_dev, ch);
                err = video_register_device(vdev,
                                            VFL_TYPE_GRABBER, (j ? 1 : 0));
@@@ -1577,7 -1714,7 +1578,7 @@@ static int vpif_remove(struct platform_
        for (i = 0; i < VPIF_CAPTURE_MAX_DEVICES; i++) {
                /* Get the pointer to the channel object */
                ch = vpif_obj.dev[i];
 -              common = &ch->common[i];
 +              common = &ch->common[VPIF_VIDEO_INDEX];
                vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
                /* Unregister video device */
                video_unregister_device(ch->video_dev);
index 6c6bd6b47994e6e4e19ca61980985f26b7e99060,b431b58f39e3648d7d33ae6e049f1896ccd3fedc..a03ec7381cfef734da18537f822e34ed959af55f
@@@ -233,6 -233,7 +233,7 @@@ err
                list_del(&buf->list);
                vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED);
        }
+       spin_unlock_irqrestore(&common->irqlock, flags);
  
        return ret;
  }
@@@ -648,6 -649,7 +649,6 @@@ static int vpif_try_fmt_vid_out(struct 
        pixfmt->width = common->fmt.fmt.pix.width;
        pixfmt->height = common->fmt.fmt.pix.height;
        pixfmt->sizeimage = pixfmt->bytesperline * pixfmt->height * 2;
 -      pixfmt->priv = 0;
  
        return 0;
  }
@@@ -1222,6 -1224,7 +1223,6 @@@ static int vpif_probe_complete(void
                vdev->vfl_dir = VFL_DIR_TX;
                vdev->queue = q;
                vdev->lock = &common->lock;
 -              set_bit(V4L2_FL_USE_FH_PRIO, &vdev->flags);
                video_set_drvdata(ch->video_dev, ch);
                err = video_register_device(vdev, VFL_TYPE_GRABBER,
                                            (j ? 3 : 2));
@@@ -1385,7 -1388,7 +1386,7 @@@ static int vpif_remove(struct platform_
        for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++) {
                /* Get the pointer to the channel object */
                ch = vpif_obj.dev[i];
 -              common = &ch->common[i];
 +              common = &ch->common[VPIF_VIDEO_INDEX];
                vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
                /* Unregister video device */
                video_unregister_device(ch->video_dev);
index a7b7a99a8d0468222675d2ed7ae85b1c7421f28e,339adce7c7a50974ffe9c5a2a185ae26fe8956c6..8b08bd0172f409d531b603fec366129b1455abac
@@@ -394,9 -394,9 +394,9 @@@ static void setbrightcont(struct gspca_
        reg_w(gspca_dev, 0xff, 0x00);           /* page 0 */
        for (i = 0; i < 10; i++) {
                v = max[i];
 -              v += (sd->brightness->val - sd->brightness->maximum)
 -                      * 150 / sd->brightness->maximum; /* 200 ? */
 -              v -= delta[i] * sd->contrast->val / sd->contrast->maximum;
 +              v += (sd->brightness->val - (s32)sd->brightness->maximum)
 +                      * 150 / (s32)sd->brightness->maximum; /* 200 ? */
 +              v -= delta[i] * sd->contrast->val / (s32)sd->contrast->maximum;
                if (v < 0)
                        v = 0;
                else if (v > 0xff)
@@@ -419,7 -419,7 +419,7 @@@ static void setcolors(struct gspca_dev 
        reg_w(gspca_dev, 0x11, 0x01);
        reg_w(gspca_dev, 0xff, 0x00);                   /* page 0 */
        for (i = 0; i < 9; i++) {
 -              v = a[i] * sd->saturation->val / sd->saturation->maximum;
 +              v = a[i] * sd->saturation->val / (s32)sd->saturation->maximum;
                v += b[i];
                reg_w(gspca_dev, 0x0f + 2 * i, (v >> 8) & 0x07);
                reg_w(gspca_dev, 0x0f + 2 * i + 1, v);
@@@ -928,6 -928,7 +928,7 @@@ static const struct usb_device_id devic
        {USB_DEVICE(0x093a, 0x2620)},
        {USB_DEVICE(0x093a, 0x2621)},
        {USB_DEVICE(0x093a, 0x2622), .driver_info = FL_VFLIP},
+       {USB_DEVICE(0x093a, 0x2623), .driver_info = FL_VFLIP},
        {USB_DEVICE(0x093a, 0x2624), .driver_info = FL_VFLIP},
        {USB_DEVICE(0x093a, 0x2625)},
        {USB_DEVICE(0x093a, 0x2626)},
index 62f289a1cd578ba7d4c4cfa848acd403f9937406,6bce01a674f9e12f9874636e962378f6965a4fad..59d15fd242ba04b8c38147225c538907b9cab4cc
@@@ -82,7 -82,7 +82,7 @@@ static void hdpvr_read_bulk_callback(st
  }
  
  /*=========================================================================*/
- /* bufffer bits */
+ /* buffer bits */
  
  /* function expects dev->io_mutex to be hold by caller */
  int hdpvr_cancel_queue(struct hdpvr_device *dev)
@@@ -926,7 -926,7 +926,7 @@@ static int hdpvr_s_ctrl(struct v4l2_ctr
        case V4L2_CID_MPEG_AUDIO_ENCODING:
                if (dev->flags & HDPVR_FLAG_AC3_CAP) {
                        opt->audio_codec = ctrl->val;
-                       return hdpvr_set_audio(dev, opt->audio_input,
+                       return hdpvr_set_audio(dev, opt->audio_input + 1,
                                              opt->audio_codec);
                }
                return 0;
@@@ -1022,13 -1022,14 +1022,13 @@@ static int vidioc_g_fmt_vid_cap(struct 
        f->fmt.pix.pixelformat  = V4L2_PIX_FMT_MPEG;
        f->fmt.pix.sizeimage    = dev->bulk_in_size;
        f->fmt.pix.bytesperline = 0;
 -      f->fmt.pix.priv         = 0;
        if (f->fmt.pix.width == 720) {
                /* SDTV formats */
                f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
                f->fmt.pix.field = V4L2_FIELD_INTERLACED;
        } else {
                /* HDTV formats */
 -              f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE240M;
 +              f->fmt.pix.colorspace = V4L2_COLORSPACE_REC709;
                f->fmt.pix.field = V4L2_FIELD_NONE;
        }
        return 0;
@@@ -1197,7 -1198,7 +1197,7 @@@ int hdpvr_register_videodev(struct hdpv
        v4l2_ctrl_new_std_menu(hdl, &hdpvr_ctrl_ops,
                V4L2_CID_MPEG_AUDIO_ENCODING,
                ac3 ? V4L2_MPEG_AUDIO_ENCODING_AC3 : V4L2_MPEG_AUDIO_ENCODING_AAC,
-               0x7, V4L2_MPEG_AUDIO_ENCODING_AAC);
+               0x7, ac3 ? dev->options.audio_codec : V4L2_MPEG_AUDIO_ENCODING_AAC);
        v4l2_ctrl_new_std_menu(hdl, &hdpvr_ctrl_ops,
                V4L2_CID_MPEG_VIDEO_ENCODING,
                V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC, 0x3,
        strcpy(dev->video_dev->name, "Hauppauge HD PVR");
        dev->video_dev->v4l2_dev = &dev->v4l2_dev;
        video_set_drvdata(dev->video_dev, dev);
 -      set_bit(V4L2_FL_USE_FH_PRIO, &dev->video_dev->flags);
  
        res = video_register_device(dev->video_dev, VFL_TYPE_GRABBER, devnum);
        if (res < 0) {