1. 05 May, 2020 10 commits
    • Bingbu Cao's avatar
      media: ipu3.rst: add explanation for running mode · 11de96b9
      Bingbu Cao authored
      Add some explanation of the ImgU running mode and add more information
      about firmware selection and running mode usage.
      Signed-off-by: default avatarBingbu Cao <bingbu.cao@intel.com>
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      11de96b9
    • Tomasz Figa's avatar
      media: staging: ipu3: Fix stale list entries on parameter queue failure · 735a02f1
      Tomasz Figa authored
      When queuing parameters fails, current code bails out without deleting
      the corresponding vb2 buffer from the driver buffer list, but the buffer
      is returned to vb2. This leads to stale list entries and a crash when
      the driver stops streaming:
      
      [  224.935561] ipu3-imgu 0000:00:05.0: set parameters failed.
      [  224.998932] ipu3-imgu 0000:00:05.0: set parameters failed.
      [  225.064430] ipu3-imgu 0000:00:05.0: set parameters failed.
      [  225.128534] ipu3-imgu 0000:00:05.0: set parameters failed.
      [  225.194945] ipu3-imgu 0000:00:05.0: set parameters failed.
      [  225.360363] ------------[ cut here ]------------
      [  225.360372] WARNING: CPU: 0 PID: 6704 at
      drivers/media/common/videobuf2/videobuf2-core.c:927
      vb2_buffer_done+0x20f/0x21a [videobuf2_common]
      [  225.360374] Modules linked in: snd_seq_dummy snd_seq snd_seq_device
      veth bridge stp llc tun nf_nat_tftp nf_conntrack_tftp nf_nat_ftp
      nf_conntrack_ftp esp6 ah6 ip6t_REJECT ip6t_ipv6header cmac rfcomm uinput
      ipu3_imgu(C) ipu3_cio2 iova videobuf2_v4l2 videobuf2_common
      videobuf2_dma_sg videobuf2_memops ov13858 ov5670 v4l2_fwnode dw9714
      acpi_als xt_MASQUERADE fuse iio_trig_sysfs cros_ec_sensors_ring
      cros_ec_light_prox cros_ec_sensors cros_ec_sensors_core
      industrialio_triggered_buffer kfifo_buf industrialio
      cros_ec_sensorsupport cdc_ether btusb btrtl btintel btbcm usbnet
      bluetooth ecdh_generic ecc hid_google_hammer iwlmvm iwl7000_mac80211
      r8152 mii lzo_rle lzo_compress iwlwifi zram cfg80211 joydev
      [  225.360400] CPU: 0 PID: 6704 Comm: CameraDeviceOps Tainted: G
      C        5.4.30 #5
      [  225.360402] Hardware name: HP Soraka/Soraka, BIOS
      Google_Soraka.10431.106.0 12/03/2019
      [  225.360405] RIP: 0010:vb2_buffer_done+0x20f/0x21a [videobuf2_common]
      [  225.360408] Code: 5e 41 5f 5d e9 e0 16 5a d4 41 8b 55 08 48 c7 c7 8f
      8b 5c c0 48 c7 c6 36 9a 5c c0 44 89 f9 31 c0 e8 a5 1c 5b d4 e9 53 fe ff
      ff <0f> 0b eb a3 e8 12 d7 43 d4 eb 97 0f 1f 44 00 00 55 48 89 e5 41 56
      [  225.360410] RSP: 0018:ffff9468ab32fba8 EFLAGS: 00010297
      [  225.360412] RAX: ffff8aa7a51577a8 RBX: dead000000000122 RCX:
      ffff8aa7a51577a8
      [  225.360414] RDX: 0000000000000000 RSI: 0000000000000006 RDI:
      ffff8aa7a5157400
      [  225.360416] RBP: ffff9468ab32fbd8 R08: ffff8aa64e47e600 R09:
      0000000000000000
      [  225.360418] R10: 0000000000000000 R11: ffffffffc06036e6 R12:
      dead000000000100
      [  225.360420] R13: ffff8aa7820f1940 R14: ffff8aa7a51577a8 R15:
      0000000000000006
      [  225.360422] FS:  00007c1146ffd700(0000) GS:ffff8aa7baa00000(0000)
      knlGS:0000000000000000
      [  225.360424] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  225.360426] CR2: 00007aea3473a000 CR3: 00000000537d6004 CR4:
      00000000003606f0
      [  225.360427] Call Trace:
      [  225.360434]  imgu_return_all_buffers+0x6f/0x8e [ipu3_imgu]
      [  225.360438]  imgu_vb2_stop_streaming+0xd6/0xf0 [ipu3_imgu]
      [  225.360441]  __vb2_queue_cancel+0x33/0x22d [videobuf2_common]
      [  225.360443]  vb2_core_streamoff+0x16/0x78 [videobuf2_common]
      [  225.360448]  __video_do_ioctl+0x33d/0x42a
      [  225.360452]  video_usercopy+0x34a/0x615
      [  225.360455]  ? video_ioctl2+0x16/0x16
      [  225.360458]  v4l2_ioctl+0x46/0x53
      [  225.360462]  do_vfs_ioctl+0x50a/0x787
      [  225.360465]  ksys_ioctl+0x58/0x83
      [  225.360468]  __x64_sys_ioctl+0x1a/0x1e
      [  225.360470]  do_syscall_64+0x54/0x68
      [  225.360474]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      [  225.360476] RIP: 0033:0x7c118030f497
      [  225.360479] Code: 8a 66 90 48 8b 05 d1 d9 2b 00 64 c7 00 26 00 00 00
      48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f
      05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d a1 d9 2b 00 f7 d8 64 89 01 48
      [  225.360480] RSP: 002b:00007c1146ffa5a8 EFLAGS: 00000246 ORIG_RAX:
      0000000000000010
      [  225.360483] RAX: ffffffffffffffda RBX: 00007c1140010018 RCX:
      00007c118030f497
      [  225.360484] RDX: 00007c114001019c RSI: 0000000040045613 RDI:
      000000000000004c
      [  225.360486] RBP: 00007c1146ffa700 R08: 00007c1140010048 R09:
      0000000000000000
      [  225.360488] R10: 0000000000000000 R11: 0000000000000246 R12:
      00007c11400101b0
      [  225.360489] R13: 00007c1140010200 R14: 00007c1140010048 R15:
      0000000000000001
      [  225.360492] ---[ end trace 73625ecfbd1c930e ]---
      [  225.360498] general protection fault: 0000 [#1] PREEMPT SMP PTI
      [  225.360501] CPU: 0 PID: 6704 Comm: CameraDeviceOps Tainted: G
      WC        5.4.30 #5
      [  225.360502] Hardware name: HP Soraka/Soraka, BIOS
      Google_Soraka.10431.106.0 12/03/2019
      [  225.360505] RIP: 0010:imgu_return_all_buffers+0x52/0x8e [ipu3_imgu]
      [  225.360507] Code: d4 49 8b 85 70 0a 00 00 49 81 c5 70 0a 00 00 49 39
      c5 74 3b 49 bc 00 01 00 00 00 00 ad de 49 8d 5c 24 22 4c 8b 30 48 8b 48
      08 <49> 89 4e 08 4c 89 31 4c 89 20 48 89 58 08 48 8d b8 58 fc ff ff 44
      [  225.360509] RSP: 0018:ffff9468ab32fbe8 EFLAGS: 00010293
      [  225.360511] RAX: ffff8aa7a51577a8 RBX: dead000000000122 RCX:
      dead000000000122
      [  225.360512] RDX: 0000000000000000 RSI: 0000000000000006 RDI:
      ffff8aa7a5157400
      [  225.360514] RBP: ffff9468ab32fc18 R08: ffff8aa64e47e600 R09:
      0000000000000000
      [  225.360515] R10: 0000000000000000 R11: ffffffffc06036e6 R12:
      dead000000000100
      [  225.360517] R13: ffff8aa7820f1940 R14: dead000000000100 R15:
      0000000000000006
      [  225.360519] FS:  00007c1146ffd700(0000) GS:ffff8aa7baa00000(0000)
      knlGS:0000000000000000
      [  225.360521] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  225.360523] CR2: 00007aea3473a000 CR3: 00000000537d6004 CR4:
      00000000003606f0
      [  225.360525] Call Trace:
      [  225.360528]  imgu_vb2_stop_streaming+0xd6/0xf0 [ipu3_imgu]
      [  225.360531]  __vb2_queue_cancel+0x33/0x22d [videobuf2_common]
      [  225.360534]  vb2_core_streamoff+0x16/0x78 [videobuf2_common]
      [  225.360537]  __video_do_ioctl+0x33d/0x42a
      [  225.360540]  video_usercopy+0x34a/0x615
      [  225.360542]  ? video_ioctl2+0x16/0x16
      [  225.360546]  v4l2_ioctl+0x46/0x53
      [  225.360548]  do_vfs_ioctl+0x50a/0x787
      [  225.360551]  ksys_ioctl+0x58/0x83
      [  225.360554]  __x64_sys_ioctl+0x1a/0x1e
      [  225.360556]  do_syscall_64+0x54/0x68
      [  225.360559]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      [  225.360561] RIP: 0033:0x7c118030f497
      [  225.360563] Code: 8a 66 90 48 8b 05 d1 d9 2b 00 64 c7 00 26 00 00 00
      48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f
      05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d a1 d9 2b 00 f7 d8 64 89 01 48
      [  225.360565] RSP: 002b:00007c1146ffa5a8 EFLAGS: 00000246 ORIG_RAX:
      0000000000000010
      [  225.360567] RAX: ffffffffffffffda RBX: 00007c1140010018 RCX:
      00007c118030f497
      [  225.360569] RDX: 00007c114001019c RSI: 0000000040045613 RDI:
      000000000000004c
      [  225.360570] RBP: 00007c1146ffa700 R08: 00007c1140010048 R09:
      0000000000000000
      [  225.360572] R10: 0000000000000000 R11: 0000000000000246 R12:
      00007c11400101b0
      [  225.360574] R13: 00007c1140010200 R14: 00007c1140010048 R15:
      0000000000000001
      [  225.360576] Modules linked in: snd_seq_dummy snd_seq snd_seq_device
      veth bridge stp llc tun nf_nat_tftp nf_conntrack_tftp nf_nat_ftp
      nf_conntrack_ftp esp6 ah6 ip6t_REJECT ip6t_ipv6header cmac rfcomm uinput
      ipu3_imgu(C) ipu3_cio2 iova videobuf2_v4l2 videobuf2_common
      videobuf2_dma_sg videobuf2_memops ov13858 ov567
      
      Fix this by moving the list_del() call just below the list_first_entry()
      call when the buffer no longer needs to be in the list.
      
      Fixes: 8ecc7c9d ("media: staging/intel-ipu3: parameter buffer refactoring")
      Signed-off-by: default avatarTomasz Figa <tfiga@chromium.org>
      Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Reviewed-by: default avatarBingbu Cao <bingbu.cao@intel.com>
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      735a02f1
    • Stanimir Varbanov's avatar
      media: venus: venc,vdec: Return EBUSY on S_FMT while streaming · 4470ff69
      Stanimir Varbanov authored
      According to the v4l spec s_fmt must return EBUSY while the
      particular queue is streaming. Add such check in encoder and
      decoder s_fmt methods.
      Signed-off-by: default avatarStanimir Varbanov <stanimir.varbanov@linaro.org>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      4470ff69
    • Stanimir Varbanov's avatar
      media: venus: Mark last capture buffer · 85872f86
      Stanimir Varbanov authored
      According to stateful Codec API the decoder will process all
      remaining buffers from before the source change event in
      dynamic-resolution-change state and mark the last buffer with
      V4L2_BUF_FLAG_LAST.
      
      In Venus case the firmware doesn't mark that last buffer and
      some mechanism have to be created in v4l decoder driver.
      Fortunately the firmware interface (HFI) claims that the
      decoder output buffers will be returned to v4l decoder
      driver before it send the insufficient event.
      
      In order to do that we save last queued in the driver capture
      buffer in the event_notify and issue flush on output firmware
      buffers queue. Once the saved buffer is returned (as a result of
      flush command) we mark it as LAST. For all that possible we
      extend HFI flush command with one more argument and one more
      flush_done HFI driver callback.
      Signed-off-by: default avatarStanimir Varbanov <stanimir.varbanov@linaro.org>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      85872f86
    • Stanimir Varbanov's avatar
      media: venus: vdec: Init registered list unconditionally · bc3d870e
      Stanimir Varbanov authored
      Presently the list initialization is done only in
      dynamic-resolution-change state, which leads to list corruptions
      and use-after-free. Init list_head unconditionally in
      vdec_stop_capture called by vb2 stop_streaming without takeing
      into account current codec state.
      Signed-off-by: default avatarStanimir Varbanov <stanimir.varbanov@linaro.org>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      bc3d870e
    • Stanimir Varbanov's avatar
      media: venus: vdec: Mark flushed buffers with error state · 51df3c81
      Stanimir Varbanov authored
      Once the hfi_session_flush is issued by the vdec all queued
      buffers to firmware should be returned to the v4l driver. Some
      of those buffers are not processed at the time of flush command,
      those buffers has filled len zero (no data). Catch that in
      buffer_done callback and mark not filled capture buffers with
      error state so that client can discard them.
      Signed-off-by: default avatarStanimir Varbanov <stanimir.varbanov@linaro.org>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      51df3c81
    • Stanimir Varbanov's avatar
      media: venus: helpers: Done buffers per queue type · 0febf923
      Stanimir Varbanov authored
      Currently calling venus_helper_buffers_done() will return buffers to
      user for both capture and output queues in the same call. This is
      wrong because both queues are really separate and calling
      stop_streaming on one queue shouldn't return buffers for the other.
      Solve this by add a new queue type argument and fix the clients of
      the helper function.
      Signed-off-by: default avatarStanimir Varbanov <stanimir.varbanov@linaro.org>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      0febf923
    • Stanimir Varbanov's avatar
      media: venus: core: Constify codec frequency data array · 18cf8ba1
      Stanimir Varbanov authored
      The array is not changed in the code, so make it const.
      Signed-off-by: default avatarStanimir Varbanov <stanimir.varbanov@linaro.org>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      18cf8ba1
    • Stanimir Varbanov's avatar
      media: venus: core: Fix mutex destroy in remove · 82223aa5
      Stanimir Varbanov authored
      The hfi_destroy function is called too early in remove method. It
      destroys a mutex which is used later in the .remove from pmruntime.
      Solve the issue by moving hfi_destroy after last usage of the mutex.
      Signed-off-by: default avatarStanimir Varbanov <stanimir.varbanov@linaro.org>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      82223aa5
    • Stanimir Varbanov's avatar
      media: venus: core: Add missing mutex destroy · cb1c05c8
      Stanimir Varbanov authored
      This adds missing mutex_destroy in remove method of venus core driver.
      Signed-off-by: default avatarStanimir Varbanov <stanimir.varbanov@linaro.org>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      cb1c05c8
  2. 29 Apr, 2020 8 commits
  3. 23 Apr, 2020 3 commits
    • Mauro Carvalho Chehab's avatar
      media: Kconfig: fix some dvb-usb-v2 dependencies · 4e5552b2
      Mauro Carvalho Chehab authored
      There are some tuners used by a few pure DVB boards that use
      internally V4L2 function calls. Due to that, such drivers now
      depends on v4l2 core support, and can't be auto-selected
      if !VIDEO_V4L2:
      
      	WARNING: unmet direct dependencies detected for DVB_RTL2832_SDR
      	  Depends on [n]: MEDIA_SUPPORT [=y] && MEDIA_DIGITAL_TV_SUPPORT [=y] && DVB_CORE [=y] && I2C [=y] && I2C_MUX [=y] && VIDEO_V4L2 [=n] && MEDIA_SDR_SUPPORT [=y] && USB [=y]
      	  Selected by [y]:
      	  - DVB_USB_RTL28XXU [=y] && USB [=y] && MEDIA_SUPPORT [=y] && MEDIA_USB_SUPPORT [=y] && I2C [=y] && MEDIA_DIGITAL_TV_SUPPORT [=y] && DVB_USB_V2 [=y] && I2C_MUX [=y] && MEDIA_SUBDRV_AUTOSELECT [=y] && MEDIA_SDR_SUPPORT [=y]
      
      	WARNING: unmet direct dependencies detected for MEDIA_TUNER_E4000
      	  Depends on [n]: (MEDIA_ANALOG_TV_SUPPORT [=y] || MEDIA_DIGITAL_TV_SUPPORT [=y] || MEDIA_RADIO_SUPPORT [=y] || MEDIA_SDR_SUPPORT [=y]) && MEDIA_SUPPORT [=y] && I2C [=y] && VIDEO_V4L2 [=n]
      	  Selected by [y]:
      	  - DVB_USB_RTL28XXU [=y] && USB [=y] && MEDIA_SUPPORT [=y] && MEDIA_USB_SUPPORT [=y] && I2C [=y] && MEDIA_DIGITAL_TV_SUPPORT [=y] && DVB_USB_V2 [=y] && I2C_MUX [=y] && MEDIA_SUBDRV_AUTOSELECT [=y]
      
      	WARNING: unmet direct dependencies detected for MEDIA_TUNER_FC2580
      	  Depends on [n]: (MEDIA_ANALOG_TV_SUPPORT [=y] || MEDIA_DIGITAL_TV_SUPPORT [=y] || MEDIA_RADIO_SUPPORT [=y] || MEDIA_SDR_SUPPORT [=y]) && MEDIA_SUPPORT [=y] && I2C [=y] && VIDEO_V4L2 [=n]
      	  Selected by [y]:
      	  - DVB_USB_RTL28XXU [=y] && USB [=y] && MEDIA_SUPPORT [=y] && MEDIA_USB_SUPPORT [=y] && I2C [=y] && MEDIA_DIGITAL_TV_SUPPORT [=y] && DVB_USB_V2 [=y] && I2C_MUX [=y] && MEDIA_SUBDRV_AUTOSELECT [=y]
      
      Detected via randconfig builds.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      4e5552b2
    • Mauro Carvalho Chehab's avatar
      media: platform: fix VIA_CAMERA dependencies · 324efc70
      Mauro Carvalho Chehab authored
      As detected by a randconfig:
      
      	WARNING: unmet direct dependencies detected for VIDEO_OV7670
      	  Depends on [n]: MEDIA_SUPPORT [=y] && I2C [=y] && VIDEO_V4L2 [=n]
      	  Selected by [y]:
      	  - VIDEO_VIA_CAMERA [=y] && MEDIA_SUPPORT [=y] && MEDIA_PLATFORM_SUPPORT [=y] && V4L_PLATFORM_DRIVERS [=y] && FB_VIA [=y]
      
      There's a missing dependency on VIDEO_V4L2 for VIA_CAMERA.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      324efc70
    • Mauro Carvalho Chehab's avatar
      media: tuners: Kconfig: add some missing VIDEO_V4L2 dependencies · 4bdbff4d
      Mauro Carvalho Chehab authored
      There are three tuners that depend on some functions inside
      V4L2 core:
      
      	$ git grep -l -E 'v4l2_[0-9a-zA-Z_]+\(' drivers/media/tuners/
      	drivers/media/tuners/e4000.c
      	drivers/media/tuners/fc2580.c
      	drivers/media/tuners/msi001.c
      
      Make them dependent of VIDEO_V4L2, as otherwise, this would happen:
      
      	on x86_64:
      	CONFIG_VIDEO_V4L2=m
      	CONFIG_MEDIA_TUNER_E4000=y
      
      	ld: drivers/media/tuners/e4000.o: in function `e4000_remove':
      	e4000.c:(.text+0x34): undefined reference to `v4l2_ctrl_handler_free'
      	ld: drivers/media/tuners/e4000.o: in function `e4000_probe':
      	e4000.c:(.text+0x16c1): undefined reference to `v4l2_ctrl_handler_init_class'
      	ld: e4000.c:(.text+0x16eb): undefined reference to `v4l2_ctrl_new_std'
      	ld: e4000.c:(.text+0x1731): undefined reference to `v4l2_ctrl_new_std'
      	ld: e4000.c:(.text+0x1762): undefined reference to `v4l2_ctrl_auto_cluster'
      	ld: e4000.c:(.text+0x178c): undefined reference to `v4l2_ctrl_new_std'
      	ld: e4000.c:(.text+0x17d6): undefined reference to `v4l2_ctrl_new_std'
      	ld: e4000.c:(.text+0x1804): undefined reference to `v4l2_ctrl_auto_cluster'
      	ld: e4000.c:(.text+0x182e): undefined reference to `v4l2_ctrl_new_std'
      	ld: e4000.c:(.text+0x1878): undefined reference to `v4l2_ctrl_new_std'
      	ld: e4000.c:(.text+0x18a6): undefined reference to `v4l2_ctrl_auto_cluster'
      	ld: e4000.c:(.text+0x18d0): undefined reference to `v4l2_ctrl_new_std'
      	ld: e4000.c:(.text+0x191a): undefined reference to `v4l2_ctrl_new_std'
      	ld: e4000.c:(.text+0x1948): undefined reference to `v4l2_ctrl_auto_cluster'
      	ld: e4000.c:(.text+0x1972): undefined reference to `v4l2_ctrl_new_std'
      	ld: e4000.c:(.text+0x19a6): undefined reference to `v4l2_ctrl_handler_free'
      	ld: e4000.c:(.text+0x1a2a): undefined reference to `v4l2_i2c_subdev_init'
      Reported-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Acked-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Tested-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      4bdbff4d
  4. 22 Apr, 2020 19 commits