dt-bindings: display: Add a property to deal with WiFi coexistence
Subsystems (5)
PATCH v2 1/3 dt-bindings: display: Add a property to deal with WiFi coexistence
The RaspberryPi4 has both a WiFi chip and HDMI outputs capable of doing 4k. Unfortunately, the 1440p resolution at 60Hz has a TMDS rate on the HDMI cable right in the middle of the first Wifi channel.
Add a property to our HDMI controller, that could be reused by other similar HDMI controllers, to allow the OS to take whatever measure is necessary to avoid that crosstalk.
---
Changes from v1:
- Renamed the property
- Split it into a separate patch
--- .../devicetree/bindings/display/brcm,bcm2711-hdmi.yaml | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/display/brcm,bcm2711-hdmi.yaml +6 -0
@@ -76,6 +76,12 @@ properties: resets: maxItems: 1 + wifi-2.4ghz-coexistence: + type: boolean + description: > + Should the pixel frequencies in the WiFi frequencies range be + avoided? + required: - compatible - reg
Signature · 1 line
2.26.2
PATCH v2 2/3 drm/vc4: hdmi: Disable Wifi Frequencies
There's cross-talk on the RPi4 between the 2.4GHz channels used by the WiFi chip and some resolutions, most notably 1440p at 60Hz.
In such a case, we can either reject entirely the mode, or lower slightly the pixel frequency to remove the overlap. Let's go for the latter.
---
Changes from v1:
- Change the name of the property
- Test for a range instead of an exact frequency
--- drivers/gpu/drm/vc4/vc4_hdmi.c | 21 +++++++++++++++++++++ drivers/gpu/drm/vc4/vc4_hdmi.h | 8 ++++++++ 2 files changed, 29 insertions(+)
drivers/gpu/drm/vc4/vc4_hdmi.c +21 -0
@@ -760,6 +760,9 @@ static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder) { } +#define WIFI_2_4GHz_CH1_MIN_FREQ 2400000000ULL +#define WIFI_2_4GHz_CH1_MAX_FREQ 2422000000ULL +static int vc4_hdmi_encoder_atomic_check (struct drm_encoder *encoder,struct drm_crtc_state *crtc_state,struct drm_connector_state *conn_state)
@@ -767,12 +770,27 @@ static int vc4_hdmi_encoder_atomic_check(struct drm_encoder *encoder,struct drm_display_mode *mode = &crtc_state->adjusted_mode;struct vc4_hdmi *vc4_hdmi =encoder_to_vc4_hdmi (encoder);unsigned long long pixel_rate = mode->clock *1000 ; +unsigned long long tmds_rate;if (vc4_hdmi->variant->unsupported_odd_h_timings && ((mode->hdisplay %2 ) || (mode->hsync_start %2 ) || (mode->hsync_end %2 ) || (mode->htotal %2 )))return -EINVAL ; +/* +* The 1440p@60 pixel rate is in the same range than the first +* WiFi channel (between 2.4GHz and 2.422GHz with 22MHz +* bandwidth). Slightly lower the frequency to bring it out of +* the WiFi range. +*/ + tmds_rate = pixel_rate *10 ; +if (vc4_hdmi->disable_wifi_frequencies && + (tmds_rate >= WIFI_2_4GHz_CH1_MIN_FREQ && + tmds_rate <= WIFI_2_4GHz_CH1_MAX_FREQ)) { + mode->clock =238560 ; + pixel_rate = mode->clock *1000 ; + } +if (pixel_rate > vc4_hdmi->variant->max_pixel_clock)return -EINVAL ;
@@ -1717,6 +1735,9 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) vc4_hdmi->hpd_active_low = hpd_gpio_flags &OF_GPIO_ACTIVE_LOW ; } + vc4_hdmi->disable_wifi_frequencies = +of_property_read_bool (dev->of_node,"wifi-2.4ghz-coexistence" ); +pm_runtime_enable (dev);drm_simple_encoder_init (drm, encoder,DRM_MODE_ENCODER_TMDS );
drivers/gpu/drm/vc4/vc4_hdmi.h +8 -0
@@ -142,6 +142,14 @@ struct vc4_hdmi {int hpd_gpio;bool hpd_active_low; +/* +* On some systems (like the RPi4), some modes are in the same +* frequency range than the WiFi channels (1440p@60Hz for +* example). Should we take evasive actions because that system +* has a wifi adapter. +*/ +bool disable_wifi_frequencies; +struct cec_adapter *cec_adap;struct cec_msg cec_rx_msg;bool cec_tx_ok;
Signature · 1 line
2.26.2
Re: [PATCH v2 2/3] drm/vc4: hdmi: Disable Wifi Frequencies
Hi
Am 29.10.20 um 14:40 schrieb Maxime Ripard:
Quoted 75 lines
There's cross-talk on the RPi4 between the 2.4GHz channels used by the WiFi chip and some resolutions, most notably 1440p at 60Hz.
In such a case, we can either reject entirely the mode, or lower slightly the pixel frequency to remove the overlap. Let's go for the latter.
Signed-off-by Maxime Ripard <[email protected]>---
Changes from v1:
- Change the name of the property
- Test for a range instead of an exact frequency--- drivers/gpu/drm/vc4/vc4_hdmi.c | 21 +++++++++++++++++++++ drivers/gpu/drm/vc4/vc4_hdmi.h | 8 ++++++++ 2 files changed, 29 insertions(+)drivers/gpu/drm/vc4/vc4_hdmi.c +21
-0@@ -760,6 +760,9 @@ static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder) { } +#define WIFI_2_4GHz_CH1_MIN_FREQ 2400000000ULL +#define WIFI_2_4GHz_CH1_MAX_FREQ 2422000000ULL +static int vc4_hdmi_encoder_atomic_check (struct drm_encoder *encoder,struct drm_crtc_state *crtc_state,struct drm_connector_state *conn_state)@@ -767,12 +770,27 @@ static int vc4_hdmi_encoder_atomic_check(struct drm_encoder *encoder,struct drm_display_mode *mode = &crtc_state->adjusted_mode;struct vc4_hdmi *vc4_hdmi =encoder_to_vc4_hdmi (encoder);unsigned long long pixel_rate = mode->clock *1000 ; +unsigned long long tmds_rate;if (vc4_hdmi->variant->unsupported_odd_h_timings && ((mode->hdisplay %2 ) || (mode->hsync_start %2 ) || (mode->hsync_end %2 ) || (mode->htotal %2 )))return -EINVAL ; +/* +* The 1440p@60 pixel rate is in the same range than the first +* WiFi channel (between 2.4GHz and 2.422GHz with 22MHz +* bandwidth). Slightly lower the frequency to bring it out of +* the WiFi range. +*/ + tmds_rate = pixel_rate *10 ; +if (vc4_hdmi->disable_wifi_frequencies && + (tmds_rate >= WIFI_2_4GHz_CH1_MIN_FREQ && + tmds_rate <= WIFI_2_4GHz_CH1_MAX_FREQ)) { + mode->clock =238560 ; + pixel_rate = mode->clock *1000 ; + } +if (pixel_rate > vc4_hdmi->variant->max_pixel_clock)return -EINVAL ;@@ -1717,6 +1735,9 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) vc4_hdmi->hpd_active_low = hpd_gpio_flags &OF_GPIO_ACTIVE_LOW ; } + vc4_hdmi->disable_wifi_frequencies = +of_property_read_bool (dev->of_node,"wifi-2.4ghz-coexistence" ); +pm_runtime_enable (dev);drm_simple_encoder_init (drm, encoder,DRM_MODE_ENCODER_TMDS );drivers/gpu/drm/vc4/vc4_hdmi.h +0
-0
drivers/gpu/drm/vc4/vc4_hdmi.h struct vc4_hdmi { · line 149
Quoted 8 lines
drivers/gpu/drm/vc4/vc4_hdmi.h +5
-0@@ -142,6 +142,14 @@ struct vc4_hdmi {int hpd_gpio;bool hpd_active_low; +/* +* On some systems (like the RPi4), some modes are in the same +* frequency range than the WiFi channels (1440p@60Hz for +* example). Should we take evasive actions because that system +* has a wifi adapter.
The final sentence sounds like a question. Maybe just write 'Take evasive actions if...'
Assuming that the display mode still works
Quoted 7 lines
drivers/gpu/drm/vc4/vc4_hdmi.h +3
-0+*/ +bool disable_wifi_frequencies; +struct cec_adapter *cec_adap;struct cec_msg cec_rx_msg;bool cec_tx_ok;
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 2/3] drm/vc4: hdmi: Disable Wifi Frequencies
Quoted 74 lines · Thomas Zimmermann
Hi
Am 29.10.20 um 14:40 schrieb Maxime Ripard:
Quoted 71 lines
There's cross-talk on the RPi4 between the 2.4GHz channels used by the WiFi chip and some resolutions, most notably 1440p at 60Hz.
In such a case, we can either reject entirely the mode, or lower slightly the pixel frequency to remove the overlap. Let's go for the latter.
Signed-off-by Maxime Ripard <[email protected]>---
Changes from v1:
- Change the name of the property
- Test for a range instead of an exact frequency--- drivers/gpu/drm/vc4/vc4_hdmi.c | 21 +++++++++++++++++++++ drivers/gpu/drm/vc4/vc4_hdmi.h | 8 ++++++++ 2 files changed, 29 insertions(+)drivers/gpu/drm/vc4/vc4_hdmi.c +21
-0@@ -760,6 +760,9 @@ static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder) { } +#define WIFI_2_4GHz_CH1_MIN_FREQ 2400000000ULL +#define WIFI_2_4GHz_CH1_MAX_FREQ 2422000000ULL +static int vc4_hdmi_encoder_atomic_check (struct drm_encoder *encoder,struct drm_crtc_state *crtc_state,struct drm_connector_state *conn_state)@@ -767,12 +770,27 @@ static int vc4_hdmi_encoder_atomic_check(struct drm_encoder *encoder,struct drm_display_mode *mode = &crtc_state->adjusted_mode;struct vc4_hdmi *vc4_hdmi =encoder_to_vc4_hdmi (encoder);unsigned long long pixel_rate = mode->clock *1000 ; +unsigned long long tmds_rate;if (vc4_hdmi->variant->unsupported_odd_h_timings && ((mode->hdisplay %2 ) || (mode->hsync_start %2 ) || (mode->hsync_end %2 ) || (mode->htotal %2 )))return -EINVAL ; +/* +* The 1440p@60 pixel rate is in the same range than the first +* WiFi channel (between 2.4GHz and 2.422GHz with 22MHz +* bandwidth). Slightly lower the frequency to bring it out of +* the WiFi range. +*/ + tmds_rate = pixel_rate *10 ; +if (vc4_hdmi->disable_wifi_frequencies && + (tmds_rate >= WIFI_2_4GHz_CH1_MIN_FREQ && + tmds_rate <= WIFI_2_4GHz_CH1_MAX_FREQ)) { + mode->clock =238560 ; + pixel_rate = mode->clock *1000 ; + } +if (pixel_rate > vc4_hdmi->variant->max_pixel_clock)return -EINVAL ;@@ -1717,6 +1735,9 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) vc4_hdmi->hpd_active_low = hpd_gpio_flags &OF_GPIO_ACTIVE_LOW ; } + vc4_hdmi->disable_wifi_frequencies = +of_property_read_bool (dev->of_node,"wifi-2.4ghz-coexistence" ); +pm_runtime_enable (dev);drm_simple_encoder_init (drm, encoder,DRM_MODE_ENCODER_TMDS );drivers/gpu/drm/vc4/vc4_hdmi.h +0
-0@@ -142,6 +142,14 @@ struct vc4_hdmi {int hpd_gpio;bool hpd_active_low;
Quoted 8 lines
drivers/gpu/drm/vc4/vc4_hdmi.h struct vc4_hdmi { · line 149
Quoted 5 lines
drivers/gpu/drm/vc4/vc4_hdmi.h +5
-0+/* +* On some systems (like the RPi4), some modes are in the same +* frequency range than the WiFi channels (1440p@60Hz for +* example). Should we take evasive actions because that system +* has a wifi adapter. The final sentence sounds like a question. Maybe just write 'Take evasive actions if...'
This was definitely a question, I've added the question mark and applied the two first patches
Quoted 3 lines
Assuming that the display mode still works
Thanks!
Maxime
PATCH v2 3/3 ARM: dts: rpi-4: disable wifi frequencies
In reply to Maxime RipardThe RPi4 WiFi chip and HDMI outputs have some frequency overlap with crosstalk around 2.4GHz. Let's mark it as such so we can use some evasive maneuvers.
---
Changes from v1:
- Changed the property name
--- arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/boot/dts/bcm2711-rpi-4-b.dts +2 -0
@@ -181,12 +181,14 @@ &gpio { &hdmi0 { clocks = <&firmware_clocks 13>, <&firmware_clocks 14>, <&dvp 0>, <&clk_27MHz>; clock-names = "hdmi", "bvb", "audio", "cec"; + wifi-2.4ghz-coexistence; status = "okay"; }; &hdmi1 { clocks = <&firmware_clocks 13>, <&firmware_clocks 14>, <&dvp 1>, <&clk_27MHz>; clock-names = "hdmi", "bvb", "audio", "cec"; + wifi-2.4ghz-coexistence; status = "okay"; };
Signature · 1 line
2.26.2
Re: [PATCH v2 3/3] ARM: dts: rpi-4: disable wifi frequencies
Quoted 10 lines · Maxime Ripard
The RPi4 WiFi chip and HDMI outputs have some frequency overlap with crosstalk around 2.4GHz. Let's mark it as such so we can use some evasive maneuvers.
Signed-off-by Maxime Ripard <[email protected]>---
Changes from v1:
- Changed the property name
Applied for next. Thanks!
Hi maxime,
Quoted 24 lines · Maxime Ripard
The RaspberryPi4 has both a WiFi chip and HDMI outputs capable of doing 4k. Unfortunately, the 1440p resolution at 60Hz has a TMDS rate on the HDMI cable right in the middle of the first Wifi channel.
Add a property to our HDMI controller, that could be reused by other similar HDMI controllers, to allow the OS to take whatever measure is necessary to avoid that crosstalk.
Signed-off-by Maxime Ripard <[email protected]>---
Changes from v1:
- Renamed the property
- Split it into a separate patch--- .../devicetree/bindings/display/brcm,bcm2711-hdmi.yaml | 6 ++++++ 1 file changed, 6 insertions(+)Documentation/devicetree/bindings/display/brcm,bcm2711-hdmi.yaml +0
-0
Documentation/devicetree/bindings/display/brcm,bcm2711-hdmi.yaml properties: · line 79
Quoted 4 lines
Documentation/devicetree/bindings/display/brcm,bcm2711-hdmi.yaml +1
-0@@ -76,6 +76,12 @@ properties: resets: maxItems: 1 + wifi-2.4ghz-coexistence:
I see you already renamed the property, but I can't seem to find v1 of the series online. Sorry if this is redundant:
I wonder if it'd make sense to prefix the property like this:
"raspberrypi,wifi-2.4ghz-coexistence." I tend to associate the lack of prefix with generic properties, and also thought it was a rule. Although I may have as well imagined it.
Other than that the series looks OK to me.
Regards,
Nicolas
Hi Nicolas,
Quoted 30 lines · Nicolas Saenz Julienne
Hi maxime,
Quoted 27 lines · Maxime Ripard
The RaspberryPi4 has both a WiFi chip and HDMI outputs capable of doing 4k. Unfortunately, the 1440p resolution at 60Hz has a TMDS rate on the HDMI cable right in the middle of the first Wifi channel.
Add a property to our HDMI controller, that could be reused by other similar HDMI controllers, to allow the OS to take whatever measure is necessary to avoid that crosstalk.
Signed-off-by Maxime Ripard <[email protected]>---
Changes from v1:
- Renamed the property
- Split it into a separate patch--- .../devicetree/bindings/display/brcm,bcm2711-hdmi.yaml | 6 ++++++ 1 file changed, 6 insertions(+)Documentation/devicetree/bindings/display/brcm,bcm2711-hdmi.yaml +0
-0@@ -76,6 +76,12 @@ properties: resets: maxItems: 1
Quoted 4 lines
Documentation/devicetree/bindings/display/brcm,bcm2711-hdmi.yaml properties: · line 79
Quoted 1 line
Documentation/devicetree/bindings/display/brcm,bcm2711-hdmi.yaml +1
-0+ wifi-2.4ghz-coexistence:I see you already renamed the property, but I can't seem to find v1 of the series online.
I realized I didn't put you in Cc for the first version, sorry, you'll find it here:
https://lore.kernel.org/dri-devel/[email protected]/
Quoted 6 lines
Sorry if this is redundant:
I wonder if it'd make sense to prefix the property like this:
"raspberrypi,wifi-2.4ghz-coexistence." I tend to associate the lack of prefix with generic properties, and also thought it was a rule. Although I may have as well imagined it.
Rob in the first iteration asked for the opposite :)
It used to be a vendor-specific property, and since this issue is basically cross-platform (as long as you can support 1440p and have WiFi), it makes sense to make this a generic property
Maxime
Nicolas Saenz Julienne
Reviewed-byQuoted 41 lines · Maxime Ripard
Hi Nicolas,
Quoted 30 lines · Nicolas Saenz Julienne
Hi maxime,
Quoted 27 lines · Maxime Ripard
The RaspberryPi4 has both a WiFi chip and HDMI outputs capable of doing 4k. Unfortunately, the 1440p resolution at 60Hz has a TMDS rate on the HDMI cable right in the middle of the first Wifi channel.
Add a property to our HDMI controller, that could be reused by other similar HDMI controllers, to allow the OS to take whatever measure is necessary to avoid that crosstalk.
Signed-off-by Maxime Ripard <[email protected]>---
Changes from v1:
- Renamed the property
- Split it into a separate patch--- .../devicetree/bindings/display/brcm,bcm2711-hdmi.yaml | 6 ++++++ 1 file changed, 6 insertions(+)Documentation/devicetree/bindings/display/brcm,bcm2711-hdmi.yaml +0
-0@@ -76,6 +76,12 @@ properties: resets: maxItems: 1Quoted 4 lines
Documentation/devicetree/bindings/display/brcm,bcm2711-hdmi.yaml properties: · line 79
Quoted 1 line
Documentation/devicetree/bindings/display/brcm,bcm2711-hdmi.yaml +1
-0+ wifi-2.4ghz-coexistence:I see you already renamed the property, but I can't seem to find v1 of the series online.
I realized I didn't put you in Cc for the first version, sorry, you'll find it here:
https://lore.kernel.org/dri-devel/[email protected]/
Quoted 8 lines
Quoted 6 lines
Sorry if this is redundant:
I wonder if it'd make sense to prefix the property like this:
"raspberrypi,wifi-2.4ghz-coexistence." I tend to associate the lack of prefix with generic properties, and also thought it was a rule. Although I may have as well imagined it.Rob in the first iteration asked for the opposite :)
Fair enough, then:
Regards,
Nicolas
Quoted 10 lines · Maxime Ripard
The RaspberryPi4 has both a WiFi chip and HDMI outputs capable of doing 4k. Unfortunately, the 1440p resolution at 60Hz has a TMDS rate on the HDMI cable right in the middle of the first Wifi channel.
Add a property to our HDMI controller, that could be reused by other similar HDMI controllers, to allow the OS to take whatever measure is necessary to avoid that crosstalk.
Signed-off-by Maxime Ripard <[email protected]>
Quoted 9 lines
---
Changes from v1:
- Renamed the property
- Split it into a separate patch--- .../devicetree/bindings/display/brcm,bcm2711-hdmi.yaml | 6 ++++++ 1 file changed, 6 insertions(+)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel