platform/kernel/linux-rpi.git
4 years agomedia: i2c: imx290: Move the settle time delay out of loop
Manivannan Sadhasivam [Fri, 12 Jun 2020 13:53:54 +0000 (15:53 +0200)]
media: i2c: imx290: Move the settle time delay out of loop

Commit 6544af9b04b4484867c234ba0be1b5008e4a14ee upstream.

The 10ms settle time is needed only at the end of all consecutive
register writes. So move the delay to outside of the for loop of
imx290_set_register_array().

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: i2c: imx290: Add support to enumerate all frame sizes
Manivannan Sadhasivam [Fri, 12 Jun 2020 13:53:53 +0000 (15:53 +0200)]
media: i2c: imx290: Add support to enumerate all frame sizes

Commit 3b867fb641d884b714fba390ae866714ba475f29 upstream.

Add support to enumerate all frame sizes supported by IMX290. This is
required for using with userspace tools such as libcamera.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: i2c: imx290: Add RAW12 mode support
Manivannan Sadhasivam [Fri, 12 Jun 2020 13:53:52 +0000 (15:53 +0200)]
media: i2c: imx290: Add RAW12 mode support

Commit c566ac01ceaa02450acc155201772c0623530e76 upstream.

IMX290 is capable of outputting frames in both Raw Bayer (packed) 10 and
12 bit formats. Since the driver already supports RAW10 mode, let's add
the missing RAW12 mode as well.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: i2c: imx290: Add support for test pattern generation
Manivannan Sadhasivam [Fri, 12 Jun 2020 13:53:51 +0000 (15:53 +0200)]
media: i2c: imx290: Add support for test pattern generation

Commit a58df1f9e4885eaf3d0663574a217e513821a9f0 upstream.

Add support for generating following test patterns by IMX290:

* Sequence Pattern 1
* Horizontal Color-bar Chart
* Vertical Color-bar Chart
* Sequence Pattern 2
* Gradation Pattern 1
* Gradation Pattern 2
* 000/555h Toggle Pattern

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: i2c: imx290: Add configurable link frequency and pixel rate
Manivannan Sadhasivam [Fri, 12 Jun 2020 13:53:50 +0000 (15:53 +0200)]
media: i2c: imx290: Add configurable link frequency and pixel rate

Commit 98e0500eadb772e1be32d8e369fcc3b7bcac93ed upstream.

IMX290 operates with multiple link frequency and pixel rate combinations.
The initial driver used a single setting for both but since we now have
the lane count support in place, let's add configurable link frequency
and pixel rate.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: i2c: imx290: Add support for 2 data lanes
Manivannan Sadhasivam [Fri, 12 Jun 2020 13:53:49 +0000 (15:53 +0200)]
media: i2c: imx290: Add support for 2 data lanes

Commit 97589ad61c730e0f486635c6c19fa25ab8e8f29d upstream.

The IMX290 sensor can output frames with 2/4 CSI2 data lanes. This commit
adds support for 2 lane mode in addition to the 4 lane and also
configuring the data lane settings in the driver based on system
configuration.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: i2c: imx290: fix reset GPIO pin handling
Andrey Konovalov [Fri, 12 Jun 2020 13:53:48 +0000 (15:53 +0200)]
media: i2c: imx290: fix reset GPIO pin handling

Commit 3909a92d7df622b41b9ceeeea694e641cad7667b upstream.

According to https://www.kernel.org/doc/Documentation/gpio/consumer.txt,

- all of the gpiod_set_value_xxx() functions operate with the *logical*
value. So in imx290_power_on() the reset signal should be cleared
(de-asserted) with gpiod_set_value_cansleep(imx290->rst_gpio, 0), and in
imx290_power_off() the value of 1 must be used to apply/assert the reset
to the sensor. In the device tree the reset pin is described as
GPIO_ACTIVE_LOW, and gpiod_set_value_xxx() functions take this into
account,

- when devm_gpiod_get_optional() is called with GPIOD_ASIS, the GPIO is
not initialized, and the direction must be set later; using a GPIO
without setting its direction first is illegal and will result in undefined
behavior. Fix this by using GPIOD_OUT_HIGH instead of GPIOD_ASIS (this
asserts the reset signal to the sensor initially).

Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: i2c: imx290: fix the order of the args in SET_RUNTIME_PM_OPS()
Andrey Konovalov [Fri, 12 Jun 2020 13:53:47 +0000 (15:53 +0200)]
media: i2c: imx290: fix the order of the args in SET_RUNTIME_PM_OPS()

Commit 8d2d1bedb1b9af3e0c039a4444858da7b6da71f8 upstream.

The macro is defined as SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn),
so imx290_power_off must be the 1st arg, and imx290_power_on the 2nd.

Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: i2c: imx290: set the format before VIDIOC_SUBDEV_G_FMT is called
Andrey Konovalov [Fri, 12 Jun 2020 13:53:46 +0000 (15:53 +0200)]
media: i2c: imx290: set the format before VIDIOC_SUBDEV_G_FMT is called

Commit d46cfdc86c30d5ec768924f0b1e2683c8d20b671 upstream.

With the current driver 'media-ctl -p' issued right after the imx290 driver
is loaded prints:
pad0: Source
             [fmt:unknown/0x0]

The format value of zero is due to the current_format field of the imx290
struct not being initialized yet.

As imx290_entity_init_cfg() calls imx290_set_fmt(), the current_mode field
is also initialized, so the line which set current_mode to a default value
in driver's probe() function is no longer needed.

Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: i2c: Add IMX290 CMOS image sensor driver
Manivannan Sadhasivam [Fri, 4 Oct 2019 16:05:25 +0000 (13:05 -0300)]
media: i2c: Add IMX290 CMOS image sensor driver

Commit 828dbc299278065b634e913d2700d254a3224853 upstream.

Add driver for Sony IMX290 CMOS image sensor driver. The driver only
supports I2C interface for programming and MIPI CSI-2 for sensor output.

[Sakari Ailus: Rewrapped a few lines over 80 chars a little.]

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: dt-bindings: media: i2c: Add IMX290 CMOS sensor binding
Manivannan Sadhasivam [Fri, 4 Oct 2019 16:05:24 +0000 (13:05 -0300)]
media: dt-bindings: media: i2c: Add IMX290 CMOS sensor binding

Commit 8a97a4676f8b1badcd9cfbed2b081342847bb1b1 upstream.

Add devicetree binding for IMX290 CMOS image sensor. Let's also
add MAINTAINERS entry for the binding and driver.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: bcm2835-unicam: Avoid gcc warning over {0} on endpoint
Dave Stevenson [Fri, 26 Jun 2020 14:53:44 +0000 (15:53 +0100)]
media: bcm2835-unicam: Avoid gcc warning over {0} on endpoint

Older gcc versions object to = { 0 } initialisation if the first
elemtn in the structure is a substructure.

Use = { } to avoid this compiler warning.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agodt/dtoverlays: Fix up base DT and overlays for updated Unicam driver
Dave Stevenson [Tue, 23 Jun 2020 14:41:42 +0000 (15:41 +0100)]
dt/dtoverlays: Fix up base DT and overlays for updated Unicam driver

The upstreamed Unicam driver uses a dt property to denote how many
lanes are supported by the receiver peripheral, independent of
the number of lanes that the sensor wants to use. It also doesn't
check the remote endpoint config for the number of lanes as that
isn't the accepted way of doing things.

Update the base DT for the brcm,num-data-lanes property, and the
overlays to define the desired number of lanes at both ends of
the link.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agomedia: bcm2835-unicam: change minimum number of vb2_queue buffers to 1
David Plowman [Thu, 28 May 2020 10:09:48 +0000 (11:09 +0100)]
media: bcm2835-unicam: change minimum number of vb2_queue buffers to 1

Since the unicam driver was modified to write to a dummy buffer when no
user-supplied buffer is available, it can now write to and return a
buffer even when there's only a single one. Enable this by changing the
min_buffers_needed in the vb2_queue; it will be useful for enabling
still captures without allocating more memory than absolutely necessary.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
4 years agomedia: bcm2835-unicam: Retain packing information on G_FMT
Dave Stevenson [Tue, 19 May 2020 10:46:47 +0000 (11:46 +0100)]
media: bcm2835-unicam: Retain packing information on G_FMT

The change to retrieve the pixel format always on g_fmt didn't
check whether the native or unpacked version of the format
had been requested, and always returned the packed one.
Correct this so that the packing setting is retained whereever
possible.

Fixes "9d59e89 media: bcm2835-unicam: Re-fetch mbus code from subdev
on a g_fmt call"

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agomedia: bcm2835-unicam: Fixup review comments from Hans.
Dave Stevenson [Tue, 23 Jun 2020 14:14:05 +0000 (15:14 +0100)]
media: bcm2835-unicam: Fixup review comments from Hans.

Updates the driver based on the upstream review comments from
Hans Verkuil at https://patchwork.linuxtv.org/patch/63531/

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agomedia: bcm2835: unicam: Fix uninitialized warning
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>
4 years agomedia: bcm2835-unicam: Always service interrupts
Dave Stevenson [Wed, 13 May 2020 17:28:27 +0000 (18:28 +0100)]
media: bcm2835-unicam: Always service interrupts

From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

https://github.com/raspberrypi/linux/issues/3602

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agomedia: bcm2835-unicam: Add support for get_mbus_config to set num lanes
Dave Stevenson [Tue, 23 Jun 2020 13:32:51 +0000 (14:32 +0100)]
media: bcm2835-unicam: Add support for get_mbus_config to set num lanes

Use the get_mbus_config pad subdev call to allow a source to use
fewer than the number of CSI2 lanes defined in device tree.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agomedia: bcm2835-unicam: Driver for CCP2/CSI2 camera interface
Naushir Patuck [Mon, 4 May 2020 09:25:41 +0000 (12:25 +0300)]
media: bcm2835-unicam: Driver for CCP2/CSI2 camera interface

Add a driver for the Unicam camera receiver block on BCM283x processors.
Compared to the bcm2835-camera driver present in staging, this driver
handles the Unicam block only (CSI-2 receiver), and doesn't depend on
the VC4 firmware running on the VPU.

The commit is made up of a series of changes cherry-picked from the
rpi-5.4.y branch of https://github.com/raspberrypi/linux/ with
additional enhancements, forward-ported to the mainline kernel.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reported-by: kbuild test robot <lkp@intel.com>
4 years agoinclude: media: Add vfl_devnode_type of VFL_TYPE_VIDEO
Dave Stevenson [Tue, 23 Jun 2020 09:35:24 +0000 (10:35 +0100)]
include: media: Add vfl_devnode_type of VFL_TYPE_VIDEO

Upsstream are renaming VFL_TYPE_GRABBER to VFL_TYPE_VIDEO.
To make backporting the upstream Unicam driver easier, add an
extra enum entry (same as VFL_TYPE_GRABBER) to match that.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agodrivers: media: Remove the downstream version of bcm2835-unicam
Dave Stevenson [Tue, 23 Jun 2020 09:05:57 +0000 (10:05 +0100)]
drivers: media: Remove the downstream version of bcm2835-unicam

About to be replaced by the upstream version.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agomedia: rcar-csi2: Negotiate data lanes number
Jacopo Mondi [Tue, 16 Jun 2020 14:12:44 +0000 (16:12 +0200)]
media: rcar-csi2: Negotiate data lanes number

Upstream https://patchwork.linuxtv.org/patch/64675/

Use the newly introduced get_mbus_config() subdevice pad operation to
retrieve the remote subdevice MIPI CSI-2 bus configuration and configure
the number of active data lanes accordingly.

In order to be able to call the remote subdevice operation cache the
index of the remote pad connected to the single CSI-2 input port.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
4 years agomedia: i2c: adv748x: Implement get_mbus_config
Jacopo Mondi [Tue, 16 Jun 2020 14:12:43 +0000 (16:12 +0200)]
media: i2c: adv748x: Implement get_mbus_config

Upstream https://patchwork.linuxtv.org/patch/64676/

Implement the newly introduced get_mbus_config operation to report the
number of currently used data lanes on the MIPI CSI-2 interface.

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
4 years agomedia: i2c: adv748x: Adjust TXA data lanes number
Jacopo Mondi [Tue, 16 Jun 2020 14:12:42 +0000 (16:12 +0200)]
media: i2c: adv748x: Adjust TXA data lanes number

Upstream https://patchwork.linuxtv.org/patch/64673/

When outputting SD-Core output through the TXA MIPI CSI-2 interface,
the number of enabled data lanes should be reduced in order to guarantee
that the two video formats produced by the SD-Core (480i and 576i)
generate a MIPI CSI-2 link clock frequency compatible with the MIPI D-PHY
specifications.

Limit the number of enabled data lanes to 2, which is guaranteed to
support 480i and 576i formats.

Cache the number of enabled data lanes to be able to report it through
the new get_mbus_config operation.

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
4 years agostaging: media: imx: Update TODO entry
Jacopo Mondi [Tue, 16 Jun 2020 14:12:41 +0000 (16:12 +0200)]
staging: media: imx: Update TODO entry

Upstream https://patchwork.linuxtv.org/patch/64672/

Update the TODO entry that mentioned a potential use case for the now
removed g_mbus_config video operation.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
4 years agomedia: v4l2-subdev: Remove [s|g]_mbus_config video ops
Jacopo Mondi [Tue, 16 Jun 2020 14:12:40 +0000 (16:12 +0200)]
media: v4l2-subdev: Remove [s|g]_mbus_config video ops

Upstream https://patchwork.linuxtv.org/patch/64670/

With all sensor and platform drivers now converted to use the new
get_mbus_config and set_mbus_config pad operations, remove the
deprecated video operations g_mbus_config and s_mbus_config.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
4 years agomedia: pxa_camera: Use the new set_mbus_config op
Jacopo Mondi [Tue, 16 Jun 2020 14:12:39 +0000 (16:12 +0200)]
media: pxa_camera: Use the new set_mbus_config op

Upstream https://patchwork.linuxtv.org/patch/64671/

Move the PXA camera driver to use the new set_mbus_config pad operation.
For this platform the change is not only cosmetic, as the pxa driver is
currently the only driver in mainline to make use of the g_mbus_config
and s_mbus_config video operations.

The existing driver semantic is the following:
- Collect all supported mbus config flags from the remote end
- Match them with the supported PXA mbus configuration flags
- If the remote subdevice allows multiple options for for VSYNC, HSYNC
  and PCLK polarity, use platform data requested settings

The semantic of the new get_mbus_config and set_mbus_config differs from
the corresponding video ops, particularly in the fact get_mbus_config
reports the current mbus configuration and not the set of supported
configuration options, with set_mbus_config always reporting the actual
mbus configuration applied to the remote subdevice.

Adapt the driver to perform the following
- Set the remote subdevice mbus configuration according to the PXA
  platform data preferences.
- If the applied configuration differs from the requested one (i.e. the
  remote subdevice does not allow changing one setting) make sure that
  - The remote end does not claim for DATA_ACTIVE_LOW, which seems not
    supported by the platform
  - The bus mastering roles match

While at there remove a few checks performed on the media bus
configuration at get_format() time as they do not belong there.

Compile-tested only.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
4 years agomedia: i2c: ov6650: Use new [get|set]_mbus_config ops
Jacopo Mondi [Tue, 16 Jun 2020 14:12:38 +0000 (16:12 +0200)]
media: i2c: ov6650: Use new [get|set]_mbus_config ops

Upstream https://patchwork.linuxtv.org/patch/64674/

Use the new get_mbus_config and set_mbus_config pad operations in place
of the video operations currently in use.

Compared to other drivers where the same conversion has been performed,
ov6650 proved to be a bit more tricky, as the existing g_mbus_config
implementation did not report the currently applied configuration but
the set of all possible configuration options.

Adapt the driver to support the semantic of the two newly introduced
operations:
- get_mbus_config reports the current media bus configuration
- set_mbus_config applies only changes explicitly requested and updates
  the provided cfg parameter to report what has actually been applied to
  the hardware.

Compile-tested only.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
4 years agomedia: i2c: Use the new get_mbus_config pad op
Jacopo Mondi [Tue, 16 Jun 2020 14:12:37 +0000 (16:12 +0200)]
media: i2c: Use the new get_mbus_config pad op

Upstream https://patchwork.linuxtv.org/patch/64669/

Move the existing users of the g_mbus_config video operation to use the
newly introduced get_mbus_config pad operations.

All the ported drivers report a static media bus configuration and do no
support s_mbus_config so the operation implementation has not changed.

Bridge drivers needs to call the new pad operation and will receive an
-ENOICTLCMD when calling the old g_mbus_config video operation

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
4 years agomedia: v4l2-subdev: Introduce [get|set]_mbus_config pad ops
Jacopo Mondi [Tue, 16 Jun 2020 14:12:36 +0000 (16:12 +0200)]
media: v4l2-subdev: Introduce [get|set]_mbus_config pad ops

Upstream https://patchwork.linuxtv.org/patch/64669/

Introduce two new pad operations to allow retrieving and configuring the
media bus parameters on a subdevice pad.

The newly introduced operations aims to replace the s/g_mbus_config video
operations, which have been on their way for deprecation since a long
time.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
4 years agobrcmfmac: Prefer a ccode from OTP over nvram file
Phil Elwell [Fri, 26 Jun 2020 10:51:05 +0000 (11:51 +0100)]
brcmfmac: Prefer a ccode from OTP over nvram file

Allow the nvram file to set a default ccode (regulatory domain) without
overriding one set in OTP.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agostaging: bcm2835-audio: Add missing MODULE_ALIAS
Maxim Mikityanskiy [Sat, 20 Jun 2020 12:40:00 +0000 (15:40 +0300)]
staging: bcm2835-audio: Add missing MODULE_ALIAS

Commit 8353fe6f1e0f ("Revert "staging: bcm2835-audio: Drop DT
dependency"") reverts the upstream change and makes bcm2835-audio use
device tree again, however, it also removes the MODULE_ALIAS for the
platform device. This MODULE_ALIAS is needed, because VCHIQ registers
bcm2835-audio as a child platform device since commit 25c7597af20d
("staging: vchiq_arm: Register a platform device for audio"), and this
mechanism is adopted also in the downstream kernel.

This commit puts back that MODULE_ALIAS to make bcm2835-audio
autoprobing work again. The rest of VCHIQ children have their
MODULE_ALIASes in place.

Fixes: 8353fe6f1e0f ("Revert "staging: bcm2835-audio: Drop DT dependency"")
Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
4 years agomedia: irs1125: Keep HW in sync after imager reset
Markus Proeller [Tue, 16 Jun 2020 11:33:56 +0000 (13:33 +0200)]
media: irs1125: Keep HW in sync after imager reset

When closing the video device, the irs1125 is put in power down state.
To keep V4L2 ctrls and the HW in sync, v4l2_ctrl_handler_setup is
called after power up.

The compound ctrl IRS1125_CID_MOD_PLL however has a default value
of all zeros, which puts the imager into a non responding state.
Thus, this ctrl is not written by the driver into HW after power up.
The userspace has to take care to write senseful data.

Signed-off-by: Markus Proeller <markus.proeller@pieye.org>
4 years agomedia: irs1125: Atomic access to imager reconfiguration
Markus Proeller [Tue, 16 Jun 2020 11:31:36 +0000 (13:31 +0200)]
media: irs1125: Atomic access to imager reconfiguration

Instead of changing the exposure and framerate settings for all sequences,
they can be changed for every sequence individually now. Therefore the
IRS1125_CID_SAFE_RECONFIG ctrl has been removed and replaced by
IRS1125_CID_SAFE_RECONFIG_S<seq_num>_EXPO and *_FRAME ctrls.

The consistency check in the sequence ctrl IRS1125_CID_SEQ_CONFIG
is removed.

Signed-off-by: Markus Proeller <markus.proeller@pieye.org>
4 years agomedia: irs1125: Refactoring and debug messages
Markus Proeller [Tue, 16 Jun 2020 11:27:42 +0000 (13:27 +0200)]
media: irs1125: Refactoring and debug messages

Changed some variable names to comply with checkpatch --strict mode.
Debug messages added.

Signed-off-by: Markus Proeller <markus.proeller@pieye.org>
4 years agomedia: irs1125: Using i2c_transfer for ic2 reads
Markus Proeller [Tue, 16 Jun 2020 11:24:31 +0000 (13:24 +0200)]
media: irs1125: Using i2c_transfer for ic2 reads

Reading data over i2c is done by using i2c_transfer to ensure that this
operation can't be interrupted.

Signed-off-by: Markus Proeller <markus.proeller@pieye.org>
4 years agoRevert "spi: spi-bcm2835: Re-enable HW CS"
Phil Elwell [Tue, 16 Jun 2020 09:23:42 +0000 (10:23 +0100)]
Revert "spi: spi-bcm2835: Re-enable HW CS"

This reverts commit 49b9bd89784e3fa29f143ebf1ac8f125be47b708.

See: https://github.com/raspberrypi/linux/pull/3687

4 years agoRevert "spi: spi-bcm2835: Disable forced software CS"
Phil Elwell [Tue, 16 Jun 2020 09:23:29 +0000 (10:23 +0100)]
Revert "spi: spi-bcm2835: Disable forced software CS"

This reverts commit 2697f0186db346176832b8eb79adaf5c874681e8.

See: https://github.com/raspberrypi/linux/pull/3687

4 years agoRevert "SQUASH: Fix spi driver compiler warnings"
Phil Elwell [Tue, 16 Jun 2020 09:23:03 +0000 (10:23 +0100)]
Revert "SQUASH: Fix spi driver compiler warnings"

This reverts commit fe3f696b7e5229678ae45d1293e97b5ecc00c245.

See: https://github.com/raspberrypi/linux/pull/3687

4 years agoARM: dts: Set brcm,enable-l1ss for CM4
Phil Elwell [Thu, 11 Jun 2020 10:22:38 +0000 (11:22 +0100)]
ARM: dts: Set brcm,enable-l1ss for CM4

Enable the PCIE L1SS on Compute Module 4. It's possible that this is
also the right thing to do for Pi 4, but it has been working as is
up to now.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agoPCI: brcmstb: Add DT property to control L1SS
Phil Elwell [Thu, 11 Jun 2020 08:57:03 +0000 (09:57 +0100)]
PCI: brcmstb: Add DT property to control L1SS

The BRCM PCIe block has controls to enable control of the CLKREQ#
signal by the L1SS, and to gate the refclk with the CLKREQ# input.
These controls are mutually exclusive - the upstream code sets the
latter, but some use cases require the former.

Add a Device Tree property - brcm,enable-l1ss - to switch to the
L1SS configuration.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agoARM: dts: Add bcm2711-rpi-cm4.dts
Phil Elwell [Tue, 2 Jun 2020 16:19:51 +0000 (17:19 +0100)]
ARM: dts: Add bcm2711-rpi-cm4.dts

Add initial DTS file for Compute Module 4.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agoSQUASH: dts: Fix firmware clocks support
Phil Elwell [Thu, 11 Jun 2020 15:34:00 +0000 (16:34 +0100)]
SQUASH: dts: Fix firmware clocks support

Commit [1] touched a lot of files and still missed some platforms.
In particular, Pi 2 was left with no clock scaling. Simplify the
firmware clocks DTS support and extend it to all platforms that
use the raspberrypi-cpufreq driver.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agoclk: rpi: Fix compatible indentation
Maxime Ripard [Wed, 10 Jun 2020 14:29:08 +0000 (16:29 +0200)]
clk: rpi: Fix compatible indentation

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoclk: rpi: Only register a few firmware clocks
Maxime Ripard [Wed, 10 Jun 2020 14:18:17 +0000 (16:18 +0200)]
clk: rpi: Only register a few firmware clocks

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoclk: bcm: rpi: Remove the quirks for the CPU clock
Maxime Ripard [Tue, 26 May 2020 13:27:35 +0000 (15:27 +0200)]
clk: bcm: rpi: Remove the quirks for the CPU clock

The CPU clock has had so far a bunch of quirks to expose the clock tree
properly, but since we reverted to exposing them through the MMIO driver,
we can remove that code from the firmware driver.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoclk: bcm: rpi: Give firmware clocks a name
Maxime Ripard [Tue, 26 May 2020 12:30:31 +0000 (14:30 +0200)]
clk: bcm: rpi: Give firmware clocks a name

We've registered the firmware clocks using their ID as name, but it's much
more convenient to register them using their proper name. Since the
firmware doesn't provide it, we have to duplicate it.

Acked-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoclk: bcm: rpi: Use CCF boundaries instead of rolling our own
Maxime Ripard [Wed, 27 May 2020 09:13:52 +0000 (11:13 +0200)]
clk: bcm: rpi: Use CCF boundaries instead of rolling our own

The raspberrypi firmware clock driver has a min_rate / max_rate clamping by
storing the info it needs in a private structure.

However, the CCF already provides such a facility, so we can switch to it
to remove the boilerplate.

Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoclk: bcm: rpi: Add an enum for the firmware clocks
Maxime Ripard [Tue, 26 May 2020 12:23:04 +0000 (14:23 +0200)]
clk: bcm: rpi: Add an enum for the firmware clocks

While the firmware allows us to discover the available clocks, we need to
discriminate those clocks to only register the ones meaningful to Linux.
The firmware also doesn't provide a clock name, so having a list of the ID
will help us to give clocks a proper name later on.

Acked-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoclk: rpi: Adjust DT binding to match upstream
Maxime Ripard [Wed, 10 Jun 2020 14:28:56 +0000 (16:28 +0200)]
clk: rpi: Adjust DT binding to match upstream

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
4 years agoPCI: brcmstb: Assert fundamental reset on initialization
Nicolas Saenz Julienne [Thu, 7 May 2020 17:20:20 +0000 (19:20 +0200)]
PCI: brcmstb: Assert fundamental reset on initialization

commit 22e21e51ce755399fd42055a3f668ee4af370881 upstream.

While preparing the driver for upstream this detail was missed.

If not asserted during the initialization process, devices connected on
the bus will not be made aware of the internal reset happening. This,
potentially resulting in unexpected behavior.

Link: https://lore.kernel.org/r/20200507172020.18000-1-nsaenzjulienne@suse.de
Fixes: c0452137034b ("PCI: brcmstb: Add Broadcom STB PCIe host controller driver")
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
4 years agow1_therm: remove redundant assignments to variable ret
Colin Ian King [Tue, 19 May 2020 15:45:53 +0000 (16:45 +0100)]
w1_therm: remove redundant assignments to variable ret

commit f37d13d52c0560bd2bac40b22466af538e61a5ce upstream.

The variable ret is being initialized with a value that is never read
and it is being updated later with a new value. The initialization
is redundant and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20200519154553.873413-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agow1_therm: Free the correct variable
Dan Carpenter [Wed, 20 May 2020 12:00:19 +0000 (15:00 +0300)]
w1_therm: Free the correct variable

commit e420637b81f78d0fbacf539bdb1b341eba602aea upstream.

The problem is that we change "p_args" to point to the middle of the
string so when we free it at the end of the function it's not freeing
the same pointer that we originally allocated.

Fixes: e2c94d6f5720 ("w1_therm: adding alarm sysfs entry")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20200520120019.GA172354@mwanda
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agow1_therm: adding bulk read support to trigger multiple conversion on bus
Akira Shimahara [Mon, 11 May 2020 20:38:20 +0000 (22:38 +0200)]
w1_therm: adding bulk read support to trigger multiple conversion on bus

commit 57c76221d5af648c8355a55c09b050c5d8d38189 upstream.

Adding bulk read support:
Sending a 'trigger' command in the dedicated sysfs entry of bus master
device send a conversion command for all the slaves on the bus. The sysfs
entry is added as soon as at least one device supporting this feature
is detected on the bus.

The behavior of the sysfs reading temperature on the device is as follow:
 * If no bulk read pending, trigger a conversion on the device, wait for
 the conversion to be done, read the temperature in device RAM
 * If a bulk read has been trigger, access directly the device RAM
This behavior is the same on the 2 sysfs entries ('temperature' and
'w1_slave').

Reading the therm_bulk_read sysfs give the status of bulk operations:
 * '-1': conversion in progress on at least 1 sensor
 * '1': conversion complete but at least one sensor has not been read yet
 * '0': no bulk operation. Reading temperature on ecah device will trigger
a conversion

As not all devices support bulk read feature, it has been added in device
family structure.

The attribute is set at master level as soon as a supporting device is
discover. It is removed when the last supported device leave the bus.
The count of supported device is kept with the static counter
bulk_read_device_counter.

A strong pull up is apply on the line if at least one device required it.
The duration of the pull up is the max time required by a device on the
line, which depends on the resolution settings of each device. The strong
pull up could be adjust with the a module parameter.

Updating documentation in Documentation/ABI/testing/sysfs-driver-w1_therm
and Documentation/w1/slaves/w1_therm.rst accordingly.

Signed-off-by: Akira Shimahara <akira215corp@gmail.com>
Link: https://lore.kernel.org/r/20200511203820.411483-1-akira215corp@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agow1_therm: adding alarm sysfs entry
Akira Shimahara [Mon, 11 May 2020 20:38:01 +0000 (22:38 +0200)]
w1_therm: adding alarm sysfs entry

commit e2c94d6f572079511945e64537eb1218643f2e68 upstream.

Adding device alarms settings by a dedicated sysfs entry alarms (RW):
read or write TH and TL in the device RAM. Checking devices in alarm
state could be performed using the master search command.

As alarms temperature level are store in a 8 bit register on the device
and are signed values, a safe cast shall be performed using the min and
max temperature that device are able to measure. This is done by
int_to_short inline function.

A 'write_data' field is added in the device structure, to bind the
correct writing function, as some devices may have 2 or 3 bytes RAM.

Updating Documentation/ABI/testing/sysfs-driver-w1_therm accordingly.

Signed-off-by: Akira Shimahara <akira215corp@gmail.com>
Link: https://lore.kernel.org/r/20200511203801.411253-1-akira215corp@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agow1_therm: optimizing temperature read timings
Akira Shimahara [Mon, 11 May 2020 20:37:42 +0000 (22:37 +0200)]
w1_therm: optimizing temperature read timings

commit 67b392f7b8edfa6f427fecd98722acab34c1c99f upstream.

Optimizing temperature reading by reducing waiting conversion time
according to device resolution settings, as per device specification.
This is device dependent as not all the devices supports resolution
setting, so it has been added in device family structures.

The process to read the temperature on the device has been adapted in a
new function 'convert_t()', which replace the former 'read_therm()', is
introduce to deal with this timing. Strong pull up is also applied during
the required time, according to device power status needs and
'strong_pullup' module parameter.

'temperature_from_RAM()' function is introduced to get the correct
temperature computation (device dependent) from device RAM data.

An new sysfs entry has been added to ouptut only temperature. The old
entry w1_slave has been kept for compatibility, without changing its
output format.

Updating Documentation/ABI/testing/sysfs-driver-w1_therm accordingly.

Signed-off-by: Akira Shimahara <akira215corp@gmail.com>
Link: https://lore.kernel.org/r/20200511203742.411039-1-akira215corp@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agow1_therm: adding eeprom sysfs entry
Akira Shimahara [Mon, 11 May 2020 20:37:25 +0000 (22:37 +0200)]
w1_therm: adding eeprom sysfs entry

commit 45d457a4cf24455eefd076a01a3d86414fc2ff1e upstream.

The driver implement 2 hardware functions to access device RAM:
 * copy_scratchpad
 * recall_scratchpad
They act according to device specifications.

As EEPROM operations are not device dependent (all w1_therm can perform
EEPROM read/write operation following the same protocol), it is removed
from device families structures.

Updating Documentation/ABI/testing/sysfs-driver-w1_therm accordingly.

Signed-off-by: Akira Shimahara <akira215corp@gmail.com>
Link: https://lore.kernel.org/r/20200511203725.410844-1-akira215corp@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agow1_therm: adding resolution sysfs entry
Akira Shimahara [Mon, 11 May 2020 20:37:08 +0000 (22:37 +0200)]
w1_therm: adding resolution sysfs entry

commit 308bdb94de0c1abe7eac5193f58638b8aeaddf4b upstream.

Adding resolution sysfs entry (RW) to get or set the device resolution
Write values are managed as follow:
* '9..12': resolution to set in bit
* Anything else: do nothing
Read values are :
* '9..12': device resolution in bit
* '-xx': xx is kernel error when reading the resolution

Only supported devices will show the sysfs entry. A new family has been
created for DS18S20 devices as they do not implement resolution feature.

The resolution of each device is check when the device is
discover by the bus master, in 'w1_therm_add_slave(struct w1_slave *)'.
The status is stored in the device structure w1_therm_family_data so
that the driver always knows the resolution of each device, which could
be used later to determine the required conversion duration (resolution
dependent).

The resolution is re evaluate each time a user read or write the sysfs
entry.

To avoid looping through the w1_therm_families at run time, the pointer
'specific_functions' is set up to the correct 'w1_therm_family_converter'
when the slave is added (which mean when it is discovered by the master).
This initialization is done by a helper function
'device_family(struct w1_slave *sl)', and a dedicated macro
'SLAVE_SPECIFIC_FUNC(sl)' allow the access to the specific function of the
slave device.

'read_scratchpad' and 'write_scratchpad' are the hardware functions to
access the device RAM, as per protocol specification.

It cancel the former 'precision' functions, which was only set and never
read (so not stored in the device struct).

Updating Documentation/ABI/testing/sysfs-driver-w1_therm accordingly.

Signed-off-by: Akira Shimahara <akira215corp@gmail.com>
Link: https://lore.kernel.org/r/20200511203708.410649-1-akira215corp@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agow1_therm: adding ext_power sysfs entry
Akira Shimahara [Mon, 11 May 2020 20:36:50 +0000 (22:36 +0200)]
w1_therm: adding ext_power sysfs entry

commit b7bb6ca17a90f47c2fe2848531b5bbaf27a65ba7 upstream.

Adding ext_power sysfs entry (RO). Return the power status of the device:
 - 0: device parasite powered
 - 1: device externally powered
 - xx: xx is kernel error

The power status of each device is check when the device is
discover by the bus master, in 'w1_therm_add_slave(struct w1_slave *)'.
The status is stored in the device structure w1_therm_family_data so
that the driver always knows the power state of each device, which could
be used later to determine the required strong pull up to apply on the
line.

The power status is re evaluate each time the sysfs ext_power read by
a user.

The hardware function 'read_powermode(struct w1_slave *sl)' act just as
per device specifications, sending W1_READ_PSUPPLY command on the bus,
and issue a read time slot, reading only one bit.

A helper function 'bool bus_mutex_lock(struct mutex *lock)' is introduced.
It try to aquire the bus mutex several times (W1_THERM_MAX_TRY), waiting
W1_THERM_RETRY_DELAY between two attempt.

Updating Documentation/ABI/testing/sysfs-driver-w1_therm accordingly.

Signed-off-by: Akira Shimahara <akira215corp@gmail.com>
Link: https://lore.kernel.org/r/20200511203650.410439-1-akira215corp@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agow1_therm: fix reset_select_slave during discovery
Akira Shimahara [Mon, 11 May 2020 20:36:10 +0000 (22:36 +0200)]
w1_therm: fix reset_select_slave during discovery

commit c8ad65f6fbfdcb9b620674ef456020eef2bfeb36 upstream.

Fix reset_select_slave issue during devices discovery by the master on
bus. The w1_reset_select_slave() from w1_io.c, which was previously used,
assume that if the slave count is 1 there is only one slave attached on
the bus. This is not always true. For example when discovering devices,
when the first device is discover by the bus master, its slave count is
1, but some other slaves may be on the bus.

In that case instead of adressing command to the attached slave the
master throw a SKIP ROM command so that all slaves attached on the bus
will answer simultenaously causing data collision.

A dedicated reset_select_slave() function is implemented here,
it always perform an adressing to each slave using the MATCH ROM
command.

Signed-off-by: Akira Shimahara <akira215corp@gmail.com>
Link: https://lore.kernel.org/r/20200511203610.409975-1-akira215corp@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agow1_therm: adding code comments and code reordering
Akira Shimahara [Mon, 11 May 2020 20:35:35 +0000 (22:35 +0200)]
w1_therm: adding code comments and code reordering

commit 92b8d2724464bc1d2e735a84c0da5741dce33485 upstream.

Adding code comments to split code in dedicated parts. After the global
declarations (defines, macros and function declarations), code is organized
as follow :
 - Device and family dependent structures and functions
 - Interfaces functions
 - Helpers functions
 - Hardware functions
 - Sysfs interface functions

Signed-off-by: Akira Shimahara <akira215corp@gmail.com>
Link: https://lore.kernel.org/r/20200511203535.409599-1-akira215corp@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agooverlays: Update upstream overlays after vc4-kms-v3d change
Phil Elwell [Fri, 5 Jun 2020 15:18:52 +0000 (16:18 +0100)]
overlays: Update upstream overlays after vc4-kms-v3d change

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agooverlays: i2c-gpio: Avoid open-drain warnings
Phil Elwell [Fri, 5 Jun 2020 15:07:07 +0000 (16:07 +0100)]
overlays: i2c-gpio: 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
gpiolib can emulate it in software if configured correctly.

Silence the warning by declaring the GPIOs as requiring open-drain
mode, trusting gpiolib to manage the emulation. The previous
incarnation of this patch took the other approach of telling the
i2c-gpio driver that the GPIOs were configured for open-drain, but
this had the effect of disabling the emulation. In some cases this
appears to work, but examining the waveforms as analogue voltages
shows contention, the success or failure depending on drive strengths.

See: https://github.com/raspberrypi/firmware/issues/1381
See: https://github.com/raspberrypi/firmware/issues/1401

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agoRevert "overlays: gpio-keys: Avoid open-drain warnings"
Phil Elwell [Fri, 5 Jun 2020 15:06:59 +0000 (16:06 +0100)]
Revert "overlays: gpio-keys: Avoid open-drain warnings"

This reverts commit 907e08e6e70dd557a1f5cd03ef28492ffebffb08.

4 years agosnd_bcm2835: disable HDMI audio when vc4 is used (#3640)
Hristo Venev [Fri, 5 Jun 2020 09:22:49 +0000 (09:22 +0000)]
snd_bcm2835: disable HDMI audio when vc4 is used (#3640)

Things don't work too well when both the vc4 driver and the firmware
driver are trying to control the same audio output:

[  763.569406] bcm2835_audio bcm2835_audio: vchi message timeout, msg=5

Hence, when the vc4 HDMI driver is used, let it control audio. This is done
by introducing a new device tree property to the audio node, and
extending the vc4-kms-v3d overlays to set it appropriately.

Signed-off-by: Hristo Venev <hristo@venev.name>
4 years agovc4: cec: Restore cec physical address on reconnect
Dom Cobley [Wed, 3 Jun 2020 11:20:19 +0000 (12:20 +0100)]
vc4: cec: Restore cec physical address on reconnect

Currently we call cec_phys_addr_invalidate on a hotplug deassert.
That may be due to a TV power cycling, or an AVR being switched
on (and switching edid). This makes CEC unusable.

Set it back up again on the hotplug assert.

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
4 years agostaging: vchiq_arm: Use g_dma_dev for dma_unmap_sg
Phil Elwell [Thu, 4 Jun 2020 16:23:36 +0000 (17:23 +0100)]
staging: vchiq_arm: Use g_dma_dev for dma_unmap_sg

Commit "staging: vchiq_arm: Clean up 40-bit DMA support" failed to
change one of the calls to dma_unmap_sg to pass in g_dma_dev (rather
than g_dev). Correct that oversight.

See: https://github.com/raspberrypi/linux/issues/3647

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agovc4: Set driver_name for card
Dom Cobley [Tue, 2 Jun 2020 18:31:49 +0000 (19:31 +0100)]
vc4: Set driver_name for card

Allows use of the same alsa conf file for hdmi1

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
4 years agoconfigs: Add SND_SOC_MAX98357A=m
Phil Elwell [Tue, 2 Jun 2020 09:06:05 +0000 (10:06 +0100)]
configs: Add SND_SOC_MAX98357A=m

Enable the MAX98357A driver.

See: https://www.raspberrypi.org/forums/viewtopic.php?f=107&t=275919

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agoAdd Micro Crystal RV-1805 to i2c-rtc overlays
Kevin P. Fleming [Mon, 1 Jun 2020 11:02:00 +0000 (07:02 -0400)]
Add Micro Crystal RV-1805 to i2c-rtc overlays

While the RV-1805 is supported by the rtc-abx80x driver via
auto-detection, in order for it to be initialized properly
it must be explcitly selected.

Signed-off-by: Kevin P. Fleming <kevin+linux@km6g.us>
4 years agomedia: bcm2835-isp: fix bytes per line calculations for some image formats
David Plowman [Fri, 29 May 2020 13:36:56 +0000 (14:36 +0100)]
media: bcm2835-isp: fix bytes per line calculations for some image formats

The bytes per line numbers calculated by get_bytesperline was not
matching the equivalent calculation being performed by the VideoCore
(mostly by the calculate_pitch function there), resulting in failures
to set the image format with some image width values. This patches up
the RGB24 and YUYV type formats to match the VideoCore calculation.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
4 years agooverlays: i2c-rtc-gpio: Fix trickle-resistor-ohms param
Phil Elwell [Fri, 29 May 2020 15:55:12 +0000 (16:55 +0100)]
overlays: i2c-rtc-gpio: Fix trickle-resistor-ohms param

The abx80x implementation of the trickle-resistor-ohms parameter is
missing the ":0" indicating that the target is an integer/cell value.

See: https://github.com/raspberrypi/linux/issues/3642

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agonet: rtl8192cu: fix gcc misleading whitespace warning
David Lechner [Sun, 24 Nov 2019 22:40:48 +0000 (16:40 -0600)]
net: rtl8192cu: fix gcc misleading whitespace warning

This fixes a gcc warning about misleading whitespace.

Signed-off-by: David Lechner <david@lechnology.com>
4 years agooverlays: Add spi0 overlay to support sc16is752
bjorn [Thu, 7 May 2020 03:11:43 +0000 (05:11 +0200)]
overlays: Add spi0 overlay to support sc16is752

Signed-off-by: Bjorn <beikeland@gmail.com>
4 years agooverlays: gpio-shutdown: Add information for Raspberry Pi 1 Model B rev 1
Pali Rohár [Thu, 30 Apr 2020 17:41:10 +0000 (19:41 +0200)]
overlays: gpio-shutdown: Add information for Raspberry Pi 1 Model B rev 1

Raspberry Pi 1 Model B rev 1 uses GPIO1 for power-up instead of GPIO3.

4 years agooverlays: gpio-shutdown: Add information for SysV init / inittab
Pali Rohár [Thu, 30 Apr 2020 17:40:07 +0000 (19:40 +0200)]
overlays: gpio-shutdown: Add information for SysV init / inittab

KeyboardSignal and kb::kbrequest can be used to call /sbin/shutdown

4 years agooverlays: i2c-rtc: Fix trickle-resistor-ohms param
Phil Elwell [Fri, 29 May 2020 13:41:13 +0000 (14:41 +0100)]
overlays: i2c-rtc: Fix trickle-resistor-ohms param

The abx80x implementation of the trickle-resistor-ohms parameter is
missing the ":0" indicating that the target is an integer/cell value.

See: https://github.com/raspberrypi/linux/issues/3642

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agobrcmfmac: BCM43436 needs dedicated firmware
Phil Elwell [Tue, 19 May 2020 08:46:12 +0000 (09:46 +0100)]
brcmfmac: BCM43436 needs dedicated firmware

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agoconfigs: Build HWMON core into kernel
Chen-Yu Tsai [Fri, 15 May 2020 07:56:14 +0000 (15:56 +0800)]
configs: Build HWMON core into kernel

To expose thermal regions as hwmon devices, the HWMON core has to be
built-in, so that THERMAL_HWMON can be enabled.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
4 years agoconfigs: Switch to upstream thermal sensor for RPi 4 - BCM2711_THERMAL
Chen-Yu Tsai [Fri, 15 May 2020 07:38:12 +0000 (15:38 +0800)]
configs: Switch to upstream thermal sensor for RPi 4 - BCM2711_THERMAL

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
4 years agoARM: dts: bcm2711-rpi: Remove downstream thermal sensor node
Chen-Yu Tsai [Thu, 14 May 2020 09:39:30 +0000 (17:39 +0800)]
ARM: dts: bcm2711-rpi: Remove downstream thermal sensor node

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
4 years agoRevert "thermal: brcmstb_thermal: Add BCM2838 support"
Chen-Yu Tsai [Thu, 14 May 2020 09:24:28 +0000 (17:24 +0800)]
Revert "thermal: brcmstb_thermal: Add BCM2838 support"

This reverts commit 9d62448adc918a94fba091d475d0e6f1648c36f4.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
4 years agoRevert "thermal: brcmstb_thermal: Correct SoC name"
Chen-Yu Tsai [Thu, 14 May 2020 09:24:24 +0000 (17:24 +0800)]
Revert "thermal: brcmstb_thermal: Correct SoC name"

This reverts commit 6642a4f0769be5732fd372a5637fc1b01d62f93a.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
4 years agoARM: configs: Build BCM2711 thermal as module
Stefan Wahren [Mon, 13 Jan 2020 18:56:18 +0000 (19:56 +0100)]
ARM: configs: Build BCM2711 thermal as module

Commit 1a90e73248c4d0add6583bd88bb5e082c3e090bc upstream.

This builds the BCM2711 thermal driver as module for the Raspberry Pi 4.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Tested-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/1578941778-23321-5-git-send-email-stefan.wahren@i2se.com
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
4 years agoARM: dts: bcm2711: Enable thermal
Stefan Wahren [Mon, 13 Jan 2020 18:56:17 +0000 (19:56 +0100)]
ARM: dts: bcm2711: Enable thermal

Commit a1d6989bf12b01cd9198e2c31a96678ac9c47415 upstream.

This enables thermal for the BCM2711 (used on Raspberry Pi 4) by adding
the AVS monitor and a subnode for the thermal part.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Tested-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/1578941778-23321-4-git-send-email-stefan.wahren@i2se.com
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
4 years agothermal: Add BCM2711 thermal driver
Stefan Wahren [Mon, 13 Jan 2020 18:56:16 +0000 (19:56 +0100)]
thermal: Add BCM2711 thermal driver

Commit 59b781352dc4cb9ae27a8ddae0cda979d29d8af7 upstream.

This adds the thermal sensor driver for the Broadcom BCM2711 SoC,
which is placed on the Raspberry Pi 4. The driver only provides
SoC temperature reading so far.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Tested-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/1578941778-23321-3-git-send-email-stefan.wahren@i2se.com
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
4 years agodt-bindings: Add Broadcom AVS RO thermal
Stefan Wahren [Mon, 13 Jan 2020 18:56:15 +0000 (19:56 +0100)]
dt-bindings: Add Broadcom AVS RO thermal

Commit ee31ff373da6602e7a4e60fe11322b41ac38eb22 upstream.

Since the BCM2711 doesn't have a AVS TMON block, the thermal information
must be retrieved from the AVS ring oscillator block. This block is part
of the AVS monitor which contains a bunch of raw sensors.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/1578941778-23321-2-git-send-email-stefan.wahren@i2se.com
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
4 years agomedia: bcm2835-unicam: change minimum number of vb2_queue buffers to 1
David Plowman [Thu, 28 May 2020 10:09:48 +0000 (11:09 +0100)]
media: bcm2835-unicam: change minimum number of vb2_queue buffers to 1

Since the unicam driver was modified to write to a dummy buffer when no
user-supplied buffer is available, it can now write to and return a
buffer even when there's only a single one. Enable this by changing the
min_buffers_needed in the vb2_queue; it will be useful for enabling
still captures without allocating more memory than absolutely necessary.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
4 years agoRevert "zswap: Uncross module parameter setting functions"
Phil Elwell [Mon, 25 May 2020 20:52:40 +0000 (21:52 +0100)]
Revert "zswap: Uncross module parameter setting functions"

This reverts commit e5e8a2214dff0c43580afc5dc22d496f667c3bbf.

4 years agoARM: dts: Update for new VCHIQ BCM2711 DMA support
Phil Elwell [Wed, 20 May 2020 15:36:57 +0000 (16:36 +0100)]
ARM: dts: Update for new VCHIQ BCM2711 DMA support

Now that the enhanced BCM2711 DMA controller is located by compatible
string and used directly for generating bulk transfer addresses,
remove the workaround of moving the vchiq node.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agostaging: vchiq_arm: Clean up 40-bit DMA support
Phil Elwell [Wed, 20 May 2020 15:36:33 +0000 (16:36 +0100)]
staging: vchiq_arm: Clean up 40-bit DMA support

Manage the split between addresses for the VPU and addresses for the
40-bit DMA controller with a dedicated DMA device pointer that on non-
BCM2711 platforms is the same as the main VCHIQ device. This allows
the VCHIQ node to stay in the usual place in the DT, and removes the
ugly VC_SAFE macros.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agomedia: i2c: imx477: Return correct result on sensor id verification
Naushir Patuck [Tue, 19 May 2020 15:56:33 +0000 (16:56 +0100)]
media: i2c: imx477: Return correct result on sensor id verification

The test should return -EIO if the register read id does not match
the expected sensor id.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
4 years agodrm/vc4: Add FKMS as an acceptable node for dma ranges.
Dave Stevenson [Tue, 19 May 2020 15:20:30 +0000 (16:20 +0100)]
drm/vc4: Add FKMS as an acceptable node for dma ranges.

Under FKMS, the firmware (via FKMS) also requires the VideoCore cache
aliases for image planes, as defined by the dma-ranges under /soc.

Add rpi-firmware-kms to the list of acceptable nodes to look for
to copy dma config from.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agodrm/vc4: Adopt the dma configuration from the HVS or V3D component
Dave Stevenson [Tue, 19 May 2020 13:54:28 +0000 (14:54 +0100)]
drm/vc4: Adopt the dma configuration from the HVS or V3D component

vc4_drv isn't necessarily under the /soc node in DT as it is a
virtual device, but it is the one that does the allocations.
The DMA addresses are consumed by primarily the HVS or V3D, and
those require VideoCore cache alias address mapping, and so will be
under /soc.

During probe find the a suitable device node for HVS or V3D,
and adopt the DMA configuration of that node.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agoconfigs: Add ZSWAP=y, ZBUD=m, Z3FOLD=m
Phil Elwell [Tue, 5 May 2020 14:25:06 +0000 (15:25 +0100)]
configs: Add ZSWAP=y, ZBUD=m, Z3FOLD=m

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agozswap: Defer zswap initialisation
Phil Elwell [Tue, 5 May 2020 14:23:32 +0000 (15:23 +0100)]
zswap: Defer zswap initialisation

Enabling zswap support in the kernel configuration costs about 1.5MB
of RAM, even when zswap is not enabled at runtime. This cost can be
reduced significantly by deferring initialisation (including pool
creation) until the "enabled" parameter is set to true. There is a
small cost to this in that some initialisation code has to remain in
memory after the init phase, just in case they are needed later,
but the total size increase is negligible.

See: https://github.com/raspberrypi/linux/pull/3432

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agozswap: Uncross module parameter setting functions
Phil Elwell [Tue, 19 May 2020 14:47:02 +0000 (15:47 +0100)]
zswap: Uncross module parameter setting functions

The "compressor" and "zpool" parameters of the zswap module each has
a custom setter function that calls __zswap_param_set with specific
parameters, but the "zpool" setter uses parameters that are correct for
the "compressor" parameter, and vice-versa.

Fix this by swapping the function bodies over.

Fixes: 90b0fc26d5db ("zswap: change zpool/compressor at runtime")

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
4 years agomedia: bcm2835-unicam: Retain packing information on G_FMT
Dave Stevenson [Tue, 19 May 2020 10:46:47 +0000 (11:46 +0100)]
media: bcm2835-unicam: Retain packing information on G_FMT

The change to retrieve the pixel format always on g_fmt didn't
check whether the native or unpacked version of the format
had been requested, and always returned the packed one.
Correct this so that the packing setting is retained whereever
possible.

Fixes "9d59e89 media: bcm2835-unicam: Re-fetch mbus code from subdev
on a g_fmt call"

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
4 years agoSwitch to snd_soc_dai_set_bclk_ratio
j-schambacher [Tue, 19 May 2020 11:56:17 +0000 (13:56 +0200)]
Switch to snd_soc_dai_set_bclk_ratio
Replaces obsolete function snd_soc_dai_set_tdm_slot

Signed-off-by: Joerg Schambacher <joerg@i2audio.com>