Add a driver for the Arducam Pivariety series CSI2 camera sensor.
Signed-off-by: Lee Jackson <info@arducam.com>
SQUASH: Fix VIDEO_ARDUCAM_PIVARIETY Kconfig entry
The cherry-pick from rpi-5.17.y put it in the wrong section, and failed
to update it for 5.18.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
media: i2c: arducam-pivariety: Add custom controls
Add support for strobe_shift, strobe_width and mode custom controls.
Signed-off-by: Lee Jackson <info@arducam.com>
media: i2c: arducam-pivariety: Fix mutex init and NULL pointer
The mutex used in arducam-pivariety was not properly initialized,
which could lead to undefined behavior. This also caused a NULL
pointer dereference under certain conditions.
This patch ensures the mutex is correctly initialized during probe
and prevents NULL pointer dereferences.
Signed-off-by: Yuriy Pasichnyk <yurijpasichnyk11@gmail.com>
Add YAML device tree binding for Arducam Pivariety CMOS image sensor, and
the relevant MAINTAINERS entries.
Signed-off-by: Lee Jackson <info@arducam.com>
On some platforms the cma area can be half the entire system memory,
meaning that allocations start happening in the cma area immediately.
This leads to fragmentation and subsequent fatal cma_alloc failures.
We introduce an "alloc_in_cma_threshold" parameter which requires that
this many sixteenths of the free pages must be in cma before it will
try to use them. By default this is set to 12, but the previous
behaviour can be restored by setting it to 8 on startup.
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Adds a driver for the Analog Devices AD5398 10 bit
I2C DAC which is commonly used for driving VCM lens
mechanisms.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
media: i2c: Rename ad5398 to ad5398_vcm
There's already a regulator module called ad5398 that exposes
this device through the regulator API. That is meaningless in
the terms that it uses and how it maps to V4L2, so a new driver
was added. However the module name collision wasn't noted, so
rename it now.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Add a binding for Analog Devices AD5398 10bit current
sinking DAC when used as a lens VCM driver.
FIXME: Convert to YAML
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Omnivision OV2311 is a CSI2 1600x1300 global shutter image sensor.
Add a driver for it.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
media: i2c: Update ov2311 Kconfig entry
Bring the OV2311 Kconfig declaration in line with upstream entries.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
media: i2c: ov2311: Fix uninitialized variable usage
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
"media: i2c: Remove .s_power() from ov7251" removed the call that
sent ov7251_global_init_setting to the sensor. Send it when starting
streaming.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
The sck-idle-input property indicates that the spi-gpio driver should
return the SCK line to an input when the chip select signals are
inactive.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
https://github.com/raspberrypi/linux/issues/4440
Upstream has added additional device specific controls, so the
V4L2_CID_USER_BASE + 0x10e0 value that had been defined for use with
the ISP has been taken by something else (and +0x10f0 has been used as
well)
Duplicate the use on V4L2_CID_USER_BASE + 0x10e0 so that userspace
(libcamera) doesn't need to change. Once the driver is upstream, then
we'll update libcamera to adopt the new value as it then won't change.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Not all implementations wire up the enable GPIO and may just tie
it to a supply rail.
Make it optional.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
The I2C to the Atmel is very fussy, and locks up easily on
Pi0-3 particularly on reads.
The LCD power status is controlled solely by this driver, so
rather than reading it back from the Atmel, use the cached
status last set.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
regulator/rpi-panel: Power off display on shutdown
Adds a shutdown function to turn off the backlight, bridge, and
touch controller on shutdown.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
regulator/rpi-panel: Remove the ID read
Reading from the Atmel has always been troublesome due to
clock stretching, and the driver does nothing with it anyway.
Remove the read and assume that if the overlay has been
configured (most likely through the firmware autodetection)
that the hardware is present.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
As happens occasionally, an upstream change has once again prevented
spidev from being loaded via Device Tree. We now need "spidev" to be
included in the new spi_device_id list, otherwise although the
spidev driver gets loaded no /dev/spidev*.* entries will appear.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
An unwanted side effect of enabling the BRCMDBG config setting is
redefining brcmf_info to be brcmf_err. This can be alarming to users
and makes it harder to spot real errors, so don't do it.
See: https://github.com/raspberrypi/linux/issues/4663
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
For cases where spare PWM outputs are available, but are desired
to be addressed a standard outputs instead.
Wraps a PWM channel as a new GPIO chip with the one output.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
pwm: gpio-pwm: follow pwm_apply_might_sleep() rename
Fixes: 03286093be68("drivers/gpio: Add a driver that wraps the PWM API as a GPIO controller")
Signed-off-by: Ratchanan Srirattanamet <peathot@hotmail.com>
Some platforms include a fan-speed register that reports RPM directly
as an alternative to counting interrupts from the fan tachometer input.
Add support for reading a register at a given offset (rpm-offset) within
a block declared in another node (rpm-regmap). This indirection allows
the usual address mapping to be performed, and for address sharing with
another driver.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Should we go through the timeout failure case with port_disable
not returning all buffers for whatever reason, the
buffers_with_vpu counter gets left at a non-zero value, which
will cause reference counting issues should the instance be
reused.
Reset the count when the port is enabled again, but before
any buffers have been sent to the VPU.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
The firmware can only use I2C0 if the kernel isn't, therefore
with libcamera and DRM using it the PoE HAT fan control needs
to move to the kernel.
Add the option for the driver to be created by the PoE HAT core
MFD driver, and use the I2C regmap that provides to control fan
functions.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
The Raspbery Pi PoE+ HAT exposes a fan controller and power
supply status reporting via a single I2C address.
Create an MFD device that allows loading of the relevant
sub-drivers, with a shared I2C regmap.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Serge Schneider <serge@raspberrypi.com>
power: rpi-poe: Drop CURRENT_AVG as it is not hardware averaged
As documented the _AVG parameters are meant to be hardware
averaged, but the implementation for the PoE+ HAT was done in
software in the firmware.
Drop the property.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
power: rpi-poe: Add option of being created by MFD or FW
The firmware can only use I2C0 if the kernel isn't, therefore
with libcamera and DRM using it the PoE HAT fan control needs
to move to the kernel.
Add the option for the driver to be created by the PoE HAT core
MFD driver, and use the I2C regmap that provides to control fan
functions.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
power: rpi-poe: FIXUP DRIVER.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
As we're wanting to wrap the image_fx component for deinterlacing,
add the deinterlace algorithm values to enum mmal_parameter_imagefx
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Adds enum mmal_interlace_type and struct
mmal_parameter_video_interlace_type to allow for querying the
interlacing mode on decoders.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Bindings for the panel-dsi specific additions to panel-simple.
Allow for DSI specific bus settings and panel timing
to be define in devicetree. Very similar to panel-dpi.
Signed-off-by: Timon Skerutsch <kernel@diodes-delight.com>
The Geekworm MZP280 panel is a 480x640 (portrait) panel with a
capacitive touch interface and a 40 pin header meant to interface
directly with the Raspberry Pi. The screen is 2.8 inches diagonally,
and there appear to be at least 4 distinct versions all with the same
panel timings.
Timings were derived from drivers posted on the github located here:
https://github.com/tianyoujian/MZDPI/tree/master/vga
Additional details about this panel family can be found here:
https://wiki.geekworm.com/2.8_inch_Touch_Screen_for_Pi_zero
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
The regulator of the Waveshare DSI-TOUCH series panels is different.
Add a new driver for this regulator.
Signed-off-by: Waveshare_Team <support@waveshare.com>
drivers/regulator : Adjust power enable sequence
Avoid direct enabling of LCD power here.
Certain screens require immediate initialization after power-on
to prevent polarization.
Signed-off-by: Waveshare_Team <support@waveshare.com>
Waveshare sell a range of DSI panels of varying sizes, all
using a common MCU to control the panel and backlight.
Add a panel driver that supports these panels.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
drm/panel: waveshare: Fix up timings for 10.1" panel
The 10.1" panel doesn't work with the timings defined. vc4
will always have been fixing up the timing due to the limited
integer divider, so compute the fixed up mode and use it
directly.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
drivers/gpu/drm/panel:fix waveshare panel software restart/shutdown display is abnormal
Fixed the screen stays white when the user restarts or shuts down
Signed-off-by: eng33 <eng33@waveshare.com>
drivers/gpu/drm/panel:Modify the DSI mode to fix the problem that 7.9inch cannot be displayed
Signed-off-by: eng33 <eng33@waveshare.com>
drivers/gpu/drm/panel:Modified the timing of 11.9inch to fix the issue that 11.9inch was displayed abnormally
Signed-off-by: eng33 <eng33@waveshare.com>
Driver:add waveshare 4inch dsi lcd (C) driver
Signed-off-by: Eng33 <eng33@waveshare.net>
drivers:gpu:drm:panel: Added waveshare 5.0inch, 6.25inch, and 8.8inch dsi screen devices
Signed-off-by: eng33 <eng33@waveshare.com>
drm: panel: Added waveshare 13.3inch panel
Signed-off-by: eng33 <eng33@waveshare.com>
drm: panel: Added waveshare 7.0inch h dsi screen support
Signed-off-by: Waveshare_Team <support@waveshare.com>
drivers/gpu/drm/panel : Add the device for the Waveshare DSI-TOUCH series panels.
the driver are provided for the Waveshare DSI-TOUCH series panels,
modelled after the other Ilitek controller drivers,
but not limited to Ilitek series controllers.
The aim is to offer a more consistent operation and
experience for the Waveshare DSI-TOUCH series panels.
Signed-off-by: Waveshare_Team <support@waveshare.com>
drivers/gpu/drm/panel : Update display driver
1) Add LCD power control
2) Added support for:
A) Add support for 3.4-DSI-TOUCH-C
B) Add support for 4-DSI-TOUCH-C
C) Add support for 8-DSI-TOUCH-A
D) Add support for 9-DSI-TOUCH-B
E) Add support for 10.1-DSI-TOUCH-B
F) Add support for 12.3-DSI-TOUCH-A
Signed-off-by: Waveshare_Team <support@waveshare.com>
The Top DisplayOptoelectronics (TDO) T17B driver chip is used
in the TL040HDS20CT panel (found in the Pimoroni HyperPixel4
Square display) and potentially other displays.
The driver chip supports SPI for configuration and DPI
video data.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
This new panel uses the ILI9881C IC but needs an alternate
init sequence, and therefore requires a new compatible string.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Penk Chen <penk@cutiepi.io>
drm/panel: ilitek-ili9881c: Clean up on mipi_dsi_attach failure
mipi_dsi_attach is allowed to fail, and currently the probe
code doesn't clean up (mainly drm_panel_remove) if this happens.
Add cleanup code on failure.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
drm/panel: panel-ilitek9881c: Use cansleep methods
Use cansleep version of gpiod_set_value so external IO drivers (like
via I2C) can be used.
Signed-off-by: Mark Williams <mwp@mwp.id.au>
drm/panel: panel-ilitek9881c: Crystalfontz support
Add support for Crystalfontz CFAF7201280A0-050Tx panel.
Signed-off-by: Mark Williams <mwp@mwp.id.au>
drm/panel: ili9881: Add configuration for the new panels
Add configuration for the 5" and 7" Raspberry Pi 720x1280
DSI panels based on ili9881.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Update panel-ilitek-ili9881c.c
Correcting display dimension typo
ILI9881C: Update timings for CFAF7201280A0-050TX
Update of ILI9881C CFAF7201280A0-050TX panel timing to work with the CM5.
Signed-off-by: Mark Williams <mark@crystalfontz.com>
There is no reason why the control GPIOs for the panel can not
be connected to I2C or similar GPIO interfaces that may need to
sleep, therefore switch from gpiod_set_value to
gpiod_set_value_cansleep calls to configure them.
Without that you get complaints from gpiolib every time the state
is changed.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
drm: panel: jdi-lt070me05000: Add prepare_upstream_first flag
The panel driver wants to send DCS commands from the prepare
hook, therefore the DSI host wants to be pre_enabled first.
Set the flag to achieve this.
https://forums.raspberrypi.com/viewtopic.php?t=354708
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
The Raspberry Pi 7" 800x480 panel uses a Toshiba TC358762 DSI
to DPI bridge chip, so there is a requirement for the timings
to be specified for the end panel. Add such a definition.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
drm/panel-simple: Populate bpc when using panel-dpi
panel-dpi doesn't know the bit depth, so in the same way that
DPI is guessed for the connector type, guess that it'll be 8bpc.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
drm/panel-simple: Allow the bus format to be read from DT for panel-dpi
The "panel-dpi" compatible string configures panel from device tree,
but it doesn't provide any way of configuring the bus format (colour
representation), nor does it populate it.
Add a DT parameter "bus-format" that allows the MEDIA_BUS_FMT_xxx value
to be specified from device tree.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
drm/panel: simple: add Geekworm MZP280 Panel
Add support for the Geekworm MZP280 Panel
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Acked-by: Maxime Ripard <maxime@cerno.tech>
drm/panel: simple: Add Innolux AT056tN53V1 5.6" VGA
Add support for the Innolux AT056tN53V1 5.6" VGA (640x480) TFT LCD
panel.
Signed-off-by: Joerg Quinten <aBUGSworstnightmare@gmail.com>
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
drm/panel: simple: Alter the timing for the Pi 7" DSI display
vc4 has always fixed up the timing, so the values defined have
never actually appeared on the wire.
The display appears to want a slightly longer HFP, so extend
the timings and recompute the clock to give the same frame rate.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
drm/panel: add panel-dsi
Equivalent to panel-dpi for configuring a simple DSI panel with
device tree side timings and bus settings.
Motiviation is the same as for panel-dpi of wanting to support
new simple panels without needing to patch the kernel.
Signed-off-by: Timon Skerutsch <kernel@diodes-delight.com>
drm/panel-simple: Remove custom handling of orientation
The framework now handles reading orientation from DT, therefore
remove the custom get_orientation hook from panel-simple.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
drm/panel-simple: Fix 7inch panel mode for misalignment
The 7inch panel is one line off the screen both horizontally
and vertically.
Alter the panel mode to correct this.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
drm/panel-simple: Increase pixel clock on Pi 7inch panel
The Toshiba bridge is very fussy and doesn't like the CM3
output when being told to produce a 27.777MHz pixel clock, which
is an almost perfect match to the DSI link integer divider.
Increasing to 30MHz will switch the DSI link from 333MHz to 400MHz
and makes the bridge happy with the same video timing as works
on Pi4.
(Pi4 will be using a link frequency of 375MHz due to a 3GHz
parent PLL).
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
We now have the hardware I2C controller pinmuxed to the drive the
display I2C, but this controller does not support clock stretching.
The Atmel micro-controller in the panel requires clock stretching
to allow it to prepare any data to be read.
Split the rpi_touchscreen_i2c_read into two independent transactions with
a delay between them for the Atmel to prepare the data.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
drm/panel/raspberrypi-ts: Insert delay before polling for startup state
In switching to the hardware I2C controller there is an issue
where we seem to not get back the correct state from the Pi
touchscreen.
Insert a delay before polling to avoid this condition.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
drm/panel/raspberrypi-touchscreen: Handle I2C errors.
rpi_touchscreen_i2c_read returns any errors from i2c_transfer,
or the 8 bit received value.
Check for error values before trying to process the data as
valid.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
drm/panel/raspberrypi-touchscreen: Insert more delays.
This avoids failures in cases where the panel is enabled
or re-probed very soon after being disabled or probed.
These can occur because the Atmel device can mis-behave
over I2C for a few ms after any write to the POWERON register.
Add call to v4l2_ctrl_new_fwnode_properties to read and
create the fwnode based controls.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Whilst the hardware can't achieve the limits of level 4.2 under
all situations, it can exceed level 4.0.
Allow selection of levels 4.1 and 4.2.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
The Adafruit Mini-PiTFT13 display needs offsets applying when rotated,
so use the "variant" mechanism to select a custom set_addr_win method
using a dedicated compatible string of "fbtft,minipitft13".
See: https://github.com/raspberrypi/firmware/issues/1524
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
DMABUFs are all handled by videobuf2, so there is no reason not
to enable support for them.
Note that this driver is still using the vmalloc allocator, so
the buffers it allocates will not be compatible with the codec
or ISP driver that require contiguous buffers. However this
driver should be able to import the buffers allocated by them.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
In order to simplify the driver slightly, use the same PLL
configuration, and hence pixel rate and link frequency (to be
added) for the full, 1080p, and binned modes.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
There are many registers in common between all the modes.
Pull those out into one common table.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
To make comparisons of the mode registers easier, put the registers
for the binned and VGA modes in the same order as the others.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
The driver did expose V4L2_CID_HBLANK, but as a READ_ONLY control.
The sensor only uses the HTS register to control the line length,
so convert this control to read/write, with the appropriate ranges.
Adopt the old fixed values as the minimum values permitted in each
mode to avoid issues of it not streaming.
This should allow exposure times up to ~3 seconds (up from ~1sec).
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
v4l2_async_register_subdev doesn't bind in lens or flash drivers,
but v4l2_async_register_subdev_sensor does.
Switch to using v4l2_async_register_subdev_sensor.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>