1. Jan 29, 2022
    • Laurent Pinchart's avatar
      media: i2c: max9286: Implement media entity .link_validate() operation · 1fe6ae4e
      Laurent Pinchart authored
      
      
      The MAX9286 has sink pads, so it should implement .link_validate(). Do
      so.
      
      Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
      Reviewed-by: default avatarJacopo Mondi <jacopo+renesas@jmondi.org>
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      1fe6ae4e
    • kernel test robot's avatar
      media: ov5693: fix returnvar.cocci warnings · 1949c01e
      kernel test robot authored
      
      
      drivers/media/i2c/ov5693.c:953:5-8: Unneeded variable: "ret". Return "0" on line 985
      
       Remove unneeded variable used to store return value.
      
      Generated by: scripts/coccinelle/misc/returnvar.cocci
      
      [Sakari Ailus: Improved subject]
      
      CC: Daniel Scally <djrscally@gmail.com>
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      1949c01e
    • kernel test robot's avatar
      media: ov5693: fix boolconv.cocci warnings · 2a7f8142
      kernel test robot authored
      
      
      drivers/media/i2c/ov5693.c:989:46-51: WARNING: conversion to bool not needed here
      drivers/media/i2c/ov5693.c:991:46-51: WARNING: conversion to bool not needed here
      
       Remove unneeded conversion to bool
      
      Semantic patch information:
       Relational and logical operators evaluate to bool,
       explicit conversion is overly verbose and unneeded.
      
      Generated by: scripts/coccinelle/misc/boolconv.cocci
      
      [Sakari Ailus: Improved subject]
      
      CC: Daniel Scally <djrscally@gmail.com>
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      2a7f8142
    • Jimmy Su's avatar
      media: i2c: Add ov08d10 camera sensor driver · 7be91e02
      Jimmy Su authored
      
      
      Add a v4l2 sub-device driver for the OmniVision ov08d10 image sensor.
      This camera sensor is using the i2c bus for control and the
      csi-2 bus for data.
      
      The following features are supported:
      - manual exposure and analog/digital gain control
      - vblank/hblank control
      - test pattern
      - image vertical flip and horizontal mirror control
      - supported resolution:
      	- 3280x2460 at 30 FPS
      	- 3264x2448 at 30 FPS
      	- 1632x1224 at 30 FPS
      - supported bayer order output:
      	- SGRBG10 as default
      	- SBGGR10 at flip mode
      	- SRGGB10 at mirror mode
      	- SGBRG10 at flip + mirror mode
      
      Signed-off-by: default avatarJimmy Su <jimmy.su@intel.com>
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      7be91e02
    • Shawn Tu's avatar
      media: hi847: Add support for Hi-847 sensor · da15b409
      Shawn Tu authored
      
      
      Add a V4L2 sub-device driver for Hynix Hi-847 image sensor.
      This is a camera sensor using the I2C bus for control and the
      CSI-2 bus for data.
      
      This driver supports following features:
      - manual exposure and analog/digital gain control support
      - vblank/hblank control support
      - test pattern support
      - media controller support
      - runtime PM support
      - vflip/hflip control support
        - keep SGRBG10 Bayer order output
      - support following resolutions:
        + 3264x2448 at 30FPS
        + 1632x1224 at 60FPS
      
      [Sakari Ailus: Wrapped a few long lines.]
      
      Signed-off-by: default avatarShawn Tu <shawnx.tu@intel.com>
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      da15b409
    • Sakari Ailus's avatar
      media: ov8865: Fix indentation in set_selection callback · ff44cc4c
      Sakari Ailus authored
      
      
      Fixed wrong indentation in set_selection callback.
      
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      ff44cc4c
    • Sakari Ailus's avatar
      media: ov5648: Don't pack controls struct · edd4fbff
      Sakari Ailus authored
      
      
      Don't pack the driver specific struct containing control pointers. This
      lead to potential alignment issues when working with the pointers.
      
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Fixes: e43ccb0a
      
       ("media: i2c: Add support for the OV5648 image sensor")
      Reviewed-by: default avatarPaul Kocialkowski <paul.kocialkowski@bootlin.com>
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      edd4fbff
    • Sakari Ailus's avatar
      media: v4l: Avoid unaligned access warnings when printing 4cc modifiers · 24bb30c8
      Sakari Ailus authored
      
      
      Pointers V4L2 pixelformat and dataformat fields in a few packed structs
      are directly passed to printk family of functions. This could result in an
      unaligned access albeit no such possibility appears to exist at the
      moment i.e. this clang warning appears to be a false positive.
      
      Address the warning by copying the pixelformat or dataformat value to a
      local variable first.
      
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Fixes: e927e1e0
      
       ("v4l: ioctl: Use %p4cc printk modifier to print FourCC codes")
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      24bb30c8
    • Janusz Krzysztofik's avatar
      media: ov6650: Fix missing frame interval enumeration support · c748f10c
      Janusz Krzysztofik authored
      
      
      According to v4l2-compliance utility, a video device which supports
      V4L2_CAP_TIMEPERFRAME via .vidioc_s_parm() operation should also
      support .vidioc_enum_frameintervals().  If the former is implemented
      via a call to v4l2_s_parm_cap() which in turn calls a subdevice
      .s_frame_interval() pad operation, the video device may want to
      implement the latter by passing frame interval enumeration requests to
      the subdevice .enum_frame_intervals() video operation.  If that
      operation is not supported by the subdevice and failure is returned by
      the video device, the compliance test issues a warning.
      
      Implement the missing pad operation.  Enumerate frame intervals
      possible to be set via pixel clock adjustment, as implemented by
      .s_frame_interval(), but not exceeding a reasonable maximum of 1
      second.
      
      [Sakari Ailus: Rebased on mbus config pad op patches]
      
      Signed-off-by: default avatarJanusz Krzysztofik <jmkrzyszt@gmail.com>
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      c748f10c
    • Janusz Krzysztofik's avatar
      media: ov6650: Fix crop rectangle affected by set format · 985d2d7a
      Janusz Krzysztofik authored
      According to subdevice interface specification found in V4L2 API
      documentation, set format pad operations should not affect image
      geometry set in preceding image processing steps. Unfortunately, that
      requirement is not respected by the driver implementation of set format
      as it was not the case when that code was still implementing a pair of
      now obsolete .s_mbus_fmt() / .try_mbus_fmt() video operations before
      they have been merged and reused as an implementation of .set_fmt() pad
      operation by commit 717fd5b4 ("[media] v4l2: replace try_mbus_fmt
      by set_fmt").
      
      Exclude non-compliant crop rectangle adjustments from set format try,
      as well as a call to .set_selection() from set format active processing
      path, so only frame scaling is applied as needed and crop rectangle is
      no longer modified.
      
      [Sakari Ailus: Rebase on subdev state patches]
      
      Fixes: 717fd5b4
      
       ("[media] v4l2: replace try_mbus_fmt by set_fmt")
      Signed-off-by: default avatarJanusz Krzysztofik <jmkrzyszt@gmail.com>
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      985d2d7a
    • Janusz Krzysztofik's avatar
      media: ov6650: Add try support to selection API operations · c7405264
      Janusz Krzysztofik authored
      Try requests are now only supported by format processing pad operations
      implemented by the driver.  The driver selection API operations
      currently respond to them with -EINVAL.  While that is correct, it
      constraints video device drivers to not use subdevice cropping at all
      while processing user requested active frame size, otherwise their set
      try format results might differ from active.  As a consequence, we
      can't fix set format pad operation as not to touch crop rectangle since
      that would affect users not being able to set arbitrary frame sizes.
      Moreover, without a working set try selection support we are not able
      to use pad config crop rectangle as a reference while processing set
      try format requests.
      
      Implement missing try selection support.  Moreover, as it will be now
      possible to maintain the pad config crop rectangle via selection API,
      start using it instead of the active one as a reference while
      processing set try format requests.
      
      is_unscaled_ok() helper, now also called from set selection operation,
      has been just moved up in the source file to avoid a prototype, with no
      functional changes.
      
      [Sakari Ailus: Rebase on subdev state patches]
      
      Fixes: 717fd5b4
      
       ("[media] v4l2: replace try_mbus_fmt by set_fmt")
      Signed-off-by: default avatarJanusz Krzysztofik <jmkrzyszt@gmail.com>
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      c7405264
    • Janusz Krzysztofik's avatar
      media: ov6650: Fix set format try processing path · 1f6f1e95
      Janusz Krzysztofik authored
      According to subdevice interface specification found in V4L2 API
      documentation, set format pad operations should not affect image
      geometry set in preceding image processing steps. Unfortunately, that
      requirement is not respected by the driver implementation of set format
      as it was not the case when that code was still implementing a pair of
      now obsolete .s_mbus_fmt() / .try_mbus_fmt() video operations before
      they have been merged and reused as an implementation of .set_fmt() pad
      operation by commit 717fd5b4 ("[media] v4l2: replace try_mbus_fmt
      by set_fmt").
      
      In case of set format active processing path the issue can be fixed
      easily by excluding a call to set active selection from that path. That
      will effectively limit frame size processing to optimal frame scaling
      against active crop rectangle without touching it.  Users can just call
      set active selection themselves to obtain desired frame size.  However,
      set format try processing path needs more work.
      
      First of all, the driver should be extended with set try selection
      support.  Lack of it constraints video device drivers to not use
      subdevice cropping at all while processing user requested active frame
      size, otherwise their set try format results might differ from active.
      
      Next, set format try processing path should use pad config crop
      rectangle as a reference, not the active one as it does now.  That
      issue can be resolved easily as soon as set try selection support is
      added to the driver so pad config crop rectangle can be maintained by
      users via selection API.
      
      Last, set format try processing path should give the same results as
      active in respect to active vs. pad config crop rectangle geometry.
      Both rectangles should be either not touched by set format (that's what
      we are going to achieve) or modified the same way, otherwise users
      won't be able to obtain equal results from both paths while iterating
      through set format and set selection operations in order to obtain
      desired frame size.
      
      We can't begin with modifying set format pad operation as not to touch
      crop rectangle since that depends on availability of set try selection
      for symmetry.  Neither can we begin with adding set try selection since
      that in turn depends on equal handling of active and pad config crop
      rectangles by set format.  We can either implement all required
      modifications in a single patch, or begin with fixing current set
      format try processing path to appropriately handle pad config crop
      rectangle.  This patch implements the latter approach as believed to
      be more readable.
      
      Move crop rectangle adjustments code from a helper (the former
      implementation of .s_fmt(), now called from set format active
      processing path) to the body of set format pad operation function
      where it can be also used for processing try requests for symmetry with
      active ones.  As the helper no longer processes frame geometry, only
      frame format and half scaling, simplify its API accordingly and update
      its users.
      
      Moreover, extract code that applies crop rectangle hardware limits
      (now a part of .set_selection() operation which is called from set
      format active processing path) to a new helper and call that helper
      from set format try processing path as well for symmetry with active.
      
      [Sakari Ailus: Rebase on subdev state patches]
      
      Fixes: 717fd5b4
      
       ("[media] v4l2: replace try_mbus_fmt by set_fmt")
      Signed-off-by: default avatarJanusz Krzysztofik <jmkrzyszt@gmail.com>
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      1f6f1e95
  2. Jan 28, 2022