Skip to content

Commit

Permalink
Merge tag 'media/v6.4-4' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/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
  • Loading branch information
torvalds committed Jun 4, 2023
2 parents 209835e + 81f3aff commit 5e89d62
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 15 deletions.
8 changes: 6 additions & 2 deletions drivers/media/cec/core/cec-adap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,8 @@ void cec_received_msg_ts(struct cec_adapter *adap,
mutex_lock(&adap->lock);
dprintk(2, "%s: %*ph\n", __func__, msg->len, msg->msg);

adap->last_initiator = 0xff;
if (!adap->transmit_in_progress)
adap->last_initiator = 0xff;

/* Check if this message was for us (directed or broadcast). */
if (!cec_msg_is_broadcast(msg)) {
Expand Down Expand Up @@ -1585,7 +1586,7 @@ static void cec_claim_log_addrs(struct cec_adapter *adap, bool block)
*
* This function is called with adap->lock held.
*/
static int cec_adap_enable(struct cec_adapter *adap)
int cec_adap_enable(struct cec_adapter *adap)
{
bool enable;
int ret = 0;
Expand All @@ -1595,6 +1596,9 @@ static int cec_adap_enable(struct cec_adapter *adap)
if (adap->needs_hpd)
enable = enable && adap->phys_addr != CEC_PHYS_ADDR_INVALID;

if (adap->devnode.unregistered)
enable = false;

if (enable == adap->is_enabled)
return 0;

Expand Down
2 changes: 2 additions & 0 deletions drivers/media/cec/core/cec-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ static void cec_devnode_unregister(struct cec_adapter *adap)
mutex_lock(&adap->lock);
__cec_s_phys_addr(adap, CEC_PHYS_ADDR_INVALID, false);
__cec_s_log_addrs(adap, NULL, false);
// Disable the adapter (since adap->devnode.unregistered is true)
cec_adap_enable(adap);
mutex_unlock(&adap->lock);

cdev_device_del(&devnode->cdev, &devnode->dev);
Expand Down
1 change: 1 addition & 0 deletions drivers/media/cec/core/cec-priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ int cec_monitor_pin_cnt_inc(struct cec_adapter *adap);
void cec_monitor_pin_cnt_dec(struct cec_adapter *adap);
int cec_adap_status(struct seq_file *file, void *priv);
int cec_thread_func(void *_adap);
int cec_adap_enable(struct cec_adapter *adap);
void __cec_s_phys_addr(struct cec_adapter *adap, u16 phys_addr, bool block);
int __cec_s_log_addrs(struct cec_adapter *adap,
struct cec_log_addrs *log_addrs, bool block);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,9 @@ static void mtk_init_vdec_params(struct mtk_vcodec_ctx *ctx)

if (!(ctx->dev->dec_capability & VCODEC_CAPABILITY_4K_DISABLED)) {
for (i = 0; i < num_supported_formats; i++) {
if (mtk_video_formats[i].type != MTK_FMT_DEC)
continue;

mtk_video_formats[i].frmsize.max_width =
VCODEC_DEC_4K_CODED_WIDTH;
mtk_video_formats[i].frmsize.max_height =
Expand Down
1 change: 0 additions & 1 deletion drivers/media/platform/qcom/camss/camss-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,6 @@ static int video_get_subdev_format(struct camss_video *video,
if (subdev == NULL)
return -EPIPE;

memset(&fmt, 0, sizeof(fmt));
fmt.pad = pad;

ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);
Expand Down
6 changes: 4 additions & 2 deletions drivers/media/platform/verisilicon/hantro_v4l2.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,12 @@ hantro_reset_raw_fmt(struct hantro_ctx *ctx, int bit_depth)
if (!raw_vpu_fmt)
return -EINVAL;

if (ctx->is_encoder)
if (ctx->is_encoder) {
encoded_fmt = &ctx->dst_fmt;
else
ctx->vpu_src_fmt = raw_vpu_fmt;
} else {
encoded_fmt = &ctx->src_fmt;
}

hantro_reset_fmt(&raw_fmt, raw_vpu_fmt);
raw_fmt.width = encoded_fmt->width;
Expand Down
16 changes: 11 additions & 5 deletions drivers/media/usb/uvc/uvc_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,17 @@ static int uvc_parse_format(struct uvc_device *dev,
/* Find the format descriptor from its GUID. */
fmtdesc = uvc_format_by_guid(&buffer[5]);

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

format->fcc = fmtdesc->fcc;
format->bpp = buffer[21];

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

streaming->format = format;
streaming->nformats = nformats;
streaming->nformats = 0;

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

streaming->nformats++;
frame += format->nframes;
format++;

Expand Down
3 changes: 1 addition & 2 deletions drivers/media/v4l2-core/v4l2-mc.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,7 @@ int v4l2_create_fwnode_links_to_pad(struct v4l2_subdev *src_sd,
{
struct fwnode_handle *endpoint;

if (!(sink->flags & MEDIA_PAD_FL_SINK) ||
!is_media_entity_v4l2_subdev(sink->entity))
if (!(sink->flags & MEDIA_PAD_FL_SINK))
return -EINVAL;

fwnode_graph_for_each_endpoint(dev_fwnode(src_sd->dev), endpoint) {
Expand Down
4 changes: 2 additions & 2 deletions drivers/staging/media/atomisp/i2c/atomisp-ov2680.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ static int ov2680_get_fmt(struct v4l2_subdev *sd,
static int ov2680_detect(struct i2c_client *client)
{
struct i2c_adapter *adapter = client->adapter;
u32 high, low;
u32 high = 0, low = 0;
int ret;
u16 id;
u8 revision;
Expand All @@ -383,7 +383,7 @@ static int ov2680_detect(struct i2c_client *client)

ret = ov_read_reg8(client, OV2680_SC_CMMN_CHIP_ID_H, &high);
if (ret) {
dev_err(&client->dev, "sensor_id_high = 0x%x\n", high);
dev_err(&client->dev, "sensor_id_high read failed (%d)\n", ret);
return -ENODEV;
}
ret = ov_read_reg8(client, OV2680_SC_CMMN_CHIP_ID_L, &low);
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/media/imx/imx8mq-mipi-csi2.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ static int imx8mq_mipi_csi_start_stream(struct csi_state *state,
struct v4l2_subdev_state *sd_state)
{
int ret;
u32 hs_settle;
u32 hs_settle = 0;

ret = imx8mq_mipi_csi_sw_reset(state);
if (ret)
Expand Down
1 change: 1 addition & 0 deletions include/media/v4l2-subdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,7 @@ struct v4l2_subdev {
* @vfh: pointer to &struct v4l2_fh
* @state: pointer to &struct v4l2_subdev_state
* @owner: module pointer to the owner of this file handle
* @client_caps: bitmask of ``V4L2_SUBDEV_CLIENT_CAP_*``
*/
struct v4l2_subdev_fh {
struct v4l2_fh vfh;
Expand Down

0 comments on commit 5e89d62

Please sign in to comment.