platform/kernel/linux-starfive.git
8 years ago[media] rc: ir-raw: change type of available_protocols to atomic64_t
Heiner Kallweit [Tue, 27 Sep 2016 19:48:47 +0000 (16:48 -0300)]
[media] rc: ir-raw: change type of available_protocols to atomic64_t

Changing available_protocols to atomic64_t allows to get rid of the
mutex protecting access to the variable. This helps to simplify
the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] VPU: mediatek: Fix return value in case of error
Christophe JAILLET [Fri, 23 Sep 2016 21:19:01 +0000 (18:19 -0300)]
[media] VPU: mediatek: Fix return value in case of error

If 'dma_alloc_coherent()' returns NULL, 'vpu_alloc_ext_mem()' will
return 0 which means success.
Return -ENOMEM instead.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] media: platform: pxa_camera: add missing sensor power on
Robert Jarzmik [Fri, 23 Sep 2016 18:41:39 +0000 (15:41 -0300)]
[media] media: platform: pxa_camera: add missing sensor power on

During sensors binding, there is a window where the sensor is switched
off, while there is a call it to set a new format, which can end up in
an access to the sensor, especially an I2C based sensor.

Remove this window by activating the sensor.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] tw5864: crop picture width to 704
Andrey Utkin [Thu, 22 Sep 2016 00:04:20 +0000 (21:04 -0300)]
[media] tw5864: crop picture width to 704

Previously, width of 720 was used, but it gives 16-pixel wide black bar
at right side of encoded picture.

Signed-off-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] cx88: fix error return code in cx8802_dvb_probe()
Wei Yongjun [Wed, 21 Sep 2016 15:12:58 +0000 (12:12 -0300)]
[media] cx88: fix error return code in cx8802_dvb_probe()

Fix to return error code -ENODEV from the error handling case
instead of 0(err maybe overwrited to 0 in the for loop), as
done elsewhere in this function.

[mchehab@s-opensource.com: remove a now uneeded set for err = -ENODEV]

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] bdisp: fix error return code in bdisp_probe()
Wei Yongjun [Wed, 21 Sep 2016 15:09:38 +0000 (12:09 -0300)]
[media] bdisp: fix error return code in bdisp_probe()

Fix to return error code -EINVAL from the platform_get_resource() error
handling case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Fabien Dessenne <fabien.dessenne@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] gs1662: drop kfree for memory allocated with devm_kzalloc
Wei Yongjun [Wed, 21 Sep 2016 13:09:39 +0000 (10:09 -0300)]
[media] gs1662: drop kfree for memory allocated with devm_kzalloc

It's not necessary to free memory allocated with devm_kzalloc
and using kfree leads to a double free.

Fixes: 7aae6e2df127 ("[media] Add GS1662 driver, a video serializer")

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] gs1662: remove .owner field for driver
Wei Yongjun [Wed, 21 Sep 2016 13:09:23 +0000 (10:09 -0300)]
[media] gs1662: remove .owner field for driver

Remove .owner field if calls are used which set it automatically.

Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] platform: pxa_camera: add VIDEO_V4L2 dependency
Arnd Bergmann [Mon, 19 Sep 2016 12:46:30 +0000 (09:46 -0300)]
[media] platform: pxa_camera: add VIDEO_V4L2 dependency

Moving the pxa_camera driver from soc_camera lots the implied
VIDEO_V4L2 Kconfig dependency, and building the driver without
V4L2 results in a kernel that cannot link:

drivers/media/platform/pxa_camera.o: In function `pxa_camera_remove':
pxa_camera.c:(.text.pxa_camera_remove+0x10): undefined reference to `v4l2_clk_unregister'
pxa_camera.c:(.text.pxa_camera_remove+0x18): undefined reference to `v4l2_device_unregister'
drivers/media/platform/pxa_camera.o: In function `pxa_camera_probe':
pxa_camera.c:(.text.pxa_camera_probe+0x458): undefined reference to `v4l2_of_parse_endpoint'
drivers/media/v4l2-core/videobuf2-core.o: In function `__enqueue_in_driver':
drivers/media/v4l2-core/videobuf2-core.o: In function `vb2_core_streamon':
videobuf2-core.c:(.text.vb2_core_streamon+0x1b4): undefined reference to `v4l_vb2q_enable_media_source'
drivers/media/v4l2-core/videobuf2-v4l2.o: In function `vb2_ioctl_reqbufs':
videobuf2-v4l2.c:(.text.vb2_ioctl_reqbufs+0xc): undefined reference to `video_devdata'

This adds back an explicit dependency.

Fixes: 3050b9985024 ("[media] media: platform: pxa_camera: move pxa_camera out of soc_camera")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] lirc_imon: use complete() instead complete_all()
Daniel Wagner [Fri, 16 Sep 2016 11:18:22 +0000 (08:18 -0300)]
[media] lirc_imon: use complete() instead complete_all()

There is only one waiter for the completion, therefore there
is no need to use complete_all(). Let's make that clear by
using complete() instead of complete_all().

While we are at it, we do a small optimization with the
reinitialization of the completion before we use it.

The usage pattern of the completion is:

waiter context                          waker context

send_packet()
  reinit_completion()
  usb_sumbit_urb()
  wait_for_completion_interruptible()

                                        usb_tx_callback()
                                          complete()

                                        imon_disconnect()
                                          complete()

Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] imon: use complete() instead of complete_all()
Daniel Wagner [Fri, 16 Sep 2016 11:18:21 +0000 (08:18 -0300)]
[media] imon: use complete() instead of complete_all()

There is only one waiter for the completion, therefore there is no need
to use complete_all(). Let's make that clear by using complete() instead
of complete_all().

While we are at it, we do a small optimization with the reinitialization
of the completion before we use it.

The usage pattern of the completion is:

waiter context                          waker context

send_packet()
  init_completion()
  usb_submit_urb()
  wait_for_completion_interruptible()

                                        usb_tx_callback()
                                          complete()

                                        imon_disonnect()
                                          complete()

Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] ad5820: Fix sparse warning
Sakari Ailus [Fri, 16 Sep 2016 10:16:30 +0000 (07:16 -0300)]
[media] ad5820: Fix sparse warning

Use a type with explicit endianness in machine to big endian conversion.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] media: adv7604: automatic "default-input" selection
Ulrich Hecht [Thu, 22 Sep 2016 13:19:00 +0000 (10:19 -0300)]
[media] media: adv7604: automatic "default-input" selection

Documentation states that the "default-input" property should reside
directly in the node of the device.  This adjusts the parsing to make the
implementation consistent with the documentation.

Based on patch by William Towle <william.towle@codethink.co.uk>.

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] media: adv7604: fix bindings inconsistency for default-input
Ulrich Hecht [Thu, 22 Sep 2016 13:18:59 +0000 (10:18 -0300)]
[media] media: adv7604: fix bindings inconsistency for default-input

The text states that default-input is an endpoint property, but in the
example it is a device property.

The default input is a property of the chip, not of a particular port, so
the example makes more sense.

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] media: i2c: tvp514x: Reported mbus format should be MEDIA_BUS_FMT_UYVY8_2X8
Benoit Parrot [Wed, 14 Sep 2016 20:03:13 +0000 (17:03 -0300)]
[media] media: i2c: tvp514x: Reported mbus format should be MEDIA_BUS_FMT_UYVY8_2X8

The advertised V4L2 pixel format and Media Bus code don't match.
The current media bud code advertised is MEDIA_BUS_FMT_YUYV8_2X8
which does not reflect what the encoder actually outputs.
This encoder generate MEDIA_BUS_FMT_UYVY8_2X8 so advertise as such.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] ite-cir: initialize use_demodulator before using it
Nicolas Iooss [Sat, 10 Sep 2016 16:59:49 +0000 (13:59 -0300)]
[media] ite-cir: initialize use_demodulator before using it

Function ite_set_carrier_params() uses variable use_demodulator after
having initialized it to false in some if branches, but this variable is
never set to true otherwise.

This bug has been found using clang -Wsometimes-uninitialized warning
flag.

Fixes: 620a32bba4a2 ("[media] rc: New rc-based ite-cir driver for
several ITE CIRs")

Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] mb86a20s: always initialize a return value
Nicolas Iooss [Sat, 10 Sep 2016 16:49:01 +0000 (13:49 -0300)]
[media] mb86a20s: always initialize a return value

In mb86a20s_read_status_and_stats(), when mb86a20s_read_status() fails,
the function returns the value in variable rc without initializing it
first. Fix this by propagating the error code from variable status_nr.

This bug has been found using clang and -Wsometimes-uninitialized
warning flag.

Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] dvb-usb-dvbsky: Add support for TechnoTrend S2-4650 CI
Olli Salonen [Fri, 9 Sep 2016 19:24:54 +0000 (16:24 -0300)]
[media] dvb-usb-dvbsky: Add support for TechnoTrend S2-4650 CI

TechnoTrend TT-connect S2-4650 CI seems to be a variation of
the DVBSky S960CI device.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] variable name is never null, so remove null check
Colin Ian King [Tue, 6 Sep 2016 12:44:09 +0000 (09:44 -0300)]
[media] variable name is never null, so remove null check

The variable name is always assigned to a literal string in the
proceeding switch statement, so it is never null and hence the
null check is redundant. Remove null the check.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
8 years ago[media] coda: add missing header dependencies
Baoyou Xie [Tue, 6 Sep 2016 07:50:56 +0000 (04:50 -0300)]
[media] coda: add missing header dependencies

We get 1 warning when building kernel with W=1:
drivers/media/platform/coda/coda-h264.c:22:5: warning: no previous prototype for 'coda_h264_padding' [-Wmissing-prototypes]

In fact, this function is declared in coda.h, so this patch
add missing header dependencies.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
8 years ago[media] cx24120: do not allow an invalid delivery system types
Colin Ian King [Sat, 3 Sep 2016 17:04:17 +0000 (14:04 -0300)]
[media] cx24120: do not allow an invalid delivery system types

cx24120_set_frontend currently allows invalid delivery system types
other than SYS_DVBS2 and SYS_DVBS.  Fix this by returning -EINVAL
for invalid values.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Jemma Denson <jdenson@gmail.com>
8 years ago[media] Add support for EVOLVEO XtraTV stick
CIJOML CIJOMLovic [Mon, 1 Aug 2016 21:55:52 +0000 (18:55 -0300)]
[media] Add support for EVOLVEO XtraTV stick

Add a new USB ID for EVOLVEO XtraTV stick.

[mchehab@s-opensource.org: fix patch and make checkpatch happy]
Cc: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] uvcvideo: uvc_scan_fallback() for webcams with broken chain
Henrik Ingo [Sun, 29 May 2016 20:58:00 +0000 (17:58 -0300)]
[media] uvcvideo: uvc_scan_fallback() for webcams with broken chain

Some devices have invalid baSourceID references, causing uvc_scan_chain()
to fail, but if we just take the entities we can find and put them
together in the most sensible chain we can think of, turns out they do
work anyway. Note: This heuristic assumes there is a single chain.

At the time of writing, devices known to have such a broken chain are
  - Acer Integrated Camera (5986:055a)
  - Realtek rtl157a7 (0bda:57a7)

Signed-off-by: Henrik Ingo <henrik.ingo@avoinelama.fi>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] cardlist: convert them to asciiart tables
Mauro Carvalho Chehab [Sun, 23 Oct 2016 10:29:16 +0000 (08:29 -0200)]
[media] cardlist: convert them to asciiart tables

Instead of using codeblock for the cardlists, use tables, in
order to improve their visual when presenting them.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] gspca-cardlist.rst: update camera names
Mauro Carvalho Chehab [Sat, 22 Oct 2016 21:51:05 +0000 (19:51 -0200)]
[media] gspca-cardlist.rst: update camera names

For those cameras that were missing descriptions, update using
some web research:
https://cateee.net/lkddb/web-lkddb/USB_GSPCA_STV0680.html
https://cateee.net/lkddb/web-lkddb/USB_GSPCA_ZC3XX.html
https://cateee.net/lkddb/web-lkddb/USB_GSPCA_KINECT.html
https://cateee.net/lkddb/web-lkddb/USB_GSPCA_SPCA561.html
https://cateee.net/lkddb/web-lkddb/USB_GSPCA_VICAM.html
https://cateee.net/lkddb/web-lkddb/USB_GSPCA_DTCS033.html
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/564979
https://cateee.net/lkddb/web-lkddb/USB_GSPCA_PAC7302.html
https://cateee.net/lkddb/web-lkddb/USB_GSPCA_SONIXB.html
https://cateee.net/lkddb/web-lkddb/USB_GSPCA_SONIXJ.html

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] gspca-cardlist.rst: update cardlist from drivers USB IDs
Mauro Carvalho Chehab [Sat, 22 Oct 2016 21:47:30 +0000 (19:47 -0200)]
[media] gspca-cardlist.rst: update cardlist from drivers USB IDs

There are several missing USB IDs that are defined on gspca
drivers. Add them.

The missing entries were found/created using the following script:

<script>
use strict;
use File::Find;

my $src = "drivers/media/usb/gspca/";
my $table = 0;
my %data;

my $id;

my $len = 0;

open IN, "Documentation/media/v4l-drivers/gspca-cardlist.rst";
while (<IN>) {
if (m/^=+\s+=+\s+=+$/) {
$table++;
next;
}
next if ($table != 2);
if (m/^(\S+)\s+(\S+)\s+(.*)/) {
$id = "$1_$2";
$data{$id}->{driver} = $1;
$data{$id}->{usb_id} = $2;
$data{$id}->{name} = $3;
$data{$id}->{valid} = 0;

$len = length($3) if (length($3) > $len);
}
}
close IN;

sub parse_dir {
        my $file = $File::Find::name;

open IN, $file;

my $driver = $file;

$driver =~ s,($src),,;

$driver =~ s,/.*,,;
$driver =~ s,\.c$,,;

while (<IN>) {
next if (m,/\*.*USB_DEVICE,);
if (m/USB_DEVICE[^\(]*\(\s*0x(\S+)\s*\,\s*0x(\S+)\)(.*)/) {
my $n = "$1:$2";
my $o = $3;
$id = "${driver}_$n";

$data{$id}->{valid} = 1;

next if (defined $data{$id}->{driver});

$data{$id}->{driver} = $driver;
$data{$id}->{usb_id} = $n;

if ($o =~ m,\/\*\s*(.*)\*\/,) {
$n = $1;
$n =~ s/\s+//;
$data{$id}->{name} = $n;
} else {
$data{$id}->{name} = "";
}
}
}
close IN;
}

find({wanted => \&parse_dir, no_chdir => 1}, $src);

print "The gspca cards list\n";
print "====================\n\n";
print "The modules for the gspca webcam drivers are:\n\n";
print "- gspca_main: main driver\n";
print "- gspca\\_\\ *driver*: subdriver module with *driver* as follows\n\n";
print "========= ========= " . "=" x $len . "\n";
print "*driver* vend:prod Device\n";
print "========= ========= " . "=" x $len . "\n";

foreach my $id (sort { $data{$a}->{usb_id} . $data{$a}->{driver} cmp $data{$b}->{usb_id} . $data{$b}->{driver} } keys %data) {
next if (!$data{$id}->{valid});

my $s = sprintf "%-15s %s\t%s\n",
$data{$id}->{driver}, $data{$id}->{usb_id}, $data{$id}->{name};

# Replace tabs by spaces
$s =~ s/[ \t]+$//;
        $s =~ s<^ {8}> <\t>;
        $s =~ s<^ {1,7}\t> <\t>;
        $s =~ s< {1,7}\t> <\t>;

printf $s;
}
print "========= ========= " . "=" x $len . "\n";
</script>

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] gspca-cardlist.rst: sort entries and adjust table margins
Mauro Carvalho Chehab [Sat, 22 Oct 2016 21:29:26 +0000 (19:29 -0200)]
[media] gspca-cardlist.rst: sort entries and adjust table margins

Some entries are out of order.

While here, clear spaces/tabs.

The content remains the same, with the exeption of one duplicated
entry from the same driver, where two different brand names share
the same entry. The content of such cell was merged, using a
comma.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] stv06xx: store device name after the USB_DEVICE line
Mauro Carvalho Chehab [Sat, 22 Oct 2016 21:59:57 +0000 (19:59 -0200)]
[media] stv06xx: store device name after the USB_DEVICE line

That makes easier to parse the names, in order to sync it
with gspca-cardlist.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] spca506: rewrite a commented line to avoid wrong parsing
Mauro Carvalho Chehab [Sat, 22 Oct 2016 22:45:23 +0000 (20:45 -0200)]
[media] spca506: rewrite a commented line to avoid wrong parsing

Keeping Documentation/media/v4l-drivers/gspca-cardlist.rst in
sync with the gspca script requires a parser. Simplify the
commented line, to make the parser work better.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] v4l: vsp1: Add support for capture and output in HSV formats
Laurent Pinchart [Wed, 7 Sep 2016 00:04:53 +0000 (21:04 -0300)]
[media] v4l: vsp1: Add support for capture and output in HSV formats

Support both the HSV24 and HSV32 formats. From a hardware point of view
pretend the formats are RGB, the RPF and WPF will just pass the data
through without performing any processing.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] vivid: Add support for HSV encoding
Ricardo Ribalda Delgado [Mon, 18 Jul 2016 12:16:15 +0000 (09:16 -0300)]
[media] vivid: Add support for HSV encoding

Support HSV encoding. Most of the logic is replicated from ycbcr_enc.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] Documentation: Add HSV encodings
Ricardo Ribalda Delgado [Thu, 18 Aug 2016 14:33:37 +0000 (11:33 -0300)]
[media] Documentation: Add HSV encodings

Describe the hsv_enc field and its use.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] videodev2.h Add HSV encoding
Ricardo Ribalda Delgado [Mon, 22 Aug 2016 09:28:07 +0000 (06:28 -0300)]
[media] videodev2.h Add HSV encoding

Some hardware maps the Hue between 0 and 255 instead of 0-179. Support
this format with a new field hsv_enc.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] vivid: Local optimization
Ricardo Ribalda Delgado [Sat, 16 Jul 2016 09:34:19 +0000 (06:34 -0300)]
[media] vivid: Local optimization

Avoid duplicated clamps when possible.

Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] vivid: Fix YUV555 and YUV565 handling
Ricardo Ribalda Delgado [Sat, 16 Jul 2016 09:26:23 +0000 (06:26 -0300)]
[media] vivid: Fix YUV555 and YUV565 handling

precalculate_color() had a optimization that avoided duplicated
conversion for YUV formats. This optimization did not take into
consideration YUV444, YUV555, YUV565 or limited range quantization.

This patch keeps the optimization, but fixes the wrong handling.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] vivid: Introduce TPG_COLOR_ENC_LUMA
Ricardo Ribalda Delgado [Sat, 16 Jul 2016 08:58:09 +0000 (05:58 -0300)]
[media] vivid: Introduce TPG_COLOR_ENC_LUMA

Simplifies handling of Gray formats.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] vivid: Rename variable
Ricardo Ribalda Delgado [Fri, 15 Jul 2016 13:21:46 +0000 (10:21 -0300)]
[media] vivid: Rename variable

r_y and g_u now also contain the H and V components on the HSV formats.
Rename the variables to reflect this.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] vivid: Add support for HSV formats
Ricardo Ribalda Delgado [Fri, 15 Jul 2016 13:20:08 +0000 (10:20 -0300)]
[media] vivid: Add support for HSV formats

This patch adds support for V4L2_PIX_FMT_HSV24 and V4L2_PIX_FMT_HSV32.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] vivid: Code refactor for color encoding
Ricardo Ribalda Delgado [Fri, 15 Jul 2016 09:09:47 +0000 (06:09 -0300)]
[media] vivid: Code refactor for color encoding

Replace is_yuv with color_enc Which can be used by other
color encodings such us HSV.

This change should ease the review of the following patches.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] Documentation: Add Ricardo Ribalda
Ricardo Ribalda Delgado [Fri, 15 Jul 2016 16:04:51 +0000 (13:04 -0300)]
[media] Documentation: Add Ricardo Ribalda

My initials were on the Changelog, but there was no link to my name.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] Documentation: Add HSV format
Ricardo Ribalda Delgado [Thu, 18 Aug 2016 14:33:28 +0000 (11:33 -0300)]
[media] Documentation: Add HSV format

Describe the HSV formats

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] videodev2.h Add HSV formats
Ricardo Ribalda Delgado [Thu, 18 Aug 2016 14:33:27 +0000 (11:33 -0300)]
[media] videodev2.h Add HSV formats

These formats store the color information of the image
in a geometrical representation. The colors are mapped into a
cylinder, where the angle is the HUE, the height is the VALUE
and the distance to the center is the SATURATION. This is a very
useful format for image segmentation algorithms.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] smiapp: Implement support for autosuspend
Sakari Ailus [Wed, 14 Sep 2016 15:29:23 +0000 (12:29 -0300)]
[media] smiapp: Implement support for autosuspend

Delay suspending the device by 1000 ms by default. This is done on
explicit power off through s_power() callback, through releasing the
file descriptor, NVM read or when the probe finishes.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] smiapp: Use runtime PM
Sakari Ailus [Tue, 13 Sep 2016 13:01:03 +0000 (10:01 -0300)]
[media] smiapp: Use runtime PM

Switch to runtime PM in sensor power management. The internal power count
is thus removed.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] smiapp: Set use suspend and resume ops for other functions
Sakari Ailus [Wed, 14 Sep 2016 14:58:17 +0000 (11:58 -0300)]
[media] smiapp: Set use suspend and resume ops for other functions

Use the suspend and resume ops for freeze, thaw, poweroff and restore
callbacks as well.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] smiapp: Set device for pixel array and binner
Sakari Ailus [Tue, 13 Sep 2016 22:16:32 +0000 (19:16 -0300)]
[media] smiapp: Set device for pixel array and binner

The dev field of the v4l2_subdev was left NULL for the pixel array and
binner sub-devices. Fix this.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] smiapp: Drop BUG_ON() in suspend path
Sakari Ailus [Tue, 13 Sep 2016 14:25:42 +0000 (11:25 -0300)]
[media] smiapp: Drop BUG_ON() in suspend path

Checking that the mutex is not acquired is unnecessary for user processes
are stopped by this point. Drop the check.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] smiapp-pll: Don't complain aloud about failing PLL calculation
Sakari Ailus [Thu, 8 Sep 2016 13:50:07 +0000 (10:50 -0300)]
[media] smiapp-pll: Don't complain aloud about failing PLL calculation

Don't complain about a failure to compute the pre_pll divisor. The
function is used to determine whether a particular combination of bits per
sample value and a link frequency can be used, in which case there are
lots of unnecessary driver messages. During normal operation the failure
generally does not happen. Use dev_dbg() instead.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] smiapp: Drop a debug print on frame size and bit depth
Sakari Ailus [Thu, 8 Sep 2016 12:08:26 +0000 (09:08 -0300)]
[media] smiapp: Drop a debug print on frame size and bit depth

The first time the sensor is powered on, the information is not yet
available.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] smiapp: Obtain correct media bus code for try format
Sakari Ailus [Thu, 8 Sep 2016 08:49:27 +0000 (05:49 -0300)]
[media] smiapp: Obtain correct media bus code for try format

The media bus code obtained for try format may have been a code that the
sensor did not even support. Use a supported code with the current pixel
order.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] smiapp: Remove useless newlines and other small cleanups
Sakari Ailus [Thu, 8 Sep 2016 08:46:47 +0000 (05:46 -0300)]
[media] smiapp: Remove useless newlines and other small cleanups

The code probably has been unindented at some point but rewrapping has not
been done. Do it now.

Also remove a useless memory allocation failure message.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] smiapp: Improve debug messages from frame layout reading
Sakari Ailus [Wed, 7 Sep 2016 12:53:42 +0000 (09:53 -0300)]
[media] smiapp: Improve debug messages from frame layout reading

Provide more debugging information on reading the frame layout.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] smiapp: Obtain frame layout from the frame descriptor
Sakari Ailus [Mon, 5 Sep 2016 11:18:34 +0000 (08:18 -0300)]
[media] smiapp: Obtain frame layout from the frame descriptor

Besides the image data, SMIA++ compliant sensors also provide embedded
data in form of registers used to capture the image. Store this
information for later use in frame descriptor and routing.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] smiapp: Use SMIAPP_PADS when referring to number of pads
Sakari Ailus [Wed, 7 Sep 2016 11:39:52 +0000 (08:39 -0300)]
[media] smiapp: Use SMIAPP_PADS when referring to number of pads

Replace plain value 2 with SMIAPP_PADS when referring to the number of
pads.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] smiapp: Unify setting up sub-devices
Sakari Ailus [Wed, 7 Sep 2016 11:55:34 +0000 (08:55 -0300)]
[media] smiapp: Unify setting up sub-devices

The initialisation of the source sub-device is somewhat different as it's
not created by the smiapp driver itself. Remove redundancy in initialising
the two kind of sub-devices.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] smiapp: Read frame format earlier
Sakari Ailus [Wed, 7 Sep 2016 10:37:47 +0000 (07:37 -0300)]
[media] smiapp: Read frame format earlier

The information gathered during frame format reading will be required
earlier in the initialisation when it was available. Also return an error
if frame format cannot be obtained.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] smiapp: Merge smiapp_init() with smiapp_probe()
Sakari Ailus [Mon, 12 Sep 2016 09:44:35 +0000 (06:44 -0300)]
[media] smiapp: Merge smiapp_init() with smiapp_probe()

The smiapp_probe() is the sole caller of smiapp_init(). Unify the two.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] smiapp: Fix resource management in registration failure
Sakari Ailus [Mon, 19 Sep 2016 21:41:14 +0000 (18:41 -0300)]
[media] smiapp: Fix resource management in registration failure

If the registered() callback failed, resources were left unaccounted for.
Fix this, as well as add unregistering the sub-devices in driver
unregistered() callback.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] smiapp: Always initialise the sensor in probe
Sakari Ailus [Wed, 7 Sep 2016 09:40:13 +0000 (06:40 -0300)]
[media] smiapp: Always initialise the sensor in probe

Initialise the sensor in probe. The reason why it wasn't previously done
in case of platform data was that the probe() of the driver that provided
the clock through the set_xclk() callback would need to finish before the
probe() function of the smiapp driver. The set_xclk() callback no longer
exists.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] smiapp: Remove unnecessary BUG_ON()'s
Sakari Ailus [Tue, 6 Sep 2016 12:51:17 +0000 (09:51 -0300)]
[media] smiapp: Remove unnecessary BUG_ON()'s

Instead, calculate how much is needed and then allocate the memory
dynamically.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] smiapp: Provide a common function to obtain native pixel array size
Sakari Ailus [Mon, 5 Sep 2016 15:15:15 +0000 (12:15 -0300)]
[media] smiapp: Provide a common function to obtain native pixel array size

The same pixel array size is required for the active format of each
sub-device sink pad and try format of each sink pad of each opened file
handle as well as for the native size rectangle.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] smiapp: Split off sub-device registration into two
Sakari Ailus [Mon, 5 Sep 2016 13:21:10 +0000 (10:21 -0300)]
[media] smiapp: Split off sub-device registration into two

Remove the loop in sub-device registration and create each sub-device
explicitly instead.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] smiapp: Initialise media entity after sensor init
Sakari Ailus [Mon, 5 Sep 2016 13:04:52 +0000 (10:04 -0300)]
[media] smiapp: Initialise media entity after sensor init

This allows determining the number of pads in the entity based on the
sensor.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] smiapp: Explicitly define number of pads in initialisation
Sakari Ailus [Mon, 5 Sep 2016 13:02:09 +0000 (10:02 -0300)]
[media] smiapp: Explicitly define number of pads in initialisation

Define the number of pads explicitly in initialising the sub-devices.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] smiapp: Move sub-device initialisation into a separate function
Sakari Ailus [Mon, 5 Sep 2016 12:39:45 +0000 (09:39 -0300)]
[media] smiapp: Move sub-device initialisation into a separate function

Simplify smiapp_init() by moving the initialisation of individual
sub-devices to a separate function.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] mtk-mdp: fix double mutex_unlock
Hans Verkuil [Mon, 19 Sep 2016 08:00:34 +0000 (05:00 -0300)]
[media] mtk-mdp: fix double mutex_unlock

Fix smatch error:

media-git/drivers/media/platform/mtk-mdp/mtk_mdp_vpu.c:100 mtk_mdp_vpu_send_msg() error: double unlock 'mutex:&ctx->mdp_dev->vpulock'

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] pixfmt-reserved.rst: Improve MT21C documentation
Hans Verkuil [Mon, 19 Sep 2016 07:22:20 +0000 (04:22 -0300)]
[media] pixfmt-reserved.rst: Improve MT21C documentation

Improve the MT21C documentation, making it clearer that this format
requires the MDP for further processing.

Also fix the fourcc (it was a fivecc :-) )

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] media: mtk-mdp: fix build error
Minghsiu Tsai [Mon, 19 Sep 2016 06:34:43 +0000 (03:34 -0300)]
[media] media: mtk-mdp: fix build error

This patch fix build error without CONFIG_PM_RUNTIME
and CONFIG_PM_SLEEP

Signed-off-by: Minghsiu Tsai <minghsiu.tsai@mediatek.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] media: mtk-mdp: fix build warning in arch x86
Minghsiu Tsai [Mon, 19 Sep 2016 06:34:42 +0000 (03:34 -0300)]
[media] media: mtk-mdp: fix build warning in arch x86

This patch fix build warning in arch x86

Signed-off-by: Minghsiu Tsai <minghsiu.tsai@mediatek.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] media: mtk-mdp: add Maintainers entry for Mediatek MDP driver
Minghsiu Tsai [Thu, 8 Sep 2016 13:09:06 +0000 (10:09 -0300)]
[media] media: mtk-mdp: add Maintainers entry for Mediatek MDP driver

Add Minghsiu Tsai, Houlong Wei and Andrew-CT Chen as
maintainers for Mediatek MDP driver

Signed-off-by: Minghsiu Tsai <minghsiu.tsai@mediatek.com>
Signed-off-by: Houlong Wei <houlong.wei@mediatek.com>
Signed-off-by: Andrew-CT Chen <andrew-ct.chen@mediatek.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] media: mtk-mdp: support pixelformat V4L2_PIX_FMT_MT21C
Minghsiu Tsai [Thu, 8 Sep 2016 13:09:05 +0000 (10:09 -0300)]
[media] media: mtk-mdp: support pixelformat V4L2_PIX_FMT_MT21C

Add V4L2_PIX_FMT_MT21C in format list.

[mchehab@s-opensource.org: re-add mtk_mdp_size_align]

Signed-off-by: Minghsiu Tsai <minghsiu.tsai@mediatek.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] mtk-mdp: fix compilation warnings if !DEBUG
Mauro Carvalho Chehab [Fri, 21 Oct 2016 13:56:43 +0000 (11:56 -0200)]
[media] mtk-mdp: fix compilation warnings if !DEBUG

The mtk_mdp_dbg() is empty if !DEBUG. This causes the following
warnings:

drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c: In function â€˜mtk_mdp_try_fmt_mplane’:
drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c:231:52: warning: suggest braces around empty body in an â€˜if’ statement [-Wempty-body]
        org_w, org_h, pix_mp->width, pix_mp->height);
                                                    ^
drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c: In function â€˜mtk_mdp_m2m_start_streaming’:
drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c:414:21: warning: suggest braces around empty body in an â€˜if’ statement [-Wempty-body]
        ctx->id, ret);
                     ^

With could actually make the code to do something wrong. So,
add an empty block to make it be parsed ok.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] arm64: dts: mediatek: Add MDP for MT8173
Minghsiu Tsai [Thu, 8 Sep 2016 13:09:04 +0000 (10:09 -0300)]
[media] arm64: dts: mediatek: Add MDP for MT8173

Add MDP node for MT8173

Signed-off-by: Minghsiu Tsai <minghsiu.tsai@mediatek.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] media: Add Mediatek MDP Driver
Minghsiu Tsai [Thu, 8 Sep 2016 13:09:03 +0000 (10:09 -0300)]
[media] media: Add Mediatek MDP Driver

Add MDP driver for MT8173

Signed-off-by: Minghsiu Tsai <minghsiu.tsai@mediatek.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] dt-bindings: Add a binding for Mediatek MDP
Minghsiu Tsai [Thu, 8 Sep 2016 13:09:02 +0000 (10:09 -0300)]
[media] dt-bindings: Add a binding for Mediatek MDP

Add a DT binding documentation of MDP for the MT8173 SoC
from Mediatek

Signed-off-by: Minghsiu Tsai <minghsiu.tsai@mediatek.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] VPU: mediatek: Add mdp support
Minghsiu Tsai [Thu, 8 Sep 2016 13:09:01 +0000 (10:09 -0300)]
[media] VPU: mediatek: Add mdp support

VPU driver add mdp support

[mchehab@s-opensource.com: fix a merge conflict and make checkpatch happy]

Signed-off-by: Minghsiu Tsai <minghsiu.tsai@mediatek.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] arm64: dts: mediatek: Add Video Decoder for MT8173
Tiffany Lin [Fri, 9 Sep 2016 15:48:07 +0000 (12:48 -0300)]
[media] arm64: dts: mediatek: Add Video Decoder for MT8173

Add video decoder node for MT8173

Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] vcodec: mediatek: Add V4L2_PIX_FMT_MT21C support for v4l2 decoder
Tiffany Lin [Fri, 9 Sep 2016 15:48:06 +0000 (12:48 -0300)]
[media] vcodec: mediatek: Add V4L2_PIX_FMT_MT21C support for v4l2 decoder

Add V4L2_PIX_FMT_MT21C support

Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] docs-rst: Add compressed video formats used on MT8173 codec driver
Tiffany Lin [Fri, 9 Sep 2016 15:48:05 +0000 (12:48 -0300)]
[media] docs-rst: Add compressed video formats used on MT8173 codec driver

Add V4L2_PIX_FMT_MT21C documentation

Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] v4l: add Mediatek compressed video block format
Tiffany Lin [Fri, 9 Sep 2016 15:48:04 +0000 (12:48 -0300)]
[media] v4l: add Mediatek compressed video block format

Add V4L2_PIX_FMT_MT21C format used on MT8173 driver.
It is compressed format and need MT8173 MDP driver to transfer to other
standard format.

Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] VPU: mediatek: fix null pointer dereference on pdev
Colin Ian King [Wed, 7 Sep 2016 17:10:27 +0000 (14:10 -0300)]
[media] VPU: mediatek: fix null pointer dereference on pdev

pdev is being null checked, however, prior to that it is being
dereferenced by platform_get_drvdata.  Move the assignments of
vpu and run to after the pdev null check to avoid a potential
null pointer dereference.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] vcodec: mediatek: add Maintainers entry for Mediatek MT8173 vcodec drivers
Tiffany Lin [Wed, 7 Sep 2016 07:08:17 +0000 (04:08 -0300)]
[media] vcodec: mediatek: add Maintainers entry for Mediatek MT8173 vcodec drivers

Add Tiffany Lin and Andrew-CT Chen as maintainers for
Mediatek MT8173 vcodec drivers

Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Andrew-CT Chen <andrew-ct.chen@mediatek.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] vcodec: mediatek: fix odd_ptr_err.cocci warnings
Julia Lawall [Tue, 6 Sep 2016 14:51:15 +0000 (11:51 -0300)]
[media] vcodec: mediatek: fix odd_ptr_err.cocci warnings

PTR_ERR should access the value just tested by IS_ERR

Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci

CC: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] vcodec: mediatek: Add Mediatek VP9 Video Decoder Driver
Tiffany Lin [Fri, 2 Sep 2016 12:20:00 +0000 (09:20 -0300)]
[media] vcodec: mediatek: Add Mediatek VP9 Video Decoder Driver

Add vp9 decoder driver for MT8173

[mchehab@s-opensource.org: make checkpatch.pl happy]

Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] Add documentation for V4L2_PIX_FMT_VP9
Tiffany Lin [Fri, 2 Sep 2016 12:19:59 +0000 (09:19 -0300)]
[media] Add documentation for V4L2_PIX_FMT_VP9

Add documentation for V4L2_PIX_FMT_VP9.

Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Wu-Cheng Li <wuchengli@chromium.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] v4l2-ioctl: add VP9 format description
Wu-Cheng Li [Fri, 2 Sep 2016 12:19:58 +0000 (09:19 -0300)]
[media] v4l2-ioctl: add VP9 format description

VP9 is a video coding format and a successor to VP8.

Signed-off-by: Wu-Cheng Li <wuchengli@chromium.org>
Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] videodev2.h: add V4L2_PIX_FMT_VP9 format
Wu-Cheng Li [Fri, 2 Sep 2016 12:19:57 +0000 (09:19 -0300)]
[media] videodev2.h: add V4L2_PIX_FMT_VP9 format

This adds VP9 video coding format, a successor to VP8.

Signed-off-by: Wu-Cheng Li <wuchengli@chromium.org>
Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] vcodec: mediatek: Add Mediatek VP8 Video Decoder Driver
Tiffany Lin [Fri, 2 Sep 2016 12:19:56 +0000 (09:19 -0300)]
[media] vcodec: mediatek: Add Mediatek VP8 Video Decoder Driver

Add vp8 decoder driver for MT8173

[mchehab@s-opensource.org: make checkpatch.pl happy]

Signed-off-by: PC Chen <pc.chen@mediatek.com>
Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] vcodec: mediatek: Add Mediatek H264 Video Decoder Drive
Tiffany Lin [Fri, 2 Sep 2016 12:19:55 +0000 (09:19 -0300)]
[media] vcodec: mediatek: Add Mediatek H264 Video Decoder Drive

Add h264 decoder driver for MT8173

Signed-off-by: PC Chen <pc.chen@mediatek.com>
Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] mtk-vcodec: fix some smatch warnings
Mauro Carvalho Chehab [Fri, 21 Oct 2016 12:55:52 +0000 (10:55 -0200)]
[media] mtk-vcodec: fix some smatch warnings

Fix this bug:
drivers/media/platform/mtk-vcodec/vdec_drv_if.c:38 vdec_if_init() info: ignoring unreachable code.

With is indeed a real problem that prevents the driver to work!

While here, also remove an used var, as reported by smatch:

drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c: In function 'mtk_vcodec_init_dec_pm':
drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c:29:17: warning: variable 'dev' set but not used [-Wunused-but-set-variable]
  struct device *dev;
                 ^~~

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] vcodec: mediatek: Add Mediatek V4L2 Video Decoder Driver
Tiffany Lin [Fri, 2 Sep 2016 12:19:54 +0000 (09:19 -0300)]
[media] vcodec: mediatek: Add Mediatek V4L2 Video Decoder Driver

Add v4l2 layer decoder driver for MT8173

[mchehab@s-opensource.com: make checkpatch.pl happy]

Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] dt-bindings: Add a binding for Mediatek Video Decoder
Tiffany Lin [Fri, 2 Sep 2016 12:19:53 +0000 (09:19 -0300)]
[media] dt-bindings: Add a binding for Mediatek Video Decoder

Add a DT binding documentation of Video Decoder for the
MT8173 SoC from Mediatek.

Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
Acked-by: Rob Herring <rob@kernel.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] VPU: mediatek: Add decode support
Andrew-CT Chen [Fri, 2 Sep 2016 12:19:52 +0000 (09:19 -0300)]
[media] VPU: mediatek: Add decode support

VPU driver add decode support

[mchehab@s-opensource.org: fix a kernel-doc markup]

Signed-off-by: Andrew-CT Chen <andrew-ct.chen@mediatek.com>
Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] s5p-mfc: fix failure path of s5p_mfc_alloc_memdev()
Marek Szyprowski [Fri, 16 Sep 2016 06:14:33 +0000 (03:14 -0300)]
[media] s5p-mfc: fix failure path of s5p_mfc_alloc_memdev()

s5p_mfc_alloc_memdev() function lacks proper releasing
of allocated device in case of reserved memory initialization
failure. This results in NULL pointer dereference:

[    2.828457] Unable to handle kernel NULL pointer dereference at virtual address 00000001
[    2.835089] pgd = c0004000
[    2.837752] [00000001] *pgd=00000000
[    2.844696] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
[    2.848680] Modules linked in:
[    2.851722] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.8.0-rc6-00002-gafa1b97 #878
[    2.859357] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[    2.865433] task: ef080000 task.stack: ef06c000
[    2.869952] PC is at strcmp+0x0/0x30
[    2.873508] LR is at platform_match+0x84/0xac
[    2.877847] pc : [<c032621c>]    lr : [<c03f65e8>]    psr: 20000013
[    2.877847] sp : ef06dea0  ip : 00000000  fp : 00000000
[    2.889303] r10: 00000000  r9 : c0b34848  r8 : c0b1e968
[    2.894511] r7 : 00000000  r6 : 00000001  r5 : c086e7fc  r4 : eeb8e010
[    2.901021] r3 : 0000006d  r2 : 00000000  r1 : c086e7fc  r0 : 00000001
[    2.907533] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
[    2.914649] Control: 10c5387d  Table: 4000404a  DAC: 00000051
[    2.920378] Process swapper/0 (pid: 1, stack limit = 0xef06c210)
[    2.926367] Stack: (0xef06dea0 to 0xef06e000)
[    2.930711] dea0: eeb8e010 c0c2d91c c03f4a6c c03f4a8c 00000000 c0c2d91c c03f4a6c c03f2fc8
[    2.938870] dec0: ef003274 ef10c4c0 c0c2d91c ef10cc80 c0c21270 c03f3fa4 c09c1be8 c0c2d91c
[    2.947028] dee0: 00000006 c0c2d91c 00000006 c0b3483c c0c47000 c03f5314 c0c2d908 c0b5fed8
[    2.955188] df00: 00000006 c010178c 60000013 c0a4ef14 00000000 c06feaa0 ef080000 60000013
[    2.963347] df20: 00000000 c0c095c8 efffca76 c0816b8c 000000d5 c0134098 c0b34848 c09d6cdc
[    2.971506] df40: c0a4de70 00000000 00000006 00000006 c0c09568 efffca40 c0b5fed8 00000006
[    2.979665] df60: c0b3483c c0c47000 000000d5 c0b34848 c0b005a4 c0b00d84 00000006 00000006
[    2.987824] df80: 00000000 c0b005a4 00000000 c06fb4d8 00000000 00000000 00000000 00000000
[    2.995983] dfa0: 00000000 c06fb4e0 00000000 c01079b8 00000000 00000000 00000000 00000000
[    3.004142] dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    3.012302] dfe0: 00000000 00000000 00000000 00000000 00000013 00000000 ffffffff ffffffff
[    3.020469] [<c032621c>] (strcmp) from [<c03f65e8>] (platform_match+0x84/0xac)
[    3.027672] [<c03f65e8>] (platform_match) from [<c03f4a8c>] (__driver_attach+0x20/0xb0)
[    3.035654] [<c03f4a8c>] (__driver_attach) from [<c03f2fc8>] (bus_for_each_dev+0x54/0x88)
[    3.043812] [<c03f2fc8>] (bus_for_each_dev) from [<c03f3fa4>] (bus_add_driver+0xe8/0x1f4)
[    3.051971] [<c03f3fa4>] (bus_add_driver) from [<c03f5314>] (driver_register+0x78/0xf4)
[    3.059958] [<c03f5314>] (driver_register) from [<c010178c>] (do_one_initcall+0x3c/0x16c)
[    3.068123] [<c010178c>] (do_one_initcall) from [<c0b00d84>] (kernel_init_freeable+0x120/0x1ec)
[    3.076802] [<c0b00d84>] (kernel_init_freeable) from [<c06fb4e0>] (kernel_init+0x8/0x118)
[    3.084958] [<c06fb4e0>] (kernel_init) from [<c01079b8>] (ret_from_fork+0x14/0x3c)
[    3.092506] Code: 1afffffb e12fff1e e1a03000 eafffff7 (e4d03001)
[    3.098618] ---[ end trace 511bf9d750810709 ]---
[    3.103207] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

This patch fixes this issue.

Fixes: c79667dd93b084fe412bcfe7fbf0ba43f7dec520 ("media: s5p-mfc: replace custom
reserved memory handling code with generic one")

CC: stable@vger.kernel.org # v4.7+
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] tveeprom: use dev_foo() for printk messages
Mauro Carvalho Chehab [Thu, 13 Oct 2016 13:51:20 +0000 (10:51 -0300)]
[media] tveeprom: use dev_foo() for printk messages

Instead of calling a V4L-specific macro, do the right thing
and use the dev_foo() macros.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] tuners: don't break long lines
Mauro Carvalho Chehab [Tue, 18 Oct 2016 19:44:26 +0000 (17:44 -0200)]
[media] tuners: don't break long lines

Due to the 80-cols restrictions, and latter due to checkpatch
warnings, several strings were broken into multiple lines. This
is not considered a good practice anymore, as it makes harder
to grep for strings at the source code.

As we're right now fixing other drivers due to KERN_CONT, we need
to be able to identify what printk strings don't end with a "\n".
It is a way easier to detect those if we don't break long lines.

So, join those continuation lines.

The patch was generated via the script below, and manually
adjusted if needed.

</script>
use Text::Tabs;
while (<>) {
if ($next ne "") {
$c=$_;
if ($c =~ /^\s+\"(.*)/) {
$c2=$1;
$next =~ s/\"\n$//;
$n = expand($next);
$funpos = index($n, '(');
$pos = index($c2, '",');
if ($funpos && $pos > 0) {
$s1 = substr $c2, 0, $pos + 2;
$s2 = ' ' x ($funpos + 1) . substr $c2, $pos + 2;
$s2 =~ s/^\s+//;

$s2 = ' ' x ($funpos + 1) . $s2 if ($s2 ne "");

print unexpand("$next$s1\n");
print unexpand("$s2\n") if ($s2 ne "");
} else {
print "$next$c2\n";
}
$next="";
next;
} else {
print $next;
}
$next="";
} else {
if (m/\"$/) {
if (!m/\\n\"$/) {
$next=$_;
next;
}
}
}
print $_;
}
</script>

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] rc: don't break long lines
Mauro Carvalho Chehab [Tue, 18 Oct 2016 19:44:25 +0000 (17:44 -0200)]
[media] rc: don't break long lines

Due to the 80-cols restrictions, and latter due to checkpatch
warnings, several strings were broken into multiple lines. This
is not considered a good practice anymore, as it makes harder
to grep for strings at the source code.

As we're right now fixing other drivers due to KERN_CONT, we need
to be able to identify what printk strings don't end with a "\n".
It is a way easier to detect those if we don't break long lines.

So, join those continuation lines.

The patch was generated via the script below, and manually
adjusted if needed.

</script>
use Text::Tabs;
while (<>) {
if ($next ne "") {
$c=$_;
if ($c =~ /^\s+\"(.*)/) {
$c2=$1;
$next =~ s/\"\n$//;
$n = expand($next);
$funpos = index($n, '(');
$pos = index($c2, '",');
if ($funpos && $pos > 0) {
$s1 = substr $c2, 0, $pos + 2;
$s2 = ' ' x ($funpos + 1) . substr $c2, $pos + 2;
$s2 =~ s/^\s+//;

$s2 = ' ' x ($funpos + 1) . $s2 if ($s2 ne "");

print unexpand("$next$s1\n");
print unexpand("$s2\n") if ($s2 ne "");
} else {
print "$next$c2\n";
}
$next="";
next;
} else {
print $next;
}
$next="";
} else {
if (m/\"$/) {
if (!m/\\n\"$/) {
$next=$_;
next;
}
}
}
print $_;
}
</script>

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] radio: don't break long lines
Mauro Carvalho Chehab [Tue, 18 Oct 2016 19:44:25 +0000 (17:44 -0200)]
[media] radio: don't break long lines

Due to the 80-cols restrictions, and latter due to checkpatch
warnings, several strings were broken into multiple lines. This
is not considered a good practice anymore, as it makes harder
to grep for strings at the source code.

As we're right now fixing other drivers due to KERN_CONT, we need
to be able to identify what printk strings don't end with a "\n".
It is a way easier to detect those if we don't break long lines.

So, join those continuation lines.

The patch was generated via the script below, and manually
adjusted if needed.

</script>
use Text::Tabs;
while (<>) {
if ($next ne "") {
$c=$_;
if ($c =~ /^\s+\"(.*)/) {
$c2=$1;
$next =~ s/\"\n$//;
$n = expand($next);
$funpos = index($n, '(');
$pos = index($c2, '",');
if ($funpos && $pos > 0) {
$s1 = substr $c2, 0, $pos + 2;
$s2 = ' ' x ($funpos + 1) . substr $c2, $pos + 2;
$s2 =~ s/^\s+//;

$s2 = ' ' x ($funpos + 1) . $s2 if ($s2 ne "");

print unexpand("$next$s1\n");
print unexpand("$s2\n") if ($s2 ne "");
} else {
print "$next$c2\n";
}
$next="";
next;
} else {
print $next;
}
$next="";
} else {
if (m/\"$/) {
if (!m/\\n\"$/) {
$next=$_;
next;
}
}
}
print $_;
}
</script>

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] platform: don't break long lines
Mauro Carvalho Chehab [Tue, 18 Oct 2016 19:44:24 +0000 (17:44 -0200)]
[media] platform: don't break long lines

Due to the 80-cols restrictions, and latter due to checkpatch
warnings, several strings were broken into multiple lines. This
is not considered a good practice anymore, as it makes harder
to grep for strings at the source code.

As we're right now fixing other drivers due to KERN_CONT, we need
to be able to identify what printk strings don't end with a "\n".
It is a way easier to detect those if we don't break long lines.

So, join those continuation lines.

The patch was generated via the script below, and manually
adjusted if needed.

</script>
use Text::Tabs;
while (<>) {
if ($next ne "") {
$c=$_;
if ($c =~ /^\s+\"(.*)/) {
$c2=$1;
$next =~ s/\"\n$//;
$n = expand($next);
$funpos = index($n, '(');
$pos = index($c2, '",');
if ($funpos && $pos > 0) {
$s1 = substr $c2, 0, $pos + 2;
$s2 = ' ' x ($funpos + 1) . substr $c2, $pos + 2;
$s2 =~ s/^\s+//;

$s2 = ' ' x ($funpos + 1) . $s2 if ($s2 ne "");

print unexpand("$next$s1\n");
print unexpand("$s2\n") if ($s2 ne "");
} else {
print "$next$c2\n";
}
$next="";
next;
} else {
print $next;
}
$next="";
} else {
if (m/\"$/) {
if (!m/\\n\"$/) {
$next=$_;
next;
}
}
}
print $_;
}
</script>

Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] firewire: don't break long lines
Mauro Carvalho Chehab [Tue, 18 Oct 2016 19:44:23 +0000 (17:44 -0200)]
[media] firewire: don't break long lines

Due to the 80-cols restrictions, and latter due to checkpatch
warnings, several strings were broken into multiple lines. This
is not considered a good practice anymore, as it makes harder
to grep for strings at the source code.

As we're right now fixing other drivers due to KERN_CONT, we need
to be able to identify what printk strings don't end with a "\n".
It is a way easier to detect those if we don't break long lines.

So, join those continuation lines.

The patch was generated via the script below, and manually
adjusted if needed.

</script>
use Text::Tabs;
while (<>) {
if ($next ne "") {
$c=$_;
if ($c =~ /^\s+\"(.*)/) {
$c2=$1;
$next =~ s/\"\n$//;
$n = expand($next);
$funpos = index($n, '(');
$pos = index($c2, '",');
if ($funpos && $pos > 0) {
$s1 = substr $c2, 0, $pos + 2;
$s2 = ' ' x ($funpos + 1) . substr $c2, $pos + 2;
$s2 =~ s/^\s+//;

$s2 = ' ' x ($funpos + 1) . $s2 if ($s2 ne "");

print unexpand("$next$s1\n");
print unexpand("$s2\n") if ($s2 ne "");
} else {
print "$next$c2\n";
}
$next="";
next;
} else {
print $next;
}
$next="";
} else {
if (m/\"$/) {
if (!m/\\n\"$/) {
$next=$_;
next;
}
}
}
print $_;
}
</script>

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>