John Stultz [Tue, 3 Dec 2019 17:26:41 +0000 (17:26 +0000)]
kselftests: Add dma-heap test
Commit
a8779927fd86c91f5400bfcbccfa018a667d8350 upstream.
Add very trivial allocation and import test for dma-heaps,
utilizing the vgem driver as a test importer.
A good chunk of this code taken from:
tools/testing/selftests/android/ion/ionmap_test.c
Originally by Laura Abbott <labbott@redhat.com>
Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Liam Mark <lmark@codeaurora.org>
Cc: Pratik Patel <pratikp@codeaurora.org>
Cc: Brian Starkey <Brian.Starkey@arm.com>
Cc: Vincent Donnefort <Vincent.Donnefort@arm.com>
Cc: Sudipto Paul <Sudipto.Paul@arm.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Chenbo Feng <fengc@google.com>
Cc: Alistair Strachan <astrachan@google.com>
Cc: Hridya Valsaraju <hridya@google.com>
Cc: Sandeep Patil <sspatil@google.com>
Cc: Hillf Danton <hdanton@sina.com>
Cc: Dave Airlie <airlied@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Reviewed-by: Brian Starkey <brian.starkey@arm.com>
Acked-by: Sandeep Patil <sspatil@android.com>
Acked-by: Laura Abbott <labbott@redhat.com>
Tested-by: Ayan Kumar Halder <ayan.halder@arm.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20191203172641.66642-6-john.stultz@linaro.org
John Stultz [Tue, 3 Dec 2019 17:26:40 +0000 (17:26 +0000)]
dma-buf: heaps: Add CMA heap to dmabuf heaps
Commit
b61614ec318aae0c77ecd2816878d851dd61d9a6 upstream.
This adds a CMA heap, which allows userspace to allocate
a dma-buf of contiguous memory out of a CMA region.
This code is an evolution of the Android ION implementation, so
thanks to its original author and maintainters:
Benjamin Gaignard, Laura Abbott, and others!
NOTE: This patch only adds the default CMA heap. We will enable
selectively adding other CMA memory regions to the dmabuf heaps
interface with a later patch (which requires a dt binding)
Cc: Laura Abbott <labbott@redhat.com>
Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Liam Mark <lmark@codeaurora.org>
Cc: Pratik Patel <pratikp@codeaurora.org>
Cc: Brian Starkey <Brian.Starkey@arm.com>
Cc: Vincent Donnefort <Vincent.Donnefort@arm.com>
Cc: Sudipto Paul <Sudipto.Paul@arm.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Chenbo Feng <fengc@google.com>
Cc: Alistair Strachan <astrachan@google.com>
Cc: Hridya Valsaraju <hridya@google.com>
Cc: Sandeep Patil <sspatil@google.com>
Cc: Hillf Danton <hdanton@sina.com>
Cc: Dave Airlie <airlied@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Reviewed-by: Brian Starkey <brian.starkey@arm.com>
Acked-by: Sandeep Patil <sspatil@android.com>
Acked-by: Laura Abbott <labbott@redhat.com>
Tested-by: Ayan Kumar Halder <ayan.halder@arm.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20191203172641.66642-5-john.stultz@linaro.org
John Stultz [Tue, 3 Dec 2019 17:26:39 +0000 (17:26 +0000)]
dma-buf: heaps: Add system heap to dmabuf heaps
Commit
efa04fefebbd724ffda7f49e42d057a7217c45b0 upstream.
This patch adds system heap to the dma-buf heaps framework.
This allows applications to get a page-allocator backed dma-buf
for non-contiguous memory.
This code is an evolution of the Android ION implementation, so
thanks to its original authors and maintainters:
Rebecca Schultz Zavin, Colin Cross, Laura Abbott, and others!
Cc: Laura Abbott <labbott@redhat.com>
Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Liam Mark <lmark@codeaurora.org>
Cc: Pratik Patel <pratikp@codeaurora.org>
Cc: Brian Starkey <Brian.Starkey@arm.com>
Cc: Vincent Donnefort <Vincent.Donnefort@arm.com>
Cc: Sudipto Paul <Sudipto.Paul@arm.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Chenbo Feng <fengc@google.com>
Cc: Alistair Strachan <astrachan@google.com>
Cc: Hridya Valsaraju <hridya@google.com>
Cc: Sandeep Patil <sspatil@google.com>
Cc: Hillf Danton <hdanton@sina.com>
Cc: Dave Airlie <airlied@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Reviewed-by: Brian Starkey <brian.starkey@arm.com>
Acked-by: Sandeep Patil <sspatil@android.com>
Acked-by: Laura Abbott <labbott@redhat.com>
Tested-by: Ayan Kumar Halder <ayan.halder@arm.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20191203172641.66642-4-john.stultz@linaro.org
John Stultz [Tue, 3 Dec 2019 17:26:38 +0000 (17:26 +0000)]
dma-buf: heaps: Add heap helpers
Commit
5248eb12fea890a03b4cdc3ef546d6319d4d9b73 upstream.
Add generic helper dmabuf ops for dma heaps, so we can reduce
the amount of duplicative code for the exported dmabufs.
This code is an evolution of the Android ION implementation, so
thanks to its original authors and maintainters:
Rebecca Schultz Zavin, Colin Cross, Laura Abbott, and others!
Cc: Laura Abbott <labbott@redhat.com>
Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Liam Mark <lmark@codeaurora.org>
Cc: Pratik Patel <pratikp@codeaurora.org>
Cc: Brian Starkey <Brian.Starkey@arm.com>
Cc: Vincent Donnefort <Vincent.Donnefort@arm.com>
Cc: Sudipto Paul <Sudipto.Paul@arm.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Chenbo Feng <fengc@google.com>
Cc: Alistair Strachan <astrachan@google.com>
Cc: Hridya Valsaraju <hridya@google.com>
Cc: Sandeep Patil <sspatil@google.com>
Cc: Hillf Danton <hdanton@sina.com>
Cc: Dave Airlie <airlied@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Reviewed-by: Brian Starkey <brian.starkey@arm.com>
Acked-by: Sandeep Patil <sspatil@android.com>
Acked-by: Laura Abbott <labbott@redhat.com>
Tested-by: Ayan Kumar Halder <ayan.halder@arm.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20191203172641.66642-3-john.stultz@linaro.org
Andrew F. Davis [Tue, 3 Dec 2019 17:26:37 +0000 (17:26 +0000)]
dma-buf: Add dma-buf heaps framework
Commit
c02a81fba74fe3488ad6b08bfb5a1329005418f8 upstream.
This framework allows a unified userspace interface for dma-buf
exporters, allowing userland to allocate specific types of memory
for use in dma-buf sharing.
Each heap is given its own device node, which a user can allocate
a dma-buf fd from using the DMA_HEAP_IOC_ALLOC.
This code is an evoluiton of the Android ION implementation,
and a big thanks is due to its authors/maintainers over time
for their effort:
Rebecca Schultz Zavin, Colin Cross, Benjamin Gaignard,
Laura Abbott, and many other contributors!
Cc: Laura Abbott <labbott@redhat.com>
Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Liam Mark <lmark@codeaurora.org>
Cc: Pratik Patel <pratikp@codeaurora.org>
Cc: Brian Starkey <Brian.Starkey@arm.com>
Cc: Vincent Donnefort <Vincent.Donnefort@arm.com>
Cc: Sudipto Paul <Sudipto.Paul@arm.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Chenbo Feng <fengc@google.com>
Cc: Alistair Strachan <astrachan@google.com>
Cc: Hridya Valsaraju <hridya@google.com>
Cc: Sandeep Patil <sspatil@google.com>
Cc: Hillf Danton <hdanton@sina.com>
Cc: Dave Airlie <airlied@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Brian Starkey <brian.starkey@arm.com>
Acked-by: Sandeep Patil <sspatil@android.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20191203172641.66642-2-john.stultz@linaro.org
Gurchetan Singh [Tue, 17 Dec 2019 23:02:28 +0000 (15:02 -0800)]
udmabuf: fix dma-buf cpu access
Commit
1ffe09590121fbb3786d6c860acdd200f7ab095c upstream.
I'm just going to put Chia's review comment here since it sums
the issue rather nicely:
"(1) Semantically, a dma-buf is in DMA domain. CPU access from the
importer must be surrounded by {begin,end}_cpu_access. This gives the
exporter a chance to move the buffer to the CPU domain temporarily.
(2) When the exporter itself has other means to do CPU access, it is
only reasonable for the exporter to move the buffer to the CPU domain
before access, and to the DMA domain after access. The exporter can
potentially reuse {begin,end}_cpu_access for that purpose.
Because of (1), udmabuf does need to implement the
{begin,end}_cpu_access hooks. But "begin" should mean
dma_sync_sg_for_cpu and "end" should mean dma_sync_sg_for_device.
Because of (2), if userspace wants to continuing accessing through the
memfd mapping, it should call udmabuf's {begin,end}_cpu_access to
avoid cache issues."
Reported-by: Chia-I Wu <olvaffe@gmail.com>
Suggested-by: Chia-I Wu <olvaffe@gmail.com>
Fixes:
284562e1f348 ("udmabuf: implement begin_cpu_access/end_cpu_access hooks")
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20191217230228.453-1-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gurchetan Singh [Tue, 3 Dec 2019 01:36:27 +0000 (17:36 -0800)]
udmabuf: implement begin_cpu_access/end_cpu_access hooks
Commit
284562e1f34874e267d4f499362c3816f8f6bc3f upstream.
With the misc device, we should end up using the result of
get_arch_dma_ops(..) or dma-direct ops.
This can allow us to have WC mappings in the guest after
synchronization.
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20191203013627.85991-4-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gurchetan Singh [Tue, 3 Dec 2019 01:36:26 +0000 (17:36 -0800)]
udmabuf: separate out creating/destroying scatter-table
Commit
17a7ce203490459cff14fb1c8f9a15d65fd1c544 upstream.
These are nice functions and can be re-used.
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20191203013627.85991-3-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gurchetan Singh [Tue, 3 Dec 2019 01:36:25 +0000 (17:36 -0800)]
udmabuf: add a pointer to the miscdevice in dma-buf private data
Commit
c1bbed668997268c9edccdc9db1bd1487d9e20b0 upstream.
Will be used later.
v2: rename 'udmabuf_misc' to 'device' (kraxel)
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20191203013627.85991-2-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gurchetan Singh [Tue, 3 Dec 2019 01:36:24 +0000 (17:36 -0800)]
udmabuf: use cache_sgt_mapping option
Commit
bc7a71da43b48333f84c6534ab43d240e34cf9eb uptream.
The GEM prime helpers do it, so should we. It's also possible to make
it optional later.
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20191203013627.85991-1-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Maarten Lankhorst [Tue, 26 Nov 2019 14:25:16 +0000 (15:25 +0100)]
udmabuf: Remove deleted map/unmap handlers.
Commit
19d32ace8b6acebc45da1ea748000ac79ccc7721 upstream.
Commit
7f0de8d80816 ("dma-buf: Drop dma_buf_k(un)map") removed map/unmap
handlers, but they still existed in udmabuf. Remove them there as well
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Fixes:
7f0de8d80816 ("dma-buf: Drop dma_buf_k(un)map")
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: linux-media@vger.kernel.org
Cc: linaro-mm-sig@lists.linaro.org
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20191126142516.630200-1-maarten.lankhorst@linux.intel.com
Naushir Patuck [Thu, 7 May 2020 14:36:25 +0000 (15:36 +0100)]
configs: Add imx477 sensor driver to all Raspberry Pi defconfigs
This commit enables the imx477 sensor driver in the following
defconfigs:
bcm2709_defconfig
bcm2711_defconfig
bcmrpi_defconfig
bcmrpi3_defconfig
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Naushir Patuck [Fri, 8 May 2020 08:41:17 +0000 (09:41 +0100)]
media: i2c: imx477: Add support for adaptive frame control
Use V4L2_CID_EXPOSURE_AUTO_PRIORITY to control if the driver should
automatically adjust the sensor frame length based on exposure time,
allowing variable frame rates and longer exposures.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Naushir Patuck [Fri, 8 May 2020 09:00:12 +0000 (10:00 +0100)]
media: i2c: Add driver for Sony IMX477 sensor
Adds a driver for the 12MPix Sony IMX477 CSI2 sensor.
Whilst the sensor supports 2 or 4 CSI2 data lanes, this driver
currently only supports 2 lanes.
The following Bayer modes are currently available:
4056x3040 12-bit @ 10fps
2028x1520 12-bit (binned) @ 40fps
2028x1050 12-bit (cropped/binned) @ 50fps
1012x760 10-bit (scaled) @ 120 fps
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Naushir Patuck [Thu, 7 May 2020 14:50:04 +0000 (15:50 +0100)]
dtoverlays: Add IMX477 sensor overlay
Add an overlay for the Sony IMX477 CMOS sensor device.
Also update overlay README and Makefile.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Naushir Patuck [Thu, 7 May 2020 14:50:54 +0000 (15:50 +0100)]
dt-bindings: media: i2c: Add IMX477 CMOS sensor binding
Add YAML device tree binding for IMX477 CMOS image sensor.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Phil Elwell [Tue, 12 May 2020 07:32:42 +0000 (08:32 +0100)]
raspberrypi: dts: Switch to discrete ALSA devices
Add the command line options required to enable audio over discrete
ALSA devices.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Phil Elwell [Mon, 11 May 2020 14:12:21 +0000 (15:12 +0100)]
overlays: Move "fixed-clock" nodes to the root
Apart from some special cases, device objects are only created for
nodes if they are children of a bus or the root node. "fixed-clock"
is one of the exceptions that will be instantiated wherever it is
found, but only during kernel initialisation - ruling out loading the
overlay at runtime.
Move most of the affected clocks to be children of the root, only
leaving those in overlays that could be multiply instantiated, to avoid
a potential name clash.
See: https://github.com/raspberrypi/linux/issues/3602
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Phil Elwell [Mon, 11 May 2020 10:55:45 +0000 (11:55 +0100)]
overlays: tc358743: Use intra-overlay fragments
The tc358743 overlay was written using a workaround to a problem with
fragments that target other fragments, but this had the unfortunate
side-effect of preventing the overlay from being applied at runtime
(the kernel doesn't allow nodes to be overwritten by an overlay, only
properties).
The current firmware and dtoverlay/dtparam utilities include support
for these "intra-overlay" fragments, so remove the workaround and do
it properly.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Dom Cobley [Thu, 7 May 2020 17:16:09 +0000 (18:16 +0100)]
config: Enable CONFIG_DRM_VC4_HDMI_CEC
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
Dom Cobley [Thu, 7 May 2020 17:16:09 +0000 (18:16 +0100)]
vc4_hdmi: Remove cec_available flag as always supported
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
Dom Cobley [Thu, 7 May 2020 17:16:08 +0000 (18:16 +0100)]
vc4_hdmi: Adjust CEC ref clock based on its input clock
2711 uses a fixed 27MHz input, earlier models use the HSM clock
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
Dom Cobley [Thu, 7 May 2020 17:16:08 +0000 (18:16 +0100)]
vc4_hdmi: Make irq shared
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
Dom Cobley [Thu, 7 May 2020 17:16:08 +0000 (18:16 +0100)]
vc4_hdmi_regs: Make interrupt mask variant specific
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
Dom Cobley [Thu, 7 May 2020 17:16:07 +0000 (18:16 +0100)]
vc4_hdmi_regs: Add Intr2 register block
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
Dom Cobley [Thu, 7 May 2020 17:16:07 +0000 (18:16 +0100)]
vc4_hdmi: Fix up CEC registers
Fix an incorrect register address, add a
missing one and reorder into address order
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
Dom Cobley [Thu, 7 May 2020 17:16:07 +0000 (18:16 +0100)]
vc4_hdmi: Fix register offset when sending longer CEC messages
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
Phil Elwell [Wed, 6 May 2020 13:25:20 +0000 (14:25 +0100)]
overlays: sc16is752-spi1: Add xtal parameter
The other sc16is75x overlays have an xtal parameter to allow a
different crystal frequency to be specified, but sc16is752-spi1
doesn't. Fix this omission.
See: https://www.raspberrypi.org/forums/viewtopic.php?f=107&t=273234
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Phil Elwell [Tue, 5 May 2020 18:45:41 +0000 (19:45 +0100)]
video: bcm2708_fb: Disable FB if no displays found
If the firmware hasn't detected a display, the driver would assume
one display was available, but because it had failed to retrieve the
display size it would try to allocate a zero-sized buffer.
Avoid the allocation failure by bailing out early if no display is
found.
See: https://github.com/raspberrypi/linux/issues/3598
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Jacko Dirks [Tue, 5 May 2020 12:33:31 +0000 (14:33 +0200)]
media: bcm2835: unicam: Fix uninitialized warning
Signed-off-by: Jacko Dirks <jdirks.linuxdev@gmail.com>
Jacko Dirks [Tue, 5 May 2020 12:28:14 +0000 (14:28 +0200)]
media: i2c: tc358743: Fix fallthrough warning
Signed-off-by: Jacko Dirks <jdirks.linuxdev@gmail.com>
Phil Elwell [Mon, 4 May 2020 14:13:24 +0000 (15:13 +0100)]
overlays: Make use of intra-overlay fragments
The firmware and runtime overlay support has recently been updated to
correctly process fragments that target other fragments within the
overlay. Make use of that ability and avoid the use of the awkward
target-path = "<alias>/..." workaround and for better readability.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
popcornmix [Mon, 6 Apr 2020 16:07:31 +0000 (17:07 +0100)]
vc4_hdmi_phy: Fix typo in phy_get_cp_current
This is stored in a 6-bit register field which causes a WARN
Signed-off-by: popcornmix <popcornmix@gmail.com>
Phil Elwell [Mon, 4 May 2020 12:38:39 +0000 (13:38 +0100)]
configs: Add missing TOUCHSCREEN_RASPBERRYPI_FW=m
The 32- and 64-bit bcm2711 defconfigs are missing support for the
official Raspberry Pi touchscreen.
Restore the missing config settings.
See: https://github.com/Hexxeh/rpi-firmware/issues/223
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Phil Elwell [Mon, 4 May 2020 10:06:04 +0000 (11:06 +0100)]
configs: Add missing PPS configs
The arm64 bcm2711_defconfig was inexplicably missing three PPS config
options. Add them, along with another missing option from
bcmrpi3_defconfig.
See: https://github.com/raspberrypi/linux/issues/3593
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Phil Elwell [Sat, 2 May 2020 12:43:06 +0000 (13:43 +0100)]
overlays: gpio-keys: Avoid open-drain warnings
The i2c-gpio driver expects to use a GPIO in open-drain mode. Failure
to configure it in that way causes alarming warnings in the kernel log.
The BCM283x and BCM2711 GPIO blocks don't support open-drain mode,
but i2c-gpio works anyway. Silence the warning by declaring that
open-drain mode has been enabled by other means.
See: https://github.com/raspberrypi/firmware/issues/1381
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Dave Stevenson [Fri, 1 May 2020 15:54:20 +0000 (16:54 +0100)]
staging: vc04_services: isp: Make all references to bcm2835_isp_fmt const
The array of potential formats and their configuration should be const.
Rework all accesses so that this is possible.
The list of supported formats was taking a copy of entries from this table.
This is unnecessary, therefore allocate an array of pointers instead of
an array of entries.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Fri, 1 May 2020 16:49:08 +0000 (17:49 +0100)]
staging: vc04_services: isp: Remove duplicated initialisation
With the codec code from which this was derived, the driver had to
get the supported formats for both input and output ports.
This had been copied across, however here we have independent nodes
for each port, but the code had been left in to do the same thing
twice.
Remove the duplicate.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Phil Elwell [Fri, 1 May 2020 16:56:13 +0000 (17:56 +0100)]
overlays: Make the i2c-gpio overlay safe again
Like many overlays, the i2c-gpio overlay goes to efforts to avoid
generating warnings about #address-cells and #size-cells not
being defined, which it does by defining them. Unfortunately this
is fatal if they don't match what the system requires, and the
recent switch to #size-cells = 2 on 2711 made i2c-gpio very
dangerous.
In the absence of the knowledge of a clean way to fix this, just delete
the declarations and suffer the warnings.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Phil Elwell [Thu, 30 Apr 2020 11:43:05 +0000 (12:43 +0100)]
ARM: dts: bcm2711: Allow 40-bit DMA for SPI
Add the spi_dma4 DT parameter to enable use of the 40-bit DMA channels
to drive SPI. Note that there are only 3-4 40-bit channels available,
and using this parameter claims 2 of them.
Usage: dtparam=spi_dma4
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Phil Elwell [Thu, 4 Apr 2019 12:33:47 +0000 (13:33 +0100)]
bcm2835-dma: Add proper 40-bit DMA support
BCM2711 has 4 DMA channels with a 40-bit address range, allowing them
to access the full 4GB of memory on a Pi 4.
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
Phil Elwell [Fri, 1 May 2020 13:58:23 +0000 (14:58 +0100)]
SQUASH: spi: Demote SPI_CS_HIGH warning to KERN_DEBUG
This warning is unavoidable from a client's perspective and
doesn't indicate anything wrong (just surprising).
SQUASH with "spi: use_gpio_descriptor fixup moved to spi_setup"
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Naushir Patuck [Fri, 1 May 2020 13:15:24 +0000 (14:15 +0100)]
staging: vc04_services: ISP: Add enum_framesizes ioctl
This is used to enumerate available frame sizes on all nodes
apart from statistics output.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Dave Stevenson [Thu, 30 Apr 2020 08:52:50 +0000 (09:52 +0100)]
media: bcm2835-unicam: Fix reference counting in unicam_open
The reference counting of node->open was only incremented after
a check that the node was v4l2_fh_is_singular_file, which resulted
in the counting going wrong and s_power not being called at an
appropriate time.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 29 Apr 2020 21:05:09 +0000 (22:05 +0100)]
media: bcm2835-unicam: Do not stop streaming in unicam_release
unicam_release calls _vb2_fop_release, which will call stop_streaming
if that particular node was streaming. Calling it unconditionally (as
the code was) means that if a second handle was opened eg to alter
a setting, on closing that connection it also stopped Unicam.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 29 Apr 2020 15:45:02 +0000 (16:45 +0100)]
media: bcm2835-unicam: Add support for VIDIOC_[S|G]_SELECTION
Sensors are now reflecting cropping and scaling parameters through
the selection API, therefore Unicam needs to forward the requests
through to the subdev.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Mon, 20 Apr 2020 10:01:21 +0000 (11:01 +0100)]
media: i2c: imx219: Declare that the driver can create events
The flag V4L2_SUBDEV_FL_HAS_EVENTS is required if the subdev can
generate events. It can create events from the ctrl handler, therefore
this is required.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Thu, 30 Apr 2020 10:03:00 +0000 (11:03 +0100)]
media: i2c: ov5647: Advertise the correct exposure range
Exposure is clipped by the VTS of the mode, so needs to be updated as
and when this is changed.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 29 Apr 2020 21:11:01 +0000 (22:11 +0100)]
media: i2c: ov5647: Use member names in mode tables
To make adding new members to the mode structures easier, use
the member names in the initialisers.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 29 Apr 2020 20:47:25 +0000 (21:47 +0100)]
media: i2c: ov5647: Neither analogue gain nor exposure need EXECUTE_ON_WRITE
The controls for analogue gain and exposure were defined with
V4L2_CTRL_FLAG_EXECUTE_ON_WRITE. This is not required as we only need
to send changes to the sensor.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 29 Apr 2020 20:39:58 +0000 (21:39 +0100)]
media: i2c: ov5647: Add support for V4L2_CID_VBLANK
Adds vblank control to allow for frame rate control.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 29 Apr 2020 16:25:56 +0000 (17:25 +0100)]
media: i2c: ov5647: Set V4L2_SUBDEV_FL_HAS_EVENTS flag
The ov5647 subdev can generate control events, therefore set
the V4L2_SUBDEV_FL_HAS_EVENTS flag.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 29 Apr 2020 11:25:13 +0000 (12:25 +0100)]
media: i2c: ov5647: Support V4L2_CID_PIXEL_RATE
Clients need to know the pixel rate in order to compute exposure
and frame rate values.
Advertise it.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 29 Apr 2020 10:50:52 +0000 (11:50 +0100)]
media: i2c: ov5467: Fixup error path to release mutex
"87f3ab9 media: ov5647: Add basic support for multiple sensor modes."
added a return path ov5647_set_fmt that didn't release the device
mutex that it had claimed.
Release the mutex.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 29 Apr 2020 10:46:07 +0000 (11:46 +0100)]
media: i2c: ov5647: Add support for g_selection to reflect cropping/binning
In order to apply lens shading correctly the client needs to know how
each mode crops or scales the image compared to the full sensor array.
Implement this (based on the imx219 equivalent).
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Jacopo Mondi [Wed, 29 Apr 2020 09:50:38 +0000 (11:50 +0200)]
media: i2c: imx219: Implement get_selection
Implement the get_selection pad operation for the IMX219 sensor driver.
The supported targets report the sensor's native size, the crop default
rectangle and the crop rectangle.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
popcornmix [Wed, 29 Apr 2020 12:41:20 +0000 (13:41 +0100)]
configs: Enable CONFIG_DRM_VC4_HDMI_CEC
Signed-off-by: popcornmix <popcornmix@gmail.com>
popcornmix [Mon, 27 Apr 2020 18:07:50 +0000 (19:07 +0100)]
vc4_hdmi: BCM2835 requires a fixed hsm clock for CEC to work
Signed-off-by: popcornmix <popcornmix@gmail.com>
popcornmix [Tue, 28 Apr 2020 16:35:07 +0000 (17:35 +0100)]
vc4_hvs: Mark core clock as optional
This isn't required on Pi3, so don't treat as an error
Signed-off-by: popcornmix <popcornmix@gmail.com>
Naushir Patuck [Mon, 20 Jan 2020 12:58:06 +0000 (12:58 +0000)]
configs: Add VIDEO_ISP_BCM2835 to all Pi defconfigs
This commit enables the bcm2835-isp driver in the following
defconfigs:
bcm2709_defconfig
bcm2711_defconfig
bcmrpi_defconfig
bcmrpi3_defconfig
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Naushir Patuck [Wed, 22 Apr 2020 07:32:32 +0000 (08:32 +0100)]
staging: vchiq: Load bcm2835_isp driver from vchiq
bcmn2835_isp is a platform driver dependent on vchiq,
therefore add the load/unload functions for it to vchiq.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Naushir Patuck [Thu, 23 Apr 2020 09:17:37 +0000 (10:17 +0100)]
staging: vc04_services: ISP: Add a more complex ISP processing component
Driver for the BCM2835 ISP hardware block. This driver uses the MMAL
component to program the ISP hardware through the VC firmware.
The ISP component can produce two video stream outputs, and Bayer
image statistics. This can't be encompassed in a simple V4L2
M2M device, so create a new device that registers 4 video nodes.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Naushir Patuck [Thu, 23 Apr 2020 09:12:24 +0000 (10:12 +0100)]
staging: mmal-vchiq: Fix formatting errors in mmal_parameters.h
No functional changes in this commit.
- Remove erroneous whitespace.
- Remove _t postfix label on structs and enums.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Naushir Patuck [Tue, 21 Apr 2020 14:06:19 +0000 (15:06 +0100)]
media: uapi: v4l-ctrls: Add CID base for the bcm2835-isp driver
We are reserving controls for the new bcm2835-isp driver.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Naushir Patuck [Thu, 23 Apr 2020 09:20:26 +0000 (10:20 +0100)]
media: uapi: v4l2-core: Add ISP statistics output V4L2 fourcc type
Add V4L2_META_FMT_BCM2835_ISP_STATS V4L2 format type.
This new format will be used by the BCM2835 ISP device to return
out ISP statistics for 3A.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Naushir Patuck [Thu, 23 Apr 2020 09:18:15 +0000 (10:18 +0100)]
uapi: bcm2835-isp: Add bcm2835-isp uapi header file
This file defines the userland interface to the bcm2835-isp driver
that will follow in a separate commit.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Naushir Patuck [Tue, 21 Apr 2020 15:26:03 +0000 (16:26 +0100)]
media: bcm2835-unicam: Re-fetch mbus code from subdev on a g_fmt call
The sensor subdevice may change the Bayer order if a H/V flip is
requested after a s_fmt call. Unicam g_fmt must call the subdev get_fmt
in case this has happened and return out the correct format 4cc.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Phil Elwell [Fri, 24 Apr 2020 14:17:06 +0000 (15:17 +0100)]
overlays: rpivid-v4l2 also needs size-cells = 2
Fixes: "dts: bcm2711: set #size-cells = <2>"
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Phil Elwell [Mon, 20 Apr 2020 12:30:49 +0000 (13:30 +0100)]
spi: use_gpio_descriptor fixup moved to spi_setup
Commits [1] and [2] including code that forces SPI_CS_HIGH for SPI
controllers that use GPIO descriptors, the SPI_CS_HIGH flag being
there to avoid a double-negation (since SPI CS is usually active-low).
The motivation for pushing the knowledge of the required polarity into
the GPIO descriptor allows the switch to an output to request the
correct inactive level, avoiding a needless glitch.
The problem with setting the flag early as [1] does is that it appears
in the mode field that is passed to client drivers during their probing,
when they may want to choose SPI_POL, SPI_PHA and (just possibly)
SPI_CS_HIGH. Since SPI_CS_HIGH is the exception, most drivers won't
set it and the anti-negation negation is lost. [2] acknowledges that
problem and patches things up for the case of users of spidev, but
omits regular kernel-mode drivers.
Downstream commit [3] moves the forcing of SPI_CS_HIGH to spi_setup,
after the driver probing. Since this code is called before any CS
manipulation it is early enough to be effective, but late enough that
clients have already had their chance to change the mode field.
This is a partial reversion of [1], and is accompanied by a complete
reversion of [2], neither of which is needed any longer.
[1]
f3186dd87669 ("spi: Optionally use GPIO descriptors for CS GPIOs")
[2]
83b2a8fe43bd ("spi: spidev: Fix CS polarity if GPIO descriptors are used")
[3] <varies> ("spi: Force CS_HIGH if GPIO descriptors are used")
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Phil Elwell [Mon, 20 Apr 2020 12:41:10 +0000 (13:41 +0100)]
Revert "spi: spidev: Fix CS polarity if GPIO descriptors are used"
This reverts commit
83b2a8fe43bda0c11981ad6afa5dd0104d78be28.
Hristo Venev [Wed, 22 Apr 2020 13:34:59 +0000 (16:34 +0300)]
dts: bcm2711: add "High Peripheral" mode overlay
The following addresses change:
- 0xfc00_0000 -> 0x4_7c00_0000
- 0xff80_0000 -> 0x4_c000_0000
The range 0xfc00_0000-0xffff_ffff becomes available as system RAM on
devices with >= 4 GiB of RAM. Firmware should initialize the memory node
appropriately.
Signed-off-by: Hristo Venev <hristo@venev.name>
Hristo Venev [Wed, 22 Apr 2020 10:40:47 +0000 (13:40 +0300)]
dts: bcm2711: set #size-cells = <2>
There already is one 4 GiB range, and one more will appear when high
peripheral mode is enabled.
Signed-off-by: Hristo Venev <hristo@venev.name>
Phil Elwell [Tue, 21 Apr 2020 16:34:27 +0000 (17:34 +0100)]
ARM: dts: Create bcm2708-rpi-b-rev1.dts
The first revision of the Pi Model B used I2C0 to address the camera
and I2C0 was available for user applications on the 26-pin header.
The second revision switched the roles, kept I2C0 on the 26-pin header
and added I2C1 on a new 8-way header (P5).
Up to now, downstream DTS has used a single file for both revisions of
the board, with a small amount of patching from the firmware. With the
introduction of an I2C mux to share I2C0 between the camera/display
connectors and the IDC headers, the difference between the two versions
becomes too great to comfortably manage with tweaking, hence this split.
Upstream DTS files already have bcm2835-rpi-b.dts and
bcm2835-rpi-b-rev2.dts, but for backwards compatibility the new file is
being added as bcm2708-rpi-b-rev1.dts, rather than renaming the old
shared version to bcm2708-rpi-b-rev2.dts.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Dave Stevenson [Thu, 9 Apr 2020 16:26:13 +0000 (17:26 +0100)]
dt: Update all mainline bcm283x dt files for i2c0 pinctrl mux
BSC0 (aka i2c0) can me muxed via pinctrl to GPIOs 0&1, 28&29, or
44&45. These have different uses based on the platform (40pin header,
and CSI/DSI connectors), so add a pinctrl I2C mux between the
different options.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Thu, 9 Apr 2020 14:04:14 +0000 (15:04 +0100)]
dtoverlays: Update CSI overlays to use i2c_csi_dsi
Update all overlays that were using i2c_vc for talking to CSI
source devices to use the new i2c_csi_dsi node via i2c_mux_pinctrl.
Remove the pins overrides as well.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Thu, 9 Apr 2020 11:46:13 +0000 (12:46 +0100)]
dt: Implement an I2C pinctrl mux for BSC0.
BSC0 serves either the HAT EEPROM pins on the 40pin connector,
or the display and camera on a board specific pairing of either
GPIO 28&29, or 44&45.
Use I2C_MUX_PINCTRL to allow exposing both pairs of pins as I2C
busses.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Thu, 9 Apr 2020 11:43:22 +0000 (12:43 +0100)]
defconfig: Enable I2C_MUX_PINCTRL in all Pi configs
To be used to switch between the camera/display pins, and
the HAT pins for i2c-0.
(arm64/bcmrpi3_defconfig was missing all the I2C mux support,
so enable it all)
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Phil Elwell [Tue, 21 Apr 2020 10:30:23 +0000 (11:30 +0100)]
driver: char: rpivid: Don't map more than wanted
Limit mappings to the permitted range, but don't map more than asked
for otherwise we walk off the end of the allocated VMA.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Phil Elwell [Mon, 20 Apr 2020 21:18:52 +0000 (22:18 +0100)]
driver: char: rpivid: Remove legacy name support
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Phil Elwell [Mon, 20 Apr 2020 10:25:18 +0000 (11:25 +0100)]
dts: bcm2711: EMMC2 can address the whole first GB
Although 0xfc000000 looks like an inaccessible RAM address (due to the
peripheral mappings), with RAM mapped at 0xc0000000 (as it is on the
30/32-bit VPU bus) this is actually 0x3c000000 in the ARM memory space,
which is fine.
This difference is potentially the cause of some warnings seen in
sdhci_send_command.
Fixes: "dts: bcm2711: Move emmc2 to its own 'bus'"
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Naushir Patuck [Thu, 12 Mar 2020 14:09:38 +0000 (14:09 +0000)]
media: imx219: Advertise embedded data node on media pad 1
This commit updates the imx219 driver to adverise support for embedded
data streams. This can then be used by the bcm2835-unicam driver, which
has recently been updated to expose the embedded data stream to
userland.
The imx219 sensor subdevice overloads the media pad to differentiate
between image stream (pad 0) and embedded data stream (pad 1) when
performing the v4l2_subdev_pad_ops functions.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Phil Elwell [Fri, 17 Apr 2020 15:20:55 +0000 (16:20 +0100)]
Revert "firmware: raspberrypi: register clk device"
This reverts commit
91f2cf4a6b2131016b1ae9c9500245f0572112c7.
Revert this because the clock driver won't probe without a DT node, and
creating it as a platform device won't give it one. Doing so avoids the
following error message:
raspberrypi-clk raspberrypi-clk: Missing firmware node
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
popcornmix [Fri, 17 Apr 2020 15:24:21 +0000 (16:24 +0100)]
configs: Enable CONFIG_ARM_BCM2835_CPUFREQ
We actually use the 64-bit 2711 kernel on Pi3 too.
It still uses the downstream cpufreq driver in DT.
See: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=269769&start=100#p1644752
Signed-off-by: popcornmix <popcornmix@gmail.com>
Laurent Pinchart [Tue, 24 Mar 2020 21:13:02 +0000 (23:13 +0200)]
media: bcm2835-unicam: Add support for the FRAME_SYNC event
The FRAME_SYNC event is useful for userspace image processing algorithms
to program the camera sensor as early as possible after frame start.
Support it.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Laurent Pinchart [Tue, 24 Mar 2020 21:13:02 +0000 (23:13 +0200)]
media: bcm2835-unicam: Disable event-related ioctls on metadata node
The unicam driver supports both the SOURCE_CHANGE and CTRL events. Both
events are only generated on the image video node, so the event-related
ioctls are useless on the medatada node. Disable them.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Dafna Hirschfeld [Tue, 31 Mar 2020 18:06:30 +0000 (20:06 +0200)]
media: i2c: imx219: Fix a bug in imx219_enum_frame_size
https://patchwork.linuxtv.org/patch/62740/
When enumerating the frame sizes, the value sent to
imx219_get_format_code should be fse->code
(the code from the ioctl) and not imx219->fmt.code
which is the code set currently in the driver.
Fixes:
22da1d56e ("media: i2c: imx219: Add support for RAW8 bit bayer format")
Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: Helen Koike <helen.koike@collabora.com>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Lad Prabhakar [Tue, 10 Mar 2020 13:17:09 +0000 (14:17 +0100)]
media: i2c: imx219: Add support for cropped 640x480 resolution
Commit
25130b8ad409d5532f3763bcf891af74f550a70d upstream.
This patch adds mode table entry for capturing cropped 640x480 resolution
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Acked-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Lad Prabhakar [Tue, 10 Mar 2020 13:17:08 +0000 (14:17 +0100)]
media: i2c: imx219: Add support for RAW8 bit bayer format
Commit
22da1d56e982151e0bdfafe9de6fe94098a51356 upstream.
IMX219 sensor is capable for RAW8/RAW10 modes. This commit adds support
for RAW8 bayer format.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Lad Prabhakar [Tue, 10 Mar 2020 13:17:07 +0000 (14:17 +0100)]
media: i2c: imx219: Fix power sequence
Commit
ca45448a56659c6df6e0436188e97f6cc65dea8a upstream.
When supporting Rpi Camera v2 Module on the RZ/G2E, found the driver had
some issues with rcar mipi-csi driver. The sensor never entered into LP-11
state.
The powerup sequence in the datasheet[1] shows the sensor entering into
LP-11 in streaming mode, so to fix this issue transitions are performed
from "streaming -> standby" in the probe() after power up.
With this commit the sensor is able to enter LP-11 mode during power up,
as expected by some CSI-2 controllers.
[1] https://publiclab.org/system/images/photos/000/023/294/original/
RASPBERRY_PI_CAMERA_V2_DATASHEET_IMX219PQH5_7.0.0_Datasheet_XXX.PDF
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Acked-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Phil Elwell [Fri, 17 Apr 2020 09:46:19 +0000 (10:46 +0100)]
spi: Force CS_HIGH if GPIO descriptors are used
Commit
f3186dd87669 ("spi: Optionally use GPIO descriptors for CS GPIOs")
amended of_spi_parse_dt() to always set SPI_CS_HIGH for SPI slaves whose
Chip Select is defined by a "cs-gpios" devicetree property.
This change breaks drivers whose probe functions set the mode field of
the spi_device because in doing so they clear the SPI_CS_HIGH flag.
Fix by setting SPI_CS_HIGH in spi_setup (under the same conditions as
in of_spi_parse_dt()).
See also:
83b2a8fe43bd ("spi: spidev: Fix CS polarity if GPIO descriptors are used")
Fixes:
f3186dd87669 ("spi: Optionally use GPIO descriptors for CS GPIOs")
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Naushir Patuck [Thu, 2 Apr 2020 15:08:51 +0000 (16:08 +0100)]
media: bcm2835-unicam: Use dummy buffer if none have been queued
If no buffer has been queued by a userland application, we use an
internal dummy buffer for the hardware to spin in. This will allow
the driver to release the existing userland buffer back to the
application for processing.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Naushir Patuck [Thu, 16 Apr 2020 10:35:41 +0000 (11:35 +0100)]
media: bcm2835-unicam: Add embedded data node.
This patch adds a new node in the bcm2835-unicam driver to support
CSI-2 embedded data streams. The subdevice is queried to see if
embedded data is available from the sensor.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Naushir Patuck [Tue, 7 Apr 2020 09:42:14 +0000 (10:42 +0100)]
media: bcm2835-unicam: Add support for mulitple device nodes.
Move device node specific state out of the device state structure and
into a new node structure. This separation will be needed for future
changes where we will add an embedded data node to the driver to work
alongside the existing image data node.
Currently only use a single image node, so this commit does not add
any functional changes.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Naushir Patuck [Tue, 21 Jan 2020 14:06:47 +0000 (14:06 +0000)]
media: uapi: Add MEDIA_BUS_FMT_SENSOR_DATA media bus format
This patch adds MEDIA_BUS_FMT_SENSOR_DATA used by the bcm2835-unicam
driver to support CSI-2 embedded data streams from camera sensors.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Naushir Patuck [Wed, 1 Apr 2020 07:46:29 +0000 (08:46 +0100)]
media: uapi: v4l2-core: Add sensor ancillary data V4L2 foucc type.
Add V4L2_META_FMT_SENSOR_DATA format 4CC.
This new format will be used by the BCM2835 Unicam device to return
out camera sensor embedded data.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Naushir Patuck [Wed, 1 Apr 2020 07:46:29 +0000 (08:46 +0100)]
defconfig: Add bcm2835-unicam to platform defconfigs.
This commit enables the bcm2835-unicam driver in the following
defconfigs:
bcm2709_defconfig
bcm2711_defconfig
bcmrpi_defconfig
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Naushir Patuck [Wed, 1 Apr 2020 07:39:49 +0000 (08:39 +0100)]
media: bcm2835-unicam: Driver for CCP2/CSI2 camera interface
Add driver for the Unicam camera receiver block on
BCM283x processors.
This commit is made up of a series of changes cherry-picked from the
rpi-4.19.y branch.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Jacopo Mondi [Tue, 7 Apr 2020 15:21:57 +0000 (17:21 +0200)]
media: v4l2-dev: Add v4l2_device_register_ro_subdev_node()
Add to the V4L2 core a function to register device nodes for video
subdevices in read-only mode.
Registering a device node in read-only mode is useful to expose to
userspace the current sub-device configuration, without allowing
application to change it by using the V4L2 subdevice ioctls.
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Jacopo Mondi [Tue, 7 Apr 2020 15:21:56 +0000 (17:21 +0200)]
Documentation: media: Document read-only subdevice
Document a new kAPI function to register subdev device nodes in read only
mode and for each affected ioctl report how access is restricted.
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Jacopo Mondi [Tue, 7 Apr 2020 15:21:55 +0000 (17:21 +0200)]
Documentation: media: Update sub-device API intro
Update the V4L2 sub-device userspace API introduction to provide more
details on why complex devices might want to register devnodes for the
connected subdevices.
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>