/*
 * Copyright (c) 2019 Jan Van Winkel <jan.van_winkel@dxplore.eu>
 *
 * SPDX-License-Identifier: Apache-2.0
 */
 #include <zephyr/dt-bindings/mipi_dbi/mipi_dbi.h>

 / {
     chosen {
         zephyr,display = &st7789v_msalamon;
     };
 
     mipi_dbi_st7789v_msalamon {
         compatible = "zephyr,mipi-dbi-spi";
         spi-dev = <&spi0>;
         reset-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
         dc-gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>;
         write-only;
         #address-cells = <1>;
         #size-cells = <0>;
 
         st7789v_msalamon: st7789v@0 {
             compatible = "sitronix,st7789v";
             mipi-max-frequency = <20000000>;
             reg = <0>;
             width = <320>;
             height = <170>;
             x-offset = <0>;
             y-offset = <35>;
             vcom = <0x2b>;
             gctrl = <0x35>;
             vrhs = <0x0f>;
             vdvs = <0x20>;
             mdac = <0x60>;
             gamma = <0x01>;
             colmod = <0x55>;
             lcm = <0x2c>;
             porch-param = [0c 0c 00 33 33];
             cmd2en-param = [5a 69 02 01];
             pwctrl1-param = [52 a1];
             pvgam-param = [D0 00 02 07 0B 1A 31 54 40 29 12 12 12 17];
             nvgam-param = [D0 00 02 07 05 15 2D 44 44 1C 18 16 1C 1D];
             ram-param = [00 F8];
             rgb-param = [CD 08 14];
             mipi-mode = "MIPI_DBI_MODE_SPI_4WIRE";
         };
     };
 };

 &pinctrl {
     spi0_default: spi0_default {
         group1 {
             psels = <NRF_PSEL(SPIM_SCK, 1, 15)>,
                 <NRF_PSEL(SPIM_MOSI, 1, 13)>,
                 <NRF_PSEL(SPIM_MISO, 1, 14)>;
         };
     };
 
     spi0_sleep: spi0_sleep {
         group1 {
             psels = <NRF_PSEL(SPIM_SCK, 1, 15)>,
                 <NRF_PSEL(SPIM_MOSI, 1, 13)>,
                 <NRF_PSEL(SPIM_MISO, 1, 14)>;
             low-power-enable;
         };
     };
 };
 
&spi0 {
     compatible = "nordic,nrf-spim";
     status = "okay";
     pinctrl-0 = <&spi0_default>;
     pinctrl-1 = <&spi0_sleep>;
     cs-gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
     pinctrl-names = "default", "sleep";
};
