Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

media: bcm2835-unicam: call pad ops with active/try states #5807

Open
wants to merge 715 commits into
base: rpi-6.7.y
Choose a base branch
from

Conversation

vvarma
Copy link
Contributor

@vvarma vvarma commented Dec 23, 2023

subdev drivers that use the v4l2-core for for state management, need the same active/try state passed in for the pad ops.

naushir and others added 30 commits December 19, 2023 13:40
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>
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>
This patch sets the driver modem line state to the actual line state
at driver startup.

See: raspberrypi#5501

Signed-off-by: Earl Schmidt <schmidt.earl.f@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
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>
The temperature sensor enable register write got lost at some point.
Re-enable it.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
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>
Added 8000x6000 10-bit (cropped) @ 3fps mode for Arducam 64MP

Signed-off-by: Lee Jackson <lee.jackson@arducam.com>
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>
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: raspberrypi#3919

[6.5.y Fixup - move downstream quirk bits further along]

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
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>
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>
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>
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 raspberrypi#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>
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>
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>
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>
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>
media: bcm2835-unicam: Fix up async notifier usage

Fixes "8a090fc3e549 bcm2835-unicam: hacks to allow it to build"
Signed-off-by: Phil Howard <phil@pimoroni.com>
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>
This functionality is now provided by raspberrypi-gpiomem.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
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>
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>
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>
sdhci: remove PYA0_INTR_BUG quirk. Add quirks to disable some of the higher SDR speeds at 1.8v.
… 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>

drivers: media: pisp_be: Add back V4L2_PIX_FMT_RPI_BE format

Add the opaque V4L2_PIX_FMT_RPI_BE format back to the format list as it
is needed for the verification test suite. Also set the default format
to YUV420 non-multiplanar.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
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>
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>
pelwell and others added 15 commits December 19, 2023 13:41
Newer kernels expect PWM references to include a polarity value as the
third parameter.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Increase #pwm-cells to 3 to allow for the extra polarity word.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
The Pi 400 only has one user-accessible LED (green), which is intended
to be used as a power indication. Therefore there is no activity LED.
However, a user may wish to remap the activity LED functionality to a
GPIO in the 40-way header, so preserve the led-act node in a disabled
state.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
In 6.7 the labels on the LEDs have changed from xxx_led to led_xxx.
Update the Pi 5 DTS to match, otherwise the act-led overlay does not
apply.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
The logging timestamps depend on the existence of a bcm2835-system-timer
node. If this node doesn't exist, leave the logging disabled rather than
crashing.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Replace "Broadcom BCM2835 GPIO" with "Broadcom BCM2712 PINCONF"
in the help message. This work was sponsored by GOVCERT.LU.

Signed-off-by: Leon Anavi <leon.anavi@konsulko.com>
See: raspberrypi#5786

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
…isplay is abnormal

Fixed the screen stays white when the user restarts or shuts down

Signed-off-by: eng33 <eng33@waveshare.com>
Pi 5 uses BL31 as its armstub file, so the reset goes via PSCI. Parse
any "reboot" parameter as a partition number to reboot into.
N.B. This code path is only used if reboot mode has been set to warm
or soft.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Switch to warm reboot mode so that the partition number is preserved.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Set snps,parkmode-disable-ss-quirk for usb0 and usb1.

Enabling this test/debug feature seems to prevent controller lockups
with bidirectional SS bulk endpoints active.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
Don't assume the camera has been reset each time we start streaming,
but always write registers relating to trigger_mode, even in mode 0.

IMX477: Stop driving XVS on stop streaming, to avoid spurious pulses.

Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
Leave the camera's power supplies up, to prevent the camera
clamping its 1.8V digital I/Os to ground. This may be useful
when synchronizing multiple camera systems using XVS or XTRIG.

Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
snprintf takes the length of the array that we can print into,
and has to fit the NULL terminator in there too.
Printing the prefix is generally "12-3456 " which is 8 desired
characters (the length of EDT_NAME_PREFIX_LEN) and the NULL.
The space is therefore being truncated to fit the NULL in.

Increase the length snprintf is allowed to use.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
This change removes the subdev state management at the driver
level for the bcm2835 unicam driver to instead opt for the v4l2-core's
state management.

Signed-off-by: Vinay Varma <varmavinaym@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet