diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2020-06-04 06:59:38 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-06-04 06:59:38 +0300 |
commit | a98f670e41a99f53acb1fb33cee9c6abbb2e6f23 (patch) | |
tree | f8ae10a4cb91758ad7f9422053753a8c5d0f04dc /drivers/media/usb | |
parent | ee01c4d72adffb7d424535adf630f2955748fa8b (diff) | |
parent | 938b29db3aa9c293c7c1366b16e55e308f1a1ddd (diff) | |
download | linux-a98f670e41a99f53acb1fb33cee9c6abbb2e6f23.tar.xz |
Merge tag 'media/v5.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab:
- Media documentation is now split into admin-guide, driver-api and
userspace-api books (a longstanding request from Jon);
- The media Kconfig was reorganized, in order to make easier to select
drivers and their dependencies;
- The testing drivers now has a separate directory;
- added a new driver for Rockchip Video Decoder IP;
- The atomisp staging driver was resurrected. It is meant to work with
4 generations of cameras on Atom-based laptops, tablets and cell
phones. So, it seems worth investing time to cleanup this driver and
making it in good shape.
- Added some V4L2 core ancillary routines to help with h264 codecs;
- Added an ov2740 image sensor driver;
- The si2157 gained support for Analog TV, which, in turn, added
support for some cx231xx and cx23885 boards to also support analog
standards;
- Added some V4L2 controls (V4L2_CID_CAMERA_ORIENTATION and
V4L2_CID_CAMERA_SENSOR_ROTATION) to help identifying where the camera
is located at the device;
- VIDIOC_ENUM_FMT was extended to support MC-centric devices;
- Lots of drivers improvements and cleanups.
* tag 'media/v5.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (503 commits)
media: Documentation: media: Refer to mbus format documentation from CSI-2 docs
media: s5k5baf: Replace zero-length array with flexible-array
media: i2c: imx219: Drop <linux/clk-provider.h> and <linux/clkdev.h>
media: i2c: Add ov2740 image sensor driver
media: ov8856: Implement sensor module revision identification
media: ov8856: Add devicetree support
media: dt-bindings: ov8856: Document YAML bindings
media: dvb-usb: Add Cinergy S2 PCIe Dual Port support
media: dvbdev: Fix tuner->demod media controller link
media: dt-bindings: phy: phy-rockchip-dphy-rx0: move rockchip dphy rx0 bindings out of staging
media: staging: dt-bindings: phy-rockchip-dphy-rx0: remove non-used reg property
media: atomisp: unify the version for isp2401 a0 and b0 versions
media: atomisp: update TODO with the current data
media: atomisp: adjust some code at sh_css that could be broken
media: atomisp: don't produce errs for ignored IRQs
media: atomisp: print IRQ when debugging
media: atomisp: isp_mmu: don't use kmem_cache
media: atomisp: add a notice about possible leak resources
media: atomisp: disable the dynamic and reserved pools
media: atomisp: turn on camera before setting it
...
Diffstat (limited to 'drivers/media/usb')
65 files changed, 302 insertions, 1498 deletions
diff --git a/drivers/media/usb/Kconfig b/drivers/media/usb/Kconfig index e678d3d11467..00feadb217d8 100644 --- a/drivers/media/usb/Kconfig +++ b/drivers/media/usb/Kconfig @@ -1,4 +1,10 @@ # SPDX-License-Identifier: GPL-2.0-only + +# This Kconfig option is also used by the legacy av7110 driver +config TTPCI_EEPROM + tristate + depends on I2C + if USB && MEDIA_SUPPORT menuconfig MEDIA_USB_SUPPORT @@ -60,11 +66,5 @@ source "drivers/media/usb/hackrf/Kconfig" source "drivers/media/usb/msi2500/Kconfig" endif -if MEDIA_CEC_SUPPORT - comment "USB HDMI CEC adapters" -source "drivers/media/usb/pulse8-cec/Kconfig" -source "drivers/media/usb/rainshadow-cec/Kconfig" -endif - endif #MEDIA_USB_SUPPORT endif #USB diff --git a/drivers/media/usb/Makefile b/drivers/media/usb/Makefile index 169aa07c97bd..3eaff3149ef4 100644 --- a/drivers/media/usb/Makefile +++ b/drivers/media/usb/Makefile @@ -24,5 +24,3 @@ obj-$(CONFIG_VIDEO_EM28XX) += em28xx/ obj-$(CONFIG_VIDEO_USBTV) += usbtv/ obj-$(CONFIG_VIDEO_GO7007) += go7007/ obj-$(CONFIG_DVB_AS102) += as102/ -obj-$(CONFIG_USB_PULSE8_CEC) += pulse8-cec/ -obj-$(CONFIG_USB_RAINSHADOW_CEC) += rainshadow-cec/ diff --git a/drivers/media/usb/cx231xx/cx231xx-avcore.c b/drivers/media/usb/cx231xx/cx231xx-avcore.c index 0974965e848f..3d3c881c8e58 100644 --- a/drivers/media/usb/cx231xx/cx231xx-avcore.c +++ b/drivers/media/usb/cx231xx/cx231xx-avcore.c @@ -587,14 +587,27 @@ int cx231xx_set_video_input_mux(struct cx231xx *dev, u8 input) return status; } } - if (dev->tuner_type == TUNER_NXP_TDA18271) + switch (dev->model) { /* i2c device tuners */ + case CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx: + case CX231XX_BOARD_HAUPPAUGE_935C: + case CX231XX_BOARD_HAUPPAUGE_955Q: + case CX231XX_BOARD_HAUPPAUGE_975: + case CX231XX_BOARD_EVROMEDIA_FULL_HYBRID_FULLHD: status = cx231xx_set_decoder_video_input(dev, CX231XX_VMUX_TELEVISION, INPUT(input)->vmux); - else - status = cx231xx_set_decoder_video_input(dev, + break; + default: + if (dev->tuner_type == TUNER_NXP_TDA18271) + status = cx231xx_set_decoder_video_input(dev, + CX231XX_VMUX_TELEVISION, + INPUT(input)->vmux); + else + status = cx231xx_set_decoder_video_input(dev, CX231XX_VMUX_COMPOSITE1, INPUT(input)->vmux); + break; + } break; default: @@ -1193,12 +1206,22 @@ int cx231xx_set_audio_decoder_input(struct cx231xx *dev, cx231xx_set_field(FLD_SIF_EN, 0)); break; default: + switch (dev->model) { /* i2c device tuners */ + case CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx: + case CX231XX_BOARD_HAUPPAUGE_935C: + case CX231XX_BOARD_HAUPPAUGE_955Q: + case CX231XX_BOARD_HAUPPAUGE_975: + case CX231XX_BOARD_EVROMEDIA_FULL_HYBRID_FULLHD: + /* TODO: Normal mode: SIF passthrough at 14.32 MHz?? */ + break; + default: /* This is just a casual suggestion to people adding new boards in case they use a tuner type we don't currently know about */ - dev_info(dev->dev, - "Unknown tuner type configuring SIF"); - break; + dev_info(dev->dev, + "Unknown tuner type configuring SIF"); + break; + } } break; diff --git a/drivers/media/usb/cx231xx/cx231xx-input.c b/drivers/media/usb/cx231xx/cx231xx-input.c index 9f88c640ec2b..8149702bcf89 100644 --- a/drivers/media/usb/cx231xx/cx231xx-input.c +++ b/drivers/media/usb/cx231xx/cx231xx-input.c @@ -88,7 +88,7 @@ int cx231xx_ir_init(struct cx231xx *dev) ir_i2c_bus = cx231xx_boards[dev->model].ir_i2c_master; dev_dbg(dev->dev, "Trying to bind ir at bus %d, addr 0x%02x\n", ir_i2c_bus, info.addr); - dev->ir_i2c_client = i2c_new_device( + dev->ir_i2c_client = i2c_new_client_device( cx231xx_get_i2c_adap(dev, ir_i2c_bus), &info); return 0; @@ -96,7 +96,6 @@ int cx231xx_ir_init(struct cx231xx *dev) void cx231xx_ir_exit(struct cx231xx *dev) { - if (dev->ir_i2c_client) - i2c_unregister_device(dev->ir_i2c_client); + i2c_unregister_device(dev->ir_i2c_client); dev->ir_i2c_client = NULL; } diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c index 8bff7d8a0310..d9f953f2d088 100644 --- a/drivers/media/usb/cx231xx/cx231xx-video.c +++ b/drivers/media/usb/cx231xx/cx231xx-video.c @@ -1129,7 +1129,7 @@ int cx231xx_s_frequency(struct file *file, void *priv, { struct cx231xx *dev = video_drvdata(file); struct v4l2_frequency new_freq = *f; - int rc; + int rc, need_if_freq = 0; u32 if_frequency = 5400000; dev_dbg(dev->dev, @@ -1142,14 +1142,30 @@ int cx231xx_s_frequency(struct file *file, void *priv, /* set pre channel change settings in DIF first */ rc = cx231xx_tuner_pre_channel_change(dev); - call_all(dev, tuner, s_frequency, f); - call_all(dev, tuner, g_frequency, &new_freq); - dev->ctl_freq = new_freq.frequency; + switch (dev->model) { /* i2c device tuners */ + case CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx: + case CX231XX_BOARD_HAUPPAUGE_935C: + case CX231XX_BOARD_HAUPPAUGE_955Q: + case CX231XX_BOARD_HAUPPAUGE_975: + case CX231XX_BOARD_EVROMEDIA_FULL_HYBRID_FULLHD: + if (dev->cx231xx_set_analog_freq) + dev->cx231xx_set_analog_freq(dev, f->frequency); + dev->ctl_freq = f->frequency; + need_if_freq = 1; + break; + default: + call_all(dev, tuner, s_frequency, f); + call_all(dev, tuner, g_frequency, &new_freq); + dev->ctl_freq = new_freq.frequency; + break; + } + + pr_debug("%s() %u : %u\n", __func__, f->frequency, dev->ctl_freq); /* set post channel change settings in DIF first */ rc = cx231xx_tuner_post_channel_change(dev); - if (dev->tuner_type == TUNER_NXP_TDA18271) { + if (need_if_freq || dev->tuner_type == TUNER_NXP_TDA18271) { if (dev->norm & (V4L2_STD_MN | V4L2_STD_NTSC_443)) if_frequency = 5400000; /*5.4MHz */ else if (dev->norm & V4L2_STD_B) @@ -1362,9 +1378,20 @@ int cx231xx_querycap(struct file *file, void *priv, V4L2_CAP_STREAMING | V4L2_CAP_DEVICE_CAPS; if (video_is_registered(&dev->radio_dev)) cap->capabilities |= V4L2_CAP_RADIO; - if (dev->tuner_type != TUNER_ABSENT) - cap->capabilities |= V4L2_CAP_TUNER; + switch (dev->model) { + case CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx: + case CX231XX_BOARD_HAUPPAUGE_935C: + case CX231XX_BOARD_HAUPPAUGE_955Q: + case CX231XX_BOARD_HAUPPAUGE_975: + case CX231XX_BOARD_EVROMEDIA_FULL_HYBRID_FULLHD: + cap->capabilities |= V4L2_CAP_TUNER; + break; + default: + if (dev->tuner_type != TUNER_ABSENT) + cap->capabilities |= V4L2_CAP_TUNER; + break; + } return 0; } @@ -1708,10 +1735,20 @@ static void cx231xx_vdev_init(struct cx231xx *dev, video_set_drvdata(vfd, dev); if (dev->tuner_type == TUNER_ABSENT) { - v4l2_disable_ioctl(vfd, VIDIOC_G_FREQUENCY); - v4l2_disable_ioctl(vfd, VIDIOC_S_FREQUENCY); - v4l2_disable_ioctl(vfd, VIDIOC_G_TUNER); - v4l2_disable_ioctl(vfd, VIDIOC_S_TUNER); + switch (dev->model) { + case CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx: + case CX231XX_BOARD_HAUPPAUGE_935C: + case CX231XX_BOARD_HAUPPAUGE_955Q: + case CX231XX_BOARD_HAUPPAUGE_975: + case CX231XX_BOARD_EVROMEDIA_FULL_HYBRID_FULLHD: + break; + default: + v4l2_disable_ioctl(vfd, VIDIOC_G_FREQUENCY); + v4l2_disable_ioctl(vfd, VIDIOC_S_FREQUENCY); + v4l2_disable_ioctl(vfd, VIDIOC_G_TUNER); + v4l2_disable_ioctl(vfd, VIDIOC_S_TUNER); + break; + } } } @@ -1781,8 +1818,20 @@ int cx231xx_register_analog_devices(struct cx231xx *dev) dev->vdev.queue = q; dev->vdev.device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_CAPTURE; - if (dev->tuner_type != TUNER_ABSENT) + + switch (dev->model) { /* i2c device tuners */ + case CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx: + case CX231XX_BOARD_HAUPPAUGE_935C: + case CX231XX_BOARD_HAUPPAUGE_955Q: + case CX231XX_BOARD_HAUPPAUGE_975: + case CX231XX_BOARD_EVROMEDIA_FULL_HYBRID_FULLHD: dev->vdev.device_caps |= V4L2_CAP_TUNER; + break; + default: + if (dev->tuner_type != TUNER_ABSENT) + dev->vdev.device_caps |= V4L2_CAP_TUNER; + break; + } /* register v4l2 video video_device */ ret = video_register_device(&dev->vdev, VFL_TYPE_VIDEO, @@ -1829,8 +1878,18 @@ int cx231xx_register_analog_devices(struct cx231xx *dev) dev->vbi_dev.queue = q; dev->vbi_dev.device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING | V4L2_CAP_VBI_CAPTURE; - if (dev->tuner_type != TUNER_ABSENT) + switch (dev->model) { /* i2c device tuners */ + case CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx: + case CX231XX_BOARD_HAUPPAUGE_935C: + case CX231XX_BOARD_HAUPPAUGE_955Q: + case CX231XX_BOARD_HAUPPAUGE_975: + case CX231XX_BOARD_EVROMEDIA_FULL_HYBRID_FULLHD: dev->vbi_dev.device_caps |= V4L2_CAP_TUNER; + break; + default: + if (dev->tuner_type != TUNER_ABSENT) + dev->vbi_dev.device_caps |= V4L2_CAP_TUNER; + } /* register v4l2 vbi video_device */ ret = video_register_device(&dev->vbi_dev, VFL_TYPE_VBI, diff --git a/drivers/media/usb/dvb-usb-v2/Kconfig b/drivers/media/usb/dvb-usb-v2/Kconfig index b21a4d413872..5c75303fba9d 100644 --- a/drivers/media/usb/dvb-usb-v2/Kconfig +++ b/drivers/media/usb/dvb-usb-v2/Kconfig @@ -7,7 +7,7 @@ config DVB_USB_V2 USB1.1 and USB2.0 DVB devices. Almost every USB device needs a firmware, please look into - <file:Documentation/media/dvb-drivers/dvb-usb.rst>. + <file:Documentation/driver-api/media/drivers/dvb-usb.rst>. For a complete list of supported USB devices see the LinuxTV DVB Wiki: <https://linuxtv.org/wiki/index.php/DVB_USB> @@ -38,7 +38,7 @@ config DVB_USB_AF9035 select MEDIA_TUNER_FC0011 if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_MXL5007T if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_TDA18218 if MEDIA_SUBDRV_AUTOSELECT - select MEDIA_TUNER_FC2580 if MEDIA_SUBDRV_AUTOSELECT + select MEDIA_TUNER_FC2580 if (MEDIA_SUBDRV_AUTOSELECT && VIDEO_V4L2) select MEDIA_TUNER_IT913X if MEDIA_SUBDRV_AUTOSELECT help Say Y here to support the Afatech AF9035 based DVB USB receiver. @@ -137,12 +137,12 @@ config DVB_USB_RTL28XXU select DVB_CXD2841ER if MEDIA_SUBDRV_AUTOSELECT select DVB_RTL2830 select DVB_RTL2832 - select DVB_RTL2832_SDR if (MEDIA_SUBDRV_AUTOSELECT && MEDIA_SDR_SUPPORT) + select DVB_RTL2832_SDR if (MEDIA_SUBDRV_AUTOSELECT && MEDIA_SDR_SUPPORT && VIDEO_V4L2) select DVB_SI2168 if MEDIA_SUBDRV_AUTOSELECT - select MEDIA_TUNER_E4000 if MEDIA_SUBDRV_AUTOSELECT + select MEDIA_TUNER_E4000 if (MEDIA_SUBDRV_AUTOSELECT && VIDEO_V4L2) select MEDIA_TUNER_FC0012 if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_FC0013 if MEDIA_SUBDRV_AUTOSELECT - select MEDIA_TUNER_FC2580 if MEDIA_SUBDRV_AUTOSELECT + select MEDIA_TUNER_FC2580 if (MEDIA_SUBDRV_AUTOSELECT && VIDEO_V4L2) select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_MXL5005S if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_QT1010 if MEDIA_SUBDRV_AUTOSELECT diff --git a/drivers/media/usb/dvb-usb-v2/ec168.c b/drivers/media/usb/dvb-usb-v2/ec168.c index e30305876840..7ed0ab9e429b 100644 --- a/drivers/media/usb/dvb-usb-v2/ec168.c +++ b/drivers/media/usb/dvb-usb-v2/ec168.c @@ -332,22 +332,17 @@ static const struct dvb_usb_device_properties ec168_props = { }, }; -static const struct dvb_usb_driver_info ec168_driver_info = { - .name = "E3C EC168 reference design", - .props = &ec168_props, -}; - static const struct usb_device_id ec168_id[] = { - { USB_DEVICE(USB_VID_E3C, USB_PID_E3C_EC168), - .driver_info = (kernel_ulong_t) &ec168_driver_info }, - { USB_DEVICE(USB_VID_E3C, USB_PID_E3C_EC168_2), - .driver_info = (kernel_ulong_t) &ec168_driver_info }, - { USB_DEVICE(USB_VID_E3C, USB_PID_E3C_EC168_3), - .driver_info = (kernel_ulong_t) &ec168_driver_info }, - { USB_DEVICE(USB_VID_E3C, USB_PID_E3C_EC168_4), - .driver_info = (kernel_ulong_t) &ec168_driver_info }, - { USB_DEVICE(USB_VID_E3C, USB_PID_E3C_EC168_5), - .driver_info = (kernel_ulong_t) &ec168_driver_info }, + { DVB_USB_DEVICE(USB_VID_E3C, USB_PID_E3C_EC168, + &ec168_props, "E3C EC168 reference design", NULL)}, + { DVB_USB_DEVICE(USB_VID_E3C, USB_PID_E3C_EC168_2, + &ec168_props, "E3C EC168 reference design", NULL)}, + { DVB_USB_DEVICE(USB_VID_E3C, USB_PID_E3C_EC168_3, + &ec168_props, "E3C EC168 reference design", NULL)}, + { DVB_USB_DEVICE(USB_VID_E3C, USB_PID_E3C_EC168_4, + &ec168_props, "E3C EC168 reference design", NULL)}, + { DVB_USB_DEVICE(USB_VID_E3C, USB_PID_E3C_EC168_5, + &ec168_props, "E3C EC168 reference design", NULL)}, {} }; MODULE_DEVICE_TABLE(usb, ec168_id); diff --git a/drivers/media/usb/dvb-usb-v2/gl861.c b/drivers/media/usb/dvb-usb-v2/gl861.c index 19217dcf20f1..b7ca236174f3 100644 --- a/drivers/media/usb/dvb-usb-v2/gl861.c +++ b/drivers/media/usb/dvb-usb-v2/gl861.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* DVB USB compliant linux driver for GL861 USB2.0 devices. * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #include <linux/string.h> @@ -550,7 +550,7 @@ static struct dvb_usb_device_properties friio_props = { static const struct usb_device_id gl861_id_table[] = { { DVB_USB_DEVICE(USB_VID_MSI, USB_PID_MSI_MEGASKY580_55801, &gl861_props, "MSI Mega Sky 55801 DVB-T USB2.0", NULL) }, - { DVB_USB_DEVICE(USB_VID_ALINK, USB_VID_ALINK_DTU, + { DVB_USB_DEVICE(USB_VID_ALINK, USB_PID_ALINK_DTU, &gl861_props, "A-LINK DTU DVB-T USB2.0", NULL) }, { DVB_USB_DEVICE(USB_VID_774, USB_PID_FRIIO_WHITE, &friio_props, "774 Friio White ISDB-T USB2.0", NULL) }, diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index fd8b42bb9a84..8a3c0eeed959 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -22,7 +22,7 @@ * * LME2510C + M88RS2000 * - * For firmware see Documentation/media/dvb-drivers/lmedm04.rst + * For firmware see Documentation/admin-guide/media/lmedm04.rst * * I2C addresses: * 0xd0 - STV0288 - Demodulator @@ -39,7 +39,7 @@ * Copyright (C) 2010 Malcolm Priestley (tvboxspy@gmail.com) * LME2510(C)(C) Leaguerme (Shenzhen) MicroElectronics Co., Ltd. * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information * * Known Issues : * LME2510: Non Intel USB chipsets fail to maintain High Speed on diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.h b/drivers/media/usb/dvb-usb-v2/lmedm04.h index 766a8348624d..4335b6ebcc1c 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.h +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.h @@ -14,7 +14,7 @@ * MVB0001F (LME2510C+LGTDQT-P001F) * * * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #ifndef _DVB_USB_LME2510_H_ #define _DVB_USB_LME2510_H_ diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf.c b/drivers/media/usb/dvb-usb-v2/mxl111sf.c index 55b4ae7037a4..7865fa0a8295 100644 --- a/drivers/media/usb/dvb-usb-v2/mxl111sf.c +++ b/drivers/media/usb/dvb-usb-v2/mxl111sf.c @@ -2,7 +2,7 @@ /* * Copyright (C) 2010-2014 Michael Krufky (mkrufky@linuxtv.org) * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #include <linux/vmalloc.h> diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf.h b/drivers/media/usb/dvb-usb-v2/mxl111sf.h index 70bd2a2a8ec1..e57e5d2353b4 100644 --- a/drivers/media/usb/dvb-usb-v2/mxl111sf.h +++ b/drivers/media/usb/dvb-usb-v2/mxl111sf.h @@ -2,7 +2,7 @@ /* * Copyright (C) 2010-2014 Michael Krufky (mkrufky@linuxtv.org) * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #ifndef _DVB_USB_MXL111SF_H_ diff --git a/drivers/media/usb/dvb-usb/Kconfig b/drivers/media/usb/dvb-usb/Kconfig index 1a3e5f965ae4..15d29c91662f 100644 --- a/drivers/media/usb/dvb-usb/Kconfig +++ b/drivers/media/usb/dvb-usb/Kconfig @@ -2,12 +2,13 @@ config DVB_USB tristate "Support for various USB DVB devices" depends on DVB_CORE && USB && I2C && RC_CORE + select CYPRESS_FIRMWARE help By enabling this you will be able to choose the various supported USB1.1 and USB2.0 DVB devices. Almost every USB device needs a firmware, please look into - <file:Documentation/media/dvb-drivers/dvb-usb.rst>. + <file:Documentation/driver-api/media/drivers/dvb-usb.rst>. For a complete list of supported USB devices see the LinuxTV DVB Wiki: <https://linuxtv.org/wiki/index.php/DVB_USB> diff --git a/drivers/media/usb/dvb-usb/a800.c b/drivers/media/usb/dvb-usb/a800.c index 666213f5d5d8..36b5b6227412 100644 --- a/drivers/media/usb/dvb-usb/a800.c +++ b/drivers/media/usb/dvb-usb/a800.c @@ -8,7 +8,7 @@ * - AVerMedia who kindly provided information and * - Glen Harris who suffered from my mistakes during development. * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #include "dibusb.h" @@ -27,8 +27,10 @@ static int a800_power_ctrl(struct dvb_usb_device *d, int onoff) } /* assure to put cold to 0 for iManufacturer == 1 */ -static int a800_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props, - struct dvb_usb_device_description **desc, int *cold) +static int a800_identify_state(struct usb_device *udev, + const struct dvb_usb_device_properties *props, + const struct dvb_usb_device_description **desc, + int *cold) { *cold = udev->descriptor.iManufacturer != 1; return 0; diff --git a/drivers/media/usb/dvb-usb/af9005-fe.c b/drivers/media/usb/dvb-usb/af9005-fe.c index 6c960f723457..9d6fa0556d7b 100644 --- a/drivers/media/usb/dvb-usb/af9005-fe.c +++ b/drivers/media/usb/dvb-usb/af9005-fe.c @@ -6,7 +6,7 @@ * * Thanks to Afatech who kindly provided information. * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #include "af9005.h" #include "af9005-script.h" diff --git a/drivers/media/usb/dvb-usb/af9005-remote.c b/drivers/media/usb/dvb-usb/af9005-remote.c index c664353f3911..41d48b3c8d05 100644 --- a/drivers/media/usb/dvb-usb/af9005-remote.c +++ b/drivers/media/usb/dvb-usb/af9005-remote.c @@ -8,7 +8,7 @@ * * Thanks to Afatech who kindly provided information. * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #include "af9005.h" /* debug */ diff --git a/drivers/media/usb/dvb-usb/af9005.c b/drivers/media/usb/dvb-usb/af9005.c index 89b4b5d84cdf..b6a2436d16e9 100644 --- a/drivers/media/usb/dvb-usb/af9005.c +++ b/drivers/media/usb/dvb-usb/af9005.c @@ -6,7 +6,7 @@ * * Thanks to Afatech who kindly provided information. * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #include "af9005.h" @@ -955,8 +955,8 @@ static int af9005_pid_filter(struct dvb_usb_adapter *adap, int index, } static int af9005_identify_state(struct usb_device *udev, - struct dvb_usb_device_properties *props, - struct dvb_usb_device_description **desc, + const struct dvb_usb_device_properties *props, + const struct dvb_usb_device_description **desc, int *cold) { int ret; diff --git a/drivers/media/usb/dvb-usb/af9005.h b/drivers/media/usb/dvb-usb/af9005.h index 3179a7c71e8f..11d74dc26d83 100644 --- a/drivers/media/usb/dvb-usb/af9005.h +++ b/drivers/media/usb/dvb-usb/af9005.h @@ -6,7 +6,7 @@ * * Thanks to Afatech who kindly provided information. * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #ifndef _DVB_USB_AF9005_H_ #define _DVB_USB_AF9005_H_ diff --git a/drivers/media/usb/dvb-usb/az6027.c b/drivers/media/usb/dvb-usb/az6027.c index 8de18da0c4bd..1c39b61cde29 100644 --- a/drivers/media/usb/dvb-usb/az6027.c +++ b/drivers/media/usb/dvb-usb/az6027.c @@ -4,7 +4,7 @@ * * Copyright (C) 2009 Adams.Xu <adams.xu@azwave.com.cn> * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #include "az6027.h" @@ -1051,8 +1051,8 @@ static struct i2c_algorithm az6027_i2c_algo = { }; static int az6027_identify_state(struct usb_device *udev, - struct dvb_usb_device_properties *props, - struct dvb_usb_device_description **desc, + const struct dvb_usb_device_properties *props, + const struct dvb_usb_device_description **desc, int *cold) { u8 *b; diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c index c421b603be44..761992ad05e2 100644 --- a/drivers/media/usb/dvb-usb/cxusb.c +++ b/drivers/media/usb/dvb-usb/cxusb.c @@ -18,7 +18,7 @@ * Copyright (C) 2006, 2007 Chris Pascoe (c.pascoe@itee.uq.edu.au) * Copyright (C) 2011, 2017 Maciej S. Szmigiero (mail@maciej.szmigiero.name) * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #include <media/tuner.h> #include <linux/delay.h> @@ -1358,8 +1358,8 @@ static int cxusb_mygica_d689_frontend_attach(struct dvb_usb_adapter *adap) * not, and forget a match if it turns out we selected the wrong device. */ static int bluebird_fx2_identify_state(struct usb_device *udev, - struct dvb_usb_device_properties *props, - struct dvb_usb_device_description **desc, + const struct dvb_usb_device_properties *props, + const struct dvb_usb_device_description **desc, int *cold) { int wascold = *cold; diff --git a/drivers/media/usb/dvb-usb/dib0700.h b/drivers/media/usb/dvb-usb/dib0700.h index ca4d3d2da969..2defbd8b6fc1 100644 --- a/drivers/media/usb/dvb-usb/dib0700.h +++ b/drivers/media/usb/dvb-usb/dib0700.h @@ -52,20 +52,25 @@ struct dib0700_state { struct i2c_client *i2c_client_tuner; }; -extern int dib0700_get_version(struct dvb_usb_device *d, u32 *hwversion, - u32 *romversion, u32 *ramversion, u32 *fwtype); -extern int dib0700_set_gpio(struct dvb_usb_device *, enum dib07x0_gpios gpio, u8 gpio_dir, u8 gpio_val); -extern int dib0700_ctrl_clock(struct dvb_usb_device *d, u32 clk_MHz, u8 clock_out_gp3); -extern int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen); -extern int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw); -extern int dib0700_rc_setup(struct dvb_usb_device *d, struct usb_interface *intf); -extern int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff); -extern struct i2c_algorithm dib0700_i2c_algo; -extern int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props, - struct dvb_usb_device_description **desc, int *cold); -extern int dib0700_change_protocol(struct rc_dev *dev, u64 *rc_proto); -extern int dib0700_set_i2c_speed(struct dvb_usb_device *d, u16 scl_kHz); +int dib0700_get_version(struct dvb_usb_device *d, u32 *hwversion, + u32 *romversion, u32 *ramversion, u32 *fwtype); +int dib0700_set_gpio(struct dvb_usb_device *d, enum dib07x0_gpios gpio, + u8 gpio_dir, u8 gpio_val); +int dib0700_ctrl_clock(struct dvb_usb_device *d, u32 clk_MHz, u8 clock_out_gp3); +int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, + u8 rxlen); +int dib0700_download_firmware(struct usb_device *d, + const struct firmware *fw); +int dib0700_rc_setup(struct dvb_usb_device *d, struct usb_interface *intf); +int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff); +int dib0700_identify_state(struct usb_device *d, + const struct dvb_usb_device_properties *props, + const struct dvb_usb_device_description **desc, + int *cold); +int dib0700_change_protocol(struct rc_dev *dev, u64 *rc_proto); +int dib0700_set_i2c_speed(struct dvb_usb_device *d, u16 scl_kHz); +extern struct i2c_algorithm dib0700_i2c_algo; extern int dib0700_device_count; extern int dvb_usb_dib0700_ir_proto; extern struct dvb_usb_device_properties dib0700_devices[]; diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c b/drivers/media/usb/dvb-usb/dib0700_core.c index ef62dd6c5ae4..70219b3e8566 100644 --- a/drivers/media/usb/dvb-usb/dib0700_core.c +++ b/drivers/media/usb/dvb-usb/dib0700_core.c @@ -372,8 +372,10 @@ struct i2c_algorithm dib0700_i2c_algo = { .functionality = dib0700_i2c_func, }; -int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props, - struct dvb_usb_device_description **desc, int *cold) +int dib0700_identify_state(struct usb_device *udev, + const struct dvb_usb_device_properties *props, + const struct dvb_usb_device_description **desc, + int *cold) { s16 ret; u8 *b; diff --git a/drivers/media/usb/dvb-usb/dibusb-common.c b/drivers/media/usb/dvb-usb/dibusb-common.c index 59ce2dec11e9..02b51d1a1b67 100644 --- a/drivers/media/usb/dvb-usb/dibusb-common.c +++ b/drivers/media/usb/dvb-usb/dibusb-common.c @@ -3,7 +3,7 @@ * * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@posteo.de) * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #include "dibusb.h" diff --git a/drivers/media/usb/dvb-usb/dibusb-mb.c b/drivers/media/usb/dvb-usb/dibusb-mb.c index d4ea72bf09c5..e9dc27f73970 100644 --- a/drivers/media/usb/dvb-usb/dibusb-mb.c +++ b/drivers/media/usb/dvb-usb/dibusb-mb.c @@ -7,7 +7,7 @@ * based on GPL code from DiBcom, which has * Copyright (C) 2004 Amaury Demol for DiBcom * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #include "dibusb.h" @@ -81,7 +81,7 @@ static int dibusb_tuner_probe_and_attach(struct dvb_usb_adapter *adap) if (i2c_transfer(&adap->dev->i2c_adap, msg, 2) != 2) { err("tuner i2c write failed."); - ret = -EREMOTEIO; + return -EREMOTEIO; } if (adap->fe_adap[0].fe->ops.i2c_gate_ctrl) diff --git a/drivers/media/usb/dvb-usb/dibusb-mc-common.c b/drivers/media/usb/dvb-usb/dibusb-mc-common.c index 967027e29c17..b8cde4cded33 100644 --- a/drivers/media/usb/dvb-usb/dibusb-mc-common.c +++ b/drivers/media/usb/dvb-usb/dibusb-mc-common.c @@ -3,7 +3,7 @@ * * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #include "dibusb.h" diff --git a/drivers/media/usb/dvb-usb/dibusb-mc.c b/drivers/media/usb/dvb-usb/dibusb-mc.c index ada3bee296c2..e2689977c8c8 100644 --- a/drivers/media/usb/dvb-usb/dibusb-mc.c +++ b/drivers/media/usb/dvb-usb/dibusb-mc.c @@ -7,7 +7,7 @@ * based on GPL code from DiBcom, which has * Copyright (C) 2004 Amaury Demol for DiBcom * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #include "dibusb.h" diff --git a/drivers/media/usb/dvb-usb/dibusb.h b/drivers/media/usb/dvb-usb/dibusb.h index a83326c36ca7..f61de0744821 100644 --- a/drivers/media/usb/dvb-usb/dibusb.h +++ b/drivers/media/usb/dvb-usb/dibusb.h @@ -3,7 +3,7 @@ * * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@posteo.de) * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #ifndef _DVB_USB_DIBUSB_H_ #define _DVB_USB_DIBUSB_H_ diff --git a/drivers/media/usb/dvb-usb/digitv.c b/drivers/media/usb/dvb-usb/digitv.c index 99a39339d45d..4e3b3c064bcf 100644 --- a/drivers/media/usb/dvb-usb/digitv.c +++ b/drivers/media/usb/dvb-usb/digitv.c @@ -6,7 +6,7 @@ * * partly based on the SDK published by Nebula Electronics * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #include "digitv.h" @@ -90,9 +90,10 @@ static struct i2c_algorithm digitv_i2c_algo = { }; /* Callbacks for DVB USB */ -static int digitv_identify_state (struct usb_device *udev, struct - dvb_usb_device_properties *props, struct dvb_usb_device_description **desc, - int *cold) +static int digitv_identify_state(struct usb_device *udev, + const struct dvb_usb_device_properties *props, + const struct dvb_usb_device_description **desc, + int *cold) { *cold = udev->descriptor.iManufacturer == 0 && udev->descriptor.iProduct == 0; return 0; @@ -230,14 +231,15 @@ static struct rc_map_table rc_map_digitv_table[] = { static int digitv_rc_query(struct dvb_usb_device *d, u32 *event, int *state) { + struct rc_map_table *entry; int ret, i; - u8 key[5]; + u8 key[4]; u8 b[4] = { 0 }; *event = 0; *state = REMOTE_NO_KEY_PRESSED; - ret = digitv_ctrl_msg(d, USB_READ_REMOTE, 0, NULL, 0, &key[1], 4); + ret = digitv_ctrl_msg(d, USB_READ_REMOTE, 0, NULL, 0, key, 4); if (ret) return ret; @@ -248,20 +250,21 @@ static int digitv_rc_query(struct dvb_usb_device *d, u32 *event, int *state) return ret; /* if something is inside the buffer, simulate key press */ - if (key[1] != 0) - { - for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) { - if (rc5_custom(&d->props.rc.legacy.rc_map_table[i]) == key[1] && - rc5_data(&d->props.rc.legacy.rc_map_table[i]) == key[2]) { - *event = d->props.rc.legacy.rc_map_table[i].keycode; + if (key[0] != 0) { + for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) { + entry = &d->props.rc.legacy.rc_map_table[i]; + + if (rc5_custom(entry) == key[0] && + rc5_data(entry) == key[1]) { + *event = entry->keycode; *state = REMOTE_KEY_PRESSED; return 0; } } + + deb_rc("key: %*ph\n", 4, key); } - if (key[0] != 0) - deb_rc("key: %*ph\n", 5, key); return 0; } diff --git a/drivers/media/usb/dvb-usb/dtt200u-fe.c b/drivers/media/usb/dvb-usb/dtt200u-fe.c index 00ce723c7bf0..9f83560ba63d 100644 --- a/drivers/media/usb/dvb-usb/dtt200u-fe.c +++ b/drivers/media/usb/dvb-usb/dtt200u-fe.c @@ -4,7 +4,7 @@ * * Copyright (C) 2005 Patrick Boettcher <patrick.boettcher@posteo.de> * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #include "dtt200u.h" diff --git a/drivers/media/usb/dvb-usb/dtt200u.c b/drivers/media/usb/dvb-usb/dtt200u.c index 1e7296b2e5b2..24efa023d827 100644 --- a/drivers/media/usb/dvb-usb/dtt200u.c +++ b/drivers/media/usb/dvb-usb/dtt200u.c @@ -6,7 +6,7 @@ * * Thanks to Steve Chang from WideView for providing support for the WT-220U. * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #include "dtt200u.h" diff --git a/drivers/media/usb/dvb-usb/dtt200u.h b/drivers/media/usb/dvb-usb/dtt200u.h index 832f355114e4..696c2c1f3af3 100644 --- a/drivers/media/usb/dvb-usb/dtt200u.h +++ b/drivers/media/usb/dvb-usb/dtt200u.h @@ -4,7 +4,7 @@ * * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@posteo.de) * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #ifndef _DVB_USB_DTT200U_H_ #define _DVB_USB_DTT200U_H_ diff --git a/drivers/media/usb/dvb-usb/dvb-usb-common.h b/drivers/media/usb/dvb-usb/dvb-usb-common.h index 8c51ac4493dd..70f4eedd7c48 100644 --- a/drivers/media/usb/dvb-usb/dvb-usb-common.h +++ b/drivers/media/usb/dvb-usb/dvb-usb-common.h @@ -26,7 +26,8 @@ extern int dvb_usb_disable_rc_polling; #define deb_uxfer(args...) dprintk(dvb_usb_debug,0x100,args) /* commonly used methods */ -extern int dvb_usb_download_firmware(struct usb_device *, struct dvb_usb_device_properties *); +int dvb_usb_download_firmware(struct usb_device *udev, + const struct dvb_usb_device_properties *props); extern int dvb_usb_device_power_ctrl(struct dvb_usb_device *d, int onoff); diff --git a/drivers/media/usb/dvb-usb/dvb-usb-firmware.c b/drivers/media/usb/dvb-usb/dvb-usb-firmware.c index 42c207aacbb1..0fb3fa6100e4 100644 --- a/drivers/media/usb/dvb-usb/dvb-usb-firmware.c +++ b/drivers/media/usb/dvb-usb/dvb-usb-firmware.c @@ -84,7 +84,8 @@ int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw } EXPORT_SYMBOL(usb_cypress_load_firmware); -int dvb_usb_download_firmware(struct usb_device *udev, struct dvb_usb_device_properties *props) +int dvb_usb_download_firmware(struct usb_device *udev, + const struct dvb_usb_device_properties *props) { int ret; const struct firmware *fw = NULL; diff --git a/drivers/media/usb/dvb-usb/dvb-usb-init.c b/drivers/media/usb/dvb-usb/dvb-usb-init.c index 16a0b4a359ea..c1a7634e27b4 100644 --- a/drivers/media/usb/dvb-usb/dvb-usb-init.c +++ b/drivers/media/usb/dvb-usb/dvb-usb-init.c @@ -6,7 +6,7 @@ * * Copyright (C) 2004-6 Patrick Boettcher (patrick.boettcher@posteo.de) * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #include "dvb-usb-common.h" @@ -184,10 +184,10 @@ static int dvb_usb_init(struct dvb_usb_device *d, short *adapter_nums) } /* determine the name and the state of the just found USB device */ -static struct dvb_usb_device_description *dvb_usb_find_device(struct usb_device *udev, struct dvb_usb_device_properties *props, int *cold) +static const struct dvb_usb_device_description *dvb_usb_find_device(struct usb_device *udev, const struct dvb_usb_device_properties *props, int *cold) { int i, j; - struct dvb_usb_device_description *desc = NULL; + const struct dvb_usb_device_description *desc = NULL; *cold = -1; @@ -242,13 +242,13 @@ int dvb_usb_device_power_ctrl(struct dvb_usb_device *d, int onoff) * USB */ int dvb_usb_device_init(struct usb_interface *intf, - struct dvb_usb_device_properties *props, + const struct dvb_usb_device_properties *props, struct module *owner, struct dvb_usb_device **du, short *adapter_nums) { struct usb_device *udev = interface_to_usbdev(intf); struct dvb_usb_device *d = NULL; - struct dvb_usb_device_description *desc = NULL; + const struct dvb_usb_device_description *desc = NULL; int ret = -ENOMEM, cold = 0; diff --git a/drivers/media/usb/dvb-usb/dvb-usb.h b/drivers/media/usb/dvb-usb/dvb-usb.h index 2eb0e24e8943..741be0e69447 100644 --- a/drivers/media/usb/dvb-usb/dvb-usb.h +++ b/drivers/media/usb/dvb-usb/dvb-usb.h @@ -291,8 +291,10 @@ struct dvb_usb_device_properties { int (*power_ctrl) (struct dvb_usb_device *, int); int (*read_mac_address) (struct dvb_usb_device *, u8 []); - int (*identify_state) (struct usb_device *, struct dvb_usb_device_properties *, - struct dvb_usb_device_description **, int *); + int (*identify_state)(struct usb_device *udev, + const struct dvb_usb_device_properties *props, + const struct dvb_usb_device_description **desc, + int *cold); struct { enum dvb_usb_mode mode; /* Drivers shouldn't touch on it */ @@ -436,7 +438,7 @@ struct dvb_usb_adapter { */ struct dvb_usb_device { struct dvb_usb_device_properties props; - struct dvb_usb_device_description *desc; + const struct dvb_usb_device_description *desc; struct usb_device *udev; @@ -473,7 +475,7 @@ struct dvb_usb_device { }; extern int dvb_usb_device_init(struct usb_interface *, - struct dvb_usb_device_properties *, + const struct dvb_usb_device_properties *, struct module *, struct dvb_usb_device **, short *adapter_nums); extern void dvb_usb_device_exit(struct usb_interface *); diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c index 1007366a295b..f96626fe2c0b 100644 --- a/drivers/media/usb/dvb-usb/dw2102.c +++ b/drivers/media/usb/dvb-usb/dw2102.c @@ -8,7 +8,7 @@ * Terratec Cinergy S2 cards * Copyright (C) 2008-2012 Igor M. Liplianin (liplianin@me.by) * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #include <media/dvb-usb-ids.h> #include "dw2102.h" @@ -955,8 +955,8 @@ static int su3000_read_mac_address(struct dvb_usb_device *d, u8 mac[6]) } static int su3000_identify_state(struct usb_device *udev, - struct dvb_usb_device_properties *props, - struct dvb_usb_device_description **desc, + const struct dvb_usb_device_properties *props, + const struct dvb_usb_device_description **desc, int *cold) { info("%s", __func__); @@ -1779,6 +1779,8 @@ enum dw2102_table_entry { TERRATEC_CINERGY_S2_R2, TERRATEC_CINERGY_S2_R3, TERRATEC_CINERGY_S2_R4, + TERRATEC_CINERGY_S2_1, + TERRATEC_CINERGY_S2_2, GOTVIEW_SAT_HD, GENIATECH_T220, TECHNOTREND_S2_4600, @@ -1806,9 +1808,16 @@ static struct usb_device_id dw2102_table[] = { [X3M_SPC1400HD] = {USB_DEVICE(0x1f4d, 0x3100)}, [TEVII_S421] = {USB_DEVICE(0x9022, USB_PID_TEVII_S421)}, [TEVII_S632] = {USB_DEVICE(0x9022, USB_PID_TEVII_S632)}, - [TERRATEC_CINERGY_S2_R2] = {USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_S2_R2)}, - [TERRATEC_CINERGY_S2_R3] = {USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_S2_R3)}, - [TERRATEC_CINERGY_S2_R4] = {USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_S2_R4)}, + [TERRATEC_CINERGY_S2_R2] = {USB_DEVICE(USB_VID_TERRATEC, + USB_PID_TERRATEC_CINERGY_S2_R2)}, + [TERRATEC_CINERGY_S2_R3] = {USB_DEVICE(USB_VID_TERRATEC, + USB_PID_TERRATEC_CINERGY_S2_R3)}, + [TERRATEC_CINERGY_S2_R4] = {USB_DEVICE(USB_VID_TERRATEC, + USB_PID_TERRATEC_CINERGY_S2_R4)}, + [TERRATEC_CINERGY_S2_1] = {USB_DEVICE(USB_VID_TERRATEC_2, + USB_PID_TERRATEC_CINERGY_S2_1)}, + [TERRATEC_CINERGY_S2_2] = {USB_DEVICE(USB_VID_TERRATEC_2, + USB_PID_TERRATEC_CINERGY_S2_2)}, [GOTVIEW_SAT_HD] = {USB_DEVICE(0x1FE1, USB_PID_GOTVIEW_SAT_HD)}, [GENIATECH_T220] = {USB_DEVICE(0x1f4d, 0xD220)}, [TECHNOTREND_S2_4600] = {USB_DEVICE(USB_VID_TECHNOTREND, @@ -2221,7 +2230,7 @@ static struct dvb_usb_device_properties su3000_properties = { }}, } }, - .num_device_descs = 6, + .num_device_descs = 8, .devices = { { "SU3000HD DVB-S USB2.0", { &dw2102_table[GENIATECH_SU3000], NULL }, @@ -2243,6 +2252,14 @@ static struct dvb_usb_device_properties su3000_properties = { { &dw2102_table[TERRATEC_CINERGY_S2_R3], NULL }, { NULL }, }, + { "Terratec Cinergy S2 PCIe Dual Port 1", + { &dw2102_table[TERRATEC_CINERGY_S2_1], NULL }, + { NULL }, + }, + { "Terratec Cinergy S2 PCIe Dual Port 2", + { &dw2102_table[TERRATEC_CINERGY_S2_2], NULL }, + { NULL }, + }, { "GOTVIEW Satellite HD", { &dw2102_table[GOTVIEW_SAT_HD], NULL }, { NULL }, diff --git a/drivers/media/usb/dvb-usb/gp8psk.c b/drivers/media/usb/dvb-usb/gp8psk.c index 1282f701f185..c07f46f5176e 100644 --- a/drivers/media/usb/dvb-usb/gp8psk.c +++ b/drivers/media/usb/dvb-usb/gp8psk.c @@ -9,7 +9,7 @@ * * This module is based off the vp7045 and vp702x modules * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #include "gp8psk.h" #include "gp8psk-fe.h" diff --git a/drivers/media/usb/dvb-usb/gp8psk.h b/drivers/media/usb/dvb-usb/gp8psk.h index 2f4c1368eabe..5293dfdd2609 100644 --- a/drivers/media/usb/dvb-usb/gp8psk.h +++ b/drivers/media/usb/dvb-usb/gp8psk.h @@ -9,7 +9,7 @@ * * This module is based off the vp7045 and vp702x modules * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #ifndef _DVB_USB_GP8PSK_H_ #define _DVB_USB_GP8PSK_H_ diff --git a/drivers/media/usb/dvb-usb/m920x.c b/drivers/media/usb/dvb-usb/m920x.c index d866a1990a7d..4bb5b82599a7 100644 --- a/drivers/media/usb/dvb-usb/m920x.c +++ b/drivers/media/usb/dvb-usb/m920x.c @@ -3,7 +3,7 @@ * * Copyright (C) 2006 Aapo Tahkola (aet@rasterburn.org) * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #include "m920x.h" @@ -459,8 +459,8 @@ static int m920x_firmware_download(struct usb_device *udev, const struct firmwar /* Callbacks for DVB USB */ static int m920x_identify_state(struct usb_device *udev, - struct dvb_usb_device_properties *props, - struct dvb_usb_device_description **desc, + const struct dvb_usb_device_properties *props, + const struct dvb_usb_device_description **desc, int *cold) { struct usb_host_interface *alt; diff --git a/drivers/media/usb/dvb-usb/nova-t-usb2.c b/drivers/media/usb/dvb-usb/nova-t-usb2.c index e368935a5089..e7b290552b66 100644 --- a/drivers/media/usb/dvb-usb/nova-t-usb2.c +++ b/drivers/media/usb/dvb-usb/nova-t-usb2.c @@ -4,7 +4,7 @@ * * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@posteo.de) * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #include "dibusb.h" diff --git a/drivers/media/usb/dvb-usb/opera1.c b/drivers/media/usb/dvb-usb/opera1.c index 823b33ae828d..e8d784b9d119 100644 --- a/drivers/media/usb/dvb-usb/opera1.c +++ b/drivers/media/usb/dvb-usb/opera1.c @@ -4,7 +4,7 @@ * Copyright (C) 2006 Mario Hlawitschka (dh1pa@amsat.org) * Copyright (C) 2006 Marco Gittler (g.marco@freenet.de) * -* see Documentation/media/dvb-drivers/dvb-usb.rst for more information +* see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #define DVB_USB_LOG_PREFIX "opera" diff --git a/drivers/media/usb/dvb-usb/technisat-usb2.c b/drivers/media/usb/dvb-usb/technisat-usb2.c index 676d233d46d5..f172120db2aa 100644 --- a/drivers/media/usb/dvb-usb/technisat-usb2.c +++ b/drivers/media/usb/dvb-usb/technisat-usb2.c @@ -330,8 +330,8 @@ schedule: /* method to find out whether the firmware has to be downloaded or not */ static int technisat_usb2_identify_state(struct usb_device *udev, - struct dvb_usb_device_properties *props, - struct dvb_usb_device_description **desc, int *cold) + const struct dvb_usb_device_properties *props, + const struct dvb_usb_device_description **desc, int *cold) { int ret; u8 *version; diff --git a/drivers/media/usb/dvb-usb/ttusb2.c b/drivers/media/usb/dvb-usb/ttusb2.c index e12a5466b677..294274fd8f55 100644 --- a/drivers/media/usb/dvb-usb/ttusb2.c +++ b/drivers/media/usb/dvb-usb/ttusb2.c @@ -17,7 +17,7 @@ * Copyright (c) 2003 Felix Domke <tmbinc@elitedvb.net> * Copyright (C) 2005-6 Patrick Boettcher <pb@linuxtv.org> * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #define DVB_USB_LOG_PREFIX "ttusb2" #include "dvb-usb.h" @@ -467,9 +467,10 @@ static int tt3650_rc_query(struct dvb_usb_device *d) /* Callbacks for DVB USB */ -static int ttusb2_identify_state (struct usb_device *udev, struct - dvb_usb_device_properties *props, struct dvb_usb_device_description **desc, - int *cold) +static int ttusb2_identify_state(struct usb_device *udev, + const struct dvb_usb_device_properties *props, + const struct dvb_usb_device_description **desc, + int *cold) { *cold = udev->descriptor.iManufacturer == 0 && udev->descriptor.iProduct == 0; return 0; diff --git a/drivers/media/usb/dvb-usb/ttusb2.h b/drivers/media/usb/dvb-usb/ttusb2.h index 8a3853cd6a26..b34c469d83f9 100644 --- a/drivers/media/usb/dvb-usb/ttusb2.h +++ b/drivers/media/usb/dvb-usb/ttusb2.h @@ -6,7 +6,7 @@ * Copyright (c) 2003 Felix Domke <tmbinc@elitedvb.net> * Copyright (C) 2005-6 Patrick Boettcher <pb@linuxtv.de> * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #ifndef _DVB_USB_TTUSB2_H_ #define _DVB_USB_TTUSB2_H_ diff --git a/drivers/media/usb/dvb-usb/umt-010.c b/drivers/media/usb/dvb-usb/umt-010.c index a2101bd43349..2181993771ae 100644 --- a/drivers/media/usb/dvb-usb/umt-010.c +++ b/drivers/media/usb/dvb-usb/umt-010.c @@ -4,7 +4,7 @@ * * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@posteo.de) * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #include "dibusb.h" diff --git a/drivers/media/usb/dvb-usb/vp702x-fe.c b/drivers/media/usb/dvb-usb/vp702x-fe.c index 1c75a9c9dfca..c1e7931900ee 100644 --- a/drivers/media/usb/dvb-usb/vp702x-fe.c +++ b/drivers/media/usb/dvb-usb/vp702x-fe.c @@ -12,7 +12,7 @@ * This file can be removed soon, after the DST-driver is rewritten to provice * the frontend-controlling separately. * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #include "vp702x.h" diff --git a/drivers/media/usb/dvb-usb/vp702x.c b/drivers/media/usb/dvb-usb/vp702x.c index 381b5c898a07..bf54747e2e01 100644 --- a/drivers/media/usb/dvb-usb/vp702x.c +++ b/drivers/media/usb/dvb-usb/vp702x.c @@ -9,7 +9,7 @@ * * Thanks to Twinhan who kindly provided hardware and information. * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #include "vp702x.h" #include <linux/mutex.h> diff --git a/drivers/media/usb/dvb-usb/vp7045-fe.c b/drivers/media/usb/dvb-usb/vp7045-fe.c index d253307a35f8..e99740ec2650 100644 --- a/drivers/media/usb/dvb-usb/vp7045-fe.c +++ b/drivers/media/usb/dvb-usb/vp7045-fe.c @@ -6,7 +6,7 @@ * * Thanks to Twinhan who kindly provided hardware and information. * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #include "vp7045.h" diff --git a/drivers/media/usb/dvb-usb/vp7045.c b/drivers/media/usb/dvb-usb/vp7045.c index 2baf57216d19..23e3a90af1f4 100644 --- a/drivers/media/usb/dvb-usb/vp7045.c +++ b/drivers/media/usb/dvb-usb/vp7045.c @@ -7,7 +7,7 @@ * * Thanks to Twinhan who kindly provided hardware and information. * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #include "vp7045.h" diff --git a/drivers/media/usb/dvb-usb/vp7045.h b/drivers/media/usb/dvb-usb/vp7045.h index 818366746c41..1c8438f22b97 100644 --- a/drivers/media/usb/dvb-usb/vp7045.h +++ b/drivers/media/usb/dvb-usb/vp7045.h @@ -6,7 +6,7 @@ * * Thanks to Twinhan who kindly provided hardware and information. * - * see Documentation/media/dvb-drivers/dvb-usb.rst for more information + * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information */ #ifndef _DVB_USB_VP7045_H_ #define _DVB_USB_VP7045_H_ diff --git a/drivers/media/usb/gspca/Kconfig b/drivers/media/usb/gspca/Kconfig index 77a360958239..0283e3b908e4 100644 --- a/drivers/media/usb/gspca/Kconfig +++ b/drivers/media/usb/gspca/Kconfig @@ -9,7 +9,7 @@ menuconfig USB_GSPCA Say Y here if you want to enable selecting webcams based on the GSPCA framework. - See <file:Documentation/media/v4l-drivers/gspca-cardlist.rst> for more info. + See <file:Documentation/admin-guide/media/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. diff --git a/drivers/media/usb/gspca/mr97310a.c b/drivers/media/usb/gspca/mr97310a.c index 502fc2eaffe0..464aa61cd914 100644 --- a/drivers/media/usb/gspca/mr97310a.c +++ b/drivers/media/usb/gspca/mr97310a.c @@ -287,7 +287,6 @@ static int zero_the_pointer(struct gspca_dev *gspca_dev) return err_code; err_code = cam_get_response16(gspca_dev, 0x21, 0); - status = data[0]; tries++; if (err_code < 0) return err_code; diff --git a/drivers/media/usb/hdpvr/hdpvr-core.c b/drivers/media/usb/hdpvr/hdpvr-core.c index b75c18a012a7..52e05a69c46e 100644 --- a/drivers/media/usb/hdpvr/hdpvr-core.c +++ b/drivers/media/usb/hdpvr/hdpvr-core.c @@ -363,9 +363,9 @@ static int hdpvr_probe(struct usb_interface *interface, } client = hdpvr_register_ir_i2c(dev); - if (!client) { + if (IS_ERR(client)) { v4l2_err(&dev->v4l2_dev, "i2c IR device register failed\n"); - retval = -ENODEV; + retval = PTR_ERR(client); goto reg_fail; } #endif diff --git a/drivers/media/usb/hdpvr/hdpvr-i2c.c b/drivers/media/usb/hdpvr/hdpvr-i2c.c index 785c8508a46e..070559b01b01 100644 --- a/drivers/media/usb/hdpvr/hdpvr-i2c.c +++ b/drivers/media/usb/hdpvr/hdpvr-i2c.c @@ -44,7 +44,7 @@ struct i2c_client *hdpvr_register_ir_i2c(struct hdpvr_device *dev) init_data->polling_interval = 405; /* ms, duplicated from Windows */ info.platform_data = init_data; - return i2c_new_device(&dev->i2c_adapter, &info); + return i2c_new_client_device(&dev->i2c_adapter, &info); } static int hdpvr_i2c_read(struct hdpvr_device *dev, int bus, diff --git a/drivers/media/usb/pulse8-cec/Kconfig b/drivers/media/usb/pulse8-cec/Kconfig deleted file mode 100644 index e802d30dbbee..000000000000 --- a/drivers/media/usb/pulse8-cec/Kconfig +++ /dev/null @@ -1,12 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -config USB_PULSE8_CEC - tristate "Pulse Eight HDMI CEC" - depends on USB_ACM - select CEC_CORE - select SERIO - select SERIO_SERPORT - help - This is a cec driver for the Pulse Eight HDMI CEC device. - - To compile this driver as a module, choose M here: the - module will be called pulse8-cec. diff --git a/drivers/media/usb/pulse8-cec/Makefile b/drivers/media/usb/pulse8-cec/Makefile deleted file mode 100644 index 7816c68bf928..000000000000 --- a/drivers/media/usb/pulse8-cec/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -obj-$(CONFIG_USB_PULSE8_CEC) += pulse8-cec.o diff --git a/drivers/media/usb/pulse8-cec/pulse8-cec.c b/drivers/media/usb/pulse8-cec/pulse8-cec.c deleted file mode 100644 index beae6aa12638..000000000000 --- a/drivers/media/usb/pulse8-cec/pulse8-cec.c +++ /dev/null @@ -1,905 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Pulse Eight HDMI CEC driver - * - * Copyright 2016 Hans Verkuil <hverkuil@xs4all.nl - */ - -/* - * Notes: - * - * - Devices with firmware version < 2 do not store their configuration in - * EEPROM. - * - * - In autonomous mode, only messages from a TV will be acknowledged, even - * polling messages. Upon receiving a message from a TV, the dongle will - * respond to messages from any logical address. - * - * - In autonomous mode, the dongle will by default reply Feature Abort - * [Unrecognized Opcode] when it receives Give Device Vendor ID. It will - * however observe vendor ID's reported by other devices and possibly - * alter this behavior. When TV's (and TV's only) report that their vendor ID - * is LG (0x00e091), the dongle will itself reply that it has the same vendor - * ID, and it will respond to at least one vendor specific command. - * - * - In autonomous mode, the dongle is known to attempt wakeup if it receives - * <User Control Pressed> ["Power On"], ["Power] or ["Power Toggle"], or if it - * receives <Set Stream Path> with its own physical address. It also does this - * if it receives <Vendor Specific Command> [0x03 0x00] from an LG TV. - */ - -#include <linux/completion.h> -#include <linux/init.h> -#include <linux/interrupt.h> -#include <linux/kernel.h> -#include <linux/module.h> -#include <linux/workqueue.h> -#include <linux/serio.h> -#include <linux/slab.h> -#include <linux/time.h> -#include <linux/delay.h> - -#include <media/cec.h> - -MODULE_AUTHOR("Hans Verkuil <hverkuil@xs4all.nl>"); -MODULE_DESCRIPTION("Pulse Eight HDMI CEC driver"); -MODULE_LICENSE("GPL"); - -static int debug; -static int persistent_config; -module_param(debug, int, 0644); -module_param(persistent_config, int, 0644); -MODULE_PARM_DESC(debug, "debug level (0-2)"); -MODULE_PARM_DESC(persistent_config, "read config from persistent memory (0-1)"); - -enum pulse8_msgcodes { - MSGCODE_NOTHING = 0, - MSGCODE_PING, - MSGCODE_TIMEOUT_ERROR, - MSGCODE_HIGH_ERROR, - MSGCODE_LOW_ERROR, - MSGCODE_FRAME_START, - MSGCODE_FRAME_DATA, - MSGCODE_RECEIVE_FAILED, - MSGCODE_COMMAND_ACCEPTED, /* 0x08 */ - MSGCODE_COMMAND_REJECTED, - MSGCODE_SET_ACK_MASK, - MSGCODE_TRANSMIT, - MSGCODE_TRANSMIT_EOM, - MSGCODE_TRANSMIT_IDLETIME, - MSGCODE_TRANSMIT_ACK_POLARITY, - MSGCODE_TRANSMIT_LINE_TIMEOUT, - MSGCODE_TRANSMIT_SUCCEEDED, /* 0x10 */ - MSGCODE_TRANSMIT_FAILED_LINE, - MSGCODE_TRANSMIT_FAILED_ACK, - MSGCODE_TRANSMIT_FAILED_TIMEOUT_DATA, - MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE, - MSGCODE_FIRMWARE_VERSION, - MSGCODE_START_BOOTLOADER, - MSGCODE_GET_BUILDDATE, - MSGCODE_SET_CONTROLLED, /* 0x18 */ - MSGCODE_GET_AUTO_ENABLED, - MSGCODE_SET_AUTO_ENABLED, - MSGCODE_GET_DEFAULT_LOGICAL_ADDRESS, - MSGCODE_SET_DEFAULT_LOGICAL_ADDRESS, - MSGCODE_GET_LOGICAL_ADDRESS_MASK, - MSGCODE_SET_LOGICAL_ADDRESS_MASK, - MSGCODE_GET_PHYSICAL_ADDRESS, - MSGCODE_SET_PHYSICAL_ADDRESS, /* 0x20 */ - MSGCODE_GET_DEVICE_TYPE, - MSGCODE_SET_DEVICE_TYPE, - MSGCODE_GET_HDMI_VERSION, - MSGCODE_SET_HDMI_VERSION, - MSGCODE_GET_OSD_NAME, - MSGCODE_SET_OSD_NAME, - MSGCODE_WRITE_EEPROM, - MSGCODE_GET_ADAPTER_TYPE, /* 0x28 */ - MSGCODE_SET_ACTIVE_SOURCE, - - MSGCODE_FRAME_EOM = 0x80, - MSGCODE_FRAME_ACK = 0x40, -}; - -static const char * const pulse8_msgnames[] = { - "NOTHING", - "PING", - "TIMEOUT_ERROR", - "HIGH_ERROR", - "LOW_ERROR", - "FRAME_START", - "FRAME_DATA", - "RECEIVE_FAILED", - "COMMAND_ACCEPTED", - "COMMAND_REJECTED", - "SET_ACK_MASK", - "TRANSMIT", - "TRANSMIT_EOM", - "TRANSMIT_IDLETIME", - "TRANSMIT_ACK_POLARITY", - "TRANSMIT_LINE_TIMEOUT", - "TRANSMIT_SUCCEEDED", - "TRANSMIT_FAILED_LINE", - "TRANSMIT_FAILED_ACK", - "TRANSMIT_FAILED_TIMEOUT_DATA", - "TRANSMIT_FAILED_TIMEOUT_LINE", - "FIRMWARE_VERSION", - "START_BOOTLOADER", - "GET_BUILDDATE", - "SET_CONTROLLED", - "GET_AUTO_ENABLED", - "SET_AUTO_ENABLED", - "GET_DEFAULT_LOGICAL_ADDRESS", - "SET_DEFAULT_LOGICAL_ADDRESS", - "GET_LOGICAL_ADDRESS_MASK", - "SET_LOGICAL_ADDRESS_MASK", - "GET_PHYSICAL_ADDRESS", - "SET_PHYSICAL_ADDRESS", - "GET_DEVICE_TYPE", - "SET_DEVICE_TYPE", - "GET_HDMI_VERSION", - "SET_HDMI_VERSION", - "GET_OSD_NAME", - "SET_OSD_NAME", - "WRITE_EEPROM", - "GET_ADAPTER_TYPE", - "SET_ACTIVE_SOURCE", -}; - -static const char *pulse8_msgname(u8 cmd) -{ - static char unknown_msg[5]; - - if ((cmd & 0x3f) < ARRAY_SIZE(pulse8_msgnames)) - return pulse8_msgnames[cmd & 0x3f]; - snprintf(unknown_msg, sizeof(unknown_msg), "0x%02x", cmd); - return unknown_msg; -} - -#define MSGSTART 0xff -#define MSGEND 0xfe -#define MSGESC 0xfd -#define MSGOFFSET 3 - -#define DATA_SIZE 256 - -#define PING_PERIOD (15 * HZ) - -#define NUM_MSGS 8 - -struct pulse8 { - struct device *dev; - struct serio *serio; - struct cec_adapter *adap; - unsigned int vers; - - struct delayed_work ping_eeprom_work; - - struct work_struct irq_work; - struct cec_msg rx_msg[NUM_MSGS]; - unsigned int rx_msg_cur_idx, rx_msg_num; - /* protect rx_msg_cur_idx and rx_msg_num */ - spinlock_t msg_lock; - u8 new_rx_msg[CEC_MAX_MSG_SIZE]; - u8 new_rx_msg_len; - - struct work_struct tx_work; - u32 tx_done_status; - u32 tx_signal_free_time; - struct cec_msg tx_msg; - bool tx_msg_is_bcast; - - struct completion cmd_done; - u8 data[DATA_SIZE]; - unsigned int len; - u8 buf[DATA_SIZE]; - unsigned int idx; - bool escape; - bool started; - - /* locks access to the adapter */ - struct mutex lock; - bool config_pending; - bool restoring_config; - bool autonomous; -}; - -static int pulse8_send(struct serio *serio, const u8 *command, u8 cmd_len) -{ - int err = 0; - - err = serio_write(serio, MSGSTART); - if (err) - return err; - for (; !err && cmd_len; command++, cmd_len--) { - if (*command >= MSGESC) { - err = serio_write(serio, MSGESC); - if (!err) - err = serio_write(serio, *command - MSGOFFSET); - } else { - err = serio_write(serio, *command); - } - } - if (!err) - err = serio_write(serio, MSGEND); - - return err; -} - -static int pulse8_send_and_wait_once(struct pulse8 *pulse8, - const u8 *cmd, u8 cmd_len, - u8 response, u8 size) -{ - int err; - - if (debug > 1) - dev_info(pulse8->dev, "transmit %s: %*ph\n", - pulse8_msgname(cmd[0]), cmd_len, cmd); - init_completion(&pulse8->cmd_done); - - err = pulse8_send(pulse8->serio, cmd, cmd_len); - if (err) - return err; - - if (!wait_for_completion_timeout(&pulse8->cmd_done, HZ)) - return -ETIMEDOUT; - if ((pulse8->data[0] & 0x3f) == MSGCODE_COMMAND_REJECTED && - cmd[0] != MSGCODE_SET_CONTROLLED && - cmd[0] != MSGCODE_SET_AUTO_ENABLED && - cmd[0] != MSGCODE_GET_BUILDDATE) - return -ENOTTY; - if (response && - ((pulse8->data[0] & 0x3f) != response || pulse8->len < size + 1)) { - dev_info(pulse8->dev, "transmit %s failed with %s\n", - pulse8_msgname(cmd[0]), - pulse8_msgname(pulse8->data[0])); - return -EIO; - } - return 0; -} - -static int pulse8_send_and_wait(struct pulse8 *pulse8, - const u8 *cmd, u8 cmd_len, u8 response, u8 size) -{ - u8 cmd_sc[2]; - int err; - - err = pulse8_send_and_wait_once(pulse8, cmd, cmd_len, response, size); - if (err != -ENOTTY) - return err; - - cmd_sc[0] = MSGCODE_SET_CONTROLLED; - cmd_sc[1] = 1; - err = pulse8_send_and_wait_once(pulse8, cmd_sc, 2, - MSGCODE_COMMAND_ACCEPTED, 1); - if (!err) - err = pulse8_send_and_wait_once(pulse8, cmd, cmd_len, - response, size); - return err == -ENOTTY ? -EIO : err; -} - -static void pulse8_tx_work_handler(struct work_struct *work) -{ - struct pulse8 *pulse8 = container_of(work, struct pulse8, tx_work); - struct cec_msg *msg = &pulse8->tx_msg; - unsigned int i; - u8 cmd[2]; - int err; - - if (msg->len == 0) - return; - - mutex_lock(&pulse8->lock); - cmd[0] = MSGCODE_TRANSMIT_IDLETIME; - cmd[1] = pulse8->tx_signal_free_time; - err = pulse8_send_and_wait(pulse8, cmd, 2, - MSGCODE_COMMAND_ACCEPTED, 1); - cmd[0] = MSGCODE_TRANSMIT_ACK_POLARITY; - cmd[1] = cec_msg_is_broadcast(msg); - pulse8->tx_msg_is_bcast = cec_msg_is_broadcast(msg); - if (!err) - err = pulse8_send_and_wait(pulse8, cmd, 2, - MSGCODE_COMMAND_ACCEPTED, 1); - cmd[0] = msg->len == 1 ? MSGCODE_TRANSMIT_EOM : MSGCODE_TRANSMIT; - cmd[1] = msg->msg[0]; - if (!err) - err = pulse8_send_and_wait(pulse8, cmd, 2, - MSGCODE_COMMAND_ACCEPTED, 1); - if (!err && msg->len > 1) { - for (i = 1; !err && i < msg->len; i++) { - cmd[0] = ((i == msg->len - 1)) ? - MSGCODE_TRANSMIT_EOM : MSGCODE_TRANSMIT; - cmd[1] = msg->msg[i]; - err = pulse8_send_and_wait(pulse8, cmd, 2, - MSGCODE_COMMAND_ACCEPTED, 1); - } - } - if (err && debug) - dev_info(pulse8->dev, "%s(0x%02x) failed with error %d for msg %*ph\n", - pulse8_msgname(cmd[0]), cmd[1], - err, msg->len, msg->msg); - msg->len = 0; - mutex_unlock(&pulse8->lock); - if (err) - cec_transmit_attempt_done(pulse8->adap, CEC_TX_STATUS_ERROR); -} - -static void pulse8_irq_work_handler(struct work_struct *work) -{ - struct pulse8 *pulse8 = - container_of(work, struct pulse8, irq_work); - unsigned long flags; - u32 status; - - spin_lock_irqsave(&pulse8->msg_lock, flags); - while (pulse8->rx_msg_num) { - spin_unlock_irqrestore(&pulse8->msg_lock, flags); - if (debug) - dev_info(pulse8->dev, "adap received %*ph\n", - pulse8->rx_msg[pulse8->rx_msg_cur_idx].len, - pulse8->rx_msg[pulse8->rx_msg_cur_idx].msg); - cec_received_msg(pulse8->adap, - &pulse8->rx_msg[pulse8->rx_msg_cur_idx]); - spin_lock_irqsave(&pulse8->msg_lock, flags); - if (pulse8->rx_msg_num) - pulse8->rx_msg_num--; - pulse8->rx_msg_cur_idx = - (pulse8->rx_msg_cur_idx + 1) % NUM_MSGS; - } - spin_unlock_irqrestore(&pulse8->msg_lock, flags); - - mutex_lock(&pulse8->lock); - status = pulse8->tx_done_status; - pulse8->tx_done_status = 0; - mutex_unlock(&pulse8->lock); - if (status) - cec_transmit_attempt_done(pulse8->adap, status); -} - -static irqreturn_t pulse8_interrupt(struct serio *serio, unsigned char data, - unsigned int flags) -{ - struct pulse8 *pulse8 = serio_get_drvdata(serio); - unsigned long irq_flags; - unsigned int idx; - - if (!pulse8->started && data != MSGSTART) - return IRQ_HANDLED; - if (data == MSGESC) { - pulse8->escape = true; - return IRQ_HANDLED; - } - if (pulse8->escape) { - data += MSGOFFSET; - pulse8->escape = false; - } else if (data == MSGEND) { - u8 msgcode = pulse8->buf[0]; - - if (debug > 1) - dev_info(pulse8->dev, "received %s: %*ph\n", - pulse8_msgname(msgcode), - pulse8->idx, pulse8->buf); - switch (msgcode & 0x3f) { - case MSGCODE_FRAME_START: - /* - * Test if we are receiving a new msg when a previous - * message is still pending. - */ - if (!(msgcode & MSGCODE_FRAME_EOM)) { - pulse8->new_rx_msg_len = 1; - pulse8->new_rx_msg[0] = pulse8->buf[1]; - break; - } - /* fall through */ - case MSGCODE_FRAME_DATA: - if (pulse8->new_rx_msg_len < CEC_MAX_MSG_SIZE) - pulse8->new_rx_msg[pulse8->new_rx_msg_len++] = - pulse8->buf[1]; - if (!(msgcode & MSGCODE_FRAME_EOM)) - break; - - spin_lock_irqsave(&pulse8->msg_lock, irq_flags); - idx = (pulse8->rx_msg_cur_idx + pulse8->rx_msg_num) % - NUM_MSGS; - if (pulse8->rx_msg_num == NUM_MSGS) { - dev_warn(pulse8->dev, - "message queue is full, dropping %*ph\n", - pulse8->new_rx_msg_len, - pulse8->new_rx_msg); - spin_unlock_irqrestore(&pulse8->msg_lock, - irq_flags); - pulse8->new_rx_msg_len = 0; - break; - } - pulse8->rx_msg_num++; - memcpy(pulse8->rx_msg[idx].msg, pulse8->new_rx_msg, - pulse8->new_rx_msg_len); - pulse8->rx_msg[idx].len = pulse8->new_rx_msg_len; - spin_unlock_irqrestore(&pulse8->msg_lock, irq_flags); - schedule_work(&pulse8->irq_work); - pulse8->new_rx_msg_len = 0; - break; - case MSGCODE_TRANSMIT_SUCCEEDED: - WARN_ON(pulse8->tx_done_status); - pulse8->tx_done_status = CEC_TX_STATUS_OK; - schedule_work(&pulse8->irq_work); - break; - case MSGCODE_TRANSMIT_FAILED_ACK: - /* - * A NACK for a broadcast message makes no sense, these - * seem to be spurious messages and are skipped. - */ - if (pulse8->tx_msg_is_bcast) - break; - WARN_ON(pulse8->tx_done_status); - pulse8->tx_done_status = CEC_TX_STATUS_NACK; - schedule_work(&pulse8->irq_work); - break; - case MSGCODE_TRANSMIT_FAILED_LINE: - case MSGCODE_TRANSMIT_FAILED_TIMEOUT_DATA: - case MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE: - WARN_ON(pulse8->tx_done_status); - pulse8->tx_done_status = CEC_TX_STATUS_ERROR; - schedule_work(&pulse8->irq_work); - break; - case MSGCODE_HIGH_ERROR: - case MSGCODE_LOW_ERROR: - case MSGCODE_RECEIVE_FAILED: - case MSGCODE_TIMEOUT_ERROR: - pulse8->new_rx_msg_len = 0; - break; - case MSGCODE_COMMAND_ACCEPTED: - case MSGCODE_COMMAND_REJECTED: - default: - if (pulse8->idx == 0) - break; - memcpy(pulse8->data, pulse8->buf, pulse8->idx); - pulse8->len = pulse8->idx; - complete(&pulse8->cmd_done); - break; - } - pulse8->idx = 0; - pulse8->started = false; - return IRQ_HANDLED; - } else if (data == MSGSTART) { - pulse8->idx = 0; - pulse8->started = true; - return IRQ_HANDLED; - } - - if (pulse8->idx >= DATA_SIZE) { - dev_dbg(pulse8->dev, - "throwing away %d bytes of garbage\n", pulse8->idx); - pulse8->idx = 0; - } - pulse8->buf[pulse8->idx++] = data; - return IRQ_HANDLED; -} - -static int pulse8_cec_adap_enable(struct cec_adapter *adap, bool enable) -{ - struct pulse8 *pulse8 = cec_get_drvdata(adap); - u8 cmd[16]; - int err; - - mutex_lock(&pulse8->lock); - cmd[0] = MSGCODE_SET_CONTROLLED; - cmd[1] = enable; - err = pulse8_send_and_wait(pulse8, cmd, 2, - MSGCODE_COMMAND_ACCEPTED, 1); - if (!enable) { - pulse8->rx_msg_num = 0; - pulse8->tx_done_status = 0; - } - mutex_unlock(&pulse8->lock); - return enable ? err : 0; -} - -static int pulse8_cec_adap_log_addr(struct cec_adapter *adap, u8 log_addr) -{ - struct pulse8 *pulse8 = cec_get_drvdata(adap); - u16 mask = 0; - u16 pa = adap->phys_addr; - u8 cmd[16]; - int err = 0; - - mutex_lock(&pulse8->lock); - if (log_addr != CEC_LOG_ADDR_INVALID) - mask = 1 << log_addr; - cmd[0] = MSGCODE_SET_ACK_MASK; - cmd[1] = mask >> 8; - cmd[2] = mask & 0xff; - err = pulse8_send_and_wait(pulse8, cmd, 3, - MSGCODE_COMMAND_ACCEPTED, 0); - if ((err && mask != 0) || pulse8->restoring_config) - goto unlock; - - cmd[0] = MSGCODE_SET_AUTO_ENABLED; - cmd[1] = log_addr == CEC_LOG_ADDR_INVALID ? 0 : 1; - err = pulse8_send_and_wait(pulse8, cmd, 2, - MSGCODE_COMMAND_ACCEPTED, 0); - if (err) - goto unlock; - pulse8->autonomous = cmd[1]; - if (log_addr == CEC_LOG_ADDR_INVALID) - goto unlock; - - cmd[0] = MSGCODE_SET_DEVICE_TYPE; - cmd[1] = adap->log_addrs.primary_device_type[0]; - err = pulse8_send_and_wait(pulse8, cmd, 2, - MSGCODE_COMMAND_ACCEPTED, 0); - if (err) - goto unlock; - - switch (adap->log_addrs.primary_device_type[0]) { - case CEC_OP_PRIM_DEVTYPE_TV: - mask = CEC_LOG_ADDR_MASK_TV; - break; - case CEC_OP_PRIM_DEVTYPE_RECORD: - mask = CEC_LOG_ADDR_MASK_RECORD; - break; - case CEC_OP_PRIM_DEVTYPE_TUNER: - mask = CEC_LOG_ADDR_MASK_TUNER; - break; - case CEC_OP_PRIM_DEVTYPE_PLAYBACK: - mask = CEC_LOG_ADDR_MASK_PLAYBACK; - break; - case CEC_OP_PRIM_DEVTYPE_AUDIOSYSTEM: - mask = CEC_LOG_ADDR_MASK_AUDIOSYSTEM; - break; - case CEC_OP_PRIM_DEVTYPE_SWITCH: - mask = CEC_LOG_ADDR_MASK_UNREGISTERED; - break; - case CEC_OP_PRIM_DEVTYPE_PROCESSOR: - mask = CEC_LOG_ADDR_MASK_SPECIFIC; - break; - default: - mask = 0; - break; - } - cmd[0] = MSGCODE_SET_LOGICAL_ADDRESS_MASK; - cmd[1] = mask >> 8; - cmd[2] = mask & 0xff; - err = pulse8_send_and_wait(pulse8, cmd, 3, - MSGCODE_COMMAND_ACCEPTED, 0); - if (err) - goto unlock; - - cmd[0] = MSGCODE_SET_DEFAULT_LOGICAL_ADDRESS; - cmd[1] = log_addr; - err = pulse8_send_and_wait(pulse8, cmd, 2, - MSGCODE_COMMAND_ACCEPTED, 0); - if (err) - goto unlock; - - cmd[0] = MSGCODE_SET_PHYSICAL_ADDRESS; - cmd[1] = pa >> 8; - cmd[2] = pa & 0xff; - err = pulse8_send_and_wait(pulse8, cmd, 3, - MSGCODE_COMMAND_ACCEPTED, 0); - if (err) - goto unlock; - - cmd[0] = MSGCODE_SET_HDMI_VERSION; - cmd[1] = adap->log_addrs.cec_version; - err = pulse8_send_and_wait(pulse8, cmd, 2, - MSGCODE_COMMAND_ACCEPTED, 0); - if (err) - goto unlock; - - if (adap->log_addrs.osd_name[0]) { - size_t osd_len = strlen(adap->log_addrs.osd_name); - char *osd_str = cmd + 1; - - cmd[0] = MSGCODE_SET_OSD_NAME; - strscpy(cmd + 1, adap->log_addrs.osd_name, sizeof(cmd) - 1); - if (osd_len < 4) { - memset(osd_str + osd_len, ' ', 4 - osd_len); - osd_len = 4; - osd_str[osd_len] = '\0'; - strscpy(adap->log_addrs.osd_name, osd_str, - sizeof(adap->log_addrs.osd_name)); - } - err = pulse8_send_and_wait(pulse8, cmd, 1 + osd_len, - MSGCODE_COMMAND_ACCEPTED, 0); - if (err) - goto unlock; - } - -unlock: - if (pulse8->restoring_config) - pulse8->restoring_config = false; - else - pulse8->config_pending = true; - mutex_unlock(&pulse8->lock); - return log_addr == CEC_LOG_ADDR_INVALID ? 0 : err; -} - -static int pulse8_cec_adap_transmit(struct cec_adapter *adap, u8 attempts, - u32 signal_free_time, struct cec_msg *msg) -{ - struct pulse8 *pulse8 = cec_get_drvdata(adap); - - pulse8->tx_msg = *msg; - if (debug) - dev_info(pulse8->dev, "adap transmit %*ph\n", - msg->len, msg->msg); - pulse8->tx_signal_free_time = signal_free_time; - schedule_work(&pulse8->tx_work); - return 0; -} - -static void pulse8_cec_adap_free(struct cec_adapter *adap) -{ - struct pulse8 *pulse8 = cec_get_drvdata(adap); - - cancel_delayed_work_sync(&pulse8->ping_eeprom_work); - cancel_work_sync(&pulse8->irq_work); - cancel_work_sync(&pulse8->tx_work); - kfree(pulse8); -} - -static const struct cec_adap_ops pulse8_cec_adap_ops = { - .adap_enable = pulse8_cec_adap_enable, - .adap_log_addr = pulse8_cec_adap_log_addr, - .adap_transmit = pulse8_cec_adap_transmit, - .adap_free = pulse8_cec_adap_free, -}; - -static void pulse8_disconnect(struct serio *serio) -{ - struct pulse8 *pulse8 = serio_get_drvdata(serio); - - cec_unregister_adapter(pulse8->adap); - pulse8->serio = NULL; - serio_set_drvdata(serio, NULL); - serio_close(serio); -} - -static int pulse8_setup(struct pulse8 *pulse8, struct serio *serio, - struct cec_log_addrs *log_addrs, u16 *pa) -{ - u8 *data = pulse8->data + 1; - u8 cmd[2]; - int err; - time64_t date; - - pulse8->vers = 0; - - cmd[0] = MSGCODE_FIRMWARE_VERSION; - err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 2); - if (err) - return err; - pulse8->vers = (data[0] << 8) | data[1]; - dev_info(pulse8->dev, "Firmware version %04x\n", pulse8->vers); - if (pulse8->vers < 2) { - *pa = CEC_PHYS_ADDR_INVALID; - return 0; - } - - cmd[0] = MSGCODE_GET_BUILDDATE; - err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 4); - if (err) - return err; - date = (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]; - dev_info(pulse8->dev, "Firmware build date %ptT\n", &date); - - dev_dbg(pulse8->dev, "Persistent config:\n"); - cmd[0] = MSGCODE_GET_AUTO_ENABLED; - err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 1); - if (err) - return err; - pulse8->autonomous = data[0]; - dev_dbg(pulse8->dev, "Autonomous mode: %s", - data[0] ? "on" : "off"); - - cmd[0] = MSGCODE_GET_DEVICE_TYPE; - err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 1); - if (err) - return err; - log_addrs->primary_device_type[0] = data[0]; - dev_dbg(pulse8->dev, "Primary device type: %d\n", data[0]); - switch (log_addrs->primary_device_type[0]) { - case CEC_OP_PRIM_DEVTYPE_TV: - log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_TV; - log_addrs->all_device_types[0] = CEC_OP_ALL_DEVTYPE_TV; - break; - case CEC_OP_PRIM_DEVTYPE_RECORD: - log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_RECORD; - log_addrs->all_device_types[0] = CEC_OP_ALL_DEVTYPE_RECORD; - break; - case CEC_OP_PRIM_DEVTYPE_TUNER: - log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_TUNER; - log_addrs->all_device_types[0] = CEC_OP_ALL_DEVTYPE_TUNER; - break; - case CEC_OP_PRIM_DEVTYPE_PLAYBACK: - log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_PLAYBACK; - log_addrs->all_device_types[0] = CEC_OP_ALL_DEVTYPE_PLAYBACK; - break; - case CEC_OP_PRIM_DEVTYPE_AUDIOSYSTEM: - log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_PLAYBACK; - log_addrs->all_device_types[0] = CEC_OP_ALL_DEVTYPE_AUDIOSYSTEM; - break; - case CEC_OP_PRIM_DEVTYPE_SWITCH: - log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_UNREGISTERED; - log_addrs->all_device_types[0] = CEC_OP_ALL_DEVTYPE_SWITCH; - break; - case CEC_OP_PRIM_DEVTYPE_PROCESSOR: - log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_SPECIFIC; - log_addrs->all_device_types[0] = CEC_OP_ALL_DEVTYPE_SWITCH; - break; - default: - log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_UNREGISTERED; - log_addrs->all_device_types[0] = CEC_OP_ALL_DEVTYPE_SWITCH; - dev_info(pulse8->dev, "Unknown Primary Device Type: %d\n", - log_addrs->primary_device_type[0]); - break; - } - - cmd[0] = MSGCODE_GET_LOGICAL_ADDRESS_MASK; - err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 2); - if (err) - return err; - log_addrs->log_addr_mask = (data[0] << 8) | data[1]; - dev_dbg(pulse8->dev, "Logical address ACK mask: %x\n", - log_addrs->log_addr_mask); - if (log_addrs->log_addr_mask) - log_addrs->num_log_addrs = 1; - - cmd[0] = MSGCODE_GET_PHYSICAL_ADDRESS; - err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 1); - if (err) - return err; - *pa = (data[0] << 8) | data[1]; - dev_dbg(pulse8->dev, "Physical address: %x.%x.%x.%x\n", - cec_phys_addr_exp(*pa)); - - cmd[0] = MSGCODE_GET_HDMI_VERSION; - err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 1); - if (err) - return err; - log_addrs->cec_version = data[0]; - dev_dbg(pulse8->dev, "CEC version: %d\n", log_addrs->cec_version); - - cmd[0] = MSGCODE_GET_OSD_NAME; - err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 0); - if (err) - return err; - strscpy(log_addrs->osd_name, data, sizeof(log_addrs->osd_name)); - dev_dbg(pulse8->dev, "OSD name: %s\n", log_addrs->osd_name); - - return 0; -} - -static int pulse8_apply_persistent_config(struct pulse8 *pulse8, - struct cec_log_addrs *log_addrs, - u16 pa) -{ - int err; - - err = cec_s_log_addrs(pulse8->adap, log_addrs, false); - if (err) - return err; - - cec_s_phys_addr(pulse8->adap, pa, false); - - return 0; -} - -static void pulse8_ping_eeprom_work_handler(struct work_struct *work) -{ - struct pulse8 *pulse8 = - container_of(work, struct pulse8, ping_eeprom_work.work); - u8 cmd; - - mutex_lock(&pulse8->lock); - cmd = MSGCODE_PING; - pulse8_send_and_wait(pulse8, &cmd, 1, - MSGCODE_COMMAND_ACCEPTED, 0); - - if (pulse8->vers < 2) - goto unlock; - - if (pulse8->config_pending && persistent_config) { - dev_dbg(pulse8->dev, "writing pending config to EEPROM\n"); - cmd = MSGCODE_WRITE_EEPROM; - if (pulse8_send_and_wait(pulse8, &cmd, 1, - MSGCODE_COMMAND_ACCEPTED, 0)) - dev_info(pulse8->dev, "failed to write pending config to EEPROM\n"); - else - pulse8->config_pending = false; - } -unlock: - schedule_delayed_work(&pulse8->ping_eeprom_work, PING_PERIOD); - mutex_unlock(&pulse8->lock); -} - -static int pulse8_connect(struct serio *serio, struct serio_driver *drv) -{ - u32 caps = CEC_CAP_DEFAULTS | CEC_CAP_PHYS_ADDR | CEC_CAP_MONITOR_ALL; - struct pulse8 *pulse8; - int err = -ENOMEM; - struct cec_log_addrs log_addrs = {}; - u16 pa = CEC_PHYS_ADDR_INVALID; - - pulse8 = kzalloc(sizeof(*pulse8), GFP_KERNEL); - - if (!pulse8) - return -ENOMEM; - - pulse8->serio = serio; - pulse8->adap = cec_allocate_adapter(&pulse8_cec_adap_ops, pulse8, - dev_name(&serio->dev), caps, 1); - err = PTR_ERR_OR_ZERO(pulse8->adap); - if (err < 0) - goto free_device; - - pulse8->dev = &serio->dev; - serio_set_drvdata(serio, pulse8); - INIT_WORK(&pulse8->irq_work, pulse8_irq_work_handler); - INIT_WORK(&pulse8->tx_work, pulse8_tx_work_handler); - INIT_DELAYED_WORK(&pulse8->ping_eeprom_work, - pulse8_ping_eeprom_work_handler); - mutex_init(&pulse8->lock); - spin_lock_init(&pulse8->msg_lock); - pulse8->config_pending = false; - - err = serio_open(serio, drv); - if (err) - goto delete_adap; - - err = pulse8_setup(pulse8, serio, &log_addrs, &pa); - if (err) - goto close_serio; - - err = cec_register_adapter(pulse8->adap, &serio->dev); - if (err < 0) - goto close_serio; - - pulse8->dev = &pulse8->adap->devnode.dev; - - if (persistent_config && pulse8->autonomous) { - err = pulse8_apply_persistent_config(pulse8, &log_addrs, pa); - if (err) - goto close_serio; - pulse8->restoring_config = true; - } - - schedule_delayed_work(&pulse8->ping_eeprom_work, PING_PERIOD); - - return 0; - -close_serio: - pulse8->serio = NULL; - serio_set_drvdata(serio, NULL); - serio_close(serio); -delete_adap: - cec_delete_adapter(pulse8->adap); -free_device: - kfree(pulse8); - return err; -} - -static const struct serio_device_id pulse8_serio_ids[] = { - { - .type = SERIO_RS232, - .proto = SERIO_PULSE8_CEC, - .id = SERIO_ANY, - .extra = SERIO_ANY, - }, - { 0 } -}; - -MODULE_DEVICE_TABLE(serio, pulse8_serio_ids); - -static struct serio_driver pulse8_drv = { - .driver = { - .name = "pulse8-cec", - }, - .description = "Pulse Eight HDMI CEC driver", - .id_table = pulse8_serio_ids, - .interrupt = pulse8_interrupt, - .connect = pulse8_connect, - .disconnect = pulse8_disconnect, -}; - -module_serio_driver(pulse8_drv); diff --git a/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c index 275394bafe7d..63db04fe12d3 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c @@ -564,7 +564,7 @@ static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw) strscpy(info.type, "ir_video", I2C_NAME_SIZE); pvr2_trace(PVR2_TRACE_INFO, "Binding %s to i2c address 0x%02x.", info.type, info.addr); - i2c_new_device(&hdw->i2c_adap, &info); + i2c_new_client_device(&hdw->i2c_adap, &info); break; case PVR2_IR_SCHEME_ZILOG: /* HVR-1950 style */ case PVR2_IR_SCHEME_24XXX_MCE: /* 24xxx MCE device */ @@ -579,7 +579,7 @@ static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw) strscpy(info.type, "ir_z8f0811_haup", I2C_NAME_SIZE); pvr2_trace(PVR2_TRACE_INFO, "Binding %s to i2c address 0x%02x.", info.type, info.addr); - i2c_new_device(&hdw->i2c_adap, &info); + i2c_new_client_device(&hdw->i2c_adap, &info); break; default: /* The device either doesn't support I2C-based IR or we diff --git a/drivers/media/usb/pwc/pwc-ctrl.c b/drivers/media/usb/pwc/pwc-ctrl.c index 315c55927f5c..cff64d872058 100644 --- a/drivers/media/usb/pwc/pwc-ctrl.c +++ b/drivers/media/usb/pwc/pwc-ctrl.c @@ -523,7 +523,7 @@ int pwc_set_leds(struct pwc_device *pdev, int on_value, int off_value) #ifdef CONFIG_USB_PWC_DEBUG int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor) { - int ret = -1, request; + int ret, request; if (pdev->type < 675) request = SENSOR_TYPE_FORMATTER1; diff --git a/drivers/media/usb/pwc/pwc-if.c b/drivers/media/usb/pwc/pwc-if.c index d57b8b786506..61869636ec61 100644 --- a/drivers/media/usb/pwc/pwc-if.c +++ b/drivers/media/usb/pwc/pwc-if.c @@ -71,37 +71,45 @@ /* hotplug device table support */ static const struct usb_device_id pwc_device_table [] = { - { USB_DEVICE(0x0471, 0x0302) }, /* Philips models */ - { USB_DEVICE(0x0471, 0x0303) }, - { USB_DEVICE(0x0471, 0x0304) }, - { USB_DEVICE(0x0471, 0x0307) }, - { USB_DEVICE(0x0471, 0x0308) }, - { USB_DEVICE(0x0471, 0x030C) }, - { USB_DEVICE(0x0471, 0x0310) }, - { USB_DEVICE(0x0471, 0x0311) }, /* Philips ToUcam PRO II */ - { USB_DEVICE(0x0471, 0x0312) }, - { USB_DEVICE(0x0471, 0x0313) }, /* the 'new' 720K */ - { USB_DEVICE(0x0471, 0x0329) }, /* Philips SPC 900NC PC Camera */ - { USB_DEVICE(0x0471, 0x032C) }, /* Philips SPC 880NC PC Camera */ - { USB_DEVICE(0x069A, 0x0001) }, /* Askey */ - { USB_DEVICE(0x046D, 0x08B0) }, /* Logitech QuickCam Pro 3000 */ + { USB_DEVICE(0x041E, 0x400C) }, /* Creative Webcam 5 */ + { USB_DEVICE(0x041E, 0x4011) }, /* Creative Webcam Pro Ex */ + + { USB_DEVICE(0x046D, 0x08B0) }, /* Logitech QuickCam 3000 Pro */ { USB_DEVICE(0x046D, 0x08B1) }, /* Logitech QuickCam Notebook Pro */ - { USB_DEVICE(0x046D, 0x08B2) }, /* Logitech QuickCam Pro 4000 */ + { USB_DEVICE(0x046D, 0x08B2) }, /* Logitech QuickCam 4000 Pro */ { USB_DEVICE(0x046D, 0x08B3) }, /* Logitech QuickCam Zoom (old model) */ { USB_DEVICE(0x046D, 0x08B4) }, /* Logitech QuickCam Zoom (new model) */ { USB_DEVICE(0x046D, 0x08B5) }, /* Logitech QuickCam Orbit/Sphere */ - { USB_DEVICE(0x046D, 0x08B6) }, /* Cisco VT Camera */ + { USB_DEVICE(0x046D, 0x08B6) }, /* Logitech/Cisco VT Camera */ { USB_DEVICE(0x046D, 0x08B7) }, /* Logitech ViewPort AV 100 */ - { USB_DEVICE(0x046D, 0x08B8) }, /* Logitech (reserved) */ + { USB_DEVICE(0x046D, 0x08B8) }, /* Logitech QuickCam */ + + { USB_DEVICE(0x0471, 0x0302) }, /* Philips PCA645VC */ + { USB_DEVICE(0x0471, 0x0303) }, /* Philips PCA646VC */ + { USB_DEVICE(0x0471, 0x0304) }, /* Askey VC010 type 2 */ + { USB_DEVICE(0x0471, 0x0307) }, /* Philips PCVC675K (Vesta) */ + { USB_DEVICE(0x0471, 0x0308) }, /* Philips PCVC680K (Vesta Pro) */ + { USB_DEVICE(0x0471, 0x030C) }, /* Philips PCVC690K (Vesta Pro Scan) */ + { USB_DEVICE(0x0471, 0x0310) }, /* Philips PCVC730K (ToUCam Fun)/PCVC830 (ToUCam II) */ + { USB_DEVICE(0x0471, 0x0311) }, /* Philips PCVC740K (ToUCam Pro)/PCVC840 (ToUCam II) */ + { USB_DEVICE(0x0471, 0x0312) }, /* Philips PCVC750K (ToUCam Pro Scan) */ + { USB_DEVICE(0x0471, 0x0313) }, /* Philips PCVC720K/40 (ToUCam XS) */ + { USB_DEVICE(0x0471, 0x0329) }, /* Philips SPC 900NC webcam */ + { USB_DEVICE(0x0471, 0x032C) }, /* Philips SPC 880NC webcam */ + + { USB_DEVICE(0x04CC, 0x8116) }, /* Sotec Afina Eye */ + { USB_DEVICE(0x055D, 0x9000) }, /* Samsung MPC-C10 */ { USB_DEVICE(0x055D, 0x9001) }, /* Samsung MPC-C30 */ { USB_DEVICE(0x055D, 0x9002) }, /* Samsung SNC-35E (Ver3.0) */ - { USB_DEVICE(0x041E, 0x400C) }, /* Creative Webcam 5 */ - { USB_DEVICE(0x041E, 0x4011) }, /* Creative Webcam Pro Ex */ - { USB_DEVICE(0x04CC, 0x8116) }, /* Afina Eye */ - { USB_DEVICE(0x06BE, 0x8116) }, /* new Afina Eye */ - { USB_DEVICE(0x0d81, 0x1910) }, /* Visionite */ - { USB_DEVICE(0x0d81, 0x1900) }, + + { USB_DEVICE(0x069A, 0x0001) }, /* Askey VC010 type 1 */ + + { USB_DEVICE(0x06BE, 0x8116) }, /* AME Co. Afina Eye */ + + { USB_DEVICE(0x0d81, 0x1900) }, /* Visionite VCS-UC300 */ + { USB_DEVICE(0x0d81, 0x1910) }, /* Visionite VCS-UM100 */ + { } }; MODULE_DEVICE_TABLE(usb, pwc_device_table); diff --git a/drivers/media/usb/rainshadow-cec/Kconfig b/drivers/media/usb/rainshadow-cec/Kconfig deleted file mode 100644 index b481c5157d7e..000000000000 --- a/drivers/media/usb/rainshadow-cec/Kconfig +++ /dev/null @@ -1,12 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -config USB_RAINSHADOW_CEC - tristate "RainShadow Tech HDMI CEC" - depends on USB_ACM - select CEC_CORE - select SERIO - select SERIO_SERPORT - help - This is a cec driver for the RainShadow Tech HDMI CEC device. - - To compile this driver as a module, choose M here: the - module will be called rainshadow-cec. diff --git a/drivers/media/usb/rainshadow-cec/Makefile b/drivers/media/usb/rainshadow-cec/Makefile deleted file mode 100644 index 47b33c574c3e..000000000000 --- a/drivers/media/usb/rainshadow-cec/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -obj-$(CONFIG_USB_RAINSHADOW_CEC) += rainshadow-cec.o diff --git a/drivers/media/usb/rainshadow-cec/rainshadow-cec.c b/drivers/media/usb/rainshadow-cec/rainshadow-cec.c deleted file mode 100644 index ee870ea1a886..000000000000 --- a/drivers/media/usb/rainshadow-cec/rainshadow-cec.c +++ /dev/null @@ -1,380 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * RainShadow Tech HDMI CEC driver - * - * Copyright 2016 Hans Verkuil <hverkuil@xs4all.nl - */ - -/* - * Notes: - * - * The higher level protocols are currently disabled. This can be added - * later, similar to how this is done for the Pulse Eight CEC driver. - * - * Documentation of the protocol is available here: - * - * http://rainshadowtech.com/doc/HDMICECtoUSBandRS232v2.0.pdf - */ - -#include <linux/completion.h> -#include <linux/ctype.h> -#include <linux/delay.h> -#include <linux/init.h> -#include <linux/interrupt.h> -#include <linux/kernel.h> -#include <linux/module.h> -#include <linux/serio.h> -#include <linux/slab.h> -#include <linux/spinlock.h> -#include <linux/time.h> -#include <linux/workqueue.h> - -#include <media/cec.h> - -MODULE_AUTHOR("Hans Verkuil <hverkuil@xs4all.nl>"); -MODULE_DESCRIPTION("RainShadow Tech HDMI CEC driver"); -MODULE_LICENSE("GPL"); - -#define DATA_SIZE 256 - -struct rain { - struct device *dev; - struct serio *serio; - struct cec_adapter *adap; - struct completion cmd_done; - struct work_struct work; - - /* Low-level ringbuffer, collecting incoming characters */ - char buf[DATA_SIZE]; - unsigned int buf_rd_idx; - unsigned int buf_wr_idx; - unsigned int buf_len; - spinlock_t buf_lock; - - /* command buffer */ - char cmd[DATA_SIZE]; - unsigned int cmd_idx; - bool cmd_started; - - /* reply to a command, only used to store the firmware version */ - char cmd_reply[DATA_SIZE]; - - struct mutex write_lock; -}; - -static void rain_process_msg(struct rain *rain) -{ - struct cec_msg msg = {}; - const char *cmd = rain->cmd + 3; - int stat = -1; - - for (; *cmd; cmd++) { - if (!isxdigit(*cmd)) - continue; - if (isxdigit(cmd[0]) && isxdigit(cmd[1])) { - if (msg.len == CEC_MAX_MSG_SIZE) - break; - if (hex2bin(msg.msg + msg.len, cmd, 1)) - continue; - msg.len++; - cmd++; - continue; - } - if (!cmd[1]) - stat = hex_to_bin(cmd[0]); - break; - } - - if (rain->cmd[0] == 'R') { - if (stat == 1 || stat == 2) - cec_received_msg(rain->adap, &msg); - return; - } - - switch (stat) { - case 1: - cec_transmit_attempt_done(rain->adap, CEC_TX_STATUS_OK); - break; - case 2: - cec_transmit_attempt_done(rain->adap, CEC_TX_STATUS_NACK); - break; - default: - cec_transmit_attempt_done(rain->adap, CEC_TX_STATUS_LOW_DRIVE); - break; - } -} - -static void rain_irq_work_handler(struct work_struct *work) -{ - struct rain *rain = - container_of(work, struct rain, work); - - while (true) { - unsigned long flags; - char data; - - spin_lock_irqsave(&rain->buf_lock, flags); - if (!rain->buf_len) { - spin_unlock_irqrestore(&rain->buf_lock, flags); - break; - } - - data = rain->buf[rain->buf_rd_idx]; - rain->buf_len--; - rain->buf_rd_idx = (rain->buf_rd_idx + 1) & 0xff; - - spin_unlock_irqrestore(&rain->buf_lock, flags); - - if (!rain->cmd_started && data != '?') - continue; - - switch (data) { - case '\r': - rain->cmd[rain->cmd_idx] = '\0'; - dev_dbg(rain->dev, "received: %s\n", rain->cmd); - if (!memcmp(rain->cmd, "REC", 3) || - !memcmp(rain->cmd, "STA", 3)) { - rain_process_msg(rain); - } else { - strscpy(rain->cmd_reply, rain->cmd, - sizeof(rain->cmd_reply)); - complete(&rain->cmd_done); - } - rain->cmd_idx = 0; - rain->cmd_started = false; - break; - - case '\n': - rain->cmd_idx = 0; - rain->cmd_started = false; - break; - - case '?': - rain->cmd_idx = 0; - rain->cmd_started = true; - break; - - default: - if (rain->cmd_idx >= DATA_SIZE - 1) { - dev_dbg(rain->dev, - "throwing away %d bytes of garbage\n", rain->cmd_idx); - rain->cmd_idx = 0; - } - rain->cmd[rain->cmd_idx++] = data; - break; - } - } -} - -static irqreturn_t rain_interrupt(struct serio *serio, unsigned char data, - unsigned int flags) -{ - struct rain *rain = serio_get_drvdata(serio); - - if (rain->buf_len == DATA_SIZE) { - dev_warn_once(rain->dev, "buffer overflow\n"); - return IRQ_HANDLED; - } - spin_lock(&rain->buf_lock); - rain->buf_len++; - rain->buf[rain->buf_wr_idx] = data; - rain->buf_wr_idx = (rain->buf_wr_idx + 1) & 0xff; - spin_unlock(&rain->buf_lock); - schedule_work(&rain->work); - return IRQ_HANDLED; -} - -static void rain_disconnect(struct serio *serio) -{ - struct rain *rain = serio_get_drvdata(serio); - - cancel_work_sync(&rain->work); - cec_unregister_adapter(rain->adap); - dev_info(&serio->dev, "disconnected\n"); - serio_close(serio); - serio_set_drvdata(serio, NULL); - kfree(rain); -} - -static int rain_send(struct rain *rain, const char *command) -{ - int err = serio_write(rain->serio, '!'); - - dev_dbg(rain->dev, "send: %s\n", command); - while (!err && *command) - err = serio_write(rain->serio, *command++); - if (!err) - err = serio_write(rain->serio, '~'); - - return err; -} - -static int rain_send_and_wait(struct rain *rain, - const char *cmd, const char *reply) -{ - int err; - - init_completion(&rain->cmd_done); - - mutex_lock(&rain->write_lock); - err = rain_send(rain, cmd); - if (err) - goto err; - - if (!wait_for_completion_timeout(&rain->cmd_done, HZ)) { - err = -ETIMEDOUT; - goto err; - } - if (reply && strncmp(rain->cmd_reply, reply, strlen(reply))) { - dev_dbg(rain->dev, - "transmit of '%s': received '%s' instead of '%s'\n", - cmd, rain->cmd_reply, reply); - err = -EIO; - } -err: - mutex_unlock(&rain->write_lock); - return err; -} - -static int rain_setup(struct rain *rain, struct serio *serio, - struct cec_log_addrs *log_addrs, u16 *pa) -{ - int err; - - err = rain_send_and_wait(rain, "R", "REV"); - if (err) - return err; - dev_info(rain->dev, "Firmware version %s\n", rain->cmd_reply + 4); - - err = rain_send_and_wait(rain, "Q 1", "QTY"); - if (err) - return err; - err = rain_send_and_wait(rain, "c0000", "CFG"); - if (err) - return err; - return rain_send_and_wait(rain, "A F 0000", "ADR"); -} - -static int rain_cec_adap_enable(struct cec_adapter *adap, bool enable) -{ - return 0; -} - -static int rain_cec_adap_log_addr(struct cec_adapter *adap, u8 log_addr) -{ - struct rain *rain = cec_get_drvdata(adap); - u8 cmd[16]; - - if (log_addr == CEC_LOG_ADDR_INVALID) - log_addr = CEC_LOG_ADDR_UNREGISTERED; - snprintf(cmd, sizeof(cmd), "A %x", log_addr); - return rain_send_and_wait(rain, cmd, "ADR"); -} - -static int rain_cec_adap_transmit(struct cec_adapter *adap, u8 attempts, - u32 signal_free_time, struct cec_msg *msg) -{ - struct rain *rain = cec_get_drvdata(adap); - char cmd[2 * CEC_MAX_MSG_SIZE + 16]; - unsigned int i; - int err; - - if (msg->len == 1) { - snprintf(cmd, sizeof(cmd), "x%x", cec_msg_destination(msg)); - } else { - char hex[3]; - - snprintf(cmd, sizeof(cmd), "x%x %02x ", - cec_msg_destination(msg), msg->msg[1]); - for (i = 2; i < msg->len; i++) { - snprintf(hex, sizeof(hex), "%02x", msg->msg[i]); - strlcat(cmd, hex, sizeof(cmd)); - } - } - mutex_lock(&rain->write_lock); - err = rain_send(rain, cmd); - mutex_unlock(&rain->write_lock); - return err; -} - -static const struct cec_adap_ops rain_cec_adap_ops = { - .adap_enable = rain_cec_adap_enable, - .adap_log_addr = rain_cec_adap_log_addr, - .adap_transmit = rain_cec_adap_transmit, -}; - -static int rain_connect(struct serio *serio, struct serio_driver *drv) -{ - u32 caps = CEC_CAP_DEFAULTS | CEC_CAP_PHYS_ADDR | CEC_CAP_MONITOR_ALL; - struct rain *rain; - int err = -ENOMEM; - struct cec_log_addrs log_addrs = {}; - u16 pa = CEC_PHYS_ADDR_INVALID; - - rain = kzalloc(sizeof(*rain), GFP_KERNEL); - - if (!rain) - return -ENOMEM; - - rain->serio = serio; - rain->adap = cec_allocate_adapter(&rain_cec_adap_ops, rain, - dev_name(&serio->dev), caps, 1); - err = PTR_ERR_OR_ZERO(rain->adap); - if (err < 0) - goto free_device; - - rain->dev = &serio->dev; - serio_set_drvdata(serio, rain); - INIT_WORK(&rain->work, rain_irq_work_handler); - mutex_init(&rain->write_lock); - spin_lock_init(&rain->buf_lock); - - err = serio_open(serio, drv); - if (err) - goto delete_adap; - - err = rain_setup(rain, serio, &log_addrs, &pa); - if (err) - goto close_serio; - - err = cec_register_adapter(rain->adap, &serio->dev); - if (err < 0) - goto close_serio; - - rain->dev = &rain->adap->devnode.dev; - return 0; - -close_serio: - serio_close(serio); -delete_adap: - cec_delete_adapter(rain->adap); - serio_set_drvdata(serio, NULL); -free_device: - kfree(rain); - return err; -} - -static const struct serio_device_id rain_serio_ids[] = { - { - .type = SERIO_RS232, - .proto = SERIO_RAINSHADOW_CEC, - .id = SERIO_ANY, - .extra = SERIO_ANY, - }, - { 0 } -}; - -MODULE_DEVICE_TABLE(serio, rain_serio_ids); - -static struct serio_driver rain_drv = { - .driver = { - .name = "rainshadow-cec", - }, - .description = "RainShadow Tech HDMI CEC driver", - .id_table = rain_serio_ids, - .interrupt = rain_interrupt, - .connect = rain_connect, - .disconnect = rain_disconnect, -}; - -module_serio_driver(rain_drv); diff --git a/drivers/media/usb/ttusb-dec/ttusb_dec.c b/drivers/media/usb/ttusb-dec/ttusb_dec.c index 3198f9624b7c..b8d39b2f777f 100644 --- a/drivers/media/usb/ttusb-dec/ttusb_dec.c +++ b/drivers/media/usb/ttusb-dec/ttusb_dec.c @@ -250,6 +250,7 @@ static void ttusb_dec_handle_irq( struct urb *urb) struct ttusb_dec *dec = urb->context; char *buffer = dec->irq_buffer; int retval; + int index = buffer[4]; switch(urb->status) { case 0: /*success*/ @@ -281,11 +282,11 @@ static void ttusb_dec_handle_irq( struct urb *urb) * this should/could be added later ... * for now lets report each signal as a key down and up */ - if (buffer[4] - 1 < ARRAY_SIZE(rc_keys)) { - dprintk("%s:rc signal:%d\n", __func__, buffer[4]); - input_report_key(dec->rc_input_dev, rc_keys[buffer[4] - 1], 1); + if (index - 1 < ARRAY_SIZE(rc_keys)) { + dprintk("%s:rc signal:%d\n", __func__, index); + input_report_key(dec->rc_input_dev, rc_keys[index - 1], 1); input_sync(dec->rc_input_dev); - input_report_key(dec->rc_input_dev, rc_keys[buffer[4] - 1], 0); + input_report_key(dec->rc_input_dev, rc_keys[index - 1], 0); input_sync(dec->rc_input_dev); } } diff --git a/drivers/media/usb/zr364xx/Kconfig b/drivers/media/usb/zr364xx/Kconfig index 55b06c833667..49b4257487bb 100644 --- a/drivers/media/usb/zr364xx/Kconfig +++ b/drivers/media/usb/zr364xx/Kconfig @@ -7,7 +7,7 @@ config USB_ZR364XX help Say Y here if you want to connect this type of camera to your computer's USB port. - See <file:Documentation/media/v4l-drivers/zr364xx.rst> for more info + See <file:Documentation/admin-guide/media/zr364xx.rst> for more info and list of supported cameras. To compile this driver as a module, choose M here: the |