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>
Jörg Schambacher [Wed, 15 Apr 2020 09:48:29 +0000 (11:48 +0200)]
Fixes a problem with clock settings of HiFiBerry DAC+ADC PRO (#3545)
This patch fixes a problem of the re-calculation of
i2s-clock and -parameter settings when only the ADC is activated.
Signed-off-by: Joerg Schambacher <joerg@i2audio.com>
James Hilliard [Sat, 11 Apr 2020 01:24:40 +0000 (19:24 -0600)]
drm/vc4: hdmi: Silence pixel clock error on -EPROBE_DEFER
If the vc4 hdmi driver loads before the pixel clock is available we
see a spurious "*ERROR* Failed to get pixel clock" error.
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Phil Elwell [Thu, 5 Dec 2019 18:02:08 +0000 (18:02 +0000)]
dts: bcm2711: Move emmc2 to its own "bus"
Moving the EMMC2 controller under a dedicated bus allows the firmware
to patch the dma-ranges property for different memory sizes without
affecting anything else.
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
Phil Elwell [Tue, 4 Feb 2020 12:51:56 +0000 (12:51 +0000)]
ARM: dts: Extend SCB bus address range
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Phil Elwell [Thu, 27 Feb 2020 12:00:42 +0000 (12:00 +0000)]
configs: Restore CONFIG_GPIO_SYSFS
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Phil Elwell [Tue, 14 Apr 2020 14:25:02 +0000 (15:25 +0100)]
ARM: dts: bcm2711: Restrict CMA to first 768MB
The downstream 32-bit 2711 kernel configuration enables HIGHMEM for
access to more physical RAM. The HIGHMEM zone starts at 0x30000000
(768MB), and allowing the CMA zone to overlap that area causes a
failure during CMA activation.
Avoid the overlap by limiting CMA to the first 768MB. This is overly
restrictive on a 64-bit kernel, but shouldn't cause any practical
problems.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Nicolas Saenz Julienne [Thu, 19 Mar 2020 19:00:13 +0000 (20:00 +0100)]
ARM: dts: bcm283x: Fix vc4's firmware bus DMA limitations
The bus is virtual and devices have to inherit their DMA constraints
from the underlying interconnect. So add an empty dma-ranges property to
the bus node, implying the firmware bus' DMA constraints are identical to
its parent's.
Fixes:
7dbe8c62ceeb ("ARM: dts: Add minimal Raspberry Pi 4 support")
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Nicolas Saenz Julienne [Thu, 2 Apr 2020 17:54:33 +0000 (19:54 +0200)]
ARM: dts: overlays: Unify overlay CMA handling
Now that we don't have to abuse the kernel command line to change CMA's
size we can clean-up and centralize CMA usage in overlays.
A new file, cma-overlay.dts is created to be used as a standalone
overlay or included on other overlays. All CMA users are converted to
this scheme. Ultimately upstream-overlay.dts is also updated to use the
default CMA size provided by upstream.
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Nicolas Saenz Julienne [Thu, 2 Apr 2020 17:22:46 +0000 (19:22 +0200)]
ARM: dts: Use upstream CMA configuration
Now that the kernel command line has precedence over the device tree,
we can use the upstream CMA setup without breaking backward
compatibility.
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Nicolas Saenz Julienne [Fri, 10 Jan 2020 17:19:33 +0000 (18:19 +0100)]
dma-contiguous: CMA: give precedence to cmdline
commit
8c8c5a4994a306c217fd061cbfc5903399fd4c1c upstream.
Although the device tree might contain a reserved-memory DT node
dedicated as the default CMA pool, users might want to change CMA's
parameters using the kernel command line for debugging purposes and
whatnot. Honor this by bypassing the reserved memory CMA setup, which
will ultimately end up freeing the memblock and allow the command line
CMA configuration routine to run.
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Phil Elwell <phil@raspberrypi.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Nicolas Saenz Julienne [Fri, 10 Jan 2020 17:29:35 +0000 (18:29 +0100)]
ARM: dts: bcm283x: Unify CMA configuration
commit
c5a1e5375d19bd4001c59dc5d482ac5b1ba51cbf upstream.
With the introduction of the Raspberry Pi 4 we were forced to explicitly
configure CMA's location, since arm64 defaults it into the ZONE_DMA32
memory area, which is not good enough to perform DMA operations on that
device. To bypass this limitation a dedicated CMA DT node was created,
explicitly indicating the acceptable memory range and size.
That said, compatibility between boards is a must on the Raspberry Pi
ecosystem so this creates a common CMA DT node so as for DT overlays to
be able to update CMA's properties regardless of the board being used.
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Phil Elwell <phil@raspberrypi.org>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Will Deacon [Tue, 3 Dec 2019 12:10:13 +0000 (12:10 +0000)]
arm64: mm: Fix initialisation of DMA zones on non-NUMA systems
commit
93b90414c33f59b7960bc8d607da0ce83377e021 upstream.
John reports that the recently merged commit
1a8e1cef7603 ("arm64: use
both ZONE_DMA and ZONE_DMA32") breaks the boot on his DB845C board:
| Booting Linux on physical CPU 0x0000000000 [0x517f803c]
| Linux version 5.4.0-mainline-10675-g957a03b9e38f
| Machine model: Thundercomm Dragonboard 845c
| [...]
| Built 1 zonelists, mobility grouping on. Total pages: -188245
| Kernel command line: earlycon
| firmware_class.path=/vendor/firmware/ androidboot.hardware=db845c
| init=/init androidboot.boot_devices=soc/1d84000.ufshc
| printk.devkmsg=on buildvariant=userdebug root=/dev/sda2
| androidboot.bootdevice=1d84000.ufshc androidboot.serialno=
c4e1189c
| androidboot.baseband=sda
| msm_drm.dsi_display0=dsi_lt9611_1080_video_display:
| androidboot.slot_suffix=_a skip_initramfs rootwait ro init=/init
|
| <hangs indefinitely here>
This is because, when CONFIG_NUMA=n, zone_sizes_init() fails to handle
memblocks that fall entirely within the ZONE_DMA region and erroneously ends up
trying to add a negatively-sized region into the following ZONE_DMA32, which is
later interpreted as a large unsigned region by the core MM code.
Rework the non-NUMA implementation of zone_sizes_init() so that the start
address of the memblock being processed is adjusted according to the end of the
previous zone, which is then range-checked before updating the hole information
of subsequent zones.
Cc: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/lkml/CALAqxLVVcsmFrDKLRGRq7GewcW405yTOxG=KR3csVzQ6bXutkA@mail.gmail.com
Fixes:
1a8e1cef7603 ("arm64: use both ZONE_DMA and ZONE_DMA32")
Reported-by: John Stultz <john.stultz@linaro.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Nicolas Saenz Julienne [Thu, 7 Nov 2019 09:56:11 +0000 (10:56 +0100)]
arm64: mm: reserve CMA and crashkernel in ZONE_DMA32
commit
bff3b04460a80f425442fe8e5c6ee8c3ebef611f upstream.
With the introduction of ZONE_DMA in arm64 we moved the default CMA and
crashkernel reservation into that area. This caused a regression on big
machines that need big CMA and crashkernel reservations. Note that
ZONE_DMA is only 1GB big.
Restore the previous behavior as the wide majority of devices are OK
with reserving these in ZONE_DMA32. The ones that need them in ZONE_DMA
will configure it explicitly.
Fixes:
1a8e1cef7603 ("arm64: use both ZONE_DMA and ZONE_DMA32")
Reported-by: Qian Cai <cai@lca.pw>
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
AMuszkat [Wed, 8 Apr 2020 08:04:49 +0000 (10:04 +0200)]
ASoC: ma120x0p: Add 96KHz rate support
Add 96KHz rate support to MA120X0P codec and make enable and mute gpio
pins optional.
Signed-off-by: AMuszkat <ariel.muszkat@gmail.com>
AMuszkat [Wed, 8 Apr 2020 07:31:39 +0000 (09:31 +0200)]
configs: add MA120X0P codec
Signed-off-by: AMuszkat <ariel.muszkat@gmail.com>
Phil Elwell [Wed, 8 Apr 2020 14:23:56 +0000 (15:23 +0100)]
kbuild: Disable gcc plugins
The GCC plugin feature leads to different kernel configurations on what
ought to be equivalent build systems because they depend on the build
hosts native compilers rather than the cross compilers needed for the
target. This causes problems with module symbol version mismatches.
Disable GCC plugins for all build hosts.
Advanced build script hackery borrowed from a patch by milhouse.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Phil Elwell [Wed, 8 Apr 2020 10:59:39 +0000 (11:59 +0100)]
overlays: Fix dtc warnings in i2c-gpio
Better late than never.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Matt Flax [Wed, 8 Apr 2020 10:00:30 +0000 (20:00 +1000)]
Add support for the AudioInjector.net Isolated sound card
This patch adds support for the Audio Injector Isolated sound card.
Signed-off-by: Matt Flax <flatmax@flatmax.org>
Phil Elwell [Wed, 8 Apr 2020 08:48:29 +0000 (09:48 +0100)]
configs: FS_ENCRYPTION replaces EXT4_ENCRYPTION
The filesystem-specific encryption options have been replaced by a
generic FS_ENCRYPTION option.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
popcornmix [Mon, 9 Sep 2019 14:49:56 +0000 (15:49 +0100)]
clk-raspberrypi: Allow cpufreq driver to also adjust gpu clocks
For performance/power it is beneficial to adjust gpu clocks with arm clock.
This is how the downstream cpufreq driver works
Signed-off-by: popcornmix <popcornmix@gmail.com>
Phil Elwell [Mon, 6 Apr 2020 08:47:42 +0000 (09:47 +0100)]
Add upstream and upstream-pi4 to overlay_map
Because the upstream overlay applies vc4-kms-v3d, of which Pi 4 has its
own version, there also needs to be a Pi 4 version - vc4-kms-v3d-pi4.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Phil Elwell [Wed, 1 Apr 2020 14:51:56 +0000 (15:51 +0100)]
overlays: Add vc4-kms-v3d-pi4 to overlay_map
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Phil Elwell [Wed, 1 Apr 2020 16:24:15 +0000 (17:24 +0100)]
overlays: Formally rename/deprecate old overlays
Take advantage of the overlay_map to rename or deprecate some obsolete
overlays.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Phil Elwell [Wed, 1 Apr 2020 14:09:42 +0000 (15:09 +0100)]
overlays: Add overlay_map
The overlay map permits platform-specific overlays, with deprecation
and renaming.
See: https://github.com/raspberrypi/linux/issues/3520
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
popcornmix [Thu, 2 Apr 2020 15:46:31 +0000 (16:46 +0100)]
vc4_hdmi_phy: Fix offset calculation
The original firmware code worked with float and did
offset = ((vco_freq / fref * 2) * (1 << 22));
offset >>= 2;
In this code it's all integer so doing the integer divide before the shift loses lots of precision
This fixes the issue of 1080p59.94 mode having 59.64 fps
Signed-off-by: popcornmix <popcornmix@gmail.com>
Phil Elwell [Fri, 27 Mar 2020 13:49:25 +0000 (13:49 +0000)]
overlays: Add missing rpi-poe parameters
The rpi-poe fan overlay has gained two more fan speeds and adjusted
the thresholds and hystereses.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Dave Stevenson [Tue, 31 Mar 2020 16:54:08 +0000 (17:54 +0100)]
dt: Drop I2C for Pi4 HDMI interfaces to 97.5kHz.
It was set to 390kHz, which is outside of the required spec for
reading HDMI (max 100kHz). The i2c-brcmstb driver only supports
a number of fixed bus speeds, of which 97.5kHz is the closest to
100kHz without exceeding it.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Tue, 31 Mar 2020 15:23:11 +0000 (16:23 +0100)]
i2c: brcmstb: The interrupt line is optional, so use platform_get_irq_optional
If there is no interrupt defined then an error is logged due
to the use of platform_get_irq. The driver handles not having
the interrupt by falling back to polling, therefore make
the appropriate call when claiming it.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Tue, 31 Mar 2020 15:21:45 +0000 (16:21 +0100)]
drm/vc4-hdmi: Give the HDMI audio instances different names
The debugfs usage within asoc gets confused if multiple interfaces
have the same card name, therefore use unique names when
initialising them.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Mon, 30 Mar 2020 17:25:10 +0000 (18:25 +0100)]
drm/vc4: Fixup plane init within firmware-kms
"drm/vc4: plane: Move additional planes creation to driver" moved
overlay and cursor plane creation to a global function thata was
unconditionally run, when it is not wanted in firmware KMS mode.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Mon, 30 Mar 2020 11:52:26 +0000 (12:52 +0100)]
drm/vc4: Fixup for firmware KMS
Fix up "drm/vc4: Kick the core clock up during a mode change" for
firmware KMS mode where we don't have the HVS or core clock
configured.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Thu, 26 Mar 2020 15:32:19 +0000 (15:32 +0000)]
drm/vc4: Kick the core clock up during a mode change
Experimental commit to kick the core clock up during mode
switching. This makes mode switching far more reliable, and
mimics what the firmware does.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Thu, 26 Mar 2020 11:51:55 +0000 (11:51 +0000)]
dtoverlays: Remove comment about vc4-kms-v3d locking up X from README
Using vc4-kms-v3d with X has worked for quite a while, and essentially
required not using fbturbo and having an up to date MESA library.
Remove the comment that says otherwise.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 25 Mar 2020 18:22:40 +0000 (18:22 +0000)]
drm/vc4: Alter the HDMI state machine clock calc to allow for 1920x1200
Whilst the documentation for BCM2835 states that the HDMI state machine
clock needs to be 108% of the pixel clock, other documentation says
that it only has to be greater than the pixel clock. The firmware
uses 101%, and that allows 1920x1200@60Hz to work within the
constraint of the HSM clock being < 163.68MHz.
Adopt 101%, and increase the maximum pixel clock for vc4 to 162MHz
so that it too supports 1920x1200@60.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 25 Mar 2020 18:18:45 +0000 (18:18 +0000)]
drm/vc4: Enable audio on Pi4.
This could be a revert of "drm/vc4: hdmi: Add an audio support flag"
as it is no longer needed.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 25 Mar 2020 18:16:14 +0000 (18:16 +0000)]
drm/vc4: Add audio initialisation for Pi4.
The audio configuration has changed for Pi4, so support the
configuration functions via the variant tables.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 25 Mar 2020 18:11:41 +0000 (18:11 +0000)]
drm/vc4: Use reg-names to configure HDMI audio.
HDMI audio configuration was using fixed index numbers to
load in DT register settings.
Switch to using reg-names for flexibility and to match Pi4.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 25 Mar 2020 18:08:39 +0000 (18:08 +0000)]
dt: Add HDMI audio dma values to bcm2711.dtsi
Adds the relevant DMA settings for HDMI audio to work.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 25 Mar 2020 18:07:19 +0000 (18:07 +0000)]
dts: Add reg-names for the HDMI registers on bcm2835
Pi4 is requiring many more register configs in the HDMI
block, and has switched to using reg-names instead of fixed index
values.
Switch bc2835-common to match.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 25 Mar 2020 18:03:42 +0000 (18:03 +0000)]
drm/vc4: Set the b-frame marker to the match ALSA's default.
ALSA's iec958 plugin by default sets the block start preamble
to 8, whilst this driver was programming the hardware to expect
0xF.
Amend the hardware config to match ALSA.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Wed, 25 Mar 2020 18:01:04 +0000 (18:01 +0000)]
drm/vc4: Reset audio infoframe on encoder_enable if previously streaming
If the encoder is disabled and re-enabled (eg mode change) all infoframes
are reset, whilst the audio subsystem know nothing about this change.
The driver therefore needs to reinstate the audio infoframe for
itself.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Mon, 17 Feb 2020 11:37:21 +0000 (11:37 +0000)]
dt: Update v3d to use firmware_clocks.
Use the updated DT clock-names property to map the v3d clock
to the firmware_clocks driver, instead of the older clkdev API.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Tue, 11 Feb 2020 15:36:59 +0000 (15:36 +0000)]
drm/vc4: The check for assigned HVS channels is not applicable firmware_kms
Channel assignments is only in full KMS, so skip the check
if in firmware kms mode.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Tue, 25 Feb 2020 17:35:10 +0000 (17:35 +0000)]
Fixup P030 support
I got the logic wrong for enabling pixel formats, resulting in
Pi0-3 only getting a single, invalid, format (P030 SAND).
Fixes: e07ef1d drm/vc4: Add support for DRM_FORMAT_P030 to vc4 planes
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Fri, 24 Jan 2020 14:25:41 +0000 (14:25 +0000)]
drm/vc4: Add support for DRM_FORMAT_P030 to vc4 planes
This currently doesn't handle non-zero source rectangles correctly,
but add support for DRM_FORMAT_P030 with DRM_FORMAT_MOD_BROADCOM_SAND128
modifier to planes when running on HVS5.
WIP still for source cropping SAND/P030 formats
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Dave Stevenson [Mon, 27 Jan 2020 10:22:44 +0000 (10:22 +0000)]
drm: Checking of the pitch is only valid for linear formats
framebuffer_check was computing a minimum pitch value and ensuring
that the provided value was greater than this.
That check is only valid if the format is linear.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>