platform/kernel/linux-rpi.git
2 years agomedia: uapi: v4l2-core: Add ISP statistics output V4L2 fourcc type
Naushir Patuck [Thu, 23 Apr 2020 09:20:26 +0000 (10:20 +0100)]
media: uapi: v4l2-core: Add ISP statistics output V4L2 fourcc type

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: Naushir Patuck <naush@raspberrypi.com>
2 years agomedia: bcm2835-unicam: Re-fetch mbus code from subdev on a g_fmt call
Naushir Patuck [Tue, 21 Apr 2020 15:26:03 +0000 (16:26 +0100)]
media: bcm2835-unicam: Re-fetch mbus code from subdev on a g_fmt call

The sensor subdevice may change the Bayer order if a H/V flip is
requested after a s_fmt call.  Unicam g_fmt must call the subdev get_fmt
in case this has happened and return out the correct format 4cc.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2 years agomedia: bcm2835-unicam: Add support for the FRAME_SYNC event
Laurent Pinchart [Tue, 24 Mar 2020 21:13:02 +0000 (23:13 +0200)]
media: bcm2835-unicam: Add support for the FRAME_SYNC event

The FRAME_SYNC event is useful for userspace image processing algorithms
to program the camera sensor as early as possible after frame start.
Support it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
2 years agomedia: bcm2835-unicam: Disable event-related ioctls on metadata node
Laurent Pinchart [Tue, 24 Mar 2020 21:13:02 +0000 (23:13 +0200)]
media: bcm2835-unicam: Disable event-related ioctls on metadata node

The unicam driver supports both the SOURCE_CHANGE and CTRL events. Both
events are only generated on the image video node, so the event-related
ioctls are useless on the medatada node. Disable them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
2 years agomedia: bcm2835-unicam: Use dummy buffer if none have been queued
Naushir Patuck [Thu, 2 Apr 2020 15:08:51 +0000 (16:08 +0100)]
media: bcm2835-unicam: Use dummy buffer if none have been queued

If no buffer has been queued by a userland application, we use an
internal dummy buffer for the hardware to spin in. This will allow
the driver to release the existing userland buffer back to the
application for processing.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2 years agomedia: bcm2835-unicam: Add embedded data node.
Naushir Patuck [Thu, 16 Apr 2020 10:35:41 +0000 (11:35 +0100)]
media: bcm2835-unicam: Add embedded data node.

This patch adds a new node in the bcm2835-unicam driver to support
CSI-2 embedded data streams.  The subdevice is queried to see if
embedded data is available from the sensor.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2 years agomedia: bcm2835-unicam: Add support for mulitple device nodes.
Naushir Patuck [Tue, 7 Apr 2020 09:42:14 +0000 (10:42 +0100)]
media: bcm2835-unicam: Add support for mulitple device nodes.

Move device node specific state out of the device state structure and
into a new node structure.  This separation will be needed for future
changes where we will add an embedded data node to the driver to work
alongside the existing image data node.

Currently only use a single image node, so this commit does not add
any functional changes.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2 years agomedia: uapi: Add MEDIA_BUS_FMT_SENSOR_DATA media bus format
Naushir Patuck [Tue, 21 Jan 2020 14:06:47 +0000 (14:06 +0000)]
media: uapi: Add MEDIA_BUS_FMT_SENSOR_DATA media bus format

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: Naushir Patuck <naush@raspberrypi.com>
2 years agomedia: uapi: v4l2-core: Add sensor ancillary data V4L2 foucc type.
Naushir Patuck [Wed, 1 Apr 2020 07:46:29 +0000 (08:46 +0100)]
media: uapi: v4l2-core: Add sensor ancillary data V4L2 foucc type.

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: Naushir Patuck <naush@raspberrypi.com>
2 years agomedia: bcm2835-unicam: Driver for CCP2/CSI2 camera interface
Naushir Patuck [Wed, 1 Apr 2020 07:39:49 +0000 (08:39 +0100)]
media: bcm2835-unicam: Driver for CCP2/CSI2 camera interface

Add driver for the Unicam camera receiver block on
BCM283x processors.

This commit is made up of a series of changes cherry-picked from the
rpi-4.19.y branch.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2 years agodriver: char: rpivid: Don't map more than wanted
Phil Elwell [Tue, 21 Apr 2020 10:30:23 +0000 (11:30 +0100)]
driver: char: rpivid: Don't map more than wanted

Limit mappings to the permitted range, but don't map more than asked
for otherwise we walk off the end of the allocated VMA.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 years agospi: Force CS_HIGH if GPIO descriptors are used
Phil Elwell [Fri, 17 Apr 2020 09:46:19 +0000 (10:46 +0100)]
spi: Force CS_HIGH if GPIO descriptors are used

Commit f3186dd87669 ("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: 83b2a8fe43bd ("spi: spidev: Fix CS polarity if GPIO descriptors are used")

Fixes: f3186dd87669 ("spi: Optionally use GPIO descriptors for CS GPIOs")
Signed-off-by: Phil 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: Phil Elwell <phil@raspberrypi.com>
2 years agodriver: char: rpivid: Remove legacy name support
Phil Elwell [Mon, 20 Apr 2020 21:18:52 +0000 (22:18 +0100)]
driver: char: rpivid: Remove legacy name support

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 years agodrm: Checking of the pitch is only valid for linear formats
Dave Stevenson [Mon, 27 Jan 2020 10:22:44 +0000 (10:22 +0000)]
drm: Checking of the pitch is only valid for linear formats

framebuffer_check was computing a minimum pitch value and ensuring
that the provided value was greater than this.
That check is only valid if the format is linear.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agodt-bindings: display: vc4: hdmi: Add BCM2711 HDMI controllers bindings
Maxime Ripard [Thu, 13 Feb 2020 15:45:24 +0000 (16:45 +0100)]
dt-bindings: display: vc4: hdmi: Add BCM2711 HDMI controllers bindings

The HDMI controllers found in the BCM2711 SoC need some adjustments to the
bindings, especially since the registers have been shuffled around in more
register ranges.

Cc: Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
2 years agodt-bindings: clock: Add a binding for the RPi Firmware clocks
Maxime Ripard [Thu, 13 Feb 2020 16:51:09 +0000 (17:51 +0100)]
dt-bindings: clock: Add a binding for the RPi Firmware clocks

The firmare running on the RPi VideoCore can be used to discover and
change the various clocks running in the BCM2711. Since devices will
need to use them through the DT, let's add a pretty simple binding.

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: linux-clk@vger.kernel.org
Cc: devicetree@vger.kernel.org
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
2 years agostaging: media: Add Raspberry Pi V4L2 H265 decoder
John Cox [Thu, 5 Mar 2020 18:30:41 +0000 (18:30 +0000)]
staging: media: Add Raspberry Pi V4L2 H265 decoder

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: John Cox <jc@kynesim.co.uk>
2 years agomedia: dt-bindings: media: Add binding for the Raspberry PI HEVC decoder
Dave Stevenson [Tue, 17 Mar 2020 10:53:16 +0000 (10:53 +0000)]
media: dt-bindings: media: Add binding for the Raspberry PI HEVC decoder

Adds a binding for the HEVC decoder found on the BCM2711 / Raspberry Pi 4.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agomedia: videodev2.h: Add a format for column YUV4:2:0 modes
Dave Stevenson [Fri, 24 Jan 2020 14:28:21 +0000 (14:28 +0000)]
media: videodev2.h: Add a format for column YUV4:2:0 modes

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: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agomedia: uapi: hevc: Add segment address field
Jernej Skrabec [Fri, 13 Dec 2019 16:04:27 +0000 (17:04 +0100)]
media: uapi: hevc: Add segment address field

From https://patchwork.linuxtv.org/patch/60725/
Changes requested, but mainly docs.

If HEVC frame consists of multiple slices, segment address has to be
known in order to properly decode it.

Add segment address field to slice parameters.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
2 years agomedia: uapi: hevc: Add scaling matrix control
Jernej Skrabec [Fri, 13 Dec 2019 16:04:25 +0000 (17:04 +0100)]
media: uapi: hevc: Add scaling matrix control

Taken from https://patchwork.linuxtv.org/patch/60728/
Changes (mainly documentation) have been requested.

HEVC has a scaling matrix concept. Add support for it.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
2 years agodrm/fourcc: Add packed 10bit YUV 4:2:0 format
Dave Stevenson [Fri, 24 Jan 2020 14:22:06 +0000 (14:22 +0000)]
drm/fourcc: Add packed 10bit YUV 4:2:0 format

Adds a format that is 3 10bit YUV 4:2:0 samples packed into
a 32bit work (with 2 spare bits).

Supported on Broadcom BCM2711 chips.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agobcmgenet: Disable skip_umac_reset by default
popcornmix [Wed, 1 Apr 2020 10:22:44 +0000 (11:22 +0100)]
bcmgenet: Disable skip_umac_reset by default

Possible fixed upstream by 'net: bcmgenet: keep MAC in reset until PHY is up'

Signed-off-by: popcornmix <popcornmix@gmail.com>
2 years agodt-bindings: pci: Add DT docs for Brcmstb PCIe device
Jim Quinlan [Mon, 15 Jan 2018 23:28:39 +0000 (18:28 -0500)]
dt-bindings: pci: Add DT docs for Brcmstb PCIe device

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: Jim Quinlan <jim2101024@gmail.com>
2 years agoof: overlay: Correct symbol path fixups
Phil Elwell [Thu, 6 Feb 2020 12:23:15 +0000 (12:23 +0000)]
of: overlay: Correct symbol path fixups

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: d1651b03c2df ("of: overlay: add overlay symbols to live device tree")

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 years agovideo: fbdev: bcm2708_fb: Use common compat header
Phil Elwell [Mon, 2 Mar 2020 14:42:23 +0000 (14:42 +0000)]
video: fbdev: bcm2708_fb: Use common compat header

The definition of compat_ptr is now common for most platforms, but
requires the inclusion of <linux/compat.h>.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 years agodrivers: char: vcio: Use common compat header
Phil Elwell [Mon, 2 Mar 2020 14:40:19 +0000 (14:40 +0000)]
drivers: char: vcio: Use common compat header

The definition of compat_ptr is now common for most platforms, but
requires the inclusion of <linux/compat.h>.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 years agopinctrl: bcm2835: Remove gpiochip on error
Phil Elwell [Mon, 6 Jan 2020 16:04:30 +0000 (16:04 +0000)]
pinctrl: bcm2835: Remove gpiochip on error

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: 85ae9e512f43 ("pinctrl: bcm2835: switch to GPIOLIB_IRQCHIP")
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
2 years agostaging: vchiq_arm: Give vchiq children DT nodes
Phil Elwell [Mon, 3 Feb 2020 17:30:46 +0000 (17:30 +0000)]
staging: vchiq_arm: Give vchiq children DT nodes

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: Phil Elwell <phil@raspberrypi.com>
2 years agoInitialise rpi-firmware before clk-bcm2835
Luke Hinds [Wed, 22 Jan 2020 16:03:00 +0000 (16:03 +0000)]
Initialise rpi-firmware before clk-bcm2835

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: Luke Hinds <lhinds@redhat.com>
Co-authored-by: Phil Elwell <phil@raspberrypi.org>
2 years agoARM: bcm: Backport BCM2711 support from upstream
Stefan Wahren [Fri, 27 Dec 2019 10:40:56 +0000 (11:40 +0100)]
ARM: bcm: Backport BCM2711 support from upstream

Make the BCM2711 a different machine, but keep it in board_bcm2835.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
2 years agostaging: vchiq: Use the old dma controller for OF config on platform devices
Dave Stevenson [Tue, 18 Jun 2019 11:15:50 +0000 (12:15 +0100)]
staging: vchiq: Use the old dma controller for OF config on platform devices

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: Dave Stevenson <dave.stevenson@raspberrypi.org>
2 years agostaging: vchiq_arm: Set up dma ranges on child devices
Dave Stevenson [Tue, 29 Jan 2019 16:13:25 +0000 (16:13 +0000)]
staging: vchiq_arm: Set up dma ranges on child devices

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: Dave Stevenson <dave.stevenson@raspberrypi.org>
2 years agoclk-bcm2835: Disable v3d clock
popcornmix [Tue, 3 Sep 2019 19:28:00 +0000 (20:28 +0100)]
clk-bcm2835: Disable v3d clock

This is controlled by firmware, see clk-raspberrypi.c

Signed-off-by: popcornmix <popcornmix@gmail.com>
2 years agoclk-raspberrypi: Allow cpufreq driver to also adjust gpu clocks
popcornmix [Mon, 9 Sep 2019 14:49:56 +0000 (15:49 +0100)]
clk-raspberrypi: Allow cpufreq driver to also adjust gpu clocks

For performance/power it is beneficial to adjust gpu clocks with arm clock.
This is how the downstream cpufreq driver works

Signed-off-by: popcornmix <popcornmix@gmail.com>
2 years agov3d_gem: Kick the clock so firmware knows we are using firmware clock interface
popcornmix [Thu, 5 Sep 2019 16:59:14 +0000 (17:59 +0100)]
v3d_gem: Kick the clock so firmware knows we are using firmware clock interface

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: popcornmix <popcornmix@gmail.com>
2 years agov3d_drv: Handle missing clock more gracefully
popcornmix [Fri, 23 Aug 2019 15:34:38 +0000 (16:34 +0100)]
v3d_drv: Handle missing clock more gracefully

Signed-off-by: popcornmix <popcornmix@gmail.com>
2 years agonet:phy:2711 Allow ethernet LED mode to be set via device tree
James Hughes [Thu, 31 Oct 2019 14:39:44 +0000 (14:39 +0000)]
net:phy:2711 Allow ethernet LED mode to be set via device tree

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: James 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.

2 years agostaging: vchiq_arm: Register bcm2835-codec as a platform driver
Dave Stevenson [Wed, 6 Nov 2019 13:57:58 +0000 (13:57 +0000)]
staging: vchiq_arm: Register bcm2835-codec as a platform driver

Following the same pattern as bcm2835-camera and bcm2835-audio,
register the V4L2 codec driver as a platform driver

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agostaging: vchiq_arm: Register vcsm-cma as a platform driver
Dave Stevenson [Wed, 6 Nov 2019 13:57:48 +0000 (13:57 +0000)]
staging: vchiq_arm: Register vcsm-cma as a platform driver

Following the same pattern as bcm2835-camera and bcm2835-audio,
register the vcsm-cma driver as a platform driver

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agodrm/v3d: Plug dma_fence leak
Phil Elwell [Tue, 12 Nov 2019 16:41:21 +0000 (16:41 +0000)]
drm/v3d: Plug dma_fence leak

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: Phil Elwell <phil@raspberrypi.org>
2 years agodrm/v3d: Suppress all but the first MMU error
Phil Elwell [Mon, 11 Nov 2019 20:18:08 +0000 (20:18 +0000)]
drm/v3d: Suppress all but the first MMU error

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: Phil Elwell <phil@raspberrypi.org>
2 years agomedia: i2c: Add a driver for the Infineon IRS1125 depth sensor
Markus Proeller [Thu, 10 Oct 2019 17:12:36 +0000 (19:12 +0200)]
media: i2c: Add a driver for the Infineon IRS1125 depth sensor

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: Markus Proeller <markus.proeller@pieye.org>
2 years agodt-bindings: Add binding for the Infineon IRS1125 sensor
Markus Proeller [Thu, 10 Oct 2019 17:12:08 +0000 (19:12 +0200)]
dt-bindings: Add binding for the Infineon IRS1125 sensor

Adds a binding for the Infineon IRS1125 time-of-flight depth
sensor.

Signed-off-by: Markus Proeller <markus.proeller@pieye.org>
2 years agoRename HDMI ALSA device names, check for enable state
James Hughes [Tue, 24 Sep 2019 17:26:55 +0000 (18:26 +0100)]
Rename HDMI ALSA device names, check for enable state

HDMI Alsa devices renamed to match names used by DRM, to
HDMI 1 and HDMI 2

Check for which HDMI devices are connected and only create
devices for those that are present.

The rename of the devices might cause some backwards compatibility
issues, but since this particular part of the driver needs to be
specifically enabled, I suspect the number of people who will see
the problem will be very small.

Signed-off-by: James Hughes <james.hughes@raspberrypi.org>
2 years agoARM: bcm: Switch board, clk and pinctrl to bcm2711 compatible
Stefan Wahren [Thu, 19 Sep 2019 18:45:30 +0000 (20:45 +0200)]
ARM: bcm: Switch board, clk and pinctrl to bcm2711 compatible

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: Stefan Wahren <wahrenst@gmx.net>
2 years agodrm/v3d: Delete pm_runtime support
Phil Elwell [Wed, 18 Sep 2019 16:22:36 +0000 (17:22 +0100)]
drm/v3d: Delete pm_runtime support

The pm_runtime was blocking changelist submission, so delete it as a
temporary workaround.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
2 years agostaging: bcm2835-camera: Add greyworld AWB mode
Dave Stevenson [Fri, 6 Sep 2019 14:13:06 +0000 (15:13 +0100)]
staging: bcm2835-camera: Add greyworld AWB mode

This is mainly used for the NoIR camera which has no IR
filter and can completely confuse normal AWB presets.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
2 years agov4l2: Add a Greyworld AWB mode.
Dave Stevenson [Fri, 6 Sep 2019 14:04:51 +0000 (15:04 +0100)]
v4l2: Add a Greyworld AWB mode.

Adds a simple greyworld white balance preset, mainly for use
with cameras without an IR filter (eg Raspberry Pi NoIR)

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
2 years agomedia: dt-bindings: Add binding for the Sony IMX219 sensor
Dave Stevenson [Wed, 28 Aug 2019 12:34:30 +0000 (13:34 +0100)]
media: dt-bindings: Add binding for the Sony IMX219 sensor

The IMX219 is an 8MPix CSI2 sensor, supporting 2 or 4 data lanes.
Document the binding for this device.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
2 years agoarch/arm64: Add Revision, Serial, Model to cpuinfo
Phil Elwell [Tue, 3 Sep 2019 17:17:25 +0000 (18:17 +0100)]
arch/arm64: Add Revision, Serial, Model to cpuinfo

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
2 years agoarch/arm: Add model string to cpuinfo
Phil Elwell [Tue, 3 Sep 2019 17:16:56 +0000 (18:16 +0100)]
arch/arm: Add model string to cpuinfo

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
2 years agoconfigs: arm64/bcm2711: Enable V3D
Phil Elwell [Thu, 15 Aug 2019 11:02:34 +0000 (12:02 +0100)]
configs: arm64/bcm2711: Enable V3D

Enable the V3D driver, which depends on BCM2835_POWER.

Originally submitted by GitHub user 'phire' in a slightly different
form.

See: https://github.com/raspberrypi/linux/pull/3063

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
2 years agoxhci: Use more event ring segment table entries
Jonathan Bell [Tue, 13 Aug 2019 14:53:29 +0000 (15:53 +0100)]
xhci: Use more event ring segment table entries

Users have reported log spam created by "Event Ring Full" xHC event
TRBs. These are caused by interrupt latency in conjunction with a very
busy set of devices on the bus. The errors are benign, but throughput
will suffer as the xHC will pause processing of transfers until the
event ring is drained by the kernel. Expand the number of event TRB slots
available by increasing the number of event ring segments in the ERST.

Controllers have a hardware-defined limit as to the number of ERST
entries they can process, so make the actual number in use
min(ERST_MAX_SEGS, hw_max).

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
2 years agonet: bcmgenet: Workaround #2 for Pi4 Ethernet fail
Phil Elwell [Fri, 9 Aug 2019 07:51:43 +0000 (08:51 +0100)]
net: bcmgenet: Workaround #2 for Pi4 Ethernet fail

Some combinations of Pi 4Bs and Ethernet switches don't reliably get a
DCHP-assigned IP address, leaving the unit with a self=assigned 169.254
address. In the failure case, the Pi is left able to receive packets
but not send them, suggesting that the MAC<->PHY link is getting into
a bad state.

It has been found empirically that skipping a reset step by the genet
driver prevents the failures. No downsides have been discovered yet,
and unlike the forced renegotiation it doesn't increase the time to
get an IP address, so the workaround is enabled by default; add

  genet.skip_umac_reset=n

to the command line to disable it.

See: https://github.com/raspberrypi/linux/issues/3108

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
2 years agoAdd HDMI1 facility to the driver.
James Hughes [Tue, 16 Jul 2019 11:18:21 +0000 (12:18 +0100)]
Add HDMI1 facility to the driver.

For generic ALSA, all you need is the bcm2835.h change, but
have also added structures for IEC958 HDMI. Not sure how to
test those.

2 years agohid: usb: Add device quirks for Freeway Airmouse T3 and MX3
Jonathan Bell [Thu, 1 Aug 2019 15:41:20 +0000 (16:41 +0100)]
hid: usb: Add device quirks for Freeway Airmouse T3 and MX3

These wireless mouse/keyboard combo remote control devices specify
multiple "wheel" events in their report descriptors. The wheel events
are incorrectly defined and apparently map to accelerometer data, leading
to spurious mouse scroll events being generated at an extreme rate when
the device is moved.

As a workaround, use HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE to mask
feeding the extra wheel events to the input subsystem.

See: https://github.com/raspberrypi/firmware/issues/1189

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
2 years agodrivers: char: add chardev for mmap'ing the RPiVid control registers
Jonathan Bell [Thu, 9 May 2019 13:30:37 +0000 (14:30 +0100)]
drivers: char: add chardev for mmap'ing the RPiVid control registers

Based on the gpiomem driver, allow mapping of the decoder register
spaces such that userspace can access control/status registers.
This driver is intended for use with a custom ffmpeg backend accelerator
prior to a v4l2 driver being written.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
driver: char: rpivid: Destroy the legacy device on remove

The legacy name support created a new device that was never destroyed.
If the driver was unloaded and reloaded, it failed due to the
device already existing.

Fixes: "75f1d14 driver: char: rpivid - also support legacy name"
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
driver: char: rpivid: Clean up error handling use of ERR_PTR/IS_ERR

The driver used an unnecessary intermediate void* variable so it
only called ERR_PTR once to convert to the error value.

Switch to converting as the error arises to remove these intermediate
variables.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
driver: char: rpivid: Add error handling to the legacy device load

The return value from device_create for the legacy device was never
checked or handled. Add the required error handling.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
driver: char: rpivid: Fix coding style whitespace issues.

Makes checkpatch happier.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
driver: char: rpimem: Add SPDX licence header.

Stops checkpatch complaining.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
driver: char: rpivid: Fix access to freed memory

The error path during probe frees the private memory block, and
then promptly dereferences it to log an error message.

Use the base device instead of the pointer to it in the private
structure.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2 years agodrm/v3d: Clock V3D down when not in use.
Eric Anholt [Thu, 2 May 2019 20:22:53 +0000 (13:22 -0700)]
drm/v3d: Clock V3D down when not in use.

My various attempts at re-enabling runtime PM have failed, so just
crank the clock down when V3D is idle to reduce power consumption.

Signed-off-by: Eric Anholt <eric@anholt.net>
2 years agodrm/v3d: HACK: gut runtime pm for now.
Eric Anholt [Mon, 14 Jan 2019 23:13:17 +0000 (15:13 -0800)]
drm/v3d: HACK: gut runtime pm for now.

Something is still unstable -- on starting a new glxgears from an idle
X11, I get an MMU violation in high addresses.  The CTS also failed
quite quickly.  With this, CTS progresses for an hour before OOMing
(allocating some big buffers when my board only has 600MB available to
Linux)

Signed-off-by: Eric Anholt <eric@anholt.net>
2 years agoclk-bcm2835: Avoid null pointer exception
popcornmix [Tue, 6 Aug 2019 14:23:14 +0000 (15:23 +0100)]
clk-bcm2835: Avoid null pointer exception

clk_desc_array[BCM2835_PLLB] doesn't exist so we dereference null when iterating

Signed-off-by: popcornmix <popcornmix@gmail.com>
2 years agoi2c: bcm2835: Set clock-stretch timeout to 35ms
Phil Elwell [Fri, 12 Jul 2019 14:38:35 +0000 (15:38 +0100)]
i2c: bcm2835: Set clock-stretch timeout to 35ms

The BCM2835 I2C blocks have a register to set the clock-stretch
timeout - how long the device is allowed to hold SCL low - in bus
cycles. The current driver doesn't write to the register, therefore
the default value of 64 cycles is being used for all devices.

Set the timeout to the value recommended for SMBus - 35ms.

See: https://github.com/raspberrypi/linux/issues/3064

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
2 years agodrm/v3d: Hook up the runtime PM ops.
Eric Anholt [Mon, 14 Jan 2019 22:47:57 +0000 (14:47 -0800)]
drm/v3d: Hook up the runtime PM ops.

In translating the runtime PM code from vc4, I missed the ".pm"
assignment to actually connect them up.  Fixes missing MMU setup if
runtime PM resets V3D.

Signed-off-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit ca197699af29baa8236c74c53d4904ca8957ee06)

2 years agodrm/v3d: Skip MMU flush if the device is currently off.
Eric Anholt [Mon, 14 Jan 2019 20:35:43 +0000 (12:35 -0800)]
drm/v3d: Skip MMU flush if the device is currently off.

If it's off, we know it will be reset on poweron, so the MMU won't
have any TLB cached from before this point.  Avoids failed waits for
MMU flush to reply.

Signed-off-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 3ee4e2e0a9e9587eacbb69b067bbc72ab2cdc47b)

2 years agodrm/v3d: Add support for 2711.
Eric Anholt [Fri, 5 Oct 2018 00:22:43 +0000 (17:22 -0700)]
drm/v3d: Add support for 2711.

Signed-off-by: Eric Anholt <eric@anholt.net>
2 years agoarm: bcm2835: Add bcm2838 compatible string.
Phil Elwell [Tue, 11 Jun 2019 16:38:28 +0000 (17:38 +0100)]
arm: bcm2835: Add bcm2838 compatible string.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
2 years agousbhid: call usb_fixup_endpoint after mangling intervals
Jonathan Bell [Tue, 11 Jun 2019 10:42:03 +0000 (11:42 +0100)]
usbhid: call usb_fixup_endpoint after mangling intervals

Lets the mousepoll override mechanism work with xhci.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
2 years agoxhci: implement xhci_fixup_endpoint for interval adjustments
Jonathan Bell [Tue, 11 Jun 2019 10:33:39 +0000 (11:33 +0100)]
xhci: implement xhci_fixup_endpoint for interval adjustments

Must be called in a non-atomic context, after the endpoint
has been registered with the hardware via xhci_add_endpoint
and before the first URB is submitted for the endpoint.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
2 years agousb: add plumbing for updating interrupt endpoint interval state
Jonathan Bell [Tue, 11 Jun 2019 09:55:00 +0000 (10:55 +0100)]
usb: add plumbing for updating interrupt endpoint interval state

xHCI caches device and endpoint data after the interface is configured,
so an explicit command needs to be issued for any device driver wanting
to alter the polling interval of an endpoint.

Add usb_fixup_endpoint() to allow drivers to do this. The fixup must be
called after calculating endpoint bandwidth requirements but before any
URBs are submitted.

If polling intervals are shortened, any bandwidth reservations are no
longer valid but in practice polling intervals are only ever relaxed.

Limit the scope to interrupt transfers for now.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
2 years agoclk: bcm2835: Allow reparenting leaf clocks while they're running.
Eric Anholt [Thu, 2 May 2019 22:24:04 +0000 (15:24 -0700)]
clk: bcm2835: Allow reparenting leaf clocks while they're running.

This falls under the same "we can reprogram glitch-free as long as we
pause generation" rule as updating the div/frac fields.  This can be
used for runtime reclocking of V3D to manage power leakage.

Signed-off-by: Eric Anholt <eric@anholt.net>
2 years agoclk: bcm2835: Add support for setting leaf clock rates while running.
Eric Anholt [Thu, 2 May 2019 22:11:05 +0000 (15:11 -0700)]
clk: bcm2835: Add support for setting leaf clock rates while running.

As long as you wait for !BUSY, you can do glitch-free updates of clock
rate while the clock is running.

Signed-off-by: Eric Anholt <eric@anholt.net>
2 years agosoc: bcm: bcm2835-pm: Add support for 2711.
Eric Anholt [Sat, 12 Jan 2019 01:31:07 +0000 (17:31 -0800)]
soc: bcm: bcm2835-pm: Add support for 2711.

Without the actual power management part any more, there's a lot less
to set up for V3D.  We just need to clear the RSTN field for the power
domain, and expose the reset controller for toggling it again.

This is definitely incomplete -- the old ISP and H264 is in the old
bridge, but since we have no consumers of it I've just done the
minimum to get V3D working.

Signed-off-by: Eric Anholt <eric@anholt.net>
2 years agoclk-bcm2835: Don't wait for pllh lock
Phil Elwell [Wed, 23 Jan 2019 16:11:50 +0000 (16:11 +0000)]
clk-bcm2835: Don't wait for pllh lock

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
2 years agospi: bcm2835: enable shared interrupt support
Martin Sperl [Mon, 13 May 2019 11:05:27 +0000 (11:05 +0000)]
spi: bcm2835: enable shared interrupt support

Add shared interrupt support for this driver.

Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
2 years agonet: genet: enable link energy detect powerdown for external PHYs
Jonathan Bell [Tue, 14 May 2019 16:17:59 +0000 (17:17 +0100)]
net: genet: enable link energy detect powerdown for external PHYs

There are several warts surrounding bcmgenet_mii_probe() as this
function is called from ndo_open, but it's calling registration-type
functions. The probe should be called at probe time and refactored
such that the PHY device data can be extracted to limit the scope
of this flag to Broadcom PHYs.

For now, pass this flag in as it puts our attached PHY into a low-power
state when disconnected.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
2 years agobcmgenet: Better coalescing parameter defaults
Phil Elwell [Wed, 27 Mar 2019 13:45:46 +0000 (13:45 +0000)]
bcmgenet: Better coalescing parameter defaults

Set defaults for TX and RX packet coalescing to be equivalent to:

  # ethtool -C eth0 tx-frames 10
  # ethtool -C eth0 rx-usecs 50

This may be something we want to set via DT parameters in the
future.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
2 years agobcmgenet: constrain max DMA burst length
Jonathan Bell [Wed, 12 Sep 2018 13:44:53 +0000 (14:44 +0100)]
bcmgenet: constrain max DMA burst length

2 years agohwrng: iproc-rng200: Add BCM2838 support
Stefan Wahren [Sat, 4 May 2019 15:06:15 +0000 (17:06 +0200)]
hwrng: iproc-rng200: Add BCM2838 support

The HWRNG on the BCM2838 is compatible to iproc-rng200, so add the
support to this driver instead of bcm2835-rng.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
hwrng: iproc-rng200: Correct SoC name

The Pi 4 SoC is called BCM2711, not BCM2838.

Fixes: "hwrng: iproc-rng200: Add BCM2838 support"

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
2 years agoarm: bcm2835: DMA can only address 1GB
Phil Elwell [Wed, 29 May 2019 14:47:42 +0000 (15:47 +0100)]
arm: bcm2835: DMA can only address 1GB

The legacy peripherals can only address the first gigabyte of RAM, so
ensure that DMA allocations are restricted to that region.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
2 years agoarm: bcm2835: Fix FIQ early ioremap
Phil Elwell [Wed, 20 Feb 2019 08:49:39 +0000 (08:49 +0000)]
arm: bcm2835: Fix FIQ early ioremap

The ioremapping creates mappings within the vmalloc area. The
equivalent early function, create_mapping, now checks that the
requested explicit virtual address is between VMALLOC_START and
VMALLOC_END. As there is no reason to have any correlation between
the physical and virtual addresses, put the required mappings at
VMALLOC_START and above.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
2 years agow1: w1-gpio: Make GPIO an output for strong pullup
Phil Elwell [Wed, 12 Jun 2019 16:15:05 +0000 (17:15 +0100)]
w1: w1-gpio: Make GPIO an output for strong pullup

The logic to drive the data line high to implement a strong pullup
assumed that the pin was already an output - setting a value does
not change an input.

See: https://github.com/raspberrypi/firmware/issues/1143

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
2 years agostaging: mmal-vchiq: Fix memory leak in error path
Dave Stevenson [Thu, 2 May 2019 14:50:01 +0000 (15:50 +0100)]
staging: mmal-vchiq: Fix memory leak in error path

On error, vchiq_mmal_component_init could leave the
event context allocated for ports.
Clean them up in the error path.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
2 years agostaging: mmal-vchiq: Free the event context for control ports
Dave Stevenson [Wed, 1 May 2019 12:27:23 +0000 (13:27 +0100)]
staging: mmal-vchiq: Free the event context for control ports

vchiq_mmal_component_init calls init_event_context for the
control port, but vchiq_mmal_component_finalise didn't free
it, causing a memory leak..

Add the free call.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
2 years agostaging: mmal-vchiq: Update mmal_parameters.h with recently defined params
Dave Stevenson [Mon, 18 Feb 2019 15:52:29 +0000 (15:52 +0000)]
staging: mmal-vchiq: Update mmal_parameters.h with recently defined params

mmal_parameters.h hasn't been updated to reflect additions made
over the last few years. Update it to reflect the currently
supported parameters.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
2 years agostaging: mmal_vchiq: Add in the Bayer encoding formats
Dave Stevenson [Wed, 13 Feb 2019 12:33:29 +0000 (12:33 +0000)]
staging: mmal_vchiq: Add in the Bayer encoding formats

The list of formats was copied before Bayer support was added.
The ISP supports Bayer and is being supported by the bcm2835_codec
driver, so add in the encodings for them.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
2 years agoclk: clk-bcm2835: Use %zd when printing size_t
Dave Stevenson [Thu, 24 Jan 2019 15:09:28 +0000 (15:09 +0000)]
clk: clk-bcm2835: Use %zd when printing size_t

The debug text for how many clocks have been registered
uses "%d" with a size_t. Correct it to "%zd".

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
2 years agostaging: mmal-vchiq: Fix client_component for 64 bit kernel
Dave Stevenson [Tue, 22 Jan 2019 12:04:09 +0000 (12:04 +0000)]
staging: mmal-vchiq: Fix client_component for 64 bit kernel

The MMAL client_component field is used with the event
mechanism to allow the client to identify the component for
which the event is generated.
The field is only 32bits in size, therefore we can't use a
pointer to the component in a 64 bit kernel.

Component handles are already held in an array per VCHI
instance, so use the array index as the client_component handle
to avoid having to create a new IDR for this purpose.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
2 years agomedia: videobuf2: Allow exporting of a struct dmabuf
Dave Stevenson [Mon, 29 Oct 2018 17:57:45 +0000 (17:57 +0000)]
media: videobuf2: Allow exporting of a struct dmabuf

videobuf2 only allowed exporting a dmabuf as a file descriptor,
but there are instances where having the struct dma_buf is
useful within the kernel.

Split the current implementation into two, one step which
exports a struct dma_buf, and the second which converts that
into an fd.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
2 years agostaging: vc04_services: Support sending data to MMAL ports
Dave Stevenson [Mon, 24 Sep 2018 17:26:02 +0000 (18:26 +0100)]
staging: vc04_services: Support sending data to MMAL ports

Add the ability to send data to ports. This only supports
zero copy mode as the required bulk transfer setup calls
are not done.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
2 years agostaging: mmal-vchiq: Add support for event callbacks.
Dave Stevenson [Mon, 24 Sep 2018 17:15:38 +0000 (18:15 +0100)]
staging: mmal-vchiq: Add support for event callbacks.

(Preparation for the codec driver).
The codec uses the event mechanism to report things such as
resolution changes. It is signalled by the cmd field of the buffer
being non-zero.

Add support for passing this information out to the client.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
2 years agostaging: mmal-vchiq: Avoid use of bool in structures
Dave Stevenson [Mon, 29 Oct 2018 16:20:46 +0000 (16:20 +0000)]
staging: mmal-vchiq: Avoid use of bool in structures

Fixes up a checkpatch error "Avoid using bool structure members
because of possible alignment issues".

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
2 years agomedia: tc358743: Return an appropriate colorspace from tc358743_set_fmt
Dave Stevenson [Thu, 22 Nov 2018 17:31:06 +0000 (17:31 +0000)]
media: tc358743: Return an appropriate colorspace from tc358743_set_fmt

When calling tc358743_set_fmt, the code was calling tc358743_get_fmt
to choose a valid format. However that sets the colorspace
based on what was read back from the chip. When you set the format,
then the driver would choose and program the colorspace based
on the format code.

The result was that if you called try or set format for UYVY
when the current format was RGB3 then you would get told sRGB,
and try RGB3 when current was UYVY and you would get told
SMPTE170M.

The value programmed into the chip is determined by this driver,
therefore there is no need to read back the value. Return the
colorspace based on the format set/tried instead.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
2 years agoMAINTAINERS: Add entry for BCM2835 Unicam driver
Dave Stevenson [Wed, 31 Oct 2018 14:59:40 +0000 (14:59 +0000)]
MAINTAINERS: Add entry for BCM2835 Unicam driver

Adds entry for the new BCM2835 Unicam (CSI-2 receiver) driver

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
2 years agodt-bindings: Document BCM283x CSI2/CCP2 receiver
Dave Stevenson [Wed, 31 Oct 2018 14:59:06 +0000 (14:59 +0000)]
dt-bindings: Document BCM283x CSI2/CCP2 receiver

Document the DT bindings for the CSI2/CCP2 receiver peripheral
(known as Unicam) on BCM283x SoCs.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
Acked-by: Rob Herring <robh@kernel.org>
2 years agomedia: videodev2: Add helper defines for printing FOURCCs
Dave Stevenson [Wed, 31 Oct 2018 14:58:08 +0000 (14:58 +0000)]
media: videodev2: Add helper defines for printing FOURCCs

New helper defines that allow printing of a FOURCC using
printf(V4L2_FOURCC_CONV, V4L2_FOURCC_CONV_ARGS(fourcc));

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
2 years agomedia: adv7180: Add YPrPb support for ADV7282M
Dave Stevenson [Wed, 31 Oct 2018 14:57:56 +0000 (14:57 +0000)]
media: adv7180: Add YPrPb support for ADV7282M

The ADV7282M can support YPbPr on AIN1-3, but this was
not selectable from the driver. Add it to the list of
supported input modes.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
2 years agomedia: adv7180: Default to the first valid input
Dave Stevenson [Wed, 31 Oct 2018 14:57:46 +0000 (14:57 +0000)]
media: adv7180: Default to the first valid input

The hardware default is differential CVBS on AIN1 & 2, which
isn't very useful.

Select the first input that is defined as valid for the
chip variant (typically CVBS_AIN1).

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
2 years agomedia: tc358743: Check I2C succeeded during probe.
Dave Stevenson [Wed, 31 Oct 2018 14:57:34 +0000 (14:57 +0000)]
media: tc358743: Check I2C succeeded during probe.

The probe for the TC358743 reads the CHIPID register from
the device and compares it to the expected value of 0.
If the I2C request fails then that also returns 0, so
the driver loads thinking that the device is there.

Generally I2C communications are reliable so there is
limited need to check the return value on every transfer,
therefore only amend the one read during probe to check
for I2C errors.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
2 years agomedia: tc358743: Add support for 972Mbit/s link freq.
Dave Stevenson [Wed, 31 Oct 2018 14:57:21 +0000 (14:57 +0000)]
media: tc358743: Add support for 972Mbit/s link freq.

Adds register setups for running the CSI lanes at 972Mbit/s,
which allows 1080P50 UYVY down 2 lanes.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
2 years agomedia: tc358743: fix connected/active CSI-2 lane reporting
Philipp Zabel [Thu, 21 Sep 2017 15:30:24 +0000 (17:30 +0200)]
media: tc358743: fix connected/active CSI-2 lane reporting

g_mbus_config was supposed to indicate all supported lane numbers, not
only the number of those currently in active use. Since the TC358743
can dynamically reduce the number of active lanes if the required
bandwidth allows for it, report all lane numbers up to the connected
number of lanes as supported in pdata mode.
In device tree mode, do not report lane count and clock mode at all, as
the receiver driver can determine these from the device tree.

To allow communicating the number of currently active lanes, add a new
bitfield to the v4l2_mbus_config flags. This is a temporary fix, to be
used only until a better solution is found.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>