Compare commits

...

5 Commits

Author SHA1 Message Date
Dom Cobley
a8c4c464b7 drm/vc4: plane: TPZ scaling modes cannot reduce lbm size when alpha-less
spec says "Note that there is not an extra mode to save memory
for alpha-less formats" in the TPZ section.

Currently, if first plane is RGB888 and scaled down (TPZ)
a second plane will corrupt the LBM and result in garbage

I've also folded in the modification to components to the
function as it seems misplaced

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
2025-12-04 15:01:06 +00:00
Dom Cobley
d04e379ac5 drm/vc4: plane: Remove dead channels_scaled code
This code can never do anything, as channels_scaled can only be 0 or 2.
I suspect that the index was intended to be i rather than channel, but that
would trigger for scaled RGB planes, and halving lines is not wanted there.

Just remove it.

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
2025-12-04 15:01:06 +00:00
Dave Stevenson
e8017d9f2d dtoverlays: ili251x: Replace incorrect comment on irq trigger
The comment said "high-to-low edge triggered", but used a value
of 8 which is IRQ_TYPE_LEVEL_LOW.

Update to use the define.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2025-12-04 11:37:01 +00:00
Dave Stevenson
fd2dff75cd dtoverlays: Add overlay for Ilitek-ts-i2c driver (213X/23XX/25XX chips)
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2025-12-04 11:37:01 +00:00
Dave Stevenson
3df21d5eaa defconfig: Add TOUCHSCREEN_ILITEK to all Pi configs
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2025-12-04 11:37:01 +00:00
11 changed files with 87 additions and 15 deletions

View File

@@ -131,6 +131,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
i2s-dac.dtbo \
i2s-gpio28-31.dtbo \
i2s-master-dac.dtbo \
ilitek-ts-i2c.dtbo \
ilitek251x.dtbo \
imx219.dtbo \
imx258.dtbo \

View File

@@ -2778,6 +2778,17 @@ Load: dtoverlay=i2s-master-dac
Params: <None>
Name: ilitek-ts-i2c
Info: Enables I2C connected Ilitek 23XX, 25XX, and 213X touch controllers
using GPIO 4 (pin 7 on GPIO header) for interrupt.
Load: dtoverlay=ilitek-ts-i2c,<param>=<val>
Params: interrupt GPIO used for interrupt (default 4)
invx Touchscreen inverted x axis
invy Touchscreen inverted y axis
swapxy Touchscreen swapped x y axis
i2c-path Override I2C path to allow for i2c-gpio buses
Name: ilitek251x
Info: Enables I2C connected Ilitek 251x multiple touch controller using
GPIO 4 (pin 7 on GPIO header) for interrupt.

View File

@@ -0,0 +1,62 @@
// Device tree overlay for I2C connected Ilitek multiple touch controller
/dts-v1/;
/plugin/;
#include <dt-bindings/interrupt-controller/irq.h>
/ {
compatible = "brcm,bcm2835";
fragment@0 {
target = <&gpio>;
__overlay__ {
ili2130_pins: ili2130_pins {
brcm,pins = <4>; // interrupt
brcm,function = <0>; // in
brcm,pull = <2>; // pull-up
};
};
};
frag1: fragment@1 {
target = <&i2c1>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
ili2130: ili2130@41 {
compatible = "ilitek,ili2130";
reg = <0x41>;
pinctrl-names = "default";
pinctrl-0 = <&ili2130_pins>;
interrupt-parent = <&gpio>;
interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
};
};
};
fragment@2 {
target = <&ili2130>;
__overlay__ {
touchscreen-inverted-x;
};
};
fragment@3 {
target = <&ili2130>;
__overlay__ {
touchscreen-inverted-y;
};
};
__overrides__ {
interrupt = <&ili2130_pins>,"brcm,pins:0",
<&ili2130>,"interrupts:0";
i2c-path = <&frag1>, "target?=0",
<&frag1>, "target-path";
invx = <0>, "-2";
invy = <0>, "-3";
swapxy = <&ili2130>,"touchscreen-swapped-x-y?";
};
};

View File

@@ -2,6 +2,8 @@
/dts-v1/;
/plugin/;
#include <dt-bindings/interrupt-controller/irq.h>
/ {
compatible = "brcm,bcm2835";
@@ -29,7 +31,7 @@
pinctrl-names = "default";
pinctrl-0 = <&ili251x_pins>;
interrupt-parent = <&gpio>;
interrupts = <4 8>; // high-to-low edge triggered
interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
touchscreen-size-x = <16384>;
touchscreen-size-y = <9600>;
};

View File

@@ -640,6 +640,7 @@ CONFIG_TOUCHSCREEN_EGALAX=m
CONFIG_TOUCHSCREEN_EXC3000=m
CONFIG_TOUCHSCREEN_GOODIX=m
CONFIG_TOUCHSCREEN_ILI210X=m
CONFIG_TOUCHSCREEN_ILITEK=m
CONFIG_TOUCHSCREEN_EDT_FT5X06=m
CONFIG_TOUCHSCREEN_RASPBERRYPI_FW=m
CONFIG_TOUCHSCREEN_USB_COMPOSITE=m

View File

@@ -673,6 +673,7 @@ CONFIG_TOUCHSCREEN_EGALAX=m
CONFIG_TOUCHSCREEN_EXC3000=m
CONFIG_TOUCHSCREEN_GOODIX=m
CONFIG_TOUCHSCREEN_ILI210X=m
CONFIG_TOUCHSCREEN_ILITEK=m
CONFIG_TOUCHSCREEN_EDT_FT5X06=m
CONFIG_TOUCHSCREEN_RASPBERRYPI_FW=m
CONFIG_TOUCHSCREEN_USB_COMPOSITE=m

View File

@@ -634,6 +634,7 @@ CONFIG_TOUCHSCREEN_EGALAX=m
CONFIG_TOUCHSCREEN_EXC3000=m
CONFIG_TOUCHSCREEN_GOODIX=m
CONFIG_TOUCHSCREEN_ILI210X=m
CONFIG_TOUCHSCREEN_ILITEK=m
CONFIG_TOUCHSCREEN_EDT_FT5X06=m
CONFIG_TOUCHSCREEN_RASPBERRYPI_FW=m
CONFIG_TOUCHSCREEN_USB_COMPOSITE=m

View File

@@ -707,6 +707,7 @@ CONFIG_TOUCHSCREEN_EGALAX=m
CONFIG_TOUCHSCREEN_EXC3000=m
CONFIG_TOUCHSCREEN_GOODIX=m
CONFIG_TOUCHSCREEN_ILI210X=m
CONFIG_TOUCHSCREEN_ILITEK=m
CONFIG_TOUCHSCREEN_EDT_FT5X06=m
CONFIG_TOUCHSCREEN_RASPBERRYPI_FW=m
CONFIG_TOUCHSCREEN_USB_COMPOSITE=m

View File

@@ -707,6 +707,7 @@ CONFIG_TOUCHSCREEN_EGALAX=m
CONFIG_TOUCHSCREEN_EXC3000=m
CONFIG_TOUCHSCREEN_GOODIX=m
CONFIG_TOUCHSCREEN_ILI210X=m
CONFIG_TOUCHSCREEN_ILITEK=m
CONFIG_TOUCHSCREEN_EDT_FT5X06=m
CONFIG_TOUCHSCREEN_RASPBERRYPI_FW=m
CONFIG_TOUCHSCREEN_USB_COMPOSITE=m

View File

@@ -710,6 +710,7 @@ CONFIG_TOUCHSCREEN_EGALAX=m
CONFIG_TOUCHSCREEN_EXC3000=m
CONFIG_TOUCHSCREEN_GOODIX=m
CONFIG_TOUCHSCREEN_ILI210X=m
CONFIG_TOUCHSCREEN_ILITEK=m
CONFIG_TOUCHSCREEN_EDT_FT5X06=m
CONFIG_TOUCHSCREEN_RASPBERRYPI_FW=m
CONFIG_TOUCHSCREEN_USB_COMPOSITE=m

View File

@@ -802,7 +802,10 @@ static unsigned int vc4_lbm_components(const struct drm_plane_state *state,
if (info->is_yuv)
return channel ? 2 : 1;
if (info->has_alpha)
if (vc4_state->y_scaling[channel] == VC4_SCALING_TPZ)
return 4;
if (info->has_alpha && state->alpha == DRM_BLEND_ALPHA_OPAQUE)
return 4;
return 3;
@@ -812,11 +815,8 @@ static unsigned int vc4_lbm_channel_size(const struct drm_plane_state *state,
unsigned int channel)
{
const struct drm_format_info *info = state->fb->format;
const struct vc4_plane_state *vc4_state = to_vc4_plane_state(state);
unsigned int channels_scaled = 0;
unsigned int components, words, wpc;
unsigned int width, lines;
unsigned int i;
/* LBM is meant to use the smaller of source or dest width, but there
* is a issue with UV scaling that the size required for the second
@@ -836,20 +836,10 @@ static unsigned int vc4_lbm_channel_size(const struct drm_plane_state *state,
if (!components)
return 0;
if (state->alpha != DRM_BLEND_ALPHA_OPAQUE && info->has_alpha)
components -= 1;
words = width * wpc * components;
lines = DIV_ROUND_UP(words, 128 / info->hsub);
for (i = 0; i < 2; i++)
if (vc4_state->y_scaling[channel] != VC4_SCALING_NONE)
channels_scaled++;
if (channels_scaled == 1)
lines = lines / 2;
return lines;
}