platform/kernel/linux-rpi.git
3 years agodt: Enable DMA_WIDE_SOURCE and DMA_WIDE_DEST for hdmi audio
popcornmix [Mon, 11 Jan 2021 13:06:23 +0000 (13:06 +0000)]
dt: Enable DMA_WIDE_SOURCE and DMA_WIDE_DEST for hdmi audio

Signed-off-by: popcornmix <popcornmix@gmail.com>
3 years agobcm2835-dma: Avoid losing CS flags after interrupt
Dom Cobley [Wed, 6 Jan 2021 18:16:10 +0000 (18:16 +0000)]
bcm2835-dma: Avoid losing CS flags after interrupt

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
3 years agobcm2835-dma: Move WAIT_RESP from extra to info
popcornmix [Mon, 11 Jan 2021 14:49:33 +0000 (14:49 +0000)]
bcm2835-dma: Move WAIT_RESP from extra to info

Questionable: Might want to drop
Signed-off-by: popcornmix <popcornmix@gmail.com>
3 years agobcm2835-dma: Add bcm2835-dma: Add DMA_WIDE_SOURCE and DMA_WIDE_DEST flags
Dom Cobley [Wed, 30 Dec 2020 14:51:29 +0000 (14:51 +0000)]
bcm2835-dma: Add bcm2835-dma: Add DMA_WIDE_SOURCE and DMA_WIDE_DEST flags

Use (reserved) bits 24 and 25 of the dreq value
(the second cell of the DT DMA descriptor) to request
that wide source reads or wide dest writes are required

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
3 years agostaging/bcm2835-isp: Log the number of excess supported formats
Dave Stevenson [Thu, 7 Jan 2021 11:43:22 +0000 (11:43 +0000)]
staging/bcm2835-isp: Log the number of excess supported formats

When logging that the firmware has provided more supported formats
than we had allocated storage for, log the number allocated and
returned.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agostaging/bcm2835-isp: Add the unpacked (16bpp) raw formats
Dave Stevenson [Thu, 7 Jan 2021 11:37:10 +0000 (11:37 +0000)]
staging/bcm2835-isp: Add the unpacked (16bpp) raw formats

Now that the firmware supports the unpacked (16bpp) variants
of the MIPI raw formats, add the mappings.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agostaging/bcm2835-codec: Log the number of excess supported formats
Dave Stevenson [Thu, 7 Jan 2021 11:41:26 +0000 (11:41 +0000)]
staging/bcm2835-codec: Log the number of excess supported formats

When logging that the firmware has provided more supported formats
than we had allocated storage for, log the number allocated and
returned.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agostaging/bcm2835-codec: Add the unpacked (16bpp) raw formats
Dave Stevenson [Thu, 7 Jan 2021 10:45:16 +0000 (10:45 +0000)]
staging/bcm2835-codec: Add the unpacked (16bpp) raw formats

Now that the firmware supports the unpacked (16bpp) variants
of the MIPI raw formats, add the mappings.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agostaging/vc04_services: Add additional unpacked raw formats
Dave Stevenson [Thu, 7 Jan 2021 10:43:20 +0000 (10:43 +0000)]
staging/vc04_services: Add additional unpacked raw formats

Support has been added for the unpacked (16bpp) versions of
the MIPI raw 10, 12, and 14 formats, so add the 4CCs for them.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agostaging/mmal-vchiq: Fix incorrect static vchiq_instance.
Dave Stevenson [Tue, 5 Jan 2021 14:34:20 +0000 (14:34 +0000)]
staging/mmal-vchiq: Fix incorrect static vchiq_instance.

For some reason lost in history function vchiq_mmal_init used
a static variable for storing the vchiq_instance.
This value is retrieved from vchiq per instance, so worked fine
until you try to call vchiq_mmal_init multiple times concurrently
when things then go wrong. This seemed to happen quite frequently
if using the cutdown firmware (no MMAL or VCSM services running)
as the vchiq_connect then failed, and one or other vchiq_shutdown
was working on an invalid handle.

Remove the static so that each caller gets a unique vchiq_instance.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agostaging/vc04-services/codec: Fix logical precedence issue
Dave Stevenson [Sat, 2 Jan 2021 10:51:58 +0000 (10:51 +0000)]
staging/vc04-services/codec: Fix logical precedence issue

Two issues identified with operator precedence in logical
expressions. Fix them.

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

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agostaging: vchiq: Fix bulk transfers on 64-bit builds
Phil Elwell [Mon, 4 Jan 2021 11:06:51 +0000 (11:06 +0000)]
staging: vchiq: Fix bulk transfers on 64-bit builds

The recent change to the bulk transfer compat function missed the fact
the relevant ioctl command is VCHIQ_IOC_QUEUE_BULK_TRANSMIT32, not
VCHIQ_IOC_QUEUE_BULK_TRANSMIT, as any attempt to send a bulk block
to the VPU would have shown.

Fixes: a4367cd2b231 ("staging: vchiq: convert compat bulk transfer")

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agovc-sm-cma: fixed kbuild problem
gesangtome [Fri, 1 Jan 2021 10:03:17 +0000 (18:03 +0800)]
vc-sm-cma: fixed kbuild problem

error logs:
  drivers/staging/vc04_services/vc-sm-cma/Kconfig:1:error: recursive dependency detected!
  drivers/staging/vc04_services/vc-sm-cma/Kconfig:1:      symbol BCM_VC_SM_CMA is selected by BCM2835_VCHIQ_MMAL
  drivers/staging/vc04_services/vchiq-mmal/Kconfig:1:     symbol BCM2835_VCHIQ_MMAL depends on BCM2835_VCHIQ
  drivers/staging/vc04_services/Kconfig:14:       symbol BCM2835_VCHIQ is selected by BCM_VC_SM_CMA
  For a resolution refer to Documentation/kbuild/kconfig-language.rst
  subsection "Kconfig recursive dependency limitations"

Tested-by: make ARCH=arm64 bcm2711_defconfig
Test platform: fedora 33
Branch: rpi-5.10.y

3 years agoAdd overlay for Seeed Studio CAN BUS FD HAT (#4034)
menschel [Wed, 30 Dec 2020 20:55:34 +0000 (21:55 +0100)]
Add overlay for Seeed Studio CAN BUS FD HAT (#4034)

This patch adds the overlay for the Seeed Studio CAN BUS FD HAT
with two CAN FD Channels and an RTC.
https://www.seeedstudio.com/CAN-BUS-FD-HAT-for-Raspberry-Pi-p-4742.html

The overlay was generated by
ovmerge -c mcp251xfd-overlay.dts,spi0-0,interrupt=25 \
           mcp251xfd-overlay.dts,spi0-1,interrupt=24 \
           i2c-rtc-overlay.dts,pcf85063

Also, add description on how to generate overlays

Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
3 years agooverlays: Rebuild "upstream" with latest ovmerge
Phil Elwell [Wed, 30 Dec 2020 20:00:38 +0000 (20:00 +0000)]
overlays: Rebuild "upstream" with latest ovmerge

The latest ovmerge drops disabled fragments, causing the "upstream"
overlay to change.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agostaging: vchiq: Fix bulk userdata handling
Phil Elwell [Tue, 22 Dec 2020 16:13:17 +0000 (16:13 +0000)]
staging: vchiq: Fix bulk userdata handling

The addition of the local 'userdata' pointer to
vchiq_irq_queue_bulk_tx_rx omitted the case where neither BLOCKING nor
WAITING modes are used, in which case the value provided by the
caller is replaced with a NULL.

Fixes: 4184da4f316a ("staging: vchiq: fix __user annotations")

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agodrm/vc4: Fixup fkms for API change
Dave Stevenson [Tue, 1 Dec 2020 14:57:41 +0000 (14:57 +0000)]
drm/vc4: Fixup fkms for API change

Atomic flush and check changed API, so fix up the downstream-only
FKMS driver.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agodrm/vc4: hdmi: Enable 10/12 bpc output
Maxime Ripard [Tue, 15 Dec 2020 15:42:43 +0000 (16:42 +0100)]
drm/vc4: hdmi: Enable 10/12 bpc output

The BCM2711 supports higher bpc count than just 8, so let's support it in
our driver.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agodrm/vc4: hdmi: Limit the BCM2711 to the max without scrambling
Maxime Ripard [Tue, 15 Dec 2020 15:42:42 +0000 (16:42 +0100)]
drm/vc4: hdmi: Limit the BCM2711 to the max without scrambling

Unlike the previous generations, the HSM clock limitation is way above
what we can reach without scrambling, so let's move the maximum
frequency we support to the maximum clock frequency without scrambling.

Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
3 years agodrm/vc4: hdmi: Use the connector state pixel rate for the PHY
Maxime Ripard [Tue, 15 Dec 2020 15:42:41 +0000 (16:42 +0100)]
drm/vc4: hdmi: Use the connector state pixel rate for the PHY

The PHY initialisation parameters are not based on the pixel clock but
the TMDS clock rate which can be the pixel clock in the standard case,
but could be adjusted based on some parameters like the bits per color.

Since the TMDS clock rate is stored in our custom connector state
already, let's reuse it from there instead of computing it again.

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
3 years agodrm/vc4: hdmi: Store pixel frequency in the connector state
Maxime Ripard [Tue, 15 Dec 2020 15:42:40 +0000 (16:42 +0100)]
drm/vc4: hdmi: Store pixel frequency in the connector state

The pixel rate is for now quite simple to compute, but with more features
(30 and 36 bits output, YUV output, etc.) will depend on a bunch of
connectors properties.

Let's store the rate we have to run the pixel clock at in our custom
connector state, and compute it in atomic_check.

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
3 years agodrm/vc4: hdmi: Create a custom connector state
Maxime Ripard [Tue, 15 Dec 2020 15:42:39 +0000 (16:42 +0100)]
drm/vc4: hdmi: Create a custom connector state

When run with a higher bpc than 8, the clock of the HDMI controller needs
to be adjusted. Let's create a connector state that will be used at
atomic_check and atomic_enable to compute and store the clock rate
associated to the state.

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agodrm/vc4: hdmi: Don't access the connector state in reset if kmalloc fails
Maxime Ripard [Tue, 15 Dec 2020 15:42:38 +0000 (16:42 +0100)]
drm/vc4: hdmi: Don't access the connector state in reset if kmalloc fails

drm_atomic_helper_connector_reset uses kmalloc which, from an API
standpoint, can fail, and thus setting connector->state to NULL.
However, our reset hook then calls drm_atomic_helper_connector_tv_reset
that will access connector->state without checking if it's a valid
pointer or not.

Make sure we don't end up accessing a NULL pointer.

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Suggested-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
3 years agodrm/vc4: hdmi: Take into account the clock doubling flag in atomic_check
Maxime Ripard [Tue, 15 Dec 2020 15:42:37 +0000 (16:42 +0100)]
drm/vc4: hdmi: Take into account the clock doubling flag in atomic_check

Commit 63495f6b4aed ("drm/vc4: hdmi: Make sure our clock rate is within
limits") was intended to compute the pixel rate to make sure we remain
within the boundaries of what the hardware can provide.

However, unlike what mode_valid was checking for, we forgot to take
into account the clock doubling flag that can be set for modes. Let's
honor that flag if it's there.

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Reported-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Fixes: 63495f6b4aed ("drm/vc4: hdmi: Make sure our clock rate is within limits")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
3 years agodrm/vc4: Pass the atomic state to encoder hooks
Maxime Ripard [Tue, 15 Dec 2020 15:42:36 +0000 (16:42 +0100)]
drm/vc4: Pass the atomic state to encoder hooks

We'll need to access the connector state in our encoder setup, so let's
just pass the whole DRM state to our private encoder hooks.

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
3 years agodrm/vc4: hvs: Align the HVS atomic hooks to the new API
Maxime Ripard [Mon, 7 Dec 2020 15:57:11 +0000 (16:57 +0100)]
drm/vc4: hvs: Align the HVS atomic hooks to the new API

Since the CRTC setup in vc4 is split between the PixelValves/TXP and the
HVS, only the PV/TXP atomic hooks were updated in the previous commits, but
it makes sense to update the HVS ones too.

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
3 years agodrm/atomic: Pass the full state to CRTC atomic begin and flush
Maxime Ripard [Wed, 28 Oct 2020 12:32:22 +0000 (13:32 +0100)]
drm/atomic: Pass the full state to CRTC atomic begin and flush

Commit f6ebe9f9c9233a6114eb922aba9a0c9ccc2d2e14 upstream.

The current atomic helpers have either their object state being passed as
an argument or the full atomic state.

The former is the pattern that was done at first, before switching to the
latter for new hooks or when it was needed.

Let's start convert all the remaining helpers to provide a consistent
interface, starting with the CRTC's atomic_begin and atomic_flush.

The conversion was done using the coccinelle script below, built tested on
all the drivers and actually tested on vc4.

virtual report

@@
struct drm_crtc_helper_funcs *FUNCS;
identifier old_crtc_state, old_state;
identifier crtc;
identifier f;
@@

 f(struct drm_crtc_state *old_crtc_state)
 {
...
  struct drm_atomic_state *old_state = old_crtc_state->state;
<...
- FUNCS->atomic_begin(crtc, old_crtc_state);
+ FUNCS->atomic_begin(crtc, old_state);
...>
 }

@@
struct drm_crtc_helper_funcs *FUNCS;
identifier old_crtc_state, old_state;
identifier crtc;
identifier f;
@@

 f(struct drm_crtc_state *old_crtc_state)
 {
...
  struct drm_atomic_state *old_state = old_crtc_state->state;
<...
- FUNCS->atomic_flush(crtc, old_crtc_state);
+ FUNCS->atomic_flush(crtc, old_state);
...>
 }

@@
struct drm_crtc_helper_funcs *FUNCS;
struct drm_crtc *crtc;
struct drm_crtc_state *crtc_state;
identifier dev, state;
identifier f;
@@

 f(struct drm_device *dev, struct drm_atomic_state *state, ...)
 {
<...
- FUNCS->atomic_begin(crtc, crtc_state);
+ FUNCS->atomic_begin(crtc, state);
...>
 }

@@
struct drm_crtc_helper_funcs *FUNCS;
struct drm_crtc *crtc;
struct drm_crtc_state *crtc_state;
identifier dev, state;
identifier f;
@@

 f(struct drm_device *dev, struct drm_atomic_state *state, ...)
 {
<...
- FUNCS->atomic_flush(crtc, crtc_state);
+ FUNCS->atomic_flush(crtc, state);
...>
 }

@@
identifier crtc, old_state;
@@

 struct drm_crtc_helper_funcs {
...
- void (*atomic_begin)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+ void (*atomic_begin)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
- void (*atomic_flush)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+ void (*atomic_flush)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
}

@ crtc_atomic_func @
identifier helpers;
identifier func;
@@

(
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_begin = func,
...,
};
|
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_flush = func,
...,
};
)

@ ignores_old_state @
identifier crtc_atomic_func.func;
identifier crtc, old_state;
@@

void func(struct drm_crtc *crtc,
struct drm_crtc_state *old_state)
{
... when != old_state
}

@ adds_old_state depends on crtc_atomic_func && !ignores_old_state @
identifier crtc_atomic_func.func;
identifier crtc, old_state;
@@

void func(struct drm_crtc *crtc, struct drm_crtc_state *old_state)
{
+ struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state, crtc);
...
}

@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
expression E;
type T;
@@

void func(...)
{
...
- T state = E;
+ T crtc_state = E;
<+...
- state
+ crtc_state
...+>

}

@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
type T;
@@

void func(...)
{
...
- T state;
+ T crtc_state;
<+...
- state
+ crtc_state
...+>

}

@@
identifier old_state;
identifier crtc;
@@

 void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
-    struct drm_crtc_state *old_state
+    struct drm_atomic_state *state
   )
{
+ struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state, crtc);
...
}

@@
identifier old_state;
identifier crtc;
@@

 void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
-    struct drm_crtc_state *old_state
+    struct drm_atomic_state *state
   );

@@
identifier old_state;
identifier crtc;
@@

 void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc,
-    struct drm_crtc_state *old_state
+    struct drm_atomic_state *state
   )
{
...
}

@@
identifier old_state;
identifier crtc;
@@

 void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc,
-    struct drm_crtc_state *old_state
+    struct drm_atomic_state *state
   );

@@
identifier old_state;
identifier crtc;
@@

 void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc,
-    struct drm_crtc_state *old_state
+    struct drm_atomic_state *state
   )
{
...
}

@@
identifier old_state;
identifier crtc;
@@

 void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc,
-    struct drm_crtc_state *old_state
+    struct drm_atomic_state *state
   );

@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
identifier old_state;
identifier crtc;
@@

void func(struct drm_crtc *crtc,
-        struct drm_crtc_state *old_state
+        struct drm_atomic_state *state
       )
{ ... }

@ include depends on adds_old_state @
@@

 #include <drm/drm_atomic.h>

@ no_include depends on !include && adds_old_state @
@@

+ #include <drm/drm_atomic.h>
  #include <drm/...>

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20201028123222.1732139-2-maxime@cerno.tech
3 years agodrm/atomic: Pass the full state to CRTC atomic_check
Maxime Ripard [Wed, 28 Oct 2020 12:32:21 +0000 (13:32 +0100)]
drm/atomic: Pass the full state to CRTC atomic_check

Commit 29b77ad7b9ca8c87152a1a9e8188970fb2a93df4 upstream.

The current atomic helpers have either their object state being passed as
an argument or the full atomic state.

The former is the pattern that was done at first, before switching to the
latter for new hooks or when it was needed.

Let's start convert all the remaining helpers to provide a consistent
interface, starting with the CRTC's atomic_check.

The conversion was done using the coccinelle script below,
built tested on all the drivers and actually tested on vc4.

virtual report

@@
struct drm_crtc_helper_funcs *FUNCS;
struct drm_crtc *crtc;
struct drm_crtc_state *crtc_state;
identifier dev, state;
identifier ret, f;
@@

 f(struct drm_device *dev, struct drm_atomic_state *state)
 {
<...
- ret = FUNCS->atomic_check(crtc, crtc_state);
+ ret = FUNCS->atomic_check(crtc, state);
...>
 }

@@
identifier crtc, new_state;
@@

 struct drm_crtc_helper_funcs {
  ...
- int (*atomic_check)(struct drm_crtc *crtc, struct drm_crtc_state *new_state);
+ int (*atomic_check)(struct drm_crtc *crtc, struct drm_atomic_state *state);
  ...
}

@ crtc_atomic_func @
identifier helpers;
identifier func;
@@

static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_check = func,
...,
};

@ ignores_new_state @
identifier crtc_atomic_func.func;
identifier crtc, new_state;
@@

 int func(struct drm_crtc *crtc,
struct drm_crtc_state *new_state)
 {
... when != new_state
 }

@ adds_new_state depends on crtc_atomic_func && !ignores_new_state @
identifier crtc_atomic_func.func;
identifier crtc, new_state;
@@

 int func(struct drm_crtc *crtc, struct drm_crtc_state *new_state)
 {
+ struct drm_crtc_state *new_state = drm_atomic_get_new_crtc_state(state, crtc);
  ...
 }

@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
expression E;
type T;
@@

 int func(...)
 {
...
- T state = E;
+ T crtc_state = E;
  <+...
- state
+ crtc_state
  ...+>
 }

@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
type T;
@@

 int func(...)
 {
  ...
- T state;
+ T crtc_state;
  <+...
- state
+ crtc_state
  ...+>
 }

@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
identifier new_state;
identifier crtc;
@@

 int func(struct drm_crtc *crtc,
-        struct drm_crtc_state *new_state
+        struct drm_atomic_state *state
       )
 { ... }

@@
identifier new_state;
identifier crtc;
@@

 int vmw_du_crtc_atomic_check(struct drm_crtc *crtc,
-                             struct drm_crtc_state *new_state
+                             struct drm_atomic_state *state
               )
 {
+       struct drm_crtc_state *new_state = drm_atomic_get_new_crtc_state(state, crtc);
...
 }

@@
identifier new_state;
identifier crtc;
@@

 int vmw_du_crtc_atomic_check(struct drm_crtc *crtc,
-                             struct drm_crtc_state *new_state
+                             struct drm_atomic_state *state
               );

@ include depends on adds_new_state @
@@

 #include <drm/drm_atomic.h>

@ no_include depends on !include && adds_new_state @
@@

+ #include <drm/drm_atomic.h>
  #include <drm/...>

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20201028123222.1732139-1-maxime@cerno.tech
3 years agodrm/atomic: Pass the full state to CRTC atomic enable/disable
Maxime Ripard [Thu, 8 Oct 2020 12:44:08 +0000 (14:44 +0200)]
drm/atomic: Pass the full state to CRTC atomic enable/disable

Commit 351f950db4ab28c321a1bd4b92e4bb03e34c4703 upstream.

If the CRTC driver ever needs to access the full DRM state, it can't do so
at atomic_enable / atomic_disable time since drm_atomic_helper_swap_state
will have cleared the pointer from the struct drm_crtc_state to the struct
drm_atomic_state before calling those hooks.

In order to allow that, let's pass the full DRM state to atomic_enable and
atomic_disable. The conversion was done using the coccinelle script below,
built tested on all the drivers and actually tested on vc4.

virtual report

@@
struct drm_crtc_helper_funcs *FUNCS;
identifier dev, state;
identifier crtc, crtc_state;
@@

 disable_outputs(struct drm_device *dev, struct drm_atomic_state *state)
 {
  <...
- FUNCS->atomic_disable(crtc, crtc_state);
+ FUNCS->atomic_disable(crtc, state);
  ...>
 }

@@
struct drm_crtc_helper_funcs *FUNCS;
identifier dev, state;
identifier crtc, crtc_state;
@@

 drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, struct drm_atomic_state *state)
 {
  <...
- FUNCS->atomic_enable(crtc, crtc_state);
+ FUNCS->atomic_enable(crtc, state);
  ...>
 }

@@
identifier crtc, old_state;
@@

 struct drm_crtc_helper_funcs {
...
- void (*atomic_enable)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+ void (*atomic_enable)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
- void (*atomic_disable)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+ void (*atomic_disable)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
}

@ crtc_atomic_func @
identifier helpers;
identifier func;
@@

(
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_enable = func,
...,
};
|
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_disable = func,
...,
};
)

@ ignores_old_state @
identifier crtc_atomic_func.func;
identifier crtc, old_state;
@@

void func(struct drm_crtc *crtc,
struct drm_crtc_state *old_state)
{
... when != old_state
}

@ adds_old_state depends on crtc_atomic_func && !ignores_old_state @
identifier crtc_atomic_func.func;
identifier crtc, old_state;
@@

void func(struct drm_crtc *crtc, struct drm_crtc_state *old_state)
{
+ struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state, crtc);
...
}

@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
expression E;
type T;
@@

void func(...)
{
...
- T state = E;
+ T crtc_state = E;
<+...
- state
+ crtc_state
...+>

}

@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
type T;
@@

void func(...)
{
...
- T state;
+ T crtc_state;
<+...
- state
+ crtc_state
...+>

}

@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
identifier old_state;
identifier crtc;
@@

void func(struct drm_crtc *crtc,
-        struct drm_crtc_state *old_state
+        struct drm_atomic_state *state
       )
{ ... }

@ include depends on adds_old_state @
@@

 #include <drm/drm_atomic.h>

@ no_include depends on !include && adds_old_state @
@@

+ #include <drm/drm_atomic.h>
  #include <drm/...>

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/845aa10ef171fc0ea060495efef142a0c13f7870.1602161031.git-series.maxime@cerno.tech
3 years agostaging/vc04_services/codec: Clear last buf dequeued flag on START
Dave Stevenson [Sun, 13 Dec 2020 16:54:43 +0000 (16:54 +0000)]
staging/vc04_services/codec: Clear last buf dequeued flag on START

It appears that the V4L2 M2M framework requires the driver to manually
call vb2_clear_last_buffer_dequeued on the CAPTURE queue during a
V4L2_DEC_CMD_START.
Add such a call.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agostaging/vc04_services/codec: Add support for CID MPEG_HEADER_MODE
Dave Stevenson [Sun, 13 Dec 2020 16:45:58 +0000 (16:45 +0000)]
staging/vc04_services/codec: Add support for CID MPEG_HEADER_MODE

Control V4L2_CID_MPEG_VIDEO_HEADER_MODE controls whether the encoder
is meant to emit the header bytes as a separate packet or with the
first encoded frame.
Add support for it.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agomedia: i2c: imx477: Selection compliance fixes
Naushir Patuck [Wed, 9 Dec 2020 11:30:12 +0000 (11:30 +0000)]
media: i2c: imx477: Selection compliance fixes

To comply with the intended usage of the V4L2 selection target when
used to retrieve a sensor image properties, adjust the rectangles
returned by the imx477 driver.

The top/left crop coordinates of the TGT_CROP rectangle were set to
(0, 0) instead of (8, 16) which is the offset from the larger physical
pixel array rectangle. This was also a mismatch with the default values
crop rectangle value, so this is corrected. Found with v4l2-compliance.

While at it, add V4L2_SEL_TGT_CROP_BOUNDS support: CROP_DEFAULT and
CROP_BOUNDS have the same size as the non-active pixels are not readable
using the selection API. Found with v4l2-compliance.

This commit mirrors 543790f777ba1b3264c168c653db6d415e7c983f done for
the imx219 sensor.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
3 years agooverlays: Add missing addresses to ads1015/ads1115
Phil Elwell [Wed, 16 Dec 2020 09:28:17 +0000 (09:28 +0000)]
overlays: Add missing addresses to ads1015/ads1115

The overlays for the ads1015 and ads1115 I2C ADCs omitted the addresses
in the main device node names. As well as breaking the conventions for
I2C devices, this prevents the firmware from renaming them when the
"reg" property is modified, which in turn stops the overlays from being
instantiated multiple times.

See: https://www.raspberrypi.org/forums/viewtopic.php?f=107&t=294465

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agodrm/vc4: Make normalize_zpos conditional on using fkms
Dom Cobley [Tue, 15 Dec 2020 16:26:51 +0000 (16:26 +0000)]
drm/vc4: Make normalize_zpos conditional on using fkms

Eric's view was that there was no point in having zpos
support on vc4 as all the planes had the same functionality.

Can be later squashed into (and fixes):
drm/vc4: Add firmware-kms mode

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
3 years agooverlays: mpu6050: Add 'addr' parameter
Phil Elwell [Tue, 15 Dec 2020 17:02:17 +0000 (17:02 +0000)]
overlays: mpu6050: Add 'addr' parameter

The mpu6050 starts up at address 0x68 by default, but can be set to
0x69 if the ADO pin is pulled high. Give the overlay an addr parameter
to allow devices at the alternate address to be used.

See: https://github.com/Hexxeh/rpi-firmware/issues/252

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agonet: lan78xx: Ack pending PHY ints when resetting
Phil Elwell [Tue, 15 Dec 2020 16:38:37 +0000 (16:38 +0000)]
net: lan78xx: Ack pending PHY ints when resetting

lan78xx_link_reset explicitly clears the MAC's view of the PHY's IRQ
status. In doing so it potentially leaves the PHY with a pending
interrupt that will never be acknowledged, at which point no further
interrupts will be generated.

Avoid the problem by acknowledging any pending PHY interrupt after
clearing the MAC's status bit.

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

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agoRevert "media: videobuf2: Fix length check for single plane dmabuf queueing"
Naushir Patuck [Tue, 15 Dec 2020 14:51:55 +0000 (14:51 +0000)]
Revert "media: videobuf2: Fix length check for single plane dmabuf queueing"

This reverts commit 961d3b27a2aff52dda0b97d35085a743a27c2f46.

The updated length check for dmabuf types broke existing usage in v4l2
userland clients.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
3 years agostaging/bcm2835-codec: Ensure OUTPUT timestamps are always forwarded
Dave Stevenson [Wed, 4 Nov 2020 18:31:02 +0000 (18:31 +0000)]
staging/bcm2835-codec: Ensure OUTPUT timestamps are always forwarded

The firmware by default tries to ensure that decoded frame
timestamps always increment. This is counter to the V4L2 API
which wants exactly the OUTPUT queue timestamps passed to the
CAPTURE queue buffers.

Disable the firmware option.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agooverlays: Fix cut-and-paste error in README
Phil Elwell [Mon, 7 Dec 2020 17:18:39 +0000 (17:18 +0000)]
overlays: Fix cut-and-paste error in README

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agooverlays: Add PCF85063 and PCF85063A to i2c-rtc
Phil Elwell [Mon, 7 Dec 2020 08:49:53 +0000 (08:49 +0000)]
overlays: Add PCF85063 and PCF85063A to i2c-rtc

Add support for the PCF85063 and PCF85063A RTC devices to the
i2c-rtc overlay.

Also enable the device to be used on i2c0 (i2c_vc) on GPIOs 0&1 (use
parameter "i2c0") and GPIOs 44 & 45 (use parameter "i2c_csi_dsi").

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agoconfigs: Add RTC_DRV_PCF85063=m
Phil Elwell [Mon, 7 Dec 2020 08:33:19 +0000 (08:33 +0000)]
configs: Add RTC_DRV_PCF85063=m

Include the driver module for the PCF85063 and PCF85063A RTC devices.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agoARM: dts: CM4 audio pins are not connected
Phil Elwell [Mon, 7 Dec 2020 09:35:57 +0000 (09:35 +0000)]
ARM: dts: CM4 audio pins are not connected

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agoPCI: brcmstb: Advertise MSI-X support
Phil Elwell [Thu, 3 Dec 2020 13:44:42 +0000 (13:44 +0000)]
PCI: brcmstb: Advertise MSI-X support

Although the BRCMSTB PCIe interface doesn't technically support the
MSI-X spec, in practise it seems to work provided no more than 32
MSI-Xs are required. Add the required flag to the driver to allow
experimentation with devices that demand MSI-X support.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agomedia: bcm2835-unicam: Clear clock state when stopping streaming
Naushir Patuck [Wed, 2 Dec 2020 16:48:41 +0000 (16:48 +0000)]
media: bcm2835-unicam: Clear clock state when stopping streaming

Commit 65e08c465020d4c5b51afb452efc2246d80fd66f failed to clear the
clock state when the device stopped streaming. Fix this, as it might
again cause the same problems when doing an unprepare.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
3 years agomedia: bcm2835-unicam: Return early from stop_streaming() if stopped
Naushir Patuck [Wed, 2 Dec 2020 15:26:09 +0000 (15:26 +0000)]
media: bcm2835-unicam: Return early from stop_streaming() if stopped

clk_disable_unprepare() is called unconditionally in stop_streaming().
This is incorrect in the cases where start_streaming() fails, and
unprepares all clocks as part of the failure cleanup. To avoid this,
ensure that clk_disable_unprepare() is only called in stop_streaming()
if the clocks are in a prepared state.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
3 years agomedia: bcm2835-unicam: Correctly handle error propagation for stream on
Naushir Patuck [Wed, 2 Dec 2020 15:22:23 +0000 (15:22 +0000)]
media: bcm2835-unicam: Correctly handle error propagation for stream on

On a failure in start_streaming(), the error code would not propagate to
the calling function on all conditions. This would cause the userland
caller to not know of the failure.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
3 years agoOverlay: Update Allo Piano Plus dac driver for 5.4.y kernels.
paul-1 [Thu, 5 Nov 2020 00:17:48 +0000 (19:17 -0500)]
Overlay: Update Allo Piano Plus dac driver for 5.4.y kernels.

Create unique names for the two instances of the codec driver.

Signed-off-by: Paul Hermann <paul@picoreplayer.org>
3 years agoAdd allo boss2 config
Sudeep [Fri, 23 Oct 2020 10:22:38 +0000 (15:52 +0530)]
Add allo boss2 config

Signed-off-by: Sudeep <sudeepkumar@cem-solutions.net>
3 years agoAdd allo boss2 overlay
Sudeep [Fri, 23 Oct 2020 10:21:15 +0000 (15:51 +0530)]
Add allo boss2 overlay

Signed-off-by: Sudeep <sudeepkumar@cem-solutions.net>
3 years agoAllo boss2 driver
Sudeep [Fri, 23 Oct 2020 10:17:17 +0000 (15:47 +0530)]
Allo boss2 driver

Signed-off-by: Sudeep <sudeepkumar@cem-solutions.net>
3 years agodrm/vc4: Correct DSI register definition
Dave Stevenson [Mon, 30 Nov 2020 16:16:03 +0000 (16:16 +0000)]
drm/vc4: Correct DSI register definition

The DSI1_PHY_AFEC0_PD_DLANE1 and DSI1_PHY_AFEC0_PD_DLANE3 register
definitions were swapped, so trying to use more than a single data
lane failed as lane 1 would get powered down.
(In theory a 4 lane device would work as all lanes would remain
powered).

Correct the definitions.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agovc4_hdmi: Move hdmi reset to bind
Dom Cobley [Thu, 22 Oct 2020 18:07:24 +0000 (19:07 +0100)]
vc4_hdmi: Move hdmi reset to bind

The hdmi reset got moved to a later point in
"drm/vc4: hdmi: Add reset callback"

which now occurs after vc4_hdmi_cec_init
and so tramples the setup of registers like
HDMI_CEC_CNTRL_1

This only affects pi0-3 as on pi4 the cec
resgisters are in a separate block

Fixes: ed9a1f6eb4402b25b8a983dc4bfe40f025176e03
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
3 years agodt: Use compatible string for BCM2711 DSI1
Dave Stevenson [Thu, 12 Nov 2020 18:42:30 +0000 (18:42 +0000)]
dt: Use compatible string for BCM2711 DSI1

Updates the compatible string for DSI1 on BCM2711 to
differentiate it from BCM2835.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agodrm/vc4: Add configuration for BCM2711 DSI1.
Dave Stevenson [Thu, 12 Nov 2020 17:18:13 +0000 (17:18 +0000)]
drm/vc4: Add configuration for BCM2711 DSI1.

BCM2711 DSI1 doesn't have the issue with the ARM not being
able to write to the registers, therefore remove the DMA
workaround for that compatible string.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agodt-bindings: Add compatible for BCM2711 DSI1
Dave Stevenson [Thu, 12 Nov 2020 17:01:52 +0000 (17:01 +0000)]
dt-bindings: Add compatible for BCM2711 DSI1

DSI1 on BCM2711 doesn't require the DMA workaround that is used
on BCM2835/6/7, therefore it needs a new compatible string.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agodrm/vc4: Add support for DSI0
Dave Stevenson [Wed, 11 Nov 2020 17:18:01 +0000 (17:18 +0000)]
drm/vc4: Add support for DSI0

DSI0 was partially supported, but didn't register with the main
driver, and the code was inconsistent as to whether it checked
port == 0 or port == 1.

Add compatible string and other support to make it consistent.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agomedia: ov9281: Add 1280x720 and 640x480 modes
Dave Stevenson [Sun, 22 Nov 2020 11:01:08 +0000 (11:01 +0000)]
media: ov9281: Add 1280x720 and 640x480 modes

Breaks out common register set and adds the different registers
for 1280x720 (cropped) and 640x480 (skipped) modes

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agoconfigs: Enable WireGuard kernel module on armhf configs
MichaIng [Mon, 23 Nov 2020 15:17:31 +0000 (16:17 +0100)]
configs: Enable WireGuard kernel module on armhf configs

CONFIG_WIREGUARD=m implies CONFIG_ARM_CRYPTO=y, hence the latter is removed.

Signed-off-by: MichaIng <micha@dietpi.com>
3 years agoconfigs: Restore BRIDGE_NETFILTER=m
Phil Elwell [Mon, 23 Nov 2020 14:56:18 +0000 (14:56 +0000)]
configs: Restore BRIDGE_NETFILTER=m

CONFIG_BRIDGE_NETFILTER=m used to be the default when CONFIG_NETFILTER
was enabled, but that was removed in 5.9. The way that defconfigs work
caused this wanted setting to be lost in rpi-5.9.y and rpi-5.10.y -
restore it now.

See: https://github.com/Hexxeh/rpi-firmware/issues/248

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agoconfigs: Regenerate the defconfigs
Phil Elwell [Mon, 23 Nov 2020 14:53:14 +0000 (14:53 +0000)]
configs: Regenerate the defconfigs

The CAN_ISOTP setting was in the wrong position, and it's better for
bisecting and reverting if this doesn't get rolled into the next
config-changing commit.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agomcp251xfd: add overlay
Marc Kleine-Budde [Thu, 14 Nov 2019 23:54:07 +0000 (00:54 +0100)]
mcp251xfd: add overlay

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agoAdd devicetree support for RaspberryPi 7" panel over DSI I2C
Dave Stevenson [Tue, 10 Nov 2020 17:49:35 +0000 (17:49 +0000)]
Add devicetree support for RaspberryPi 7" panel over DSI I2C

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agodrm/panel/raspberrypi-ts: Insert delay before polling for startup state
Dave Stevenson [Tue, 10 Nov 2020 11:21:56 +0000 (11:21 +0000)]
drm/panel/raspberrypi-ts: Insert delay before polling for startup state

In switching to the hardware I2C controller there is an issue
where we seem to not get back the correct state from the Pi
touchscreen.
Insert a delay before polling to avoid this condition.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agodrm/panel/raspberrypi-touchscreen: Use independent I2C actions with delay.
Dave Stevenson [Thu, 23 Apr 2020 09:17:18 +0000 (10:17 +0100)]
drm/panel/raspberrypi-touchscreen: Use independent I2C actions with delay.

We now have the hardware I2C controller pinmuxed to the drive the
display I2C, but this controller does not support clock stretching.
The Atmel micro-controller in the panel requires clock stretching
to allow it to prepare any data to be read.

Split the rpi_touchscreen_i2c_read into two independent transactions with
a delay between them for the Atmel to prepare the data.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agodtoverlays: Add an overlay for the EDT FT5406 touchscreen
Dave Stevenson [Fri, 6 Nov 2020 18:52:25 +0000 (18:52 +0000)]
dtoverlays: Add an overlay for the EDT FT5406 touchscreen

This touchscreen controller is used by the 7" DSI panel, and
this overlay configures it for when it is NOT being polled by
the firmware.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agoInput: edt-ft5x06: Poll the device if no interrupt is configured.
Dave Stevenson [Fri, 6 Nov 2020 18:45:10 +0000 (18:45 +0000)]
Input: edt-ft5x06: Poll the device if no interrupt is configured.

Not all systems have the interrupt line wired up, so switch to
polling the touchscreen off a timer if no interrupt line is
configured.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agovc4: Clear unused infoframe packet RAM registers
Dom Cobley [Tue, 10 Nov 2020 20:04:08 +0000 (20:04 +0000)]
vc4: Clear unused infoframe packet RAM registers

Using a hdmi analyser the bytes in packet ram
registers beyond the length were visible in the
infoframes and it flagged the checksum as invalid.

Zeroing unused words of packet RAM avoids this

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
3 years agoPCI: brcmstb: Restore initial fundamental reset
Phil Elwell [Wed, 11 Nov 2020 17:08:33 +0000 (17:08 +0000)]
PCI: brcmstb: Restore initial fundamental reset

[1] replaced a single reset function with a pointer to one of two
implementations, but also removed the call asserting the reset
at the start of brcm_pcie_setup. Doing so breaks Raspberry Pis with
VL805 XHCI controllers lacking dedicated SPI EEPROMs, which have been
used for USB booting but then need to be reset so that the kernel
can reconfigure them. The lack of a reset causes the firmware's loading
of the EEPROM image to RAM to fail, breaking USB for the kernel.

See: https://www.raspberrypi.org/forums/viewtopic.php?p=1758157#p1758157

Fixes: 04356ac30771 ("PCI: brcmstb: Add bcm7278 PERST# support")

[1] 04356ac30771 ("PCI: brcmstb: Add bcm7278 PERST# support")

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agovc4_hdmi: Report that 3d/stereo is allowed
Dom Cobley [Mon, 9 Nov 2020 19:49:32 +0000 (19:49 +0000)]
vc4_hdmi: Report that 3d/stereo is allowed

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
3 years agoconfigs: Add CAN_MCP251XFD=m and CAN_ISOTP=m
menschel [Fri, 6 Nov 2020 22:32:22 +0000 (23:32 +0100)]
configs: Add CAN_MCP251XFD=m and CAN_ISOTP=m

* Add mcp251xfd driver module to the RPi kernel builds.
* Add isotp can protocol module to the RPi kernel builds.

Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
3 years agoARM: dts: bcm27xx: Remove enable_headphones setting
Phil Elwell [Thu, 5 Nov 2020 11:39:35 +0000 (11:39 +0000)]
ARM: dts: bcm27xx: Remove enable_headphones setting

The enable_headphones parameter of the snd_bcm2835 module is forced
to 1 if enable_compat_alsa is 0, so setting them both on the kernel
command line is pointless (and, in the case of Pi 400 and Pi Zeroes,
confusing).

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agooverlays: Deprecate and delete the sdtweak overlay
Phil Elwell [Wed, 4 Nov 2020 11:25:02 +0000 (11:25 +0000)]
overlays: Deprecate and delete the sdtweak overlay

The sdtweak overlay has been superseded by the board-specific
sd_* parameters such as sd_poll_once, sd_overclock etc.

For example, replace:

    dtoverlay=sdtweak,poll_once

with:

    dtparam=sd_poll_once

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agoARM: dts: Add bcm2711-rpi-400.dts
Phil Elwell [Tue, 14 Jul 2020 13:21:33 +0000 (14:21 +0100)]
ARM: dts: Add bcm2711-rpi-400.dts

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agooverlays: Add MAX31856 support to maxtherm overlay
Phil Elwell [Thu, 22 Oct 2020 16:11:12 +0000 (17:11 +0100)]
overlays: Add MAX31856 support to maxtherm overlay

Extend the maxtherm overlay with support for the MAX31856.
The driver reads the thermocouple type from a property, which is much
more civilised.

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

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agoconfigs: Add CONFIG_MAX31856=m
Phil Elwell [Mon, 2 Nov 2020 14:56:18 +0000 (14:56 +0000)]
configs: Add CONFIG_MAX31856=m

Enable support for MAX31856 temperature sensors.

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

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agophy: broadcom: Add bcm54213pe configuration
Phil Elwell [Thu, 29 Oct 2020 14:10:56 +0000 (14:10 +0000)]
phy: broadcom: Add bcm54213pe configuration

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agophy: broadcom: split out the BCM54213PE from the BCM54210E IDs
Jonathan Bell [Tue, 14 May 2019 16:00:41 +0000 (17:00 +0100)]
phy: broadcom: split out the BCM54213PE from the BCM54210E IDs

The last nibble is a revision ID, and the 54213pe is a later rev
than the 54210e. Running the 54210e setup code on a 54213pe results
in a broken RGMII interface.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
3 years agofirmware: raspberrypi: Add support for tryonce reboot flag
Tim Gover [Tue, 20 Oct 2020 10:55:37 +0000 (11:55 +0100)]
firmware: raspberrypi: Add support for tryonce reboot flag

Define a new mailbox (SET_REBOOT_FLAGS) which may be used to
pass optional flags to the Raspberry Pi firmware that changes
the behaviour of the bootloader and firmware during a reboot.

Currently this just defines the 'tryboot' flag which causes
the firmware to load tryboot.txt instead config.txt. This
alternate configuration file can be used to specify the
path of an alternate firmware and kernels allowing a fallback
mechanism to be implemented for OS upgrades.

3 years agowatchdog: bcm2835: Ignore params after the partition number
Tim Gover [Thu, 22 Oct 2020 14:30:55 +0000 (15:30 +0100)]
watchdog: bcm2835: Ignore params after the partition number

Use sscanf to extract the partition number and ignore extra parameters
which are only relevant to other reboot notifiers.

3 years agobcm2835-pcm: Fix up multichannel pcm audio
Dom Cobley [Tue, 27 Oct 2020 12:24:14 +0000 (12:24 +0000)]
bcm2835-pcm: Fix up multichannel pcm audio

Fixes: a9c1660ff5f02d048c5f31abf1fd1108ccf9ef87
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
3 years agoPiFi-40 driver, Makefile and Kconfig
David Knell [Wed, 28 Oct 2020 14:21:37 +0000 (14:21 +0000)]
PiFi-40 driver, Makefile and Kconfig

Signed-off-by: David Knell <david.knell@gmail.com>
3 years agoPiFi-40 Devicetree files
David Knell [Wed, 28 Oct 2020 14:20:56 +0000 (14:20 +0000)]
PiFi-40 Devicetree files

Signed-off-by: David Knell <david.knell@gmail.com>
3 years agoPiFi-40 defconfigs
David Knell [Wed, 28 Oct 2020 14:18:42 +0000 (14:18 +0000)]
PiFi-40 defconfigs

Signed-off-by: David Knell <david.knell@gmail.com>
3 years agobcm2708_fb: Fix a build warning
Phil Elwell [Tue, 27 Oct 2020 12:12:22 +0000 (12:12 +0000)]
bcm2708_fb: Fix a build warning

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agorpivid_h625: Fix build warnings
Phil Elwell [Tue, 27 Oct 2020 12:10:40 +0000 (12:10 +0000)]
rpivid_h625: Fix build warnings

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agogpio-fsm: Fix a build warning
Phil Elwell [Tue, 27 Oct 2020 12:10:04 +0000 (12:10 +0000)]
gpio-fsm: Fix a build warning

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agodwc_otg: Minimise header and fix build warnings
Phil Elwell [Tue, 27 Oct 2020 09:59:49 +0000 (09:59 +0000)]
dwc_otg: Minimise header and fix build warnings

Delete a large amount of unused declaration from "usb.h", some of which
were causing build warnings, and get the module building cleanly.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agoconfigs: Set RASPBERRYPI_FIRMWARE for arm64 bcm2711
Phil Elwell [Mon, 26 Oct 2020 21:51:29 +0000 (21:51 +0000)]
configs: Set RASPBERRYPI_FIRMWARE for arm64 bcm2711

RASPBERRYPI_FIRMWARE was missing from the arm64 bcm2711_defconfig.
bcmrpi3_defconfig was also missing a few options. Add the misssing
settings and regenerate all the Pi defconfigs.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agoARM: dts: Expand PCIe space on BCM2711
Phil Elwell [Mon, 26 Oct 2020 10:35:43 +0000 (10:35 +0000)]
ARM: dts: Expand PCIe space on BCM2711

Attempts to connect external GPUs to Compute Module 4's PCIe bus have
highlighted that the existing "outbound window" - the fraction of the
PCI address base that is appears in the host's memory map - is
restrictively small. Expand the window to a full 1GB.

See: https://www.raspberrypi.org/forums/viewtopic.php?f=98&t=288902

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agorpisense-fb: Set pseudo_pallete to prevent crash on fbcon takeover
Serge Schneider [Mon, 26 Oct 2020 16:38:21 +0000 (16:38 +0000)]
rpisense-fb: Set pseudo_pallete to prevent crash on fbcon takeover

Signed-off-by: Serge Schneider <serge@raspberrypi.com>
3 years agooverlays: Enable headphone audio in audremap
Phil Elwell [Mon, 26 Oct 2020 10:21:23 +0000 (10:21 +0000)]
overlays: Enable headphone audio in audremap

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agoARM: dts: Disable headphone audio on Zeroes, CM4
Phil Elwell [Mon, 26 Oct 2020 10:18:50 +0000 (10:18 +0000)]
ARM: dts: Disable headphone audio on Zeroes, CM4

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agostaging: bcm2835-audio: Add disable-headphones flag
Phil Elwell [Mon, 26 Oct 2020 10:23:22 +0000 (10:23 +0000)]
staging: bcm2835-audio: Add disable-headphones flag

Add a property to allow the headphone output to be disabled. Use an
integer property rather than a boolean so that an overlay can clear it.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years agodts: Tidy the Raspberry Pi Makefile entries
Phil Elwell [Mon, 26 Oct 2020 15:01:21 +0000 (15:01 +0000)]
dts: Tidy the Raspberry Pi Makefile entries

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
3 years 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.

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

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
3 years agodrm/vc4: Add the 2711 HVS as a suitable DMA node
Dave Stevenson [Mon, 26 Oct 2020 12:38:27 +0000 (12:38 +0000)]
drm/vc4: Add the 2711 HVS as a suitable DMA node

With vc4-drv node not being under /soc on Pi4, we need to
adopt the correct DMA parameters from a suitable sub-component.
Add "brcm,bcm2711-hvs" to that list of components.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agodts: Add CM4 to arm64 dt files
Dave Stevenson [Fri, 23 Oct 2020 14:45:11 +0000 (15:45 +0100)]
dts: Add CM4 to arm64 dt files

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agooverlays: imx219: Correct link frequency to match the upstream driver
Dave Stevenson [Wed, 11 Mar 2020 12:07:57 +0000 (12:07 +0000)]
overlays: imx219: Correct link frequency to match the upstream driver

The upstream driver is checking the link frequency parameter, and
the overlay had the wrong value.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agooverlays: Add option to disable composite to vc4-kms-v3d
Dave Stevenson [Fri, 23 Oct 2020 13:15:41 +0000 (14:15 +0100)]
overlays: Add option to disable composite to vc4-kms-v3d

Composite gets enabled automatically if HDMI isn't detected,
which can cause some grief in X should it be not connected
and touchscreens are in use.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 years agoARM: dts: bcm271x: Use a53 pmu, drop RPI364
Phil Elwell [Thu, 19 Mar 2020 10:04:46 +0000 (10:04 +0000)]
ARM: dts: bcm271x: Use a53 pmu, drop RPI364

The upstream bcm2837.dtsi uses cortex-a53-pmu, so we can do the same
but with a fallback to the cortex-a7-pmu which is supported by the
32-bit kernel.

Now that we're using the natural fallback mechanism of compatible
strings, the RPI364 macro no longer serves any purpose - remove it.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>