Skip to content
  1. Mar 14, 2023
    • Phil Elwell's avatar
      bcm2835-dma: Add proper 40-bit DMA support · 9a52a991
      Phil Elwell authored
      
      
      BCM2711 has 4 DMA channels with a 40-bit address range, allowing them
      to access the full 4GB of memory on a Pi 4.
      
      Signed-off-by: default avatarPhil Elwell <phil@raspberrypi.org>
      9a52a991
    • Naushir Patuck's avatar
      staging: vchiq: Load bcm2835_isp driver from vchiq · a7fb577f
      Naushir Patuck authored
      
      
      bcmn2835_isp is a platform driver dependent on vchiq,
      therefore add the load/unload functions for it to vchiq.
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      a7fb577f
    • Naushir Patuck's avatar
      media: uapi: v4l-ctrls: Add CID base for the bcm2835-isp driver · a00fedfe
      Naushir Patuck authored
      
      
      We are reserving controls for the new bcm2835-isp driver.
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      a00fedfe
    • Naushir Patuck's avatar
      media: uapi: v4l2-core: Add ISP statistics output V4L2 fourcc type · 81cee275
      Naushir Patuck authored
      
      
      Add V4L2_META_FMT_BCM2835_ISP_STATS V4L2 format type.
      
      This new format will be used by the BCM2835 ISP device to return
      out ISP statistics for 3A.
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      81cee275
    • Naushir Patuck's avatar
      media: uapi: Add MEDIA_BUS_FMT_SENSOR_DATA media bus format · 314a685c
      Naushir Patuck authored
      
      
      This patch adds MEDIA_BUS_FMT_SENSOR_DATA used by the bcm2835-unicam
      driver to support CSI-2 embedded data streams from camera sensors.
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      314a685c
    • Naushir Patuck's avatar
      media: uapi: v4l2-core: Add sensor ancillary data V4L2 foucc type. · d45d62a7
      Naushir Patuck authored
      
      
      Add V4L2_META_FMT_SENSOR_DATA format 4CC.
      
      This new format will be used by the BCM2835 Unicam device to return
      out camera sensor embedded data.
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      d45d62a7
    • Phil Elwell's avatar
      spi: Force CS_HIGH if GPIO descriptors are used · 4ec3d682
      Phil Elwell authored
      
      
      Commit f3186dd8 ("spi: Optionally use GPIO descriptors for CS GPIOs")
      amended of_spi_parse_dt() to always set SPI_CS_HIGH for SPI slaves whose
      Chip Select is defined by a "cs-gpios" devicetree property.
      
      This change breaks drivers whose probe functions set the mode field of
      the spi_device because in doing so they clear the SPI_CS_HIGH flag.
      
      Fix by setting SPI_CS_HIGH in spi_setup (under the same conditions as
      in of_spi_parse_dt()).
      
      See also: 83b2a8fe ("spi: spidev: Fix CS polarity if GPIO descriptors are used")
      
      Fixes: f3186dd8 ("spi: Optionally use GPIO descriptors for CS GPIOs")
      Signed-off-by: default avatarPhil Elwell <phil@raspberrypi.com>
      
      SQUASH: spi: Demote SPI_CS_HIGH warning to KERN_DEBUG
      
      This warning is unavoidable from a client's perspective and
      doesn't indicate anything wrong (just surprising).
      
      SQUASH with "spi: use_gpio_descriptor fixup moved to spi_setup"
      
      Signed-off-by: default avatarPhil Elwell <phil@raspberrypi.com>
      4ec3d682
    • John Cox's avatar
      staging: media: rpivid: Add Raspberry Pi V4L2 H265 decoder · 70c5d720
      John Cox authored
      
      
      This driver is for the HEVC/H265 decoder block on the Raspberry
      Pi 4, and conforms to the V4L2 stateless decoder API.
      
      Signed-off-by: default avatarJohn Cox <jc@kynesim.co.uk>
      
      staging: media: rpivid: Select MEDIA_CONTROLLER and MEDIA_CONTROLLER_REQUEST_API
      
      MEDIA_CONTROLLER_REQUEST_API is a hidden option. If rpivid depends on it,
      the user would need to first enable another driver that selects
      MEDIA_CONTROLLER_REQUEST_API, and only then rpivid would become available.
      
      By selecting it instead of depending on it, it becomes possible to enable
      rpivid without having to enable other potentially unnecessary drivers.
      
      Signed-off-by: default avatarHristo Venev <hristo@venev.name>
      
      rpivid_h265: Fix width/height typo
      
      Signed-off-by: default avatarpopcornmix <popcornmix@gmail.com>
      
      rpivid_h625: Fix build warnings
      
      Signed-off-by: default avatarPhil Elwell <phil@raspberrypi.com>
      
      staging: rpivid: Fix crash when CMA alloc fails
      
      If realloc to increase coeff size fails then attempt to re-allocate
      the original size.  If that also fails then flag a fatal error to abort
      all further decode.
      
      Signed-off-by: default avatarJohn Cox <jc@kynesim.co.uk>
      
      rpivid: Request maximum hevc clock
      
      Query maximum and minimum clock from driver
      and use those
      
      Signed-off-by: default avatarDom Cobley <popcornmix@gmail.com>
      
      rpivid: Switch to new clock api
      
      Signed-off-by: default avatarDom Cobley <popcornmix@gmail.com>
      
      rpivid: Only clk_request_done once
      
      Fixes: 25486f49
      Signed-off-by: default avatarDom Cobley <popcornmix@gmail.com>
      
      media: rpivid: Remove the need to have num_entry_points set
      
      VAAPI H265 has num entry points but never sets it. Allow a VAAPI
      shim to work without requiring rewriting the VAAPI driver.
      num_entry_points can be calculated from the slice_segment_addr
      of the next slice so delay processing until we have that.
      
      Also includes some minor cosmetics.
      
      Signed-off-by: default avatarJohn Cox <jc@kynesim.co.uk>
      
      media: rpivid: Convert to MPLANE
      
      Use multi-planar interface rather than single plane interface. This
      allows dmabufs holding compressed data to be resized.
      
      Signed-off-by: default avatarJohn Cox <jc@kynesim.co.uk>
      
      media: rpivid: Add an enable count to irq claim Qs
      
      Add an enable count to the irq Q structures to allow the irq logic to
      block further callbacks if resources associated with the irq are not
      yet available.
      
      Signed-off-by: default avatarJohn Cox <jc@kynesim.co.uk>
      
      media: rpivid: Add a Pass0 to accumulate slices and rework job finish
      
      Due to overheads in assembling controls and requests it is worth having
      the slice assembly phase separate from the h/w pass1 processing. Create
      a queue to service pass1 rather than have the pass1 finished callback
      trigger the next slice job.
      
      This requires a rework of the logic that splits up the buffer and
      request done events. This code contains two ways of doing that, we use
      Ezequiel Garcias <ezequiel@collabora.com> solution, but expect that
      in the future this will be handled by the framework in a cleaner manner.
      
      Fix up the handling of some of the memory exhaustion crashes uncovered
      in the process of writing this code.
      
      Signed-off-by: default avatarJohn Cox <jc@kynesim.co.uk>
      
      media: rpivid: Map cmd buffer directly
      
      It is unnecessary to have a separate dmabuf to hold the cmd buffer.
      Map it directly from the kmalloc.
      
      Signed-off-by: default avatarJohn Cox <jc@kynesim.co.uk>
      
      media: rpivid: Improve values returned when setting output format
      
      Guess a better value for the compressed bitstream buffer size
      
      Signed-off-by: default avatarJohn Cox <jc@kynesim.co.uk>
      
      media: rpivid: Improve stream_on/off conformance & clock setup
      
      Fix stream on & off such that failures leave the driver in the correct
      state.  Ensure that the clock is on when we are streaming and off when
      all contexts attached to this device have stopped streaming.
      
      Signed-off-by: default avatarJohn Cox <jc@kynesim.co.uk>
      
      media: rpivid: Improve SPS/PPS error handling/validation
      
      Move size and width checking from bitstream processing to control
      validation
      
      Signed-off-by: default avatarJohn Cox <jc@kynesim.co.uk>
      
      media: rpivid: Fix H265 aux ent reuse of the same slot
      
      It is legitimate, though unusual, for an aux ent associated with a slot
      to be selected in phase 0 before a previous selection has been used and
      released in phase 2. Fix such that if the slot is found to be in use
      that the aux ent associated with it is reused rather than an new aux
      ent being created. This fixes a problem where when the first aux ent
      was released the second was lost track of.
      
      This bug spotted in Nick's testing. It may explain some other occasional,
      unreliable decode error reports where dmesg included "Missing DPB AUX
      ent" logging.
      
      Signed-off-by: default avatarJohn Cox <jc@kynesim.co.uk>
      
      media: rpivid: Update to compile with new hevc decode params
      
      DPB entries have moved from slice params to the new decode params
      attribute - update to deal with this.  Also fixes fallthrough
      warnings which seem to be new in 5.14.
      
      Signed-off-by: default avatarJohn Cox <jc@kynesim.co.uk>
      
      media: rpivid: Make slice ctrl dynamic
      
      Allows the user to submit a whole frames worth of slice headers in
      one lump along with a single bitstream dmabuf for the whole lot.
      This saves potentially a lot of bitstream copying.
      
      Signed-off-by: default avatarJohn Cox <jc@kynesim.co.uk>
      
      media: rpivid: Only create aux entries for H265 if needed
      
      Only create aux entries of mv info for frames where that info might
      be used by a later frame.  This saves some memory bandwidth and
      potentially some memory.
      
      Signed-off-by: default avatarJohn Cox <jc@kynesim.co.uk>
      
      media: rpivid: Avoid returning EINVAL to a G_FMT ioctl
      
      V4L2 spec says that G/S/TRY_FMT IOCTLs should never return errors for
      anything other than wrong buffer types. Improve the capture format
      function such that this is so and unsupported values get converted
      to supported ones properly.
      
      Signed-off-by: default avatarJohn Cox <jc@kynesim.co.uk>
      
      media: rpivid: Remove unused ctx state variable and defines
      
      Remove unused ctx state tracking variable and associated defines.
      Their presence implies they might be used, but they aren't.
      
      Signed-off-by: default avatarJohn Cox <jc@kynesim.co.uk>
      
      media: rpivid: Ensure IRQs have completed before uniniting context
      
      Before uniniting the decode context sync with the IRQ queues to ensure
      that decode no longer has any buffers in use.  This fixes a problem that
      manifested as ffmpeg leaking CMA buffers when it did a stream off on
      OUTPUT before CAPTURE, though in reality it was probably much more
      dangerous than that.
      
      Signed-off-by: default avatarJohn Cox <jc@kynesim.co.uk>
      
      media: rpivid: remove min_buffers_needed from src queue
      
      Remove min_buffers_needed=1 from src queue init. Src buffers are bound
      to media requests therefore this setting is not needed and generates
      a WARN in kernel 5.16.
      
      Signed-off-by: default avatarJohn Cox <jc@kynesim.co.uk>
      
      rpivid: Use clk_get_max_rate()
      
      The driver was using clk_round_rate() to figure out the maximum clock
      rate that was allowed for the HEVC clock.
      
      Since we have a function to return it directly now, let's use it.
      
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      
      media: rpivid: Apply V4L2 stateless API changes
      
      media: rpivid: Fix fallthrough warning
      
      Replace old-style /* FALLTHRU */ with fallthrough;
      
      Signed-off-by: default avatarJohn Cox <jc@kynesim.co.uk>
      
      media: rpivid: Set min value as well as max for HEVC_DECODE_MODE
      
      As only one value can be accepted set both min and max to that value.
      
      Signed-off-by: default avatarJohn Cox <jc@kynesim.co.uk>
      
      media: rpivid: Accept ANNEX_B start codes
      
      Allow the START_CODE control to take ANNEX_B as a value. This makes no
      difference to any part of the decode process as the added bytes are in
      data that we ignore. This helps my testing and may help userland code
      that expects to send those bytes.
      
      Signed-off-by: default avatarJohn Cox <jc@kynesim.co.uk>
      
      rpivid: Convert to new clock rate API
      
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      70c5d720
    • Ezequiel Garcia's avatar
      RFC: media: Add media_request_{pin,unpin} API · 533ab7bc
      Ezequiel Garcia authored
      
      
      This is probably not the API we will want to add, but it
      should show what semantics are needed by drivers.
      
      The goal is to allow the OUTPUT (aka source) buffer and the
      controls associated to a request to be released from the request,
      and in particular return the OUTPUT buffer back to userspace,
      without signalling the media request fd.
      
      This is useful for devices that are able to pre-process
      the OUTPUT buffer, therefore able to release it before
      the decoding is finished. These drivers should signal
      the media request fd only after the CAPTURE buffer is done.
      
      Tested-by: default avatarJohn Cox <jc@kynesim.co.uk>
      Signed-off-by: default avatarEzequiel Garcia <ezequiel@collabora.com>
      533ab7bc
    • Dave Stevenson's avatar
      media: dt-bindings: media: Add binding for the Raspberry PI HEVC decoder · eaebca2d
      Dave Stevenson authored
      
      
      Adds a binding for the HEVC decoder found on the BCM2711 / Raspberry Pi 4.
      
      Signed-off-by: default avatarDave Stevenson <dave.stevenson@raspberrypi.com>
      eaebca2d
    • Dave Stevenson's avatar
      media: videodev2.h: Add a format for column YUV4:2:0 modes · 49bccde4
      Dave Stevenson authored
      
      
      Some of the Broadcom codec blocks use a column based YUV4:2:0 image
      format, so add the documentation and defines for both 8 and 10 bit
      versions.
      
      Signed-off-by: default avatarDave Stevenson <dave.stevenson@raspberrypi.com>
      49bccde4
    • popcornmix's avatar
      bcmgenet: Disable skip_umac_reset by default · aa8ddd0e
      popcornmix authored
      
      
      Possible fixed upstream by 'net: bcmgenet: keep MAC in reset until PHY is up'
      
      Signed-off-by: default avatarpopcornmix <popcornmix@gmail.com>
      aa8ddd0e
    • Jim Quinlan's avatar
      dt-bindings: pci: Add DT docs for Brcmstb PCIe device · 66193a38
      Jim Quinlan authored
      
      
      The DT bindings description of the Brcmstb PCIe device is described.  This
      node can be used by almost all Broadcom settop box chips, using
      ARM, ARM64, or MIPS CPU architectures.
      
      Signed-off-by: default avatarJim Quinlan <jim2101024@gmail.com>
      66193a38
    • Phil Elwell's avatar
      of: overlay: Correct symbol path fixups · 88293f20
      Phil Elwell authored
      
      
      When symbols from overlays are added to the live tree their paths must
      be rebased. The translated symbol is normally the result of joining
      the fragment-relative path (with a leading "/") to the target path
      (either copied directly from the "target-path" property or resolved
      from the phandle). This translation fails when the target is the root
      node (a common case for Raspberry Pi overlays) because the resulting
      path starts with a double slash. For example, if target-path is "/" and
      the fragment adds a node called "newnode", the label associated with
      that node will be assigned the path "//newnode", which can't be found
      in the tree.
      
      Fix the failure case by explicitly replacing a target path of "/" with
      an empty string.
      
      Fixes: d1651b03 ("of: overlay: add overlay symbols to live device tree")
      
      Signed-off-by: default avatarPhil Elwell <phil@raspberrypi.com>
      88293f20
    • Phil Elwell's avatar
      video: fbdev: bcm2708_fb: Use common compat header · 84e03f88
      Phil Elwell authored
      
      
      The definition of compat_ptr is now common for most platforms, but
      requires the inclusion of <linux/compat.h>.
      
      Signed-off-by: default avatarPhil Elwell <phil@raspberrypi.com>
      84e03f88
    • Phil Elwell's avatar
      pinctrl: bcm2835: Remove gpiochip on error · 18f3e5d5
      Phil Elwell authored
      
      
      A failure in gpiochip_irqchip_add leads to a leak of a gpiochip. Fix
      the leak with the use of devm_gpiochip_add_data.
      
      Fixes: 85ae9e51 ("pinctrl: bcm2835: switch to GPIOLIB_IRQCHIP")
      Signed-off-by: default avatarPhil Elwell <phil@raspberrypi.org>
      18f3e5d5
    • Phil Elwell's avatar
      staging: vchiq_arm: Give vchiq children DT nodes · 81889482
      Phil Elwell authored
      
      
      vchiq kernel clients are now instantiated as platform drivers rather
      than using DT, but the children of the vchiq interface may still
      benefit from access to DT properties. Give them the option of a
      a sub-node of the vchiq parent for configuration and to allow
      them to be disabled.
      
      Signed-off-by: default avatarPhil Elwell <phil@raspberrypi.com>
      81889482
    • Luke Hinds's avatar
      Initialise rpi-firmware before clk-bcm2835 · 98256748
      Luke Hinds authored
      The IMA (Integrity Measurement Architecture) looks for a TPM (Trusted
      Platform Module) having been registered when it initialises; otherwise
      it assumes there is no TPM. It has been observed on BCM2835 that IMA
      is initialised before TPM, and that initialising the BCM2835 clock
      driver before the firmware driver has the effect of reversing this
      order.
      
      Change the firmware driver to initialise at core_initcall, delaying the
      BCM2835 clock driver to postcore_initcall.
      
      See: https://github.com/raspberrypi/linux/issues/3291
           https://github.com/raspberrypi/linux/pull/3297
      
      
      
      Signed-off-by: default avatarLuke Hinds <lhinds@redhat.com>
      Co-authored-by: default avatarPhil Elwell <phil@raspberrypi.org>
      98256748
    • Stefan Wahren's avatar
      ARM: bcm: Backport BCM2711 support from upstream · f829cb42
      Stefan Wahren authored
      
      
      Make the BCM2711 a different machine, but keep it in board_bcm2835.
      
      Signed-off-by: default avatarStefan Wahren <wahrenst@gmx.net>
      f829cb42
    • Dave Stevenson's avatar
      staging: vchiq: Use the old dma controller for OF config on platform devices · aa6eefa9
      Dave Stevenson authored
      
      
      vchiq on Pi4 is no longer under the soc node, therefore it
      doesn't get the dma-ranges for the VPU.
      
      Switch to using the configuration of the old dma controller as
      that will set the dma-ranges correctly.
      
      Signed-off-by: default avatarDave Stevenson <dave.stevenson@raspberrypi.org>
      aa6eefa9
    • Dave Stevenson's avatar
      staging: vchiq_arm: Set up dma ranges on child devices · c3870e08
      Dave Stevenson authored
      
      
      The VCHIQ driver now loads the audio, camera, codec, and vc-sm
      drivers as platform drivers. However they were not being given
      the correct DMA configuration.
      
      Call of_dma_configure with the parent (VCHIQ) parameters to be
      inherited by the child.
      
      Signed-off-by: default avatarDave Stevenson <dave.stevenson@raspberrypi.org>
      c3870e08
    • popcornmix's avatar
      clk-raspberrypi: Allow cpufreq driver to also adjust gpu clocks · 48e777e9
      popcornmix authored
      
      
      For performance/power it is beneficial to adjust gpu clocks with arm clock.
      This is how the downstream cpufreq driver works
      
      Signed-off-by: default avatarpopcornmix <popcornmix@gmail.com>
      48e777e9
    • popcornmix's avatar
      v3d_gem: Kick the clock so firmware knows we are using firmware clock interface · f6a30128
      popcornmix authored
      
      
      Setting the v3d clock to low value allows firmware to handle dvfs in case
      where v3d hardware is not being actively used (e.g. console use).
      
      Signed-off-by: default avatarpopcornmix <popcornmix@gmail.com>
      f6a30128
    • popcornmix's avatar
      5ef19796
    • James Hughes's avatar
      net:phy:2711 Allow ethernet LED mode to be set via device tree · 63f0accf
      James Hughes authored
      
      
      Add device tree entries and code to allow the specification of
      the lighting modes for the LED's on the ethernet connector.
      
      Signed-off-by: default avatarJames Hughes <james.hughes@raspberrypi.org>
      
      net:phy:2711 Change the default ethernet LED actions
      
      This should return default behaviour back to that of previous
      releases.
      63f0accf
    • Dave Stevenson's avatar
      staging: vchiq_arm: Register bcm2835-codec as a platform driver · 9e937a7d
      Dave Stevenson authored
      
      
      Following the same pattern as bcm2835-camera and bcm2835-audio,
      register the V4L2 codec driver as a platform driver
      
      Signed-off-by: default avatarDave Stevenson <dave.stevenson@raspberrypi.com>
      9e937a7d
    • Dave Stevenson's avatar
      staging: vchiq_arm: Register vcsm-cma as a platform driver · 0b46fff1
      Dave Stevenson authored
      
      
      Following the same pattern as bcm2835-camera and bcm2835-audio,
      register the vcsm-cma driver as a platform driver
      
      Signed-off-by: default avatarDave Stevenson <dave.stevenson@raspberrypi.com>
      0b46fff1
    • Phil Elwell's avatar
      drm/v3d: Plug dma_fence leak · 90628b94
      Phil Elwell authored
      
      
      The irq_fence and done_fence are given a reference that is never
      released. The necessary dma_fence_put()s seem to have been
      deleted in error in an earlier commit.
      
      Fixes: 0b73676836b2 ("drm/v3d: Clock V3D down when not in use.")
      
      Signed-off-by: default avatarPhil Elwell <phil@raspberrypi.org>
      90628b94
    • Phil Elwell's avatar
      drm/v3d: Suppress all but the first MMU error · 2ee2beee
      Phil Elwell authored
      
      
      The v3d driver currently encounters a lot of MMU PTE exceptions, so
      only log the first to avoid swamping the kernel log.
      
      Signed-off-by: default avatarPhil Elwell <phil@raspberrypi.org>
      2ee2beee
    • Markus Proeller's avatar
      media: i2c: Add a driver for the Infineon IRS1125 depth sensor · 5485923f
      Markus Proeller authored
      
      
      The Infineon IRS1125 is a time of flight depth sensor that
      has a CSI-2 interface.
      
      Add a V4L2 subdevice driver for this device.
      
      Signed-off-by: default avatarMarkus Proeller <markus.proeller@pieye.org>
      5485923f
    • Markus Proeller's avatar
      dt-bindings: Add binding for the Infineon IRS1125 sensor · f1373946
      Markus Proeller authored
      
      
      Adds a binding for the Infineon IRS1125 time-of-flight depth
      sensor.
      
      Signed-off-by: default avatarMarkus Proeller <markus.proeller@pieye.org>
      f1373946
    • Stefan Wahren's avatar
      ARM: bcm: Switch board, clk and pinctrl to bcm2711 compatible · 7c9facdc
      Stefan Wahren authored
      
      
      After the decision to use bcm2711 compatible for upstream, we should
      switch all accepted compatibles to bcm2711. So we can boot with
      one DTB the down- and the upstream kernel.
      
      Signed-off-by: default avatarStefan Wahren <wahrenst@gmx.net>
      7c9facdc
    • Dave Stevenson's avatar
      staging:bcm2835-camera: Fix the cherry-pick of AWB Greyworld · 69f59c63
      Dave Stevenson authored
      
      
      The cherry-pick of the patch that added the greyworld AWB mode
      was incomplete. Fix it up.
      
      Fixes: b3ef481f "staging: bcm2835-camera: Add greyworld AWB mode"
      Signed-off-by: default avatarDave Stevenson <dave.stevenson@raspberrypi.com>
      69f59c63
    • John Cox's avatar
      media: v4l2: Add Greyworld AWB control name · 186e0e84
      John Cox authored
      
      
      Add name for greyworld to white_balance preset names.
      This patch previously applied to v4l2-ctrl.c but that was split
      and deleted.
      
      Signed-off-by: default avatarJohn Cox <jc@kynesim.co.uk>
      186e0e84
    • Dave Stevenson's avatar
      staging: bcm2835-camera: Add greyworld AWB mode · 8699574d
      Dave Stevenson authored
      
      
      This is mainly used for the NoIR camera which has no IR
      filter and can completely confuse normal AWB presets.
      
      Signed-off-by: default avatarDave Stevenson <dave.stevenson@raspberrypi.org>
      8699574d
    • Dave Stevenson's avatar
      v4l2: Add a Greyworld AWB mode. · 6e0d6af5
      Dave Stevenson authored
      
      
      Adds a simple greyworld white balance preset, mainly for use
      with cameras without an IR filter (eg Raspberry Pi NoIR)
      
      Signed-off-by: default avatarDave Stevenson <dave.stevenson@raspberrypi.org>
      6e0d6af5
    • David Plowman's avatar
      Documentation: devicetree: Add documentation for imx378 sensor · f230a65a
      David Plowman authored
      
      
      The imx378 sensor is compatible with the imx477 and shares common
      device tree settings.
      
      Signed-off-by: default avatarDavid Plowman <david.plowman@raspberrypi.com>
      f230a65a
    • Lee Jackson's avatar
      media: i2c: imx519: Support for the Sony IMX519 sensor · 084e5750
      Lee Jackson authored
      
      
      dt-bindings: media: i2c: Add IMX519 CMOS sensor binding
      
      Add YAML device tree binding for IMX519 CMOS image sensor, and
      the relevant MAINTAINERS entries.
      
      Signed-off-by: default avatarLee Jackson <info@arducam.com>
      
      media: i2c: Add driver for IMX519 sensor
      
      Adds a driver for the 16MPix IMX519 CSI2 sensor.
      Whilst the sensor supports 2 or 4 CSI2 data lanes, this driver
      currently only supports 2 lanes.
      
      The following Bayer modes are currently available:
      
      4656x3496 10-bit @ 10fps
      3840x2160 10-bit (cropped) @ 21fps
      2328x1748 10-bit (binned) @ 30fps
      1920x1080 10-bit (cropped/binned) @ 60fps
      1280x720 10-bit (cropped/binned) @ 120fps
      
      Signed-off-by: default avatarLee Jackson <info@arducam.com>
      
      media: i2c: imx519: Advertise embedded data node on media pad 1
      
      This commit updates the imx519 driver to adverise support for embedded
      data streams.
      
      The imx519 sensor subdevice overloads the media pad to differentiate
      between image stream (pad 0) and embedded data stream (pad 1) when
      performing the v4l2_subdev_pad_ops functions.
      
      Signed-off-by: default avatarLee Jackson <info@arducam.com>
      
      media: i2c: imx519: Sensor should report RAW color space
      
      Tested on Raspberry Pi running libcamera.
      
      Signed-off-by: default avatarDavid Plowman <david.plowman@raspberrypi.com>
      
      media: i2c: Update imx519 Kconfig entry
      
      Bring the IMX519 Kconfig declaration in line with the upstream entries.
      
      Signed-off-by: default avatarPhil Elwell <phil@raspberrypi.com>
      084e5750
    • Naushir Patuck's avatar
      media: i2c: imx477: Support for the Sony IMX477 sensor · c864dc54
      Naushir Patuck authored
      
      
      dt-bindings: media: i2c: Add IMX477 CMOS sensor binding
      
      Add YAML device tree binding for IMX477 CMOS image sensor.
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      
      media: i2c: Add driver for Sony IMX477 sensor
      
      Adds a driver for the 12MPix Sony IMX477 CSI2 sensor.
      Whilst the sensor supports 2 or 4 CSI2 data lanes, this driver
      currently only supports 2 lanes.
      
      The following Bayer modes are currently available:
      
      4056x3040 12-bit @ 10fps
      2028x1520 12-bit (binned) @ 40fps
      2028x1050 12-bit (cropped/binned) @ 50fps
      1012x760 10-bit (scaled) @ 120 fps
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      
      media: i2c: imx477: Add support for adaptive frame control
      
      Use V4L2_CID_EXPOSURE_AUTO_PRIORITY to control if the driver should
      automatically adjust the sensor frame length based on exposure time,
      allowing variable frame rates and longer exposures.
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      
      media: i2c: imx477: Return correct result on sensor id verification
      
      The test should return -EIO if the register read id does not match
      the expected sensor id.
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      
      media: i2c: imx477: Parse and register properties
      
      Parse device properties and register controls for them using the V4L2
      fwnode properties helpers.
      
      Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      
      media: i2c: imx477: Selection compliance fixes
      
      To comply with the intended usage of the V4L2 selection target when
      used to retrieve a sensor image properties, adjust the rectangles
      returned by the imx477 driver.
      
      The top/left crop coordinates of the TGT_CROP rectangle were set to
      (0, 0) instead of (8, 16) which is the offset from the larger physical
      pixel array rectangle. This was also a mismatch with the default values
      crop rectangle value, so this is corrected. Found with v4l2-compliance.
      
      While at it, add V4L2_SEL_TGT_CROP_BOUNDS support: CROP_DEFAULT and
      CROP_BOUNDS have the same size as the non-active pixels are not readable
      using the selection API. Found with v4l2-compliance.
      
      This commit mirrors 543790f7 done for
      the imx219 sensor.
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      
      media: i2c: imx477: Remove auto frame length adjusting
      
      The V4L2_CID_EXPOSURE_AUTO_PRIORITY was used to let the sensor control
      frame length (effectively framerate) based on the requested exposure
      time requested. Remove this feature as it is never used, and goes
      against how V4L2 likes to handle exposure and vblank controls.
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      
      media: i2c: imx477: Add very long exposure control to the driver
      
      Add support for very long exposures by using the exposure multiplier
      register. Userland does not need to pass any additional controls to
      enable long exposures, it simply requests a larger vblank to extend the
      exposure control range appropriately.
      
      Currently, since hblank is fixed, a maximum of approximately 124 seconds
      of exposure time can be used. In a future change, hblank could also be
      controlled in userland to give over 200 seconds of exposure time.
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      
      media: i2c: imx477: Fix crop height for 2028x1080 mode
      
      The crop height for this mode was set at 2600 lines, it should be 2160
      lines instead.
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      
      media: i2c: imx477: Replace existing 1012x760 mode
      
      The existing 1012x760 120 fps mode has significant IQ problem using
      the internal sensor scaler. Replace this mode with a 1332x990 120 fps
      mode instead. This new mode has a smaller field of view, but does not
      suffer from the bad IQ of the original mode.
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      
      media: i2c: imx477: Remove internal v4l2_mbus_framefmt from the state
      
      The only field in this struct that is used is the format code, so
      replace the struct with this single field.
      
      Save the format code in imx477_set_pad_format() when setting up a new
      mode so that imx477_get_pad_format() performs the right lookup.
      Otherwise, this caused a bug where the mode lookup occurred on the
      12-bit table rather than the 10-bit table.
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      
      media: i2c: imx477: Remove unused function parameter
      
      The struct imx477 *ctrl parameter is not used in the function
      imx477_adjust_exposure_range(), so remove it.
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      
      media: i2c: imx477: Fix for long exposure limit calculations
      
      Do not scale IMX477_EXPOSURE_OFFSET with the long exposure factor during
      the limit calculations. This allows larger exposure times, and does seem to be
      what the sensor is doing internally.
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      
      media: i2c: imx477: Extend driver to support imx378 sensor
      
      The imx378 sensor is almost identical to the imx477 and can be
      supported as a "compatible" sensor with just a few extra register
      writes.
      
      Signed-off-by: default avatarDavid Plowman <david.plowman@raspberrypi.com>
      
      media: i2c: imx477: Fix framerates for 1332x990 mode
      
      The imx477 driver's line length for this mode had not been updated to
      the value supplied to us by the sensor manufacturer. With this
      correction the sensor delivers the framerates that are expected.
      
      Signed-off-by: default avatarDavid Plowman <david.plowman@raspberrypi.com>
      
      media: i2c: imx477: Allow control of on-sensor DPC
      
      A module parameter "dpc_enable" is added to allow the control of the
      sensor's on-board DPC (Defective Pixel Correction) function.
      
      This is a global setting to be configured before using the sensor;
      there is no intention that this would ever be changed on-the-fly.
      
      Signed-off-by: default avatarDavid Plowman <david.plowman@raspberrypi.com>
      
      media: i2c: imx477: Sensor should report RAW color space
      
      Tested on Raspberry Pi running libcamera.
      
      Signed-off-by: default avatarDavid Plowman <david.plowman@raspberrypi.com>
      
      media: i2c: imx477: Add vsync trigger_mode parameter
      
      trigger_mode == 0 (default) => no effect / no registers written
      trigger_mode == 1           => source
      trigger_mode == 2           => sink
      
      This can be set e.g. in /boot/cmdline.txt as imx477.trigger_mode=N
      
      Signed-off-by: default avatarJonas Jacob <jonas.jacob@neocortexvision.com>
      
      media: i2c: Update imx477 Kconfig entry
      
      Bring the IMX477 Kconfig declaration in line with upstream entries.
      
      Signed-off-by: default avatarPhil Elwell <phil@raspberrypi.com>
      
      media: i2c: imx477: Correct minimum exposure lines
      
      The minimum number of exposure lines value (IMX477_EXPOSURE_MIN) was
      previously 20 but this is not correct. The datasheet is not completely
      explicit, however the new value of 4 has been tested with all the
      sensor modes supported by this driver, and matches the lowest exposure
      value of 114us that could be achieved wtih Raspberry Pi's legacy
      firmware driver.
      
      Signed-off-by: default avatarDavid Plowman <david.plowman@raspberrypi.com>
      
      media: i2c: imx477: Allow dynamic horizontal blanking control
      
      Currently, the V4L2_CID_HBLANK control is marked as read-only. Remove this
      restriction and allow userland to modify the control if needed.
      
      Set the maximum limit of the line length to 0xfff0.
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      
      media: i2c: imx477: Reset hblank on mode switch
      
      Reset the hblank control to the minimum value on every mode switch. This is to
      account for userland instances that do not yet control hblank, otherwise it
      gets set to a non-optimal value.
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      
      media: i2c: imx477: Do not unconditionally adjust hblank and vblank limits
      
      On a mode change, only call imx477_set_framing_limits() to adjust the hblank
      and vblank limits if the new mode is different from the existing mode. This
      preserves any manual control values the user might have set.
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      c864dc54
    • Manivannan Sadhasivam's avatar
      media: i2c: imx296: Support for the Sony IMX296 sensor · 7f14666d
      Manivannan Sadhasivam authored
      
      
      dt-bindings: media: i2c: Add IMX296 CMOS sensor binding
      
      Add YAML devicetree binding for IMX296 CMOS image sensor. Let's also
      add MAINTAINERS entry for the binding and driver.
      
      Signed-off-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
      Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      
      media: i2c: IMX296 camera sensor driver
      
      The IMX296LLR is a monochrome 1.60MP CMOS sensor from Sony. The driver
      supports cropping and binning (but not both at the same time due to
      hardware limitations) and exposure, gain, vertical blanking and test
      pattern controls.
      
      Preliminary support is also included for the color IMX296LQR sensor.
      
      Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      
      media: imx296: Fix Bayer order
      
      Switch the Bayer ordering advertised by the device driver from BGGR to RGGB.
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      
      media: imx296: Add standby and stream on/off delays
      
      Add a 1.5ms delay after coming out of standby.
      Add a 2ms delay after going into or coming out of streaming state.
      
      All delay values have been deduced from the sensor datasheet.
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      
      media: imx296: Only advertise the full resolution mode
      
      The 1/4 resolution derived mode does not stream correctly, so remove it from
      the advertised mode list.
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      
      media: imx296: Add horizontal and vertical flips support
      
      Add support for hflip and vflip controls. Adjust the mbus_code value reported
      based on the currently programmed flips.
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      
      media: imx296: Adjust exposure limits on vblank changes
      
      The exposure lines control limits are adjusted appropriately during any change
      to the vblank control. This allows accurate framerate and exposure adjustments
      from userland.
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      
      media: imx296: Set gain delay to 1 frame
      
      In order to behave in a similar manner to the rolling shutter sensors, set the
      gain delay to 1 frame. This simplifies userland control of the gain value.
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      
      media: imx296: Add the link frequency control
      
      Add the V4L2_CID_LINK_FREQ menu control for the imx296. Report a single value
      of 1188 Mhz for the link frequency.
      
      Signed-off-by: default avatarNaushir Patuck <naush@raspberrypi.com>
      7f14666d