Commit fc856f1d authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'media/v5.11-2' of git://git.kernel.org/pub/scm/linux/kernel/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
parents a467b073 e081863a
...@@ -10,5 +10,6 @@ obj-$(CONFIG_CEC_MESON_AO) += meson/ ...@@ -10,5 +10,6 @@ obj-$(CONFIG_CEC_MESON_AO) += meson/
obj-$(CONFIG_CEC_SAMSUNG_S5P) += s5p/ obj-$(CONFIG_CEC_SAMSUNG_S5P) += s5p/
obj-$(CONFIG_CEC_SECO) += seco/ obj-$(CONFIG_CEC_SECO) += seco/
obj-$(CONFIG_CEC_STI) += sti/ obj-$(CONFIG_CEC_STI) += sti/
obj-$(CONFIG_CEC_STM32) += stm32/
obj-$(CONFIG_CEC_TEGRA) += tegra/ obj-$(CONFIG_CEC_TEGRA) += tegra/
...@@ -118,8 +118,7 @@ static int __verify_length(struct vb2_buffer *vb, const struct v4l2_buffer *b) ...@@ -118,8 +118,7 @@ static int __verify_length(struct vb2_buffer *vb, const struct v4l2_buffer *b)
return -EINVAL; return -EINVAL;
} }
} else { } else {
length = (b->memory == VB2_MEMORY_USERPTR || length = (b->memory == VB2_MEMORY_USERPTR)
b->memory == VB2_MEMORY_DMABUF)
? b->length : vb->planes[0].length; ? b->length : vb->planes[0].length;
if (b->bytesused > length) if (b->bytesused > length)
......
...@@ -772,14 +772,8 @@ int ccs_pll_calculate(struct device *dev, const struct ccs_pll_limits *lim, ...@@ -772,14 +772,8 @@ int ccs_pll_calculate(struct device *dev, const struct ccs_pll_limits *lim,
switch (pll->bus_type) { switch (pll->bus_type) {
case CCS_PLL_BUS_TYPE_CSI2_DPHY: 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: case CCS_PLL_BUS_TYPE_CSI2_CPHY:
op_sys_clk_freq_hz_sdr = op_sys_clk_freq_hz_sdr = pll->link_freq * 2
pll->link_freq
* (pll->flags & CCS_PLL_FLAG_LANE_SPEED_MODEL ? * (pll->flags & CCS_PLL_FLAG_LANE_SPEED_MODEL ?
1 : pll->csi2.lanes); 1 : pll->csi2.lanes);
break; break;
......
...@@ -152,7 +152,7 @@ static int ccs_data_parse_version(struct bin_container *bin, ...@@ -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) + vv->version_major = ((u16)v->static_data_version_major[0] << 8) +
v->static_data_version_major[1]; v->static_data_version_major[1];
vv->version_minor = ((u16)v->static_data_version_minor[0] << 8) + 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_year = ((u16)v->year[0] << 8) + v->year[1];
vv->date_month = v->month; vv->date_month = v->month;
vv->date_day = v->day; vv->date_day = v->day;
......
...@@ -302,7 +302,7 @@ static int cio2_csi2_calc_timing(struct cio2_device *cio2, struct cio2_queue *q, ...@@ -302,7 +302,7 @@ static int cio2_csi2_calc_timing(struct cio2_device *cio2, struct cio2_queue *q,
if (!q->sensor) if (!q->sensor)
return -ENODEV; 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) { if (freq < 0) {
dev_err(dev, "error %lld, invalid link_freq\n", freq); dev_err(dev, "error %lld, invalid link_freq\n", freq);
return freq; return freq;
......
...@@ -349,8 +349,10 @@ static void venus_core_shutdown(struct platform_device *pdev) ...@@ -349,8 +349,10 @@ static void venus_core_shutdown(struct platform_device *pdev)
{ {
struct venus_core *core = platform_get_drvdata(pdev); struct venus_core *core = platform_get_drvdata(pdev);
pm_runtime_get_sync(core->dev);
venus_shutdown(core); venus_shutdown(core);
venus_firmware_deinit(core); venus_firmware_deinit(core);
pm_runtime_put_sync(core->dev);
} }
static __maybe_unused int venus_runtime_suspend(struct device *dev) static __maybe_unused int venus_runtime_suspend(struct device *dev)
......
...@@ -654,7 +654,7 @@ static int rvin_parallel_parse_of(struct rvin_dev *vin) ...@@ -654,7 +654,7 @@ static int rvin_parallel_parse_of(struct rvin_dev *vin)
out: out:
fwnode_handle_put(fwnode); fwnode_handle_put(fwnode);
return 0; return ret;
} }
static int rvin_parallel_init(struct rvin_dev *vin) static int rvin_parallel_init(struct rvin_dev *vin)
......
...@@ -320,7 +320,7 @@ static int ir_mce_kbd_decode(struct rc_dev *dev, struct ir_raw_event ev) ...@@ -320,7 +320,7 @@ static int ir_mce_kbd_decode(struct rc_dev *dev, struct ir_raw_event ev)
data->body); data->body);
spin_lock(&data->keylock); spin_lock(&data->keylock);
if (scancode) { if (scancode) {
delay = nsecs_to_jiffies(dev->timeout) + delay = usecs_to_jiffies(dev->timeout) +
msecs_to_jiffies(100); msecs_to_jiffies(100);
mod_timer(&data->rx_timeout, jiffies + delay); mod_timer(&data->rx_timeout, jiffies + delay);
} else { } else {
......
...@@ -1551,7 +1551,7 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id ...@@ -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; rdev->s_rx_carrier_range = ite_set_rx_carrier_range;
/* FIFO threshold is 17 bytes, so 17 * 8 samples minimum */ /* FIFO threshold is 17 bytes, so 17 * 8 samples minimum */
rdev->min_timeout = 17 * 8 * ITE_BAUDRATE_DIVISOR * rdev->min_timeout = 17 * 8 * ITE_BAUDRATE_DIVISOR *
itdev->params.sample_period; itdev->params.sample_period / 1000;
rdev->timeout = IR_DEFAULT_TIMEOUT; rdev->timeout = IR_DEFAULT_TIMEOUT;
rdev->max_timeout = 10 * IR_DEFAULT_TIMEOUT; rdev->max_timeout = 10 * IR_DEFAULT_TIMEOUT;
rdev->rx_resolution = ITE_BAUDRATE_DIVISOR * rdev->rx_resolution = ITE_BAUDRATE_DIVISOR *
......
...@@ -737,7 +737,7 @@ static unsigned int repeat_period(int protocol) ...@@ -737,7 +737,7 @@ static unsigned int repeat_period(int protocol)
void rc_repeat(struct rc_dev *dev) void rc_repeat(struct rc_dev *dev)
{ {
unsigned long flags; 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)); msecs_to_jiffies(repeat_period(dev->last_protocol));
struct lirc_scancode sc = { struct lirc_scancode sc = {
.scancode = dev->last_scancode, .rc_proto = dev->last_protocol, .scancode = dev->last_scancode, .rc_proto = dev->last_protocol,
...@@ -855,7 +855,7 @@ void rc_keydown(struct rc_dev *dev, enum rc_proto protocol, u64 scancode, ...@@ -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); ir_do_keydown(dev, protocol, scancode, keycode, toggle);
if (dev->keypressed) { 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)); msecs_to_jiffies(repeat_period(protocol));
mod_timer(&dev->timer_keyup, dev->keyup_jiffies); mod_timer(&dev->timer_keyup, dev->keyup_jiffies);
} }
...@@ -1928,6 +1928,8 @@ int rc_register_device(struct rc_dev *dev) ...@@ -1928,6 +1928,8 @@ int rc_register_device(struct rc_dev *dev)
goto out_raw; goto out_raw;
} }
dev->registered = true;
rc = device_add(&dev->dev); rc = device_add(&dev->dev);
if (rc) if (rc)
goto out_rx_free; goto out_rx_free;
...@@ -1937,8 +1939,6 @@ int rc_register_device(struct rc_dev *dev) ...@@ -1937,8 +1939,6 @@ int rc_register_device(struct rc_dev *dev)
dev->device_name ?: "Unspecified device", path ?: "N/A"); dev->device_name ?: "Unspecified device", path ?: "N/A");
kfree(path); kfree(path);
dev->registered = true;
/* /*
* once the the input device is registered in rc_setup_rx_device, * once the the input device is registered in rc_setup_rx_device,
* userspace can open the input device and rc_open() will be called * userspace can open the input device and rc_open() will be called
......
...@@ -385,7 +385,7 @@ static irqreturn_t serial_ir_irq_handler(int i, void *blah) ...@@ -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 ? */ } while (!(sinp(UART_IIR) & UART_IIR_NO_INT)); /* still pending ? */
mod_timer(&serial_ir.timeout_timer, 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); ir_raw_event_handle(serial_ir.rcdev);
......
...@@ -442,7 +442,7 @@ int v4l2_fill_pixfmt(struct v4l2_pix_format *pixfmt, u32 pixelformat, ...@@ -442,7 +442,7 @@ int v4l2_fill_pixfmt(struct v4l2_pix_format *pixfmt, u32 pixelformat,
} }
EXPORT_SYMBOL_GPL(v4l2_fill_pixfmt); 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) unsigned int div)
{ {
struct v4l2_ctrl *ctrl; struct v4l2_ctrl *ctrl;
...@@ -473,4 +473,4 @@ s64 v4l2_get_link_rate(struct v4l2_ctrl_handler *handler, unsigned int mul, ...@@ -473,4 +473,4 @@ s64 v4l2_get_link_rate(struct v4l2_ctrl_handler *handler, unsigned int mul,
return freq > 0 ? freq : -EINVAL; return freq > 0 ? freq : -EINVAL;
} }
EXPORT_SYMBOL_GPL(v4l2_get_link_rate); EXPORT_SYMBOL_GPL(v4l2_get_link_freq);
...@@ -367,7 +367,7 @@ hantro_reset_raw_fmt(struct hantro_ctx *ctx) ...@@ -367,7 +367,7 @@ hantro_reset_raw_fmt(struct hantro_ctx *ctx)
hantro_reset_fmt(raw_fmt, raw_vpu_fmt); hantro_reset_fmt(raw_fmt, raw_vpu_fmt);
raw_fmt->width = encoded_fmt->width; raw_fmt->width = encoded_fmt->width;
raw_fmt->width = encoded_fmt->width; raw_fmt->height = encoded_fmt->height;
if (ctx->is_encoder) if (ctx->is_encoder)
hantro_set_fmt_out(ctx, raw_fmt); hantro_set_fmt_out(ctx, raw_fmt);
else else
......
...@@ -203,7 +203,7 @@ static void _cedrus_write_ref_list(struct cedrus_ctx *ctx, ...@@ -203,7 +203,7 @@ static void _cedrus_write_ref_list(struct cedrus_ctx *ctx,
position = cedrus_buf->codec.h264.position; position = cedrus_buf->codec.h264.position;
sram_array[i] |= position << 1; 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); sram_array[i] |= BIT(0);
} }
......
...@@ -520,7 +520,7 @@ int v4l2_fill_pixfmt_mp(struct v4l2_pix_format_mplane *pixfmt, u32 pixelformat, ...@@ -520,7 +520,7 @@ int v4l2_fill_pixfmt_mp(struct v4l2_pix_format_mplane *pixfmt, u32 pixelformat,
u32 width, u32 height); 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 * @handler: The transmitter's control handler
* @mul: The multiplier between pixel rate and link frequency. Bits per pixel on * @mul: The multiplier between pixel rate and link frequency. Bits per pixel on
...@@ -537,7 +537,7 @@ int v4l2_fill_pixfmt_mp(struct v4l2_pix_format_mplane *pixfmt, u32 pixelformat, ...@@ -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 * -ENOENT: Link frequency or pixel rate control not found
* -EINVAL: Invalid link frequency value * -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); unsigned int div);
static inline u64 v4l2_buffer_get_timestamp(const struct v4l2_buffer *buf) static inline u64 v4l2_buffer_get_timestamp(const struct v4l2_buffer *buf)
......
...@@ -176,7 +176,7 @@ struct v4l2_subdev_capability { ...@@ -176,7 +176,7 @@ struct v4l2_subdev_capability {
}; };
/* The v4l2 sub-device video device node is registered in read-only mode. */ /* 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 */ /* Backwards compatibility define --- to be removed */
#define v4l2_subdev_edid v4l2_edid #define v4l2_subdev_edid v4l2_edid
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment