platform/kernel/linux-rpi.git
4 months agoclk: rp1: Add sdio-clk driver
Phil Elwell [Wed, 12 Oct 2022 13:20:07 +0000 (14:20 +0100)]
clk: rp1: Add sdio-clk driver

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 months agommc: sdhci-of-dwcmshc: rp1 sdio changes
Phil Elwell [Wed, 12 Oct 2022 13:07:32 +0000 (14:07 +0100)]
mmc: sdhci-of-dwcmshc: rp1 sdio changes

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 months agommc: sdhci-of-dwcmshc: define sdio timeout clocks
Liam Fraser [Thu, 14 Mar 2019 16:01:26 +0000 (16:01 +0000)]
mmc: sdhci-of-dwcmshc: define sdio timeout clocks

Signed-off-by: Liam Fraser <liam@raspberrypi.com>
4 months agoserial: pl011: rp1 uart support
Phil Elwell [Wed, 12 Oct 2022 12:24:51 +0000 (13:24 +0100)]
serial: pl011: rp1 uart support

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 months agopinctrl: Add rp1 driver
Phil Elwell [Mon, 10 Oct 2022 13:21:11 +0000 (14:21 +0100)]
pinctrl: Add rp1 driver

RP1 exposes GPIOs. Add a pinctrl driver to allow control of those.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 months agodt-bindings: pinctrl: Add bindings for Raspberry Pi RP1
Phil Elwell [Fri, 28 Oct 2022 13:13:30 +0000 (14:13 +0100)]
dt-bindings: pinctrl: Add bindings for Raspberry Pi RP1

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 months agoclk: Add rp1 clock driver
Phil Elwell [Mon, 10 Oct 2022 13:25:38 +0000 (14:25 +0100)]
clk: Add rp1 clock driver

RP1 contains various PLLs and clocks for driving the hardware
blocks, so add a driver to configure these.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 months agodt-bindings: clock: Add bindings for Raspberry Pi RP1
Phil Elwell [Fri, 28 Oct 2022 13:12:18 +0000 (14:12 +0100)]
dt-bindings: clock: Add bindings for Raspberry Pi RP1

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 months agomfd: Add rp1 driver
Phil Elwell [Mon, 10 Oct 2022 13:21:50 +0000 (14:21 +0100)]
mfd: Add rp1 driver

RP1 is a multifunction PCIe device that exposes a range of
peripherals.
Add the parent driver to manage these.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 months agodt-binding: mfd: Add binding for Raspberry Pi RP1
Phil Elwell [Fri, 28 Oct 2022 13:10:34 +0000 (14:10 +0100)]
dt-binding: mfd: Add binding for Raspberry Pi RP1

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 months agobcm2708_fb: Fix more build warnings
Phil Elwell [Thu, 1 Sep 2022 16:51:54 +0000 (17:51 +0100)]
bcm2708_fb: Fix more build warnings

4 months agoV4L2: Add PiSP compressed formats to V4L2
Naushir Patuck [Wed, 2 Mar 2022 16:10:50 +0000 (16:10 +0000)]
V4L2: Add PiSP compressed formats to V4L2

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
4 months agoV4L2: Add PiSP opaque formats to V4L2
Naushir Patuck [Mon, 7 Feb 2022 09:20:49 +0000 (09:20 +0000)]
V4L2: Add PiSP opaque formats to V4L2

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
4 months agoPCI: brcmstb: Add BCM2712 support
Jim Quinlan [Fri, 23 Jun 2023 14:40:57 +0000 (10:40 -0400)]
PCI: brcmstb: Add BCM2712 support

PCI: brcmstb: differing register offsets on 2712

pcie-brcmstb: Add 2712 bridge reset support

pcie: 2712 PORT_MASK and rescal support

pcie-brcmstb: don't alter the L1SS debug register

For reasons unknown, this disables the reference clock

pcie-brcmstb: fix BAR2 enable and window decode

Set UBUS ACCESS_EN to let inbound DMA work. Also BCM2712 has grown
an index in the inbound window size decode register.

PCIe: brcmstb: Enable support for 64 MSI-Xs

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
pcie-brcmstb: Suppress read error responses

If the link is down or the EP fails to return a read completion, the
RC's default behaviour is to return an AXI error. This causes fatal
exceptions on A76, so it's better to respond with all 1s instead.

pcie-brcmstb: increase UBUS timeout to cater for link retrain events

pcie-brcmstb: Handle additional inbound regions

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
pcie-brcmstb: Add support for external MSI controller

pcie-brcmstb: add a reasonable default traffic class to priority map

BCM2712 supports multiple traffic classes (TCs) with independent
maximally sized transfer queues for each TC. Traffic classes have no
transaction ordering requirements between them, which facilitates
out-of-order completions and arbitration between posted writes for
data streams that have no dependence on each other.

In addition to the above benefits of splitting endpoint traffic into
individual queues, priorities can be assigned to traffic classes by
a heuristic or deterministic mechanism. The heuristic elevates AXI
QOS priority in accordance with the number of pending transfers in
each TC's queue, but for true priority signalling a forwarding
mechanism using vendor-defined messages is implemented.

Receipt of a 3 DWORD VDM assigns a priority tag to a TC on-the-fly,
and this tag corresponds to a configurable AXI QOS value.

As a simple baseline, assign a linear map of AXI QOS to each tag.

pcie: brcmstb: set up the VDM forwarding interface when setting up QoS

pcie-brcmstb: clean up debug messages

pcie-brcmstb: fix BCM2712A0 PHY PM errata

The power management clock is 54MHz not 50MHz, so adjust the PM clock period
to suit. Powering off the PHY PLL in L1.2 is unsafe, so force it on.

pcie-brcmstb: set CLKREQ functionality according to link partner support

The RC supports either L1 with clock PM or L1 sub-state control, not both
at the same time. Examine the link partner's capabilities to determine
which is the most suitable scheme to use.

pcie: brcmstb: don't reset block bridges in suspend or removal cases

BCM2712 has a single rescal block for all three root complexes, and
holding PCIE1's bridge in reset will hang the chip if a different
RC wants to access any of the rescal registers.

pcie: brcmstb: guard 2712-specific setup with a RC type check

BCM2711 doesn't implement the UBUS control registers.

pcie: brcmstb: On 2712 keeping the PLL powered in L1.x is not required

A separate misconfiguration when enabling SSC (the MDIO registers no
longer do the same thing on BCM2712) had the side-effect of breaking
PLL powerdown and resume sequencing.

Allow entry into a true L1.2 state where analogue is depowered.

pcie: brcmstb: Fix reset warning on probe failure

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
bcm2712: pcie: adjust PHY PLL setup to use a 54MHz input refclk

Use canned MDIO writes from Broadcom that switch the ref_clk output
pair to run from the internal fractional PLL, and set the internal PLL
to expect a 54MHz input reference clock.

Gen3 operation is not guaranteed to be stable in this setup, so default
to gen2.

This only works if the LCPLL is bypassed (requires latest bootloader).

pcie: brcmstb: add missing register writes

drivers: pcie: brcmstb: cater for BCM2712C0 bug dropping QoS on the floor

The AXI QoS value extracted from the request fifo ends up as zero forever.
Disabling this means that "panic" signalling doesn't do anything useful,
but static priorites do work.

Also align the selected TC:QoS map with RP1's expectations of service.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
drivers: pcie: brcmstb: shuffle TC priorities up to 8

Use the range 8-11 which puts the highest below HVS but leaves space
below for other 2712 masters.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
drivers: pcie: brcmstb: optionally enable QoS features by DT for BCM2712

It's a bad idea to universally enable "realtime" priorities for TCs
across all the RC instances on the chip. Endpoints other than RP1 may
make use of these, so you don't want e.g. NVMe descriptor fetches getting
higher priority than your remote display.

Add two optional DT properties controlling the behaviour - FIFO-based
backpressure QoS or "message-based". Message-based signalling is
fundamentally broken due to a chip bug, so it collapses into a set of
static assignments that RP1 needs.

The default if neither property is specified is to assign everything a
QoS of 0.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
drivers: pcie: brcmstb: adjust completion timeouts for bcm2712

Setting the RC config retry timeout makes CRS auto-polling work, but
the UBUS timeout will override the config retry. Both need to be large.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
4 months agodrm/panel/raspberrypi-touchscreen: Insert more delays.
Nick Hollinghurst [Wed, 1 Dec 2021 19:43:08 +0000 (19:43 +0000)]
drm/panel/raspberrypi-touchscreen: Insert more delays.

This avoids failures in cases where the panel is enabled
or re-probed very soon after being disabled or probed.
These can occur because the Atmel device can mis-behave
over I2C for a few ms after any write to the POWERON register.

4 months agousb: dwc3: Set DMA and coherent masks early
Jonathan Bell [Mon, 13 Sep 2021 10:14:32 +0000 (11:14 +0100)]
usb: dwc3: Set DMA and coherent masks early

dwc3 allocates scratch and event buffers in the top-level driver. Hack the
probe function to set the DMA mask before trying to allocate these.

I think the event buffers are only used in device mode, but the scratch
buffers may be used if core hibernation is enabled.

usb: dwc3: add support for new DT quirks

Apply the optional axi-pipe-limit and dis-in-autoretry-quirk properties
during driver probe.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
phy: phy-brcm-usb: Add 2712 support

usb: dwc3: if the host controller instance number is present in DT, use it

If two instances of a dwc3 host controller are specified in devicetree,
then the probe order may be arbitrary which results in the device names
swapping on a per-boot basis.

If a "usb" alias with the instance number is specified, then use
that to construct the device name instead of autogenerating one.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
rp1 dwc3 changes

drivers: usb: dwc3: allow setting GTXTHRCFG on dwc_usb3.0 hardware

Equivalent register fields exist in the SuperSpeed Host version of the
hardware, so allow the use of TX thresholds if specified in devicetree.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
drivers: usb: dwc3: remove downstream quirk dis-in-autoretry

Upstream have unilaterally disabled the feature.

Partially reverts 6e9142a26ee0fdc3a5adc49ed6cedc0b16ec2ed1 (downstream)

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
4 months agonet: macb: Also set DMA coherent mask
Phil Elwell [Fri, 10 Sep 2021 16:20:45 +0000 (17:20 +0100)]
net: macb: Also set DMA coherent mask

macb: Add device tree properties that allow configuration of the AXI max pipeline register

net: macb: add support for ethtool interrupt moderation configuration

Only global throttling of rx or tx by time quanta is supported.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
macb: add platform device shutdown function. Prevents AXI master over PCIE from hanging when the host is rebooted.

net: macb: increase polling interval for MDIO completion

MDIO is a slow bus (single-digit MHz). Polling at 1us intervals
is a bit aggressive, so increase to 100us as the transaction
usually takes 100-200us to complete.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
net: macb: Several patches for RP1

64-bit RX fix

Also set DMA coherent mask

Add device tree properties that allow configuration of the AXI max
pipeline register

Add support for ethtool interrupt moderation configuration

Only global throttling of rx or tx by time quanta is supported.

Add platform device shutdown function. Prevents AXI master over PCIE
from hanging when the host is rebooted.

Increase polling interval for MDIO completion

MDIO is a slow bus (single-digit MHz). Polling at 1us intervals
is a bit aggressive, so increase to 100us as the transaction
usually takes 100-200us to complete.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
net: macb: Support the phy-reset-gpios property

Allow a PHY to be reset with an optional GPIO. The reset duration can
be specified in milliseconds - the default is 10ms.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
drivers: net: macb: close device on driver shutdown

Fix some suspicious locking and instead call into macb_close, which
deregisters and frees all resources the corresponding macb_open
claimed.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
net: macb: add hack to prevent TX stalls in a quiet system

See https://github.com/raspberrypi/linux-2712/issues/89

There is some critical window during TX where a further write to the
TSTART bit while TX is active does not cause newly queued TX descriptors
to be consumed.

For now "wait a bit, then try anyway" seems to work.

Requires further investigation, but this unsticks NFS reliably.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
net: macb: set default interrupt moderation for GEM hardware

Defaulting to intmod = 0 is antisocial, as the MAC can generate over
130,000 interrupts per second. 50us is a sensible default.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
4 months agoreset: reset-brcmstb-rescal: Support shared use
Phil Elwell [Tue, 7 Sep 2021 13:49:00 +0000 (14:49 +0100)]
reset: reset-brcmstb-rescal: Support shared use

reset_control_reset should not be used with shared reset controllers.
Add support for reset_control_assert and _deassert to get the desired
behaviour and avoid ugly warnings in the kernel log.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 months agoirqchip: irq-bcm2712-mip: Support for 2712's MIP
Phil Elwell [Wed, 28 Jul 2021 10:13:39 +0000 (11:13 +0100)]
irqchip: irq-bcm2712-mip: Support for 2712's MIP

irqchip: irq-bcm2712-mip: specify bitmap search size as ilog2(N) not N

Freeing also has the same interface.

irqchip: irq-bcm2712-mip: Fix build warnings

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
irqchip: bcm2712-mip: add a quick hack to optionally shift MSI vectors

There are two MIP peripherals in bcm2712, the first gets a first-class
treatment where 64 consecutive GIC SPIs are assigned to all 64 output
vectors. The second gets an agglomeration of 17 GIC SPIs, but only 8 of
these are consecutive starting at the 8th output vector.

For now, allow the use of this smaller contiguous range within a larger
whole.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
4 months agoAdd new "pispbe" driver (though not yet the Makesfiles or DT required to use it)
Nick Hollinghurst [Wed, 14 Jul 2021 08:32:49 +0000 (09:32 +0100)]
Add new "pispbe" driver (though not yet the Makesfiles or DT required to use it)

media: bcm2712: Initial commit of the PiSP BE driver

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
media: bcm2712_pisp_be: PiSP driver updates.

- Start registering video nodes from /dev/video20
- Formatting fixes
- Define MODULE_DEVICE_TABLE() to probe correctly

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
media: pisp_be: Improve image format support

Add a new format table that lists the V4L2 format enums and their properties.
Keep the exising 'RPBP' format to support the userland verification tools.
This format requires userland to fill all plane properties. Standard V4L2
formats will derive these properties from the format table.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
media: pisp_be: Advertise the meta output format explictily.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
drivers: pisp_be: Various updates and cleanups

- Switch to a single node group for now.
- Add a node description table to simplify node handling.
- Switch HoG output to V4L2_CAP_META_CAPTURE type.
- Use string descriptions for node names in logging messages.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
pisp_be: Updates for libcamera usage:

- Remove indexes from device entity names
- Add enumframesize and enumfmts ioctls
- Add default format to all nodes.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
v4l2: pisp_be: Move format definitions into v4l2 core

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
media: raspberrypi: Move PiSP common headers to a single location

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
media: raspberrypi: Remove old pispbe driver.

This is now supersede by the driver in drivers/media/platform/raspberrypi/

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
PISP-BE Driver: Automate buffer-cycling for TDN and Stitch state.
Remove "tdn-input" and "stitch-input" nodes altogether (the output
nodes must still be opened and REQBUFS called with 1 or 2 buffers).
Also, a bit of tidying of buffer address handling and locking.

PISP-BE driver: Turn debug level right down to reduce overly-chatty messages

media: bcm2712: Depend on CONFIG_PM

Depend on CONFIG_PM as the driver uses the runtime_pm infrastructure.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
drivers: media: pisp_be: Move BE driver to a raspberrypi directory

Move the pisp_be driver from drivers/media/platform/raspberrypi/ to
drivers/media/platform/raspberrypi/pisp_be/. This seems the accepted
convention in the drivers/media/platform/ directory structure.

Also rename the driver module from bcm2712_pisp_be to pisp_be.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
pisp_be: Updates for libcamera streaming:

- Add some required v4l2 formats
- Add buf_prepare ioctl
- Set plane offsets correctly before reprogramming

pisp_be: Reduce logging verbosity

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
pisp_be: Add buffer timestamps

While at it, remove duplicate code when checking if the HW has completed
multiple jobs.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
pisp_be: Remove queue size allocation constraint

PISP-BE driver: Fix ISR to handle multiple done/start events.

PISP-BE: Fix variable-name shadowing bugette

PISP-BE: Support for two node groups. Reorganize the driver.

To support 2 concurrent libcamera applications, we need 2 node groups,
need to allow multiple opens of each node (because libcamera does this)
and create a separate media device per group (to support file-locking).

This triggered significant rearrangement of the driver. Some calls
that we formerly intercepted have been delegated back to v4l2/vb2.
Logging changes arising from multiple v4l2_dev. Refactored probe()
and initialization. Avoid dynamically-allocated entity name strings.

drivers: media: pisp_be: Add vidioc_enum_fmt_meta_out

This was missing in the struct v4l2_ioctl_ops definition.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
drivers: media: pispe_be: Add Bayer compressed formats

Add PiSP Bayer compressed formats to the list of supported pixel formats
for the PiSP backend driver.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
drivers: meida: pisp_be: Fix overflow in plane size calculations

The calculations for buffer plane sizes can overflow because of the
plane factor shift. Fix this by using u64 integers for the calculations.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
drivers: media: pisp_be: Use 0P3 for plane factors

Use less precision for the plane factors to avoid any nasty overflows.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
media: pisp: Checkpatch and coding style fixups

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
media: pisp_be: More coding style fixups

media: platform: bcm2712: pisp_be: Fix crash when buffer format not set

Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
media: platform: bcm2712: pisp_be: Allow non-SRGB colour spaces on RGB outputs

Allow colour spaces other than SRGB when the output format in question
is an RGB output. This commit merely ports over existing changes from
the vc4 ISP driver.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
media: platform: bcm2712: Tweak list of BE supported image formats

Remove RGB565 and 10- and 12-bit packed raw formats, which ISP-BE
can't support for input or output. Add NV12M and NV21M which it can.
(I didn't bother adding YUV422P, which apparently is not widely used.)

Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
pisp_be: Fill the hardware revision in the media entity struct

This can be used by userland to determine the hardware capabilities.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
bcm2712: Use BIT() macro

Use the BIT() macro instead of plain bit shifting.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
bcm2712: Invert condition in pispbe_schedule_internal()

Return earlier and save one indentation level

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
bcm2712: Invert condition in for loop

Save one indentation level by continuing if the node is not streaming.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
bcm2712: Do not declare a local variable

There already is a truct pispbe_node *node in the function scope.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
bcm21712: Siplify pispbe_schedule_one()

A little more verbose but easier to follow ?

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
bcm2712: Rename pispbe_schedule_all() to pispbe_schedule_any()

The pispbe_schedule_all() function name is misleading, as the function
schedule a single job from any of the node groups. Rename it.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
media: platform: bcm2712: Remove buffer auto-cycling from ISP-BE

Previously, the ISP-BE driver tried to automate "ping pong" buffers
for TDN and HDR state, but did not fully conceal them from users.

The automation has been removed: there are now separate output and
capture queues for each of TDN and Stitch, which must be managed by
user code (DMABUFs may be used to circulate buffers between queues).

Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
drivers: media: pisp_be: Cache BE config buffer vaddr

When programming a new job, we access at the config buffer, possibly
from ISR context. So fetch and the virtual address when queuing the
buffer.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
drivers: media: pisp_be: Remove all traces of ctrls and request API

These APIs are not (and will not) be used by the driver, so remove them.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
media: bcm2712: Replace v4l2_dbg with dev_dbg

Replace the v4l2 debug helpers with the device debug once, which are
preferred.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
media: bcm2712: Remove of_match_ptr()

The of_match_ptr() usage could cause a compiler warning if
CONFIG_OF is not enabled, as the pispbe_of_match variable would
result unused.

As the of_match_table field of struct platform_driver exists
unconditionally, drop of_match_ptr() to avoid a warning.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
drivers: media: pispbe: Add local config buffer DMA allocation

When initialiasing the driver, allocate a number of tiles + config
structures used for storing hardware config internally in the driver.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
drivers: media: pispbe: Use local config buffers

Store a copy of the config + tiles buffer locally when the buffer gets
queued. This resolves the security issue where a userland process may
modify the config buffer after it has been queued.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
drivers: media: pispbe: Validate config buffers

Perform a basic config validation on the device output nodes to ensure
the buffer size and stride values do not result in a buffer overrun.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
media: bcm2712: Rework probe sequence order

Rework the probe sequence to:
1) Use dev_err_probe() when failing to get clocks
2) Disable clock on error path
3) Disable the node groups if they have been enabled and
   propagate the error up

Also disable clocks in the remove() function.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
media: bcm2712: Use pm_runtime_ops

Introduce usage of runtime resume and suspend operations.

The diver only uses a single clock source which is enable/disabled
at resume and suspend time.

Implement file open and release operations to control enablement of
the clock provider.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
media: bcm2712: Demote info message

Demote info message about clock enablement to dev_dbg()

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
media: bcm2712: Move pm_runtime calls to streamon/streamoff

Move the calls to pm_runtime_resume_and_get() and pm_runtime_put()
to the streamon and streamoff ioctl handlers.

Remove custom handlers for the open and close file operations and use
the framework provided helpers.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
media: bcm2712: Use pm_runtime_autosuspend()

Use the _autosuspend() version of runtime_pm_put() in order to avoid
resuming and suspending the peripheral in between streaming sessions
closely apart one from the other.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
drivers: media: pisp_be: Conditionally check buffers when preparing jobs

When preparing a job, check the global enables in the config structure
to see if the Output0/1, Tdn and Stitch blocks are enabled, and only
test for a buffer queued if they are.

This will allow userland to control the outputs selectively without
disabling/re-enabling the respective device nodes.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
media: bcm2712: Rework media controller registration

The current implementation register the v4l2_device and the video
devices first, then creates the media controller and manually registers
entities there.

Rework the registration procedure to first create the v4l2_device and
register the media_device with it. Then create the video nodes which
gets automatically registered in the media graph by the core.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
media: bcm2712: Create v4l2_subdev for ISP entity

Create a v4l2 subdevice to represent the PISPBE ISP entity.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
media: bcm2712: Fix v4l2-compliance warn on QUERYCAP

Fix:

warn: v4l2-compliance.cpp(669): media bus_info
'platform:1000880000.pisp_be' differs from V4L2 bus_info
'platform:pispbe'

by populating the driver caps bus_info by using dev_name().

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
media: bcm2712: Fix v4l2-compliance warn on invalid pixfmt

The V4L2 API for the TRY_FMT/S_FMT ioctl allows the ioctl handler to
return an error code only in specific conditions. If an invalid pixel
format is supplied it should be adjusted instead of an error being
returned.

Albeit, v4l2-compliance treats this situation as a warning and not as
an error because the behaviour has been discussed in length in the past.

warn: v4l2-test-formats.cpp(794): TRY_FMT cannot handle an invalid pixelformat.
warn: v4l2-test-formats.cpp(795): This may or may not be a problem. For more information see:
warn: v4l2-test-formats.cpp(796): http://www.mail-archive.com/linux-media@vger.kernel.org/msg56550.html
VIDIOC_TRY_FMT returned -1 (Invalid argument)

Regardless of the warning vs failure decision, adjust the try_format()
function implementation to use V4L2_PIX_FMT_YUV420M as default pixel
format if the supplied one is invalid.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
media: bcm2712: Fix v4l2-compliance warn on HOG pix format

The try_format() implementation for the HOG video device node returns
an error if the supplied pixel format is not correct.

As per the video device output and capture video nodes, this contradicts
the V4L2 specification even if it is treated as a warning by
v4l2-compliance.

Fix this by forcing the buffer pixel format and size to the default
supported one. While at here, use the BIT() macro in the format
initialization function.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
media: bcm2712: Fix formats enumeration

Right now a single implementation of enum_fmt() is used for all nodes
in a group. This means that all the BE supported formats are listed for
all the nodes. This is incorrect as the meta capture and output node
formats should be restricted, and the meta formats should not be
enumerated for video output and capture devices.

Fix this by restricting the enumeration of META formats to the config
and hog nodes. Split out from the list of supported_formats the
V4L2_META_FMT_RPI_BE_CFG which is only used for the meta_out node, while
V4L2_PIX_FMT_RPI_BE is kept in the list of supported_formats as it can
be used as an opaque format for both meta_cap, video_cap and video_out
nodes.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
media: bcm2712: Minor fixes to support PiSP regression tests

Allow RGB input, not just Bayer (but only of those at once);
Allow Wallpaper image formats. XXX They are not yet size-checked;
Set "chicken bits" to test BURST_TRIM and AXI AWID/BID variation.
Convert some v4l2_err() to dev_err()

Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
drivers: media: pisp_be: Use the maximum number of config buffers

Set PISP_BE_NUM_CONFIG_BUFFERS the the maximum number of possible
buffers.  In the worst case, this overallocates config buffers, but
given their size, it's not too much of a problem.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
media: pisp_be: Fix extra PM runtime put

vidioc_streamoff callback can be called even if vidioc_streamon was
never called. The driver currently does PM runtime get/put in these
callbacks, which may lead to a put without a matching get.

Fix this by moving the PM runtime get/put to vb2_ops's start_streaming &
stop_streaming, which the framework makes sure won't get extra calls.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
drivers: media: pisp_be: Don't report V4L2_PIX_FMT_RPI_BE format

This is an internal opaque format, not to be reported in enum_fmt.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
4 months agosdhci: Add SD Express hook
Phil Elwell [Tue, 6 Jul 2021 08:45:36 +0000 (09:45 +0100)]
sdhci: Add SD Express hook

sdhci: remove PYA0_INTR_BUG quirk. Add quirks to disable some of the higher SDR speeds at 1.8v.

4 months agommc: brcmstb: add support for BCM2712
Ulf Hansson [Thu, 29 Oct 2020 01:57:16 +0000 (09:57 +0800)]
mmc: brcmstb: add support for BCM2712

BCM2712 has an SD Express capable SDHCI implementation and uses
the SDIO CFG register block present on other STB chips.

Add plumbing for SD Express handover and BCM2712-specific functions.

Due to the common bus infrastructure between BCM2711 and BCM2712,
the driver also needs to implement 32-bit IO accessors.

mmc: brcmstb: override card presence if broken-cd is set

Not just if the card is declared as nonremovable.

sdhci: brcmstb: align SD express switchover with SD spec v8.00

Part 1 of the Physical specification, figure 3-24, details the switch
sequence for cards initially probed as SD. Add a missing check for DAT2
level after switching VDD2 on.

sdhci: brcmstb: clean up SD Express probe and error handling

Refactor to avoid spurious error messages in dmesg if the requisite SD
Express DT nodes aren't present.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
mmc: sdhci-brcmstb: only use the delay line PHY for tuneable speeds

The MMC core has a 200MHz core clock which allows the use of DDR50 and
below without incremental phase tuning. SDR50/SDR104 and the EMMC HS200
speeds require tuning.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
4 months agovc4/fkms: Remove use of SMI peripheral
Dom Cobley [Thu, 1 Jul 2021 18:21:10 +0000 (19:21 +0100)]
vc4/fkms: Remove use of SMI peripheral

4 months agopinctrl: bcm2712 pinctrl/pinconf driver
Phil Elwell [Wed, 9 Jun 2021 14:48:28 +0000 (15:48 +0100)]
pinctrl: bcm2712 pinctrl/pinconf driver

pinctrl: bcm2712: Reject invalid pulls

Reject attempts to set pulls on aon-sgpios, and fix pull shift
values.

pinctrl: bcm2712: Add 7712 support, fix 2712 count

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
pinctrl-bcm2712: add EMMC pins so pulls can be set

These pins have pad controls but not mux controls. They look enough like
GPIOs to squeeze in at the end of the list though.

pinctrl: bcm2712: correct BCM2712C0 AON_GPIO pad pull control offset

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
pinctrl: bcm2712: on C0 the regular GPIO pad control register moves too

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
pinctrl: bcm2712: Implement (partially) pinconf_get

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
pinctrl: bcm2712: Convert to generic pinconf

Remove the legacy brcm,* pin configuration support and replace it with
a proper generic pinconf interface, using named functions instead of
alt function numbers. This is nicer for users, less error-prone, and
immune to some of the C0->D0 changes.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
pinctrl: bcm2712: Remove vestigial pull parameter

Now the legacy brcm, pinconf parameters are no longer supported, this
custom pin config parameter is not needed.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
pinctrl: bcm2712: Guard against bad func numbers

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
pinctrl: bcm2712: A better attempt at D0 support

The BCM2712D0 sparse pinctrl maps play havoc with the old GPIO_REGS
macro, so make the bit positions explicit. And delete the unwanted
GPIO and pinmux declarations on D0.

Note that a Pi 5 with D0 requires a separate DTS file with "bcm2712d0"
compatible strings.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
pinctrl: bcm2712: Delete base register constants

BCM2712D0 deletes many GPIOs and their associated mux and pad bits,
so much so that the offsets to the start of the pad control registers
changes. Remove the constant offsets from the *GPIO_REGS macros,
compensating by adjusting the per-GPIO values.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 months agoAllow RESET_BRCMSTB on ARCH_BCM2835
Phil Elwell [Thu, 27 May 2021 10:46:30 +0000 (11:46 +0100)]
Allow RESET_BRCMSTB on ARCH_BCM2835

4 months agogpio_brcmstb: Allow to build for ARCH_BCM2835
Dom Cobley [Fri, 21 May 2021 11:33:38 +0000 (12:33 +0100)]
gpio_brcmstb: Allow to build for ARCH_BCM2835

gpio-brcmstb: Report the correct bank width

gpio: brcmstb: Use bank address as gpiochip label

If the path to the device node is used as gpiochip label then
gpio-brcmstb instances with multiple banks end up with duplicated
names. Instead, use a combination of the driver name with the physical
address of the bank, which is both unique and helpful for devmem
debugging.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
gpio: mmio: Add DIRECT mode for shared access

The generic MMIO GPIO library uses shadow registers for efficiency,
but this breaks attempts by raspi-gpio to change other GPIOs in the
same bank. Add a DIRECT mode that makes fewer assumptions about the
existing register contents, but note that genuinely simultaneous
accesses are likely to lose updates.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
gpio: brcmstb: Don't always clear interrupt mask

If the GPIO controller is not being used as an interrupt source
leave the interrupt mask register alone. On BCM2712 it might be used
to generate interrupts to the VPU firmware, and on other devices it
doesn't matter since no interrupts will be generated.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 months agobcm2708_fb: Hack out dma support
popcornmix [Thu, 24 Sep 2020 19:13:08 +0000 (20:13 +0100)]
bcm2708_fb: Hack out dma support

4 months agodrivers: char: delete bcm2835-gpiomem
Jonathan Bell [Wed, 26 Apr 2023 12:44:15 +0000 (13:44 +0100)]
drivers: char: delete bcm2835-gpiomem

This functionality is now provided by raspberrypi-gpiomem.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
4 months agodefconfigs: Add RASPBERRYPI_GPIOMEM as a module
Dave Stevenson [Thu, 28 Sep 2023 16:12:37 +0000 (17:12 +0100)]
defconfigs: Add RASPBERRYPI_GPIOMEM as a module

This wants to be merged before
"drivers: char: delete bcm2835-gpiomem"

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agodrivers: char: add generic gpiomem driver
Jonathan Bell [Tue, 25 Apr 2023 14:52:13 +0000 (15:52 +0100)]
drivers: char: add generic gpiomem driver

Based on bcm2835-gpiomem.

We allow export of the "GPIO registers" to userspace via a chardev as
this allows for finer access control (e.g. users must be group gpio, root
not required).

This driver allows access to either rp1-gpiomem or gpiomem, depending on
which nodes are populated in devicetree.

RP1 has a different look-and-feel to BCM283x SoCs as it has split ranges
for IO controls and the parallel registered OE/IN/OUT access. To handle
this, the driver concatenates the ranges for an IO bank and the
corresponding RIO instance into a contiguous buffer.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
4 months agoRevert "usb: phy: generic: Get the vbus supply"
Dom Cobley [Mon, 23 May 2022 15:56:44 +0000 (16:56 +0100)]
Revert "usb: phy: generic: Get the vbus supply"

This reverts commit c0ea202fbc855d60bc4a0603ca52a9e80654b327.

4 months agooverlays: Add a sample hat_map
Phil Elwell [Tue, 19 Sep 2023 19:31:34 +0000 (20:31 +0100)]
overlays: Add a sample hat_map

The HAT map is way of associating named overlays with HATs whose
EEPROMs were programmed with the contents of the overlay.
Unfortunately, change in the DT and kernel drivers has meant that some
of these embedded overlays no longer function, or even don't apply.

The HAT map is a mapping from HAT UUIDs to overlay names. If a HAT with
a listed UUID is detected, the embedded overlay is ignored and the
overlay named in the mapping is loaded in its place.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 months agomedia: i2c: imx219: fix binning and rate_factor for 480p and 1232p
Vinay Varma [Fri, 22 Sep 2023 17:17:42 +0000 (18:17 +0100)]
media: i2c: imx219: fix binning and rate_factor for 480p and 1232p

At a high FPS with RAW10, there is frame corruption for 480p because the
rate_factor of 2 is used with the normal 2x2 bining [1]. This commit
ties the rate_factor to the selected binning mode. For the 480p mode,
analog 2x2 binning mode with a rate_factor of 2 is always used. For the
1232p mode the normal 2x2 binning mode is used for RAW10 while analog
2x2 binning mode is used for RAW8.

[1] raspberrypi#5493

Signed-off-by: Vinay Varma <varmavinaym@gmail.com>
Reworked due to upstream changes
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agomedia: i2c: imx219: Scale the pixel clock rate for the 640x480 mode
Naushir Patuck [Tue, 8 Feb 2022 13:49:11 +0000 (13:49 +0000)]
media: i2c: imx219: Scale the pixel clock rate for the 640x480 mode

The 640x480 mode uses a special binning mode for high framerate operation where
the pixel rate is effectively doubled. Account for this when setting up the
pixel clock rate, and applying the vblank and exposure controls.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
4 months agomedia: imx219: Advertise embedded data node on media pad 1
Naushir Patuck [Fri, 10 Mar 2023 17:43:57 +0000 (17:43 +0000)]
media: imx219: Advertise embedded data node on media pad 1

This commit updates the imx219 driver to adverise support for embedded
data streams.  This can then be used by the bcm2835-unicam driver, which
has recently been updated to expose the embedded data stream to
userland.

The imx219 sensor subdevice overloads the media pad to differentiate
between image stream (pad 0) and embedded data stream (pad 1) when
performing the v4l2_subdev_pad_ops functions.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agomedia: i2c: imx219: make HBLANK r/w to allow longer exposures
Dave Stevenson [Thu, 14 Sep 2023 11:23:05 +0000 (12:23 +0100)]
media: i2c: imx219: make HBLANK r/w to allow longer exposures

The HBLANK control was read-only, and always configured such
that the sensor HTS register was 3448. This limited the maximum
exposure time that could be achieved to around 1.26 secs.

Make HBLANK read/write so that the line time can be extended,
and thereby allow longer exposures (and slower frame rates).
Retain the overall HTS setting when changing modes rather than
resetting it to a default.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agooverlays: Correct for #pwm-cells = 3
Phil Elwell [Mon, 18 Sep 2023 15:39:33 +0000 (16:39 +0100)]
overlays: Correct for #pwm-cells = 3

An upstream commit changed #pwm-cells for the BCM2835 PWMs to 3, so as
to accomodate the polarity. Add a zero to all references to the PWMs
to indicate normal polarity.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 months agoconfigs: Regenerate the defconfigs
Phil Elwell [Thu, 14 Sep 2023 10:39:45 +0000 (11:39 +0100)]
configs: Regenerate the defconfigs

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 months 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 months agoconfigs: Switch CONFIG_EMBEDDED to CONFIG_EXPERT
Dom Cobley [Wed, 13 Sep 2023 18:54:04 +0000 (19:54 +0100)]
configs: Switch CONFIG_EMBEDDED to CONFIG_EXPERT

4 months agoRevert "configs: Regenerate with CONFIG_MEDIA_SUPPORT_FILTER unset"
Dom Cobley [Wed, 13 Sep 2023 18:33:36 +0000 (19:33 +0100)]
Revert "configs: Regenerate with CONFIG_MEDIA_SUPPORT_FILTER unset"

This reverts commit 712b18d20c72f28acb25d4e3a508548453779582.

4 months agobcm2835-unicam: hacks to allow it to build
Dom Cobley [Wed, 13 Sep 2023 17:53:21 +0000 (18:53 +0100)]
bcm2835-unicam: hacks to allow it to build

media: bcm2835-unicam: Fix up async notifier usage

Fixes "8a090fc3e549 bcm2835-unicam: hacks to allow it to build"

4 months agoconfigs: Regenerate with CONFIG_MEDIA_SUPPORT_FILTER unset
Dom Cobley [Wed, 13 Sep 2023 17:52:41 +0000 (18:52 +0100)]
configs: Regenerate with CONFIG_MEDIA_SUPPORT_FILTER unset

Required to enable MEDIA options like CONFIG_VIDEO_RPIVID

4 months agoRevert "drivers: char: add chardev for mmap'ing the RPiVid control registers"
Dom Cobley [Wed, 13 Sep 2023 17:06:19 +0000 (18:06 +0100)]
Revert "drivers: char: add chardev for mmap'ing the RPiVid control registers"

This reverts commit 239b2f31fe443adfaf7f3d4b9eb7786b455b9b75.

4 months agoinput: ads7846: Add missing spi_device_id strings
Dave Stevenson [Fri, 1 Sep 2023 11:23:30 +0000 (12:23 +0100)]
input: ads7846: Add missing spi_device_id strings

The SPI core logs error messages if a compatible string device
name is not also present as an spi_device_id.

No spi_device_id values are specified by the driver, therefore
we get 4 log lines every time it is loaded:
SPI driver ads7846 has no spi_device_id for ti,tsc2046
SPI driver ads7846 has no spi_device_id for ti,ads7843
SPI driver ads7846 has no spi_device_id for ti,ads7845
SPI driver ads7846 has no spi_device_id for ti,ads7873

Add the spi_device_id values for these devices.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agodrm/ili9486: Resolve clash in spi_device_id names
Dave Stevenson [Fri, 1 Sep 2023 11:17:38 +0000 (12:17 +0100)]
drm/ili9486: Resolve clash in spi_device_id names

For "Really Good Reasons" [1] the SPI core requires a match
between compatible device strings and the name in spi_device_id.

The ili9486 driver uses compatible strings "waveshare,rpi-lcd-35"
and "ozzmaker,piscreen", but "rpi-lcd-35" and "piscreen" are missing,
so add them.

Compatible string "ilitek,ili9486" is already used by
staging/fbtft/fb_ili9486, therefore leaving it present in ili9486 as an
spi_device_id causes the incorrect module to be loaded, therefore remove
this id.

[1] https://elixir.bootlin.com/linux/latest/source/drivers/spi/spi.c#L487

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agodrivers: media: imx296: Updated imx296 driver for external trigger
Ben Benson [Fri, 21 Jul 2023 14:59:51 +0000 (15:59 +0100)]
drivers: media: imx296: Updated imx296 driver for external trigger

Updated imx296 driver to support external trigger mode via XTR pin.
Added module parameter to control this mode.

Signed-off-by: Ben Benson <ben.benson@raspberrypi.com>
4 months agodrivers: media: imx296: Add standby delay during probe
Naushir Patuck [Fri, 28 Jul 2023 11:00:40 +0000 (12:00 +0100)]
drivers: media: imx296: Add standby delay during probe

Add a 2-5ms delay when coming out of standby and before reading the
sensor info register durning probe, as instructed by the datasheet. This
standby delay is already present when the sensor starts streaming.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
4 months agocfg80211: ship debian certificates as hex files
Nicolai Buchwitz [Wed, 12 Jul 2023 09:30:42 +0000 (11:30 +0200)]
cfg80211: ship debian certificates as hex files

Loading the regulatory database from the debian files fails with

"loaded regulatory.db is malformed or signature is missing/invalid"

due to missing certificates.  Add these debian-specific certificates
from upstream to fix this error. See #5536 for details.

The certificates have been imported as following:

patch -p1 <<<$(
curl https://salsa.debian.org/kernel-team/linux/-/raw/\
master/debian/patches/debian/\
wireless-add-debian-wireless-regdb-certificates.patch
)

Signed-off-by: Nicolai Buchwitz <n.buchwitz@kunbus.com>
4 months agousb: xhci: add XHCI_VLI_HUB_TT_QUIRK
Jonathan Bell [Thu, 1 Dec 2022 16:59:44 +0000 (16:59 +0000)]
usb: xhci: add XHCI_VLI_HUB_TT_QUIRK

The integrated USB2.0 hub in the VL805 chipset has a bug where it
incorrectly determines the remaining available frame time before the
host next sends a SOF packet with an incremented frame_number.

See the USB2.0 specification sections 11.3 and 11.14.2.3.

The hub's non-periodic TT handler can transmit the IN/OUT handshake
token too late, so a following 64-byte DATA0/1 packet causes the ACK
handshake to collide with the propagated SOF. This causes port babble.

Avoid ringing doorbells for vulnerable endpoints during uFrame 7 if the
TR is Idle to stop one source of babble. An IN transfer for a Running TR
may happen at any time, so there's not much we can do about that.

Ideally a hub firmware update to properly implement frame timeouts is
needed, and to avoid spinning for up to 125us when submitting TDs to
Idle rings.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
xhci: constrain XHCI_VLI_HUB_TT_QUIRK to old firmware versions

VLI have a firmware update for the VL805 which resolves the incorrect
frame time calculation in the hub's TT. Limit applying the quirk to
known-bad firmwares.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
4 months agousb: xhci: add VLI_SS_BULK_OUT_BUG quirk
Jonathan Bell [Thu, 8 Sep 2022 14:50:15 +0000 (15:50 +0100)]
usb: xhci: add VLI_SS_BULK_OUT_BUG quirk

The VL805 can cause data corruption if a SS Bulk OUT endpoint enters a
flow-control condition and there are TRBs in the transfer ring that are
not an integral size of wMaxPacket and the endpoint is behind one or more
hubs.

This is frequently the case encountered when FAT32 filesystems are
present on mass-storage devices with cluster sizes of 1 sector, and the
filesystem is being written to with an aggregate of small files.

The initial implementation of this quirk separated TRBs that didn't
adhere to this limitation into two - the first a multiple of wMaxPacket
and the second the 512-byte remainder - in an attempt to force TD
fragments to align with packet boundaries. This reduced the incidence
rate of data corruption but did not resolve it.

The fix as recommended by VIA is to disable bursts if this sequence of
TRBs can occur.

Limit turning off bursts to just USB mass-storage devices by searching
the device's configuration for an interface with a class type of
USB_CLASS_MASS_STORAGE.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
4 months agousb: xhci: borrow upstream TRB_FETCH quirk on VL805 hosts
Jonathan Bell [Thu, 13 Jul 2023 14:06:54 +0000 (15:06 +0100)]
usb: xhci: borrow upstream TRB_FETCH quirk on VL805 hosts

This reimplements 5a57342 usb: xhci: add VLI_TRB_CACHE_BUG quirk

The downstream implementation required a fair bit of driver surgery to
allow for truncated ring segments, which needed to shrink by a small
amount to avoid the cache prefetcher from reading off the end of one
segment and into another.

An upstream implementation for a similar bug on a different controller
just doubles the size of the memory allocated for ring segments, which
is a bit more wasteful (+4K per allocation) but means less code churn.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
4 months agoxhci: quirks: add link TRB quirk for VL805
Jonathan Bell [Mon, 26 Oct 2020 14:03:35 +0000 (14:03 +0000)]
xhci: quirks: add link TRB quirk for VL805

The VL805 controller can't cope with the TR Dequeue Pointer for an endpoint
being set to a Link TRB. The hardware-maintained endpoint context ends up
stuck at the address of the Link TRB, leading to erroneous ring expansion
events whenever the enqueue pointer wraps to the dequeue position.

If the search for the end of the current TD and ring cycle state lands on
a Link TRB, move to the next segment.

Link: https://github.com/raspberrypi/linux/issues/3919
[6.5.y Fixup - move downstream quirk bits further along]

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
4 months agoxhci: Use more event ring segment table entries
Jonathan Bell [Thu, 13 Jul 2023 13:43:21 +0000 (14:43 +0100)]
xhci: Use more event ring segment table entries

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

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

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
4 months agomedia: i2c: arducam_64mp: Add PDAF support
Lee Jackson [Tue, 30 May 2023 07:50:05 +0000 (15:50 +0800)]
media: i2c: arducam_64mp: Add PDAF support

Enable PDAF output for all modes, and also need to modify Embedded Line
Width to 11560 * 3 (two lines of Embedded Data + one line of PDAF).

Signed-off-by: Lee Jackson <lee.jackson@arducam.com>
4 months agomedia: i2c: arducam_64mp: Add 8000x6000 resolution
Lee Jackson [Fri, 5 May 2023 06:36:15 +0000 (14:36 +0800)]
media: i2c: arducam_64mp: Add 8000x6000 resolution

Added 8000x6000 10-bit (cropped) @ 3fps mode for Arducam 64MP

Signed-off-by: Lee Jackson <lee.jackson@arducam.com>
4 months agomedia: i2c: arducam_64mp: Modify the line length of 1280x720 resolution
Lee Jackson [Thu, 4 May 2023 03:14:04 +0000 (11:14 +0800)]
media: i2c: arducam_64mp: Modify the line length of 1280x720 resolution

Arducam 64MP has specific requirements for the line length, and if these
conditions are not met, the camera will not function properly. Under the
previous configuration, once a stream off operation is performed, the
camera will not output any data, even if a stream on operation is
performed. This prevents us from switching from 1280x720 to another
resolution.

Signed-off-by: Lee Jackson <lee.jackson@arducam.com>
4 months agodriver: media: i2c: imx477: Re-enable temperature sensor
Naushir Patuck [Wed, 21 Jun 2023 07:45:02 +0000 (08:45 +0100)]
driver: media: i2c: imx477: Re-enable temperature sensor

The temperature sensor enable register write got lost at some point.
Re-enable it.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
4 months agodrivers: media: bcm2835_unicam: Improve frame sequence count handling
Naushir Patuck [Fri, 16 Jun 2023 15:24:19 +0000 (16:24 +0100)]
drivers: media: bcm2835_unicam: Improve frame sequence count handling

Ensure that the frame sequence counter is incremented only if a previous
frame start interrupt has occurred, or a frame start + frame end has
occurred simultaneously.

This corresponds the sequence number with the actual number of frames
produced by the sensor, not the number of frame buffers dequeued back
to userland.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
4 months agoserial: sc16is7xx: Read modem line state at startup
Phil Elwell [Tue, 13 Jun 2023 15:12:54 +0000 (16:12 +0100)]
serial: sc16is7xx: Read modem line state at startup

This patch sets the driver modem line state to the actual line state
at driver startup.

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

Signed-off-by: Earl Schmidt <schmidt.earl.f@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 months agopanel-sitronix-st7701: Fix panel prepare over SPI
Jack Andersen [Fri, 26 May 2023 19:19:19 +0000 (12:19 -0700)]
panel-sitronix-st7701: Fix panel prepare over SPI

A DSI write is issued in st7701_prepare even when the probed panel
runs on SPI. In practice, this results in a panic with the
vc4-kms-dpi-hyperpixel2r overlay active.

Perform the equivalent write over SPI in this case.

Signed-off-by: Jack Andersen <jackoalan@gmail.com>
4 months agodrivers: media: imx296: Disable 2x2 binned mode
Naushir Patuck [Wed, 31 May 2023 14:51:58 +0000 (15:51 +0100)]
drivers: media: imx296: Disable 2x2 binned mode

Disable enumerating and setting of the 2x2 binned mode entirely as it
does not seem to work for either mono or colour sensor variants.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
4 months agopps: Compatibility hack should be X86-specific
Phil Elwell [Mon, 22 May 2023 13:22:55 +0000 (14:22 +0100)]
pps: Compatibility hack should be X86-specific

As of [1], using PPS_FETCH on a 64-bit ARM kernel with a 32-bit userland
is broken, returning a timeout. This is because the requested 4-byte
alignment for struct pps_ktime_compat (illegal on arm64) results in the
timeout flags field being uninitialised.

Make the hack specific to X86_64 builds with CONFIG_COMPAT defined.

[1] commit c2a49fe8eeef ("pps: fix padding issue with PPS_FETCH for
    ioctl_compat")

See: https://github.com/raspberrypi/linux/issues/5430
Fixes: c2a49fe8eeef ("pps: fix padding issue with PPS_FETCH for ioctl_compat")
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 months agoi2c-bcm2835: Implement I2C_M_IGNORE_NAK
Dave Stevenson [Tue, 23 May 2023 13:31:03 +0000 (14:31 +0100)]
i2c-bcm2835: Implement I2C_M_IGNORE_NAK

Now that transfers aren't aborted immediately (and uncleanly) on
errors, and the FIFOs are always drained after all transfers, we
can implement I2C_M_IGNORE_NAK by ignoring the returned error
value.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agoi2c-bcm2835: Do not abort transfers on ERR if still active
Dave Stevenson [Tue, 23 May 2023 13:14:05 +0000 (14:14 +0100)]
i2c-bcm2835: Do not abort transfers on ERR if still active

If a transaction is aborted immediately on ERR being reported,
then the bus is not returned to the STOP condition, and devices
generally get very upset.

Handle the ERR and CLKT conditions only when TA is not set.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agoi2c-bcm2835: Flush FIFOs cleanly on error
Dave Stevenson [Tue, 23 May 2023 13:11:52 +0000 (14:11 +0100)]
i2c-bcm2835: Flush FIFOs cleanly on error

On error condition, note the error return code, but still
handle the FIFOs in the normal way rather than relying on
C_CLEAR flushing everything cleanly.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agodrm/vc4: hdmi: Increase MAI fifo dreq threshold
Dom Cobley [Fri, 21 Apr 2023 21:00:16 +0000 (22:00 +0100)]
drm/vc4: hdmi: Increase MAI fifo dreq threshold

Now we wait for write responses and have a burst
size of 4, we can set the fifo threshold much higher.

Set it to 28 (of the 32 entry size) to keep fifo
fuller and reduce chance of underflow.

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
4 months agospi: bcm2835: Use phys addresses for slave DMA config
Phil Elwell [Thu, 11 May 2023 15:27:06 +0000 (16:27 +0100)]
spi: bcm2835: Use phys addresses for slave DMA config

Contrary to what struct snd_dmaengine_dai_dma_data suggests, the
configuration of addresses of DMA slave interfaces should be done in
CPU physical addresses.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 months agommc: bcm2835: Use phys addresses for slave DMA config
Phil Elwell [Thu, 11 May 2023 15:25:46 +0000 (16:25 +0100)]
mmc: bcm2835: Use phys addresses for slave DMA config

Contrary to what struct snd_dmaengine_dai_dma_data suggests, the
configuration of addresses of DMA slave interfaces should be done in
CPU physical addresses.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 months agodrm/vc4: Use phys addresses for slave DMA config
Phil Elwell [Thu, 11 May 2023 15:08:15 +0000 (16:08 +0100)]
drm/vc4: Use phys addresses for slave DMA config

Slave addresses for DMA are meant to be supplied as physical addresses
(contrary to what struct snd_dmaengine_dai_dma_data does).

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 months agodrm/v3d: New debugfs end-points to query GPU usage stats.
Jose Maria Casanova Crespo [Tue, 7 Feb 2023 12:54:02 +0000 (13:54 +0100)]
drm/v3d: New debugfs end-points to query GPU usage stats.

Two new debugfs interfaces are implemented:

- gpu_usage: exposes the total runtime since boot of each
of the 5 scheduling queues available at V3D (BIN, RENDER,
CSD, TFU, CACHE_CLEAN). So if the interface is queried at
two different points of time the usage percentage of each
of the queues can be calculated.

- gpu_pid_usage: exposes the same information but to the
level of detail of each process using the V3D driver. The
runtime for process using the driver is stored. So the
percentages of usage by PID can be calculated with
measures at different timestamps.

The storage of gpu_pid_usage stats is only done if
the debugfs interface is polled during the last 70 seconds.
If a process does not submit a GPU job during last 70
seconds its stats will also be purged.

Signed-off-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
4 months agomedia: i2c: imx258: Make HFLIP and VFLIP controls writable
Dave Stevenson [Tue, 15 Jun 2021 17:29:52 +0000 (18:29 +0100)]
media: i2c: imx258: Make HFLIP and VFLIP controls writable

The sensor supports H & V flips, but the controls were READ_ONLY.

Note that the Bayer order changes with these flips, therefore
they set the V4L2_CTRL_FLAG_MODIFY_LAYOUT property.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agomedia: i2c: imx258: Change register settings for variants of the sensor
Dave Stevenson [Tue, 21 Jun 2022 13:55:41 +0000 (14:55 +0100)]
media: i2c: imx258: Change register settings for variants of the sensor

Sony have advised that there are variants of the IMX258 sensor which
require slightly different register configuration to the mainline
imx258 driver defaults.

There is no available run-time detection for the variant, so add
configuration via the DT compatible string.

The Vision Components imx258 module supports PDAF, so add the
register differences for that variant

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agodt-bindings: media: imx258: Add alternate compatible strings
Dave Stevenson [Thu, 11 May 2023 14:44:21 +0000 (15:44 +0100)]
dt-bindings: media: imx258: Add alternate compatible strings

There are a number of variants of the imx258 modules that can not
be differentiated at runtime, so add compatible strings for them.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agodt-bindings: media: imx258: Rename to include vendor prefix
Dave Stevenson [Thu, 11 May 2023 14:40:16 +0000 (15:40 +0100)]
dt-bindings: media: imx258: Rename to include vendor prefix

imx258.yaml doesn't include the vendor prefix of sony, so
rename to add it.
Update the id entry and MAINTAINERS to match.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agomedia: i2c: imx258: Support faster pixel rate on binned modes
Dave Stevenson [Fri, 1 Apr 2022 17:56:54 +0000 (18:56 +0100)]
media: i2c: imx258: Support faster pixel rate on binned modes

With the binned modes, there is little point in faithfully
reproducing the horizontal line length of 5352 pixels on the CSI2
bus, and the FIFO between the pixel array and MIPI serialiser
allows us to remove that dependency.

Allow the pixel array to run with the normal settings, with the MIPI
serialiser at half the rate. This requires some additional
information for the link frequency to pixel rate function that
needs to be added to the configuration tables.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agomedia: i2c: imx258: Set pixel_rate range to the same as the value
Dave Stevenson [Fri, 1 Apr 2022 17:54:12 +0000 (18:54 +0100)]
media: i2c: imx258: Set pixel_rate range to the same as the value

With a read only control there is limited point in advertising
a minimum and maximum for the control, so change to set the
value, min, and max all to the selected pixel rate.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agomedia: i2c: imx258: Issue reset before starting streaming
Dave Stevenson [Thu, 31 Mar 2022 16:12:12 +0000 (17:12 +0100)]
media: i2c: imx258: Issue reset before starting streaming

Whilst not documented, register 0x0103 bit 0 is the soft
reset for the sensor, so send it before trying to configure
the sensor.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agomedia: i2c: imx258: Add support for long exposure modes
Dave Stevenson [Thu, 31 Mar 2022 15:45:36 +0000 (16:45 +0100)]
media: i2c: imx258: Add support for long exposure modes

The sensor has a register CIT_LSHIFT which extends the exposure
and frame times by the specified power of 2 for longer
exposure times.

Add support for this by configuring this register via V4L2_CID_VBLANK
and extending the V4L2_CID_EXPOSURE range accordingly.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agomedia: i2c: imx258: Correct max FRM_LENGTH_LINES value
Dave Stevenson [Thu, 31 Mar 2022 14:39:40 +0000 (15:39 +0100)]
media: i2c: imx258: Correct max FRM_LENGTH_LINES value

The data sheet states that the maximum value for registers
0x0340/0x0341 FRM_LENGTH_LINES is 65525(decimal), not the
0xFFFF defined in this driver. Correct this limit.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agomedia: i2c: imx258: Allow configuration of clock lane behaviour
Dave Stevenson [Thu, 31 Mar 2022 14:33:59 +0000 (15:33 +0100)]
media: i2c: imx258: Allow configuration of clock lane behaviour

The sensor supports the clock lane either remaining in HS mode
during frame blanking, or dropping to LP11.

Add configuration of the mode via V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agomedia: i2c: imx258: Add get_selection for pixel array information
Dave Stevenson [Wed, 23 Mar 2022 15:48:49 +0000 (15:48 +0000)]
media: i2c: imx258: Add get_selection for pixel array information

Libcamera requires the cropping information for each mode, so
add this information to the driver.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agomedia: i2c: imx258: Follow normal V4L2 behaviours for clipping exposure
Dave Stevenson [Wed, 16 Jun 2021 16:19:17 +0000 (17:19 +0100)]
media: i2c: imx258: Follow normal V4L2 behaviours for clipping exposure

V4L2 sensor drivers are expected are expected to clip the supported
exposure range based on the VBLANK configured.
IMX258 wasn't doing that as register 0x350 (FRM_LENGTH_CTL)
switches it to a mode where frame length tracks coarse exposure time.

Disable this mode and clip the range for V4L2_CID_EXPOSURE appropriately
based on V4L2_CID_VBLANK.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agomedia: i2c: imx258: Add support for running on 2 CSI data lanes
Dave Stevenson [Wed, 16 Jun 2021 15:27:06 +0000 (16:27 +0100)]
media: i2c: imx258: Add support for running on 2 CSI data lanes

Extends the driver to also support 2 data lanes.
Frame rates are obviously more restricted on 2 lanes, but some
hardware simply hasn't wired more up.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agomedia: i2c: imx258: Add support for 24MHz clock
Dave Stevenson [Wed, 16 Jun 2021 12:08:00 +0000 (13:08 +0100)]
media: i2c: imx258: Add support for 24MHz clock

There's no reason why the clock must be 19.2MHz and nothing
else (indeed this isn't even a frequency listed in the datasheet),
so add support for 24MHz as well.
The PLL settings result in slightly different link frequencies,
so parameterise those.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agomedia: i2c: imx258: Make V4L2_CID_VBLANK configurable.
Dave Stevenson [Tue, 15 Jun 2021 17:56:33 +0000 (18:56 +0100)]
media: i2c: imx258: Make V4L2_CID_VBLANK configurable.

The values and ranges of V4L2_CID_VBLANK are all computed,
so there is no reason for it to be a read only control.
Remove the register values from the mode lists, add the
handler, and remove the read only flag.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agomedia: i2c: imx258: Add regulator control
Dave Stevenson [Tue, 15 Jun 2021 17:45:40 +0000 (18:45 +0100)]
media: i2c: imx258: Add regulator control

The device tree bindings define the relevant regulators for the
sensor, so update the driver to request the regulators and control
them at the appropriate times.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agomedia: i2c: imx258: Remove redundant I2C writes.
Dave Stevenson [Tue, 15 Jun 2021 17:38:46 +0000 (18:38 +0100)]
media: i2c: imx258: Remove redundant I2C writes.

Registers 0x0202 and 0x0203 are written via the control handler
for V4L2_CID_EXPOSURE, so are not needed from the mode lists.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agomedia: i2c: imx258: Disable digital cropping on binned modes
Dave Stevenson [Wed, 30 Mar 2022 13:55:01 +0000 (14:55 +0100)]
media: i2c: imx258: Disable digital cropping on binned modes

The binned modes set DIG_CROP_X_OFFSET and DIG_CROP_IMAGE_WIDTH
to less than the full image, even though the image being captured
is meant to be a scaled version of the full array size.

Reduce X_OFFSET to 0, and increase IMAGE_WIDTH to the full array.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agomedia: i2c: imx258: Make image geometry meet sensor requirements
Dave Stevenson [Tue, 15 Jun 2021 17:34:38 +0000 (18:34 +0100)]
media: i2c: imx258: Make image geometry meet sensor requirements

The output image is defined as being 4208x3118 pixels in size.
Y_ADD_STA register was set to 0, and Y_ADD_END to 3118, giving
3119 lines total.

The datasheet lists a requirement for Y_ADD_STA to be a multiple
of a power of 2 depending on binning/scaling mode (2 for full pixel,
4 for x2-bin/scale, 8 for (x2-bin)+(x2-subsample) or x4-bin, or 16
for (x4-bin)+(x2-subsample)).
(Y_ADD_END – Y_ADD_STA + 1) also has to be a similar power of 2.

The current configuration for the full res modes breaks that second
requirement, and we can't increase Y_ADD_STA to 1 to retain exactly
the same field of view as that then breaks the first requirement.
For the binned modes, they are worse off as 3118 is not a multiple of
4.

Increase the main mode to 4208x3120 so that it is the same FOV as the
binned modes, with Y_ADD_STA at 0.
Fix Y_ADD_STA and Y_ADD_END for the binned modes so that they meet the
sensor requirements.

This does change the Bayer order as the default configuration is for
H&V flips to be enabled, so readout is from Y_STA_END to Y_ADD_STA,
and this patch has changed Y_STA_END.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agomedia: i2c: imx258: Remove unused defines
Dave Stevenson [Tue, 15 Jun 2021 17:18:42 +0000 (18:18 +0100)]
media: i2c: imx258: Remove unused defines

The IMX258_FLL_* defines are unused. Remove them.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agopinctrl: bcm2835: Workaround for edge IRQ loss
Phil Elwell [Fri, 5 May 2023 10:25:48 +0000 (11:25 +0100)]
pinctrl: bcm2835: Workaround for edge IRQ loss

It has been observed that edge events can be lost when GPIO edges occur
close to each other. Investigation suggests this is due to a hardware
bug, although no mechanism has been identified.

Work around the event loss by moving the IRQ acknowledgement into the
main ISR, adding missing events by explicit level-change detection.

See: https://forums.raspberrypi.com/viewtopic.php?t=350295

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 months agoBluetooth: hci_bcm: Add more invalid BDADDRs
Phil Elwell [Thu, 6 Apr 2023 09:38:40 +0000 (10:38 +0100)]
Bluetooth: hci_bcm: Add more invalid BDADDRs

The kernel needs to recognise the default BDADDRs used by the Bluetooth
modems, so add a few more that we care about.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 months agoBluetooth: hci_sync: Add fallback-bd-address prop
Phil Elwell [Tue, 25 Apr 2023 10:49:41 +0000 (11:49 +0100)]
Bluetooth: hci_sync: Add fallback-bd-address prop

The kernel Bluetooth framework understands that devices may not
be programmed with valid Bluetooth addresses. It also has the ability
to override a Bluetooth address with the value of the local-bd-address
DT property, but it ignores the validity of the existing address when
doing so.

Add a new boolean property, fallback-bd-address, which indicates that
the given local-bd-address property should only be used if the device
does not already have a valid BDADDR.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 months agoserial: 8250: Add NOMSI bug for bcm2835aux
Phil Elwell [Mon, 24 Apr 2023 10:48:31 +0000 (11:48 +0100)]
serial: 8250: Add NOMSI bug for bcm2835aux

The BCM2835 mini-UART has no modem status interrupt, causing all
transmission to stop, never to use, if a speed change ever happens
while the CTS signal is high.

Add a simple polling mechanism in order to allow recovery in that
situation.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 months agoinput: goodix: Add option to poll instead of relying on IRQ line
Dave Stevenson [Mon, 30 Jan 2023 14:46:16 +0000 (14:46 +0000)]
input: goodix: Add option to poll instead of relying on IRQ line

The interrupt line from the touch controller is not necessarily
connected to the SoC, so add the option to poll for touch info.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agodrm/panel: Add panel driver for Waveshare DSI touchscreens
Dave Stevenson [Fri, 14 Apr 2023 12:50:08 +0000 (13:50 +0100)]
drm/panel: Add panel driver for Waveshare DSI touchscreens

Waveshare sell a range of DSI panels of varying sizes, all
using a common MCU to control the panel and backlight.

Add a panel driver that supports these panels.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agomedia: bcm2835-unicam: Start and stop media_pipeline with same node
Dave Stevenson [Tue, 28 Mar 2023 12:43:43 +0000 (13:43 +0100)]
media: bcm2835-unicam: Start and stop media_pipeline with same node

media_pipeline_start and media_pipeline_stop now validate that
the pipeline is being started and stopped with the same pipe
and pad handles.
When running with embedded metadata (eg imx477 and imx708), the
start typically happens from the metadata pad, whilst stop is
always from the image pad.

Always pass the image pad to media_pipeline_start to ensure
that the calls are balanced.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 months agodrives: media: imx708: Put HFLIP and VFLIP controls in a cluster
Naushir Patuck [Fri, 31 Mar 2023 11:02:09 +0000 (12:02 +0100)]
drives: media: imx708: Put HFLIP and VFLIP controls in a cluster

Create a cluster for the HVLIP and VFLIP controls so they are treated
as a single composite control.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
4 months agodrivers: media: imx708: Follow the standard devicetree labels
Naushir Patuck [Fri, 31 Mar 2023 14:05:33 +0000 (15:05 +0100)]
drivers: media: imx708: Follow the standard devicetree labels

Switch the system clock name from "xclk" to "inclk".
Use lower case lables for all regulator names.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>