Skip to content

Commit 44d81ba

Browse files
authored
Merge branch 'rpi-6.18.y' into rpi-6.18-sr9900
2 parents 7a55480 + 5d49b59 commit 44d81ba

9 files changed

Lines changed: 98 additions & 87 deletions

File tree

drivers/gpu/drm/vc4/vc4_hdmi.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -841,14 +841,12 @@ static void vc4_hdmi_encoder_post_crtc_disable(struct drm_encoder *encoder,
841841

842842
mutex_lock(&vc4_hdmi->mutex);
843843

844-
vc4_hdmi->packet_ram_enabled = false;
845-
846844
if (!drm_dev_enter(drm, &idx))
847845
goto out;
848846

849847
spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
850848

851-
HDMI_WRITE(HDMI_RAM_PACKET_CONFIG, 0);
849+
HDMI_WRITE(HDMI_RAM_PACKET_CONFIG, VC4_HDMI_RAM_PACKET_ENABLE);
852850

853851
HDMI_WRITE(HDMI_VID_CTL, HDMI_READ(HDMI_VID_CTL) | VC4_HD_VID_CTL_CLRRGB);
854852

@@ -1622,9 +1620,6 @@ static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder,
16221620
WARN_ONCE(ret, "Timeout waiting for "
16231621
"VC4_HDMI_SCHEDULER_CONTROL_HDMI_ACTIVE\n");
16241622
} else {
1625-
HDMI_WRITE(HDMI_RAM_PACKET_CONFIG,
1626-
HDMI_READ(HDMI_RAM_PACKET_CONFIG) &
1627-
~(VC4_HDMI_RAM_PACKET_ENABLE));
16281623
HDMI_WRITE(HDMI_SCHEDULER_CONTROL,
16291624
HDMI_READ(HDMI_SCHEDULER_CONTROL) &
16301625
~VC4_HDMI_SCHEDULER_CONTROL_MODE_HDMI);
@@ -1643,11 +1638,7 @@ static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder,
16431638
WARN_ON(!(HDMI_READ(HDMI_SCHEDULER_CONTROL) &
16441639
VC4_HDMI_SCHEDULER_CONTROL_HDMI_ACTIVE));
16451640

1646-
HDMI_WRITE(HDMI_RAM_PACKET_CONFIG,
1647-
VC4_HDMI_RAM_PACKET_ENABLE);
1648-
16491641
spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags);
1650-
vc4_hdmi->packet_ram_enabled = true;
16511642

16521643
drm_atomic_helper_connector_hdmi_update_infoframes(connector, state);
16531644
}
@@ -3107,6 +3098,12 @@ static int vc5_hdmi_init_resources(struct drm_device *drm,
31073098
static int vc4_hdmi_runtime_suspend(struct device *dev)
31083099
{
31093100
struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);
3101+
unsigned long flags;
3102+
3103+
spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
3104+
HDMI_WRITE(HDMI_RAM_PACKET_CONFIG, 0);
3105+
spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags);
3106+
31103107

31113108
clk_disable_unprepare(vc4_hdmi->audio_clock);
31123109
/* we no longer require a minimum clock rate */
@@ -3119,7 +3116,7 @@ static int vc4_hdmi_runtime_suspend(struct device *dev)
31193116
static int vc4_hdmi_runtime_resume(struct device *dev)
31203117
{
31213118
struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);
3122-
unsigned long __maybe_unused flags;
3119+
unsigned long flags;
31233120
u32 __maybe_unused value;
31243121
unsigned long rate;
31253122
int ret;
@@ -3167,6 +3164,11 @@ static int vc4_hdmi_runtime_resume(struct device *dev)
31673164
}
31683165
#endif
31693166

3167+
spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
3168+
HDMI_WRITE(HDMI_RAM_PACKET_CONFIG,
3169+
VC4_HDMI_RAM_PACKET_ENABLE);
3170+
spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags);
3171+
31703172
return 0;
31713173

31723174
err_disable_clk:

drivers/gpu/drm/vc4/vc4_hdmi.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,6 @@ struct vc4_hdmi {
192192
*/
193193
struct drm_display_mode saved_adjusted_mode;
194194

195-
/**
196-
* @packet_ram_enabled: Is the HDMI controller packet RAM currently
197-
* on? Protected by @mutex.
198-
*/
199-
bool packet_ram_enabled;
200-
201195
/**
202196
* @scdc_enabled: Is the HDMI controller currently running with
203197
* the scrambler on? Protected by @mutex.

drivers/media/i2c/tc358743.c

Lines changed: 9 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,6 @@ static void tc358743_set_ref_clk(struct v4l2_subdev *sd)
756756
static void tc358743_set_csi_color_space(struct v4l2_subdev *sd)
757757
{
758758
struct tc358743_state *state = to_state(sd);
759-
struct device *dev = &state->i2c_client->dev;
760759

761760
switch (state->mbus_fmt_code) {
762761
case MEDIA_BUS_FMT_UYVY8_1X16:
@@ -772,17 +771,7 @@ static void tc358743_set_csi_color_space(struct v4l2_subdev *sd)
772771
mutex_unlock(&state->confctl_mutex);
773772
break;
774773
case MEDIA_BUS_FMT_RGB888_1X24:
775-
/*
776-
* The driver was initially introduced with RGB888
777-
* support, but CSI really means BGR.
778-
*
779-
* Since we might have applications that would have
780-
* hard-coded the RGB888, let's support both.
781-
*/
782-
dev_warn_once(dev, "RGB format isn't actually supported by the hardware. The application should be fixed to use BGR.");
783-
fallthrough;
784-
case MEDIA_BUS_FMT_BGR888_1X24:
785-
v4l2_dbg(2, debug, sd, "%s: BGR 888 24-bit\n", __func__);
774+
v4l2_dbg(2, debug, sd, "%s: RGB 888 24-bit\n", __func__);
786775
i2c_wr8_and_or(sd, VOUT_SET2,
787776
~(MASK_SEL422 | MASK_VOUT_422FIL_100) & 0xff,
788777
0x00);
@@ -1443,26 +1432,11 @@ static int tc358743_log_status(struct v4l2_subdev *sd)
14431432
v4l2_info(sd, "Stopped: %s\n",
14441433
(i2c_rd16(sd, CSI_STATUS) & MASK_S_HLT) ?
14451434
"yes" : "no");
1446-
1447-
switch (state->mbus_fmt_code) {
1448-
case MEDIA_BUS_FMT_BGR888_1X24:
1449-
/*
1450-
* The driver was initially introduced with RGB888
1451-
* support, but CSI really means BGR.
1452-
*
1453-
* Since we might have applications that would have
1454-
* hard-coded the RGB888, let's support both.
1455-
*/
1456-
case MEDIA_BUS_FMT_RGB888_1X24:
1457-
v4l2_info(sd, "Color space: BGR 888 24-bit\n");
1458-
break;
1459-
case MEDIA_BUS_FMT_UYVY8_1X16:
1460-
v4l2_info(sd, "Color space: YCbCr 422 16-bit\n");
1461-
break;
1462-
default:
1463-
v4l2_info(sd, "Color space: Unsupported\n");
1464-
break;
1465-
}
1435+
v4l2_info(sd, "Color space: %s\n",
1436+
state->mbus_fmt_code == MEDIA_BUS_FMT_UYVY8_1X16 ?
1437+
"YCbCr 422 16-bit" :
1438+
state->mbus_fmt_code == MEDIA_BUS_FMT_RGB888_1X24 ?
1439+
"RGB 888 24-bit" : "Unsupported");
14661440

14671441
v4l2_info(sd, "-----%s status-----\n", is_hdmi(sd) ? "HDMI" : "DVI-D");
14681442
v4l2_info(sd, "HDCP encrypted content: %s\n",
@@ -1799,18 +1773,11 @@ static int tc358743_enum_mbus_code(struct v4l2_subdev *sd,
17991773
{
18001774
switch (code->index) {
18011775
case 0:
1802-
code->code = MEDIA_BUS_FMT_BGR888_1X24;
1776+
code->code = MEDIA_BUS_FMT_RGB888_1X24;
18031777
break;
18041778
case 1:
18051779
code->code = MEDIA_BUS_FMT_UYVY8_1X16;
18061780
break;
1807-
case 2:
1808-
/*
1809-
* We need to keep RGB888 for backward compatibility,
1810-
* but we should list it last for userspace to pick BGR.
1811-
*/
1812-
code->code = MEDIA_BUS_FMT_RGB888_1X24;
1813-
break;
18141781
default:
18151782
return -EINVAL;
18161783
}
@@ -1820,7 +1787,6 @@ static int tc358743_enum_mbus_code(struct v4l2_subdev *sd,
18201787
static u32 tc358743_g_colorspace(u32 code)
18211788
{
18221789
switch (code) {
1823-
case MEDIA_BUS_FMT_BGR888_1X24:
18241790
case MEDIA_BUS_FMT_RGB888_1X24:
18251791
return V4L2_COLORSPACE_SRGB;
18261792
case MEDIA_BUS_FMT_UYVY8_1X16:
@@ -1858,8 +1824,7 @@ static int tc358743_set_fmt(struct v4l2_subdev *sd,
18581824
u32 code = format->format.code; /* is overwritten by get_fmt */
18591825
int ret = tc358743_get_fmt(sd, sd_state, format);
18601826

1861-
if (code == MEDIA_BUS_FMT_BGR888_1X24 ||
1862-
code == MEDIA_BUS_FMT_RGB888_1X24 ||
1827+
if (code == MEDIA_BUS_FMT_RGB888_1X24 ||
18631828
code == MEDIA_BUS_FMT_UYVY8_1X16)
18641829
format->format.code = code;
18651830
format->format.colorspace = tc358743_g_colorspace(format->format.code);
@@ -2279,7 +2244,7 @@ static int tc358743_probe(struct i2c_client *client)
22792244
if (err < 0)
22802245
goto err_hdl;
22812246

2282-
state->mbus_fmt_code = MEDIA_BUS_FMT_BGR888_1X24;
2247+
state->mbus_fmt_code = MEDIA_BUS_FMT_RGB888_1X24;
22832248

22842249
sd->dev = &client->dev;
22852250

drivers/media/platform/broadcom/bcm2835-unicam.c

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,12 @@ static const struct unicam_format_info unicam_image_formats[] = {
342342
.csi_dt = MIPI_CSI2_DT_RGB565,
343343
}, {
344344
.fourcc = V4L2_PIX_FMT_RGB24, /* rgb */
345-
.code = MEDIA_BUS_FMT_RGB888_1X24,
345+
.code = MEDIA_BUS_FMT_BGR888_1X24,
346346
.depth = 24,
347347
.csi_dt = MIPI_CSI2_DT_RGB888,
348348
}, {
349349
.fourcc = V4L2_PIX_FMT_BGR24, /* bgr */
350-
.code = MEDIA_BUS_FMT_BGR888_1X24,
350+
.code = MEDIA_BUS_FMT_RGB888_1X24,
351351
.depth = 24,
352352
.csi_dt = MIPI_CSI2_DT_RGB888,
353353
}, {
@@ -2148,22 +2148,45 @@ static int unicam_video_link_validate(struct media_link *link)
21482148
const struct v4l2_pix_format *fmt = &node->fmt.fmt.pix;
21492149
const struct unicam_format_info *fmtinfo;
21502150

2151-
fmtinfo = unicam_find_format_by_fourcc(fmt->pixelformat,
2152-
UNICAM_SD_PAD_SOURCE_IMAGE);
2151+
fmtinfo = unicam_find_format_by_code(format->code,
2152+
UNICAM_SD_PAD_SOURCE_IMAGE);
21532153
if (WARN_ON(!fmtinfo)) {
21542154
ret = -EPIPE;
21552155
goto out;
21562156
}
21572157

2158-
if (fmtinfo->code != format->code ||
2159-
fmt->height != format->height ||
2158+
/*
2159+
* Unicam initially associated BGR24 to BGR888_1X24 and RGB24 to
2160+
* RGB888_1X24.
2161+
*
2162+
* In order to allow the applications using the old behaviour to
2163+
* run, let's accept the old combination, but warn about it.
2164+
*/
2165+
if (fmtinfo->fourcc != fmt->pixelformat) {
2166+
if ((fmt->pixelformat == V4L2_PIX_FMT_BGR24 &&
2167+
format->code == MEDIA_BUS_FMT_BGR888_1X24) ||
2168+
(fmt->pixelformat == V4L2_PIX_FMT_RGB24 &&
2169+
format->code == MEDIA_BUS_FMT_RGB888_1X24)) {
2170+
dev_warn_once(node->dev->dev,
2171+
"Incorrect pixel format %p4cc for 0x%04x. Fix your application to use %p4cc.\n",
2172+
&fmt->pixelformat, format->code, &fmtinfo->fourcc);
2173+
} else {
2174+
dev_dbg(node->dev->dev,
2175+
"image: format mismatch: 0x%04x <=> %p4cc\n",
2176+
format->code, &fmt->pixelformat);
2177+
ret = -EPIPE;
2178+
goto out;
2179+
}
2180+
}
2181+
2182+
if (fmt->height != format->height ||
21602183
fmt->width != format->width ||
21612184
fmt->field != format->field) {
21622185
dev_dbg(node->dev->dev,
2163-
"image: (%u x %u) 0x%08x %s != (%u x %u) 0x%08x %s\n",
2164-
fmt->width, fmt->height, fmtinfo->code,
2186+
"image: (%u x %u) %s != (%u x %u) %s\n",
2187+
fmt->width, fmt->height,
21652188
v4l2_field_names[fmt->field],
2166-
format->width, format->height, format->code,
2189+
format->width, format->height,
21672190
v4l2_field_names[format->field]);
21682191
ret = -EPIPE;
21692192
}

drivers/media/platform/raspberrypi/rp1-cfe/cfe-fmts.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ static const struct cfe_fmt formats[] = {
6262
},
6363
{
6464
.fourcc = V4L2_PIX_FMT_RGB24, /* rgb */
65-
.code = MEDIA_BUS_FMT_RGB888_1X24,
65+
.code = MEDIA_BUS_FMT_BGR888_1X24,
6666
.depth = 24,
6767
.csi_dt = MIPI_CSI2_DT_RGB888,
6868
},
6969
{
7070
.fourcc = V4L2_PIX_FMT_BGR24, /* bgr */
71-
.code = MEDIA_BUS_FMT_BGR888_1X24,
71+
.code = MEDIA_BUS_FMT_RGB888_1X24,
7272
.depth = 24,
7373
.csi_dt = MIPI_CSI2_DT_RGB888,
7474
},

drivers/media/platform/raspberrypi/rp1-cfe/cfe.c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,13 +1807,30 @@ static int cfe_video_link_validate(struct media_link *link)
18071807
goto out;
18081808
}
18091809

1810-
fmt = find_format_by_code_and_fourcc(source_fmt->code,
1811-
pix_fmt->pixelformat);
1810+
fmt = find_format_by_code(source_fmt->code);
1811+
18121812
if (!fmt) {
1813-
cfe_err(cfe, "Format mismatch!\n");
1813+
cfe_err(cfe, "Format mismatch - unknown code!\n");
18141814
ret = -EINVAL;
18151815
goto out;
18161816
}
1817+
1818+
if (fmt->fourcc != pix_fmt->pixelformat) {
1819+
if ((pix_fmt->pixelformat == V4L2_PIX_FMT_BGR24 &&
1820+
source_fmt->code == MEDIA_BUS_FMT_BGR888_1X24) ||
1821+
(pix_fmt->pixelformat == V4L2_PIX_FMT_RGB24 &&
1822+
source_fmt->code == MEDIA_BUS_FMT_RGB888_1X24)) {
1823+
dev_warn_once(&cfe->pdev->dev,
1824+
"Incorrect pixel format %p4cc for 0x%04x. Fix your application to use %p4cc.\n",
1825+
&pix_fmt->pixelformat,
1826+
source_fmt->code, &fmt->fourcc);
1827+
} else {
1828+
cfe_err(cfe, "Format mismatch! Code %u fourcc %p4cc\n",
1829+
source_fmt->code, &pix_fmt->pixelformat);
1830+
ret = -EINVAL;
1831+
goto out;
1832+
}
1833+
}
18171834
} else if (is_csi2_node(node) && is_meta_output_node(node)) {
18181835
struct v4l2_meta_format *meta_fmt = &node->meta_fmt.fmt.meta;
18191836
const struct cfe_fmt *fmt;

drivers/media/platform/raspberrypi/rp1_cfe/cfe.c

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,7 +1676,6 @@ static int cfe_video_link_validate(struct cfe_node *node,
16761676
if (is_image_output_node(node)) {
16771677
struct v4l2_pix_format *pix_fmt = &node->vid_fmt.fmt.pix;
16781678
const struct cfe_fmt *fmt = NULL;
1679-
unsigned int i;
16801679

16811680
if (remote_fmt->width != pix_fmt->width ||
16821681
remote_fmt->height != pix_fmt->height) {
@@ -1687,17 +1686,29 @@ static int cfe_video_link_validate(struct cfe_node *node,
16871686
return -EINVAL;
16881687
}
16891688

1690-
for (i = 0; i < ARRAY_SIZE(formats); i++) {
1691-
if (formats[i].code == remote_fmt->code &&
1692-
formats[i].fourcc == pix_fmt->pixelformat) {
1693-
fmt = &formats[i];
1694-
break;
1695-
}
1696-
}
1689+
fmt = find_format_by_code(remote_fmt->code);
1690+
16971691
if (!fmt) {
1698-
cfe_err("Format mismatch!\n");
1692+
cfe_err("Format not found. %08x %p4cc\n",
1693+
remote_fmt->code, &pix_fmt->pixelformat);
16991694
return -EINVAL;
17001695
}
1696+
1697+
if (fmt->fourcc != pix_fmt->pixelformat) {
1698+
if ((pix_fmt->pixelformat == V4L2_PIX_FMT_BGR24 &&
1699+
remote_fmt->code == MEDIA_BUS_FMT_BGR888_1X24) ||
1700+
(pix_fmt->pixelformat == V4L2_PIX_FMT_RGB24 &&
1701+
remote_fmt->code == MEDIA_BUS_FMT_RGB888_1X24)) {
1702+
dev_warn_once(&cfe->pdev->dev,
1703+
"Incorrect pixel format %p4cc for 0x%04x. Fix your application to use %p4cc.\n",
1704+
&pix_fmt->pixelformat,
1705+
remote_fmt->code, &fmt->fourcc);
1706+
} else {
1707+
cfe_err("Format mismatch! Code %u fourcc %p4cc\n",
1708+
remote_fmt->code, &pix_fmt->pixelformat);
1709+
return -EINVAL;
1710+
}
1711+
}
17011712
} else if (is_csi2_node(node) && is_meta_output_node(node)) {
17021713
struct v4l2_meta_format *meta_fmt = &node->meta_fmt.fmt.meta;
17031714
const struct cfe_fmt *fmt;

drivers/media/platform/raspberrypi/rp1_cfe/cfe_fmts.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ static const struct cfe_fmt formats[] = {
6363
},
6464
{
6565
.fourcc = V4L2_PIX_FMT_RGB24, /* rgb */
66-
.code = MEDIA_BUS_FMT_RGB888_1X24,
66+
.code = MEDIA_BUS_FMT_BGR888_1X24,
6767
.depth = 24,
6868
.csi_dt = MIPI_CSI2_DT_RGB888,
6969
},
7070
{
7171
.fourcc = V4L2_PIX_FMT_BGR24, /* bgr */
72-
.code = MEDIA_BUS_FMT_BGR888_1X24,
72+
.code = MEDIA_BUS_FMT_RGB888_1X24,
7373
.depth = 24,
7474
.csi_dt = MIPI_CSI2_DT_RGB888,
7575
},

drivers/pwm/pwm-pio-rp1.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ static int pwm_pio_rp1_probe(struct platform_device *pdev)
224224
pwm_pio_resolution = (1000u * 1000 * 1000 * pwm_loop_ticks) / clock_get_hz(clk_sys);
225225

226226
chip->ops = &pwm_pio_rp1_ops;
227-
chip->atomic = true;
228227
chip->npwm = 1;
229228

230229
platform_set_drvdata(pdev, ppwm);

0 commit comments

Comments
 (0)