1. 12 Jan, 2014 7 commits
    • Mauro Carvalho Chehab's avatar
      [media] em28xx-audio: fix the period size in bytes · 49677aef
      Mauro Carvalho Chehab authored
      If the period size is wrong, userspace will assume a wrong delay
      any may negociate an inadequate value.
      
      The em28xx devices use 8 for URB interval, in microframes,
      and the driver programs it to have 64 packets.
      
      That means that the IRQ sampling period is 125 * 8 * 64,
      with is equal to 64 ms.
      
      So, that's the minimal latency with the current settings. It is
      possible to program a lower latency, by using less than 64 packets,
      but that increases the amount of bandwitdh used, and the number of
      IRQ events per second.
      
      In any case, in order to support it, the driver logic should be
      changed to fill those parameters in realtime.
      Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
      49677aef
    • Mauro Carvalho Chehab's avatar
      [media] em28xx-audio: don't hardcode audio URB calculus · 1b3fd2d3
      Mauro Carvalho Chehab authored
      The current code hardcodes the number of audio URBs, the number
      of packets per URB and the maximum URB size.
      
      This is not a good idea, as it:
      
      - wastes more bandwidth than necessary, by using a very
        large number of packets;
      
      - those constants are bound to an specific scenario, with
        a bandwidth of 48 kHz;
      
      - don't take the maximum endpoint size into account;
      
      - with urb->interval = 1 on xHCI, those constraints cause a "funny"
        setup: URBs with 64 packets inside, with only 24 bytes total. E. g.
        a complete waste of space.
      
      Change the code to do dynamic URB audio calculus and allocation.
      
      For now, use the same constraints as used before this patch, to
      avoid regressions.
      
      A good scenario (tested) seems to use those defines, instead:
      
      	#define EM28XX_MAX_AUDIO_BUFS          8
      	#define EM28XX_MIN_AUDIO_PACKETS       2
      
      But let's not do such change here, letting the optimization to
      happen on latter patches, after more tests.
      Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
      1b3fd2d3
    • Mauro Carvalho Chehab's avatar
      [media] em28xx-audio: Fix error path · 439c491c
      Mauro Carvalho Chehab authored
      De-allocate memory and free sound if an error happens.
      Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
      439c491c
    • Mauro Carvalho Chehab's avatar
      [media] em28xx-audio: use bInterval on em28xx-audio · d2849fa5
      Mauro Carvalho Chehab authored
      Just filling urb->interval with 1 is wrong, and causes a different
      behaviour with xHCI.
      
      With EHCI, the URB size is typically 192 bytes. However, as
      xHCI specifies intervals in microframes, the URB size becomes
      too short (24 bytes).
      
      With this patch, the interval will be properly initialized, and
      the device will behave the same if connected into a xHCI or an
      EHCI device port.
      Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
      d2849fa5
    • Mauro Carvalho Chehab's avatar
      [media] em28xx-i2c: add timeout debug information if i2c_debug enabled · d845fb3a
      Mauro Carvalho Chehab authored
      If i2c_debug is enabled, we splicitly want to know when a
      device fails with timeout.
      
      If i2c_debug==2, this is already provided, for each I2C transfer
      that fails.
      
      However, most of the time, we don't need to go that far. We just
      want to know that I2C transfers fail.
      
      So, add such errors for normal (ret == 0x10) I2C aborted timeouts.
      Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
      d845fb3a
    • Mauro Carvalho Chehab's avatar
      [media] em28xx-i2c: cleanup I2C debug messages · 50f0a9df
      Mauro Carvalho Chehab authored
      The I2C output messages is too polluted. Clean it a little
      bit, by:
      	- use the proper core support for memory dumps;
      	- hide most stuff under the i2c_debug umbrella;
      	- add the missing KERN_CONT where needed;
      	- use 2 levels or verbosity. Only the second one
      	  will show the I2C transfer data.
      Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
      50f0a9df
    • Mauro Carvalho Chehab's avatar
      [media] em28xx-i2c: Fix error code for I2C error transfers · e63b009d
      Mauro Carvalho Chehab authored
      Follow the error codes for I2C as described at Documentation/i2c/fault-codes.
      
      In the case of the I2C status register (0x05), this is mapped into:
      
      	- ENXIO - when reg 05 returns 0x10
      	- ETIMEDOUT - when the device is not temporarily not responding
      		      (e. g. reg 05 returning something not 0x10 or 0x00)
      	- EIO - for generic I/O errors that don't fit into the above.
      
      In the specific case of 0-byte reads, used only during I2C device
      probing, it keeps returning -ENODEV.
      
      TODO: return EBUSY when reg 05 returns 0x20 on em2874 and upper.
      Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
      e63b009d
  2. 10 Jan, 2014 8 commits
  3. 07 Jan, 2014 25 commits