-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Adding support for PTP on RPI 3B+ #5243
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
Closed
tiagofreire-pt
wants to merge
10,000
commits into
raspberrypi:rpi-5.15.y
from
tiagofreire-pt:patch-2
Closed
Adding support for PTP on RPI 3B+ #5243
tiagofreire-pt
wants to merge
10,000
commits into
raspberrypi:rpi-5.15.y
from
tiagofreire-pt:patch-2
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When symbols from overlays are added to the live tree their paths must be rebased. The translated symbol is normally the result of joining the fragment-relative path (with a leading "/") to the target path (either copied directly from the "target-path" property or resolved from the phandle). This translation fails when the target is the root node (a common case for Raspberry Pi overlays) because the resulting path starts with a double slash. For example, if target-path is "/" and the fragment adds a node called "newnode", the label associated with that node will be assigned the path "//newnode", which can't be found in the tree. Fix the failure case by explicitly replacing a target path of "/" with an empty string. Fixes: d1651b0 ("of: overlay: add overlay symbols to live device tree") Signed-off-by: Phil Elwell <[email protected]>
The DT bindings description of the Brcmstb PCIe device is described. This node can be used by almost all Broadcom settop box chips, using ARM, ARM64, or MIPS CPU architectures. Signed-off-by: Jim Quinlan <[email protected]>
Possible fixed upstream by 'net: bcmgenet: keep MAC in reset until PHY is up' Signed-off-by: popcornmix <[email protected]>
Some of the Broadcom codec blocks use a column based YUV4:2:0 image format, so add the documentation and defines for both 8 and 10 bit versions. Signed-off-by: Dave Stevenson <[email protected]>
Adds a binding for the HEVC decoder found on the BCM2711 / Raspberry Pi 4. Signed-off-by: Dave Stevenson <[email protected]>
This is probably not the API we will want to add, but it should show what semantics are needed by drivers. The goal is to allow the OUTPUT (aka source) buffer and the controls associated to a request to be released from the request, and in particular return the OUTPUT buffer back to userspace, without signalling the media request fd. This is useful for devices that are able to pre-process the OUTPUT buffer, therefore able to release it before the decoding is finished. These drivers should signal the media request fd only after the CAPTURE buffer is done. Tested-by: John Cox <[email protected]> Signed-off-by: Ezequiel Garcia <[email protected]>
This driver is for the HEVC/H265 decoder block on the Raspberry Pi 4, and conforms to the V4L2 stateless decoder API. Signed-off-by: John Cox <[email protected]> staging: media: rpivid: Select MEDIA_CONTROLLER and MEDIA_CONTROLLER_REQUEST_API MEDIA_CONTROLLER_REQUEST_API is a hidden option. If rpivid depends on it, the user would need to first enable another driver that selects MEDIA_CONTROLLER_REQUEST_API, and only then rpivid would become available. By selecting it instead of depending on it, it becomes possible to enable rpivid without having to enable other potentially unnecessary drivers. Signed-off-by: Hristo Venev <[email protected]> rpivid_h265: Fix width/height typo Signed-off-by: popcornmix <[email protected]> rpivid_h625: Fix build warnings Signed-off-by: Phil Elwell <[email protected]> staging: rpivid: Fix crash when CMA alloc fails If realloc to increase coeff size fails then attempt to re-allocate the original size. If that also fails then flag a fatal error to abort all further decode. Signed-off-by: John Cox <[email protected]> rpivid: Request maximum hevc clock Query maximum and minimum clock from driver and use those Signed-off-by: Dom Cobley <[email protected]> rpivid: Switch to new clock api Signed-off-by: Dom Cobley <[email protected]> rpivid: Only clk_request_done once Fixes: 25486f4 Signed-off-by: Dom Cobley <[email protected]> media: rpivid: Remove the need to have num_entry_points set VAAPI H265 has num entry points but never sets it. Allow a VAAPI shim to work without requiring rewriting the VAAPI driver. num_entry_points can be calculated from the slice_segment_addr of the next slice so delay processing until we have that. Also includes some minor cosmetics. Signed-off-by: John Cox <[email protected]> media: rpivid: Convert to MPLANE Use multi-planar interface rather than single plane interface. This allows dmabufs holding compressed data to be resized. Signed-off-by: John Cox <[email protected]> media: rpivid: Add an enable count to irq claim Qs Add an enable count to the irq Q structures to allow the irq logic to block further callbacks if resources associated with the irq are not yet available. Signed-off-by: John Cox <[email protected]> media: rpivid: Add a Pass0 to accumulate slices and rework job finish Due to overheads in assembling controls and requests it is worth having the slice assembly phase separate from the h/w pass1 processing. Create a queue to service pass1 rather than have the pass1 finished callback trigger the next slice job. This requires a rework of the logic that splits up the buffer and request done events. This code contains two ways of doing that, we use Ezequiel Garcias <[email protected]> solution, but expect that in the future this will be handled by the framework in a cleaner manner. Fix up the handling of some of the memory exhaustion crashes uncovered in the process of writing this code. Signed-off-by: John Cox <[email protected]> media: rpivid: Map cmd buffer directly It is unnecessary to have a separate dmabuf to hold the cmd buffer. Map it directly from the kmalloc. Signed-off-by: John Cox <[email protected]> media: rpivid: Improve values returned when setting output format Guess a better value for the compressed bitstream buffer size Signed-off-by: John Cox <[email protected]> media: rpivid: Improve stream_on/off conformance & clock setup Fix stream on & off such that failures leave the driver in the correct state. Ensure that the clock is on when we are streaming and off when all contexts attached to this device have stopped streaming. Signed-off-by: John Cox <[email protected]> media: rpivid: Improve SPS/PPS error handling/validation Move size and width checking from bitstream processing to control validation Signed-off-by: John Cox <[email protected]> media: rpivid: Fix H265 aux ent reuse of the same slot It is legitimate, though unusual, for an aux ent associated with a slot to be selected in phase 0 before a previous selection has been used and released in phase 2. Fix such that if the slot is found to be in use that the aux ent associated with it is reused rather than an new aux ent being created. This fixes a problem where when the first aux ent was released the second was lost track of. This bug spotted in Nick's testing. It may explain some other occasional, unreliable decode error reports where dmesg included "Missing DPB AUX ent" logging. Signed-off-by: John Cox <[email protected]> media: rpivid: Update to compile with new hevc decode params DPB entries have moved from slice params to the new decode params attribute - update to deal with this. Also fixes fallthrough warnings which seem to be new in 5.14. Signed-off-by: John Cox <[email protected]> media: rpivid: Make slice ctrl dynamic Allows the user to submit a whole frames worth of slice headers in one lump along with a single bitstream dmabuf for the whole lot. This saves potentially a lot of bitstream copying. Signed-off-by: John Cox <[email protected]> media: rpivid: Only create aux entries for H265 if needed Only create aux entries of mv info for frames where that info might be used by a later frame. This saves some memory bandwidth and potentially some memory. Signed-off-by: John Cox <[email protected]> media: rpivid: Avoid returning EINVAL to a G_FMT ioctl V4L2 spec says that G/S/TRY_FMT IOCTLs should never return errors for anything other than wrong buffer types. Improve the capture format function such that this is so and unsupported values get converted to supported ones properly. Signed-off-by: John Cox <[email protected]> media: rpivid: Remove unused ctx state variable and defines Remove unused ctx state tracking variable and associated defines. Their presence implies they might be used, but they aren't. Signed-off-by: John Cox <[email protected]> media: rpivid: Ensure IRQs have completed before uniniting context Before uniniting the decode context sync with the IRQ queues to ensure that decode no longer has any buffers in use. This fixes a problem that manifested as ffmpeg leaking CMA buffers when it did a stream off on OUTPUT before CAPTURE, though in reality it was probably much more dangerous than that. Signed-off-by: John Cox <[email protected]> media: rpivid: remove min_buffers_needed from src queue Remove min_buffers_needed=1 from src queue init. Src buffers are bound to media requests therefore this setting is not needed and generates a WARN in kernel 5.16. Signed-off-by: John Cox <[email protected]> rpivid: Use clk_get_max_rate() The driver was using clk_round_rate() to figure out the maximum clock rate that was allowed for the HEVC clock. Since we have a function to return it directly now, let's use it. Signed-off-by: Maxime Ripard <[email protected]> media: rpivid: Apply V4L2 stateless API changes media: rpivid: Fix fallthrough warning Replace old-style /* FALLTHRU */ with fallthrough; Signed-off-by: John Cox <[email protected]> media: rpivid: Set min value as well as max for HEVC_DECODE_MODE As only one value can be accepted set both min and max to that value. Signed-off-by: John Cox <[email protected]> media: rpivid: Accept ANNEX_B start codes Allow the START_CODE control to take ANNEX_B as a value. This makes no difference to any part of the decode process as the added bytes are in data that we ignore. This helps my testing and may help userland code that expects to send those bytes. Signed-off-by: John Cox <[email protected]> rpivid: Convert to new clock rate API Signed-off-by: Maxime Ripard <[email protected]>
Commit f3186dd ("spi: Optionally use GPIO descriptors for CS GPIOs") amended of_spi_parse_dt() to always set SPI_CS_HIGH for SPI slaves whose Chip Select is defined by a "cs-gpios" devicetree property. This change breaks drivers whose probe functions set the mode field of the spi_device because in doing so they clear the SPI_CS_HIGH flag. Fix by setting SPI_CS_HIGH in spi_setup (under the same conditions as in of_spi_parse_dt()). See also: 83b2a8f ("spi: spidev: Fix CS polarity if GPIO descriptors are used") Fixes: f3186dd ("spi: Optionally use GPIO descriptors for CS GPIOs") Signed-off-by: Phil Elwell <[email protected]> SQUASH: spi: Demote SPI_CS_HIGH warning to KERN_DEBUG This warning is unavoidable from a client's perspective and doesn't indicate anything wrong (just surprising). SQUASH with "spi: use_gpio_descriptor fixup moved to spi_setup" Signed-off-by: Phil Elwell <[email protected]>
Add V4L2_META_FMT_SENSOR_DATA format 4CC. This new format will be used by the BCM2835 Unicam device to return out camera sensor embedded data. Signed-off-by: Naushir Patuck <[email protected]>
This patch adds MEDIA_BUS_FMT_SENSOR_DATA used by the bcm2835-unicam driver to support CSI-2 embedded data streams from camera sensors. Signed-off-by: Naushir Patuck <[email protected]>
Add V4L2_META_FMT_BCM2835_ISP_STATS V4L2 format type. This new format will be used by the BCM2835 ISP device to return out ISP statistics for 3A. Signed-off-by: Naushir Patuck <[email protected]>
We are reserving controls for the new bcm2835-isp driver. Signed-off-by: Naushir Patuck <[email protected]>
bcmn2835_isp is a platform driver dependent on vchiq, therefore add the load/unload functions for it to vchiq. Signed-off-by: Naushir Patuck <[email protected]>
BCM2711 has 4 DMA channels with a 40-bit address range, allowing them to access the full 4GB of memory on a Pi 4. Signed-off-by: Phil Elwell <[email protected]>
Signed-off-by: Jacko Dirks <[email protected]>
If the firmware hasn't detected a display, the driver would assume one display was available, but because it had failed to retrieve the display size it would try to allocate a zero-sized buffer. Avoid the allocation failure by bailing out early if no display is found. See: #3598 Signed-off-by: Phil Elwell <[email protected]>
Adds in a couple of new MMAL parameter defines. Signed-off-by: Dave Stevenson <[email protected]>
V4L2 wishes to have the codec header bytes in the same buffer as the first encoded frame, so it does become 1-in 1-out for encoding. The firmware now has an option to do this, so enable it. Signed-off-by: Dave Stevenson <[email protected]>
Enabling zswap support in the kernel configuration costs about 1.5MB of RAM, even when zswap is not enabled at runtime. This cost can be reduced significantly by deferring initialisation (including pool creation) until the "enabled" parameter is set to true. There is a small cost to this in that some initialisation code has to remain in memory after the init phase, just in case they are needed later, but the total size increase is negligible. See: #3432 Signed-off-by: Phil Elwell <[email protected]>
Upstream Linux deems using output GPIOs to generate IRQs as a bogus use case, even though the BCM2835 GPIO controller is capable of doing so. A number of users would like to make use of this facility, so disable the checks. See: #2527 Signed-off-by: Phil Elwell <[email protected]>
The BRCM PCIe block has controls to enable control of the CLKREQ# signal by the L1SS, and to gate the refclk with the CLKREQ# input. These controls are mutually exclusive - the upstream code sets the latter, but some use cases require the former. Add a Device Tree property - brcm,enable-l1ss - to switch to the L1SS configuration. Signed-off-by: Phil Elwell <[email protected]>
Reading data over i2c is done by using i2c_transfer to ensure that this operation can't be interrupted. Signed-off-by: Markus Proeller <[email protected]>
Changed some variable names to comply with checkpatch --strict mode. Debug messages added. Signed-off-by: Markus Proeller <[email protected]>
Instead of changing the exposure and framerate settings for all sequences, they can be changed for every sequence individually now. Therefore the IRS1125_CID_SAFE_RECONFIG ctrl has been removed and replaced by IRS1125_CID_SAFE_RECONFIG_S<seq_num>_EXPO and *_FRAME ctrls. The consistency check in the sequence ctrl IRS1125_CID_SEQ_CONFIG is removed. Signed-off-by: Markus Proeller <[email protected]>
When closing the video device, the irs1125 is put in power down state. To keep V4L2 ctrls and the HW in sync, v4l2_ctrl_handler_setup is called after power up. The compound ctrl IRS1125_CID_MOD_PLL however has a default value of all zeros, which puts the imager into a non responding state. Thus, this ctrl is not written by the driver into HW after power up. The userspace has to take care to write senseful data. Signed-off-by: Markus Proeller <[email protected]>
Allow the nvram file to set a default ccode (regulatory domain) without overriding one set in OTP. Signed-off-by: Phil Elwell <[email protected]>
Add a driver for the Unicam camera receiver block on BCM283x processors. Compared to the bcm2835-camera driver present in staging, this driver handles the Unicam block only (CSI-2 receiver), and doesn't depend on the VC4 firmware running on the VPU. The commit is made up of a series of changes cherry-picked from the rpi-5.4.y branch of https://github.com/raspberrypi/linux/ with additional enhancements, forward-ported to the mainline kernel. Signed-off-by: Dave Stevenson <[email protected]> Signed-off-by: Naushir Patuck <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Reported-by: kbuild test robot <[email protected]>
Signed-off-by: Dave Stevenson <[email protected]> Signed-off-by: Naushir Patuck <[email protected]>
Use the get_mbus_config pad subdev call to allow a source to use fewer than the number of CSI2 lanes defined in device tree. Signed-off-by: Dave Stevenson <[email protected]>
Older gcc versions object to = { 0 } initialisation if the first elemtn in the structure is a substructure. Use = { } to avoid this compiler warning. Signed-off-by: Dave Stevenson <[email protected]>
As a result of [1], DRM_GEM_CMA_HELPER has been replaced by DRM_GEM_CMA_HELPER. [1] 4a83c26 ("drm/gem: rename GEM CMA helpers to GEM DMA helpers") Signed-off-by: Phil Elwell <[email protected]>
Signed-off-by: Phil Elwell <[email protected]>
Signed-off-by: Phil Elwell <[email protected]>
The driver had a number of issues, checkpatch warnings/errors, and other limitations, so fix these up to make it usable. Signed-off-by: Phil Elwell <[email protected]> Signed-off-by: Dave Stevenson <[email protected]>
Signed-off-by: Dom Cobley <[email protected]>
The pointer (struct usb_host_endpoint *)->hcpriv should contain a reference to dwc_otg_qh_t if the driver has already seen a URB submitted to this endpoint. It then checks whether the qh exists and is already in a schedule in order to decide whether to allocate periodic bandwidth or not. Passing a pointer to an offset inside of struct usb_host_endpoint instead of just the pointer means it dereferences bogus addresses. Rationalise (delete) a variable while we're at it. See #5189 Signed-off-by: Jonathan Bell <[email protected]>
The missing 32-bit per pixel ABGR and various "RGB with an X value" formats are added. Change sent by Dave Stevenson. Signed-off-by: David Plowman <[email protected]>
Add support for the Aosong AHT10 temperature and humidity sensor. See: #5222 Signed-off-by: Phil Elwell <[email protected]>
Add support for the Aosong AHT10 temperature and humidity sensor. See: #5222 Signed-off-by: Phil Elwell <[email protected]>
Signed-off-by: Phil Elwell <[email protected]>
Configuring GCC to use task stack protector canaries means it will insert calls to check functions in FIQ code. This is bad, as a) the FIQ's stack is banked and b) the failure invokes __stack_chk_fail which eventually tries to call printk(). Printing to the console inside the FIQ is generally fatal. Add CFLAGS to stop this happening in FIQ code. Also catch one function where notrace wasn't specified. Signed-off-by: Jonathan Bell <[email protected]>
See: #5234 Signed-off-by: Phil Elwell <[email protected]>
The pisound overlay claims a number of GPIOs using a pinctrl node, but for some reason hangs this claim on the main gpio node. This obscures the ownership of the pins (as shown by gpioinfo and in the kernel logs) and isn't scalable - only one overlay can use the trick at a time. Change the overlay to make the pin ownership clear and avoid any future conflicts, removing a bogus claim on pins_spi0 at the same time. See: #5235 Signed-off-by: Phil Elwell <[email protected]>
This reverts commit f43fc13.
A significant number of RaspberryPi drivers using the firmware don't have a phandle to it, so end up scanning the device tree to find a node with the firmware compatible. That code is duplicated everywhere, so let's introduce a helper instead. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Maxime Ripard <[email protected]>
We'll need the clock IDs in more drivers than just the clock driver from now on, so let's move them in the firmware header. Reviewed-by: Florian Fainelli <[email protected]> Acked-by: Stephen Boyd <[email protected]> Signed-off-by: Maxime Ripard <[email protected]>
The firmware allows to query for its clocks the operating range of a given clock. We'll need this for some drivers (KMS, in particular) to infer the state of some configuration options, so let's create a function to do so. Acked-by: Stephen Boyd <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Signed-off-by: Maxime Ripard <[email protected]>
In order to support higher HDMI frequencies, users have to set the hdmi_enable_4kp60 parameter in their config.txt file. We were detecting this so far by calling clk_round_rate() on the core clock with the frequency we're supposed to run at when one of those modes is enabled. Whether or not the parameter was enabled could then be inferred by the returned rate since the maximum clock rate reported by the firmware was one of the side effect of setting that parameter. However, the recent clock rework we did changed what clk_round_rate() was returning to always return the minimum allowed, and thus this test wasn't reliable anymore. Let's use the new clk_get_max_rate() function to reliably determine the maximum rate allowed on that clock and fix the 4k@60Hz output. Fixes: e9d6cea ("clk: bcm: rpi: Run some clocks at the minimum rate allowed") Reviewed-by: Dave Stevenson <[email protected]> Signed-off-by: Maxime Ripard <[email protected]>
In order to support higher HDMI frequencies, users have to set the hdmi_enable_4kp60 parameter in their config.txt file. This will have the side-effect of raising the maximum of the core clock, tied to the HVS, and managed by the HVS driver. However, we are querying this in the HDMI driver by poking into the HVS structure to get our struct clk handle. Let's make this part of the HVS bind implementation to have all the core clock related setup in the same place. Signed-off-by: Maxime Ripard <[email protected]>
At least the 4096x2160@60Hz mode requires some overclocking that isn't available by default, even if hdmi_enable_4kp60 is enabled. Let's add some logic to detect whether we can satisfy the core clock requirements for that mode, and prevent it from being used otherwise. Signed-off-by: Dom Cobley <[email protected]> Reviewed-by: Dave Stevenson <[email protected]> Signed-off-by: Maxime Ripard <[email protected]>
Following the clock rate range improvements to the clock framework, trying to set a disjoint range on a clock will now result in an error. Thus, we can't set a minimum rate higher than the maximum reported by the firmware, or clk_set_min_rate() will fail. Thus we need to clamp the rate we are about to ask for to the maximum rate possible on that clock. Reviewed-by: Dave Stevenson <[email protected]> Signed-off-by: Maxime Ripard <[email protected]>
BCM54213PE is an Ethernet PHY that supports PTP hardware timestamping. BCM54210PW ia another Ethernet PHY, but one without PTP support. Unfortunately the two PHYs return the same ID when queried, so some extra information is required to determine whether the PHY is PTP- capable. There are two Raspberry Pi products that use these PHYs - Pi 4B and CM4 - and fortunately they use different PHY addresses, so use that as a differentiator. Choose to treat a PHY with the same ID but another address as a BCM54210PE, which seems more common. See: #5104 Signed-off-by: Phil Elwell <[email protected]>
See: https://forum.libreelec.tv/thread/24783-tv-avr-turns-back-on-right-after-turning-them-off While the kernel provides a :D flag for assuming device is connected, it doesn't stop this function from being called and generating a cec_phys_addr_invalidate message when hotplug is deasserted. That message provokes a flurry of CEC messages which for many users results in the TV switching back on again and it's very hard to get it to stay switched off. It seems to only occur with an AVR and TV connected but has been observed across a number of manufacturers. The issue started with #4371 and this provides an optional way of getting back the old behaviour Signed-off-by: Dom Cobley <[email protected]>
Delete this PR. |
I don't see the option to delete it - it's Closed, and that's enough. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The PR #4856 added on the lan driver support for
SOF_TIMESTAMPING_TX_SOFTWARE
. Therefore, only kernel modules support is still lacking for full support of PTP (while on software) kernel timestamping.The use case is to allow a stratum-1 PPS disciplined NTP server basic support for PTP and increased accuracy across the LAN, without the need of a kernel compiling effort.