media updates for v4.17-rc1

-----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJay4MSAAoJEAhfPr2O5OEVtC4QAIT57PnaoQnY/5WJS44D0/2v
 +YrMDVg8qE2kU2tOtVqCZTtlivxF+QUh2IkJXmXkq0cLQ4DBlND/Ftpb1fOl9lhb
 Kvy/B0Cl3v/kIcsLNZ+QAXw8mRkoOumFrG4fuz9Javb+7J6xu/RGvMRohRTMZHeX
 9aTbfhDeVtumvgiYyt/MQFLwzQuoq4FGNEimxTmnp0YYz0qC5f/Iqf2/IIHek+tz
 YQcBOD8lwqGhTOe81zOktgyzjoV+aWXwkvbHTCnQ/1ieuSzYIQ0J07lUEA0j/2gC
 k9YptubzeynKG1o00WN+BjjdzYiND3akuOHr7Vl8BPChQr2dMxukbWZiDJSqr4vh
 yJhNpoHeUoYndzfbdIUd7P+smm2/NoK1sJLwtXGUip7isr/LEWu6eGr7M7DJIGEj
 xuEGxXP7pZ5xCw6yLNcv7KLToSlul4MzAoK+q/+R9bYYOIKvChJCvYuNiPBjkkOS
 PWaNk0uZFLqmd53E6XsG+BoXBeVemf6QI6BD1ivaRQKfA7y3vwzclQeqd8KfZ6r/
 Gn/9iNFxLhI+2ljQaoaYccCfNkfeYQ+BGNW+RHgEWUopXDQXd5ROIwmWBOWdGpLl
 eM0pD/tNENAvmzHA5mRnWVPo8pClOILEvz8LxUqaMJX3UaDqzKo+dCb4wb0Lzz2G
 sSZhoKsNKt+7lIkg4FDk
 =+PjT
 -----END PGP SIGNATURE-----

Merge tag 'media/v4.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull media fixes from Mauro Carvalho Chehab:
 "A series of media updates/fixes for 4.17.

  There are two important core fix patches in this series:

   - A regression fix on Kernel 4.16 with causes it to not work with
     some input devices that depend on media core

   - A fix at compat32 bits with causes it to OOPS on overlay, and
     affects the Kernels where the CVE-2017-13166 was backported

  The remaining ones are other random fixes at the documentation and on
  drivers.

  The biggest part of this series is a set of 18 patches for the Intel
  atomisp driver. Currently, it produces hundreds of warnings/errors on
  sparse/smatch, causing me to sometimes ignore new warnings on other
  drivers that are not so broken. This driver is on really poor state,
  even for staging standards: it has several layers of abstraction on
  it, and it supports two different hardware. Selecting between them
  require to add a define (there isn't even a Kconfig option for such
  purpose). Just on this smatch cleanup, I could easily get rid of 8
  "do-nothing" files. So, I'm seriously considering its removal from
  upstream, if I don't see any real work on addressing the problems
  there along this year"

* tag 'media/v4.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (48 commits)
  media: v4l2-core: fix size of devnode_nums[] bitarray
  media: v4l2-compat-ioctl32: don't oops on overlay
  media: i2c: adv748x: afe: fix sparse warning
  media: extended-controls.rst: transmitter -> receiver
  media: staging: atomisp: stop duplicating input format types
  media: staging: atomisp: get rid of an unused var
  media: staging: atomisp: stop mixing enum types
  media: staging: atomisp: get rid of some static warnings
  media: staging: atomisp: use %p to print pointers
  media: staging: atomisp: remove an useless check
  media: staging: atomisp: avoid a warning if 32 bits build
  media: staging: atomisp: don't access a NULL var
  media: staging: atomisp: Get rid of *default.host.[ch]
  media: staging: atomisp: get rid of an unused function
  media: staging: atomisp: remove unused set_pd_base()
  media: staging: atomisp: fix endianess issues
  media: staging: atomisp: add a missing include
  media: staging: atomisp: get rid of stupid statements
  media: staging: atomisp: declare static vars as such
  media: staging: atomisp: ia_css_output.host: don't use var before check
  ...
This commit is contained in:
Linus Torvalds 2018-04-10 10:10:30 -07:00
commit d36260050e
111 changed files with 815 additions and 1249 deletions

View file

@ -668,7 +668,7 @@ static void cec_pin_rx_states(struct cec_pin *pin, ktime_t ts)
/* Start bit low is too short, go back to idle */
if (delta < CEC_TIM_START_BIT_LOW_MIN - CEC_TIM_IDLE_SAMPLE) {
if (!pin->rx_start_bit_low_too_short_cnt++) {
pin->rx_start_bit_low_too_short_ts = pin->ts;
pin->rx_start_bit_low_too_short_ts = ktime_to_ns(pin->ts);
pin->rx_start_bit_low_too_short_delta = delta;
}
cec_pin_to_idle(pin);
@ -700,7 +700,7 @@ static void cec_pin_rx_states(struct cec_pin *pin, ktime_t ts)
/* Start bit is too short, go back to idle */
if (delta < CEC_TIM_START_BIT_TOTAL_MIN - CEC_TIM_IDLE_SAMPLE) {
if (!pin->rx_start_bit_too_short_cnt++) {
pin->rx_start_bit_too_short_ts = pin->ts;
pin->rx_start_bit_too_short_ts = ktime_to_ns(pin->ts);
pin->rx_start_bit_too_short_delta = delta;
}
cec_pin_to_idle(pin);
@ -770,7 +770,7 @@ static void cec_pin_rx_states(struct cec_pin *pin, ktime_t ts)
*/
if (delta < CEC_TIM_DATA_BIT_TOTAL_MIN) {
if (!pin->rx_data_bit_too_short_cnt++) {
pin->rx_data_bit_too_short_ts = pin->ts;
pin->rx_data_bit_too_short_ts = ktime_to_ns(pin->ts);
pin->rx_data_bit_too_short_delta = delta;
}
cec_pin_low(pin);

View file

@ -1149,7 +1149,7 @@ static void gen_twopix(struct tpg_data *tpg,
case V4L2_PIX_FMT_NV42:
buf[0][offset] = r_y_h;
buf[1][2 * offset] = b_v;
buf[1][(2 * offset + 1) %8] = g_u_s;
buf[1][(2 * offset + 1) % 8] = g_u_s;
break;
case V4L2_PIX_FMT_YUYV:

View file

@ -2089,7 +2089,7 @@ static int dvb_frontend_handle_compat_ioctl(struct file *file, unsigned int cmd,
}
for (i = 0; i < tvps->num; i++) {
err = dtv_property_process_get(
fe, &getp, (struct dtv_property *)tvp + i, file);
fe, &getp, (struct dtv_property *)(tvp + i), file);
if (err < 0) {
kfree(tvp);
return err;

View file

@ -275,7 +275,8 @@ static int adv748x_afe_s_stream(struct v4l2_subdev *sd, int enable)
{
struct adv748x_afe *afe = adv748x_sd_to_afe(sd);
struct adv748x_state *state = adv748x_afe_to_state(afe);
int ret, signal = V4L2_IN_ST_NO_SIGNAL;
u32 signal = V4L2_IN_ST_NO_SIGNAL;
int ret;
mutex_lock(&state->mutex);

View file

@ -1,15 +1,5 @@
/*
* Copyright (c) 2015--2017 Intel Corporation.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version
* 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2015--2017 Intel Corporation.
#include <linux/delay.h>
#include <linux/i2c.h>

View file

@ -1426,7 +1426,7 @@ static int imx274_set_vflip(struct stimx274 *priv, int val)
err = imx274_write_reg(priv, IMX274_VFLIP_REG, val);
if (err) {
dev_err(&priv->client->dev, "VFILP control error\n");
dev_err(&priv->client->dev, "VFLIP control error\n");
return err;
}

View file

@ -1,16 +1,5 @@
/*
* Copyright (c) 2017 Intel Corporation.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version
* 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2017 Intel Corporation.
#include <linux/acpi.h>
#include <linux/i2c.h>
@ -1375,7 +1364,9 @@ ov13858_set_pad_format(struct v4l2_subdev *sd,
if (fmt->format.code != MEDIA_BUS_FMT_SGRBG10_1X10)
fmt->format.code = MEDIA_BUS_FMT_SGRBG10_1X10;
mode = v4l2_find_nearest_size(supported_modes, width, height,
mode = v4l2_find_nearest_size(supported_modes,
ARRAY_SIZE(supported_modes),
width, height,
fmt->format.width, fmt->format.height);
ov13858_update_pad_format(mode, fmt);
if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {

View file

@ -832,7 +832,6 @@ MODULE_DEVICE_TABLE(of, ov2685_of_match);
static struct i2c_driver ov2685_i2c_driver = {
.driver = {
.name = "ov2685",
.owner = THIS_MODULE,
.pm = &ov2685_pm_ops,
.of_match_table = of_match_ptr(ov2685_of_match),
},

View file

@ -1641,6 +1641,9 @@ static int ov5640_set_mode(struct ov5640_dev *sensor,
return 0;
}
static int ov5640_set_framefmt(struct ov5640_dev *sensor,
struct v4l2_mbus_framefmt *format);
/* restore the last set video mode after chip power-on */
static int ov5640_restore_mode(struct ov5640_dev *sensor)
{
@ -1652,7 +1655,11 @@ static int ov5640_restore_mode(struct ov5640_dev *sensor)
return ret;
/* now restore the last capture mode */
return ov5640_set_mode(sensor, &ov5640_mode_init_data);
ret = ov5640_set_mode(sensor, &ov5640_mode_init_data);
if (ret < 0)
return ret;
return ov5640_set_framefmt(sensor, &sensor->fmt);
}
static void ov5640_power(struct ov5640_dev *sensor, bool enable)
@ -1874,7 +1881,13 @@ static int ov5640_try_fmt_internal(struct v4l2_subdev *sd,
if (ov5640_formats[i].code == fmt->code)
break;
if (i >= ARRAY_SIZE(ov5640_formats))
fmt->code = ov5640_formats[0].code;
i = 0;
fmt->code = ov5640_formats[i].code;
fmt->colorspace = ov5640_formats[i].colorspace;
fmt->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(fmt->colorspace);
fmt->quantization = V4L2_QUANTIZATION_FULL_RANGE;
fmt->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(fmt->colorspace);
return 0;
}
@ -1885,6 +1898,7 @@ static int ov5640_set_fmt(struct v4l2_subdev *sd,
{
struct ov5640_dev *sensor = to_ov5640_dev(sd);
const struct ov5640_mode_info *new_mode;
struct v4l2_mbus_framefmt *mbus_fmt = &format->format;
int ret;
if (format->pad != 0)
@ -1897,7 +1911,7 @@ static int ov5640_set_fmt(struct v4l2_subdev *sd,
goto out;
}
ret = ov5640_try_fmt_internal(sd, &format->format,
ret = ov5640_try_fmt_internal(sd, mbus_fmt,
sensor->current_fr, &new_mode);
if (ret)
goto out;
@ -1906,12 +1920,12 @@ static int ov5640_set_fmt(struct v4l2_subdev *sd,
struct v4l2_mbus_framefmt *fmt =
v4l2_subdev_get_try_format(sd, cfg, 0);
*fmt = format->format;
*fmt = *mbus_fmt;
goto out;
}
sensor->current_mode = new_mode;
sensor->fmt = format->format;
sensor->fmt = *mbus_fmt;
sensor->pending_mode_change = true;
out:
mutex_unlock(&sensor->lock);
@ -2496,6 +2510,7 @@ static int ov5640_probe(struct i2c_client *client,
struct device *dev = &client->dev;
struct fwnode_handle *endpoint;
struct ov5640_dev *sensor;
struct v4l2_mbus_framefmt *fmt;
int ret;
sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL);
@ -2503,10 +2518,15 @@ static int ov5640_probe(struct i2c_client *client,
return -ENOMEM;
sensor->i2c_client = client;
sensor->fmt.code = MEDIA_BUS_FMT_UYVY8_2X8;
sensor->fmt.width = 640;
sensor->fmt.height = 480;
sensor->fmt.field = V4L2_FIELD_NONE;
fmt = &sensor->fmt;
fmt->code = ov5640_formats[0].code;
fmt->colorspace = ov5640_formats[0].colorspace;
fmt->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(fmt->colorspace);
fmt->quantization = V4L2_QUANTIZATION_FULL_RANGE;
fmt->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(fmt->colorspace);
fmt->width = 640;
fmt->height = 480;
fmt->field = V4L2_FIELD_NONE;
sensor->frame_interval.numerator = 1;
sensor->frame_interval.denominator = ov5640_framerates[OV5640_30_FPS];
sensor->current_fr = OV5640_30_FPS;

View file

@ -959,23 +959,6 @@ __ov5645_get_pad_crop(struct ov5645 *ov5645, struct v4l2_subdev_pad_config *cfg,
}
}
static const struct ov5645_mode_info *
ov5645_find_nearest_mode(unsigned int width, unsigned int height)
{
int i;
for (i = ARRAY_SIZE(ov5645_mode_info_data) - 1; i >= 0; i--) {
if (ov5645_mode_info_data[i].width <= width &&
ov5645_mode_info_data[i].height <= height)
break;
}
if (i < 0)
i = 0;
return &ov5645_mode_info_data[i];
}
static int ov5645_set_format(struct v4l2_subdev *sd,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_format *format)
@ -989,8 +972,11 @@ static int ov5645_set_format(struct v4l2_subdev *sd,
__crop = __ov5645_get_pad_crop(ov5645, cfg, format->pad,
format->which);
new_mode = ov5645_find_nearest_mode(format->format.width,
format->format.height);
new_mode = v4l2_find_nearest_size(ov5645_mode_info_data,
ARRAY_SIZE(ov5645_mode_info_data),
width, height,
format->format.width, format->format.height);
__crop->width = new_mode->width;
__crop->height = new_mode->height;
@ -1131,13 +1117,14 @@ static int ov5645_probe(struct i2c_client *client,
ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint),
&ov5645->ep);
of_node_put(endpoint);
if (ret < 0) {
dev_err(dev, "parsing endpoint node failed\n");
return ret;
}
of_node_put(endpoint);
if (ov5645->ep.bus_type != V4L2_MBUS_CSI2) {
dev_err(dev, "invalid bus type, must be CSI2\n");
return -EINVAL;

View file

@ -1,16 +1,5 @@
/*
* Copyright (c) 2017 Intel Corporation.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version
* 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2017 Intel Corporation.
#include <linux/acpi.h>
#include <linux/i2c.h>
@ -2230,7 +2219,9 @@ static int ov5670_set_pad_format(struct v4l2_subdev *sd,
fmt->format.code = MEDIA_BUS_FMT_SGRBG10_1X10;
mode = v4l2_find_nearest_size(supported_modes, width, height,
mode = v4l2_find_nearest_size(supported_modes,
ARRAY_SIZE(supported_modes),
width, height,
fmt->format.width, fmt->format.height);
ov5670_update_pad_format(mode, fmt);
if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {

View file

@ -1081,11 +1081,11 @@ static int mtk_jpeg_clk_init(struct mtk_jpeg_dev *jpeg)
jpeg->clk_jdec = devm_clk_get(jpeg->dev, "jpgdec");
if (IS_ERR(jpeg->clk_jdec))
return -EINVAL;
return PTR_ERR(jpeg->clk_jdec);
jpeg->clk_jdec_smi = devm_clk_get(jpeg->dev, "jpgdec-smi");
if (IS_ERR(jpeg->clk_jdec_smi))
return -EINVAL;
return PTR_ERR(jpeg->clk_jdec_smi);
return 0;
}

View file

@ -135,20 +135,21 @@ find_format_by_index(struct venus_inst *inst, unsigned int index, u32 type)
return NULL;
for (i = 0; i < size; i++) {
bool valid;
if (fmt[i].type != type)
continue;
if (k == index)
valid = type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ||
venus_helper_check_codec(inst, fmt[i].pixfmt);
if (k == index && valid)
break;
k++;
if (valid)
k++;
}
if (i == size)
return NULL;
if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE &&
!venus_helper_check_codec(inst, fmt[i].pixfmt))
return NULL;
return &fmt[i];
}

View file

@ -120,20 +120,21 @@ find_format_by_index(struct venus_inst *inst, unsigned int index, u32 type)
return NULL;
for (i = 0; i < size; i++) {
bool valid;
if (fmt[i].type != type)
continue;
if (k == index)
valid = type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ||
venus_helper_check_codec(inst, fmt[i].pixfmt);
if (k == index && valid)
break;
k++;
if (valid)
k++;
}
if (i == size)
return NULL;
if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE &&
!venus_helper_check_codec(inst, fmt[i].pixfmt))
return NULL;
return &fmt[i];
}

View file

@ -561,8 +561,9 @@ int vivid_try_fmt_vid_cap(struct file *file, void *priv,
mp->field = vivid_field_cap(dev, mp->field);
if (vivid_is_webcam(dev)) {
const struct v4l2_frmsize_discrete *sz =
v4l2_find_nearest_size(webcam_sizes, width, height,
mp->width, mp->height);
v4l2_find_nearest_size(webcam_sizes,
VIVID_WEBCAM_SIZES, width,
height, mp->width, mp->height);
w = sz->width;
h = sz->height;

View file

@ -452,7 +452,7 @@ static void wpf_configure(struct vsp1_entity *entity,
: VI6_WPF_SRCRPF_RPF_ACT_SUB(input->entity.index);
}
if (pipe->bru || pipe->num_inputs > 1)
if (pipe->bru)
srcrpf |= pipe->bru->type == VSP1_ENTITY_BRU
? VI6_WPF_SRCRPF_VIRACT_MST
: VI6_WPF_SRCRPF_VIRACT2_MST;

View file

@ -20,6 +20,8 @@
//
// RF Gain set/get is not implemented.
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/videodev2.h>
#include <linux/mutex.h>
#include <linux/slab.h>
@ -2371,7 +2373,7 @@ err:
err_no_gate:
mutex_unlock(&r820t_list_mutex);
tuner_info("%s: failed=%d\n", __func__, rc);
pr_info("%s: failed=%d\n", __func__, rc);
r820t_release(fe);
return NULL;
}

View file

@ -276,7 +276,7 @@ static int start_streaming(struct cx231xx_dvb *dvb)
if (dev->USE_ISO) {
dev_dbg(dev->dev, "DVB transfer mode is ISO.\n");
cx231xx_set_alt_setting(dev, INDEX_TS1, 4);
cx231xx_set_alt_setting(dev, INDEX_TS1, 5);
rc = cx231xx_set_mode(dev, CX231XX_DIGITAL_MODE);
if (rc < 0)
return rc;

View file

@ -7,7 +7,7 @@ menuconfig USB_GSPCA
Say Y here if you want to enable selecting webcams based
on the GSPCA framework.
See <file:Documentation/video4linux/gspca.txt> for more info.
See <file:Documentation/media/v4l-drivers/gspca-cardlist.rst> for more info.
This driver uses the Video For Linux API. You must say Y or M to
"Video For Linux" to use this driver.

View file

@ -101,7 +101,7 @@ static int get_v4l2_window32(struct v4l2_window __user *kp,
static int put_v4l2_window32(struct v4l2_window __user *kp,
struct v4l2_window32 __user *up)
{
struct v4l2_clip __user *kclips = kp->clips;
struct v4l2_clip __user *kclips;
struct v4l2_clip32 __user *uclips;
compat_caddr_t p;
u32 clipcount;
@ -116,6 +116,8 @@ static int put_v4l2_window32(struct v4l2_window __user *kp,
if (!clipcount)
return 0;
if (get_user(kclips, &kp->clips))
return -EFAULT;
if (get_user(p, &up->clips))
return -EFAULT;
uclips = compat_ptr(p);

View file

@ -939,10 +939,14 @@ int __video_register_device(struct video_device *vdev,
#endif
vdev->minor = i + minor_offset;
vdev->num = nr;
devnode_set(vdev);
/* Should not happen since we thought this minor was free */
WARN_ON(video_device[vdev->minor] != NULL);
if (WARN_ON(video_device[vdev->minor])) {
mutex_unlock(&videodev_lock);
printk(KERN_ERR "video_device not empty!\n");
return -ENFILE;
}
devnode_set(vdev);
vdev->index = get_index(vdev);
video_device[vdev->minor] = vdev;
mutex_unlock(&videodev_lock);