04 Mar, 2016

1 commit

  • Change get_frontend to re-check current lock status rather than relying
    on a cached value from get_status. Removes potential for tuning failure
    if get_frontend is called during tuning.

    Probably not too essential as other changes work around this:
    https://patchwork.linuxtv.org/patch/32845/

    Signed-off-by: Jemma Denson
    Signed-off-by: Mauro Carvalho Chehab

    Jemma Denson
     

03 Mar, 2016

5 commits


01 Mar, 2016

2 commits

  • Smatch with -pkernel --no-data keeps complaining about rf_ramp:
    drivers/media/dvb-frontends/dib0090.c:1119 dib0090_pwm_gain_reset() error: we previously assumed 'state->rf_ramp' could be null (see line 1086)

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • While there's no risk of divison by zero, the logic there is akward, as it
    does the calculus for the numerator and denominator before checking
    if this will be used.

    Change the order to check first if the denominator is zero, and only
    calculating the numerator/denominator if not.

    This should also avoid those smatch errors:
    drivers/media/dvb-frontends/drx39xyj/drxj.c:9605 ctrl_get_qam_sig_quality() debug: sval_binop_unsigned: divide by zero
    drivers/media/dvb-frontends/drx39xyj/drxj.c:9605 ctrl_get_qam_sig_quality() debug: sval_binop_unsigned: divide by zero
    drivers/media/dvb-frontends/drx39xyj/drxj.c:9605 ctrl_get_qam_sig_quality() debug: sval_binop_unsigned: divide by zero
    drivers/media/dvb-frontends/drx39xyj/drxj.c:9605 ctrl_get_qam_sig_quality() debug: sval_binop_unsigned: divide by zero
    drivers/media/dvb-frontends/drx39xyj/drxj.c:9605 ctrl_get_qam_sig_quality() debug: sval_binop_unsigned: divide by zero

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     

27 Feb, 2016

2 commits


23 Feb, 2016

4 commits


09 Feb, 2016

1 commit

  • Linux 4.5-rc3

    * tag 'v4.5-rc3': (644 commits)
    Linux 4.5-rc3
    epoll: restrict EPOLLEXCLUSIVE to POLLIN and POLLOUT
    radix-tree: fix oops after radix_tree_iter_retry
    MAINTAINERS: trim the file triggers for ABI/API
    dax: dirty inode only if required
    thp: make deferred_split_scan() work again
    mm: replace vma_lock_anon_vma with anon_vma_lock_read/write
    ocfs2/dlm: clear refmap bit of recovery lock while doing local recovery cleanup
    um: asm/page.h: remove the pte_high member from struct pte_t
    mm, hugetlb: don't require CMA for runtime gigantic pages
    mm/hugetlb: fix gigantic page initialization/allocation
    mm: downgrade VM_BUG in isolate_lru_page() to warning
    mempolicy: do not try to queue pages from !vma_migratable()
    mm, vmstat: fix wrong WQ sleep when memory reclaim doesn't make any progress
    vmstat: make vmstat_update deferrable
    mm, vmstat: make quiet_vmstat lighter
    mm/Kconfig: correct description of DEFERRED_STRUCT_PAGE_INIT
    memblock: don't mark memblock_phys_mem_size() as __init
    dump_stack: avoid potential deadlocks
    mm: validate_mm browse_rb SMP race condition
    ...

    Mauro Carvalho Chehab
     

05 Feb, 2016

3 commits


04 Feb, 2016

1 commit

  • The tda1004x was updating the properties cache before locking.
    If the device is not locked, the data at the registers are just
    random values with no real meaning.

    This caused the driver to fail with libdvbv5, as such library
    calls GET_PROPERTY from time to time, in order to return the
    DVB stats.

    Tested with a saa7134 card 78:
    ASUSTeK P7131 Dual, vendor PCI ID: 1043:4862

    Cc: stable@vger.kernel.org
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     

01 Feb, 2016

6 commits


26 Jan, 2016

1 commit

  • This issue was detected by using the Coccinelle software.

    1. Let us return directly if a call of the si2165_readreg8()
    function failed.

    2. Reduce the scope for the local variables "ret" and "tmp" to one branch
    of an if statement.

    3. Delete the jump label "err" then.

    4. Return the value from a call of the si2165_writereg8() function
    without using an extra assignment for the variable "ret" at the end.

    Signed-off-by: Markus Elfring
    Signed-off-by: Matthias Schwarzott
    Signed-off-by: Mauro Carvalho Chehab

    Markus Elfring
     

25 Jan, 2016

3 commits


18 Jan, 2016

1 commit

  • Pull GPIO updates from Linus Walleij:
    "Here is the bulk of GPIO changes for v4.5.

    Notably there are big refactorings mostly by myself, aimed at getting
    the gpio_chip into a shape that makes me believe I can proceed to
    preserve state for a proper userspace ABI (character device) that has
    already been proposed once, but resulted in the feedback that I need
    to go back and restructure stuff. So I've been restructuring stuff.
    On the way I ran into brokenness (return code from the get_value()
    callback) and had to fix it. Also, refactored generic GPIO to be
    simpler.

    Some of that is still waiting to trickle down from the subsystems all
    over the kernel that provide random gpio_chips, I've touched every
    single GPIO driver in the kernel now, oh man I didn't know I was
    responsible for so much...

    Apart from that we're churning along as usual.

    I took some effort to test and retest so it should merge nicely and we
    shook out a couple of bugs in -next.

    Infrastructural changes:

    - In struct gpio_chip, rename the .dev node to .parent to better
    reflect the fact that this is not the GPIO struct device
    abstraction. We will add that soon so this would be totallt
    confusing.

    - It was noted that the driver .get_value() callbacks was sometimes
    reporting negative -ERR values to the gpiolib core, expecting them
    to be propagated to consumer gpiod_get_value() and gpio_get_value()
    calls. This was not happening, so as there was a mess of drivers
    returning negative errors and some returning "anything else than
    zero" to indicate that a line was active. As some would have bit
    31 set to indicate "line active" it clashed with negative error
    codes. This is fixed by the largeish series clamping values in all
    drivers with !!value to [0,1] and then augmenting the code to
    propagate error codes to consumers. (Includes some ACKed patches
    in other subsystems.)

    - Add a void *data pointer to struct gpio_chip. The container_of()
    design pattern is indeed very nice, but we want to reform the
    struct gpio_chip to be a non-volative, stateless business, and keep
    states internal to the gpiolib to be able to hold on to the state
    when adding a proper userspace ABI (character device) further down
    the road. To achieve this, drivers need a handle at the internal
    state that is not dependent on their struct gpio_chip() so we add
    gpiochip_add_data() and gpiochip_get_data() following the pattern
    of many other subsystems. All the "use gpiochip data pointer"
    patches transforms drivers to this scheme.

    - The Generic GPIO chip header has been merged into the general
    header, and the custom header for that
    removed. Instead of having a separate mm_gpio_chip struct for
    these generic drivers, merge that into struct gpio_chip,
    simplifying the code and removing the need for separate and
    confusing includes.

    Misc improvements:

    - Stabilize the way GPIOs are looked up from the ACPI legacy
    specification.

    - Incremental driver features for PXA, PCA953X, Lantiq (patches from
    the OpenWRT community), RCAR, Zynq, PL061, 104-idi-48

    New drivers:

    - Add a GPIO chip to the ALSA SoC AC97 driver.

    - Add a new Broadcom NSP SoC driver (this lands in the pinctrl dir,
    but the branch is merged here too to account for infrastructural
    changes).

    - The sx150x driver now supports the sx1502"

    * tag 'gpio-v4.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (220 commits)
    gpio: generic: make bgpio_pdata always visible
    gpiolib: fix chip order in gpio list
    gpio: mpc8xxx: Do not use gpiochip_get_data() in mpc8xxx_gpio_save_regs()
    gpio: mm-lantiq: Do not use gpiochip_get_data() in ltq_mm_save_regs()
    gpio: brcmstb: Allow building driver for BMIPS_GENERIC
    gpio: brcmstb: Set endian flags for big-endian MIPS
    gpio: moxart: fix build regression
    gpio: xilinx: Do not use gpiochip_get_data() in xgpio_save_regs()
    leds: pca9532: use gpiochip data pointer
    leds: tca6507: use gpiochip data pointer
    hid: cp2112: use gpiochip data pointer
    bcma: gpio: use gpiochip data pointer
    avr32: gpio: use gpiochip data pointer
    video: fbdev: via: use gpiochip data pointer
    gpio: pch: Optimize pch_gpio_get()
    Revert "pinctrl: lantiq: Implement gpio_chip.to_irq"
    pinctrl: nsp-gpio: use gpiochip data pointer
    pinctrl: vt8500-wmt: use gpiochip data pointer
    pinctrl: exynos5440: use gpiochip data pointer
    pinctrl: at91-pio4: use gpiochip data pointer
    ...

    Linus Torvalds
     

15 Jan, 2016

1 commit

  • Pull trivial tree updates from Jiri Kosina.

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial:
    floppy: make local variable non-static
    exynos: fixes an incorrect header guard
    dt-bindings: fixes some incorrect header guards
    cpufreq-dt: correct dead link in documentation
    cpufreq: ARM big LITTLE: correct dead link in documentation
    treewide: Fix typos in printk
    Documentation: filesystem: Fix typo in fs/eventfd.c
    fs/super.c: use && instead of & for warn_on condition
    Documentation: fix sysfs-ptp
    lib: scatterlist: fix Kconfig description

    Linus Torvalds
     

11 Jan, 2016

5 commits

  • With the MC next gen rework, what's left for media_entity_init()
    is to just initialize the PADs. However, certain devices, like
    a FLASH led/light doesn't have any input or output PAD.

    So, there's no reason why calling media_entity_init() would be
    mandatory. Also, despite its name, what this function actually
    does is to initialize the PADs data. So, rename it to
    media_entity_pads_init() in order to reflect that.

    The media entity actual init happens during entity register,
    at media_device_register_entity(). We should move init of
    num_links and num_backlinks to it.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • Rename the userspace types from MEDIA_ENT_T_ to MEDIA_ENT_F_
    and add the backward compatibility bits.

    The changes at the .c files was generated by the following
    coccinelle script:

    @@
    @@
    -MEDIA_ENT_T_UNKNOWN
    +MEDIA_ENT_F_UNKNOWN
    @@
    @@
    -MEDIA_ENT_T_DVB_BASE
    +MEDIA_ENT_F_DVB_BASE
    @@
    @@
    -MEDIA_ENT_T_V4L2_BASE
    +MEDIA_ENT_F_V4L2_BASE
    @@
    @@
    -MEDIA_ENT_T_V4L2_SUBDEV_BASE
    +MEDIA_ENT_F_V4L2_SUBDEV_BASE
    @@
    @@
    -MEDIA_ENT_T_CONNECTOR_BASE
    +MEDIA_ENT_F_CONNECTOR_BASE
    @@
    @@
    -MEDIA_ENT_T_V4L2_VIDEO
    +MEDIA_ENT_F_IO_V4L
    @@
    @@
    -MEDIA_ENT_T_V4L2_VBI
    +MEDIA_ENT_F_IO_VBI
    @@
    @@
    -MEDIA_ENT_T_V4L2_SWRADIO
    +MEDIA_ENT_F_IO_SWRADIO
    @@
    @@
    -MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN
    +MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN
    @@
    @@
    -MEDIA_ENT_T_CONN_RF
    +MEDIA_ENT_F_CONN_RF
    @@
    @@
    -MEDIA_ENT_T_CONN_SVIDEO
    +MEDIA_ENT_F_CONN_SVIDEO
    @@
    @@
    -MEDIA_ENT_T_CONN_COMPOSITE
    +MEDIA_ENT_F_CONN_COMPOSITE
    @@
    @@
    -MEDIA_ENT_T_CONN_TEST
    +MEDIA_ENT_F_CONN_TEST
    @@
    @@
    -MEDIA_ENT_T_V4L2_SUBDEV_SENSOR
    +MEDIA_ENT_F_CAM_SENSOR
    @@
    @@
    -MEDIA_ENT_T_V4L2_SUBDEV_FLASH
    +MEDIA_ENT_F_FLASH
    @@
    @@
    -MEDIA_ENT_T_V4L2_SUBDEV_LENS
    +MEDIA_ENT_F_LENS
    @@
    @@
    -MEDIA_ENT_T_V4L2_SUBDEV_DECODER
    +MEDIA_ENT_F_ATV_DECODER
    @@
    @@
    -MEDIA_ENT_T_V4L2_SUBDEV_TUNER
    +MEDIA_ENT_F_TUNER
    @@
    @@
    -MEDIA_ENT_T_DVB_DEMOD
    +MEDIA_ENT_F_DTV_DEMOD
    @@
    @@
    -MEDIA_ENT_T_DVB_DEMUX
    +MEDIA_ENT_F_TS_DEMUX
    @@
    @@
    -MEDIA_ENT_T_DVB_TSOUT
    +MEDIA_ENT_F_IO_DTV
    @@
    @@
    -MEDIA_ENT_T_DVB_CA
    +MEDIA_ENT_F_DTV_CA
    @@
    @@
    -MEDIA_ENT_T_DVB_NET_DECAP
    +MEDIA_ENT_F_DTV_NET_DECAP

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • Entities should have one or more functions. Calling it as a
    type proofed to not be correct, as an entity could eventually
    have more than one type.

    So, rename the field as function.

    Please notice that this patch doesn't extend support for
    multiple function entities. Such change will happen when
    we have real case drivers using it.

    No functional changes.

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

    Mauro Carvalho Chehab
     
  • Currently, media_entity_init() creates an array with the links,
    allocated at init time. It provides a parameter (extra_links)
    that would allocate more links than the current needs, but this
    is not used by any driver.

    As we want to be able to do dynamic link allocation/removal,
    we'll need to change the implementation of the links. So,
    before doing that, let's first remove that extra unused
    parameter, in order to cleanup the interface first.

    Signed-off-by: Mauro Carvalho Chehab
    Acked-by: Sakari Ailus
    Acked-by: Laurent Pinchart

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • Add support for analog and dvb tv using media controller.

    Signed-off-by: Rafael Lourenço de Lima Chehab
    Signed-off-by: Mauro Carvalho Chehab

    Rafael Lourenço de Lima Chehab
     

24 Dec, 2015

2 commits


22 Dec, 2015

1 commit

  • As reported by kmemleak:

    unreferenced object 0xffff880321e1da40 (size 32):
    comm "modprobe", pid 3309, jiffies 4295019569 (age 2359.636s)
    hex dump (first 32 bytes):
    47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 G...............
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    backtrace:
    [] kmemleak_alloc+0x4e/0xb0
    [] kmem_cache_alloc_trace+0x1ec/0x280
    [] au8522_probe+0x19a/0xa30 [au8522_decoder]
    [] i2c_device_probe+0x2b2/0x490
    [] driver_probe_device+0x454/0xd90
    [] __device_attach_driver+0x17b/0x230
    [] bus_for_each_drv+0x11a/0x1b0
    [] __device_attach+0x1cd/0x2c0
    [] device_initial_probe+0x13/0x20
    [] bus_probe_device+0x1af/0x250
    [] device_add+0x943/0x13b0
    [] device_register+0x1a/0x20
    [] i2c_new_device+0x5d6/0x8f0
    [] v4l2_i2c_new_subdev_board+0x1e4/0x250 [v4l2_common]
    [] v4l2_i2c_new_subdev+0xd7/0x110 [v4l2_common]
    [] au0828_card_analog_fe_setup+0x2e6/0x3f0 [au0828]

    Checking where the error happens:
    (gdb) list *au8522_probe+0x19a
    0x99a is in au8522_probe (drivers/media/dvb-frontends/au8522_decoder.c:761).
    756 printk(KERN_INFO "au8522_decoder attach existing instance.\n");
    757 break;
    758 }
    759
    760 demod_config = kzalloc(sizeof(struct au8522_config), GFP_KERNEL);
    761 if (demod_config == NULL) {
    762 if (instance == 1)
    763 kfree(state);
    764 return -ENOMEM;
    765 }

    Shows that the error path is not being handled properly.

    The are actually several issues here:

    1) config free should have been calling hybrid_tuner_release_state()
    function, by calling au8522_release_state();

    2) config is only allocated at the digital part. On the analog one,
    it is received from the caller.

    A complex logic could be added to address it, however, it is simpler
    to just embeed config inside the state.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     

18 Dec, 2015

1 commit

  • Move timestamp from struct vb2_v4l2_buffer to struct vb2_buffer
    for common use, and change its type to u64 in order to handling
    y2038 problem. This patch also includes all device drivers' changes related to
    this restructuring.

    Signed-off-by: Junghak Sung
    Signed-off-by: Geunyoung Kim
    Acked-by: Seung-Woo Kim
    Acked-by: Inki Dae
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Junghak Sung