summaryrefslogtreecommitdiff
path: root/drivers/media
AgeCommit message (Collapse)Author
2020-01-08media: v4l2-core: only zero-out ioctl-read buffersArnd Bergmann
The memset() got moved out of the check for _IOC_NONE, so passing a made-up command number with a size but no direction would allow clearing data on user-provided pointers. Move video_get_user() back into the _IOC_NONE check where it belongs. Reported-by: syzbot+54fd8cca4b7226c94b8e@syzkaller.appspotmail.com Fixes: 6c625c01c7a6 ("media: v4l2-core: split out data copy from video_usercopy") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-08media: rc: ir-hix5hd2: add hi3796cv300-ir supportShawn Guo
The IR device on Hi3796CV300 SoC is mostly same as hix5hd2, except the following two things. - IR_CLK offset is 0x60 instead of 0x48. - It needs to set an extra bit in IR_ENABLE register to enable IR. The following changes are made to deal with them. - Define a SoC specific data to accommodate IR_CLK offset and the flag telling requirement of extra enable bit. - Create function hix5hd2_ir_enable() to handle IR enabling. The original hix5hd2_ir_enable() is all about managing IR clock, so gets renamed to hix5hd2_ir_clk_enable(). - Device table hix5hd2_ir_table[] gets moved forward, as it's being used by hix5hd2_ir_probe() now. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-08media: dvb-core: Fix receiving invalid EIT-sectionsJohann Friedrichs
Resetting buf without resetting pusi_seen at a channel-switch can lead to copying the rest of a section to the start of buf, but treating it as a complete section, when the next pusi arrives. EIT-sections starting without valid header were randomly received during an EIT-scan on a transponder. Signed-off-by: Johann Friedrichs <johann.friedrichs@web.de> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-08media: au8522: improve formattingDaniel W. S. Almeida
This patch fixes the following scripts/checkpatch.pl errors: ERROR: space required before the open parenthesis '(' + switch(input) { Suggested-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-08media: as102: improve formattingDaniel W. S. Almeida
This patch fixes the following scripts/checkpatch.pl error: ERROR: open brace '{' following function definitions go on the next line +static int as102_fe_get_tune_settings(struct dvb_frontend *fe, + struct dvb_frontend_tune_settings *settings) { Suggested-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-08media: dvb_dummy_fe: change printk to pr_warnDaniel W. S. Almeida
Replaces printk with pr_err to fix warnings from checkpatch.pl Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-08media: dvb_dummy_fe: Add blank line after declarationDaniel W. S. Almeida
Fix checkpatch.pl error by adding a blank line Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-08media: dvb_dummy_fe: Fix ERROR: POINTER_LOCATION, AVOID_EXTERN and long linesDaniel W. S. Almeida
Change foo* bar to foo *bar to avoid ERROR: POINTER_LOCATION in checkpatch ERROR: "foo* bar" should be "foo *bar" +static int dvb_dummy_fe_read_signal_strength(struct dvb_frontend* fe, u16* strength) ERROR: "foo* bar" should be "foo *bar" +static int dvb_dummy_fe_read_signal_strength(struct dvb_frontend* fe, u16* strength) ERROR: "foo* bar" should be "foo *bar" +static int dvb_dummy_fe_read_snr(struct dvb_frontend* fe, u16* snr) ERROR: "foo* bar" should be "foo *bar" +static int dvb_dummy_fe_read_snr(struct dvb_frontend* fe, u16* snr) ERROR: "foo* bar" should be "foo *bar" +static int dvb_dummy_fe_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) ERROR: "foo* bar" should be "foo *bar" +static int dvb_dummy_fe_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) ERROR: "foo* bar" should be "foo *bar" +static int dvb_dummy_fe_sleep(struct dvb_frontend* fe) ERROR: "foo* bar" should be "foo *bar" +static int dvb_dummy_fe_init(struct dvb_frontend* fe) ERROR: "foo* bar" should be "foo *bar" +static void dvb_dummy_fe_release(struct dvb_frontend* fe) ERROR: "foo* bar" should be "foo *bar" + struct dvb_dummy_fe_state* state = fe->demodulator_priv; ERROR: "foo* bar" should be "foo *bar" +struct dvb_frontend* dvb_dummy_fe_ofdm_attach(void) ERROR: "foo* bar" should be "foo *bar" + struct dvb_dummy_fe_state* state = NULL; ERROR: "foo* bar" should be "foo *bar" + struct dvb_dummy_fe_state* state = NULL; ERROR: "foo* bar" should be "foo *bar" + struct dvb_dummy_fe_state* state = NULL; remove 'extern' keyword from declaration Fix CHECK:AVOID_EXTERNS: extern prototypes should be avoided in .h files by removing it. Fix long lines Break long lines into smaller ones to improve readability. WARNING: line over 80 characters + memcpy(&state->frontend.ops, &dvb_dummy_fe_ofdm_ops, sizeof(struct dvb_frontend_ops)); WARNING: line over 80 characters + memcpy(&state->frontend.ops, &dvb_dummy_fe_qpsk_ops, sizeof(struct dvb_frontend_ops)); WARNING: line over 80 characters + memcpy(&state->frontend.ops, &dvb_dummy_fe_qam_ops, sizeof(struct dvb_frontend_ops)); WARNING: line over 80 characters + FE_CAN_FEC_4_5 | FE_CAN_FEC_5_6 | FE_CAN_FEC_6_7 | WARNING: line over 80 characters + FE_CAN_FEC_7_8 | FE_CAN_FEC_8_9 | FE_CAN_FEC_AUTO | WARNING: line over 80 characters + FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO | WARNING: line over 80 characters + .symbol_rate_min = (57840000 / 2) / 6 Suggested-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-08media: dib0090: incorrect format specifier detected by clangSean Young
drivers/media/dvb-frontends/dib0090.c:1751:67: warning: format specifies type 'short' but the argument has type 'u8' (aka 'unsigned char') [-Wformat] dprintk("BB Offset Cal, BBreg=%hd,Offset=%hd,Value Set=%hd\n", state->dc->addr, state->adc_diff, state->step); ~~~ ^~~~~~~~~~~~~~~ %hhu drivers/media/dvb-frontends/dib0090.c:30:22: note: expanded from macro 'dprintk' __func__, ##arg); \ ^~~ drivers/media/dvb-frontends/dib0090.c:1751:101: warning: format specifies type 'short' but the argument has type 's8' (aka 'signed char') [-Wformat] dprintk("BB Offset Cal, BBreg=%hd,Offset=%hd,Value Set=%hd\n", state->dc->addr, state->adc_diff, state->step); ~~~ ^~~~~~~~~~~ %hhd drivers/media/dvb-frontends/dib0090.c:30:22: note: expanded from macro 'dprintk' __func__, ##arg); \ ^~~ Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-08media: dib0070: incorrect format specifiers detected by clangSean Young
drivers/media/dvb-frontends/dib0070.c:192:52: warning: format specifies type 'short' but the argument has type 's8' (aka 'signed char') [-Wformat] dprintk("CAPTRIM=%hd; ADC = %hd (ADC) & %dmV\n", state->captrim, adc, (u32) adc*(u32)1800/(u32)1024); ~~~ ^~~~~~~~~~~~~~ %hhd drivers/media/dvb-frontends/dib0070.c:30:22: note: expanded from macro 'dprintk' __func__, ##arg); \ ^~~ drivers/media/dvb-frontends/dib0070.c:203:59: warning: format specifies type 'short' but the argument has type 's8' (aka 'signed char') [-Wformat] dprintk("CAPTRIM=%hd is closer to target (%hd/%hd)\n", state->captrim, adc, state->adc_diff); ~~~ ^~~~~~~~~~~~~~ %hhd drivers/media/dvb-frontends/dib0070.c:30:22: note: expanded from macro 'dprintk' __func__, ##arg); \ ^~~ drivers/media/dvb-frontends/dib0070.c:367:46: warning: format specifies type 'short' but the argument has type 'u8' (aka 'unsigned char') [-Wformat] dprintk("Tuning for Band: %hd (%d kHz)\n", band, freq); ~~~ ^~~~ %hhu drivers/media/dvb-frontends/dib0070.c:30:22: note: expanded from macro 'dprintk' __func__, ##arg); \ ^~~ drivers/media/dvb-frontends/dib0070.c:445:39: warning: format specifies type 'short' but the argument has type 'u8' (aka 'unsigned char') [-Wformat] dprintk("REFDIV: %hd, FREF: %d\n", REFDIV, FREF); ~~~ ^~~~~~ %hhu drivers/media/dvb-frontends/dib0070.c:30:22: note: expanded from macro 'dprintk' __func__, ##arg); \ ^~~ drivers/media/dvb-frontends/dib0070.c:447:57: warning: format specifies type 'short' but the argument has type 'u8' (aka 'unsigned char') [-Wformat] dprintk("Num: %hd, Den: %hd, SD: %hd\n", (u16) Rest, Den, (state->lo4 >> 12) & 0x1); ~~~ ^~~ %hhu drivers/media/dvb-frontends/dib0070.c:30:22: note: expanded from macro 'dprintk' __func__, ##arg); \ ^~~ drivers/media/dvb-frontends/dib0070.c:447:62: warning: format specifies type 'short' but the argument has type 'int' [-Wformat] dprintk("Num: %hd, Den: %hd, SD: %hd\n", (u16) Rest, Den, (state->lo4 >> 12) & 0x1); ~~~ ^~~~~~~~~~~~~~~~~~~~~~~~ %d drivers/media/dvb-frontends/dib0070.c:30:22: note: expanded from macro 'dprintk' __func__, ##arg); \ ^~~ drivers/media/dvb-frontends/dib0070.c:448:33: warning: format specifies type 'short' but the argument has type 'u8' (aka 'unsigned char') [-Wformat] dprintk("HFDIV code: %hd\n", state->current_tune_table_index->hfdiv); ~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %hhu drivers/media/dvb-frontends/dib0070.c:30:22: note: expanded from macro 'dprintk' __func__, ##arg); \ ^~~ drivers/media/dvb-frontends/dib0070.c:449:27: warning: format specifies type 'short' but the argument has type 'u8' (aka 'unsigned char') [-Wformat] dprintk("VCO = %hd\n", state->current_tune_table_index->vco_band); ~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %hhu drivers/media/dvb-frontends/dib0070.c:30:22: note: expanded from macro 'dprintk' __func__, ##arg); \ ^~~ drivers/media/dvb-frontends/dib0070.c:450:40: warning: format specifies type 'short' but the argument has type 'u8' (aka 'unsigned char') [-Wformat] dprintk("VCOF: ((%hd*%d) << 1))\n", state->current_tune_table_index->vco_multi, freq); ~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %hhu drivers/media/dvb-frontends/dib0070.c:30:22: note: expanded from macro 'dprintk' __func__, ##arg); \ ^~~ Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-08media: dib7000p: incorrect format specifier detected by clangSean Young
drivers/media/dvb-frontends/dib7000p.c:918:37: warning: format specifies type 'short' but the argument has type 'u8' (aka 'unsigned char') [-Wformat] dprintk("SPLIT %p: %hd\n", demod, agc_split); ~~~ ^~~~~~~~~ %hhu Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-08media: dib7000m: incorrect format specifier detected by clangSean Young
drivers/media/dvb-frontends/dib7000m.c:811:38: warning: format specifies type 'short' but the argument has type 'u8' (aka 'unsigned char') [-Wformat] dprintk("SPLIT %p: %hd\n", demod, agc_split); ~~~ ^~~~~~~~~ %hhu Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-08Merge tag 'v5.5-rc5' into patchworkMauro Carvalho Chehab
Linux 5.5-rc5 * tag 'v5.5-rc5': (1006 commits) Linux 5.5-rc5 Documentation: riscv: add patch acceptance guidelines riscv: prefix IRQ_ macro names with an RV_ namespace clocksource: riscv: add notrace to riscv_sched_clock apparmor: fix aa_xattrs_match() may sleep while holding a RCU lock hexagon: define ioremap_uc ocfs2: fix the crash due to call ocfs2_get_dlm_debug once less ocfs2: call journal flush to mark journal as empty after journal recovery when mount mm/hugetlb: defer freeing of huge pages if in non-task context mm/gup: fix memory leak in __gup_benchmark_ioctl mm/oom: fix pgtables units mismatch in Killed process message fs/posix_acl.c: fix kernel-doc warnings hexagon: work around compiler crash hexagon: parenthesize registers in asm predicates fs/namespace.c: make to_mnt_ns() static fs/nsfs.c: include headers for missing declarations fs/direct-io.c: include fs/internal.h for missing prototype mm: move_pages: return valid node id in status if the page is already on the target node memcg: account security cred as well to kmemcg kcov: fix struct layout for kcov_remote_arg ...
2020-01-07cros_ec: treewide: Remove 'include/linux/mfd/cros_ec.h'Enric Balletbo i Serra
This header file now only includes the cros_ec_dev struct, however, is the 'include/linux/platform_data/cros_ec_proto.h' who contains the definition of all the Chrome OS EC related structs. There is no reason to have a separate include for this struct so move to the place where other structs are defined. That way, we can remove the include itself, but also simplify the common pattern #include <linux/mfd/cros_ec.h> #include <linux/platform_data/cros_ec_proto.h> for a single include #include <linux/platform_data/cros_ec_proto.h> The changes to remove the cros_ec.h include were generated with the following shell script: git grep -l "<linux/mfd/cros_ec.h>" | xargs sed -i '/<linux\/mfd\/cros_ec.h>/d' Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Acked-by: Lee Jones <lee.jones@linaro.org> Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Acked-by: Sebastian Reichel <sre@kernel.org> Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2020-01-06remove ioremap_nocache and devm_ioremap_nocacheChristoph Hellwig
ioremap has provided non-cached semantics by default since the Linux 2.6 days, so remove the additional ioremap_nocache interface. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Arnd Bergmann <arnd@arndb.de>
2020-01-04Merge tag 'media/v5.5-3' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media Pull media fixes from Mauro Carvalho Chehab: - some fixes at CEC core to comply with HDMI 2.0 specs and fix some border cases - a fix at the transmission logic of the pulse8-cec driver - one alignment fix on a data struct at ipu3 when built with 32 bits * tag 'media/v5.5-3' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: media: intel-ipu3: Align struct ipu3_uapi_awb_fr_config_s to 32 bytes media: pulse8-cec: fix lost cec_transmit_attempt_done() call media: cec: check 'transmit_in_progress', not 'transmitting' media: cec: avoid decrementing transmit_queue_sz if it is 0 media: cec: CEC 2.0-only bcast messages were ignored
2020-01-04media: sun4i-csi: Add support for A10 CSI1 camera sensor interfaceChen-Yu Tsai
The A10/A20 Allwinner SoCs have two camera sensor interface blocks, named CSI0 and CSI1. The two have the same register layouts with slightly different features: - CSI0 has an image signal processor (ISP); CSI1 doesn't - CSI0 can support up to four separate channels under CCIR656; CSI1 can only support one - CSI0 can support up to 16-bit wide bus with YUV422; CSI1 can support up to 24-bit wide bus with YUV444 For now the driver doesn't support wide busses, nor CCIR656. So the only relevant difference is whether a clock needs to be taken and enabled for the ISP. Add structs to record the differences, tie them to the compatible strings, and deal with the ISP clock. Support for the new CSI1 hardware block is added as well. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Maxime Ripard <mripard@kernel.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-04media: sun4i-csi: Deal with DRAM offsetChen-Yu Tsai
On Allwinner SoCs, some high memory bandwidth devices do DMA directly over the memory bus (called MBUS), instead of the system bus. These devices include the CSI camera sensor interface, video (codec) engine, display subsystem, etc.. The memory bus has a different addressing scheme without the DRAM starting offset. Deal with this using the "interconnects" property from the device tree, or if that is not available, set dev->dma_pfn_offset to PHYS_PFN_OFFSET. Fixes: 577bbf23b758 ("media: sunxi: Add A10 CSI driver") Signed-off-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Maxime Ripard <mripard@kernel.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-04media: sun4i-csi: Fix [HV]sync polarity handlingChen-Yu Tsai
The Allwinner camera sensor interface has a different definition of [HV]sync. While the timing diagram uses the names HSYNC and VSYNC, the note following the diagram and register names use HREF and VREF. Combined they imply the hardware uses either [HV]REF or inverted [HV]SYNC. There are also registers to set horizontal skip lengths in pixels and vertical skip lengths in lines, also known as back porches. Fix the polarity handling by using the opposite polarity flag for the checks. Also rename `[hv]sync_pol` to `[hv]ref_pol` to better match the hardware register description. Fixes: 577bbf23b758 ("media: sunxi: Add A10 CSI driver") Signed-off-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Maxime Ripard <mripard@kernel.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-04media: sun4i-csi: Fix data sampling polarity handlingChen-Yu Tsai
The CLK_POL field specifies whether data is sampled on the falling or rising edge of PCLK, not whether the data lines are active high or low. Evidence of this can be found in the timing diagram labeled "horizontal size setting and pixel clock timing". Fix the setting by checking the correct flag, V4L2_MBUS_PCLK_SAMPLE_RISING. While at it, reorder the three polarity flag checks so HSYNC and VSYNC are grouped together. Fixes: 577bbf23b758 ("media: sunxi: Add A10 CSI driver") Signed-off-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Maxime Ripard <mripard@kernel.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-04media: i2c: mt9v032: fix enum mbus codes and frame sizesEugen Hristev
This driver supports both the mt9v032 (color) and the mt9v022 (mono) sensors. Depending on which sensor is used, the format from the sensor is different. The format.code inside the dev struct holds this information. The enum mbus and enum frame sizes need to take into account both type of sensors, not just the color one. To solve this, use the format.code in these functions instead of the hardcoded bayer color format (which is only used for mt9v032). [Sakari Ailus: rewrapped commit message] Suggested-by: Wenyou Yang <wenyou.yang@microchip.com> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-04media: ov5640: Fix check for PLL1 exceeding max allowed rateAdam Ford
The variable _rate is by ov5640_compute_sys_clk() which returns zero if the PLL exceeds 1GHz. Unfortunately, the check to see if the max PLL1 output is checking 'rate' and not '_rate' and 'rate' does not ever appear to be 0. This patch changes the check against the returned value of '_rate' to determine if the PLL1 output exceeds 1GHz. Fixes: aa2882481cad ("media: ov5640: Adjust the clock based on the expected rate") Signed-off-by: Adam Ford <aford173@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-04media: ov5640: Put max framerate into table and simplify checkAdam Ford
Currently the various modes are placed into a table, but when ov5640_find_mode is called, it has to double check whether or not the requested framerate is tolerated by the mode. The determination is based on checking hact, vact, and frame rate. Only 640x480 is allowed at 60fps and QSXGA is limited to 15fps, but as the number of permitted frame rates change, this will begin to add more and more complexity to the check. This patch simplifies the check by adding the max framerate allowed for each mode into the table of modes. It then compares the requested framerate to the max permitted in the mode's table. This reduces the number of comparisions to one down from three at run-time. Signed-off-by: Adam Ford <aford173@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-03media: smiapp: Put the device again if starting streaming failsSakari Ailus
If there was an error in starting streaming, put the runtime usage count of the device. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-03media: smiapp: Avoid maintaining power state informationSakari Ailus
Instead of keeping track of the power state ourselves, let runtime PM handle it. This also splits handling controls between side effect management and writing the new configuration to the sensor's registers. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-03media: omap3isp: Don't restart CCDC if we're about to stopSakari Ailus
The omap3isp driver set the new buffer and enabled the CCDC in a situation a new buffer was available but streaming was about to be stopped on the CCDC. This lead to frequent system crashes in case there were buffers queued when streming was being stopped. Fix this by first checking whether there's an intent to stop streaming and if there isn't, then set the new buffer and re-enable CCDC. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-03media: omap3isp: Ignore failure of stopping streaming on external subdevSakari Ailus
The isp was marked to have failed to stop if stopping streaming on an external subdev failed. The return value from the external subdev should be ignored instead as it is not part of the ISP and thus the ISP does not need to be reset for that reason. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-03media: dvb: add support for TerraTec TC2 Stick (193534)Tomasz Maciej Nowak
Seems to be a clone of Logilink VG0022A. Supports DVB-C, DVB-T and DVB-T2. Only terrestrial reception was tested on Polish and Czech multiplexes. Signed-off-by: Tomasz Maciej Nowak <tmn505@gmail.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-03media: serial_ir: change "ignoring spike" to debug levelBodo Eggert
At least on my system with a self-made IR receiver, my kernel log is filled with: serial_ir serial_ir.0: ignoring spike: 1 1 1419988034627194ns 1419956080709377ns These messages happen at random and do not prevent the receiver from working. Also I cannot change the features of the IC, therefore they are not useful. Probably they are not useful at all. However they fill the console, they accumulate and fill the dmesg log, by doing this, they prevent me from seeing important message. Signed-off-by: Bodo Eggert <7eggert@gmx.de> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-03media: rtl28xxu: Add support for PROlectrix DV107669 DVB-T dongleDavid J. Fiddes
This adds support for the PROlectrix DV107669 DVT-T dongle which uses an RTL2832 and FC0012 tuner. Tests: - Verified correct operation of DVB-T reception with VLC across several UK multiplexes Signed-off-by: David J. Fiddes <D.J@fiddes.net> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-03media: dvb_dummy_fe: Add blank line after declarationDaniel W. S. Almeida
Fix checkpatch.pl error by adding a blank line Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-03media: dvb_dummy_fe: place EXPORT_SYMBOL below corresponding functionDaniel W. S. Almeida
dvb_dummy_fe.c had all its EXPORT_SYMBOL macros located at the end of the file. Now these are located directly below the symbol they are exporting for increased readability. Suggested-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-03media: rc: ensure lirc is initialized before registering input deviceSean Young
Once rc_open is called on the input device, lirc events can be delivered. Ensure lirc is ready to do so else we might get this: Registered IR keymap rc-hauppauge rc rc0: Hauppauge WinTV PVR-350 as /devices/pci0000:00/0000:00:1e.0/0000:04:00.0/i2c-0/0-0018/rc/rc0 input: Hauppauge WinTV PVR-350 as /devices/pci0000:00/0000:00:1e.0/0000:04:00.0/i2c-0/0-0018/rc/rc0/input9 BUG: kernel NULL pointer dereference, address: 0000000000000038 PGD 0 P4D 0 Oops: 0000 [#1] SMP PTI CPU: 1 PID: 17 Comm: kworker/1:0 Not tainted 5.3.11-300.fc31.x86_64 #1 Hardware name: /DG43NB, BIOS NBG4310H.86A.0096.2009.0903.1845 09/03/2009 Workqueue: events ir_work [ir_kbd_i2c] RIP: 0010:ir_lirc_scancode_event+0x3d/0xb0 Code: a6 b4 07 00 00 49 81 c6 b8 07 00 00 55 53 e8 ba a7 9d ff 4c 89 e7 49 89 45 00 e8 5e 7a 25 00 49 8b 1e 48 89 c5 4c 39 f3 74 58 <8b> 43 38 8b 53 40 89 c1 2b 4b 3c 39 ca 72 41 21 d0 49 8b 7d 00 49 RSP: 0018:ffffaae2000b3d88 EFLAGS: 00010017 RAX: 0000000000000002 RBX: 0000000000000000 RCX: 0000000000000019 RDX: 0000000000000001 RSI: 006e801b1f26ce6a RDI: ffff9e39797c37b4 RBP: 0000000000000002 R08: 0000000000000001 R09: 0000000000000001 R10: 0000000000000001 R11: 0000000000000001 R12: ffff9e39797c37b4 R13: ffffaae2000b3db8 R14: ffff9e39797c37b8 R15: ffff9e39797c33d8 FS: 0000000000000000(0000) GS:ffff9e397b680000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000038 CR3: 0000000035844000 CR4: 00000000000006e0 Call Trace: ir_do_keydown+0x8e/0x2b0 rc_keydown+0x52/0xc0 ir_work+0xb8/0x130 [ir_kbd_i2c] process_one_work+0x19d/0x340 worker_thread+0x50/0x3b0 kthread+0xfb/0x130 ? process_one_work+0x340/0x340 ? kthread_park+0x80/0x80 ret_from_fork+0x35/0x40 Modules linked in: rc_hauppauge tuner msp3400 saa7127 saa7115 ivtv(+) tveeprom cx2341x v4l2_common videodev mc i2c_algo_bit ir_kbd_i2c ip_tables firewire_ohci e1000e serio_raw firewire_core ata_generic crc_itu_t pata_acpi pata_jmicron fuse CR2: 0000000000000038 ---[ end trace c67c2697a99fa74b ]--- RIP: 0010:ir_lirc_scancode_event+0x3d/0xb0 Code: a6 b4 07 00 00 49 81 c6 b8 07 00 00 55 53 e8 ba a7 9d ff 4c 89 e7 49 89 45 00 e8 5e 7a 25 00 49 8b 1e 48 89 c5 4c 39 f3 74 58 <8b> 43 38 8b 53 40 89 c1 2b 4b 3c 39 ca 72 41 21 d0 49 8b 7d 00 49 RSP: 0018:ffffaae2000b3d88 EFLAGS: 00010017 RAX: 0000000000000002 RBX: 0000000000000000 RCX: 0000000000000019 RDX: 0000000000000001 RSI: 006e801b1f26ce6a RDI: ffff9e39797c37b4 RBP: 0000000000000002 R08: 0000000000000001 R09: 0000000000000001 R10: 0000000000000001 R11: 0000000000000001 R12: ffff9e39797c37b4 R13: ffffaae2000b3db8 R14: ffff9e39797c37b8 R15: ffff9e39797c33d8 FS: 0000000000000000(0000) GS:ffff9e397b680000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000038 CR3: 0000000035844000 CR4: 00000000000006e0 rc rc0: lirc_dev: driver ir_kbd_i2c registered at minor = 0, scancode receiver, no transmitter tuner-simple 0-0061: creating new instance tuner-simple 0-0061: type set to 2 (Philips NTSC (FI1236,FM1236 and compatibles)) ivtv0: Registered device video0 for encoder MPG (4096 kB) ivtv0: Registered device video32 for encoder YUV (2048 kB) ivtv0: Registered device vbi0 for encoder VBI (1024 kB) ivtv0: Registered device video24 for encoder PCM (320 kB) ivtv0: Registered device radio0 for encoder radio ivtv0: Registered device video16 for decoder MPG (1024 kB) ivtv0: Registered device vbi8 for decoder VBI (64 kB) ivtv0: Registered device vbi16 for decoder VOUT ivtv0: Registered device video48 for decoder YUV (1024 kB) Cc: stable@vger.kernel.org Tested-by: Nick French <nickfrench@gmail.com> Reported-by: Nick French <nickfrench@gmail.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-03media: cxusb: use dev_dbg() rather than hand-rolled debugSean Young
This solves the following compiler warnings: drivers/media/usb/dvb-usb/cxusb.c: In function ‘cxusb_gpio_tuner’: drivers/media/usb/dvb-usb/cxusb.c:128:35: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body] 128 | deb_info("gpio_write failed.\n"); | ^ drivers/media/usb/dvb-usb/cxusb.c: In function ‘cxusb_bluebird_gpio_rw’: drivers/media/usb/dvb-usb/cxusb.c:145:44: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body] 145 | deb_info("bluebird_gpio_write failed.\n"); | ^ drivers/media/usb/dvb-usb/cxusb.c: In function ‘cxusb_i2c_xfer’: drivers/media/usb/dvb-usb/cxusb.c:251:42: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body] 251 | deb_i2c("i2c read may have failed\n"); | ^ drivers/media/usb/dvb-usb/cxusb.c:274:43: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body] 274 | deb_i2c("i2c write may have failed\n"); | ^ Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-03media: vp7045: do not read uninitialized values if usb transfer failsSean Young
It is not a fatal error if reading the mac address or the remote control decoder state fails. Reported-by: syzbot+ec869945d3dde5f33b43@syzkaller.appspotmail.com Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-03media: af9005: uninitialized variable printkedSean Young
If usb_bulk_msg() fails, actual_length can be uninitialized. Reported-by: syzbot+9d42b7773d2fecd983ab@syzkaller.appspotmail.com Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-03media: digitv: don't continue if remote control state can't be readSean Young
This results in an uninitialized variable read. Reported-by: syzbot+6bf9606ee955b646c0e1@syzkaller.appspotmail.com Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-03media: v4l2-core: fix compat v4l2_buffer handling for time64 ABIArnd Bergmann
Add support for the four new variants of ioctl commands for 64-bit time_t in v4l2_buffer. The existing v4l2_buffer32 structure for the traditional format gets changed to match the new v4l2_buffer format, and the old layout is now called v4l2_buffer32_time32. Neither of these matches the native 64-bit architecture format of v4l2_buffer, so both require special handling in compat code. Duplicating the existing handlers for the new types is a safe conversion for now, but unfortunately this may turn into a maintenance burden later. A larger-scale rework of the compat code might be a better alternative, but is out of scope of the y2038 work. Note: x32 support for v4l2_buffer32 has always been broken and remains so after this change, fixing it would have required even more duplication, and apparently nobody has cared so far. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> [hverkuil-cisco@xs4all.nl: remove spurious newline] Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-03media: v4l2-core: fix compat VIDIOC_DQEVENT for time64 ABIArnd Bergmann
The native code supports the variant of struct v4l2_event for 64-bit time_t, so add the compat version as well. Here, a new incompatibility arises: while almost all 32-bit architectures now use the same layout as 64-bit architectures and the commands can simply be passed through, on x86 the internal alignment of v4l2_event is different because of the 64-bit member in v4l2_event_ctrl. To handle all architectures, this now requires defining four different versions of the structure to cover all possible combinations. The compat handling for VIDIOC_DQEVENT32 and VIDIOC_DQEVENT32_TIME32 is now inside of an #ifdef so it does not get used on architectures other than x86. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-03media: v4l2-core: fix v4l2_buffer handling for time64 ABIArnd Bergmann
The v4l2_buffer structure contains a 'struct timeval' member that is defined by the user space C library, creating an ABI incompatibility when that gets updated to a 64-bit time_t. As in v4l2_event, handle this with a special case in video_put_user() and video_get_user() to replace the memcpy there. Since the structure also contains a pointer, there are now two native versions (on 32-bit systems) as well as two compat versions (on 64-bit systems), which unfortunately complicates the compat handler quite a bit. Duplicating the existing handlers for the new types is a safe conversion for now, but unfortunately this may turn into a maintenance burden later. A larger-scale rework of the compat code might be a better alternative, but is out of scope of the y2038 work. Sparc64 needs a special case because of their special suseconds_t definition. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-03media: v4l2-core: fix VIDIOC_DQEVENT for time64 ABIArnd Bergmann
The v4l2_event structure contains a 'struct timespec' member that is defined by the user space C library, creating an ABI incompatibility when that gets updated to a 64-bit time_t. While passing a 32-bit time_t here would be sufficient for CLOCK_MONOTONIC timestamps, simply redefining the structure to use the kernel's __kernel_old_timespec would not work for any library that uses a copy of the linux/videodev2.h header file rather than including the copy from the latest kernel headers. This means the kernel has to be changed to handle both versions of the structure layout on a 32-bit architecture. The easiest way to do this is during the copy from/to user space. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-03media: v4l2-core: split out data copy from video_usercopyArnd Bergmann
The copy-in/out portions of video_usercopy() are about to get more complex, so turn then into separate functions as a cleanup first. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-03media: v4l2-core: compat: ignore native command codesArnd Bergmann
The do_video_ioctl() compat handler converts the compat command codes into the native ones before processing further, but this causes problems for 32-bit user applications that pass a command code that matches a 64-bit native number, which will then be handled the same way. Specifically, this breaks VIDIOC_DQEVENT_TIME from user space applications with 64-bit time_t, as the structure layout is the same as the native 64-bit layout on many architectures (x86 being the notable exception). Change the handler to use the converted command code only for passing into the native ioctl handler, not for deciding on the conversion, in order to make the compat behavior match the native behavior. Actual support for the 64-bit time_t version of VIDIOC_DQEVENT_TIME and other commands still needs to be added in a separate patch. Cc: stable@vger.kernel.org Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-01-03media: v4l2: abstract timeval handling in v4l2_bufferArnd Bergmann
As a preparation for adding 64-bit time_t support in the uapi, change the drivers to no longer care about the format of the timestamp field in struct v4l2_buffer. The v4l2_timeval_to_ns() function is no longer needed in the kernel after this, but there is userspace code relying on it to be part of the uapi header. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> [hverkuil-cisco@xs4all.nl: replace spaces by tabs] Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2019-12-17Merge tag 'drm-misc-next-2019-12-16' of ↵Daniel Vetter
git://anongit.freedesktop.org/drm/drm-misc into drm-next drm-misc-next for v5.6: UAPI Changes: - Add support for DMA-BUF HEAPS. Cross-subsystem Changes: - mipi dsi definition updates, pulled into drm-intel as well. - Add lockdep annotations for dma_resv vs mmap_sem and fs_reclaim. - Remove support for dma-buf kmap/kunmap. - Constify fb_ops in all fbdev drivers, including drm drivers and drm-core, and media as well. Core Changes: - Small cleanups to ttm. - Fix SCDC definition. - Assorted cleanups to core. - Add todo to remove load/unload hooks, and use generic fbdev emulation. - Assorted documentation updates. - Use blocking ww lock in ttm fault handler. - Remove drm_fb_helper_fbdev_setup/teardown. - Warning fixes with W=1 for atomic. - Use drm_debug_enabled() instead of drm_debug flag testing in various drivers. - Fallback to nontiled mode in fbdev emulation when not all tiles are present. (Later on reverted) - Various kconfig indentation fixes in core and drivers. - Fix freeing transactions in dp-mst correctly. - Sean Paul is steping down as core maintainer. :-( - Add lockdep annotations for atomic locks vs dma-resv. - Prevent use-after-free for a bad job in drm_scheduler. - Fill out all block sizes in the P01x and P210 definitions. - Avoid division by zero in drm/rect, and fix bounds. - Add drm/rect selftests. - Add aspect ratio and alternate clocks for HDMI 4k modes. - Add todo for drm_framebuffer_funcs and fb_create cleanup. - Drop DRM_AUTH for prime import/export ioctls. - Clear DP-MST payload id tables downstream when initializating. - Fix for DSC throughput definition. - Add extra FEC definitions. - Fix fake offset in drm_gem_object_funs.mmap. - Stop using encoder->bridge in core directly - Handle bridge chaining slightly better. - Add backlight support to drm/panel, and use it in many panel drivers. - Increase max number of y420 modes from 128 to 256, as preparation to add the new modes. Driver Changes: - Small fixes all over. - Fix documentation in vkms. - Fix mmap_sem vs dma_resv in nouveau. - Small cleanup in komeda. - Add page flip support in gma500 for psb/cdv. - Add ddc symlink in the connector sysfs directory for many drivers. - Add support for analogic an6345, and fix small bugs in it. - Add atomic modesetting support to ast. - Fix radeon fault handler VMA race. - Switch udl to use generic shmem helpers. - Unconditional vblank handling for mcde. - Miscellaneous fixes to mcde. - Tweak debug output from komeda using debugfs. - Add gamma and color transform support to komeda for DOU-IPS. - Add support for sony acx424AKP panel. - Various small cleanups to gma500. - Use generic fbdev emulation in udl, and replace udl_framebuffer with generic implementation. - Add support for Logic PD Type 28 panel. - Use drm_panel_* wrapper functions in exynos/tegra/msm. - Add devicetree bindings for generic DSI panels. - Don't include drm_pci.h directly in many drivers. - Add support for begin/end_cpu_access in udmabuf. - Stop using drm_get_pci_dev in gma500 and mga200. - Fixes to UDL damage handling, and use dma_buf_begin/end_cpu_access. - Add devfreq thermal support to panfrost. - Fix hotplug with daisy chained monitors by removing VCPI when disabling topology manager. - meson: Add support for OSD1 plane AFBC commit. - Stop displaying garbage when toggling ast primary plane on/off. - More cleanups and fixes to UDL. - Add D32 suport to komeda. - Remove globle copy of drm_dev in gma500. - Add support for Boe Himax8279d MIPI-DSI LCD panel. - Add support for ingenic JZ4770 panel. - Small null pointer deference fix in ingenic. - Remove support for the special tfp420 driver, as there is a generic way to do it. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/ba73535a-9334-5302-2e1f-5208bd7390bd@linux.intel.com
2019-12-16media: vivid: support multiplanar touch devicesHans Verkuil
The v4l2-compliance tests failed with the touch device when multiplanar was enabled in vivid. Since it is perfectly fine to support the multiplanar API for touch, add support for this in vivid. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2019-12-16media: v4l2-ioctl.c: allow multiplanar for touchHans Verkuil
There is no reason to prohibit multiplanar support for touch devices, so just allow it. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2019-12-16media: vivid: set field to NONE for touchHans Verkuil
The v4l2_buffer's 'field' value was never initialized in vivid for the touch capture device, causing v4l2-compliance errors. Set it to NONE. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2019-12-16media: pulse8-cec: log when a CEC message is receivedHans Verkuil
Log (if debug > 0) when a CEC message is received. This is done for transmits already, so it makes sense to do the same for receives. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2019-12-16media: pulse8-cec: schedule next ping after current ping finishedHans Verkuil
Don't schedule the next ping before the current ping is sent, schedule it after. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>