Dom Cobley [Tue, 23 Jun 2020 17:37:01 +0000 (18:37 +0100)]
vc4_hdmi: Set HD_CTL_WHOLSMP and HD_CTL_CHALIGN_SET
Symptom is random switching of speakers when using multichannel.
Repeatedly running speakertest -c8 occasionally starts with
channels jumbled. This is fixed with HD_CTL_WHOLSMP.
The other bit looks beneficial and apears harmless in testing so
I'd suggest adding it too.
Documentation says: HD_CTL_WHILSMP_SET
Wait for whole sample. When this bit is set MAI transmit will start
only when there is at least one whole sample available in the fifo.
Documentation says: HD_CTL_CHALIGN_SET
Channel Align When Overflow. This bit is used to realign the audio
channels in case of an overflow.
If this bit is set, after the detection of an overflow, equal
amount of dummy words to the missing words will be written to fifo,
filling up the broken sample and maintaining alignment.
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
Dave Stevenson [Tue, 19 May 2020 13:54:28 +0000 (14:54 +0100)]
drm/vc4: Adopt the dma configuration from the HVS or V3D component
vc4_drv isn't necessarily under the /soc node in DT as it is a
virtual device, but it is the one that does the allocations.
The DMA addresses are consumed by primarily the HVS or V3D, and
those require VideoCore cache alias address mapping, and so will be
under /soc.
During probe find the a suitable device node for HVS or V3D,
and adopt the DMA configuration of that node.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dom Cobley [Thu, 7 May 2020 17:16:09 +0000 (18:16 +0100)]
vc4_hdmi: Remove cec_available flag as always supported
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
Dom Cobley [Thu, 7 May 2020 17:16:08 +0000 (18:16 +0100)]
vc4_hdmi: Adjust CEC ref clock based on its input clock
2711 uses a fixed 27MHz input, earlier models use the HSM clock
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
Dom Cobley [Thu, 7 May 2020 17:16:08 +0000 (18:16 +0100)]
vc4_hdmi: Make irq shared
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
Dom Cobley [Thu, 7 May 2020 17:16:08 +0000 (18:16 +0100)]
vc4_hdmi_regs: Make interrupt mask variant specific
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
Dom Cobley [Thu, 7 May 2020 17:16:07 +0000 (18:16 +0100)]
vc4_hdmi_regs: Add Intr2 register block
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
Dom Cobley [Thu, 7 May 2020 17:16:07 +0000 (18:16 +0100)]
vc4_hdmi: Fix up CEC registers
Fix an incorrect register address, add a
missing one and reorder into address order
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
Dom Cobley [Thu, 7 May 2020 17:16:07 +0000 (18:16 +0100)]
vc4_hdmi: Fix register offset when sending longer CEC messages
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
popcornmix [Mon, 27 Apr 2020 18:07:50 +0000 (19:07 +0100)]
vc4_hdmi: BCM2835 requires a fixed hsm clock for CEC to work
Signed-off-by: popcornmix <popcornmix@gmail.com>
Dave Stevenson [Thu, 3 Sep 2020 16:09:07 +0000 (17:09 +0100)]
include/firmware: Add enum for RPI_FIRMWARE_FRAMEBUFFER_GET_DISPLAY_ID
Used by audio and FKMS.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
detule [Tue, 2 Oct 2018 08:10:08 +0000 (04:10 -0400)]
vchiq_2835_arm: Implement a DMA pool for small bulk transfers (#2699)
During a bulk transfer we request a DMA allocation to hold the
scatter-gather list. Most of the time, this allocation is small
(<< PAGE_SIZE), however it can be requested at a high enough frequency
to cause fragmentation and/or stress the CMA allocator (think time
spent in compaction here, or during allocations elsewhere).
Implement a pool to serve up small DMA allocations, falling back
to a coherent allocation if the request is greater than
VCHIQ_DMA_POOL_SIZE.
Signed-off-by: Oliver Gjoneski <ogjoneski@gmail.com>
popcornmix [Thu, 3 Sep 2020 13:02:41 +0000 (14:02 +0100)]
dwc_otg: whitelist_table is now productlist_table
popcornmix [Thu, 3 Sep 2020 13:02:21 +0000 (14:02 +0100)]
bcm2835-mmc: uninitialized_var is no more
Dave Stevenson [Tue, 7 Jul 2020 17:29:10 +0000 (18:29 +0100)]
media: i2c: ov9281: Add support for 8 bit readout
The sensor supports 8 bit mode as well as 10bit, so add the
relevant code to allow selection of this.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Fri, 10 Jul 2020 11:40:50 +0000 (12:40 +0100)]
media: i2c: tc358743: Only allow supported pixel fmts in set_fmt
Fix commit "media: tc358743: Return an appropriate colorspace from
tc358743_set_fmt" to ensure that the format passed in to set_fmt
is checked to be valid, and reset to the current format if not.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Thu, 27 Aug 2020 15:30:26 +0000 (16:30 +0100)]
media: bcm2835-unicam: Drop WARN on uing direct cache alias
Pi 0&1 pass all ARM accesses through the VPU L2 cache, therefore
the dma-ranges property sets the cache alias bits to other
than the direct alias, hence this WARN was firing.
It was overprotective coding, so assume that everything is OK
with the dma-ranges, and remove the WARN.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Hristo Venev [Wed, 19 Aug 2020 14:05:53 +0000 (17:05 +0300)]
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: Hristo Venev <hristo@venev.name>
Hristo Venev [Wed, 19 Aug 2020 14:02:22 +0000 (17:02 +0300)]
media: bcm2835: unicam: Select MEDIA_CONTROLLER and VIDEO_V4L2_SUBDEV_API
That is what almost all other drivers appear to be doing.
Signed-off-by: Hristo Venev <hristo@venev.name>
Phil Elwell [Wed, 29 Jul 2020 12:47:55 +0000 (13:47 +0100)]
ARM: proc-v7: Force misalignment of early stmia
In an attempt to prevent the problem of CPUn not starting, explicitly
misalign the scratch space used to save registers acros the cache
invalidation.
Notes:
At this stage in the boot process the core is running with its cache
disabled. Before enabling the cache its contents must be explicitly
invalidated, a process that requires quite a few registers that the
caller must preserve. Evidence suggests that something is writing a
block of zeroes over that space at a time when all other cores should
be idle, possibly some kind of write-combiner, and the misalignment is
designed to disrupt any write-coalescing.
In truth, I don't understand why this patch works, and when the failure
is so random it is hard to be certain that this isn't just rolling the
dice again. One interesting test would be to change the "addeq r12, #4"s
to "addeq r12, #0"s determine see if the offset itself is significant or
just the additional code.
See: https://github.com/Hexxeh/rpi-firmware/issues/232
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Phil Elwell [Wed, 22 Jul 2020 16:59:31 +0000 (17:59 +0100)]
bcm2835-dma: Advertise the full DMA range
Unless the DMA mask is set wider than 32 bits, DMA mapping will use a
bounce buffer.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Phil Elwell [Tue, 21 Jul 2020 16:34:09 +0000 (17:34 +0100)]
staging: vchiq_arm: children inherit DMA config
Although it is no longer necessary for vchiq's children to have a
different DMA configuration to the parent, they do still need to
explicitly to have their DMA configuration set - to be that of the
parent.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Phil Elwell [Mon, 13 Jul 2020 09:33:19 +0000 (10:33 +0100)]
leds: Add the actpwr trigger
The actpwr trigger is a meta trigger that cycles between an inverted
mmc0 and default-on. It is written in a way that could fairly easily
be generalised to support alternative sets of source triggers.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Laurent Pinchart [Fri, 3 Jul 2020 22:45:08 +0000 (01:45 +0300)]
media: i2c: ov5647: Parse and register properties
Parse device properties and register controls for them using the V4L2
fwnode properties helpers.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Naushir Patuck [Mon, 11 May 2020 12:06:27 +0000 (13:06 +0100)]
dt-bindings: bcm2835-unicam: Update documentation with new clock params
Update the documentation to reflect the new "VPU" clock needed
by the bcm2835-unicam driver.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Naushir Patuck [Mon, 11 May 2020 12:02:22 +0000 (13:02 +0100)]
media: bcm2835: unicam: Set VPU min clock freq to 250Mhz.
When streaming with Unicam, the VPU must have a clock frequency of at
least 250Mhz. Otherwise, the input fifos could overrun, causing
image corruption.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Dave Stevenson [Tue, 7 Jul 2020 13:52:43 +0000 (14:52 +0100)]
media: bcm2835-unicam: Ensure type is VIDEO_CAPTURE in [g|s]_selection
[g|s]_selection pass in a buffer type that needs to be validated
before passing on to the sensor subdev.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Tue, 7 Jul 2020 13:23:40 +0000 (14:23 +0100)]
media: bcm2835-unicam: Reinstate V4L2_CAP_READWRITE in the caps
v4l2-compliance throws a failure if the device doesn't advertise
V4L2_CAP_READWRITE but allows read or write operations.
We do support read, so reinstate the flag.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Tue, 7 Jul 2020 10:51:26 +0000 (11:51 +0100)]
media: i2c: imx290: Set the colorspace fields in the format
The colorspace fields were left untouched in imx290_set_fmt
which lead to a v4l2-compliance failure.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Tue, 7 Jul 2020 10:23:48 +0000 (11:23 +0100)]
media: i2c: imx290: Add support for g_selection to report cropping
Userspace needs to know the cropping arrangements for each mode,
so expose this through g_selection.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Tue, 7 Jul 2020 09:31:53 +0000 (10:31 +0100)]
media: i2c: imx290: Explicitly set v&h blank on mode change
__v4l2_ctrl_modify_range only updates the current value should
it be invalid within the new range. That can leave modes producing
odd frame rates.
Explicitly update the HBLANK and VBLANK values so that on mode
change we revert to the default frame rate for the mode.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Mon, 6 Jul 2020 16:51:32 +0000 (17:51 +0100)]
media: i2c: ov9281: Read chip ID via 2 reads
Vision Components have made an OV9281 module which blocks reading
back the majority of registers to comply with NDAs, and in doing
so doesn't allow auto-increment register reading as used when
reading the chip ID.
Use two reads and manually combine the results.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Tue, 14 Apr 2020 15:12:33 +0000 (16:12 +0100)]
media: i2c: ov9281: Fixup for recent kernel releases, and remove custom code
The Rockchip driver was based on a 4.4 kernel, and had several custom
Rockchip parts.
Update to 5.4 kernel APIs, with the relevant controls required by
libcamera, and remove custom Rockchip parts.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Tue, 14 Apr 2020 14:51:50 +0000 (15:51 +0100)]
media: i2c: ov9281: add enum_frame_interval function for iq tool 2.2 and hal3
Adds the ov9281 parts of the Rockchip patch adding enum_frame_interval to
a large number of drivers.
Change-Id: I03344cd6cf278dd7c18fce8e97479089ef185a5c
Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com>
Dave Stevenson [Tue, 14 Apr 2020 14:47:09 +0000 (15:47 +0100)]
media: i2c: ov9281: fix mclk issue when probe multiple camera.
Takes the ov9281 part only from the Rockchip's patch.
Change-Id: I30e833baf2c1bb07d6d87ddb3b00759ab45a90e4
Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com>
Zefa Chen [Fri, 17 May 2019 10:23:03 +0000 (18:23 +0800)]
media: i2c: add ov9281 driver.
Change-Id: I7b77250bbc56d2f861450cf77271ad15f9b88ab1
Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com>
Phil Elwell [Wed, 1 Jul 2020 19:28:27 +0000 (20:28 +0100)]
bcm2835-dma: Add NO_WAIT_RESP flag
Use bit 27 of the dreq value (the second cell of the DT DMA descriptor)
to request that the WAIT_RESP bit is not set.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Dave Stevenson [Wed, 1 Jul 2020 09:57:57 +0000 (10:57 +0100)]
media: bcm2835-unicam: Add support for unpacked 14bit Bayer formats
Now that the 14bit non-packed Bayer formats are defined, add them
into the supported formats lookup table.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Thu, 25 Jun 2020 17:03:47 +0000 (18:03 +0100)]
media: bcm2835-unicam: Add support for 14bit mono sources
Now that V4L2_PIX_FMT_Y14 and V4L2_PIX_FMT_Y14P are defined,
allow passing 14bit mono data through the peripheral.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Thu, 25 Jun 2020 16:53:32 +0000 (17:53 +0100)]
media: bcm2835-unicam: Add support for 12bit mono packed format
Now that V4L2_PIX_FMT_Y12P is defined, allow passing raw 12bit
mono packed data through the peripheral.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Thu, 25 Jun 2020 16:51:03 +0000 (17:51 +0100)]
media: Add a pixel format for MIPI packed 14bit luma only.
This is the format used by monochrome 14bit image sensors.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Thu, 7 May 2020 15:59:03 +0000 (16:59 +0100)]
media: Add a pixel format for MIPI packed 12bit luma only.
This is the format used by monochrome 12bit image sensors.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Phil Elwell [Thu, 2 Jul 2020 12:53:20 +0000 (13:53 +0100)]
serial: 8250: bcm2835aux - defer if clock is zero
See: https://github.com/raspberrypi/linux/issues/3700
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Dave Stevenson [Fri, 26 Jun 2020 17:11:49 +0000 (18:11 +0100)]
media: i2c: imx290: Switch set_hmax to use imx290_write_buffered_reg
imx290_set_hmax was using two independent writes to set up hmax,
when all other multi-register writes were using imx290_write_buffered_reg
which claims the group hold first.
Switch imx290_set_hmax to using imx290_write_buffered_reg too.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Thu, 25 Jun 2020 16:03:11 +0000 (17:03 +0100)]
media : i2c: imx290: Add support for the mono sensor variant.
The IMX290 module is available as either mono or colour (Bayer).
Update the driver so that it can advertise the correct mono
formats instead of the colour ones.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Thu, 25 Jun 2020 15:52:14 +0000 (16:52 +0100)]
media: dt-bindings: media: i2c: Add mono version to IMX290 bindings
The IMX290 module is available as either monochrome or colour and
the variant is not detectable at runtime.
Add a new compatible string for the monochrome version.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Thu, 11 Jun 2020 17:34:16 +0000 (18:34 +0100)]
media: i2c: imx290: Add H and V flip controls
The sensor supports horizontal and vertical flips, so support them
through V4L2_CID_HFLIP and V4L2_CID_VFLIP.
This sensor does NOT change the Bayer order when changing the
direction of readout, therefore no special handling is required for
that.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Thu, 11 Jun 2020 17:19:13 +0000 (18:19 +0100)]
media: i2c: imx290: Add exposure control to the driver.
Adds support for V4L2_CID_EXPOSURE so that userspace can control
the sensor exposure time.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Thu, 11 Jun 2020 17:09:12 +0000 (18:09 +0100)]
media: i2c: imx290: Add support for V4L2_CID_VBLANK
In order to calculate framerate and durations userspace needs
the vertical blanking information. This can be configurable,
and indeed the datasheet lists different values for VBLANK for
the 1080p and 720p modes.
Add the new control, and adopt the datasheet values for each mode.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Thu, 11 Jun 2020 13:36:40 +0000 (14:36 +0100)]
media: i2c: imx290: Convert HMAX setting into V4L2_CID_HBLANK
Userspace needs to know HBLANK if it is to work out exposure times
and frame rates, therefore convert it to map onto V4L2_CID_HBLANK
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Thu, 11 Jun 2020 12:41:43 +0000 (13:41 +0100)]
media: i2c: imx290: Correct range for V4L2_CID_GAIN to 0-238
The datasheet lists the gain as being 0.0 to 72.0dB in 0.3dB steps, which
makes 238 steps total.
Correct the 0-72 range defined in the driver.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Thu, 25 Jun 2020 07:28:51 +0000 (08:28 +0100)]
media: i2c: imx290: Add support for 74.25MHz clock
The existing driver only supported a clock of 37.125MHz, but the
sensor also supports 74.25MHz.
Add the relevant register modifications to support this alternate
clock frequency.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Andrey Konovalov [Fri, 12 Jun 2020 13:53:46 +0000 (15:53 +0200)]
media: i2c: imx290: set the format before VIDIOC_SUBDEV_G_FMT is called
Commit
d46cfdc86c30d5ec768924f0b1e2683c8d20b671 upstream.
With the current driver 'media-ctl -p' issued right after the imx290 driver
is loaded prints:
pad0: Source
[fmt:unknown/0x0]
The format value of zero is due to the current_format field of the imx290
struct not being initialized yet.
As imx290_entity_init_cfg() calls imx290_set_fmt(), the current_mode field
is also initialized, so the line which set current_mode to a default value
in driver's probe() function is no longer needed.
Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Dave Stevenson [Fri, 26 Jun 2020 14:53:44 +0000 (15:53 +0100)]
media: bcm2835-unicam: Avoid gcc warning over {0} on endpoint
Older gcc versions object to = { 0 } initialisation if the first
elemtn in the structure is a substructure.
Use = { } to avoid this compiler warning.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Tue, 23 Jun 2020 13:32:51 +0000 (14:32 +0100)]
media: bcm2835-unicam: Add support for get_mbus_config to set num lanes
Use the get_mbus_config pad subdev call to allow a source to use
fewer than the number of CSI2 lanes defined in device tree.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Naushir Patuck [Mon, 4 May 2020 09:25:41 +0000 (12:25 +0300)]
media: bcm2835-unicam: Driver for CCP2/CSI2 camera interface
Add a driver for the Unicam camera receiver block on BCM283x processors.
Compared to the bcm2835-camera driver present in staging, this driver
handles the Unicam block only (CSI-2 receiver), and doesn't depend on
the VC4 firmware running on the VPU.
The commit is made up of a series of changes cherry-picked from the
rpi-5.4.y branch of https://github.com/raspberrypi/linux/ with
additional enhancements, forward-ported to the mainline kernel.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reported-by: kbuild test robot <lkp@intel.com>
Dave Stevenson [Tue, 23 Jun 2020 09:05:57 +0000 (10:05 +0100)]
drivers: media: Remove the downstream version of bcm2835-unicam
About to be replaced by the upstream version.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Phil Elwell [Fri, 26 Jun 2020 10:51:05 +0000 (11:51 +0100)]
brcmfmac: Prefer a ccode from OTP over nvram file
Allow the nvram file to set a default ccode (regulatory domain) without
overriding one set in OTP.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Maxim Mikityanskiy [Sat, 20 Jun 2020 12:40:00 +0000 (15:40 +0300)]
staging: bcm2835-audio: Add missing MODULE_ALIAS
Commit
8353fe6f1e0f ("Revert "staging: bcm2835-audio: Drop DT
dependency"") reverts the upstream change and makes bcm2835-audio use
device tree again, however, it also removes the MODULE_ALIAS for the
platform device. This MODULE_ALIAS is needed, because VCHIQ registers
bcm2835-audio as a child platform device since commit
25c7597af20d
("staging: vchiq_arm: Register a platform device for audio"), and this
mechanism is adopted also in the downstream kernel.
This commit puts back that MODULE_ALIAS to make bcm2835-audio
autoprobing work again. The rest of VCHIQ children have their
MODULE_ALIASes in place.
Fixes:
8353fe6f1e0f ("Revert "staging: bcm2835-audio: Drop DT dependency"")
Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
Markus Proeller [Tue, 16 Jun 2020 11:33:56 +0000 (13:33 +0200)]
media: irs1125: Keep HW in sync after imager reset
When closing the video device, the irs1125 is put in power down state.
To keep V4L2 ctrls and the HW in sync, v4l2_ctrl_handler_setup is
called after power up.
The compound ctrl IRS1125_CID_MOD_PLL however has a default value
of all zeros, which puts the imager into a non responding state.
Thus, this ctrl is not written by the driver into HW after power up.
The userspace has to take care to write senseful data.
Signed-off-by: Markus Proeller <markus.proeller@pieye.org>
Markus Proeller [Tue, 16 Jun 2020 11:31:36 +0000 (13:31 +0200)]
media: irs1125: Atomic access to imager reconfiguration
Instead of changing the exposure and framerate settings for all sequences,
they can be changed for every sequence individually now. Therefore the
IRS1125_CID_SAFE_RECONFIG ctrl has been removed and replaced by
IRS1125_CID_SAFE_RECONFIG_S<seq_num>_EXPO and *_FRAME ctrls.
The consistency check in the sequence ctrl IRS1125_CID_SEQ_CONFIG
is removed.
Signed-off-by: Markus Proeller <markus.proeller@pieye.org>
Markus Proeller [Tue, 16 Jun 2020 11:27:42 +0000 (13:27 +0200)]
media: irs1125: Refactoring and debug messages
Changed some variable names to comply with checkpatch --strict mode.
Debug messages added.
Signed-off-by: Markus Proeller <markus.proeller@pieye.org>
Markus Proeller [Tue, 16 Jun 2020 11:24:31 +0000 (13:24 +0200)]
media: irs1125: Using i2c_transfer for ic2 reads
Reading data over i2c is done by using i2c_transfer to ensure that this
operation can't be interrupted.
Signed-off-by: Markus Proeller <markus.proeller@pieye.org>
Phil Elwell [Thu, 11 Jun 2020 08:57:03 +0000 (09:57 +0100)]
PCI: brcmstb: Add DT property to control L1SS
The BRCM PCIe block has controls to enable control of the CLKREQ#
signal by the L1SS, and to gate the refclk with the CLKREQ# input.
These controls are mutually exclusive - the upstream code sets the
latter, but some use cases require the former.
Add a Device Tree property - brcm,enable-l1ss - to switch to the
L1SS configuration.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Phil Elwell [Tue, 24 Apr 2018 13:42:27 +0000 (14:42 +0100)]
gpiolib: Don't prevent IRQ usage of output GPIOs
Upstream Linux deems using output GPIOs to generate IRQs as a bogus
use case, even though the BCM2835 GPIO controller is capable of doing
so. A number of users would like to make use of this facility, so
disable the checks.
See: https://github.com/raspberrypi/linux/issues/2527
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
Hristo Venev [Fri, 5 Jun 2020 09:22:49 +0000 (09:22 +0000)]
snd_bcm2835: disable HDMI audio when vc4 is used (#3640)
Things don't work too well when both the vc4 driver and the firmware
driver are trying to control the same audio output:
[ 763.569406] bcm2835_audio bcm2835_audio: vchi message timeout, msg=5
Hence, when the vc4 HDMI driver is used, let it control audio. This is done
by introducing a new device tree property to the audio node, and
extending the vc4-kms-v3d overlays to set it appropriately.
Signed-off-by: Hristo Venev <hristo@venev.name>
Phil Elwell [Tue, 19 May 2020 08:46:12 +0000 (09:46 +0100)]
brcmfmac: BCM43436 needs dedicated firmware
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
David Plowman [Thu, 28 May 2020 10:09:48 +0000 (11:09 +0100)]
media: bcm2835-unicam: change minimum number of vb2_queue buffers to 1
Since the unicam driver was modified to write to a dummy buffer when no
user-supplied buffer is available, it can now write to and return a
buffer even when there's only a single one. Enable this by changing the
min_buffers_needed in the vb2_queue; it will be useful for enabling
still captures without allocating more memory than absolutely necessary.
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Phil Elwell [Wed, 20 May 2020 15:36:33 +0000 (16:36 +0100)]
staging: vchiq_arm: Clean up 40-bit DMA support
Manage the split between addresses for the VPU and addresses for the
40-bit DMA controller with a dedicated DMA device pointer that on non-
BCM2711 platforms is the same as the main VCHIQ device. This allows
the VCHIQ node to stay in the usual place in the DT, and removes the
ugly VC_SAFE macros.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
staging: vchiq_arm: Use g_dma_dev for dma_unmap_sg
Commit "staging: vchiq_arm: Clean up 40-bit DMA support" failed to
change one of the calls to dma_unmap_sg to pass in g_dma_dev (rather
than g_dev). Correct that oversight.
See: https://github.com/raspberrypi/linux/issues/3647
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Phil Elwell [Fri, 22 May 2020 10:35:33 +0000 (11:35 +0100)]
SQUASH: pinctrl: bcm2835: Set base for bcm2711 GPIO to 0
Without this patch GPIOs don't seem to work properly, primarily
noticeable as broken LEDs.
Squash with "pinctrl-bcm2835: Set base to 0 give expected gpio numbering"
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Phil Elwell [Tue, 5 May 2020 14:23:32 +0000 (15:23 +0100)]
zswap: Defer zswap initialisation
Enabling zswap support in the kernel configuration costs about 1.5MB
of RAM, even when zswap is not enabled at runtime. This cost can be
reduced significantly by deferring initialisation (including pool
creation) until the "enabled" parameter is set to true. There is a
small cost to this in that some initialisation code has to remain in
memory after the init phase, just in case they are needed later,
but the total size increase is negligible.
See: https://github.com/raspberrypi/linux/pull/3432
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Dave Stevenson [Tue, 19 May 2020 10:46:47 +0000 (11:46 +0100)]
media: bcm2835-unicam: Retain packing information on G_FMT
The change to retrieve the pixel format always on g_fmt didn't
check whether the native or unpacked version of the format
had been requested, and always returned the packed one.
Correct this so that the packing setting is retained whereever
possible.
Fixes "9d59e89 media: bcm2835-unicam: Re-fetch mbus code from subdev
on a g_fmt call"
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Phil Elwell [Wed, 8 Apr 2020 14:23:56 +0000 (15:23 +0100)]
kbuild: Disable gcc plugins
The GCC plugin feature leads to different kernel configurations on what
ought to be equivalent build systems because they depend on the build
hosts native compilers rather than the cross compilers needed for the
target. This causes problems with module symbol version mismatches.
Disable GCC plugins for all build hosts.
Advanced build script hackery borrowed from a patch by milhouse.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Dave Stevenson [Fri, 15 May 2020 12:48:59 +0000 (13:48 +0100)]
staging:vc04_services: bcm2835-camera: Request headers with I-frame
V4L2 wishes to have the codec header bytes in the same buffer as the
first encoded frame, so it does become 1-in 1-out for encoding.
The firmware now has an option to do this, so enable it.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Fri, 15 May 2020 12:42:10 +0000 (13:42 +0100)]
staging: vc04_services: mmal-vchiq: Update parameters list
Adds in a couple of new MMAL parameter defines.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Phil Elwell [Wed, 13 May 2020 19:10:15 +0000 (20:10 +0100)]
sc16is7xx: Fix for hardware flow control
The SC16IS7XX hardware flow control is mishandled by the driver in
a number of ways:
1. The set_baud method accidentally clears it when setting EFR bit.
2. Even though hardware flow control is enabled, it isn't indicated
back to the serial framework.
3. Applying the flow control clears the EFR bit.
4. The CTS support is not indicated in the return from
sc16is7xx_get_mctrl.
Address all of those issues using a mixture of patches found on the
linked pages.
See: https://github.com/raspberrypi/linux/issues/2542
See: https://www.spinics.net/lists/linux-serial/msg21794.html
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Dave Stevenson [Wed, 13 May 2020 17:28:27 +0000 (18:28 +0100)]
media: bcm2835-unicam: Always service interrupts
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.
The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.
https://github.com/raspberrypi/linux/issues/3602
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Naushir Patuck [Thu, 7 May 2020 14:50:54 +0000 (15:50 +0100)]
dt-bindings: media: i2c: Add IMX477 CMOS sensor binding
Add YAML device tree binding for IMX477 CMOS image sensor.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Phil Elwell [Tue, 5 May 2020 18:45:41 +0000 (19:45 +0100)]
video: bcm2708_fb: Disable FB if no displays found
If the firmware hasn't detected a display, the driver would assume
one display was available, but because it had failed to retrieve the
display size it would try to allocate a zero-sized buffer.
Avoid the allocation failure by bailing out early if no display is
found.
See: https://github.com/raspberrypi/linux/issues/3598
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Jacko Dirks [Tue, 5 May 2020 12:33:31 +0000 (14:33 +0200)]
media: bcm2835: unicam: Fix uninitialized warning
Signed-off-by: Jacko Dirks <jdirks.linuxdev@gmail.com>
Jacko Dirks [Tue, 5 May 2020 12:28:14 +0000 (14:28 +0200)]
media: i2c: tc358743: Fix fallthrough warning
Signed-off-by: Jacko Dirks <jdirks.linuxdev@gmail.com>
Dave Stevenson [Thu, 30 Apr 2020 08:52:50 +0000 (09:52 +0100)]
media: bcm2835-unicam: Fix reference counting in unicam_open
The reference counting of node->open was only incremented after
a check that the node was v4l2_fh_is_singular_file, which resulted
in the counting going wrong and s_power not being called at an
appropriate time.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 29 Apr 2020 21:05:09 +0000 (22:05 +0100)]
media: bcm2835-unicam: Do not stop streaming in unicam_release
unicam_release calls _vb2_fop_release, which will call stop_streaming
if that particular node was streaming. Calling it unconditionally (as
the code was) means that if a second handle was opened eg to alter
a setting, on closing that connection it also stopped Unicam.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 29 Apr 2020 15:45:02 +0000 (16:45 +0100)]
media: bcm2835-unicam: Add support for VIDIOC_[S|G]_SELECTION
Sensors are now reflecting cropping and scaling parameters through
the selection API, therefore Unicam needs to forward the requests
through to the subdev.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Thu, 30 Apr 2020 10:03:00 +0000 (11:03 +0100)]
media: i2c: ov5647: Advertise the correct exposure range
Exposure is clipped by the VTS of the mode, so needs to be updated as
and when this is changed.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 29 Apr 2020 21:11:01 +0000 (22:11 +0100)]
media: i2c: ov5647: Use member names in mode tables
To make adding new members to the mode structures easier, use
the member names in the initialisers.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 29 Apr 2020 20:47:25 +0000 (21:47 +0100)]
media: i2c: ov5647: Neither analogue gain nor exposure need EXECUTE_ON_WRITE
The controls for analogue gain and exposure were defined with
V4L2_CTRL_FLAG_EXECUTE_ON_WRITE. This is not required as we only need
to send changes to the sensor.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 29 Apr 2020 20:39:58 +0000 (21:39 +0100)]
media: i2c: ov5647: Add support for V4L2_CID_VBLANK
Adds vblank control to allow for frame rate control.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 29 Apr 2020 16:25:56 +0000 (17:25 +0100)]
media: i2c: ov5647: Set V4L2_SUBDEV_FL_HAS_EVENTS flag
The ov5647 subdev can generate control events, therefore set
the V4L2_SUBDEV_FL_HAS_EVENTS flag.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 29 Apr 2020 11:25:13 +0000 (12:25 +0100)]
media: i2c: ov5647: Support V4L2_CID_PIXEL_RATE
Clients need to know the pixel rate in order to compute exposure
and frame rate values.
Advertise it.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 29 Apr 2020 10:50:52 +0000 (11:50 +0100)]
media: i2c: ov5467: Fixup error path to release mutex
"87f3ab9 media: ov5647: Add basic support for multiple sensor modes."
added a return path ov5647_set_fmt that didn't release the device
mutex that it had claimed.
Release the mutex.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 29 Apr 2020 10:46:07 +0000 (11:46 +0100)]
media: i2c: ov5647: Add support for g_selection to reflect cropping/binning
In order to apply lens shading correctly the client needs to know how
each mode crops or scales the image compared to the full sensor array.
Implement this (based on the imx219 equivalent).
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
David Plowman [Wed, 29 Jan 2020 15:31:32 +0000 (15:31 +0000)]
media: ov5647: change defaults to better match raw camera applications.
Specifically:
* AWB is now off by default.
* AEC/AGC is also off by default.
* The default mode is changed to the 10-bit 2x2 binned mode.
AWB and AEC/AGC can be re-enabled using the usual V4L2 controls. The
original 8-bit mode will be respected if an application requests the
8-bit format.
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
David Plowman [Wed, 29 Jan 2020 15:31:28 +0000 (15:31 +0000)]
media: ov5647: Add extra 10-bit sensor modes.
The 8-bit VGA mode remains, we add the following 10-bit modes:
Mode 0: 2592x1944 full resolution.
Mode 1: 1920x1080 full resolution, but centre-cropped.
(This mode achieves 30fps, mode 0 does not.)
Mode 2: 1296x972 full field-of-view 2x2 binned mode.
Mode 3: VGA full field of view mode.
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
David Plowman [Wed, 29 Jan 2020 15:31:23 +0000 (15:31 +0000)]
media: ov5647: Add V4L2 controls for analogue gain, exposure and AWB
Added basic v4l2_ctrl_handler infrastructure (there was none
previously).
Added controls to let AWB/AEC/AGC run in the sensor's auto mode or
manually. Also controls to set exposure (in lines) and analogue gain
(as a register code) from user code.
Also delete registers (just the one) from the VGA mode register set
that are now controlled by the new V4L2 controls.
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
David Plowman [Wed, 29 Jan 2020 15:30:53 +0000 (15:30 +0000)]
media: ov5647: Add basic support for multiple sensor modes.
Specifically:
Added a structure ov5647_mode and a list of supported_modes (though no
actual new modes as yet). The state object points to the "current mode".
ov5647_enum_mbus_code, ov5647_enum_frame_size, ov5647_set_fmt and
ov5647_get_fmt all needed upgrading to cope with multiple modes.
__sensor_init (which writes all the registers) is now called by
ov5647_stream_on (once the mode is known) rather than by
ov5647_sensor_power.
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
David Plowman [Wed, 15 Jan 2020 13:40:38 +0000 (13:40 +0000)]
media: ov5647: Fix return codes from ov5647_write/ov5647_read functions.
Previously they were returning positive non-zero codes for success,
which were getting passed up the call stack. Since release 4.19,
do_dentry_open (fs/open.c) has been catching these and flagging an
error. (So this driver has been broken since that date.)
Fixes: 3c2472a [media] media: i2c: Add support for OV5647 sensor
Signed-off-by: David Plowman <david.plowman@raspberrypi.org>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Dave Stevenson [Mon, 20 Apr 2020 10:01:21 +0000 (11:01 +0100)]
media: i2c: imx219: Declare that the driver can create events
The flag V4L2_SUBDEV_FL_HAS_EVENTS is required if the subdev can
generate events. It can create events from the ctrl handler, therefore
this is required.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Phil Elwell [Fri, 1 May 2020 16:56:13 +0000 (17:56 +0100)]
overlays: Make the i2c-gpio overlay safe again
Like many overlays, the i2c-gpio overlay goes to efforts to avoid
generating warnings about #address-cells and #size-cells not
being defined, which it does by defining them. Unfortunately this
is fatal if they don't match what the system requires, and the
recent switch to #size-cells = 2 on 2711 made i2c-gpio very
dangerous.
In the absence of the knowledge of a clean way to fix this, just delete
the declarations and suffer the warnings.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Phil Elwell [Thu, 4 Apr 2019 12:33:47 +0000 (13:33 +0100)]
bcm2835-dma: Add proper 40-bit DMA support
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: Phil Elwell <phil@raspberrypi.org>