Skip to content

Commit

Permalink
Merge tag 'media/v5.11-2' of git://git.kernel.org/pub/scm/linux/kerne…
Browse files Browse the repository at this point in the history
…l/git/mchehab/linux-media

Pull media fixes from Mauro Carvalho Chehab:

 - a V4L2 core regression at videobuf2 when checking for single-plane
   dmabuf

 - a change at uAPI header v4l2-subdev.h, fixing a breakage as BIT()
   macro is not available in userspace

 - fix some regressions at RC core due to the usage of microseconds
   everywhere on it

 - a fix for a race condition at RC core

 - a rename on a newly-introduced kAPI symbol (v4l2_get_link_rate),
   currently used only by a single driver

 - Regression fixes for rcar-vin, cedrus, ite-cir, hantro, css, venus,
   and cec drivers.

* tag 'media/v5.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
  media: hantro: Fix reset_raw_fmt initialization
  media: cec: add stm32 driver
  media: cedrus: Fix H264 decoding
  media: v4l2-subdev.h: BIT() is not available in userspace
  media: Revert "media: videobuf2: Fix length check for single plane dmabuf queueing"
  media: rc: ite-cir: fix min_timeout calculation
  media: venus: core: Fix platform driver shutdown
  media: rc: fix timeout handling after switch to microsecond durations
  media: v4l: common: Fix naming of v4l2_get_link_rate
  media: rcar-vin: fix return, use ret instead of zero
  media: ccs: Get static data version minor correctly
  media: ccs-pll: Fix link frequency for C-PHY
  media: rc: ensure that uevent can be read directly after rc device register
  • Loading branch information
torvalds committed Jan 28, 2021
2 parents a467b07 + e081863 commit fc856f1
Show file tree
Hide file tree
Showing 16 changed files with 22 additions and 26 deletions.
1 change: 1 addition & 0 deletions drivers/media/cec/platform/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ obj-$(CONFIG_CEC_MESON_AO) += meson/
obj-$(CONFIG_CEC_SAMSUNG_S5P) += s5p/
obj-$(CONFIG_CEC_SECO) += seco/
obj-$(CONFIG_CEC_STI) += sti/
obj-$(CONFIG_CEC_STM32) += stm32/
obj-$(CONFIG_CEC_TEGRA) += tegra/

3 changes: 1 addition & 2 deletions drivers/media/common/videobuf2/videobuf2-v4l2.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ static int __verify_length(struct vb2_buffer *vb, const struct v4l2_buffer *b)
return -EINVAL;
}
} else {
length = (b->memory == VB2_MEMORY_USERPTR ||
b->memory == VB2_MEMORY_DMABUF)
length = (b->memory == VB2_MEMORY_USERPTR)
? b->length : vb->planes[0].length;

if (b->bytesused > length)
Expand Down
8 changes: 1 addition & 7 deletions drivers/media/i2c/ccs-pll.c
Original file line number Diff line number Diff line change
Expand Up @@ -772,14 +772,8 @@ int ccs_pll_calculate(struct device *dev, const struct ccs_pll_limits *lim,

switch (pll->bus_type) {
case CCS_PLL_BUS_TYPE_CSI2_DPHY:
/* CSI transfers 2 bits per clock per lane; thus times 2 */
op_sys_clk_freq_hz_sdr = pll->link_freq * 2
* (pll->flags & CCS_PLL_FLAG_LANE_SPEED_MODEL ?
1 : pll->csi2.lanes);
break;
case CCS_PLL_BUS_TYPE_CSI2_CPHY:
op_sys_clk_freq_hz_sdr =
pll->link_freq
op_sys_clk_freq_hz_sdr = pll->link_freq * 2
* (pll->flags & CCS_PLL_FLAG_LANE_SPEED_MODEL ?
1 : pll->csi2.lanes);
break;
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/i2c/ccs/ccs-data.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ static int ccs_data_parse_version(struct bin_container *bin,
vv->version_major = ((u16)v->static_data_version_major[0] << 8) +
v->static_data_version_major[1];
vv->version_minor = ((u16)v->static_data_version_minor[0] << 8) +
v->static_data_version_major[1];
v->static_data_version_minor[1];
vv->date_year = ((u16)v->year[0] << 8) + v->year[1];
vv->date_month = v->month;
vv->date_day = v->day;
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/pci/intel/ipu3/ipu3-cio2.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ static int cio2_csi2_calc_timing(struct cio2_device *cio2, struct cio2_queue *q,
if (!q->sensor)
return -ENODEV;

freq = v4l2_get_link_rate(q->sensor->ctrl_handler, bpp, lanes);
freq = v4l2_get_link_freq(q->sensor->ctrl_handler, bpp, lanes);
if (freq < 0) {
dev_err(dev, "error %lld, invalid link_freq\n", freq);
return freq;
Expand Down
2 changes: 2 additions & 0 deletions drivers/media/platform/qcom/venus/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,10 @@ static void venus_core_shutdown(struct platform_device *pdev)
{
struct venus_core *core = platform_get_drvdata(pdev);

pm_runtime_get_sync(core->dev);
venus_shutdown(core);
venus_firmware_deinit(core);
pm_runtime_put_sync(core->dev);
}

static __maybe_unused int venus_runtime_suspend(struct device *dev)
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/platform/rcar-vin/rcar-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ static int rvin_parallel_parse_of(struct rvin_dev *vin)
out:
fwnode_handle_put(fwnode);

return 0;
return ret;
}

static int rvin_parallel_init(struct rvin_dev *vin)
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/rc/ir-mce_kbd-decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ static int ir_mce_kbd_decode(struct rc_dev *dev, struct ir_raw_event ev)
data->body);
spin_lock(&data->keylock);
if (scancode) {
delay = nsecs_to_jiffies(dev->timeout) +
delay = usecs_to_jiffies(dev->timeout) +
msecs_to_jiffies(100);
mod_timer(&data->rx_timeout, jiffies + delay);
} else {
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/rc/ite-cir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1551,7 +1551,7 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
rdev->s_rx_carrier_range = ite_set_rx_carrier_range;
/* FIFO threshold is 17 bytes, so 17 * 8 samples minimum */
rdev->min_timeout = 17 * 8 * ITE_BAUDRATE_DIVISOR *
itdev->params.sample_period;
itdev->params.sample_period / 1000;
rdev->timeout = IR_DEFAULT_TIMEOUT;
rdev->max_timeout = 10 * IR_DEFAULT_TIMEOUT;
rdev->rx_resolution = ITE_BAUDRATE_DIVISOR *
Expand Down
8 changes: 4 additions & 4 deletions drivers/media/rc/rc-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ static unsigned int repeat_period(int protocol)
void rc_repeat(struct rc_dev *dev)
{
unsigned long flags;
unsigned int timeout = nsecs_to_jiffies(dev->timeout) +
unsigned int timeout = usecs_to_jiffies(dev->timeout) +
msecs_to_jiffies(repeat_period(dev->last_protocol));
struct lirc_scancode sc = {
.scancode = dev->last_scancode, .rc_proto = dev->last_protocol,
Expand Down Expand Up @@ -855,7 +855,7 @@ void rc_keydown(struct rc_dev *dev, enum rc_proto protocol, u64 scancode,
ir_do_keydown(dev, protocol, scancode, keycode, toggle);

if (dev->keypressed) {
dev->keyup_jiffies = jiffies + nsecs_to_jiffies(dev->timeout) +
dev->keyup_jiffies = jiffies + usecs_to_jiffies(dev->timeout) +
msecs_to_jiffies(repeat_period(protocol));
mod_timer(&dev->timer_keyup, dev->keyup_jiffies);
}
Expand Down Expand Up @@ -1928,6 +1928,8 @@ int rc_register_device(struct rc_dev *dev)
goto out_raw;
}

dev->registered = true;

rc = device_add(&dev->dev);
if (rc)
goto out_rx_free;
Expand All @@ -1937,8 +1939,6 @@ int rc_register_device(struct rc_dev *dev)
dev->device_name ?: "Unspecified device", path ?: "N/A");
kfree(path);

dev->registered = true;

/*
* once the the input device is registered in rc_setup_rx_device,
* userspace can open the input device and rc_open() will be called
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/rc/serial_ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ static irqreturn_t serial_ir_irq_handler(int i, void *blah)
} while (!(sinp(UART_IIR) & UART_IIR_NO_INT)); /* still pending ? */

mod_timer(&serial_ir.timeout_timer,
jiffies + nsecs_to_jiffies(serial_ir.rcdev->timeout));
jiffies + usecs_to_jiffies(serial_ir.rcdev->timeout));

ir_raw_event_handle(serial_ir.rcdev);

Expand Down
4 changes: 2 additions & 2 deletions drivers/media/v4l2-core/v4l2-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ int v4l2_fill_pixfmt(struct v4l2_pix_format *pixfmt, u32 pixelformat,
}
EXPORT_SYMBOL_GPL(v4l2_fill_pixfmt);

s64 v4l2_get_link_rate(struct v4l2_ctrl_handler *handler, unsigned int mul,
s64 v4l2_get_link_freq(struct v4l2_ctrl_handler *handler, unsigned int mul,
unsigned int div)
{
struct v4l2_ctrl *ctrl;
Expand Down Expand Up @@ -473,4 +473,4 @@ s64 v4l2_get_link_rate(struct v4l2_ctrl_handler *handler, unsigned int mul,

return freq > 0 ? freq : -EINVAL;
}
EXPORT_SYMBOL_GPL(v4l2_get_link_rate);
EXPORT_SYMBOL_GPL(v4l2_get_link_freq);
2 changes: 1 addition & 1 deletion drivers/staging/media/hantro/hantro_v4l2.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ hantro_reset_raw_fmt(struct hantro_ctx *ctx)

hantro_reset_fmt(raw_fmt, raw_vpu_fmt);
raw_fmt->width = encoded_fmt->width;
raw_fmt->width = encoded_fmt->width;
raw_fmt->height = encoded_fmt->height;
if (ctx->is_encoder)
hantro_set_fmt_out(ctx, raw_fmt);
else
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/media/sunxi/cedrus/cedrus_h264.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ static void _cedrus_write_ref_list(struct cedrus_ctx *ctx,
position = cedrus_buf->codec.h264.position;

sram_array[i] |= position << 1;
if (ref_list[i].fields & V4L2_H264_BOTTOM_FIELD_REF)
if (ref_list[i].fields == V4L2_H264_BOTTOM_FIELD_REF)
sram_array[i] |= BIT(0);
}

Expand Down
4 changes: 2 additions & 2 deletions include/media/v4l2-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ int v4l2_fill_pixfmt_mp(struct v4l2_pix_format_mplane *pixfmt, u32 pixelformat,
u32 width, u32 height);

/**
* v4l2_get_link_rate - Get link rate from transmitter
* v4l2_get_link_freq - Get link rate from transmitter
*
* @handler: The transmitter's control handler
* @mul: The multiplier between pixel rate and link frequency. Bits per pixel on
Expand All @@ -537,7 +537,7 @@ int v4l2_fill_pixfmt_mp(struct v4l2_pix_format_mplane *pixfmt, u32 pixelformat,
* -ENOENT: Link frequency or pixel rate control not found
* -EINVAL: Invalid link frequency value
*/
s64 v4l2_get_link_rate(struct v4l2_ctrl_handler *handler, unsigned int mul,
s64 v4l2_get_link_freq(struct v4l2_ctrl_handler *handler, unsigned int mul,
unsigned int div);

static inline u64 v4l2_buffer_get_timestamp(const struct v4l2_buffer *buf)
Expand Down
2 changes: 1 addition & 1 deletion include/uapi/linux/v4l2-subdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ struct v4l2_subdev_capability {
};

/* The v4l2 sub-device video device node is registered in read-only mode. */
#define V4L2_SUBDEV_CAP_RO_SUBDEV BIT(0)
#define V4L2_SUBDEV_CAP_RO_SUBDEV 0x00000001

/* Backwards compatibility define --- to be removed */
#define v4l2_subdev_edid v4l2_edid
Expand Down

0 comments on commit fc856f1

Please sign in to comment.