Skip to content

Conversation

6by9
Copy link
Contributor

@6by9 6by9 commented Jul 8, 2020

This removes the need for the client to use vcsm at all.

Signed-off-by: Dave Stevenson [email protected]

pelwell and others added 30 commits July 1, 2020 16:33
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] f3186dd ("spi: Optionally use GPIO descriptors for CS GPIOs")
[2] 83b2a8f ("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 <[email protected]>
Fixes: "dts: bcm2711: set #size-cells = <2>"

Signed-off-by: Phil Elwell <[email protected]>
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 <[email protected]>
This file defines the userland interface to the bcm2835-isp driver
that will follow in a separate commit.

Signed-off-by: Naushir Patuck <[email protected]>
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 <[email protected]>
We are reserving controls for the new bcm2835-isp driver.

Signed-off-by: Naushir Patuck <[email protected]>
No functional changes in this commit.

- Remove erroneous whitespace.
- Remove _t postfix label on structs and enums.

Signed-off-by: Naushir Patuck <[email protected]>
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 <[email protected]>
bcmn2835_isp is a platform driver dependent on vchiq,
therefore add the load/unload functions for it to vchiq.

Signed-off-by: Naushir Patuck <[email protected]>
This commit enables the bcm2835-isp driver in the following
defconfigs:

bcm2709_defconfig
bcm2711_defconfig
bcmrpi_defconfig
bcmrpi3_defconfig

Signed-off-by: Naushir Patuck <[email protected]>
This isn't required on Pi3, so don't treat as an error

Signed-off-by: popcornmix <[email protected]>
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 <[email protected]>
Signed-off-by: Jacopo Mondi <[email protected]>
…inning

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 <[email protected]>
"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 <[email protected]>
Clients need to know the pixel rate in order to compute exposure
and frame rate values.
Advertise it.

Signed-off-by: Dave Stevenson <[email protected]>
The ov5647 subdev can generate control events, therefore set
the V4L2_SUBDEV_FL_HAS_EVENTS flag.

Signed-off-by: Dave Stevenson <[email protected]>
Adds vblank control to allow for frame rate control.

Signed-off-by: Dave Stevenson <[email protected]>
…N_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 <[email protected]>
To make adding new members to the mode structures easier, use
the member names in the initialisers.

Signed-off-by: Dave Stevenson <[email protected]>
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 <[email protected]>
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 <[email protected]>
Sensors are now reflecting cropping and scaling parameters through
the selection API, therefore Unicam needs to forward the requests
through to the subdev.

Signed-off-by: Dave Stevenson <[email protected]>
unicam_release calls _vb2_fop_release, which will call stop_streaming
if that particular node was streaming. Calling it unconditionally (as
the code was) means that if a second handle was opened eg to alter
a setting, on closing that connection it also stopped Unicam.

Signed-off-by: Dave Stevenson <[email protected]>
The reference counting of node->open was only incremented after
a check that the node was v4l2_fh_is_singular_file, which resulted
in the counting going wrong and s_power not being called at an
appropriate time.

Signed-off-by: Dave Stevenson <[email protected]>
This is used to enumerate available frame sizes on all nodes
apart from statistics output.

Signed-off-by: Naushir Patuck <[email protected]>
This warning is unavoidable from a client's perspective and
doesn't indicate anything wrong (just surprising).

SQUASH with "spi: use_gpio_descriptor fixup moved to spi_setup"

Signed-off-by: Phil Elwell <[email protected]>
BCM2711 has 4 DMA channels with a 40-bit address range, allowing them
to access the full 4GB of memory on a Pi 4.

Signed-off-by: Phil Elwell <[email protected]>
6by9 and others added 13 commits July 7, 2020 15:52
…and hal3

Adds the ov9281 parts of the Rockchip patch adding enum_frame_interval to
a large number of drivers.

Change-Id: I03344cd6cf278dd7c18fce8e97479089ef185a5c
Signed-off-by: Zefa Chen <[email protected]>
…om code

The Rockchip driver was based on a 4.4 kernel, and had several custom
Rockchip parts.

Update to 5.4 kernel APIs, with the relevant controls required by
libcamera, and remove custom Rockchip parts.

Signed-off-by: Dave Stevenson <[email protected]>
Vision Components have made an OV9281 module which blocks reading
back the majority of registers to comply with NDAs, and in doing
so doesn't allow auto-increment register reading as used when
reading the chip ID.

Use two reads and manually combine the results.

Signed-off-by: Dave Stevenson <[email protected]>
Adds an overlay for the OV9281 mono imaging sensor using 2 CSI-2
data lanes.

Signed-off-by: Dave Stevenson <[email protected]>
Adds the driver for use by the dtoverlay.

Signed-off-by: Dave Stevenson <[email protected]>
commit 3347a80 upstream.

The RPi 4 uses the hardware handshake lines for CYW43455, but the chip
doesn't react to HCI requests during DT probe. The reason is the inproper
handling of the RTS line during startup. According to the startup
signaling sequence in the CYW43455 datasheet, the hosts RTS line must
be driven after BT_REG_ON and BT_HOST_WAKE.

Signed-off-by: Stefan Wahren <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
commit d462af2 upstream.

The BCM43540 chip is a 802.11 a/b/g/n/ac + Bluetooth 4.1 combo module.
This patch adds a compatible string match to the serdev driver for the
Bluetooth part of the chip.

Signed-off-by: Abhishek Pandit-Subedi <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
commit 1199ab4 upstream.

This patch adds the device ID for the BCM4335A0 module
(part of the AMPAK AP6335 WIFI/Bluetooth combo)

hciconfig output:
```
hci1:   Type: Primary  Bus: UART
        BD Address: 43:35:B0:07:1F:AC  ACL MTU: 1021:8  SCO MTU: 64:1
        UP RUNNING
        RX bytes:5079 acl:0 sco:0 events:567 errors:0
        TX bytes:69065 acl:0 sco:0 commands:567 errors:0
        Features: 0xbf 0xfe 0xcf 0xff 0xdf 0xff 0x7b 0x87
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
        Link policy: RSWITCH SNIFF
        Link mode: SLAVE ACCEPT
        Name: 'alarm'
        Class: 0x000000
        Service Classes: Unspecified
        Device Class: Miscellaneous,
        HCI Version: 4.0 (0x6)  Revision: 0x161
        LMP Version: 4.0 (0x6)  Subversion: 0x4106
        Manufacturer: Broadcom Corporation (15)
```

Signed-off-by: Mohammad Rasim <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
commit 5d6f391 upstream.

Without updating the patchram, the BCM4354 does not support a higher
operating speed. The normal bcm_setup follows the correct order
(init_speed, patchram and then oper_speed) but the serdev driver will
set the operating speed before calling the hu->setup function. Thus,
for the BCM4354, don't set the operating speed before patchram.

Signed-off-by: Abhishek Pandit-Subedi <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
Signed-off-by: Johan Hedberg <[email protected]>
commit 5283799 upstream.

Add BCM vendor specific command to configure PCM parameters. The new
vendor opcode allows us to set the sco routing, the pcm interface rate,
and a few other pcm specific options (frame sync, sync mode, and clock
mode). See broadcom-bluetooth.txt in Documentation for more information
about valid values for those settings.

Here is an example trace where this opcode was used to configure
a BCM4354:

        < HCI Command: Vendor (0x3f|0x001c) plen 5
                01 02 00 01 01
        > HCI Event: Command Complete (0x0e) plen 4
        Vendor (0x3f|0x001c) ncmd 1
                Status: Success (0x00)

We can read back the values as well with ocf 0x001d to confirm the
values that were set:
        $ hcitool cmd 0x3f 0x001d
        < HCI Command: ogf 0x3f, ocf 0x001d, plen 0
        > HCI Event: 0x0e plen 9
        01 1D FC 00 01 02 00 01 01

Signed-off-by: Abhishek Pandit-Subedi <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
Signed-off-by: Johan Hedberg <[email protected]>
commit eb762b9 upstream.

BCM chips may require configuration of PCM to operate correctly and
there is a vendor specific HCI command to do this. Add support in the
hci_bcm driver to parse this from devicetree and configure the chip.

Signed-off-by: Abhishek Pandit-Subedi <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
Signed-off-by: Johan Hedberg <[email protected]>
commit e601dae upstream.

The commit 3347a80 ("Bluetooth: hci_bcm: Fix RTS handling during
startup") is causing at least a regression for AP6256 on Orange Pi 3.
So do the RTS line handing during startup only on the necessary platform.

Fixes: 3347a80 ("Bluetooth: hci_bcm: Fix RTS handling during startup")
Reported-by: Ondřej Jirman <[email protected]>
Signed-off-by: Stefan Wahren <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
This removes the need for the client to use vcsm at all.

Signed-off-by: Dave Stevenson <[email protected]>
@6by9
Copy link
Contributor Author

6by9 commented Jul 8, 2020

@davidplowman @naushir Needs the corresponding libcamera changes and is an ABI breakage.

@naushir
Copy link
Contributor

naushir commented Jul 8, 2020

Change looks good to me. However, we must sync with the libcamera changes as this will be an ABI breakage that we must advertise.

@pelwell
Copy link
Contributor

pelwell commented Jul 10, 2020

Let me know how and when you want this merged.

@naushir
Copy link
Contributor

naushir commented Jul 10, 2020

Will have to do it next week I'm afraid. I'm just finishing off some other things, then will start testing the libcamera changes needed for this.

@pelwell
Copy link
Contributor

pelwell commented Jul 17, 2020

Rebased and merged offline.

@pelwell pelwell closed this Jul 17, 2020
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Jul 17, 2020
See: raspberrypi/linux#3730

kernel: drm/vc4: Add DRM_MODE_FLAG_DBLCLK support to vc4-fkms
See: raspberrypi/linux#3725

kernel: raspberrypi: Report sensor orientation through DT
See: raspberrypi/linux#3723

kernel: correct SND_SOC_DAILINK_DEFS
See: raspberrypi/linux#3722

kernel: ARM: dts: Select the actpwr LED trigger on Zeroes

kernel: staging: vc04_services: isp: Rework lens shading to take a dmabuf
See: raspberrypi/linux#3715

kernel: unicam clock changes
See: raspberrypi/linux#3609

firmware: IL: camera: Fix stereoscopic pool allocations

firmware: arm_loader: Add support for double clock/pixel_rep for FKMS
See: raspberrypi/linux#3725

firmware: scalerlib: Set the default chroma location for YUV10 to match 8bit
firmware: scalerlib: Set chroma_vrep correctly for YUV10COL

firmware: isp: check the hi-res resize filter mode when the input crop changes
popcornmix added a commit to Hexxeh/rpi-firmware that referenced this pull request Jul 17, 2020
See: raspberrypi/linux#3730

kernel: drm/vc4: Add DRM_MODE_FLAG_DBLCLK support to vc4-fkms
See: raspberrypi/linux#3725

kernel: raspberrypi: Report sensor orientation through DT
See: raspberrypi/linux#3723

kernel: correct SND_SOC_DAILINK_DEFS
See: raspberrypi/linux#3722

kernel: ARM: dts: Select the actpwr LED trigger on Zeroes

kernel: staging: vc04_services: isp: Rework lens shading to take a dmabuf
See: raspberrypi/linux#3715

kernel: unicam clock changes
See: raspberrypi/linux#3609

firmware: IL: camera: Fix stereoscopic pool allocations

firmware: arm_loader: Add support for double clock/pixel_rep for FKMS
See: raspberrypi/linux#3725

firmware: scalerlib: Set the default chroma location for YUV10 to match 8bit
firmware: scalerlib: Set chroma_vrep correctly for YUV10COL

firmware: isp: check the hi-res resize filter mode when the input crop changes
kbingham pushed a commit to kbingham/libcamera that referenced this pull request Jul 17, 2020
Remove use of vcsm allocations and replace with dma heap allocations.
The pipeline handler now passes the fd of the allocation over to the IPA
instead of the raw pointer.

Also use libcamera::FileDescriptor for fd lifetime management.

This commit must be built alongside the accompanying BCM2835 ISP kernel
driver changes at raspberrypi/linux#3715.
Otherwise a mismatch will cause undefined behavior.

Signed-off-by: Naushir Patuck <[email protected]>
Reviewed-by: Laurent Pinchart <[email protected]>
Signed-off-by: Laurent Pinchart <[email protected]>
naushir added a commit to raspberrypi/libcamera that referenced this pull request Jul 22, 2020
Remove use of vcsm allocations and replace with dma heap allocations.
The pipeline handler now passes the fd of the allocation over to the IPA
instead of the raw pointer.

Also use libcamera::FileDescriptor for fd lifetime management.

This commit must be built alongside the accompanying BCM2835 ISP kernel
driver changes at raspberrypi/linux#3715.
Otherwise a mismatch will cause undefined behavior.

Signed-off-by: Naushir Patuck <[email protected]>
Reviewed-by: Laurent Pinchart <[email protected]>
Signed-off-by: Laurent Pinchart <[email protected]>
@kamomil
Copy link

kamomil commented Sep 17, 2020

Hi, I see that branch rpi-5.8.y have this change, but branch rpi-5.9.y does not

@6by9
Copy link
Contributor Author

6by9 commented Sep 17, 2020

Hi, I see that branch rpi-5.8.y have this change, but branch rpi-5.9.y does not

Mainline 5.9 release includes a significant rework to VCHI which stops vcsm-cma (a dependency of bcm2835-codec and bcm2835-isp) from working.
It's being worked on, and I'll be making sure that everything is supported on 5.9 when done.

@kamomil
Copy link

kamomil commented Sep 18, 2020

Hi, thanks for the fast response, I tried to use the driver on rpi-5.8.y but I get the error:

bcm2835-isp bcm2835-isp: bcm2835_isp_probe: ril.isp returned 1 i/p (1 expected), 2 o/p (3 expected) ports

which originate from this part:
https://github.com/raspberrypi/linux/blob/rpi-5.8.y/drivers/staging/vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c#L1662

You have any idea why does it happen and how can I track it back?
I see that outputs is set here:
https://github.com/raspberrypi/linux/blob/rpi-5.8.y/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c#L1099
but how/where is rmsg get filled ?

Thanks

@kamomil
Copy link

kamomil commented Sep 23, 2020

hi, I found out the problem, I had to udpate my firmware to fit the new kernel with rpi-update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.