Commit Graph

2265 Commits

Author SHA1 Message Date
tbslucy
9f5cdb290c add to support tbs6032 2025-06-26 17:46:26 +08:00
CrazyCat
b4a40fd7cc media: pci/tbscapture2: Compatibility fix for 6.14+ kernels. 2025-04-06 18:38:25 +03:00
CrazyCat
b68595ce48 media: pci/saa716x: Fixed TBS 6991 config. 2025-03-27 18:56:45 +02:00
CrazyCat
82569f482a Merge branch 'tbsdtv_linux_media/master' into tbsdtv_linux_media/latest 2025-03-19 21:13:18 +02:00
CrazyCat
3c5176eb42 Revert "media: Convert from tasklet to BH workqueue"
This reverts commit 16ba295214.
2025-03-19 21:06:35 +02:00
CrazyCat
a668e81971 media: pci/tbscapture2: Optimized for X86 SIMD. 2025-03-19 19:49:50 +02:00
CrazyCat
75a92ecbf1 Merge branch 'tbsdtv_linux_media/master' into tbsdtv_linux_media/latest 2025-03-18 23:37:11 +02:00
Allen Pais
16ba295214 media: Convert from tasklet to BH workqueue
The only generic interface to execute asynchronously in the BH context is
tasklet; however, it's marked deprecated and has some design flaws. To
replace tasklets, BH workqueue support was recently added. A BH workqueue
behaves similarly to regular workqueues except that the queued work items
are executed in the BH context.

This patch converts drivers/media/* from tasklet to BH workqueue.

Based on the work done by Tejun Heo <tj@kernel.org>

Signed-off-by: Allen Pais <allen.lkml@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2025-03-18 23:36:28 +02:00
CrazyCat
a8b05e2cf2 media: pci/tbscapture2: Compile only for X86. 2025-03-17 19:47:29 +02:00
Davin622
2a06970f80 Added support for tbs6514 V2 2025-03-17 15:54:06 +08:00
Davin622
7d6cc50725 Added support for r850 chip 2025-03-17 15:46:06 +08:00
CrazyCat
1dcc2b53e9 media: pci/tbscapture2: New generation PCIe x4 HDMI capture card driver. TBS 6314R support. 2025-02-27 16:55:17 +02:00
CrazyCat
7220890237 Merge branch 'tbsdtv_linux_media/master' into tbsdtv_linux_media/latest 2025-02-12 20:02:20 +02:00
Yang Yingliang
610cff29b9 media: netup_unidvb: switch to use devm_spi_alloc_host()
Switch to use modern name function devm_spi_alloc_host().

No functional changed.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://patch.msgid.link/20240902125947.1368-3-yangyingliang@huaweicloud.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-02-10 18:51:34 +02:00
CrazyCat
8d6283e035 media: pci/tbscapture: Rename module and cleanup. 2025-01-26 18:03:21 +02:00
tbslucy
ca3b5b0028 add to support TBS690B-Lite 2024-12-16 18:07:54 +08:00
CrazyCat
723c9a55fa Merge branch 'tbsdtv_linux_media/master' into tbsdtv_linux_media/latest 2024-12-11 19:46:52 +02:00
CrazyCat
b7236f208b move asm/unaligned.h to linux/unaligned.h
asm/unaligned.h is always an include of asm-generic/unaligned.h;
might as well move that thing to linux/unaligned.h and include
that - there's nothing arch-specific in that header.

auto-generated by the following:

for i in `git grep -l -w asm/unaligned.h`; do
    sed -i -e "s/asm\/unaligned.h/linux\/unaligned.h/" $i
done
for i in `git grep -l -w asm-generic/unaligned.h`; do
    sed -i -e "s/asm-generic\/unaligned.h/linux\/unaligned.h/" $i
done
git mv include/asm-generic/unaligned.h include/linux/unaligned.h
git mv tools/include/asm-generic/unaligned.h tools/include/linux/unaligned.h
sed -i -e "/unaligned.h/d" include/asm-generic/Kbuild
sed -i -e "s/__ASM_GENERIC/__LINUX/" include/linux/unaligned.h tools/include/linux/unaligned.h
2024-12-11 17:53:49 +02:00
tbslucy
2951e46e6c add to support tbs6302se and tbs6304se 2024-11-19 11:01:55 +08:00
CrazyCat
36ce48448b media: pci/tbsecp3: Fix irq handler for DMA events. 2024-10-26 18:58:35 +03:00
tbslucy
48d0098707 add to support TBS6322 2024-10-21 17:22:31 +08:00
CrazyCat
a2e856bfb2 Merge branch 'latest' of github.com:tbsdtv/linux_media into tbsdtv_linux_media/latest 2024-10-03 23:07:44 +03:00
CrazyCat
576a772be2 Merge branch 'tbsdtv_linux_media/master' into tbsdtv_linux_media/latest 2024-10-03 23:06:59 +03:00
Greg Kroah-Hartman
85e969f052 driver core: have match() callback in struct bus_type take a const *
In the match() callback, the struct device_driver * should not be
changed, so change the function callback to be a const *.  This is one
step of many towards making the driver core safe to have struct
device_driver in read-only memory.

Because the match() callback is in all busses, all busses are modified
to handle this properly.  This does entail switching some container_of()
calls to container_of_const() to properly handle the constant *.

For some busses, like PCI and USB and HV, the const * is cast away in
the match callback as those busses do want to modify those structures at
this point in time (they have a local lock in the driver structure.)
That will have to be changed in the future if they wish to have their
struct device * in read-only-memory.

Cc: Rafael J. Wysocki <rafael@kernel.org>
Reviewed-by: Alex Elder <elder@kernel.org>
Acked-by: Sumit Garg <sumit.garg@linaro.org>
Link: https://lore.kernel.org/r/2024070136-wrongdoer-busily-01e8@gregkh
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-01 22:15:38 +03:00
tbslucy
0a7ac6c4db add to support tbs6324 2024-09-29 11:49:39 +08:00
CrazyCat
33cfd223fa Merge branch 'tbsdtv_linux_media/master' into tbsdtv_linux_media/latest 2024-08-02 18:44:48 +03:00
CrazyCat
5c61248f8e Revert "media: videobuf2: core: Rename min_buffers_needed field in vb2_queue"
This reverts commit 4657721876.
2024-07-30 19:05:53 +03:00
CrazyCat
76482c109c Reapply "media: bttv: add back vbi hack"
This reverts commit ac24c93aa4.
2024-07-30 19:05:35 +03:00
CrazyCat
ac24c93aa4 Revert "media: bttv: add back vbi hack"
This reverts commit ab8869dd23.
2024-07-30 18:59:46 +03:00
Jeff Johnson
be672b3cd3 media: pci: add missing MODULE_DESCRIPTION() macros
With ARCH=x86, make allmodconfig && make W=1 C=1 reports:
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/pci/ttpci/budget-core.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/pci/bt8xx/bt878.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/pci/ivtv/ivtvfb.o

Add the missing invocations of the MODULE_DESCRIPTION() macro.

Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-07-30 18:53:09 +03:00
Ricardo B. Marliere
43100f523a media: bt8xx: make bttv_sub_bus_type const
Now that the driver core can properly handle constant struct bus_type,
move the bttv_sub_bus_type variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-07-30 18:52:44 +03:00
Benjamin Gaignard
4657721876 media: videobuf2: core: Rename min_buffers_needed field in vb2_queue
Rename min_buffers_needed into min_queued_buffers and update
the documentation about it.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil: Drop the change where min_queued_buffers + 1 buffers would be]
[hverkuil: allocated. Now this patch only renames this field instead of making]
[hverkuil: a functional change as well.]
[hverkuil: Renamed 3 remaining min_buffers_needed occurrences.]
2024-07-30 18:52:26 +03:00
Hans Verkuil
ab8869dd23 media: bttv: add back vbi hack
The old (now removed) videobuf framework had an optional vbi hack where
the sequence number of the frame counter was copied in the last 4 bytes
of the buffer. This hack was active only for the read() interface
(so not for streaming I/O), and it was enabled by bttv. This allowed
applications that used read() for the VBI data to match it with the
corresponding video frame.

When bttv was converted to vb2 this hack was forgotten, but some old
applications rely on this.

So add this back, but this time in the bttv driver rather than in the
vb2 framework.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Fixes: b7ec3212a73a ("media: bttv: convert to vb2")
Tested-by: Dr. David Alan Gilbert <dave@treblig.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-07-30 18:52:05 +03:00
Hans Verkuil
a7c6ff2a3e media: bttv: start_streaming should return a proper error code
The start_streaming callback returned 0 or 1 instead of a
proper error code. Fix that.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Fixes: b7ec3212a73a ("media: bttv: convert to vb2")
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2024-07-30 18:51:37 +03:00
Colin Ian King
ebbabe9f43 media: bt8xx: make read-only arrays static
Don't populate the arrays on the stack, instead make them static const.
Also add spaces between values to clean up checkpatch style warnings.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-07-30 18:51:12 +03:00
Juerg Haefliger
dceacbaf88 media: bttv: Add MODULE_FIRMWARE macro
The module loads firmware so add a MODULE_FIRMWARE macro to provide that
information via modinfo.

Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-07-30 18:50:50 +03:00
Zheng Wang
f9ae06c957 media: bttv: fix use after free error due to btv->timeout timer
There may be some a race condition between timer function
bttv_irq_timeout and bttv_remove. The timer is setup in
probe and there is no timer_delete operation in remove
function. When it hit kfree btv, the function might still be
invoked, which will cause use after free bug.

This bug is found by static analysis, it may be false positive.

Fix it by adding del_timer_sync invoking to the remove function.

cpu0                cpu1
                  bttv_probe
                    ->timer_setup
                      ->bttv_set_dma
                        ->mod_timer;
bttv_remove
  ->kfree(btv);
                  ->bttv_irq_timeout
                    ->USE btv

Fixes: 162e6376ac ("media: pci: Convert timers to use timer_setup()")
Signed-off-by: Zheng Wang <zyytlz.wz@163.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-07-30 18:50:27 +03:00
Hans Verkuil
4933fd006d media: bt8xx: bttv_risc_packed(): remove field checks
Do not turn on the vcr_hack based on the btv->field value.

This was a change in the bttv vb2 conversion that caused
green lines at the bottom of the picture in tvtime.

It was originally added to the vb2 conversion based on
faulty information that without this there would be glitches
in the video. However, later tests suggest that this is a
problem in the utilities used to test this since tvtime
behaves fine.

This patch reverts the bttv driver to the original pre-vb2
behavior w.r.t. vcr_hack.

Fixes: b7ec3212a73a ("media: bttv: convert to vb2")
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-07-30 18:50:01 +03:00
Deborah Brouwer
ab4f554b93 media: bttv: convert to vb2
Convert this driver from the old videobuf framework to videobuf2.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-07-30 18:49:09 +03:00
Deborah Brouwer
03b0cdc16e media: bttv: use audio defaults for winfast2000
The winfast2000 card advertised rxsubchans that weren't compatible with
its default audmode. Just use the default audmode (V4L2_TUNER_MODE_MONO)
and default audio reception flag (V4L2_TUNER_SUB_MONO) for this card.
Fixes compliance test failures.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-07-30 18:48:09 +03:00
Deborah Brouwer
6f4c23ebf6 media: bttv: refactor bttv_set_dma()
Break bttv_set_dma() into several smaller, separate functions so it is
easier to read the risc and dma code. Replace numeric values with
descriptive macros. Also remove the unused field btv->cap_ctl.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-07-30 18:47:49 +03:00
Deborah Brouwer
e6e73bdec9 media: bttv: move vbi_skip/vbi_count out of buffer
Instead of storing vbi_skip and vbi_count in each bttv buffer separately,
move them to the main bttv struct as they won't change per buffer.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-07-30 18:47:31 +03:00
Deborah Brouwer
bb953b7de6 media: bttv: remove crop info from bttv_buffer
Instead of storing the cropping parameters in each bttv buffer separately,
just use the global bttv crop because it won't change per buffer.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-07-30 18:47:13 +03:00
Deborah Brouwer
4e500ae381 media: bttv: remove tvnorm field from bttv_buffer
Instead of storing the tvnorm in each bttv buffer separately, just use the
global bttv tvnorm because the tvnorm does not change per buffer.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-07-30 18:46:56 +03:00
Deborah Brouwer
a944fef58a media: bttv: remove format field from bttv_buffer
Instead of storing the format (video or vbi) in each bttv buffer
separately, just use the global bttv format because the format does not
change per buffer.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-07-30 18:46:41 +03:00
Deborah Brouwer
4fb0930124 media: bttv: move do_crop flag out of bttv_fh
The do_crop flag indicates whether a cropping rectangle has been set.
Instead of storing this flag separately in each file handle, move do_crop
to struct bttv in preparation for vb2 conversion which stops using
separate bttv file handles.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-07-30 18:46:25 +03:00
Deborah Brouwer
73f1c651d2 media: bttv: copy vbi_fmt from bttv_fh
In preparation for the vb2 conversion, copy the vbi format from struct
bttv_fh and add it to the main struct bttv. Use vbi format from struct
bttv wherever it will be needed after the vb2 conversion which stops using
separate bttv file handles altogether. To avoid changing more code than
necessary, just leave the vbi format in separate file handles wherever it
will be subsequently removed by vb2.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-07-30 18:46:09 +03:00
Deborah Brouwer
6c84fe0efa media: bttv: copy vid fmt/width/height from fh
In preparation for the vb2 conversion, copy the video format, width and
height fields from struct bttv_fh and add them to the main struct bttv.
Use these fields from struct bttv wherever they will be needed after the
vb2 conversion which stops using separate bttv file handles altogether. To
avoid changing more code than necessary, just leave the video format,
width and height fields in separate file handles wherever the code will be
subsequently removed by vb2.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-07-30 18:45:44 +03:00
Deborah Brouwer
39bfb3c14b media: bttv: radio use v4l2_fh instead of bttv_fh
Use a v4l2_fh when opening a radio device instead of a bttv_fh and manage
it with v4l2_fh_open() and v4l2_fh_release() and v4l2_ctrl_poll(). This
eliminates bttv_fh from the radio in preparation for vb2 conversion which
stops using separate bttv file handles altogether.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-07-30 18:45:25 +03:00
Deborah Brouwer
b9b4e7d4b8 media: bttv: replace BUG with WARN_ON
Both BUG and BUG_ON are replaced with WARN_ON wherever they would still be
present after the vb2 conversion. WARN_ON is sufficient in these cases.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-07-30 18:45:06 +03:00