15 Dec, 2017

1 commit

  • With CONFIG_KASAN enabled, we get a relatively large stack frame in one function

    drivers/media/tuners/tda8290.c: In function 'tda8290_set_params':
    drivers/media/tuners/tda8290.c:310:1: warning: the frame size of 1520 bytes is larger than 1024 bytes [-Wframe-larger-than=]

    With CONFIG_KASAN_EXTRA this goes up to

    drivers/media/tuners/tda8290.c: In function 'tda8290_set_params':
    drivers/media/tuners/tda8290.c:310:1: error: the frame size of 3200 bytes is larger than 3072 bytes [-Werror=frame-larger-than=]

    We can significantly reduce this by marking local arrays as 'static const', and
    this should result in better compiled code for everyone.

    [mchehab@s-opensource.com: fix a trivial merge conflict]
    Signed-off-by: Arnd Bergmann
    Reviewed-by: Michael Ira Krufky
    Signed-off-by: Mauro Carvalho Chehab

    Arnd Bergmann
     

14 Dec, 2017

39 commits

  • This is part of the uAPI. Add it to the documentation again,
    and fix cross-references.

    Signed-off-by: Mauro Carvalho Chehab
    Acked-by: Sean Young

    Mauro Carvalho Chehab
     
  • CEC autorepeat is different than other protocols. Autorepeat is triggered
    by the first repeated user control pressed CEC message, rather than a
    fixed REP_DELAY.

    This change also does away with the KEY_UP event directly after the first
    KEY_DOWN event, which was used to stop autorepeat from starting.

    See commit a9a249a2c997 ("media: cec: fix remote control passthrough")
    for the original change.

    Acked-by: Hans Verkuil
    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • Another device with the 0xffdc device id, this one with 0x30 in the
    config byte. Its an iMON VFD + iMON IR (it does not understand rc6).

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • The pnp_irq() function returns -1 if an error occurs.
    pnp_irq() error checking for zero is not correct.

    Signed-off-by: Arvind Yadav
    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Arvind Yadav
     
  • This patch changes the 32-bit time type (timeval) to the 64-bit one
    (ktime_t), since 32-bit time types will break in the year 2038.

    I use ktime_t instead of all uses of timeval in imon.c

    This patch also changes do_gettimeofday() to ktime_get() accordingly,
    since ktime_get returns a ktime_t, but do_gettimeofday returns a
    struct timeval, and the other reason is that ktime_get() uses
    the monotonic clock.

    Signed-off-by: Chunyan Zhang
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Chunyan Zhang
     
  • Once rc_unregister_device() has been called, no driver function
    should be called.

    This prevents some nasty race conditions with an ioctl calls
    driver functions when the driver specific data has been freed.

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • This makes it possible for lircd to read from a lirc chardev, and not
    keep it busy.

    Note that this changes the default for timeout reports to on. lircd
    already enables timeout reports when it opens a lirc device, leaving
    them on until the next reboot.

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • This removes the need for include/media/lirc.h, which just includes
    the uapi file.

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • Since removing the lirc kapi, ir-lirc-codec.c only contains lirc fops
    so the file name is no longer correct. By moving its content into
    lirc_dev.c the ugly extern struct lirc_fops is not longer needed,
    and everything lirc related is in one file.

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • If you try to store u64 in a kfifo (or a struct with u64 members),
    then the buf member of __STRUCT_KFIFO_PTR will cause 4 bytes
    padding due to alignment (note that struct __kfifo is 20 bytes
    on 32 bit).

    That in turn causes the __is_kfifo_ptr() to fail, which is caught
    by kfifo_alloc(), which now returns EINVAL.

    So, ensure that __is_kfifo_ptr() compares to the right structure.

    Signed-off-by: Sean Young
    Acked-by: Stefani Seibold
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • Now that the lirc interface supports scancodes, RC scancode devices
    can also have a lirc device. The only receiving feature they will have
    enabled is LIRC_CAN_REC_SCANCODE.

    Note that CEC devices have no lirc device, since they can be controlled
    from their /dev/cecN chardev.

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • Lirc supports a new mode which requires documentation.

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • The lirc device should get lirc repeats whether there is a keymap
    match or not.

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • This implements LIRC_MODE_SCANCODE reading from the lirc device. The
    scancode can be read from the input device too, but with this interface
    you get the rc protocol, keycode, toggle and repeat status in addition
    to just the scancode.

    int main()
    {
    int fd, mode, rc;
    fd = open("/dev/lirc0", O_RDWR);

    mode = LIRC_MODE_SCANCODE;
    if (ioctl(fd, LIRC_SET_REC_MODE, &mode)) {
    // kernel too old or lirc does not support transmit
    }
    struct lirc_scancode scancode;
    while (read(fd, &scancode, sizeof(scancode)) == sizeof(scancode)) {
    printf("protocol:%d scancode:0x%x toggle:%d repeat:%d\n",
    scancode.rc_proto, scancode.scancode,
    !!(scancode.flags & LIRC_SCANCODE_FLAG_TOGGLE),
    !!(scancode.flags & LIRC_SCANCODE_FLAG_REPEAT));
    }
    close(fd);
    }

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • rc-core has replaced the lirc kapi many years ago, and now with the last
    driver ported to rc-core, we can finally remove it.

    Note this has no effect on userspace.

    All future IR drivers should use the rc-core api.

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • This is a duplicate of rcdev->driver_name.

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • Replace the generic kernel lirc api with ones which use rc-core, further
    reducing the lirc_dev members.

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • If a lirc chardev is held open after a device is unplugged, rc_close()
    will be called after rc_unregister_device(). The driver is not expecting
    any calls at this point, and the iguanair driver causes an oops in
    this scenario.

    rc_open() can be called when the device is removed too, by calling open
    on the chardev whilst the device is being removed.

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • This is done to further remove the lirc kernel api. Ensure that every
    fops checks for this.

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • Since the only mode lirc devices can handle is raw IR, handle this
    in a plain kfifo.

    Remove lirc_buffer since this is no longer needed.

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • Calculate lirc features when necessary, and add LIRC_{S,G}ET_REC_MODE
    cases to ir_lirc_ioctl.

    This makes lirc_dev_fop_ioctl() unnecessary since all cases are
    already handled by ir_lirc_ioctl().

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • For some IR protocols, some scancode values not valid, i.e. they're part
    of a different protocol variant.

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • Ensure we reject an attempt to transmit invalid scancodes.

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • The lirc user interface exists as a raw decoder, which does not make
    much sense for transmit-only devices.

    In addition, we want to have lirc char devices for devices which do not
    use raw IR, i.e. scancode only devices.

    Note that rc-code, lirc_dev, ir-lirc-codec are now calling functions of
    each other, so they've been merged into one module rc-core to avoid
    circular dependencies.

    Since ir-lirc-codec no longer exists as separate codec module, there is no
    need for RC_DRIVER_IR_RAW_TX type drivers to call ir_raw_event_register().

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • When sending scancodes, load the encoder if we need it.

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • If the lirc device supports it, set the carrier for the protocol.

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • This introduces a new lirc mode: scancode. Any device which can send raw IR
    can now also send scancodes.

    int main()
    {
    int mode, fd = open("/dev/lirc0", O_RDWR);

    mode = LIRC_MODE_SCANCODE;
    if (ioctl(fd, LIRC_SET_SEND_MODE, &mode)) {
    // kernel too old or lirc does not support transmit
    }
    struct lirc_scancode scancode = {
    .scancode = 0x1e3d,
    .rc_proto = RC_PROTO_RC5,
    };
    write(fd, &scancode, sizeof(scancode));
    close(fd);
    }

    The other fields of lirc_scancode must be set to 0.

    Note that toggle (rc5, rc6) and repeats (nec) are not implemented. Nor is
    there a method for holding down a key for a period.

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • LIRCCODE is a lirc mode where a driver produces driver-dependent
    codes for receive and transmit. No driver uses this any more. The
    LIRC_GET_LENGTH ioctl was used for this mode only.

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • Now that lirc is no longer in the staging area, remove the entry.

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • The ir-kbd-i2c driver behaves like the lirc_zilog driver, except it can
    send raw IR and receives scancodes rather than lirccodes.

    The lirc_zilog driver only polls if the lirc chardev is opened;
    similarly the ir-kbd-i2c driver only polls if the corresponding input
    device is opened, or the lirc device.

    Polling is disabled during IR transmission through the mutex.

    The polling period is 402ms in the ir-kdb-i2c driver, and 260ms in the
    lirc_zilog driver.

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • This is a fix for commit 329d88da4df9 ("[media] media: i2c: Don't export
    ir-kbd-i2c module alias") that stopped the module from being loaded
    automagically.

    The problems described only affect the HD-PVR, so it should not affect
    other hardware; also if the module happens to be loaded, the i2c IR
    part of the HD-PVR will be enabled anyway.

    Fixes: 329d88da4df9 ("[media] media: i2c: Don't export ir-kbd-i2c module alias")

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • This code implements the transmitter which is currently implemented
    in the staging lirc_zilog driver.

    The new code does not need a signal database, iow. the
    haup-ir-blaster.bin firmware file is no longer needed, and the driver
    does not know anything about the keycodes in that file.

    Instead, the new driver can send raw IR, but the hardware is limited
    to few different lengths of pulse and spaces, so it is best to use
    generated IR rather than recorded IR.

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • These two devices ids are really just one device with multiple
    addresses. Probing becomes much simpler if we simply fold this into
    one i2c device with two address.

    Note that this breaks the lirc_zilog driver, however we will teach
    ir-kbd-i2c to do what lirc_zilog does in a later commit.

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • The lirc_zilog driver only polls the device if the lirc chardev
    is opened; do the same with the rc-core driver.

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • Use the dev_dbg dynamic infrastructure instead of rolling our own custom
    debug logic.

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • With the parent set for the rc device, the messages clearly state
    that it is attached via i2c. The additional printk is unnecessary.

    These are the old messages:

    rc rc1: i2c IR (Hauppauge WinTV PVR-150 as /devices/virtual/rc/rc1
    ir-kbd-i2c: i2c IR (Hauppauge WinTV PVR-150 detected at i2c-10/10-0071/ir0 [ivtv i2c driver #0]

    Now we simply get:

    rc rc1: Hauppauge WinTV PVR-150 as /devices/pci0000:00/0000:00:1e.0/0000:02:00.0/i2c-10/10-0071/rc/rc1

    Note that we no longer copy the name. I've checked all call sites
    to verfiy this is not a problem.

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     
  • When iterating through all endpoints using of_graph_get_next_endpoint(),
    the refcount of the returned endpoint node is incremented and the refcount
    of the node which is passed as previous endpoint is decremented.

    So the caller doesn't need to call of_node_put() for each iterated node
    except for error exit paths. Otherwise we get "OF: ERROR: Bad
    of_node_put() on ..." messages.

    Cc: Hyun Kwon
    Signed-off-by: Akinobu Mita
    Reviewed-by: Laurent Pinchart
    Signed-off-by: Mauro Carvalho Chehab

    Akinobu Mita
     
  • This is odd to call 'pci_disable_device()' in an error path before a
    coresponding successful 'pci_enable_device()'.

    Return directly instead.

    Fixes: 77e0be12100a ("V4L/DVB (4176): Bug-fix: Fix memory overflow")

    Signed-off-by: Christophe JAILLET
    Signed-off-by: Mauro Carvalho Chehab

    Christophe JAILLET
     
  • Currently a user can pass in an unsanitized slot number which
    will lead to and out of range index into ca->slot_info. Fix this
    by checking that the slot number is no more than the allowed
    maximum number of slots. Seems that this bug has been in the driver
    forever.

    Detected by CoverityScan, CID#139381 ("Untrusted pointer read")

    Signed-off-by: Colin Ian King
    Reviewed-by: Dan Carpenter
    Reviewed-by: Jasmin Jessich
    Signed-off-by: Mauro Carvalho Chehab

    Colin Ian King