Commit Graph

304 Commits

Author SHA1 Message Date
Andreas Sandberg a43fd92c4e drivers: ssd16xx: Make SSD1673 registers optional
The SSD16xx driver currently hard-codes a couple of register overrides
that aren't relevant or even correct for many devices. Make them
optional device tree properties instead.

Note that this changes the behavior for panels that expect
SSD16XX_CMD_DUMMY_LINE and SSD16XX_CMD_GATE_LINE_WIDTH to be set by
the driver. This fixes a bug where the incorrect value
was written to all SSD16xx panels except for GDEH0213B1 and GDEH029A1.

The overlay files for devices that need dummy line and gate line width
to be specified have been updated as a part of this commit.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-08-16 11:32:26 +02:00
Andreas Sandberg 532ab8c13d drivers: ssd16xx: Make voltage overrides optional
The OTP in most SSD16xx-based displays normally contain default
VCOM/GDV/SDV values. Make all of these optional in the device tree.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-08-16 11:32:26 +02:00
Andreas Sandberg aa68ebf1d4 drivers: ssd16xx: Add a helper for uint8 writes
Many register writes only use 8 bits of data. A common pattern in the
driver is to assign a constant to a temporary variable and write that
to the device. Simplify this pattern by adding a helper function that
writes an uint8 to a device.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-08-16 11:32:26 +02:00
Andreas Sandberg 0c343344eb drivers: ssd16xx: Refactor activation
Device activation always follows the same sequence, we first write the
SSD16XX_CMD_UPDATE_CTRL_2 register followed by
SSD16XX_CMD_MASTER_ACTIVATION. Create a helper function that performs
both of these actions.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-08-16 11:32:26 +02:00
Henrik Brix Andersen 31681269c0 drivers: display: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Kumar Gala 63769bd1c1 drivers: display: Remove unnecessary Kconfig settings
Have the display enabled in devicetree will now get the driver
enabled by default when CONFIG_DISPLAY=y is set.  So we can remove
setting driver enabling Kconfig values in various .conf and
defconfig files.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-09 12:27:44 +02:00
Kumar Gala 902f42f491 drivers: display: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers
* Move to using 'select SPI' instead of 'depends on'
  (see commit df81fef944 for
   more details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-09 12:27:44 +02:00
Andreas Sandberg 61306aedb4 drivers: ssd16xx: Add an API to read raw RAM contents
Add the ssd16xx_read_ram() function that can be used to read the raw
contents of the two display RAM in the controller. This function is
similar to display_read(), but lets the caller specify the RAM to
operate on. The intention is that this can be used to read out the
contents of the old frame buffer after a partial refresh that
automatically swaps the black/red buffers.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-27 18:45:47 +02:00
Andreas Sandberg 8312db7734 drivers: ssd16xx: Implement basic read support
Read operations only work on SPI controllers that support half
duplex. To enable read operations, set the device mode to half duplex
by adding the following to the device's DTB node:

  duplex = <SPI_HALF_DUPLEX>;

If read requests will fail with -ENOTSUP if the device isn't in half
duplex mode.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-27 18:45:47 +02:00
Andreas Sandberg 25cff5edc3 drivers: uc81xx: Avoid using auto sequencing
The UC8179 supports automatic power management where the DC-DC is
enabled automatically. This is not supported on the UC8176. Explicitly
call PON/DRF/POF from uc81xx_update_display instead. This ensures that
the DC-DC is only enabled while actually updating the display for all
supported chips.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-27 18:45:02 +02:00
Andreas Sandberg f4a6c75087 drivers: uc81xx: Fix incorrect UC8176 CDI layout
The CDI register in UC8176 and UC8179 have different layouts. Add a
helper function to the quirks structure to handle CDI updates.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-27 18:45:02 +02:00
Andreas Sandberg f6bbbc3c7d drivers: uc81xx: Use device-specific compatibles
The UC8176 and UC8179 chips that exist in tree have subtly different
register layouts. Use separate compatible strings for these chips and
a quirks structure that describe device-specific behavior.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-27 18:45:02 +02:00
Andreas Sandberg 8f0093aaf8 drivers: Rename GD7965 to UC81xx
The GD7965 driver is really just a vendor name for the UltraChip
UC8179. Rename the driver to UC81xx since there are other chips in the
family (e.g., the UC8176) with an almost identical register interface.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-27 18:45:02 +02:00
Andreas Sandberg fa6fe0274c drivers: gd7965: Use packed structs where appropriate
There are a few registers that map nicely onto structs. Switch from
using index constants and byte arrays in those cases.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-19 13:06:47 -07:00
Andreas Sandberg 544c0b22dd drivers: gd7965: Make tcon/cdi/pwr/softstart optional
Some panels using this driver don't provide tcon/cdi/pwr/softstart
values in their reference code. It is normally expected that the right
values will be loaded from OTP in such cases. Make these values
optional to support such panels.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-19 13:06:47 -07:00
Andreas Sandberg dc860cd6aa drivers: gd7965: Make it possible to use multiple instances
Add instance-specific data and config structs, and remove all other
global variables.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-19 13:06:47 -07:00
Andreas Sandberg 376973423f drivers: gd7965: Remove the need to use heap memory
The GD7965 driver uses malloc to allocate a single line buffer when
clearing the display. This buffer is used to clear the display line by
line. This as two problems. First, it means that the driver introduces
an unnecessary requirement to support heap allocations. Second, it
causes a lot of weird and unnecessary SPI transactions that look like
partial updates without the actual refresh. This is very inefficient
since the same action can be performed in a single SPI transaction.

Add a gd7965_write_cmd_pattern() helper function that writes a pattern
of a specified length to a register in the device.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-19 13:06:47 -07:00
Andreas Sandberg 589b83a745 drivers: gd7965: Lock the SPI bus
The protocol used by the GD7965 driver requires that SPI transactions
are split into two phases, a command phase and a data phase, to change
the state of a GPIO signaling commands/data.

We currently don't lock the bus which means that other drivers could
potentially take over the bus and introduce unpredictable delays
between the command and data phase.

Add the necessary locking.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-19 13:06:47 -07:00
Jimmy Ou 78f876ef03 drivers: display: max7219: add driver
This commit implements the display interface for the MAX7219 LED Display
drivers.

Signed-off-by: Jimmy Ou <yanagiis@gmail.com>
2022-07-15 10:10:48 +02:00
Andreas Sandberg 237de99da4 drivers: ssd16xx: Refactor busy pin handling
The SSD16xx driver needs to wait for the chip to complete commands
before issuing new commands. The datasheet doesn't specify which
commands cause the chip to raise the busy pin. The current driver has
ssd16xx_busy_wait() calls after commands that are known to take a long
time. This is very fragile and scatters a lot of boiler plate around
the driver.

Include an ssd16xx_busy_wait() call in ssd16xx_write_cmd() instead of
after commands that are suspected to take a long time. This makes the
driver more robust and is more in line with the expectations set out
in the data sheet.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-13 15:57:04 +02:00
Pieter De Gendt bdf3322de8 drivers: display: display_mcux_elcdif: Rework double framebuffer
Improved the eLCDIF driver implementation:
* Optional (working) double framebuffers
* Statically allocated framebuffer(s)
* Removed obsolete Kconfig entries

Also modified the mimxrt1170 EVK default config.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-07-13 07:58:58 -05:00
Andreas Sandberg 4a09967517 drivers: ssd16xx: Implement blanking support
Implement support for display blanking by inhibiting display refresh
while blanking is on. Writes to the display are still sent to the
internal RAM in the display controller. Once blanking is turned off,
the contents of the RAM are written to the display. This behavior is
makes it possible to compose a frame buffer in the display controller
without flickering.

Other e-paper drivers such as the GD7965 already implement this
behavior.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-13 10:27:45 +02:00
Andreas Sandberg f5932657dd drivers: ssd16xx: Fix CS glitch
The SSD16xx uses a separate pin to indicate if an SPI transfer is a
command or data. This means that driver needs to split most SPI
transactions into two distinct transactions, one for commands and one
for data. The driver currently doesn't request SPI_HOLD_ON_CS which
means that the chip select will be released momentarily between the
command and data phase.

Update the driver to request SPI_HOLD_ON_CS and SPI_LOCK_ON to lock
the bus and complete both phases of a command in one atomic operation.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-06 11:14:49 +02:00
Andreas Sandberg f922a580f7 drivers: ssd16xx: Remove unused include
Remove the unused zephyr/display/cfb.h include.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-06 11:14:49 +02:00
Pieter De Gendt 8bef504163 drivers: display: st7789v: Support 3-line serial interface
The sitronix ST7789V serial interface can operate with 3- or 4-line
protocol.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-07-06 10:42:15 +02:00
TOKITA Hiroshi 7e4cf8308d drivers: display: st7735r: added inversion-on property
Add 'inversion-on' property to st7735r.
Issue INVON(21h) command on initializing if inversion-on was enabled.
As a result of this command, the display color is inverted.
Otherwise, INVOFF(20h) will be issued.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-05-13 11:04:21 -07:00
Mahesh Mahadevan 8157e4bebf display: Update ELCDIF driver to use a config
Update the MCUX ELCDIF driver to use CONFIG_MCUX_ELCDIF_POOL_BLOCK_NUM
for the number for frame buffers to allocate.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-05-12 09:26:50 -05:00
Mahesh Mahadevan 450a1c0982 drivers: display: Add support for Raydium RM68200
Add support for the Raydium RM68200 MIPI DSI panel.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-05-12 09:26:50 -05:00
Tomislav Milkovic a5429ac988 drivers: display: temporary fix for PLLSAI on STM32F7
Temporary fix to configure PLLSAIR multipliers for correct
LTDC pixel clock on STM32F746G Discovery board

Signed-off-by: Tomislav Milkovic <tomislav.milkovic95@gmail.com>
2022-05-12 09:21:46 +02:00
Georgij Cernysiov b11fcc8e0c drivers: display: stm32_ltdc: fix set orientation API
Refactors invalid switch into if statement.
Fixes orientation set return value for normal
display orientation.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-11 10:49:23 +02:00
Gerard Marull-Paretas fb60aab245 drivers: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all drivers to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 19:58:21 +02:00
Konstantinos Papadopoulos b8604024f7 drivers: display: stm32_ltdc temporary patch for LTDC clock
LTDC clock on F4/F7 series, is generated from PLLSAI which yet is not
implemented into Zephyr.

Signed-off-by: Konstantinos Papadopoulos <kostas.papadopulos@gmail.com>
2022-04-08 15:49:42 -07:00
Konstantinos Papadopoulos 5e519fef40 drivers: ILI9341 add interface control registers
This enables the option through dts to drive the display
with RGB interface.

Signed-off-by: Konstantinos Papadopoulos <kostas.papadopulos@gmail.com>
2022-04-08 15:49:42 -07:00
Mahesh Mahadevan a8f8c1c185 drivers: display: Add blanking support for NXP ELCDIF driver
Implement the blanking_on and blanking_off API functions for
NXP's MCUX ELCDIF display driver

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-04-07 16:37:50 -05:00
Casper Meijn c33d1b55f8 drivers: display: st7789v: Add multi-instance support
Replace the config and data struct with a macro. Execute the macro
for each instance.

Signed-off-by: Casper Meijn <casper@meijn.net>
2022-04-06 10:58:26 +02:00
Casper Meijn ac9cd9e89a drivers: display: st7789v: Remove compile time reset selection
Replace the compiletime `#if` with a runtime decision. This makes
a multi-instance driver possible.

Signed-off-by: Casper Meijn <casper@meijn.net>
2022-04-06 10:58:26 +02:00
Casper Meijn 7f5c5cf317 drivers: display: st7789v: Move params to `struct config`
Move the const configuration parameters to `struct st7789v_config`.

Signed-off-by: Casper Meijn <casper@meijn.net>
2022-04-06 10:58:26 +02:00
Tomislav Milkovic 9f0fa15bb7 drivers: display: add stm32_ltdc driver
Add Kconfig for STM32 LTDC driver
Add STM32 LTDC driver C source
Update display drivers CMakeLists with the new driver
Update display drivers Kconfig with the new driver

Signed-off-by: Tomislav Milkovic <tomislav.milkovic95@gmail.com>
2022-03-29 18:30:02 -07:00
Daniel DeGrasse 9824721680 drivers: display: display_mcux_elcdif: add backlight-gpios property
Add backlight gpios property to mcux display driver, so that the driver
can correctly initialize the backlight gpio control.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Daniel DeGrasse 5ec576fb04 drivers: display: display_mcux_elcdif: add pinctrl support
add pinctrl support for display_mcux_elcdif driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Gerard Marull-Paretas d965f0a578 drivers: display: ili9xxx: default based on DT compatible
Enable the ILI9XXX display driver based on DT compatible status.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-24 13:36:54 +01:00
Johann Fischer a713315f0c drivers: ssd16xx: propagate errors where possible
Fix error propagation on several places.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-03-23 18:40:08 +01:00
Johann Fischer 75fb9ee143 drivers: ssd16xx: rework function to clear panel buffer at init
Rework function to clear panel buffer to use less memory
and propagate the errors.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-03-23 18:40:08 +01:00
Johann Fischer e36c2699e4 drivers: ssd16xx: use usual scheme struct foo *data = dev->data
Use usual scheme "struct foo *data = dev->data;".

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-03-23 18:40:08 +01:00
Johann Fischer a2e7e9a0e0 drivers: ssd16xx: add multi-instance support
Get rid of all DT_INST_PROP(0,...) and rework
the driver to support multiple instances.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-03-23 18:40:08 +01:00
Nazar Kazakov f483b1bc4c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-18 13:24:08 -04:00
Nazar Kazakov 9713f0d47c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-14 20:22:24 -04:00
Gerard Marull-Paretas 95fb0ded6b kconfig: remove Enable from boolean prompts
According to Kconfig guidelines, boolean prompts must not start with
"Enable...". The following command has been used to automate the changes
in this patch:

sed -i "s/bool \"[Ee]nables\? \(\w\)/bool \"\U\1/g" **/Kconfig*

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-09 15:35:54 +01:00
Krzysztof Chruscinski 47ae656cc1 all: Deprecate UTIL_LISTIFY and replace with LISTIFY
UTIL_LISTIFY is deprecated. Replacing it with LISTIFY.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-08 11:03:30 +01:00
Casper Meijn 2eb1feea91 drivers: display: st7789v: fix gpio_dt_spec initialization
The `gpio_dt_spec` structures where never initialised, therefore the driver
would always fault with "E: Reset GPIO device not ready" printed to the
console.

Fixes: 069bf6be44
("drivers: display: st7789v: use gpio_dt_spec")

Signed-off-by: Casper Meijn <casper@meijn.net>
2022-03-01 14:38:21 -06:00