platform/kernel/linux-rpi.git
3 years agomedia: dvb-frontends/drxk_hard.c: fix uninitialized variable warning
Hans Verkuil [Thu, 8 Oct 2020 11:59:13 +0000 (13:59 +0200)]
media: dvb-frontends/drxk_hard.c: fix uninitialized variable warning

drxk_hard.c: In function 'hi_command.constprop':
drxk_hard.c:1016:5: warning: 'wait_cmd' may be used uninitialized in this function [-Wmaybe-uninitialized]
 1015 |   } while ((status < 0) && (retry_count < DRXK_MAX_RETRIES)
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1016 |     && (wait_cmd != 0));
      |     ^~~~~~~~~~~~~~~~~~

The underlying cause is that the while condition is wrong. It should be:

(status < 0 || wait_cmd) && (retry_count < DRXK_MAX_RETRIES)

'wait_cmd' is only valid if '!(status < 0)'.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: tvp7002: fix uninitialized variable warning
Hans Verkuil [Thu, 8 Oct 2020 11:59:12 +0000 (13:59 +0200)]
media: tvp7002: fix uninitialized variable warning

tvp7002.c: In function 'tvp7002_g_register':
tvp7002.c:691:11: warning: 'val' may be used uninitialized in this function [-Wmaybe-uninitialized]
  691 |  reg->val = val;
      |  ~~~~~~~~~^~~~~

Just return without setting 'reg' if tvp7002_read returns an error.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: s5k5baf: drop 'data' field in struct s5k5baf_fw
Hans Verkuil [Thu, 8 Oct 2020 11:59:11 +0000 (13:59 +0200)]
media: s5k5baf: drop 'data' field in struct s5k5baf_fw

struct s5k5baf_fw ends with this:

       struct {
               u16 id;
               u16 offset;
       } seq[0];
       u16 data[];
};

which is rather confusing and can cause gcc warnings:

s5k5baf.c: In function 's5k5baf_load_setfile.isra':
s5k5baf.c:390:13: warning: array subscript 65535 is outside the bounds of an interior zero-length array 'struct <anonymous>[0]' [-Wzero-length-bounds]
  390 |   if (f->seq[i].offset + d <= end)
      |       ~~~~~~^~~

It turns out that 'data[]' is used in only one place and it can
easily be replaced by &fw->seq[0].id and 'seq[0]' can be replaced by
'seq[]'.

This is both more readable and solved that warnings.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Sylwester Nawrocki <snawrocki@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: dt-bindings: media: venus: Add an optional power domain for perf voting
Rajendra Nayak [Tue, 1 Sep 2020 14:20:22 +0000 (16:20 +0200)]
media: dt-bindings: media: venus: Add an optional power domain for perf voting

Venus needs to vote for the performance state of a power domain (cx)
to be able to support DVFS. This 'cx' power domain is controlled by
rpmh and is a common power domain (scalable) not specific to
venus alone. This is optional in the sense that, leaving this power
domain out does not really impact the functionality but just makes
the platform a little less power efficient.

Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: rcar-vin: rcar-dma: Fix setting VNIS_REG for RAW8 formats
Lad Prabhakar [Fri, 2 Oct 2020 10:26:52 +0000 (12:26 +0200)]
media: rcar-vin: rcar-dma: Fix setting VNIS_REG for RAW8 formats

pixelformat in vin priv structure holds V4L2_PIX_FMT_* and not
MEDIA_BUS_FMT_* so make sure we check against V4L2_PIX_FMT_* formats
while setting the VNIS_REG.

Fixes: 8c3e0f67df6c9 ("media: rcar-vin: Extend RAW8 support to all RGB layouts")
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: staging: rkisp1: uapi: Do not use BIT() macro
Niklas Söderlund [Mon, 28 Sep 2020 21:02:50 +0000 (23:02 +0200)]
media: staging: rkisp1: uapi: Do not use BIT() macro

The BIT() macro is not available to uAPI headers, replace the few usages
of it by open coding it.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Acked-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: v4l2-mem2mem: Fix spurious v4l2_m2m_buf_done
Ezequiel Garcia [Mon, 28 Sep 2020 14:03:34 +0000 (16:03 +0200)]
media: v4l2-mem2mem: Fix spurious v4l2_m2m_buf_done

A seemingly bad rebase introduced a spurious v4l2_m2m_buf_done,
which releases a buffer twice and therefore triggers a
noisy warning on each job:

WARNING: CPU: 0 PID: 0 at drivers/media/common/videobuf2/videobuf2-core.c:986 vb2_buffer_done+0x208/0x2a0

Fix it by removing the spurious v4l2_m2m_buf_done.

Reported-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Fixes: 911ea8ec42dea ("media: v4l2-mem2mem: add v4l2_m2m_suspend, v4l2_m2m_resume")
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: usbtv: Fix refcounting mixup
Oliver Neukum [Thu, 24 Sep 2020 09:14:10 +0000 (11:14 +0200)]
media: usbtv: Fix refcounting mixup

The premature free in the error path is blocked by V4L
refcounting, not USB refcounting. Thanks to
Ben Hutchings for review.

[v2] corrected attributions

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Fixes: 50e704453553 ("media: usbtv: prevent double free in error case")
CC: stable@vger.kernel.org
Reported-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran.rst: place it at the right place this time
Mauro Carvalho Chehab [Sun, 4 Oct 2020 15:45:22 +0000 (17:45 +0200)]
media: zoran.rst: place it at the right place this time

I was too quick moving zoran.rst... it ends that the original
patch didn't do the right thing and forgot to update the files
that references it.

Fix it.

Fixes: 6b90346919d4 ("media: zoran: move documentation file to the right place")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agoMerge tag 'v5.9-rc7' into patchwork
Mauro Carvalho Chehab [Sun, 4 Oct 2020 10:19:12 +0000 (12:19 +0200)]
Merge tag 'v5.9-rc7' into patchwork

Linux 5.9-rc7

* tag 'v5.9-rc7': (683 commits)
  Linux 5.9-rc7
  mm/thp: Split huge pmds/puds if they're pinned when fork()
  mm: Do early cow for pinned pages during fork() for ptes
  mm/fork: Pass new vma pointer into copy_page_range()
  mm: Introduce mm_struct.has_pinned
  mm: validate pmd after splitting
  mm: don't rely on system state to detect hot-plug operations
  mm: replace memmap_context by meminit_context
  arch/x86/lib/usercopy_64.c: fix __copy_user_flushcache() cache writeback
  lib/memregion.c: include memregion.h
  lib/string.c: implement stpcpy
  mm/migrate: correct thp migration stats
  mm/gup: fix gup_fast with dynamic page table folding
  mm: memcontrol: fix missing suffix of workingset_restore
  mm, THP, swap: fix allocating cluster for swapfile by mistake
  mm: slab: fix potential double free in ___cache_free
  Documentation/llvm: Fix clang target examples
  io_uring: ensure async buffered read-retry is setup properly
  KVM: SVM: Add a dedicated INVD intercept routine
  io_uring: don't unconditionally set plug->nowait = true
  ...

3 years agomedia: add Zoran cardlist
Mauro Carvalho Chehab [Sat, 3 Oct 2020 08:34:54 +0000 (10:34 +0200)]
media: add Zoran cardlist

Now that Zoran was re-added, we need to add its cardlist
to the admin guide.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: admin-guide: update cardlists
Mauro Carvalho Chehab [Fri, 2 Oct 2020 12:26:30 +0000 (14:26 +0200)]
media: admin-guide: update cardlists

Update them according with the current support on drivers.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: siano: rename a duplicated card string
Mauro Carvalho Chehab [Fri, 2 Oct 2020 12:24:07 +0000 (14:24 +0200)]
media: siano: rename a duplicated card string

There are two different variants for Hauppauge WinTV MiniCard:

[SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD] = {
.name = "Hauppauge WinTV MiniCard",
.type = SMS_NOVA_B0,
.fw[DEVICE_MODE_DVBT_BDA] = SMS_FW_DVBT_HCW_55XXX,
.default_mode = DEVICE_MODE_DVBT_BDA,
.lna_ctrl  = 29,
.board_cfg.foreign_lna0_ctrl = 29,
.rf_switch = 17,
.board_cfg.rf_switch_uhf = 17,
},
[SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2] = {
.name = "Hauppauge WinTV MiniCard Rev 2",
.type = SMS_NOVA_B0,
.fw[DEVICE_MODE_DVBT_BDA] = SMS_FW_DVBT_HCW_55XXX,
.default_mode = DEVICE_MODE_DVBT_BDA,
.lna_ctrl  = -1,
},

As it can be seen, the RF part of the definitions are different.

So, better to use different names in order to distinguish
between them.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: move documentation file to the right place
Mauro Carvalho Chehab [Fri, 2 Oct 2020 12:20:09 +0000 (14:20 +0200)]
media: zoran: move documentation file to the right place

The zoran revert patch misplaced the Zoran doc file. Move it to
the right place.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: atomisp: fixes build breakage for ISP2400 due to a cleanup
Mauro Carvalho Chehab [Wed, 30 Sep 2020 15:01:03 +0000 (17:01 +0200)]
media: atomisp: fixes build breakage for ISP2400 due to a cleanup

A temporary var needed for building with ISP2400 was removed
by accident on a cleanup patch.

Fix the breakage.

Fixes: 852a53a02cf0 ("media: atomisp: get rid of unused vars")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: fix mixed case on vars
Mauro Carvalho Chehab [Thu, 1 Oct 2020 09:15:47 +0000 (11:15 +0200)]
media: zoran: fix mixed case on vars

Use this small script to replace CamelCase and wrong case
on vars:

<script>
FILES=$(find "$1" -type f|grep -e '.c$' -e '.h$')
CAMEL_VARS=$(cat tags|perl -ne 'print "$1\n" if (m/^(\w*[A-Z]\w*[a-z]\w*)\s/)')
for i in $CAMEL_VARS; do
        new=$(perl -e '
                my $s = $ARGV[0];
                $s =~ s{([^a-zA-Z]?)([A-Z]*)([A-Z])([a-z]?)}{
                        my $fc = pos($s)==0;
                        my ($p0,$p1,$p2,$p3) = ($1,lc$2,lc$3,$4);
                        my $t = $p0 || $fc ? $p0 : '_';
                        $t .= $p3 ? $p1 ? "${p1}_$p2$p3" : "$p2$p3" : "$p1$p2";
                        $t;
                }ge;
                print $s;' "$i")
        for j in $FILES; do
                sed -E "s,\b$i\b,$new,g" -i $j
        done
done
for i in $(git grep "#define zr" drivers/staging/media/zoran/*.[ch]|perl -ne 'print "$1\n" if (m/#define\s+(zr\S+)/)'); do j=$(echo $i|tr [a-z] [A-Z]); sed "s,\b$i\b,$j,g" -i drivers/staging/media/zoran/*.[ch]; done
</script>

This should solve almost all warnings reported by checkpatch.pl
in strict mode.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: get rid of an unused var
Mauro Carvalho Chehab [Thu, 1 Oct 2020 09:17:51 +0000 (11:17 +0200)]
media: zoran: get rid of an unused var

The jpeg_error in lowercase is not used anywhere. Drop it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: use upper case for card types
Mauro Carvalho Chehab [Thu, 1 Oct 2020 09:00:29 +0000 (11:00 +0200)]
media: zoran: use upper case for card types

Don't mix case there: let's just use uppercase, as this is
the common pattern for such define-like enums.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: fix sparse warnings
Hans Verkuil [Mon, 28 Sep 2020 13:16:37 +0000 (15:16 +0200)]
media: zoran: fix sparse warnings

The output is not fully supported yet, so some ops are
commented out. Also comment out the corresponding callbacks to prevent
these sparse warnings:

drivers/staging/media/zoran/zoran_driver.c:656:12: warning: 'zoran_s_output' defined but not used [-Wunused-function]
  656 | static int zoran_s_output(struct file *file, void *__fh, unsigned int output)
      |            ^~~~~~~~~~~~~~
drivers/staging/media/zoran/zoran_driver.c:649:12: warning: 'zoran_g_output' defined but not used [-Wunused-function]
  649 | static int zoran_g_output(struct file *file, void *__fh, unsigned int *output)
      |            ^~~~~~~~~~~~~~
drivers/staging/media/zoran/zoran_driver.c:635:12: warning: 'zoran_enum_output' defined but not used [-Wunused-function]
  635 | static int zoran_enum_output(struct file *file, void *__fh,
      |            ^~~~~~~~~~~~~~~~~
drivers/staging/media/zoran/zoran_driver.c:302:12: warning: 'zoran_enum_fmt_vid_overlay' defined but not used [-Wunused-function]
  302 | static int zoran_enum_fmt_vid_overlay(struct file *file, void *__fh,
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/staging/media/zoran/zoran_driver.c:294:12: warning: 'zoran_enum_fmt_vid_out' defined but not used [-Wunused-function]
  294 | static int zoran_enum_fmt_vid_out(struct file *file, void *__fh,
      |            ^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: fix smatch warning
Hans Verkuil [Mon, 28 Sep 2020 13:11:39 +0000 (15:11 +0200)]
media: zoran: fix smatch warning

drivers/staging/media/zoran/zoran_device.c:941 zoran_irq() warn: inconsistent indenting

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: update TODO
Corentin Labbe [Fri, 25 Sep 2020 18:30:57 +0000 (20:30 +0200)]
media: zoran: update TODO

Update the TODO of the zoran driver

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: convert to vb2
Corentin Labbe [Fri, 25 Sep 2020 18:30:56 +0000 (20:30 +0200)]
media: zoran: convert to vb2

This is it! the ultimate last step, the vb2 conversion.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: remove deprecated .vidioc_g_jpegcomp
Corentin Labbe [Fri, 25 Sep 2020 18:30:55 +0000 (20:30 +0200)]
media: zoran: remove deprecated .vidioc_g_jpegcomp

Remove the deprecated .vidioc_g_jpegcomp and replace it
with corresponding v4l2_ctrl_ops code.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: fix some compliance test
Corentin Labbe [Fri, 25 Sep 2020 18:30:54 +0000 (20:30 +0200)]
media: zoran: fix some compliance test

Add TODO for "TRY_FMT cannot handle an invalid pixelformat"

We need to set pixelformat in some case.
We should also handle some minimum requirement.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: fix use of buffer_size and sizeimage
Corentin Labbe [Fri, 25 Sep 2020 18:30:53 +0000 (20:30 +0200)]
media: zoran: fix use of buffer_size and sizeimage

buffer_size was not set when it should be.
Furthermore, use it instead of recalculate it.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: remove test_interrupts
Corentin Labbe [Fri, 25 Sep 2020 18:30:52 +0000 (20:30 +0200)]
media: zoran: remove test_interrupts

The test_interrupts function is useless, remove it.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: add vidioc_g_parm
Corentin Labbe [Fri, 25 Sep 2020 18:30:51 +0000 (20:30 +0200)]
media: zoran: add vidioc_g_parm

Adding vidioc_g_parm made v4l compliance happy.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: remove framebuffer support
Corentin Labbe [Fri, 25 Sep 2020 18:30:50 +0000 (20:30 +0200)]
media: zoran: remove framebuffer support

The framebuffer support is obsolete, so let's reduce code size.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: enable makefile
Corentin Labbe [Fri, 25 Sep 2020 18:30:49 +0000 (20:30 +0200)]
media: zoran: enable makefile

This patch enables compilation of the zoran driver.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: device support only 32bit DMA address
Corentin Labbe [Fri, 25 Sep 2020 18:30:48 +0000 (20:30 +0200)]
media: zoran: device support only 32bit DMA address

The zoran device only supports 32bit DMA address.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: disable output
Corentin Labbe [Fri, 25 Sep 2020 18:30:47 +0000 (20:30 +0200)]
media: zoran: disable output

Zoran is picky about jpeg data it accepts. At least it seems to not support COM and APPn.
So until a way to filter data will be done, disable output.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: Add vb_queue
Corentin Labbe [Fri, 25 Sep 2020 18:30:46 +0000 (20:30 +0200)]
media: zoran: Add vb_queue

This patchs adds a vb_queue without using it.
This reduce the final VB2 conversion patch.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: Add more check for compliance
Corentin Labbe [Fri, 25 Sep 2020 18:30:45 +0000 (20:30 +0200)]
media: zoran: Add more check for compliance

The zoran driver miss some sanity checks, and this made v4l compliance
happy.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: constify codec_name
Corentin Labbe [Fri, 25 Sep 2020 18:30:44 +0000 (20:30 +0200)]
media: zoran: constify codec_name

The codec_name could be const.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: constify struct tvnorm
Corentin Labbe [Fri, 25 Sep 2020 18:30:43 +0000 (20:30 +0200)]
media: zoran: constify struct tvnorm

The structure tvnorm could be consified.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: add stat_com buffer
Corentin Labbe [Fri, 25 Sep 2020 18:30:42 +0000 (20:30 +0200)]
media: zoran: add stat_com buffer

Adds the allocation of the stat_com buffer which be used later.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: use devm_ioremap
Corentin Labbe [Fri, 25 Sep 2020 18:30:41 +0000 (20:30 +0200)]
media: zoran: use devm_ioremap

Using devm_ioremap simplify code.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: use pci_request_regions
Corentin Labbe [Fri, 25 Sep 2020 18:30:40 +0000 (20:30 +0200)]
media: zoran: use pci_request_regions

Use pci_request_regions so now we can see zoran in /proc/iomem.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: use devm for videocodec_master alloc
Corentin Labbe [Fri, 25 Sep 2020 18:30:39 +0000 (20:30 +0200)]
media: zoran: use devm for videocodec_master alloc

Let's use devm allocations for videocodec, this simplify code.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: convert mdelay to udelay
Corentin Labbe [Fri, 25 Sep 2020 18:30:38 +0000 (20:30 +0200)]
media: zoran: convert mdelay to udelay

As asked by checkpath, let's use udelay.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: convert zoran alloc to devm
Corentin Labbe [Fri, 25 Sep 2020 18:30:37 +0000 (20:30 +0200)]
media: zoran: convert zoran alloc to devm

Allocate the zoran structure with devm_ functions permit to simplify
code.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: convert irq to pci irq
Corentin Labbe [Fri, 25 Sep 2020 18:30:36 +0000 (20:30 +0200)]
media: zoran: convert irq to pci irq

This patch convert zoran to pci_irq functions.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: zoran does not support STD_ALL
Corentin Labbe [Fri, 25 Sep 2020 18:30:35 +0000 (20:30 +0200)]
media: zoran: zoran does not support STD_ALL

In fact, zoran does not support V4L2_STD_ALL, so let's enumerate what we
support.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: use ZR_NORM
Corentin Labbe [Fri, 25 Sep 2020 18:30:34 +0000 (20:30 +0200)]
media: zoran: use ZR_NORM

Instead of using hardcoded numbers, let's use some define for ZR NORM.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: Use DMA coherent for stat_com
Corentin Labbe [Fri, 25 Sep 2020 18:30:33 +0000 (20:30 +0200)]
media: zoran: Use DMA coherent for stat_com

Instead of using a fragile virt_to_bus, let's use proper DMA coherent
for the stat_com entry.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: remove overlay
Corentin Labbe [Fri, 25 Sep 2020 18:30:32 +0000 (20:30 +0200)]
media: zoran: remove overlay

Supporting overlay is not necessary today, so let's reduce the code size
by removing it.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: Change zoran_v4l_set_format parameter from zoran_fh to zoran
Corentin Labbe [Fri, 25 Sep 2020 18:30:31 +0000 (20:30 +0200)]
media: zoran: Change zoran_v4l_set_format parameter from zoran_fh to zoran

We need to get rid of zoran_fh, so let's change function arguments.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: Use video_drvdata to get struct zoran
Corentin Labbe [Fri, 25 Sep 2020 18:30:30 +0000 (20:30 +0200)]
media: zoran: Use video_drvdata to get struct zoran

Using video_drvdata() is proper and shorter than using directly
fh pointers.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: move overlay_settings out of zoran_fh
Corentin Labbe [Fri, 25 Sep 2020 18:30:29 +0000 (20:30 +0200)]
media: zoran: move overlay_settings out of zoran_fh

We need to get rid of zoran_fh, so move the overlay_settings directly in the
zoran structure.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: move jpg_settings out of zoran_fh
Corentin Labbe [Fri, 25 Sep 2020 18:30:28 +0000 (20:30 +0200)]
media: zoran: move jpg_settings out of zoran_fh

We need to get rid of zoran_fh, so move the jpg_settings directly in the
zoran structure.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: move v4l_settings out of zoran_fh
Corentin Labbe [Fri, 25 Sep 2020 18:30:27 +0000 (20:30 +0200)]
media: zoran: move v4l_settings out of zoran_fh

We need to get rid of zoran_fh, so move the v4l_settings directly in the
zoran structure.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: move buffer_size out of zoran_fh
Corentin Labbe [Fri, 25 Sep 2020 18:30:26 +0000 (20:30 +0200)]
media: zoran: move buffer_size out of zoran_fh

We need to get rid of zoran_fh, so move the buffer_size directly in the
zoran structure.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: do not print random guest 0
Corentin Labbe [Fri, 25 Sep 2020 18:30:25 +0000 (20:30 +0200)]
media: zoran: do not print random guest 0

The slot 0 of guest is never initialized and so we print later random
data.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: use v4l2_buffer_set_timestamp
Corentin Labbe [Fri, 25 Sep 2020 18:30:24 +0000 (20:30 +0200)]
media: zoran: use v4l2_buffer_set_timestamp

The ns_to_timeval function is removed, so replace it with
v4l2_buffer_set_timestamp().

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: use VFL_TYPE_VIDEO
Corentin Labbe [Fri, 25 Sep 2020 18:30:23 +0000 (20:30 +0200)]
media: zoran: use VFL_TYPE_VIDEO

The VFL_TYPE_GRABBER type was removed, so let's use the new type.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: remove proc_fs
Corentin Labbe [Fri, 25 Sep 2020 18:30:22 +0000 (20:30 +0200)]
media: zoran: remove proc_fs

The zoran driver give some debug information in procfs, but this is not
the right place.
So let's remove them, we will use debugfs later.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: zoran_device.c: convert pr_x to pci_x
Corentin Labbe [Fri, 25 Sep 2020 18:30:21 +0000 (20:30 +0200)]
media: zoran: zoran_device.c: convert pr_x to pci_x

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: convert dprintk debug
Corentin Labbe [Fri, 25 Sep 2020 18:30:20 +0000 (20:30 +0200)]
media: zoran: convert dprintk debug

This patch convert dprintk(debug) to pci_dbg.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: convert dprintk info to pci_info
Corentin Labbe [Fri, 25 Sep 2020 18:30:19 +0000 (20:30 +0200)]
media: zoran: convert dprintk info to pci_info

This patch convert dprintk(info) to pci_info (or pci_dbg if the message
is not important).

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: convert dprintk warn
Corentin Labbe [Fri, 25 Sep 2020 18:30:18 +0000 (20:30 +0200)]
media: zoran: convert dprintk warn

This patch convert dprintk(warn) to pci_warn.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: convert all error dprintk to pci_err/pr_err
Corentin Labbe [Fri, 25 Sep 2020 18:30:17 +0000 (20:30 +0200)]
media: zoran: convert all error dprintk to pci_err/pr_err

This patch converts all errors dprintk to pci_err/pr_err.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: do not forward declare zr36057_init_vfe
Corentin Labbe [Fri, 25 Sep 2020 18:30:16 +0000 (20:30 +0200)]
media: zoran: do not forward declare zr36057_init_vfe

move function for avoiding forward declaration

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: fix checkpatch issue
Corentin Labbe [Fri, 25 Sep 2020 18:30:15 +0000 (20:30 +0200)]
media: zoran: fix checkpatch issue

Fix a lot of style issue found by checkpatch.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: Documentation: fix typo
Corentin Labbe [Fri, 25 Sep 2020 18:30:14 +0000 (20:30 +0200)]
media: zoran: Documentation: fix typo

Fix some typo in doc.

[hverkuil: The TV encoder are -> The TV encoder is]

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: zoran: datasheet is no longer available from zoran.com
Corentin Labbe [Fri, 25 Sep 2020 18:30:13 +0000 (20:30 +0200)]
media: zoran: datasheet is no longer available from zoran.com

Simply remove this broken reference

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: MAINTAINERS: change maintainer of the zoran driver
Corentin Labbe [Fri, 25 Sep 2020 18:30:12 +0000 (20:30 +0200)]
media: MAINTAINERS: change maintainer of the zoran driver

Add myself as maintainer.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: staging: media: Revert "media: zoran: remove deprecated driver"
Corentin Labbe [Fri, 25 Sep 2020 18:30:11 +0000 (20:30 +0200)]
media: staging: media: Revert "media: zoran: remove deprecated driver"

This reverts commit 8dce4b265a5357731058f69645840dabc718c687.
The revert is slighly modified:
- Documentation/media/v4l-drivers/index.rst is ,ot restored since removed from tree
- drivers/staging/media/Makefile is not restored since the zoran driver
  is not compilable yet.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: platform: s5p-mfc: Fix adding a standard frame skip mode control
Marek Szyprowski [Mon, 28 Sep 2020 08:48:44 +0000 (10:48 +0200)]
media: platform: s5p-mfc: Fix adding a standard frame skip mode control

Add proper control type to the recently introduced
V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE control. This will forward it to
v4l2_ctrl_new_std_menu() not v4l2_ctrl_new_std(), what causes the
failure. This fixes the following warning during driver initialization:

s5p_mfc_enc_ctrls_setup:2671: Adding control (18) failed
s5p_mfc_open:811: Failed to setup mfc controls

Fixes: ef56b3ee4f54 ("media: s5p-mfc: Use standard frame skip mode control")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: vidtv: fix decoding with gstreamer and Vlc
Mauro Carvalho Chehab [Mon, 21 Sep 2020 11:33:13 +0000 (13:33 +0200)]
media: vidtv: fix decoding with gstreamer and Vlc

Neither Vlc nor Gstreamer likes the PES_scrambling_control bits.

In the case of GST, this can be seen with:

$ GST_DEBUG=2 LANG=C gst-play-1.0 pcm_audio.ts
...
0:00:00.097973439 12308 0x55f7ddd155e0 WARN               pesparser pesparse.c:411:mpegts_parse_pes_header: Wrong '0x10' marker before PES_scrambling_control (0x40)
0:00:00.097987026 12308 0x55f7ddd155e0 WARN                 tsdemux tsdemux.c:2314:gst_ts_demux_parse_pes_header: Error parsing PES header. pid: 0x111 stream_type: 0x6
...

So, change, it. After such change, the stream now plays
fine with Vlc, Gstreamer, ffmpeg - and with programs
that use such libraries, like Kaffeine.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: vidtv: rewrite the adaption field logic
Mauro Carvalho Chehab [Mon, 21 Sep 2020 08:05:30 +0000 (10:05 +0200)]
media: vidtv: rewrite the adaption field logic

When compared with a stream generated via ffmpeg, it can be
noticed that the PES doesn't contain any PCR info. That could
cause problems with userspace decoding. So, rewrite the
logic that fills the adaptation info, in order to allow it
to add PCR frames without breaking frame alignment.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: vidtv: simplify parameters for vidtv_pes_write_stuffing()
Mauro Carvalho Chehab [Mon, 21 Sep 2020 05:34:42 +0000 (07:34 +0200)]
media: vidtv: simplify parameters for vidtv_pes_write_stuffing()

Instead of passing struct pes_ts_header_write_args fields as
function parameters, just pass a pointer to the struct.

That would allow adding more args without needing to change
the function prototype.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: vidtv: fix a typo
Mauro Carvalho Chehab [Sun, 20 Sep 2020 08:14:28 +0000 (10:14 +0200)]
media: vidtv: fix a typo

optinal -> optional

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: vidtv: cleanup SDT string identifiers
Mauro Carvalho Chehab [Sun, 20 Sep 2020 07:40:45 +0000 (09:40 +0200)]
media: vidtv: cleanup SDT string identifiers

In order to better test userspace applications, add an encoding
for the strings. The original channel string is also too big.
As we're just playing the first compasses of the 5th Beethoven
Symphony, change the service name to just "Beethoven". Also,
add a provider's name. For such purpose, let's point it to
the Linux media community website.

With such changes, the SDT table now looks more like one got
from a real digital TV channel:

SDT
| table_id         0x42
| section_length      44
| one                 2
| zero                1
| syntax              1
| transport_stream_id 1860
| current_next        1
| version             0
| one2                3
| section_number      0
| last_section_number 0
| network_id          65281
| reserved            255
|\
|- service 0x0880
|   EIT schedule          0
|   EIT present following 0
|   free CA mode          0
|   running status        4
|   descriptor length     27
|        0x48: service_descriptor
|           service type  1
|           provider      'LinuxTV.org'
|           name          'Beethoven'
|_  1 services

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: vidtv: cleanup PSI version numbers
Mauro Carvalho Chehab [Sun, 20 Sep 2020 07:17:45 +0000 (09:17 +0200)]
media: vidtv: cleanup PSI version numbers

There's no reason to use static vars to store PSI version
numbers.

Also, currently, version numbers are starting with 0x01,
because there's a code being called that increases it to
1 for all table initializer code, as the code may support
dynamic changes at the PS tables on some future.

So, let's just initialize them to 0x1f, in order for the
versions to be reported as starting from 0.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: vidtv: fix initialization of the network_id field at SDT
Mauro Carvalho Chehab [Sun, 20 Sep 2020 06:34:55 +0000 (08:34 +0200)]
media: vidtv: fix initialization of the network_id field at SDT

This field should point to the network ID, and has different
ranges for cable, terrestrial or satellite. It also has
an special range for temporary private usage.

For now, let's use the temporary private one. Once the
Network Information Table (NIT) gets added, this should be
reviewed.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: vidtv: remove more ENDIAN_BITFIELD nonsense
Mauro Carvalho Chehab [Sun, 20 Sep 2020 06:25:49 +0000 (08:25 +0200)]
media: vidtv: remove more ENDIAN_BITFIELD nonsense

Changeset 870e350d4e39 ("media: vidtv: get rid of ENDIAN_BITFIELD nonsense")
was incomplete. There are still some wrong endannes logic at
the driver. Get rid of them.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: vidtv: simplify PCR logic to get jiffies
Mauro Carvalho Chehab [Sun, 20 Sep 2020 06:22:20 +0000 (08:22 +0200)]
media: vidtv: simplify PCR logic to get jiffies

There's no need to have a check when setting timing.past_jiffies,
as we can simply do the initialization earlier at vidtv_mux_init().

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: hist-v4l2.rst: remove :c:`type` from structs and enums
Mauro Carvalho Chehab [Mon, 28 Sep 2020 06:16:02 +0000 (08:16 +0200)]
media: hist-v4l2.rst: remove :c:`type` from structs and enums

Using struct|enum :c:`type` here sounds a bad idea, as it may be
documenting data types that were already removed. Also, it makes
the file harder to read.

As automarkup.py should be able to handle those cases, let's
just get rid of the markup.

While not required by automarkup, in order to make easier for
grep, both type and names are now at the same line.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: hist-v4l2.rst: remove struct duplication
Mauro Carvalho Chehab [Mon, 28 Sep 2020 06:11:34 +0000 (08:11 +0200)]
media: hist-v4l2.rst: remove struct duplication

There are several places there where struct was used twice,
on multiple lines, like:

struct
struct ``v4l2_zoomcap``

That's probably done during the DocBook to ReSt conversion.

Probably the cases where "struct struct" were at the same line
was addressed back then, but the multi-line cases are still
there.

Get rid of them.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: v4l2-subdev.h: fix a kernel-doc markup
Mauro Carvalho Chehab [Tue, 29 Sep 2020 09:15:36 +0000 (11:15 +0200)]
media: v4l2-subdev.h: fix a kernel-doc markup

As reported by Sphinx:

./Documentation/driver-api/media/v4l2-subdev:490: ./include/media/v4l2-subdev.h:384: WARNING: Unparseable C cross-reference: 'struct'
Invalid C declaration: Expected identifier in nested name, got keyword: struct [error at 6]
  struct
  ------^

The markup there is wrong:
&struct &v4l2_input -> &struct v4l2_input

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: cec-core.rst: fix warnings with Sphinx 3.0+
Mauro Carvalho Chehab [Sat, 26 Sep 2020 07:08:38 +0000 (09:08 +0200)]
media: cec-core.rst: fix warnings with Sphinx 3.0+

The new C domain code on Sphinx 3 is a lot more pedantic.
It only accepts real functions declared as c:function.

So, declarations like this are not valid:

.. c:function::
        int (*adap_enable)(struct cec_adapter *adap, bool enable);

Also, no blank lines are allowed after ".. c:function:", and
continuation lines should be like:

.. c:function:
int (void foo, \
     int bar);

Change the logic there, in order to avoid lots of warnings
when built with Sphinx 3.x.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: v4l2-subdev.rst: get rid of a duplicatd kernel-doc markup
Mauro Carvalho Chehab [Mon, 28 Sep 2020 14:21:00 +0000 (16:21 +0200)]
media: v4l2-subdev.rst: get rid of a duplicatd kernel-doc markup

There are two kernel-doc markups for include/media/v4l2-async.h,
one at v4l2-async.rst and another one at v4l2-subdev.rst.

Sphinx 3.x checks it and complains for duplicated symbols.

So, get rid of one of them.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: dvb-frontends: remove a clone of a kernel-doc markup at zd1301_demod.h
Mauro Carvalho Chehab [Fri, 25 Sep 2020 11:08:01 +0000 (13:08 +0200)]
media: dvb-frontends: remove a clone of a kernel-doc markup at zd1301_demod.h

The same markup are there twice, causing warnings with
Sphinx 3.x. Drop the second copy.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: docs: ipu3.rst: rely at automarkup extension
Mauro Carvalho Chehab [Fri, 25 Sep 2020 09:48:40 +0000 (11:48 +0200)]
media: docs: ipu3.rst: rely at automarkup extension

There are several :c:type: definitions there, in order to
do cross-references with the driver's documentation.

Those are broken when docs are built with Sphinx 3.x, as
it would require :c:struct: instead.

For Sphinx < 3.x, the automarkup.py extension is able to do the
replacement already, and a future improvement on it should make
it also work with Sphinx 3.x.

So, get rid of the usage of the :c:type: macro there.

Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: glossary.rst: use the right case for glossary entries
Mauro Carvalho Chehab [Fri, 25 Sep 2020 06:48:32 +0000 (08:48 +0200)]
media: glossary.rst: use the right case for glossary entries

Sphinx 3.x is pedantic with glossary entries:

    Documentation/userspace-api/media/glossary.rst:17: WARNING: term device driver not found in case sensitive match.made a reference to Device Driver instead.
    Documentation/userspace-api/media/glossary.rst:59: WARNING: term media hardware not found in case sensitive match.made a reference to Media Hardware instead.
    Documentation/userspace-api/media/glossary.rst:59: WARNING: term IP block not found in case sensitive match.made a reference to IP Block instead.
    Documentation/userspace-api/media/glossary.rst:64: WARNING: term hardware component not found in case sensitive match.made a reference to Hardware Component instead.
    Documentation/userspace-api/media/glossary.rst:64: WARNING: term ip block not found in case sensitive match.made a reference to IP Block instead.
    Documentation/userspace-api/media/glossary.rst:70: WARNING: term peripheral not found in case sensitive match.made a reference to Peripheral instead.
    Documentation/userspace-api/media/glossary.rst:130: WARNING: term V4L2 hardware not found in case sensitive match.made a reference to V4L2 Hardware instead.
    Documentation/userspace-api/media/glossary.rst:151: WARNING: term hardware peripheral not found in case sensitive match.made a reference to Hardware Peripheral instead.
    Documentation/userspace-api/media/glossary.rst:183: WARNING: term device node not found in case sensitive match.made a reference to Device Node instead.
    Documentation/userspace-api/media/glossary.rst:191: WARNING: term bridge driver not found in case sensitive match.made a reference to Bridge Driver instead.

While it works with case-insensitive entires, it complains.

Let's fix it, in order to cleanup the warnings. Also, I won't
doubt that a later change on Sphinx will end breaking support
for it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: camera-sensor.rst: fix a doc build warning
Mauro Carvalho Chehab [Wed, 9 Sep 2020 13:05:31 +0000 (15:05 +0200)]
media: camera-sensor.rst: fix a doc build warning

Documentation/driver-api/media/camera-sensor.rst:123: WARNING: Inline literal start-string without end-string.

There's a missing blank space over there.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agoLinux 5.9-rc7
Linus Torvalds [Sun, 27 Sep 2020 21:38:10 +0000 (14:38 -0700)]
Linux 5.9-rc7

3 years agoMerge tag 'kbuild-fixes-v5.9-4' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 27 Sep 2020 19:18:57 +0000 (12:18 -0700)]
Merge tag 'kbuild-fixes-v5.9-4' of git://git./linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild fixes from Masahiro Yamada:

 - ignore compiler stubs for PPC to fix builds

 - fix the usage of --target mentioned in the LLVM document

* tag 'kbuild-fixes-v5.9-4' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  Documentation/llvm: Fix clang target examples
  scripts/kallsyms: skip ppc compiler stub *.long_branch.* / *.plt_branch.*

3 years agoMerge tag 'x86-urgent-2020-09-27' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 27 Sep 2020 19:15:21 +0000 (12:15 -0700)]
Merge tag 'x86-urgent-2020-09-27' of git://git./linux/kernel/git/tip/tip

Pull x86 fixes from Thomas Gleixner:
 "Two fixes for the x86 interrupt code:

   - Unbreak the magic 'search the timer interrupt' logic in IO/APIC
     code which got wreckaged when the core interrupt code made the
     state tracking logic stricter.

     That caused the interrupt line to stay masked after switching from
     IO/APIC to PIC delivery mode, which obviously prevents interrupts
     from being delivered.

   - Make run_on_irqstack_code() typesafe. The function argument is a
     void pointer which is then cast to 'void (*fun)(void *).

     This breaks Control Flow Integrity checking in clang. Use proper
     helper functions for the three variants reuqired"

* tag 'x86-urgent-2020-09-27' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/ioapic: Unbreak check_timer()
  x86/irq: Make run_on_irqstack_cond() typesafe

3 years agoMerge tag 'timers-urgent-2020-09-27' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 27 Sep 2020 19:11:35 +0000 (12:11 -0700)]
Merge tag 'timers-urgent-2020-09-27' of git://git./linux/kernel/git/tip/tip

Pull timer updates from Thomas Gleixner:
 "A set of clocksource/clockevents updates:

   - Reset the TI/DM timer before enabling it instead of doing it the
     other way round.

   - Initialize the reload value for the GX6605s timer correctly so the
     hardware counter starts at 0 again after overrun.

   - Make error return value negative in the h8300 timer init function"

* tag 'timers-urgent-2020-09-27' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  clocksource/drivers/timer-gx6605s: Fixup counter reload
  clocksource/drivers/timer-ti-dm: Do reset before enable
  clocksource/drivers/h8300_timer8: Fix wrong return value in h8300_8timer_init()

3 years agomm/thp: Split huge pmds/puds if they're pinned when fork()
Peter Xu [Fri, 25 Sep 2020 22:26:00 +0000 (18:26 -0400)]
mm/thp: Split huge pmds/puds if they're pinned when fork()

Pinned pages shouldn't be write-protected when fork() happens, because
follow up copy-on-write on these pages could cause the pinned pages to
be replaced by random newly allocated pages.

For huge PMDs, we split the huge pmd if pinning is detected.  So that
future handling will be done by the PTE level (with our latest changes,
each of the small pages will be copied).  We can achieve this by let
copy_huge_pmd() return -EAGAIN for pinned pages, so that we'll
fallthrough in copy_pmd_range() and finally land the next
copy_pte_range() call.

Huge PUDs will be even more special - so far it does not support
anonymous pages.  But it can actually be done the same as the huge PMDs
even if the split huge PUDs means to erase the PUD entries.  It'll
guarantee the follow up fault ins will remap the same pages in either
parent/child later.

This might not be the most efficient way, but it should be easy and
clean enough.  It should be fine, since we're tackling with a very rare
case just to make sure userspaces that pinned some thps will still work
even without MADV_DONTFORK and after they fork()ed.

Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
3 years agomm: Do early cow for pinned pages during fork() for ptes
Peter Xu [Fri, 25 Sep 2020 22:25:59 +0000 (18:25 -0400)]
mm: Do early cow for pinned pages during fork() for ptes

This allows copy_pte_range() to do early cow if the pages were pinned on
the source mm.

Currently we don't have an accurate way to know whether a page is pinned
or not.  The only thing we have is page_maybe_dma_pinned().  However
that's good enough for now.  Especially, with the newly added
mm->has_pinned flag to make sure we won't affect processes that never
pinned any pages.

It would be easier if we can do GFP_KERNEL allocation within
copy_one_pte().  Unluckily, we can't because we're with the page table
locks held for both the parent and child processes.  So the page
allocation needs to be done outside copy_one_pte().

Some trick is there in copy_present_pte(), majorly the wrprotect trick
to block concurrent fast-gup.  Comments in the function should explain
better in place.

Oleg Nesterov reported a (probably harmless) bug during review that we
didn't reset entry.val properly in copy_pte_range() so that potentially
there's chance to call add_swap_count_continuation() multiple times on
the same swp entry.  However that should be harmless since even if it
happens, the same function (add_swap_count_continuation()) will return
directly noticing that there're enough space for the swp counter.  So
instead of a standalone stable patch, it is touched up in this patch
directly.

Link: https://lore.kernel.org/lkml/20200914143829.GA1424636@nvidia.com/
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
3 years agomm/fork: Pass new vma pointer into copy_page_range()
Peter Xu [Fri, 25 Sep 2020 22:25:58 +0000 (18:25 -0400)]
mm/fork: Pass new vma pointer into copy_page_range()

This prepares for the future work to trigger early cow on pinned pages
during fork().

No functional change intended.

Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
3 years agomm: Introduce mm_struct.has_pinned
Peter Xu [Fri, 25 Sep 2020 22:25:57 +0000 (18:25 -0400)]
mm: Introduce mm_struct.has_pinned

(Commit message majorly collected from Jason Gunthorpe)

Reduce the chance of false positive from page_maybe_dma_pinned() by
keeping track if the mm_struct has ever been used with pin_user_pages().
This allows cases that might drive up the page ref_count to avoid any
penalty from handling dma_pinned pages.

Future work is planned, to provide a more sophisticated solution, likely
to turn it into a real counter.  For now, make it atomic_t but use it as
a boolean for simplicity.

Suggested-by: Jason Gunthorpe <jgg@ziepe.ca>
Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
3 years agomedia: MAINTAINERS: remove Maxime Jourdan as maintainer of Amlogic VDEC
Neil Armstrong [Wed, 23 Sep 2020 16:09:10 +0000 (18:09 +0200)]
media: MAINTAINERS: remove Maxime Jourdan as maintainer of Amlogic VDEC

Maxime is no more a BayLibre employee, and his e-mail address is now
invalid.

I'll be happy to add him back using another e-mail address if he wants
to continue maintaining this driver.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: staging: rkisp1: cap: protect access to buf with the spin lock
Dafna Hirschfeld [Tue, 22 Sep 2020 11:34:02 +0000 (13:34 +0200)]
media: staging: rkisp1: cap: protect access to buf with the spin lock

The function 'rkisp1_stream_start' calls 'rkisp1_set_next_buf'
which access the buffers, so the call should be protected by
taking the cap->buf.lock.
After this patch, all locks are reviewed and commented so remove
the TODO item "review and comment every lock"

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: staging: rkisp1: use the right variants of spin_lock
Dafna Hirschfeld [Tue, 22 Sep 2020 11:34:01 +0000 (13:34 +0200)]
media: staging: rkisp1: use the right variants of spin_lock

When locking, use either 'spin_lock' or 'spin_lock_irq'
according to the context. There is nowhere need to
use 'spin_lock_irqsave'.
Outside of irq context, always use 'spin_lock_irq'
to be on the safe side.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: staging: rkisp1: params: no need to lock default config
Dafna Hirschfeld [Tue, 22 Sep 2020 11:34:00 +0000 (13:34 +0200)]
media: staging: rkisp1: params: no need to lock default config

In the function 'rkisp1_params_config_parameter' the lock
is taken while applying the default config. But the lock
only needs to protect the buffers list and the 'is_streaming'
field, so move the locking to lock only what is needed.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: staging: rkisp1: stats: protect write to 'is_streaming' in start_streaming cb
Dafna Hirschfeld [Tue, 22 Sep 2020 11:33:59 +0000 (13:33 +0200)]
media: staging: rkisp1: stats: protect write to 'is_streaming' in start_streaming cb

The field stats->is_streaming is written in 'start_streaming' callback
without the stats->lock protection.
The isr might run together with the callback so 'spin_lock_irq'
should be used.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
3 years agomedia: staging: rkisp1: isp: don't enable signal RKISP1_CIF_ISP_FRAME_IN
Dafna Hirschfeld [Tue, 22 Sep 2020 11:33:58 +0000 (13:33 +0200)]
media: staging: rkisp1: isp: don't enable signal RKISP1_CIF_ISP_FRAME_IN

The signal RKISP1_CIF_ISP_FRAME_IN is not used in the isr so
there is no need to enable it.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>