123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863 |
- /*
- * Copyright (c) 2020 Actions Technology Co., Ltd
- *
- * SPDX-License-Identifier: Apache-2.0
- */
- #include <sys/byteorder.h>
- #include "panel_st77916.h"
- #include "panel_device.h"
- /*********************
- * DEFINES
- *********************/
- /**********************
- * TYPEDEFS
- **********************/
- /**********************
- * STATIC PROTOTYPES
- **********************/
- /**********************
- * STATIC VARIABLES
- **********************/
- /**********************
- * MACROS
- **********************/
- /**********************
- * FUNCTIONS
- **********************/
- static void _panel_transmit(const struct device *dev, uint32_t cmd,
- const uint8_t *tx_data, size_t tx_count)
- {
- struct lcd_panel_data *data = dev->data;
- //assert(data->transfering == 0);
- display_controller_write_config(data->lcdc_dev, ST77916_WR_CMD(cmd), tx_data, tx_count);
- }
- static inline void _panel_transmit_cmd(const struct device *dev, uint32_t cmd)
- {
- _panel_transmit(dev, cmd, NULL, 0);
- }
- static inline void _panel_transmit_p1(const struct device *dev, uint32_t cmd, uint8_t tx_data)
- {
- _panel_transmit(dev, cmd, &tx_data, 1);
- }
- static void _panel_transmit_p2(const struct device *dev, uint32_t cmd, uint8_t data1, uint8_t data2)
- {
- uint8_t data_array[2] = {
- data1,
- data2,
- };
- _panel_transmit(dev, cmd, data_array, 2);
- }
- static int _panel_set_brightness(const struct device *dev, uint8_t brightness)
- {
- _panel_transmit_p1(dev, DDIC_CMD_WRDISBV, brightness);
- return 0;
- }
- static int _panel_set_mem_area(const struct device *dev, uint16_t x, uint16_t y, uint16_t w,
- uint16_t h)
- {
- uint16_t cmd_data[2];
- x += CONFIG_PANEL_MEM_OFFSET_X; // add 12 pixel offset ?
- y += CONFIG_PANEL_MEM_OFFSET_Y;
- cmd_data[0] = sys_cpu_to_be16(x);
- cmd_data[1] = sys_cpu_to_be16(x + w - 1);
- _panel_transmit(dev, DDIC_CMD_CASET, (uint8_t *)&cmd_data[0], 4);
- cmd_data[0] = sys_cpu_to_be16(y);
- cmd_data[1] = sys_cpu_to_be16(y + h - 1);
- _panel_transmit(dev, DDIC_CMD_RASET, (uint8_t *)&cmd_data[0], 4);
- return 0;
- }
- #if 0
- static void _panel_exit_sleep(const struct device *dev)
- {
- struct lcd_panel_data *data = dev->data;
- _panel_transmit_cmd(dev, DDIC_CMD_SLPOUT);
- k_msleep(120);
- data->in_sleep = 0;
-
- // _panel_transmit_cmd(dev, 0xFE);
- // _panel_transmit_cmd(dev, 0xEF);
- // _panel_transmit_cmd(dev, 0x11);
- // k_msleep(120);
- // _panel_transmit_cmd(dev, 0x29);
-
- //printk("st77916 panel exit sleep \r\n ");
- }
- #endif
- static int _panel_blanking_on(const struct device *dev)
- {
- //printk("st77916 panel blanking on \r\n ");
-
- //_panel_transmit_cmd(dev, DDIC_CMD_DISPOFF);
- //_panel_transmit_cmd(dev, DDIC_CMD_SLPIN);
- return 0;
- }
- static int _panel_blanking_off(const struct device *dev)
- {
- //struct lcd_panel_data *data = dev->data;
-
- //printk("st77916 panel blanking off \r\n ");
- //if (data->in_sleep)
- // _panel_exit_sleep(dev);
- //_panel_transmit_cmd(dev, DDIC_CMD_DISPON);
- k_msleep(80);
- return 0;
- }
- static int _panel_lowpower_enter(const struct device *dev)
- {
- //printk("st77916 panel lowpower enter \r\n ");
-
- //_panel_transmit_p1(dev, 0xFE, 0x01);
- /* 0x01 60Hz, 0x41 30Hz, 0x43 15Hz, 0x4B 5Hz, 0x7B 1Hz */
- //_panel_transmit_p1(dev, 0x29, 0x4B);
- //_panel_transmit_p1(dev, 0xFE, 0x00);
- return 0;
- }
- static int _panel_lowpower_exit(const struct device *dev)
- {
- //printk("st77916 panel lowpower exit \r\n ");
-
- //_panel_transmit_p1(dev, 0xFE, 0x01);
- //_panel_transmit_p1(dev, 0x29, 0x01);
- //_panel_transmit_p1(dev, 0xFE, 0x00);
- return 0;
- }
- //static void _panel_init_te(const struct device *dev)
- //{
- // const struct lcd_panel_config *config = dev->config;
- // if (config->videomode.flags & (DISPLAY_FLAGS_TE_HIGH | DISPLAY_FLAGS_TE_LOW)) {
- // uint8_t tmp[2];
- // sys_put_be16(CONFIG_PANEL_TE_SCANLINE, tmp);
- // _panel_transmit(dev, DDIC_CMD_STESL, tmp, 2);
- // tmp[0] = 0x02;
- // _panel_transmit(dev, DDIC_CMD_TEON, tmp, 1);
- // } else {
- // _panel_transmit(dev, DDIC_CMD_TEOFF, NULL, 0);
- // }
- //}
- static int _panel_init(const struct device *dev)
- {
- /* Sleep Out */
- //_panel_exit_sleep(dev);
-
- // internal reg enable
- //_panel_transmit(dev, DDIC_CMD_INTERREG_EN1, NULL, 0);
- //_panel_transmit(dev, DDIC_CMD_INTERREG_EN2, NULL, 0);
-
- printk("st77916 panel_init \r\n ");
-
- #if 1
- _panel_transmit_p1(dev, 0xf0, 0x08);
- _panel_transmit_p1(dev, 0xF2, 0x08);
- _panel_transmit_p1(dev, 0x9B, 0x51);
- _panel_transmit_p1(dev, 0x86, 0x53);
- _panel_transmit_p1(dev, 0xF2, 0x80);
- _panel_transmit_p1(dev, 0xF0, 0x00);
- _panel_transmit_p1(dev, 0xF0, 0x01);
- _panel_transmit_p1(dev, 0xF1, 0x01);
- _panel_transmit_p1(dev, 0xB0, 0x54);
- _panel_transmit_p1(dev, 0xB1, 0x3F);
- _panel_transmit_p1(dev, 0xB2, 0x2A);
- _panel_transmit_p1(dev, 0xB4, 0x46);
- _panel_transmit_p1(dev, 0xB5, 0x34);
- _panel_transmit_p1(dev, 0xB6, 0xD5);
- _panel_transmit_p1(dev, 0xB7, 0x30);
- //_panel_transmit_p1(dev, 0xB8, 0x04);
- _panel_transmit_p1(dev, 0xBA, 0x00);
- _panel_transmit_p1(dev, 0xBB, 0x08);
- _panel_transmit_p1(dev, 0xBC, 0x08);
- _panel_transmit_p1(dev, 0xBD, 0x00);
- _panel_transmit_p1(dev, 0xC0, 0x80);
- _panel_transmit_p1(dev, 0xC1, 0x10);
- _panel_transmit_p1(dev, 0xC2, 0x37);
- _panel_transmit_p1(dev, 0xC3, 0x80);
- _panel_transmit_p1(dev, 0xC4, 0x10);
- _panel_transmit_p1(dev, 0xC5, 0x37);
- _panel_transmit_p1(dev, 0xC6, 0xA9);
- _panel_transmit_p1(dev, 0xC7, 0x41);
- _panel_transmit_p1(dev, 0xC8, 0x51);
- _panel_transmit_p1(dev, 0xC9, 0xA9);
- _panel_transmit_p1(dev, 0xCA, 0x41);
- _panel_transmit_p1(dev, 0xCB, 0x51);
- _panel_transmit_p1(dev, 0xD0, 0x91);
- _panel_transmit_p1(dev, 0xD1, 0x68);
- _panel_transmit_p1(dev, 0xD2, 0x69);
- const uint8_t data_0xf5[] = {
- 0x00,
- 0xA5,
- };
- _panel_transmit(dev, 0xF5, data_0xf5, sizeof(data_0xf5));
- _panel_transmit_p1(dev, 0xDD, 0x3F);
- _panel_transmit_p1(dev, 0xDE, 0x3F);
- _panel_transmit_p1(dev, 0xF1, 0x10);
- _panel_transmit_p1(dev, 0xF0, 0x00);
- _panel_transmit_p1(dev, 0xF0, 0x02);
- const uint8_t data_0xe0[] = {
- 0xF0, 0x06, 0x0B, 0x09, 0x09, 0x16, 0x32, 0x44, 0x4A, 0x37, 0x13, 0x13, 0x2E, 0x34,
- };
- _panel_transmit(dev, 0xE0, data_0xe0, sizeof(data_0xe0));
- const uint8_t data_0xe1[] = {
- 0xF0, 0x06, 0x0B, 0x09, 0x08, 0x05, 0x32, 0x33, 0x49, 0x17, 0x13, 0x13, 0x2E, 0x34,
- };
- _panel_transmit(dev, 0xE1, data_0xe1, sizeof(data_0xe1));
- _panel_transmit_p1(dev, 0xF0, 0x10);
- _panel_transmit_p1(dev, 0xF3, 0x10);
- _panel_transmit_p1(dev, 0xE0, 0x0A);
- _panel_transmit_p1(dev, 0xE1, 0x00);
- _panel_transmit_p1(dev, 0xE2, 0x00);
- _panel_transmit_p1(dev, 0xE3, 0x00);
- _panel_transmit_p1(dev, 0xE4, 0xE0);
- _panel_transmit_p1(dev, 0xE5, 0x06);
- _panel_transmit_p1(dev, 0xE6, 0x21);
- _panel_transmit_p1(dev, 0xE7, 0x00);
- _panel_transmit_p1(dev, 0xE8, 0x05);
- _panel_transmit_p1(dev, 0xE9, 0x82);
- _panel_transmit_p1(dev, 0xEA, 0xDF);
- _panel_transmit_p1(dev, 0xEB, 0x89);
- _panel_transmit_p1(dev, 0xEC, 0x20);
- _panel_transmit_p1(dev, 0xED, 0x14);
- _panel_transmit_p1(dev, 0xEE, 0xFF);
- _panel_transmit_p1(dev, 0xEF, 0x00);
- _panel_transmit_p1(dev, 0xF8, 0xFF);
- _panel_transmit_p1(dev, 0xF9, 0x00);
- _panel_transmit_p1(dev, 0xFA, 0x00);
- _panel_transmit_p1(dev, 0xFB, 0x30);
- _panel_transmit_p1(dev, 0xFC, 0x00);
- _panel_transmit_p1(dev, 0xFD, 0x00);
- _panel_transmit_p1(dev, 0xFE, 0x00);
- _panel_transmit_p1(dev, 0xFF, 0x00);
- _panel_transmit_p1(dev, 0x60, 0x42);
- _panel_transmit_p1(dev, 0x61, 0xE0);
- _panel_transmit_p1(dev, 0x62, 0x40);
- _panel_transmit_p1(dev, 0x63, 0x40);
- _panel_transmit_p1(dev, 0x64, 0x02);
- _panel_transmit_p1(dev, 0x65, 0x00);
- _panel_transmit_p1(dev, 0x66, 0x40);
- _panel_transmit_p1(dev, 0x67, 0x03);
- _panel_transmit_p1(dev, 0x68, 0x00);
- _panel_transmit_p1(dev, 0x69, 0x00);
- _panel_transmit_p1(dev, 0x6A, 0x00);
- _panel_transmit_p1(dev, 0x6B, 0x00);
- _panel_transmit_p1(dev, 0x70, 0x42);
- _panel_transmit_p1(dev, 0x71, 0xE0);
- _panel_transmit_p1(dev, 0x72, 0x40);
- _panel_transmit_p1(dev, 0x73, 0x40);
- _panel_transmit_p1(dev, 0x74, 0x02);
- _panel_transmit_p1(dev, 0x75, 0x00);
- _panel_transmit_p1(dev, 0x76, 0x40);
- _panel_transmit_p1(dev, 0x77, 0x03);
- _panel_transmit_p1(dev, 0x78, 0x00);
- _panel_transmit_p1(dev, 0x79, 0x00);
- _panel_transmit_p1(dev, 0x7A, 0x00);
- _panel_transmit_p1(dev, 0x7B, 0x00);
- _panel_transmit_p1(dev, 0x80, 0x48);
- _panel_transmit_p1(dev, 0x81, 0x00);
- _panel_transmit_p1(dev, 0x82, 0x05);
- _panel_transmit_p1(dev, 0x83, 0x02);
- _panel_transmit_p1(dev, 0x84, 0xDD);
- _panel_transmit_p1(dev, 0x85, 0x00);
- _panel_transmit_p1(dev, 0x86, 0x00);
- _panel_transmit_p1(dev, 0x87, 0x00);
- _panel_transmit_p1(dev, 0x88, 0x48);
- _panel_transmit_p1(dev, 0x89, 0x00);
- _panel_transmit_p1(dev, 0x8A, 0x07);
- _panel_transmit_p1(dev, 0x8B, 0x02);
- _panel_transmit_p1(dev, 0x8C, 0xDF);
- _panel_transmit_p1(dev, 0x8D, 0x00);
- _panel_transmit_p1(dev, 0x8E, 0x00);
- _panel_transmit_p1(dev, 0x8F, 0x00);
- _panel_transmit_p1(dev, 0x90, 0x48);
- _panel_transmit_p1(dev, 0x91, 0x00);
- _panel_transmit_p1(dev, 0x92, 0x09);
- _panel_transmit_p1(dev, 0x93, 0x02);
- _panel_transmit_p1(dev, 0x94, 0xE1);
- _panel_transmit_p1(dev, 0x95, 0x00);
- _panel_transmit_p1(dev, 0x96, 0x00);
- _panel_transmit_p1(dev, 0x97, 0x00);
- _panel_transmit_p1(dev, 0x98, 0x48);
- _panel_transmit_p1(dev, 0x99, 0x00);
- _panel_transmit_p1(dev, 0x9A, 0x0B);
- _panel_transmit_p1(dev, 0x9B, 0x02);
- _panel_transmit_p1(dev, 0x9C, 0xE3);
- _panel_transmit_p1(dev, 0x9D, 0x00);
- _panel_transmit_p1(dev, 0x9E, 0x00);
- _panel_transmit_p1(dev, 0x9F, 0x00);
- _panel_transmit_p1(dev, 0xA0, 0x48);
- _panel_transmit_p1(dev, 0xA1, 0x00);
- _panel_transmit_p1(dev, 0xA2, 0x04);
- _panel_transmit_p1(dev, 0xA3, 0x02);
- _panel_transmit_p1(dev, 0xA4, 0xDC);
- _panel_transmit_p1(dev, 0xA5, 0x00);
- _panel_transmit_p1(dev, 0xA6, 0x00);
- _panel_transmit_p1(dev, 0xA7, 0x00);
- _panel_transmit_p1(dev, 0xA8, 0x48);
- _panel_transmit_p1(dev, 0xA9, 0x00);
- _panel_transmit_p1(dev, 0xAA, 0x06);
- _panel_transmit_p1(dev, 0xAB, 0x02);
- _panel_transmit_p1(dev, 0xAC, 0xDE);
- _panel_transmit_p1(dev, 0xAD, 0x00);
- _panel_transmit_p1(dev, 0xAE, 0x00);
- _panel_transmit_p1(dev, 0xAF, 0x00);
- _panel_transmit_p1(dev, 0xB0, 0x48);
- _panel_transmit_p1(dev, 0xB1, 0x00);
- _panel_transmit_p1(dev, 0xB2, 0x08);
- _panel_transmit_p1(dev, 0xB3, 0x02);
- _panel_transmit_p1(dev, 0xB4, 0xE0);
- _panel_transmit_p1(dev, 0xB5, 0x00);
- _panel_transmit_p1(dev, 0xB6, 0x00);
- _panel_transmit_p1(dev, 0xB7, 0x00);
- _panel_transmit_p1(dev, 0xB8, 0x48);
- _panel_transmit_p1(dev, 0xB9, 0x00);
- _panel_transmit_p1(dev, 0xBA, 0x0A);
- _panel_transmit_p1(dev, 0xBB, 0x02);
- _panel_transmit_p1(dev, 0xBC, 0xE2);
- _panel_transmit_p1(dev, 0xBD, 0x00);
- _panel_transmit_p1(dev, 0xBE, 0x00);
- _panel_transmit_p1(dev, 0xBF, 0x00);
- _panel_transmit_p1(dev, 0xC0, 0x12);
- _panel_transmit_p1(dev, 0xC1, 0xAA);
- _panel_transmit_p1(dev, 0xC2, 0x65);
- _panel_transmit_p1(dev, 0xC3, 0x74);
- _panel_transmit_p1(dev, 0xC4, 0x47);
- _panel_transmit_p1(dev, 0xC5, 0x56);
- _panel_transmit_p1(dev, 0xC6, 0x00);
- _panel_transmit_p1(dev, 0xC7, 0x88);
- _panel_transmit_p1(dev, 0xC8, 0x99);
- _panel_transmit_p1(dev, 0xC9, 0x33);
- _panel_transmit_p1(dev, 0xD0, 0x21);
- _panel_transmit_p1(dev, 0xD1, 0xAA);
- _panel_transmit_p1(dev, 0xD2, 0x65);
- _panel_transmit_p1(dev, 0xD3, 0x74);
- _panel_transmit_p1(dev, 0xD4, 0x47);
- _panel_transmit_p1(dev, 0xD5, 0x56);
- _panel_transmit_p1(dev, 0xD6, 0x00);
- _panel_transmit_p1(dev, 0xD7, 0x88);
- _panel_transmit_p1(dev, 0xD8, 0x99);
- _panel_transmit_p1(dev, 0xD9, 0x33);
- _panel_transmit_p1(dev, 0xF3, 0x01);
- _panel_transmit_p1(dev, 0xF0, 0x00);
- _panel_transmit_p1(dev, 0xF0, 0x01);
- _panel_transmit_p1(dev, 0xF1, 0x01);
- _panel_transmit_p1(dev, 0xA0, 0x0B);
- _panel_transmit_p1(dev, 0xA3, 0x2A);
- _panel_transmit_p1(dev, 0xA5, 0xC3);
- k_msleep(1);
- _panel_transmit_p1(dev, 0xA3, 0x2B);
- _panel_transmit_p1(dev, 0xA5, 0xC3);
- k_msleep(1);
- _panel_transmit_p1(dev, 0xA3, 0x2C);
- _panel_transmit_p1(dev, 0xA5, 0xC3);
- k_msleep(1);
- _panel_transmit_p1(dev, 0xA3, 0x2D);
- _panel_transmit_p1(dev, 0xA5, 0xC3);
- k_msleep(1);
- _panel_transmit_p1(dev, 0xA3, 0x2E);
- _panel_transmit_p1(dev, 0xA5, 0xC3);
- k_msleep(1);
- _panel_transmit_p1(dev, 0xA3, 0x2F);
- _panel_transmit_p1(dev, 0xA5, 0xC3);
- k_msleep(1);
- _panel_transmit_p1(dev, 0xA3, 0x30);
- _panel_transmit_p1(dev, 0xA5, 0xC3);
- k_msleep(1);
- _panel_transmit_p1(dev, 0xA3, 0x31);
- _panel_transmit_p1(dev, 0xA5, 0xC3);
- k_msleep(1);
- _panel_transmit_p1(dev, 0xA3, 0x32);
- _panel_transmit_p1(dev, 0xA5, 0xC3);
- k_msleep(1);
- _panel_transmit_p1(dev, 0xA3, 0x33);
- _panel_transmit_p1(dev, 0xA5, 0xC3);
- k_msleep(1);
- _panel_transmit_p1(dev, 0xA0, 0x09);
- _panel_transmit_p1(dev, 0xF1, 0x10);
- _panel_transmit_p1(dev, 0xF0, 0x00);
- const uint8_t data_0x2a[] = {
- 0x00,
- 0x00,
- 0x01,
- 0x67,
- };
- _panel_transmit(dev, 0x2a, data_0x2a, sizeof(data_0x2a));
- const uint8_t data_0x2b[] = {
- 0x01,
- 0x68,
- 0x01,
- 0x68,
- };
- _panel_transmit(dev, 0x2b, data_0x2b, sizeof(data_0x2b));
- _panel_transmit_p1(dev, 0x4D, 0x00);
- _panel_transmit_p1(dev, 0x4E, 0x00);
- _panel_transmit_p1(dev, 0x4F, 0x00);
- _panel_transmit_p1(dev, 0x4C, 0x01);
- k_msleep(10);
- _panel_transmit_p1(dev, 0x4C, 0x00);
- _panel_transmit(dev, 0x2a, data_0x2a, sizeof(data_0x2a));
- _panel_transmit(dev, 0x2b, data_0x2a, sizeof(data_0x2a));
- _panel_transmit_cmd(dev, 0x21);
- /* TE */
- _panel_transmit_p2(dev, DDIC_CMD_STESL, CONFIG_PANEL_TE_SCANLINE >> 8,
- CONFIG_PANEL_TE_SCANLINE & 0xff);
- _panel_transmit_p1(dev, DDIC_CMD_TEON, 0x00);
- _panel_transmit_p1(dev, 0x53, 0x20);
- _panel_transmit_cmd(dev, 0x11); /* Sleep Out */
- k_msleep(120);
- _panel_transmit_p1(dev, 0x3a, 0x55);
- _panel_transmit_cmd(dev, 0x29); /* Display On */
- k_msleep(50);
- //_panel_transmit_cmd(dev, 0x1c);
- //k_msleep(120);
-
- #else
- _panel_transmit_p1(dev, 0xf0, 0x08);
- _panel_transmit_p1(dev, 0xF2, 0x08);
- _panel_transmit_p1(dev, 0x9B, 0x51);
- _panel_transmit_p1(dev, 0x86, 0x53);
- _panel_transmit_p1(dev, 0xF2, 0x08);
- _panel_transmit_p1(dev, 0xF0, 0x00);
- _panel_transmit_p1(dev, 0xF0, 0x01);
- _panel_transmit_p1(dev, 0xF1, 0x01);
- _panel_transmit_p1(dev, 0xB0, 0x54);
- _panel_transmit_p1(dev, 0xB1, 0x3F);
- _panel_transmit_p1(dev, 0xB2, 0x2A);
- _panel_transmit_p1(dev, 0xB4, 0x46);
- _panel_transmit_p1(dev, 0xB5, 0x34);
- _panel_transmit_p1(dev, 0xB6, 0xD5);
- _panel_transmit_p1(dev, 0xB7, 0x30);
- _panel_transmit_p1(dev, 0xB8, 0x04);
- _panel_transmit_p1(dev, 0xBA, 0x00);
- _panel_transmit_p1(dev, 0xBB, 0x08);
- _panel_transmit_p1(dev, 0xBC, 0x08);
- _panel_transmit_p1(dev, 0xBD, 0x00);
- _panel_transmit_p1(dev, 0xC0, 0x80);
- _panel_transmit_p1(dev, 0xC1, 0x10);
- _panel_transmit_p1(dev, 0xC2, 0x37);
- _panel_transmit_p1(dev, 0xC3, 0x80);
- _panel_transmit_p1(dev, 0xC4, 0x10);
- _panel_transmit_p1(dev, 0xC5, 0x37);
- _panel_transmit_p1(dev, 0xC6, 0xA9);
- _panel_transmit_p1(dev, 0xC7, 0x41);
- _panel_transmit_p1(dev, 0xC8, 0x51);
- _panel_transmit_p1(dev, 0xC9, 0xA9);
- _panel_transmit_p1(dev, 0xCA, 0x41);
- _panel_transmit_p1(dev, 0xCB, 0x51);
- _panel_transmit_p1(dev, 0xD0, 0x91);
- _panel_transmit_p1(dev, 0xD1, 0x68);
- _panel_transmit_p1(dev, 0xD2, 0x69);
- const uint8_t data_0xf5[] = {
- 0x00,
- 0xA5,
- };
- _panel_transmit(dev, 0xF5, data_0xf5, sizeof(data_0xf5));
- _panel_transmit_p1(dev, 0xDD, 0x35);
- _panel_transmit_p1(dev, 0xDE, 0x35);
- _panel_transmit_p1(dev, 0xF1, 0x10);
- _panel_transmit_p1(dev, 0xF0, 0x00);
- _panel_transmit_p1(dev, 0xF0, 0x02);
- const uint8_t data_0xe0[] = {
- 0x70, 0x09, 0x12, 0x0C, 0x0B, 0x27, 0x38, 0x54, 0x4E, 0x19, 0x15, 0x15, 0x2C, 0x2F,
- };
- _panel_transmit(dev, 0xE0, data_0xe0, sizeof(data_0xe0));
- const uint8_t data_0xe1[] = {
- 0x70, 0x08, 0x11, 0x0C, 0x0B, 0x27, 0x38, 0x43, 0x4C, 0x18, 0x14, 0x14, 0x2B, 0x2D,
- };
- _panel_transmit(dev, 0xE1, data_0xe1, sizeof(data_0xe1));
- _panel_transmit_p1(dev, 0xF0, 0x10);
- _panel_transmit_p1(dev, 0xF3, 0x10);
- _panel_transmit_p1(dev, 0xE0, 0x0A);
- _panel_transmit_p1(dev, 0xE1, 0x00);
- _panel_transmit_p1(dev, 0xE2, 0x0B);
- _panel_transmit_p1(dev, 0xE3, 0x00);
- _panel_transmit_p1(dev, 0xE4, 0xE0);
- _panel_transmit_p1(dev, 0xE5, 0x06);
- _panel_transmit_p1(dev, 0xE6, 0x21);
- _panel_transmit_p1(dev, 0xE7, 0x00);
- _panel_transmit_p1(dev, 0xE8, 0x05);
- _panel_transmit_p1(dev, 0xE9, 0x82);
- _panel_transmit_p1(dev, 0xEA, 0xDF);
- _panel_transmit_p1(dev, 0xEB, 0x89);
- _panel_transmit_p1(dev, 0xEC, 0x20);
- _panel_transmit_p1(dev, 0xED, 0x14);
- _panel_transmit_p1(dev, 0xEE, 0xFF);
- _panel_transmit_p1(dev, 0xEF, 0x00);
- _panel_transmit_p1(dev, 0xF8, 0xFF);
- _panel_transmit_p1(dev, 0xF9, 0x00);
- _panel_transmit_p1(dev, 0xFA, 0x00);
- _panel_transmit_p1(dev, 0xFB, 0x30);
- _panel_transmit_p1(dev, 0xFC, 0x00);
- _panel_transmit_p1(dev, 0xFD, 0x00);
- _panel_transmit_p1(dev, 0xFE, 0x00);
- _panel_transmit_p1(dev, 0xFF, 0x00);
- _panel_transmit_p1(dev, 0x60, 0x42);
- _panel_transmit_p1(dev, 0x61, 0xE0);
- _panel_transmit_p1(dev, 0x62, 0x40);
- _panel_transmit_p1(dev, 0x63, 0x40);
- _panel_transmit_p1(dev, 0x64, 0x02);
- _panel_transmit_p1(dev, 0x65, 0x00);
- _panel_transmit_p1(dev, 0x66, 0x40);
- _panel_transmit_p1(dev, 0x67, 0x03);
- _panel_transmit_p1(dev, 0x68, 0x00);
- _panel_transmit_p1(dev, 0x69, 0x00);
- _panel_transmit_p1(dev, 0x6A, 0x00);
- _panel_transmit_p1(dev, 0x6B, 0x00);
- _panel_transmit_p1(dev, 0x70, 0x42);
- _panel_transmit_p1(dev, 0x71, 0xE0);
- _panel_transmit_p1(dev, 0x72, 0x40);
- _panel_transmit_p1(dev, 0x73, 0x40);
- _panel_transmit_p1(dev, 0x74, 0x02);
- _panel_transmit_p1(dev, 0x75, 0x00);
- _panel_transmit_p1(dev, 0x76, 0x40);
- _panel_transmit_p1(dev, 0x77, 0x03);
- _panel_transmit_p1(dev, 0x78, 0x00);
- _panel_transmit_p1(dev, 0x79, 0x00);
- _panel_transmit_p1(dev, 0x7A, 0x00);
- _panel_transmit_p1(dev, 0x7B, 0x00);
- _panel_transmit_p1(dev, 0x80, 0x38);
- _panel_transmit_p1(dev, 0x81, 0x00);
- _panel_transmit_p1(dev, 0x82, 0x04);
- _panel_transmit_p1(dev, 0x83, 0x02);
- _panel_transmit_p1(dev, 0x84, 0xDC);
- _panel_transmit_p1(dev, 0x85, 0x00);
- _panel_transmit_p1(dev, 0x86, 0x00);
- _panel_transmit_p1(dev, 0x87, 0x00);
- _panel_transmit_p1(dev, 0x88, 0x38);
- _panel_transmit_p1(dev, 0x89, 0x00);
- _panel_transmit_p1(dev, 0x8A, 0x06);
- _panel_transmit_p1(dev, 0x8B, 0x02);
- _panel_transmit_p1(dev, 0x8C, 0xDE);
- _panel_transmit_p1(dev, 0x8D, 0x00);
- _panel_transmit_p1(dev, 0x8E, 0x00);
- _panel_transmit_p1(dev, 0x8F, 0x00);
- _panel_transmit_p1(dev, 0x90, 0x38);
- _panel_transmit_p1(dev, 0x91, 0x00);
- _panel_transmit_p1(dev, 0x92, 0x08);
- _panel_transmit_p1(dev, 0x93, 0x02);
- _panel_transmit_p1(dev, 0x94, 0xE0);
- _panel_transmit_p1(dev, 0x95, 0x00);
- _panel_transmit_p1(dev, 0x96, 0x00);
- _panel_transmit_p1(dev, 0x97, 0x00);
- _panel_transmit_p1(dev, 0x98, 0x38);
- _panel_transmit_p1(dev, 0x99, 0x00);
- _panel_transmit_p1(dev, 0x9A, 0x0A);
- _panel_transmit_p1(dev, 0x9B, 0x02);
- _panel_transmit_p1(dev, 0x9C, 0xE2);
- _panel_transmit_p1(dev, 0x9D, 0x00);
- _panel_transmit_p1(dev, 0x9E, 0x00);
- _panel_transmit_p1(dev, 0x9F, 0x00);
- _panel_transmit_p1(dev, 0xA0, 0x38);
- _panel_transmit_p1(dev, 0xA1, 0x00);
- _panel_transmit_p1(dev, 0xA2, 0x03);
- _panel_transmit_p1(dev, 0xA3, 0x02);
- _panel_transmit_p1(dev, 0xA4, 0xDB);
- _panel_transmit_p1(dev, 0xA5, 0x00);
- _panel_transmit_p1(dev, 0xA6, 0x00);
- _panel_transmit_p1(dev, 0xA7, 0x00);
- _panel_transmit_p1(dev, 0xA8, 0x38);
- _panel_transmit_p1(dev, 0xA9, 0x00);
- _panel_transmit_p1(dev, 0xAA, 0x05);
- _panel_transmit_p1(dev, 0xAB, 0x02);
- _panel_transmit_p1(dev, 0xAC, 0xDD);
- _panel_transmit_p1(dev, 0xAD, 0x00);
- _panel_transmit_p1(dev, 0xAE, 0x00);
- _panel_transmit_p1(dev, 0xAF, 0x00);
- _panel_transmit_p1(dev, 0xB0, 0x38);
- _panel_transmit_p1(dev, 0xB1, 0x00);
- _panel_transmit_p1(dev, 0xB2, 0x07);
- _panel_transmit_p1(dev, 0xB3, 0x02);
- _panel_transmit_p1(dev, 0xB4, 0xDF);
- _panel_transmit_p1(dev, 0xB5, 0x00);
- _panel_transmit_p1(dev, 0xB6, 0x00);
- _panel_transmit_p1(dev, 0xB7, 0x00);
- _panel_transmit_p1(dev, 0xB8, 0x38);
- _panel_transmit_p1(dev, 0xB9, 0x00);
- _panel_transmit_p1(dev, 0xBA, 0x09);
- _panel_transmit_p1(dev, 0xBB, 0x02);
- _panel_transmit_p1(dev, 0xBC, 0xE1);
- _panel_transmit_p1(dev, 0xBD, 0x00);
- _panel_transmit_p1(dev, 0xBE, 0x00);
- _panel_transmit_p1(dev, 0xBF, 0x00);
- _panel_transmit_p1(dev, 0xC0, 0x22);
- _panel_transmit_p1(dev, 0xC1, 0xAA);
- _panel_transmit_p1(dev, 0xC2, 0x65);
- _panel_transmit_p1(dev, 0xC3, 0x74);
- _panel_transmit_p1(dev, 0xC4, 0x47);
- _panel_transmit_p1(dev, 0xC5, 0x56);
- _panel_transmit_p1(dev, 0xC6, 0x00);
- _panel_transmit_p1(dev, 0xC7, 0x88);
- _panel_transmit_p1(dev, 0xC8, 0x99);
- _panel_transmit_p1(dev, 0xC9, 0x33);
- _panel_transmit_p1(dev, 0xD0, 0x11);
- _panel_transmit_p1(dev, 0xD1, 0xAA);
- _panel_transmit_p1(dev, 0xD2, 0x65);
- _panel_transmit_p1(dev, 0xD3, 0x74);
- _panel_transmit_p1(dev, 0xD4, 0x47);
- _panel_transmit_p1(dev, 0xD5, 0x56);
- _panel_transmit_p1(dev, 0xD6, 0x00);
- _panel_transmit_p1(dev, 0xD7, 0x88);
- _panel_transmit_p1(dev, 0xD8, 0x99);
- _panel_transmit_p1(dev, 0xD9, 0x33);
- _panel_transmit_p1(dev, 0xF3, 0x01);
- _panel_transmit_p1(dev, 0xF0, 0x00);
- _panel_transmit_p1(dev, 0xF0, 0x01);
- _panel_transmit_p1(dev, 0xF1, 0x01);
- _panel_transmit_p1(dev, 0xA0, 0x0B);
- _panel_transmit_p1(dev, 0xA3, 0x2A);
- _panel_transmit_p1(dev, 0xA5, 0xC3);
- k_msleep(1);
- _panel_transmit_p1(dev, 0xA3, 0x2B);
- _panel_transmit_p1(dev, 0xA5, 0xC3);
- k_msleep(1);
- _panel_transmit_p1(dev, 0xA3, 0x2C);
- _panel_transmit_p1(dev, 0xA5, 0xC3);
- k_msleep(1);
- _panel_transmit_p1(dev, 0xA3, 0x2D);
- _panel_transmit_p1(dev, 0xA5, 0xC3);
- k_msleep(1);
- _panel_transmit_p1(dev, 0xA3, 0x2E);
- _panel_transmit_p1(dev, 0xA5, 0xC3);
- k_msleep(1);
- _panel_transmit_p1(dev, 0xA3, 0x2F);
- _panel_transmit_p1(dev, 0xA5, 0xC3);
- k_msleep(1);
- _panel_transmit_p1(dev, 0xA3, 0x30);
- _panel_transmit_p1(dev, 0xA5, 0xC3);
- k_msleep(1);
- _panel_transmit_p1(dev, 0xA3, 0x31);
- _panel_transmit_p1(dev, 0xA5, 0xC3);
- k_msleep(1);
- _panel_transmit_p1(dev, 0xA3, 0x32);
- _panel_transmit_p1(dev, 0xA5, 0xC3);
- k_msleep(1);
- _panel_transmit_p1(dev, 0xA3, 0x33);
- _panel_transmit_p1(dev, 0xA5, 0xC3);
- k_msleep(1);
- _panel_transmit_p1(dev, 0xA0, 0x09);
- _panel_transmit_p1(dev, 0xF1, 0x10);
- _panel_transmit_p1(dev, 0xF0, 0x00);
- const uint8_t data_0x2a[] = {
- 0x00,
- 0x00,
- 0x01,
- 0x67,
- };
- _panel_transmit(dev, 0x2a, data_0x2a, sizeof(data_0x2a));
- const uint8_t data_0x2b[] = {
- 0x01,
- 0x68,
- 0x01,
- 0x68,
- };
- _panel_transmit(dev, 0x2b, data_0x2b, sizeof(data_0x2b));
- _panel_transmit_p1(dev, 0x4D, 0x00);
- _panel_transmit_p1(dev, 0x4E, 0x00);
- _panel_transmit_p1(dev, 0x4F, 0x00);
- _panel_transmit_p1(dev, 0x4C, 0x01);
- k_msleep(10);
- _panel_transmit_p1(dev, 0x4C, 0x00);
- _panel_transmit(dev, 0x2a, data_0x2a, sizeof(data_0x2a));
- _panel_transmit(dev, 0x2b, data_0x2a, sizeof(data_0x2a));
- _panel_transmit_cmd(dev, 0x21);
- /* TE */
- _panel_transmit_p2(dev, DDIC_CMD_STESL,
- CONFIG_PANEL_TE_SCANLINE >> 8, CONFIG_PANEL_TE_SCANLINE & 0xff);
- _panel_transmit_p1(dev, DDIC_CMD_TEON, 0x00);
- _panel_transmit_p1(dev, 0x53, 0x20);
- _panel_transmit_cmd(dev, 0x11); /* Sleep Out */
- k_msleep(120);
- _panel_transmit_cmd(dev, 0x29); /* Display On */
- k_msleep(120);
-
- _panel_transmit_cmd(dev, 0x1c);
- k_msleep(120);
- #endif
- // _panel_init_te(dev);
- printk("st77916 panel_init exit\r\n ");
- return 0;
- }
- static const struct lcd_panel_ops lcd_panel_ops = {
- .init = _panel_init,
- .blanking_on = _panel_blanking_on,
- .blanking_off = _panel_blanking_off,
- .lowpower_enter = _panel_lowpower_enter,
- .lowpower_exit = _panel_lowpower_exit,
- .set_brightness = _panel_set_brightness,
- .write_prepare = _panel_set_mem_area,
- };
- const struct lcd_panel_config lcd_panel_st77916_config = {
- .videoport = PANEL_VIDEO_PORT_INITIALIZER,
- .videomode = PANEL_VIDEO_MODE_INITIALIZER,
- .ops = &lcd_panel_ops,
- .cmd_ramwr = (0x32 << 24 | DDIC_CMD_RAMWR << 8),
- .cmd_ramwc = (0x32 << 24 | DDIC_CMD_RAMWRC << 8),
- .tw_reset = 10,
- .ts_reset = 120,
- };
|