Skip to content

Commit 5e89d62

Browse files
committed
Merge tag 'media/v6.4-4' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media fixes from Mauro Carvalho Chehab: "Some driver fixes: - a regression fix for the verisilicon driver - uvcvideo: don't expose unsupported video formats to userspace - camss-video: don't zero subdev format after init - mediatek: some fixes for 4K decoder formats - fix a Sphinx build warning (missing doc for client_caps) - some fixes for imx and atomisp staging drivers And two CEC core fixes: - don't set last_initiator if TX in progress - disable adapter in cec_devnode_unregister" * tag 'media/v6.4-4' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: media: uvcvideo: Don't expose unsupported formats to userspace media: v4l2-subdev: Fix missing kerneldoc for client_caps media: staging: media: imx: initialize hs_settle to avoid warning media: v4l2-mc: Drop subdev check in v4l2_create_fwnode_links_to_pad() media: staging: media: atomisp: init high & low vars media: cec: core: don't set last_initiator if tx in progress media: cec: core: disable adapter in cec_devnode_unregister media: mediatek: vcodec: Only apply 4K frame sizes on decoder formats media: camss: camss-video: Don't zero subdev format again after initialization media: verisilicon: Additional fix for the crash when opening the driver
2 parents 209835e + 81f3aff commit 5e89d62

File tree

11 files changed

+32
-15
lines changed

11 files changed

+32
-15
lines changed

drivers/media/cec/core/cec-adap.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,8 @@ void cec_received_msg_ts(struct cec_adapter *adap,
10911091
mutex_lock(&adap->lock);
10921092
dprintk(2, "%s: %*ph\n", __func__, msg->len, msg->msg);
10931093

1094-
adap->last_initiator = 0xff;
1094+
if (!adap->transmit_in_progress)
1095+
adap->last_initiator = 0xff;
10951096

10961097
/* Check if this message was for us (directed or broadcast). */
10971098
if (!cec_msg_is_broadcast(msg)) {
@@ -1585,7 +1586,7 @@ static void cec_claim_log_addrs(struct cec_adapter *adap, bool block)
15851586
*
15861587
* This function is called with adap->lock held.
15871588
*/
1588-
static int cec_adap_enable(struct cec_adapter *adap)
1589+
int cec_adap_enable(struct cec_adapter *adap)
15891590
{
15901591
bool enable;
15911592
int ret = 0;
@@ -1595,6 +1596,9 @@ static int cec_adap_enable(struct cec_adapter *adap)
15951596
if (adap->needs_hpd)
15961597
enable = enable && adap->phys_addr != CEC_PHYS_ADDR_INVALID;
15971598

1599+
if (adap->devnode.unregistered)
1600+
enable = false;
1601+
15981602
if (enable == adap->is_enabled)
15991603
return 0;
16001604

drivers/media/cec/core/cec-core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ static void cec_devnode_unregister(struct cec_adapter *adap)
191191
mutex_lock(&adap->lock);
192192
__cec_s_phys_addr(adap, CEC_PHYS_ADDR_INVALID, false);
193193
__cec_s_log_addrs(adap, NULL, false);
194+
// Disable the adapter (since adap->devnode.unregistered is true)
195+
cec_adap_enable(adap);
194196
mutex_unlock(&adap->lock);
195197

196198
cdev_device_del(&devnode->cdev, &devnode->dev);

drivers/media/cec/core/cec-priv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ int cec_monitor_pin_cnt_inc(struct cec_adapter *adap);
4747
void cec_monitor_pin_cnt_dec(struct cec_adapter *adap);
4848
int cec_adap_status(struct seq_file *file, void *priv);
4949
int cec_thread_func(void *_adap);
50+
int cec_adap_enable(struct cec_adapter *adap);
5051
void __cec_s_phys_addr(struct cec_adapter *adap, u16 phys_addr, bool block);
5152
int __cec_s_log_addrs(struct cec_adapter *adap,
5253
struct cec_log_addrs *log_addrs, bool block);

drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,9 @@ static void mtk_init_vdec_params(struct mtk_vcodec_ctx *ctx)
584584

585585
if (!(ctx->dev->dec_capability & VCODEC_CAPABILITY_4K_DISABLED)) {
586586
for (i = 0; i < num_supported_formats; i++) {
587+
if (mtk_video_formats[i].type != MTK_FMT_DEC)
588+
continue;
589+
587590
mtk_video_formats[i].frmsize.max_width =
588591
VCODEC_DEC_4K_CODED_WIDTH;
589592
mtk_video_formats[i].frmsize.max_height =

drivers/media/platform/qcom/camss/camss-video.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,6 @@ static int video_get_subdev_format(struct camss_video *video,
353353
if (subdev == NULL)
354354
return -EPIPE;
355355

356-
memset(&fmt, 0, sizeof(fmt));
357356
fmt.pad = pad;
358357

359358
ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);

drivers/media/platform/verisilicon/hantro_v4l2.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,12 @@ hantro_reset_raw_fmt(struct hantro_ctx *ctx, int bit_depth)
397397
if (!raw_vpu_fmt)
398398
return -EINVAL;
399399

400-
if (ctx->is_encoder)
400+
if (ctx->is_encoder) {
401401
encoded_fmt = &ctx->dst_fmt;
402-
else
402+
ctx->vpu_src_fmt = raw_vpu_fmt;
403+
} else {
403404
encoded_fmt = &ctx->src_fmt;
405+
}
404406

405407
hantro_reset_fmt(&raw_fmt, raw_vpu_fmt);
406408
raw_fmt.width = encoded_fmt->width;

drivers/media/usb/uvc/uvc_driver.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,14 +251,17 @@ static int uvc_parse_format(struct uvc_device *dev,
251251
/* Find the format descriptor from its GUID. */
252252
fmtdesc = uvc_format_by_guid(&buffer[5]);
253253

254-
if (fmtdesc != NULL) {
255-
format->fcc = fmtdesc->fcc;
256-
} else {
254+
if (!fmtdesc) {
255+
/*
256+
* Unknown video formats are not fatal errors, the
257+
* caller will skip this descriptor.
258+
*/
257259
dev_info(&streaming->intf->dev,
258260
"Unknown video format %pUl\n", &buffer[5]);
259-
format->fcc = 0;
261+
return 0;
260262
}
261263

264+
format->fcc = fmtdesc->fcc;
262265
format->bpp = buffer[21];
263266

264267
/*
@@ -675,7 +678,7 @@ static int uvc_parse_streaming(struct uvc_device *dev,
675678
interval = (u32 *)&frame[nframes];
676679

677680
streaming->format = format;
678-
streaming->nformats = nformats;
681+
streaming->nformats = 0;
679682

680683
/* Parse the format descriptors. */
681684
while (buflen > 2 && buffer[1] == USB_DT_CS_INTERFACE) {
@@ -689,7 +692,10 @@ static int uvc_parse_streaming(struct uvc_device *dev,
689692
&interval, buffer, buflen);
690693
if (ret < 0)
691694
goto error;
695+
if (!ret)
696+
break;
692697

698+
streaming->nformats++;
693699
frame += format->nframes;
694700
format++;
695701

drivers/media/v4l2-core/v4l2-mc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,7 @@ int v4l2_create_fwnode_links_to_pad(struct v4l2_subdev *src_sd,
314314
{
315315
struct fwnode_handle *endpoint;
316316

317-
if (!(sink->flags & MEDIA_PAD_FL_SINK) ||
318-
!is_media_entity_v4l2_subdev(sink->entity))
317+
if (!(sink->flags & MEDIA_PAD_FL_SINK))
319318
return -EINVAL;
320319

321320
fwnode_graph_for_each_endpoint(dev_fwnode(src_sd->dev), endpoint) {

drivers/staging/media/atomisp/i2c/atomisp-ov2680.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ static int ov2680_get_fmt(struct v4l2_subdev *sd,
373373
static int ov2680_detect(struct i2c_client *client)
374374
{
375375
struct i2c_adapter *adapter = client->adapter;
376-
u32 high, low;
376+
u32 high = 0, low = 0;
377377
int ret;
378378
u16 id;
379379
u8 revision;
@@ -383,7 +383,7 @@ static int ov2680_detect(struct i2c_client *client)
383383

384384
ret = ov_read_reg8(client, OV2680_SC_CMMN_CHIP_ID_H, &high);
385385
if (ret) {
386-
dev_err(&client->dev, "sensor_id_high = 0x%x\n", high);
386+
dev_err(&client->dev, "sensor_id_high read failed (%d)\n", ret);
387387
return -ENODEV;
388388
}
389389
ret = ov_read_reg8(client, OV2680_SC_CMMN_CHIP_ID_L, &low);

drivers/staging/media/imx/imx8mq-mipi-csi2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ static int imx8mq_mipi_csi_start_stream(struct csi_state *state,
354354
struct v4l2_subdev_state *sd_state)
355355
{
356356
int ret;
357-
u32 hs_settle;
357+
u32 hs_settle = 0;
358358

359359
ret = imx8mq_mipi_csi_sw_reset(state);
360360
if (ret)

include/media/v4l2-subdev.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,6 +1119,7 @@ struct v4l2_subdev {
11191119
* @vfh: pointer to &struct v4l2_fh
11201120
* @state: pointer to &struct v4l2_subdev_state
11211121
* @owner: module pointer to the owner of this file handle
1122+
* @client_caps: bitmask of ``V4L2_SUBDEV_CLIENT_CAP_*``
11221123
*/
11231124
struct v4l2_subdev_fh {
11241125
struct v4l2_fh vfh;

0 commit comments

Comments
 (0)