platform/kernel/linux-rpi.git
4 years agoPCI: brcmstb: Add Broadcom STB PCIe host controller driver
Phil Elwell [Tue, 19 Feb 2019 22:06:59 +0000 (22:06 +0000)]
PCI: brcmstb: Add Broadcom STB PCIe host controller driver

This commit adds the basic Broadcom STB PCIe controller.  Missing is
the ability to process MSI and also handle dma-ranges for inbound
memory accesses.  These two functionalities are added in subsequent
commits.

The PCIe block contains an MDIO interface.  This is a local interface
only accessible by the PCIe controller.  It cannot be used or shared
by any other HW.  As such, the small amount of code for this
controller is included in this driver as there is little upside to put
it elsewhere.

Signed-off-by: Jim Quinlan <jim2101024@gmail.com>
4 years agoFix copy_from_user if BCM2835_FAST_MEMCPY=n
Tim Gover [Thu, 14 Mar 2019 10:16:02 +0000 (10:16 +0000)]
Fix copy_from_user if BCM2835_FAST_MEMCPY=n

The change which introduced CONFIG_BCM2835_FAST_MEMCPY unconditionally
changed the behaviour of arm_copy_from_user. The page pinning code
is not safe on ARMv7 if LPAE & high memory is enabled and causes
crashes which look like PTE corruption.

Make __copy_from_user_memcpy conditional on CONFIG_2835_FAST_MEMCPY=y
which is really an ARMv6 / Pi1 optimization and not necessary on newer
ARM processors.

4 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>
4 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>
4 years agostaging: bcm2835-codec: Add support for setting S_PARM and G_PARM
Dave Stevenson [Fri, 10 May 2019 13:13:11 +0000 (14:13 +0100)]
staging: bcm2835-codec: Add support for setting S_PARM and G_PARM

Video encode can use the frame rate for rate control calculations,
therefore plumb it through from V4L2's [S|G]_PARM ioctl.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agostaging: bcm2835-codec: Convert V4L2 nsec timestamps to MMAL usec
Dave Stevenson [Fri, 10 May 2019 13:11:58 +0000 (14:11 +0100)]
staging: bcm2835-codec: Convert V4L2 nsec timestamps to MMAL usec

V4L2 uses nsecs, whilst MMAL uses usecs, but the code wasn't converting
between them. This upsets video encode rate control.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agoBluetooth: Check key sizes only when Secure Simple Pairing is enabled
Marcel Holtmann [Wed, 22 May 2019 07:05:40 +0000 (09:05 +0200)]
Bluetooth: Check key sizes only when Secure Simple Pairing is enabled

The encryption is only mandatory to be enforced when both sides are using
Secure Simple Pairing and this means the key size check makes only sense
in that case.

On legacy Bluetooth 2.0 and earlier devices like mice the encryption was
optional and thus causing an issue if the key size check is not bound to
using Secure Simple Pairing.

Fixes: d5bb334a8e17 ("Bluetooth: Align minimum encryption key size for LE and BR/EDR connections")
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Cc: stable@vger.kernel.org
4 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>
4 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>
4 years agostaging: bcm2835-codec: Remove height padding for ISP role
Dave Stevenson [Thu, 2 May 2019 13:32:21 +0000 (14:32 +0100)]
staging: bcm2835-codec: Remove height padding for ISP role

The ISP has no need for heights to be a multiple of macroblock
sizes, therefore doesn't require the align on the height.
Remove it for the ISP role. (It is required for the codecs).

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agostaging: bcm2835-codec: Correct port width calc for truncation
Dave Stevenson [Thu, 2 May 2019 13:30:24 +0000 (14:30 +0100)]
staging: bcm2835-codec: Correct port width calc for truncation

The calculation converting from V4L2 bytesperline to MMAL
width had an operator ordering issue that lead to Bayer raw 10
(and 12 and 14) setting an incorrect stride for the buffer.
Correct this operation ordering issue.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agostaging: bcm2835-codec: Refactor default resolution code
Dave Stevenson [Wed, 20 Mar 2019 10:06:51 +0000 (10:06 +0000)]
staging: bcm2835-codec: Refactor default resolution code

The default resolution code was different for each role
as compressed formats need to pass bytesperline as 0 and
set up customised buffer sizes.
This is common setup, therefore amend get_sizeimage and
get_bytesperline to do the correct thing whether compressed
or uncompressed.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agostaging: bcm2835_codec: Clean up logging on unloading the driver
Dave Stevenson [Fri, 8 Mar 2019 11:26:00 +0000 (11:26 +0000)]
staging: bcm2835_codec: Clean up logging on unloading the driver

The log line was missing a closing \n, so wasn't added to the
log immediately.
Adds the function of the V4L2 device that is being unregistered
too.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agostaging: bcm2835-codec: NULL component handle on queue_setup failure
Dave Stevenson [Tue, 19 Mar 2019 17:55:09 +0000 (17:55 +0000)]
staging: bcm2835-codec: NULL component handle on queue_setup failure

queue_setup tries creating the relevant MMAL component and configures
the input and output ports as we're expecting to start streaming.
If the port configuration failed then it destroyed the component,
but failed to clear the component handle, therefore release tried
destroying the component again.
Adds some logging should the port config fail as well.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agostaging: bcm2835_codec: Include timing info in SPS headers
Dave Stevenson [Mon, 18 Feb 2019 15:56:42 +0000 (15:56 +0000)]
staging: bcm2835_codec: Include timing info in SPS headers

Inserting timing information into the VUI block of the SPS is
optional with the VPU encoder.
GStreamer appears to require them when using V4L2 M2M, therefore
set the option to enable them from the encoder.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 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>
4 years agostaging: bcm2835_codec: Fix handling of VB2_MEMORY_DMABUF buffers
Dave Stevenson [Fri, 15 Feb 2019 11:38:45 +0000 (11:38 +0000)]
staging: bcm2835_codec: Fix handling of VB2_MEMORY_DMABUF buffers

If the queue is configured as VB2_MEMORY_DMABUF then vb2_core_expbuf
fails as it ensures the queue is defined as VB2_MEMORY_MMAP.

Correct the handling so that we unmap the buffer from vcsm and the
VPU on cleanup, and then correctly get the dma buf of the new buffer.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agostaging: bcm2835_codec: Add an option for ignoring Bayer formats.
Dave Stevenson [Fri, 15 Feb 2019 11:36:14 +0000 (11:36 +0000)]
staging: bcm2835_codec: Add an option for ignoring Bayer formats.

This is a workaround for GStreamer currently not identifying Bayer
as a raw format, therefore any device that supports it does not
match the criteria for v4l2convert.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agostaging: bcm2835_codec: Add support for the ISP as an M2M device
Dave Stevenson [Wed, 13 Feb 2019 14:07:52 +0000 (14:07 +0000)]
staging: bcm2835_codec: Add support for the ISP as an M2M device

The MMAL ISP component can also use this same V4L2 wrapper to
provide a M2M format conversion and resizer.
Instantiate 3 V4L2 devices now, one for each of decode, encode,
and isp.
The ISP currently doesn't expose any controls via V4L2, but this
can be extended in the future.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agostaging: bcm2835_codec: Query supported formats from the component
Dave Stevenson [Wed, 13 Feb 2019 13:44:00 +0000 (13:44 +0000)]
staging: bcm2835_codec: Query supported formats from the component

The driver was previously working with hard coded tables of
which video formats were supported by each component.
The components advertise this information via a MMAL parameter,
so retrieve the information from there during probe, and store
in the state structure for that device.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agostaging: mmal-vchiq: If the VPU returns an error, don't negate it
Dave Stevenson [Wed, 13 Feb 2019 12:51:03 +0000 (12:51 +0000)]
staging: mmal-vchiq: If the VPU returns an error, don't negate it

There is an enum for the errors that the VPU can return.
port_parameter_get was negating that value, but also using -EINVAL
from the Linux error codes.
Pass the VPU error code as positive values. Should the function
need to pass a Linux failure, then return that as negative.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agostaging: mmal-vchiq: Always return the param size from param_get
Dave Stevenson [Wed, 13 Feb 2019 12:36:56 +0000 (12:36 +0000)]
staging: mmal-vchiq: Always return the param size from param_get

mmal-vchiq is a reimplementation of the userland library for MMAL.
When getting a parameter, the client provides the storage and
the size of the storage. The VPU then returns the size of the
parameter that it wished to return, and as much as possible of
that parameter is returned to the client.

The implementation previously only returned the size provided
by the VPU should it exceed the buffer size. So for parameters
such as the supported encodings list the client had no idea
how much of the provided storage had been populated.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 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>
4 years agostaging: bcm2835-codec: Fix potentially uninitialised vars
Dave Stevenson [Thu, 24 Jan 2019 16:36:19 +0000 (16:36 +0000)]
staging: bcm2835-codec: Fix potentially uninitialised vars

src_m2m_buf and dst_m2m_buf were printed in log messages
when there are code paths that don't initialise them.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agostaging: bcm2835-codec: variable vb2 may be used uninitialised
Dave Stevenson [Thu, 24 Jan 2019 16:40:01 +0000 (16:40 +0000)]
staging: bcm2835-codec: variable vb2 may be used uninitialised

In op_buffer_cb, the failure path checked whether there was
an associated vb2 buffer before the variable vb2 had been
assigned.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agomedia: ov5647: Use gpiod_set_value_cansleep
Dave Stevenson [Tue, 18 Sep 2018 10:08:51 +0000 (11:08 +0100)]
media: ov5647: Use gpiod_set_value_cansleep

All calls to the gpio library are in contexts that can sleep,
therefore there is no issue with having those GPIOs controlled
by controllers which require sleeping (eg I2C GPIO expanders).

Switch to using gpiod_set_value_cansleep instead of gpiod_set_value
to avoid triggering the warning in gpiolib should the GPIO
controller need to sleep.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 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>
4 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>
4 years agostaging: vc04_services: Add a V4L2 M2M codec driver
Dave Stevenson [Tue, 25 Sep 2018 13:53:49 +0000 (14:53 +0100)]
staging: vc04_services: Add a V4L2 M2M codec driver

This adds a V4L2 memory to memory device that wraps the MMAL
video decode and video_encode components for H264 and MJPEG encode
and decode, MPEG4, H263, and VP8 decode (and MPEG2 decode
if the appropriate licence has been purchased).

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 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>
4 years agostaging: vc04_services: Use vc-sm-cma to support zero copy
Dave Stevenson [Tue, 25 Sep 2018 15:07:55 +0000 (16:07 +0100)]
staging: vc04_services: Use vc-sm-cma to support zero copy

With the vc-sm-cma driver we can support zero copy of buffers between
the kernel and VPU. Add this support to vchiq-mmal.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
staging: vc-sm-cma: Use a void* pointer as the handle within the kernel

The driver was using an unsigned int as the handle to the outside world,
and doing a nasty cast to the struct dmabuf when handed it back.
This breaks badly with a 64 bit kernel where the pointer doesn't fit
in an unsigned int.

Switch to using a void* within the kernel. Reality is that it is
a struct dma_buf*, but advertising it as such to other drivers seems
to encourage the use of it as such, and I'm not sure on the implications
of that.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agostaging: vc04_services: Add new vc-sm-cma driver
Dave Stevenson [Tue, 25 Sep 2018 09:27:11 +0000 (10:27 +0100)]
staging: vc04_services: Add new vc-sm-cma driver

This new driver allows contiguous memory blocks to be imported
into the VideoCore VPU memory map, and manages the lifetime of
those objects, only releasing the source dmabuf once the VPU has
confirmed it has finished with it.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
staging: vc-sm-cma: Correct DMA configuration.

Now that VCHIQ is setting up the DMA configuration as our
parent device, don't try to configure it during probe.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
staging: vc-sm-cma: Use a void* pointer as the handle within the kernel

The driver was using an unsigned int as the handle to the outside world,
and doing a nasty cast to the struct dmabuf when handed it back.
This breaks badly with a 64 bit kernel where the pointer doesn't fit
in an unsigned int.

Switch to using a void* within the kernel. Reality is that it is
a struct dma_buf*, but advertising it as such to other drivers seems
to encourage the use of it as such, and I'm not sure on the implications
of that.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
staging: vc-sm-cma: Fix up for 64bit builds

There were a number of logging lines that were using
inappropriate formatting under 64bit kernels.

The kernel_id field passed to/from the VPU was being
abused for storing the struct vc_sm_buffer *.
This breaks with 64bit kernels, so change to using an IDR.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
staging: vc_sm_cma: Remove erroneous misc_deregister

Code from the misc /dev node was still present in
bcm2835_vc_sm_cma_remove, which caused a NULL deref.
Remove it.

See #2885.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
staging: vc-sm-cma: Remove the debugfs directory on remove

Without removing that, reloading the driver fails.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
staging: vc-sm-cma: Use devm_ allocs for sm_state.

Use managed allocations for sm_state, removing reliance on
manual management.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
staging: vc-sm-cma: Don't fail if debugfs calls fail.

Return codes from debugfs calls should never alter the
flow of the main code.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
staging: vc-sm-cma: Ensure mutex and idr are destroyed

map_lock and kernelid_map are created in probe, but not released
in release should the vcsm service not connect (eg running the
cutdown firmware).

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
staging: vc-sm-cma: Remove obsolete comment and make function static

Removes obsolete comment about wanting to pass a function
pointer into mmal-vchiq as we now do.
As the function is passed as a function pointer, the function itself
can be static.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
staging: vc-sm-cma: Add in allocation for VPU requests.

Module has to change from tristate to bool as all CMA functions
are boolean.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
staging: vc-sm-cma: Update TODO.

The driver is already a platform driver, so that can be
deleted from the TODO.
There are no known issues that need to be resolved.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
staging: vc-sm-cma: Add in userspace allocation API

Replacing the functionality from the older vc-sm driver,
add in a userspace API that allows allocation of buffers,
and importing of dma-bufs.
The driver hands out dma-buf fds, therefore much of the
handling around lifespan and odd mmaps from the old driver
goes away.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
staging: vcsm-cma: Add cache control ioctls

The old driver allowed for direct cache manipulation and that
was used by various clients. Replicate here.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
staging: vcsm-cma: Alter dev node permissions to 0666

Until the udev rules are updated, open up access to this node by
default.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
staging: vcsm-cma: Drop logging level on messages in vc_sm_release_resource

They weren't errors but were logged as such.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
staging: vcsm-cma: Fixup the alloc code handling of kernel_id

The allocation code had been copied in from an old branch prior
to having added the IDR for 64bit support. It was therefore pushing
a pointer into the kernel_id field instead of an IDR handle, the
lookup therefore failed, and we never released the buffer.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
staging: vcsm-cma: Remove cache manipulation ioctl from ARM64

The cache flushing ioctls are used by the Pi3 HEVC hw-assisted
decoder as it needs finer grained flushing control than dma_ops
allow.
These cache calls are not present for ARM64, therefore disable
them. We are not actively supporting 64bit kernels at present,
and the use case of the HEVC decoder is fairly limited.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
staging: vcsm-cma: Rework to use dma APIs, not CMA

Due to a misunderstanding of the DMA mapping APIs, I made
the wrong decision on how to implement this.

Rework to use dma_alloc_coherent instead of the CMA
API. This also allows it to be built as a module easily.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
staging: vc-sm-cma: Fix the few remaining coding style issues

Fix a few minor checkpatch complaints to make the driver clean

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
staging: vc04_services: fix compiling in separate directory

The vc04_services Makefiles do not respect the O=path argument
correctly: include paths in CFLAGS are given relatively to object path,
not source path. Compiling in a separate directory yields #include
errors.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
vc-sm-cma: Fix compatibility ioctl

This code path hasn't been used previously.
Fixed up after testing with kodi on 32-bit userland and 64-bit kernel

Signed-off-by: popcornmix <popcornmix@gmail.com>
4 years agostaging: vc04_services: Fixup vchiq-mmal include ordering
Dave Stevenson [Tue, 25 Sep 2018 15:57:40 +0000 (16:57 +0100)]
staging: vc04_services: Fixup vchiq-mmal include ordering

There were dependencies on including the headers in the correct
order. Fix up the headers so that they include the other
headers that they depend on themselves.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 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>
4 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>
4 years agostaging: mmal-vchiq: Make a mmal_buf struct for passing parameters
Dave Stevenson [Mon, 24 Sep 2018 16:33:37 +0000 (17:33 +0100)]
staging: mmal-vchiq: Make a mmal_buf struct for passing parameters

The callback from vchi_mmal to the client was growing lots of extra
parameters. Consolidate them into a single struct instead of
growing the list further.
The struct is associated with the client buffer, therefore there
are various changes to setup various containers for the struct,
and pass the appropriate members.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agostaging: mmal-vchiq: Make timeout a defined parameter
Dave Stevenson [Mon, 24 Sep 2018 15:57:09 +0000 (16:57 +0100)]
staging: mmal-vchiq: Make timeout a defined parameter

The timeout period for VPU communications is a useful thing
to extend when debugging.
Set it via a define, rather than a magic number buried in the code.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 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>
4 years agostaging: mmal-vchiq: Allocate and free components as required
Dave Stevenson [Mon, 24 Sep 2018 15:51:13 +0000 (16:51 +0100)]
staging: mmal-vchiq: Allocate and free components as required

The existing code assumed that there would only ever be 4 components,
and never freed the entries once used.
Allow arbitrary creation and destruction of components.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agostaging: vc04_services: Split vchiq-mmal into a module
Dave Stevenson [Mon, 24 Sep 2018 15:30:37 +0000 (16:30 +0100)]
staging: vc04_services: Split vchiq-mmal into a module

In preparation for adding a video codec V4L2 module which also
wants to use vchiq-mmal functions, split it out into an
independent module.
The minimum number of changes have been made to achieve this
(eg straight moves where possible) so existing checkpatch
errors will still be present.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agostaging: bcm2835-camera: Ensure timestamps never go backwards.
Dave Stevenson [Tue, 24 Jul 2018 11:08:29 +0000 (12:08 +0100)]
staging: bcm2835-camera: Ensure timestamps never go backwards.

There is an awkward situation with H264 header bytes. Currently
they are returned with a PTS of 0 because they aren't associated
with a timestamped frame to encode. These are handled by either
returning the timestamp of the last buffer to have been received,
or in the case of the first buffer the timestamp taken at
start_streaming.
This results in a race where the current frame may have started
before we take the start time, which results in the first encoded
frame having an earlier timestamp than the header bytes.

Ensure that we never return a negative delta to the user by checking
against the previous timestamp.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agostaging: bcm2835-camera: Fix logical continuation splits
Dave Stevenson [Wed, 21 Feb 2018 15:48:54 +0000 (15:48 +0000)]
staging: bcm2835-camera: Fix logical continuation splits

Fix checkpatch errors for "Logical continuations should be
on the previous line".

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agostaging: vchiq_arm: Fix platform device unregistration
Stefan Wahren [Sat, 13 Oct 2018 18:51:23 +0000 (20:51 +0200)]
staging: vchiq_arm: Fix platform device unregistration

In error case platform_device_register_data would return an ERR_PTR
instead of NULL. So we better check this before unregistration.

Fixes: 37b7b3087a2f ("staging/vc04_services: Register a platform device for the camera driver.")
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 years agomedia: tc358743: Increase FIFO level to 374.
Dave Stevenson [Wed, 31 Oct 2018 14:56:59 +0000 (14:56 +0000)]
media: tc358743: Increase FIFO level to 374.

The existing fixed value of 16 worked for UYVY 720P60 over
2 lanes at 594MHz, or UYVY 1080P60 over 4 lanes. (RGB888
1080P60 needs 6 lanes at 594MHz).
It doesn't allow for lower resolutions to work as the FIFO
underflows.

374 is required for 1080P24-30 UYVY over 2 lanes @ 972Mbit/s, but
>374 means that the FIFO underflows on 1080P50 UYVY over 2 lanes
@ 972Mbit/s.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agomedia: ov5647: Add support for non-continuous clock mode
Dave Stevenson [Wed, 31 Oct 2018 14:56:47 +0000 (14:56 +0000)]
media: ov5647: Add support for non-continuous clock mode

The driver was only supporting continuous clock mode
although this was not stated anywhere.
Non-continuous clock saves a small amount of power and
on some SoCs is easier to interface with.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agomedia: ov5647: Add support for PWDN GPIO.
Dave Stevenson [Wed, 31 Oct 2018 14:56:33 +0000 (14:56 +0000)]
media: ov5647: Add support for PWDN GPIO.

Add support for an optional GPIO connected to PWDN on the sensor.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years ago[media] Documentation: DT: add device tree for PWDN control
Dave Stevenson [Wed, 31 Oct 2018 14:55:59 +0000 (14:55 +0000)]
[media] Documentation: DT: add device tree for PWDN control

Add optional GPIO pwdn to connect to the PWDN line on the sensor.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agomedia: ov5647: Add set_fmt and get_fmt calls.
Dave Stevenson [Wed, 31 Oct 2018 14:55:37 +0000 (14:55 +0000)]
media: ov5647: Add set_fmt and get_fmt calls.

There's no way to query the subdevice for the supported
resolutions.
Add set_fmt and get_fmt implementations.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agosound: pcm512x-codec: Adding 352.8kHz samplerate support
Klaus Schulz [Thu, 16 May 2019 11:35:32 +0000 (13:35 +0200)]
sound: pcm512x-codec: Adding 352.8kHz samplerate support

4 years agoAdded IQaudIO Pi-Codec board support (#2969)
IQaudIO [Mon, 13 May 2019 20:53:05 +0000 (21:53 +0100)]
Added IQaudIO Pi-Codec board support (#2969)

Add support for the IQaudIO Pi-Codec board.

Signed-off-by: Gordon <gordon@iqaudio.com>
Fixed 48k timing issue

ASoC: iqaudio-codec: use modern dai_link style

Signed-off-by: Hui Wang <hui.wang@canonical.com>
4 years agolan78xx: use default alignment for rx buffers
P33M [Thu, 2 May 2019 10:53:45 +0000 (11:53 +0100)]
lan78xx: use default alignment for rx buffers

The lan78xx uses a 12-byte hardware rx header, so there is no need
to allocate SKBs with NET_IP_ALIGN set. Removes alignment faults
in both dwc_otg and in ipv6 processing.

4 years agoAudiophonics I-Sabre 9038Q2M DAC driver
FERHAT Nicolas [Fri, 5 Apr 2019 12:06:42 +0000 (13:06 +0100)]
Audiophonics I-Sabre 9038Q2M DAC driver

Signed-off-by: Audiophonics <contact@audiophonics.fr>
ASoC: i-sabre-q2m: use modern dai_link style

Signed-off-by: Hui Wang <hui.wang@canonical.com>
4 years agortc: rv3028: Add backup switchover mode support
Phil Howard [Fri, 29 Mar 2019 10:53:14 +0000 (10:53 +0000)]
rtc: rv3028: Add backup switchover mode support

Signed-off-by: Phil Howard <phil@pimoroni.com>
4 years agodrm: vc4: Programming the CTM is conditional on running full KMS
Dave Stevenson [Tue, 19 Feb 2019 15:18:25 +0000 (15:18 +0000)]
drm: vc4: Programming the CTM is conditional on running full KMS

vc4_ctm_commit writes to HVS registers, so this is only applicable
when in full KMS mode, not in firmware KMS mode. Add this conditional.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agobcm2835-dma: Add support for per-channel flags
Phil Elwell [Fri, 20 Jul 2018 21:03:41 +0000 (22:03 +0100)]
bcm2835-dma: Add support for per-channel flags

Add the ability to interpret the high bits of the dreq specifier as
flags to be included in the DMA_CS register. The motivation for this
change is the ability to set the DISDEBUG flag for SD card transfers
to avoid corruption when using the VPU debugger.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agogpu: vc4_firmware_kms: Fix up 64 bit compile warnings.
Dave Stevenson [Mon, 28 Jan 2019 14:40:16 +0000 (14:40 +0000)]
gpu: vc4_firmware_kms: Fix up 64 bit compile warnings.

Resolve two build warnings with regard using incorrectly
sized parameters in logging messages on 64 bit builds.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agoRevert "staging: bcm2835-audio: Drop DT dependency"
popcornmix [Fri, 15 Mar 2019 21:11:10 +0000 (21:11 +0000)]
Revert "staging: bcm2835-audio: Drop DT dependency"

This reverts commit b7491a9fca2dc2535b9dc922550a37c5baae9d3d.

4 years agoRevert "staging: vchiq: delete vchiq_killable.h"
Phil Elwell [Wed, 6 Mar 2019 16:28:09 +0000 (16:28 +0000)]
Revert "staging: vchiq: delete vchiq_killable.h"

This reverts commit 2da56630b1cc422f58408033102b8f91ae97bc91.

4 years agolan78xx: EEE support is now a PHY property
Phil Elwell [Tue, 5 Mar 2019 09:51:22 +0000 (09:51 +0000)]
lan78xx: EEE support is now a PHY property

Now that EEE support is a property of the PHY, use the PHY's DT node
when querying the EEE-related properties.

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

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agoconfigs: Enable the AD193x codecs
Phil Elwell [Thu, 7 Feb 2019 18:16:25 +0000 (18:16 +0000)]
configs: Enable the AD193x codecs

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

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agoAdded driver for the HiFiBerry DAC+ ADC (#2694)
HiFiBerry [Mon, 8 Oct 2018 16:10:12 +0000 (18:10 +0200)]
Added driver for the HiFiBerry DAC+ ADC (#2694)

Signed-off-by: Daniel Matuschek <daniel@hifiberry.com>
hifiberry_dacplusadc: switch to snd_soc_dai_set_bclk_ratio

Signed-off-by: Matthias Reichl <hias@horus.com>
ASoC: hifiberry_dacplusadc: fix DAI link setup

The driver only defines a single DAI link and the code that tries
to setup the second (non-existent) DAI link looks wrong - using dmic
as a CPU/platform driver doesn't make any sense.

The DT overlay doesn't define a dmic property, so the code was never
executed (otherwise it would have resulted in a memory corruption).

So drop the offending code to prevent issues if a dmic property
should be added to the DT overlay.

Signed-off-by: Matthias Reichl <hias@horus.com>
ASoC: hifiberry_dacplusadc: use modern dai_link style

Signed-off-by: Matthias Reichl <hias@horus.com>
4 years agospi: spi-bcm2835: Disable forced software CS
Phil Elwell [Tue, 15 Jan 2019 12:41:15 +0000 (12:41 +0000)]
spi: spi-bcm2835: Disable forced software CS

With GPIO CS used by the DTBs, allow hardware CS to be selected by an
overlay.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agospi: spi-bcm2835: Re-enable HW CS
Phil Elwell [Tue, 15 Jan 2019 12:39:50 +0000 (12:39 +0000)]
spi: spi-bcm2835: Re-enable HW CS

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agoASoC: Add support for AudioSense-Pi add-on soundcard
b-ak [Wed, 2 Jan 2019 18:31:08 +0000 (00:01 +0530)]
ASoC: Add support for AudioSense-Pi add-on soundcard

AudioSense-Pi is a RPi HAT based on a TI's TLV320AIC32x4 stereo codec

This hardware provides multiple audio I/O capabilities to the RPi.
The codec connects to the RPi's SoC through the I2S Bus.

The following devices can be connected through a 3.5mm jack
1. Line-In: Plain old audio in from mobile phones, PCs, etc.,
2. Mic-In: Connect a microphone
3. Line-Out: Connect the output to a speaker
4. Headphones: Connect a Headphone w or w/o microphones

Multiple Inputs:
It supports the following combinations
1. Two stereo Line-Inputs and a microphone
2. One stereo Line-Input and two microphones
3. Two stereo Line-Inputs, a microphone and
one mono line-input (with h/w hack)
4. One stereo Line-Input, two microphones and
one mono line-input (with h/w hack)

Multiple Outputs:
Audio output can be routed to the headphones or
speakers (with additional hardware)

Signed-off-by: b-ak <anur.bhargav@gmail.com>
ASoC: audiosense-pi: use modern dai_link style

Signed-off-by: Hui Wang <hui.wang@canonical.com>
4 years agolan78xx: Debounce link events to minimize poll storm
Joshua Emele [Thu, 8 Nov 2018 00:07:40 +0000 (16:07 -0800)]
lan78xx: Debounce link events to minimize poll storm

The bInterval is set to 4 (i.e. 8 microframes => 1ms) and the only bit
that the driver pays attention to is "link was reset". If there's a
flapping status bit in that endpoint data, (such as if PHY negotiation
needs a few tries to get a stable link) then polling at a slower rate
would act as a de-bounce.

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

4 years agofirmware: raspberrypi: Report the fw variant during probe
Dave Stevenson [Thu, 10 Jan 2019 17:58:06 +0000 (17:58 +0000)]
firmware: raspberrypi: Report the fw variant during probe

The driver already reported the firmware build date during probe.
The mailbox calls have been extended to also report the variant
 1 = standard start.elf
 2 = start_x.elf (includes camera stack)
 3 = start_db.elf (includes assert logging)
 4 = start_cd.elf (cutdown version for smallest memory footprint).
Log the variant during probe.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
firmware: raspberrypi: Report the fw git hash during probe

The firmware can now report the git hash from which it was built
via the mailbox, so report it during probe.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agostaging: bcm2835-camera: Ensure H264 header bytes get a sensible timestamp
Dave Stevenson [Mon, 29 Oct 2018 14:21:04 +0000 (14:21 +0000)]
staging: bcm2835-camera: Ensure H264 header bytes get a sensible timestamp

H264 header come from VC with 0 timestamps, which means they get a
strange timestamp when processed with VC/kernel start times,
particularly if used with the inline header option.
Remember the last frame timestamp and use that if set, or otherwise
use the kernel start time.

https://github.com/raspberrypi/linux/issues/1836

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agonet: lan78xx: Support auto-downshift to 100Mb/s
Phil Elwell [Mon, 26 Nov 2018 19:46:58 +0000 (19:46 +0000)]
net: lan78xx: Support auto-downshift to 100Mb/s

Ethernet cables with faulty or missing pairs (specifically pairs C and
D) allow auto-negotiation to 1000Mbs, but do not support the successful
establishment of a link. Add a DT property, "microchip,downshift-after",
to configure the number of auto-negotiation failures after which it
falls back to 100Mbs. Valid values are 2, 3, 4, 5 and 0, where 0 means
never downshift.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agogpiolib: Don't prevent IRQ usage of output GPIOs
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>
4 years agoUpdate issue templates (#2736)
James Hughes [Fri, 2 Nov 2018 11:55:49 +0000 (11:55 +0000)]
Update issue templates (#2736)

4 years agodrivers: thermal: step_wise: avoid throttling at hysteresis temperature after droppin...
Serge Schneider [Tue, 2 Oct 2018 10:14:15 +0000 (11:14 +0100)]
drivers: thermal: step_wise: avoid throttling at hysteresis temperature after dropping below it

Signed-off-by: Serge Schneider <serge@raspberrypi.org>
4 years agodrivers: thermal: step_wise: add support for hysteresis
Ram Chandrasekar [Mon, 7 May 2018 17:54:08 +0000 (11:54 -0600)]
drivers: thermal: step_wise: add support for hysteresis

Step wise governor increases the mitigation level when the temperature
goes above a threshold and will decrease the mitigation when the
temperature falls below the threshold. If it were a case, where the
temperature hovers around a threshold, the mitigation will be applied
and removed at every iteration. This reaction to the temperature is
inefficient for performance.

The use of hysteresis temperature could avoid this ping-pong of
mitigation by relaxing the mitigation to happen only when the
temperature goes below this lower hysteresis value.

Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
Signed-off-by: Lina Iyer <ilina@codeaurora.org>
4 years agosc16is7xx: Don't spin if no data received
Phil Elwell [Tue, 6 Nov 2018 12:57:48 +0000 (12:57 +0000)]
sc16is7xx: Don't spin if no data received

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

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agofirmware: raspberrypi: Add backward compatible get_throttled
Stefan Wahren [Sat, 13 Oct 2018 11:31:21 +0000 (13:31 +0200)]
firmware: raspberrypi: Add backward compatible get_throttled

Avoid a hard userspace ABI change by adding a compatible get_throttled
sysfs entry. Its value is now feed by the GET_THROTTLED requests of the
new hwmon driver. The first access to get_throttled will generate
a warning.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
4 years agohwmon: raspberrypi: Prevent voltage low warnings from filling log
Stefan Wahren [Sat, 6 Oct 2018 14:46:18 +0000 (16:46 +0200)]
hwmon: raspberrypi: Prevent voltage low warnings from filling log

Although the correct fix for low voltage warnings is to
improve the power supply, the current implementation
of the detection can fill the log if the warning
happens freqently. This replaces the logging with
slightly custom ratelimited logging.

Signed-off-by: James Hughes <james.hughes@raspberrypi.org>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
4 years agovchiq_2835_arm: Implement a DMA pool for small bulk transfers (#2699)
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>
4 years agocxd2880: CXD2880_SPI_DRV should select DVB_CXD2880 with MEDIA_SUBDRV_AUTOSELECT
popcornmix [Mon, 17 Sep 2018 16:31:18 +0000 (17:31 +0100)]
cxd2880: CXD2880_SPI_DRV should select DVB_CXD2880 with MEDIA_SUBDRV_AUTOSELECT

4 years agoAdd rpi-poe-fan driver
Serge Schneider [Mon, 9 Jul 2018 11:54:25 +0000 (12:54 +0100)]
Add rpi-poe-fan driver

Signed-off-by: Serge Schneider <serge@raspberrypi.org>
PoE HAT driver cleanup

* Fix undeclared variable in rpi_poe_fan_suspend
* Add SPDX-License-Identifier
* Expand PoE acronym in Kconfig help
* Give clearer error message on of_property_count_u32_elems fail
* Add documentation
* Add vendor to of_device_id compatible string.
* Rename m_data_s struct to fw_data_s
* Fix typos

Fixes: #2665

Signed-off-by: Serge Schneider <serge@raspberrypi.org>
4 years agolan78xx: Move enabling of EEE into PHY init code
Phil Elwell [Thu, 5 Apr 2018 13:46:11 +0000 (14:46 +0100)]
lan78xx: Move enabling of EEE into PHY init code

Enable EEE mode as soon as possible after connecting to the PHY, and
before phy_start. This avoids a second link negotiation, which speeds
up booting and stops the interface failing to become ready.

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

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agobrcmfmac: Re-enable firmware roaming support
Phil Elwell [Wed, 20 Jun 2018 11:20:01 +0000 (12:20 +0100)]
brcmfmac: Re-enable firmware roaming support

As of 4.18, a firmware that implements the update_connect_params
method but doesn't claim to support roaming causes an error. We
disabled firmware roaming in 4.4 [1] because it appeared to
prevent disconnects, but let's try with the current firmware to see
if things have improved.

[1] https://github.com/raspberrypi/linux/commit/dd9188011786fb62a7960922f31e8e086fb2009b

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agonet: lan78xx: Disable TCP Segmentation Offload (TSO)
Dave Stevenson [Wed, 13 Jun 2018 14:21:10 +0000 (15:21 +0100)]
net: lan78xx: Disable TCP Segmentation Offload (TSO)

TSO seems to be having issues when packets are dropped and the
remote end uses Selective Acknowledge (SACK) to denote that
data is missing. The missing data is never resent, so the
connection eventually stalls.

There is a module parameter of enable_tso added to allow
further debugging without forcing a rebuild of the kernel.

https://github.com/raspberrypi/linux/issues/2449
https://github.com/raspberrypi/linux/issues/2482

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
4 years agoof: configfs: Use of_overlay_fdt_apply API call
Phil Elwell [Thu, 14 Jun 2018 14:07:26 +0000 (15:07 +0100)]
of: configfs: Use of_overlay_fdt_apply API call

The published API to the dynamic overlay application mechanism now
takes a Flattened Device Tree blob as input so that it can manage the
lifetime of the unflattened tree. Conveniently, the new API call -
of_overlay_fdt_apply - is virtually a drop-in replacement for
create_overlay, which can now be deleted.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agoirqchip: irq-bcm2835: Calc. FIQ_START at boot-time
Phil Elwell [Thu, 14 Jun 2018 10:21:04 +0000 (11:21 +0100)]
irqchip: irq-bcm2835: Calc. FIQ_START at boot-time

ad83c7cb2f37 ("irqchip/irq-bcm2836: Add support for DT interrupt polarity")
changed the way that the BCM2836/7 local interrupts are mapped; instead
of being pre-mapped they are now mapped on-demand. A side effect of this
change is that the call to irq_of_parse_and_map from armctrl_of_init
creates a new mapping, forming a gap between the IRQs and the FIQs. This
 gap breaks the FIQ<->IRQ mapping which up to now has been done by assuming:

1) that the value of FIQ_START is the same as the number of normal IRQs
that will be mapped (still true), and

2) that this value is also the offset between an IRQ and its equivalent
FIQ (which is no longer the case).

Remove both assumptions by measuring the interval between the last IRQ
and the last FIQ, passing it as the parameter to init_FIQ().

Fixes: https://github.com/raspberrypi/linux/issues/2432

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agofirmware/raspberrypi: Notify firmware of a reboot
Phil Elwell [Sat, 12 May 2018 20:35:43 +0000 (21:35 +0100)]
firmware/raspberrypi: Notify firmware of a reboot

Register for reboot notifications, sending RPI_FIRMWARE_NOTIFY_REBOOT
over the mailbox interface on reception.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agoAdd ability to export gpio used by gpio-poweroff
Nick Bulleid [Thu, 10 May 2018 20:57:02 +0000 (21:57 +0100)]
Add ability to export gpio used by gpio-poweroff

Signed-off-by: Nick Bulleid <nedbulleid@fastmail.com>
Added export feature to gpio-poweroff documentation

Signed-off-by: Nick Bulleid <nedbulleid@fastmail.com>
4 years agohid: Reduce default mouse polling interval to 60Hz
popcornmix [Mon, 14 Jul 2014 21:02:09 +0000 (22:02 +0100)]
hid: Reduce default mouse polling interval to 60Hz

Reduces overhead when using X

4 years agolan78xx: Read initial EEE status from DT
Phil Elwell [Fri, 9 Mar 2018 12:01:00 +0000 (12:01 +0000)]
lan78xx: Read initial EEE status from DT

Add two new DT properties:
* microchip,eee-enabled  - a boolean to enable EEE
* microchip,tx-lpi-timer - time in microseconds to wait before entering
                           low power state

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agoadded capture_clear option to pps-gpio via dtoverlay (#2433)
hdoverobinson [Tue, 13 Mar 2018 10:58:39 +0000 (06:58 -0400)]
added capture_clear option to pps-gpio via dtoverlay (#2433)

4 years agoi2c-gpio: Also set bus numbers from reg property
Phil Elwell [Tue, 20 Feb 2018 10:07:27 +0000 (10:07 +0000)]
i2c-gpio: Also set bus numbers from reg property

I2C busses can be assigned specific bus numbers using aliases in
Device Tree - string properties where the name is the alias and the
value is the path to the node. The current DT parameter mechanism
does not allow property names to be derived from a parameter value
in any way, so it isn't possible to generate unique or matching
aliases for nodes from an overlay that can generate multiple
instances, e.g. i2c-gpio.

Work around this limitation (at least temporarily) by allowing
the i2c adapter number to be initialised from the "reg" property
if present.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
4 years agodrm/vc4: Don't wait for vblank on fkms cursor updates.
Eric Anholt [Mon, 5 Feb 2018 18:53:18 +0000 (18:53 +0000)]
drm/vc4: Don't wait for vblank on fkms cursor updates.

We don't use the same async update path between fkms and normal kms,
and the normal kms workaround ended up making us wait.  This became a
larger problem in rpi-4.14.y, as the USB HID update rate throttling
got (accidentally?) dropped.

Signed-off-by: Eric Anholt <eric@anholt.net>
4 years agogpu:vc4-fkms: Update driver to not use plane->crtc.
Dave Stevenson [Tue, 19 Feb 2019 15:06:31 +0000 (15:06 +0000)]
gpu:vc4-fkms: Update driver to not use plane->crtc.

Following on from
commit 2f958af7fc248 ("drm/vc4: Stop updating plane->fb/crtc")
do the same in the firmwarekms driver and look at plane_state->crtc
instead.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>