Support Boe Himax8279d 8.0" 1200x1920 TFT LCD panel, it is a MIPI DSI panel. V2: - Use SPDX identifier (Sam) - Use necessary header files replace drmP.h (Sam) - Delete unnecessary header files #include <linux/err.h> (Sam) - Specifies a GPIOs array to control the reset timing, instead of reading "dsi-reset-sequence" data from DTS (Sam) - Delete backlight_disable() function when already disabled (Sam) - Use devm_of_find_backlight() replace of_find_backlight_by_node() (Sam) - Move the necessary data in the DTS to the current file, like porch, display_mode and Init code etc. (Sam) - Add compatible device "boe,himax8279d10p" (Sam) V1: - Support Boe Himax8279d 8.0" 1200x1920 TFT LCD panel, it is a MIPI DSI panel. Signed-off-by: Jerry Han <hanxu5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> Cc: Jitao Shi <jitao.shi@xxxxxxxxxxxx> Cc: Nick Sanders <nsanders@xxxxxxxxxx> Cc: YH Lin <yueherngl@xxxxxxxxxxxx> Cc: Rock wang <rock_wang@xxxxxxxxxxxx> --- drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-boe-himax8279d.c | 1201 ++++++++++++------ 2 files changed, 842 insertions(+), 360 deletions(-) diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index a771c92f880a..4beae2ab427f 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_DRM_PANEL_ARM_VERSATILE) += panel-arm-versatile.o +obj-$(CONFIG_DRM_PANEL_BOE_HIMAX8279D) += panel-boe-himax8279d.o obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o obj-$(CONFIG_DRM_PANEL_FEIYANG_FY07024DI26A30D) += panel-feiyang-fy07024di26a30d.o diff --git a/drivers/gpu/drm/panel/panel-boe-himax8279d.c b/drivers/gpu/drm/panel/panel-boe-himax8279d.c index 2788bdda69ec..836a9cbc5891 100644 --- a/drivers/gpu/drm/panel/panel-boe-himax8279d.c +++ b/drivers/gpu/drm/panel/panel-boe-himax8279d.c @@ -1,319 +1,76 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Copyright (c) 2019, Huaqin Electronics Co., Ltd + * Copyright (c) 2019, Huaqin Telecom Technology Co., Ltd + * + * Author: Jerry Han <hanxu5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #include <linux/backlight.h> -#include <linux/gpio/consumer.h> +#include <linux/delay.h> +#include <linux/fb.h> +#include <linux/kernel.h> #include <linux/module.h> #include <linux/of.h> #include <linux/of_device.h> + +#include <linux/gpio/consumer.h> #include <linux/regulator/consumer.h> -#include <drm/drmP.h> -#include <drm/drm_crtc.h> +#include <drm/drm_modes.h> #include <drm/drm_mipi_dsi.h> #include <drm/drm_panel.h> +#include <drm/drm_device.h> +#include <drm/drm_print.h> #include <video/mipi_display.h> -#include <linux/err.h> -struct dsi_cmd_desc { - char wait; - char cmd; - char len; - char *payload; +struct panel_cmd { + size_t len; + const char *data; }; -struct dsi_panel_cmds { - char *buf; - int blen; - struct dsi_cmd_desc *cmds; - int cmd_cnt; +#define _INIT_CMD(...) { \ + .len = sizeof((char[]){__VA_ARGS__}), \ + .data = (char[]){__VA_ARGS__} } + +struct panel_desc { + const struct drm_display_mode *display_mode; + unsigned int bpc; + unsigned int width; + unsigned int height; + + unsigned int delay_t1; + unsigned int reset_delay_t2; + unsigned int reset_delay_t3; + unsigned int reset_delay_t4; + + unsigned long flags; + enum mipi_dsi_pixel_format format; + unsigned int lanes; + const struct panel_cmd *on_cmds; + const struct panel_cmd *off_cmds; }; struct panel_info { struct drm_panel base; struct mipi_dsi_device *link; + const struct panel_desc *desc; struct backlight_device *backlight; struct gpio_desc *reset_gpio; - struct gpio_desc *pp33000_gpio; - struct gpio_desc *pp18000_gpio; - - u32 rst_seq[10]; - u32 rst_seq_len; - - struct dsi_panel_cmds *on_cmds; - struct dsi_panel_cmds *off_cmds; - struct drm_display_mode *panel_display_mode; - - unsigned int panel_width_mm; - unsigned int panel_height_mm; - unsigned int per_color_channel; + struct gpio_desc *pp33_gpio; + struct gpio_desc *pp18_gpio; bool prepared; bool enabled; }; -static int dsi_parse_reset_seq(struct device_node *np, u32 rst_seq[10], - u32 *rst_len, const char *name) -{ - int num = 0, i; - int rc; - struct property *data; - u32 tmp[10]; - *rst_len = 0; - data = of_find_property(np, name, &num); - - num /= sizeof(u32); - if (!data || !num || num > 10 || num % 2) { - pr_err("%s:%d, error reading %s, length found = %d\n", - __func__, __LINE__, name, num); - return -EINVAL; - } - - rc = of_property_read_u32_array(np, name, tmp, num); - if (rc) { - pr_err("%s:%d, error reading %s, rc = %d\n", - __func__, __LINE__, name, rc); - return -EINVAL; - } - - for (i = 0; i < num; ++i) { - rst_seq[i] = tmp[i]; - *rst_len = num; - } - return 0; -} - -ssize_t mipi_dsi_dcs_write_delay(struct mipi_dsi_device *dsi, u8 cmd, - const void *data, size_t len, size_t time) +void set_gpios(struct panel_info *pinfo, int enable) { - ssize_t ret; - - if (len == 0) - ret = mipi_dsi_dcs_write(dsi, cmd, NULL, 0); - else - ret = mipi_dsi_dcs_write(dsi, cmd, data, len); - - msleep(time); - - return ret; -} - -static int write_cmds(struct mipi_dsi_device *dsi_device, - struct dsi_panel_cmds *init_cmds) -{ - struct dsi_cmd_desc *one_cmd = init_cmds->cmds; - int i = 0; - int ret; - - for (i = 0; i < init_cmds->cmd_cnt; i++) { - if (one_cmd == NULL) - return -EINVAL; - - ret = mipi_dsi_dcs_write_delay(dsi_device, - one_cmd->cmd, one_cmd->payload, - one_cmd->len, one_cmd->wait); - one_cmd++; - } - - return ret; -} - -static int parse_dcs_cmds(struct device_node *np, - struct dsi_panel_cmds *pcmds, char *cmd_key) -{ - const char *data; - int blen = 0, len, cnt = 0; - char *buf, *bp; - struct dsi_cmd_desc *temp_cmd; - - data = of_get_property(np, cmd_key, &blen); - if (!data) { - pr_err("%s: failed, key=%s\n", __func__, cmd_key); - return -ENOMEM; - } - - buf = kzalloc(sizeof(char) * blen, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - memcpy(buf, data, blen); - - /* scan dcs commands */ - bp = buf; - len = blen; - - /* get how much cmd cnt */ - while (len > 0) { - cnt++; - len = len - *(bp); - bp = bp + *(bp); - } - - pcmds->cmd_cnt = cnt; - - pcmds->cmds = kcalloc(cnt, sizeof(struct dsi_cmd_desc), GFP_KERNEL); - if (!pcmds->cmds) - return -ENOMEM; - temp_cmd = pcmds->cmds; - - bp = buf; - len = blen; - - while (cnt != 0) { - temp_cmd->wait = *(bp+1); - temp_cmd->cmd = *(bp+2); - temp_cmd->len = *(bp) - 3; - temp_cmd->payload = bp + 3; - - cnt--; - temp_cmd++; - bp = bp + *(bp); - } - - pcmds->buf = buf; - pcmds->blen = blen; - - return 0; -} - -static int panel_parse_dt(struct panel_info *pinfo) -{ - struct device_node *panels_node; - struct device_node *parameter_node; - static const char *lcd_name; - static const char *panel_parameter; - struct drm_display_mode *display_mode; - struct mipi_dsi_device *dsi_device = pinfo->link; - int ret = 0; - u32 tmp; - - panels_node = of_find_node_by_name(NULL, "panels"); - if (!panels_node) { - pr_err("Get panels node Fail!\n"); - return -EINVAL; - } - - panel_parameter = of_get_property(panels_node, "panel-parameter", NULL); - if (!panel_parameter) { - pr_err("Get panel parameter Fail!\n"); - return -EINVAL; - } - - parameter_node = of_find_node_by_name(panels_node, panel_parameter); - if (!parameter_node) - return -ENODEV; - - /* get lcd name */ - lcd_name = of_get_property(parameter_node, "dsi-panel-name", NULL); - if (!lcd_name) { - pr_err("Get lcd_name Fail!\n"); - return -EINVAL; - } - pr_info("%s: Lcd Name = %s\n", __func__, lcd_name); - - /* get lcd init code */ - pinfo->on_cmds = kzalloc(sizeof(struct dsi_panel_cmds), GFP_KERNEL); - if (!(pinfo->on_cmds)) - return -ENOMEM; - - ret = parse_dcs_cmds(parameter_node, pinfo->on_cmds, "dsi-on-command"); - if (ret < 0) { - pr_err("Get Dsi on command Fail\n"); - return -EINVAL; - } - - /* get lcd off code */ - pinfo->off_cmds = kzalloc(sizeof(struct dsi_panel_cmds), GFP_KERNEL); - if (!(pinfo->off_cmds)) - return -ENOMEM; - - ret = parse_dcs_cmds(parameter_node, pinfo->off_cmds, - "dsi-off-command"); - if (ret < 0) { - pr_err("Get Dsi off command Fail\n"); - return -EINVAL; - } - - /* get Porch */ - display_mode = kzalloc(sizeof(struct drm_display_mode), GFP_KERNEL); - if (!display_mode) - return -ENOMEM; - pinfo->panel_display_mode = display_mode; - - ret = of_property_read_u32(parameter_node, "dsi-pixel-clk", &tmp); - display_mode->clock = (!ret ? tmp : 0); - - ret = of_property_read_u32(parameter_node, - "dsi-panel-hzorizontal", &tmp); - display_mode->hdisplay = (!ret ? tmp : 0); - - ret = of_property_read_u32(parameter_node, "dsi-h-front-porch", &tmp); - tmp = (!ret ? tmp : 0); - display_mode->hsync_start = display_mode->hdisplay + tmp; - - ret = of_property_read_u32(parameter_node, "dsi-h-back-porch", &tmp); - tmp = (!ret ? tmp : 0); - display_mode->hsync_end = display_mode->hsync_start + tmp; - - ret = of_property_read_u32(parameter_node, "dsi-h-pulse-width", &tmp); - tmp = (!ret ? tmp : 0); - display_mode->htotal = display_mode->hsync_end + tmp; - - ret = of_property_read_u32(parameter_node, "dsi-panel-vertical", &tmp); - display_mode->vdisplay = (!ret ? tmp : 0); - - ret = of_property_read_u32(parameter_node, "dsi-v-front-porch", &tmp); - tmp = (!ret ? tmp : 0); - display_mode->vsync_start = display_mode->vdisplay + tmp; - - ret = of_property_read_u32(parameter_node, "dsi-v-back-porch", &tmp); - tmp = (!ret ? tmp : 0); - display_mode->vsync_end = display_mode->vsync_start + tmp; - - ret = of_property_read_u32(parameter_node, "dsi-v-pulse-width", &tmp); - tmp = (!ret ? tmp : 0); - display_mode->vtotal = display_mode->vsync_end + tmp; - - ret = of_property_read_u32(parameter_node, "dsi-panel-refresh", &tmp); - display_mode->vrefresh = (!ret ? tmp : 0); - - /* get lans */ - ret = of_property_read_u32(parameter_node, "dsi-panel-lanes", &tmp); - dsi_device->lanes = (!ret ? tmp : 0); - - ret = of_property_read_u32(parameter_node, "dsi-panel-format", &tmp); - dsi_device->format = (!ret ? tmp : 0); - - ret = of_property_read_u32(parameter_node, - "dsi-panel-mode-flags", &tmp); - dsi_device->mode_flags = (!ret ? tmp : 0); - - /* get WxH */ - ret = of_property_read_u32(parameter_node, "dsi-panel-width-mm", &tmp); - pinfo->panel_width_mm = (!ret ? tmp : 0); - - ret = of_property_read_u32(parameter_node, "dsi-panel-height-mm", &tmp); - pinfo->panel_height_mm = (!ret ? tmp : 0); - - ret = of_property_read_u32(parameter_node, "per-color-channel", &tmp); - pinfo->per_color_channel = (!ret ? tmp : 0); - - /* reset time */ - ret = dsi_parse_reset_seq(parameter_node, pinfo->rst_seq, - &(pinfo->rst_seq_len), "dsi-reset-sequence"); - if (ret < 0) - return ret; - - return 0; + gpiod_set_value(pinfo->reset_gpio, enable); + gpiod_set_value(pinfo->pp33_gpio, enable); + gpiod_set_value(pinfo->pp18_gpio, enable); } static inline struct panel_info *to_panel_info(struct drm_panel *panel) @@ -325,9 +82,6 @@ static int panel_disable(struct drm_panel *panel) { struct panel_info *pinfo = to_panel_info(panel); - if (!pinfo->enabled) - return 0; - backlight_disable(pinfo->backlight); pinfo->enabled = false; @@ -343,48 +97,99 @@ static int panel_unprepare(struct drm_panel *panel) if (!pinfo->prepared) return 0; - err = write_cmds(pinfo->link, pinfo->off_cmds); - if (err < 0) { - dev_err(panel->dev, - "failed to send DCS Off Code: %d\n", err); - return err; + /* send off code */ + if (pinfo->desc->off_cmds) { + const struct panel_cmd *cmds = pinfo->desc->off_cmds; + unsigned int i; + + for (i = 0; cmds[i].len != 0; i++) { + const struct panel_cmd *cmd = &cmds[i]; + + if (cmd->len == 2) + err = mipi_dsi_dcs_write(pinfo->link, + cmd->data[1], NULL, 0); + else + err = mipi_dsi_dcs_write(pinfo->link, + cmd->data[1], cmd->data + 2, + cmd->len - 2); + + if (err < 0) { + dev_err(panel->dev, + "failed to send DCS Off Code: %d\n", + err); + goto poweroff; + } + usleep_range((cmd->data[0]) * 1000, + (1 + cmd->data[0]) * 1000); + } } usleep_range(1000, 1000); - gpiod_set_value_cansleep(pinfo->reset_gpio, 0); - gpiod_set_value_cansleep(pinfo->pp33000_gpio, 0); - gpiod_set_value_cansleep(pinfo->pp18000_gpio, 0); + set_gpios(pinfo, 0); pinfo->prepared = false; return 0; + +poweroff: + set_gpios(pinfo, 0); + return err; } static int panel_prepare(struct drm_panel *panel) { struct panel_info *pinfo = to_panel_info(panel); - int err, i; + const struct panel_desc *desc = pinfo->desc; + int err; if (pinfo->prepared) return 0; - gpiod_set_value_cansleep(pinfo->pp18000_gpio, 1); - gpiod_set_value_cansleep(pinfo->pp33000_gpio, 1); + gpiod_set_value(pinfo->pp18_gpio, 1); + /* T1 (> 5ms) */ + usleep_range(desc->delay_t1, 1000 + desc->delay_t1); + gpiod_set_value(pinfo->pp33_gpio, 1); /* reset sequence */ - for (i = 0; i < pinfo->rst_seq_len; ++i) { - gpiod_set_value_cansleep(pinfo->reset_gpio, pinfo->rst_seq[i]); - if (pinfo->rst_seq[++i]) - usleep_range(pinfo->rst_seq[i] * 1000, - pinfo->rst_seq[i] * 1000); + // T2 (> 14ms) + usleep_range(desc->reset_delay_t2, 1000 + desc->reset_delay_t2); + + // T3 (>= 0ms) + if (desc->reset_delay_t3) { + gpiod_set_value(pinfo->reset_gpio, 1); + usleep_range(desc->reset_delay_t3, 1000 + desc->reset_delay_t3); + gpiod_set_value(pinfo->reset_gpio, 0); } + // T4 (> 20us) + usleep_range(desc->reset_delay_t4, 1000 + desc->reset_delay_t4); + gpiod_set_value(pinfo->reset_gpio, 1); + /* send init code */ - err = write_cmds(pinfo->link, pinfo->on_cmds); - if (err < 0) { - dev_err(panel->dev, - "failed to send DCS Init Code: %d\n", err); - goto poweroff; + if (pinfo->desc->on_cmds) { + const struct panel_cmd *cmds = pinfo->desc->on_cmds; + unsigned int i; + + for (i = 0; cmds[i].len != 0; i++) { + const struct panel_cmd *cmd = &cmds[i]; + + if (cmd->len == 2) + err = mipi_dsi_dcs_write(pinfo->link, + cmd->data[1], NULL, 0); + else + err = mipi_dsi_dcs_write(pinfo->link, + cmd->data[1], cmd->data + 2, + cmd->len - 2); + + if (err < 0) { + dev_err(panel->dev, + "failed to send DCS Init Code: %d\n", + err); + goto poweroff; + } + usleep_range(cmd->data[0] * 1000, + (1 + cmd->data[0]) * 1000); + } } pinfo->prepared = true; @@ -392,9 +197,7 @@ static int panel_prepare(struct drm_panel *panel) return 0; poweroff: - gpiod_set_value_cansleep(pinfo->reset_gpio, 0); - gpiod_set_value_cansleep(pinfo->pp33000_gpio, 0); - gpiod_set_value_cansleep(pinfo->pp18000_gpio, 0); + set_gpios(pinfo, 0); return err; } @@ -409,7 +212,7 @@ static int panel_enable(struct drm_panel *panel) ret = backlight_enable(pinfo->backlight); if (ret) { DRM_DEV_ERROR(panel->drm->dev, - "Failed to enable backlight %d\n", ret); + "Failed to enable backlight %d\n", ret); return ret; } @@ -421,16 +224,13 @@ static int panel_enable(struct drm_panel *panel) static int panel_get_modes(struct drm_panel *panel) { struct panel_info *pinfo = to_panel_info(panel); + const struct drm_display_mode *m = pinfo->desc->display_mode; struct drm_display_mode *mode; - if (!pinfo->panel_display_mode) { - pr_err("Get panel_display_mode fail!\n"); - return -1; - } - - mode = drm_mode_duplicate(panel->drm, pinfo->panel_display_mode); + mode = drm_mode_duplicate(panel->drm, m); if (!mode) { - pr_err("failed to add mode\n"); + DRM_DEV_ERROR(panel->drm->dev, "failed to add mode %ux%ux@%u\n", + m->hdisplay, m->vdisplay, m->vrefresh); return -ENOMEM; } @@ -438,9 +238,9 @@ static int panel_get_modes(struct drm_panel *panel) drm_mode_probed_add(panel->connector, mode); - panel->connector->display_info.width_mm = pinfo->panel_width_mm; - panel->connector->display_info.height_mm = pinfo->panel_height_mm; - panel->connector->display_info.bpc = pinfo->per_color_channel; + panel->connector->display_info.width_mm = pinfo->desc->width; + panel->connector->display_info.height_mm = pinfo->desc->height; + panel->connector->display_info.bpc = pinfo->desc->bpc; return 1; } @@ -453,8 +253,700 @@ static const struct drm_panel_funcs panel_funcs = { .get_modes = panel_get_modes, }; +/* 8 inch */ +static const struct drm_display_mode boe_himax8279d8p_display_mode = { + .clock = 159420, + .hdisplay = 1200, + .hsync_start = 1200 + 80, + .hsync_end = 1200 + 80 + 60, + .htotal = 1200 + 80 + 60 + 24, + .vdisplay = 1920, + .vsync_start = 1920 + 10, + .vsync_end = 1920 + 10 + 14, + .vtotal = 1920 + 10 + 14 + 4, + .vrefresh = 60, +}; + +static const struct panel_cmd boe_himax8279d8p_on_cmds[] = { + _INIT_CMD(0x22, 0x10), + _INIT_CMD(0x00, 0xB0, 0x05), + _INIT_CMD(0x00, 0xB1, 0xE5), + _INIT_CMD(0x00, 0xB3, 0x52), + _INIT_CMD(0x00, 0xB0, 0x00), + _INIT_CMD(0x00, 0xB3, 0x88), + _INIT_CMD(0x00, 0xB0, 0x04), + _INIT_CMD(0x00, 0xB8, 0x00), + _INIT_CMD(0x00, 0xB0, 0x00), + _INIT_CMD(0x00, 0xB2, 0x50), + _INIT_CMD(0x00, 0xB6, 0x03), + _INIT_CMD(0x00, 0xBA, 0x8B), + _INIT_CMD(0x00, 0xBF, 0x15), + _INIT_CMD(0x00, 0xC0, 0x0F), + _INIT_CMD(0x00, 0xC2, 0x0C), + _INIT_CMD(0x00, 0xC3, 0x02), + _INIT_CMD(0x00, 0xC4, 0x0C), + _INIT_CMD(0x00, 0xC5, 0x02), + _INIT_CMD(0x00, 0xB0, 0x01), + _INIT_CMD(0x00, 0xE0, 0x26), + _INIT_CMD(0x00, 0xE1, 0x26), + _INIT_CMD(0x00, 0xDC, 0x00), + _INIT_CMD(0x00, 0xDD, 0x00), + _INIT_CMD(0x00, 0xCC, 0x26), + _INIT_CMD(0x00, 0xCD, 0x26), + _INIT_CMD(0x00, 0xC8, 0x00), + _INIT_CMD(0x00, 0xC9, 0x00), + _INIT_CMD(0x00, 0xD2, 0x04), + _INIT_CMD(0x00, 0xD3, 0x04), + _INIT_CMD(0x00, 0xE6, 0x03), + _INIT_CMD(0x00, 0xE7, 0x03), + _INIT_CMD(0x00, 0xC4, 0x08), + _INIT_CMD(0x00, 0xC5, 0x08), + _INIT_CMD(0x00, 0xD8, 0x07), + _INIT_CMD(0x00, 0xD9, 0x07), + _INIT_CMD(0x00, 0xC2, 0x06), + _INIT_CMD(0x00, 0xC3, 0x06), + _INIT_CMD(0x00, 0xD6, 0x05), + _INIT_CMD(0x00, 0xD7, 0x05), + _INIT_CMD(0x00, 0xC0, 0x0C), + _INIT_CMD(0x00, 0xC1, 0x0C), + _INIT_CMD(0x00, 0xD4, 0x0B), + _INIT_CMD(0x00, 0xD5, 0x0B), + _INIT_CMD(0x00, 0xCA, 0x0A), + _INIT_CMD(0x00, 0xCB, 0x0A), + _INIT_CMD(0x00, 0xDE, 0x09), + _INIT_CMD(0x00, 0xDF, 0x09), + _INIT_CMD(0x00, 0xC6, 0x26), + _INIT_CMD(0x00, 0xC7, 0x26), + _INIT_CMD(0x00, 0xCE, 0x00), + _INIT_CMD(0x00, 0xCF, 0x00), + _INIT_CMD(0x00, 0xDA, 0x26), + _INIT_CMD(0x00, 0xDB, 0x26), + _INIT_CMD(0x00, 0xE2, 0x00), + _INIT_CMD(0x00, 0xE3, 0x00), + _INIT_CMD(0x00, 0xB0, 0x02), + _INIT_CMD(0x00, 0xC0, 0x00), + _INIT_CMD(0x00, 0xC1, 0x07), + _INIT_CMD(0x00, 0xC2, 0x0D), + _INIT_CMD(0x00, 0xC3, 0x18), + _INIT_CMD(0x00, 0xC4, 0x27), + _INIT_CMD(0x00, 0xC5, 0x28), + _INIT_CMD(0x00, 0xC6, 0x30), + _INIT_CMD(0x00, 0xC7, 0x2E), + _INIT_CMD(0x00, 0xC8, 0x2F), + _INIT_CMD(0x00, 0xC9, 0x1A), + _INIT_CMD(0x00, 0xCA, 0x20), + _INIT_CMD(0x00, 0xCB, 0x29), + _INIT_CMD(0x00, 0xCC, 0x26), + _INIT_CMD(0x00, 0xCD, 0x32), + _INIT_CMD(0x00, 0xCE, 0x33), + _INIT_CMD(0x00, 0xCF, 0x31), + _INIT_CMD(0x00, 0xD0, 0x06), + _INIT_CMD(0x00, 0xD2, 0x00), + _INIT_CMD(0x00, 0xD3, 0x07), + _INIT_CMD(0x00, 0xD4, 0x12), + _INIT_CMD(0x00, 0xD5, 0x26), + _INIT_CMD(0x00, 0xD6, 0x3D), + _INIT_CMD(0x00, 0xD7, 0x3F), + _INIT_CMD(0x00, 0xD8, 0x3F), + _INIT_CMD(0x00, 0xD9, 0x3F), + _INIT_CMD(0x00, 0xDA, 0x3F), + _INIT_CMD(0x00, 0xDB, 0x3F), + _INIT_CMD(0x00, 0xDC, 0x3F), + _INIT_CMD(0x00, 0xDD, 0x3F), + _INIT_CMD(0x00, 0xDE, 0x3F), + _INIT_CMD(0x00, 0xDF, 0x3A), + _INIT_CMD(0x00, 0xE0, 0x37), + _INIT_CMD(0x00, 0xE1, 0x35), + _INIT_CMD(0x00, 0xE2, 0x07), + _INIT_CMD(0x00, 0xB0, 0x03), + _INIT_CMD(0x00, 0xC8, 0x0B), + _INIT_CMD(0x00, 0xC9, 0x07), + _INIT_CMD(0x00, 0xC3, 0x00), + _INIT_CMD(0x00, 0xE7, 0x00), + _INIT_CMD(0x00, 0xC5, 0x2A), + _INIT_CMD(0x00, 0xDE, 0x2A), + _INIT_CMD(0x00, 0xCA, 0x43), + _INIT_CMD(0x00, 0xC9, 0x07), + _INIT_CMD(0x00, 0xE4, 0xC0), + _INIT_CMD(0x00, 0xE5, 0x0D), + _INIT_CMD(0x00, 0xCB, 0x00), + _INIT_CMD(0x00, 0xB0, 0x06), + _INIT_CMD(0x00, 0xB8, 0xA5), + _INIT_CMD(0x00, 0xC0, 0xA5), + _INIT_CMD(0x00, 0xC7, 0x0F), + _INIT_CMD(0x00, 0xD5, 0x32), + _INIT_CMD(0x00, 0xB8, 0x00), + _INIT_CMD(0x00, 0xC0, 0x00), + _INIT_CMD(0x00, 0xBC, 0x00), + _INIT_CMD(0x00, 0xB0, 0x07), + _INIT_CMD(0x00, 0xB1, 0x00), + _INIT_CMD(0x00, 0xB2, 0x09), + _INIT_CMD(0x00, 0xB3, 0x19), + _INIT_CMD(0x00, 0xB4, 0x2F), + _INIT_CMD(0x00, 0xB5, 0x44), + _INIT_CMD(0x00, 0xB6, 0x52), + _INIT_CMD(0x00, 0xB7, 0x6A), + _INIT_CMD(0x00, 0xB8, 0x8A), + _INIT_CMD(0x00, 0xB9, 0xCA), + _INIT_CMD(0x00, 0xBA, 0x0C), + _INIT_CMD(0x05, 0xBB, 0x87), + _INIT_CMD(0x00, 0xBC, 0x06), + _INIT_CMD(0x00, 0xBD, 0x0A), + _INIT_CMD(0x00, 0xBE, 0x9B), + _INIT_CMD(0x00, 0xBF, 0x0C), + _INIT_CMD(0x00, 0xC0, 0x3D), + _INIT_CMD(0x00, 0xC1, 0x71), + _INIT_CMD(0x00, 0xC2, 0x90), + _INIT_CMD(0x00, 0xC3, 0xA0), + _INIT_CMD(0x00, 0xC4, 0xA8), + _INIT_CMD(0x00, 0xC5, 0xB1), + _INIT_CMD(0x00, 0xC6, 0xBB), + _INIT_CMD(0x00, 0xC7, 0xC0), + _INIT_CMD(0x00, 0xC8, 0xC4), + _INIT_CMD(0x00, 0xC9, 0x00), + _INIT_CMD(0x00, 0xCA, 0x00), + _INIT_CMD(0x00, 0xCB, 0x16), + _INIT_CMD(0x00, 0xCC, 0xAF), + _INIT_CMD(0x00, 0xCD, 0xFF), + _INIT_CMD(0x00, 0xCE, 0xFF), + _INIT_CMD(0x00, 0xB0, 0x08), + _INIT_CMD(0x00, 0xB1, 0x04), + _INIT_CMD(0x00, 0xB2, 0x08), + _INIT_CMD(0x00, 0xB3, 0x19), + _INIT_CMD(0x00, 0xB4, 0x31), + _INIT_CMD(0x00, 0xB5, 0x46), + _INIT_CMD(0x00, 0xB6, 0x55), + _INIT_CMD(0x00, 0xB7, 0x6E), + _INIT_CMD(0x00, 0xB8, 0x92), + _INIT_CMD(0x00, 0xB9, 0xD4), + _INIT_CMD(0x00, 0xBA, 0x1B), + _INIT_CMD(0x05, 0xBB, 0x9B), + _INIT_CMD(0x00, 0xBC, 0x28), + _INIT_CMD(0x00, 0xBD, 0x2D), + _INIT_CMD(0x00, 0xBE, 0xC3), + _INIT_CMD(0x00, 0xBF, 0x2F), + _INIT_CMD(0x00, 0xC0, 0x62), + _INIT_CMD(0x00, 0xC1, 0x99), + _INIT_CMD(0x00, 0xC2, 0xAB), + _INIT_CMD(0x00, 0xC3, 0xBF), + _INIT_CMD(0x00, 0xC4, 0xCF), + _INIT_CMD(0x00, 0xC5, 0xDF), + _INIT_CMD(0x00, 0xC6, 0xF0), + _INIT_CMD(0x00, 0xC7, 0xF9), + _INIT_CMD(0x00, 0xC8, 0xFC), + _INIT_CMD(0x00, 0xC9, 0x00), + _INIT_CMD(0x00, 0xCA, 0x00), + _INIT_CMD(0x00, 0xCB, 0x16), + _INIT_CMD(0x00, 0xCC, 0xAF), + _INIT_CMD(0x00, 0xCD, 0xFF), + _INIT_CMD(0x00, 0xCE, 0xFF), + _INIT_CMD(0x00, 0xB0, 0x09), + _INIT_CMD(0x00, 0xB1, 0x04), + _INIT_CMD(0x00, 0xB2, 0x05), + _INIT_CMD(0x00, 0xB3, 0x17), + _INIT_CMD(0x00, 0xB4, 0x2E), + _INIT_CMD(0x00, 0xB5, 0x42), + _INIT_CMD(0x00, 0xB6, 0x51), + _INIT_CMD(0x00, 0xB7, 0x69), + _INIT_CMD(0x00, 0xB8, 0x88), + _INIT_CMD(0x00, 0xB9, 0xC9), + _INIT_CMD(0x00, 0xBA, 0x0C), + _INIT_CMD(0x05, 0xBB, 0x86), + _INIT_CMD(0x00, 0xBC, 0x03), + _INIT_CMD(0x00, 0xBD, 0x08), + _INIT_CMD(0x00, 0xBE, 0x95), + _INIT_CMD(0x00, 0xBF, 0x05), + _INIT_CMD(0x00, 0xC0, 0x35), + _INIT_CMD(0x00, 0xC1, 0x62), + _INIT_CMD(0x00, 0xC2, 0x81), + _INIT_CMD(0x00, 0xC3, 0x96), + _INIT_CMD(0x00, 0xC4, 0x9E), + _INIT_CMD(0x00, 0xC5, 0xA5), + _INIT_CMD(0x00, 0xC6, 0xAD), + _INIT_CMD(0x00, 0xC7, 0xB1), + _INIT_CMD(0x00, 0xC8, 0xB4), + _INIT_CMD(0x00, 0xC9, 0x00), + _INIT_CMD(0x00, 0xCA, 0x00), + _INIT_CMD(0x00, 0xCB, 0x16), + _INIT_CMD(0x00, 0xCC, 0xAF), + _INIT_CMD(0x00, 0xCD, 0xFF), + _INIT_CMD(0x00, 0xCE, 0xFF), + _INIT_CMD(0x00, 0xB0, 0x0A), + _INIT_CMD(0x00, 0xB1, 0x00), + _INIT_CMD(0x00, 0xB2, 0x09), + _INIT_CMD(0x00, 0xB3, 0x19), + _INIT_CMD(0x00, 0xB4, 0x2F), + _INIT_CMD(0x00, 0xB5, 0x44), + _INIT_CMD(0x00, 0xB6, 0x52), + _INIT_CMD(0x00, 0xB7, 0x6A), + _INIT_CMD(0x00, 0xB8, 0x8A), + _INIT_CMD(0x00, 0xB9, 0xCA), + _INIT_CMD(0x00, 0xBA, 0x0C), + _INIT_CMD(0x05, 0xBB, 0x87), + _INIT_CMD(0x00, 0xBC, 0x06), + _INIT_CMD(0x00, 0xBD, 0x0A), + _INIT_CMD(0x00, 0xBE, 0x9B), + _INIT_CMD(0x00, 0xBF, 0x0C), + _INIT_CMD(0x00, 0xC0, 0x3D), + _INIT_CMD(0x00, 0xC1, 0x71), + _INIT_CMD(0x00, 0xC2, 0x90), + _INIT_CMD(0x00, 0xC3, 0xA0), + _INIT_CMD(0x00, 0xC4, 0xA8), + _INIT_CMD(0x00, 0xC5, 0xB1), + _INIT_CMD(0x00, 0xC6, 0xBB), + _INIT_CMD(0x00, 0xC7, 0xC0), + _INIT_CMD(0x00, 0xC8, 0xC4), + _INIT_CMD(0x00, 0xC9, 0x00), + _INIT_CMD(0x00, 0xCA, 0x00), + _INIT_CMD(0x00, 0xCB, 0x16), + _INIT_CMD(0x00, 0xCC, 0xAF), + _INIT_CMD(0x00, 0xCD, 0xFF), + _INIT_CMD(0x00, 0xCE, 0xFF), + _INIT_CMD(0x00, 0xB0, 0x0B), + _INIT_CMD(0x00, 0xB1, 0x04), + _INIT_CMD(0x00, 0xB2, 0x08), + _INIT_CMD(0x00, 0xB3, 0x19), + _INIT_CMD(0x00, 0xB4, 0x31), + _INIT_CMD(0x00, 0xB5, 0x46), + _INIT_CMD(0x00, 0xB6, 0x55), + _INIT_CMD(0x00, 0xB7, 0x6E), + _INIT_CMD(0x00, 0xB8, 0x92), + _INIT_CMD(0x00, 0xB9, 0xD4), + _INIT_CMD(0x00, 0xBA, 0x1B), + _INIT_CMD(0x05, 0xBB, 0x9B), + _INIT_CMD(0x00, 0xBC, 0x28), + _INIT_CMD(0x00, 0xBD, 0x2D), + _INIT_CMD(0x00, 0xBE, 0xC3), + _INIT_CMD(0x00, 0xBF, 0x2F), + _INIT_CMD(0x00, 0xC0, 0x62), + _INIT_CMD(0x00, 0xC1, 0x99), + _INIT_CMD(0x00, 0xC2, 0xAB), + _INIT_CMD(0x00, 0xC3, 0xBF), + _INIT_CMD(0x00, 0xC4, 0xCF), + _INIT_CMD(0x00, 0xC5, 0xDF), + _INIT_CMD(0x00, 0xC6, 0xF0), + _INIT_CMD(0x00, 0xC7, 0xF9), + _INIT_CMD(0x00, 0xC8, 0xFC), + _INIT_CMD(0x00, 0xC9, 0x00), + _INIT_CMD(0x00, 0xCA, 0x00), + _INIT_CMD(0x00, 0xCB, 0x16), + _INIT_CMD(0x00, 0xCC, 0xAF), + _INIT_CMD(0x00, 0xCD, 0xFF), + _INIT_CMD(0x00, 0xCE, 0xFF), + _INIT_CMD(0x00, 0xB0, 0x0C), + _INIT_CMD(0x00, 0xB1, 0x04), + _INIT_CMD(0x00, 0xB2, 0x05), + _INIT_CMD(0x00, 0xB3, 0x17), + _INIT_CMD(0x00, 0xB4, 0x2E), + _INIT_CMD(0x00, 0xB5, 0x42), + _INIT_CMD(0x00, 0xB6, 0x51), + _INIT_CMD(0x00, 0xB7, 0x69), + _INIT_CMD(0x00, 0xB8, 0x88), + _INIT_CMD(0x00, 0xB9, 0xC9), + _INIT_CMD(0x00, 0xBA, 0x0C), + _INIT_CMD(0x05, 0xBB, 0x86), + _INIT_CMD(0x00, 0xBC, 0x03), + _INIT_CMD(0x00, 0xBD, 0x08), + _INIT_CMD(0x00, 0xBE, 0x95), + _INIT_CMD(0x00, 0xBF, 0x05), + _INIT_CMD(0x00, 0xC0, 0x35), + _INIT_CMD(0x00, 0xC1, 0x62), + _INIT_CMD(0x00, 0xC2, 0x81), + _INIT_CMD(0x00, 0xC3, 0x96), + _INIT_CMD(0x00, 0xC4, 0x9E), + _INIT_CMD(0x00, 0xC5, 0xA5), + _INIT_CMD(0x00, 0xC6, 0xAD), + _INIT_CMD(0x00, 0xC7, 0xB1), + _INIT_CMD(0x00, 0xC8, 0xB4), + _INIT_CMD(0x00, 0xC9, 0x00), + _INIT_CMD(0x00, 0xCA, 0x00), + _INIT_CMD(0x00, 0xCB, 0x16), + _INIT_CMD(0x00, 0xCC, 0xAF), + _INIT_CMD(0x00, 0xCD, 0xFF), + _INIT_CMD(0x64, 0xCE, 0xFF), + _INIT_CMD(0x00, 0xB0, 0x00), + _INIT_CMD(0x00, 0xB3, 0x08), + _INIT_CMD(0x00, 0xB0, 0x04), + _INIT_CMD(0x0A, 0xB8, 0x68), + _INIT_CMD(0x78, 0x11), + _INIT_CMD(0x14, 0x29), + + {}, +}; + +static const struct panel_cmd boe_himax8279d8p_off_cmds[] = { + _INIT_CMD(0x00, 0x28), + _INIT_CMD(0x00, 0x10), + + {}, +}; + +static const struct panel_desc boe_himax8279d8p_panel_desc = { + .display_mode = &boe_himax8279d8p_display_mode, + .bpc = 8, + .width = 107, + .height = 172, + .delay_t1 = 5000, + .reset_delay_t2 = 14000, + .reset_delay_t3 = 1000, + .reset_delay_t4 = 1000, + .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE | + MIPI_DSI_CLOCK_NON_CONTINUOUS | MIPI_DSI_MODE_LPM, + .format = MIPI_DSI_FMT_RGB888, + .lanes = 4, + .on_cmds = boe_himax8279d8p_on_cmds, + .off_cmds = boe_himax8279d8p_off_cmds, +}; + +/* 10 inch */ +static const struct drm_display_mode boe_himax8279d10p_display_mode = { + .clock = 159420, + .hdisplay = 1200, + .hsync_start = 1200 + 80, + .hsync_end = 1200 + 80 + 60, + .htotal = 1200 + 80 + 60 + 24, + .vdisplay = 1920, + .vsync_start = 1920 + 10, + .vsync_end = 1920 + 10 + 14, + .vtotal = 1920 + 10 + 14 + 4, + .vrefresh = 60, +}; + +static const struct panel_cmd boe_himax8279d10p_on_cmds[] = { + _INIT_CMD(0x00, 0xB0, 0x05), + _INIT_CMD(0x00, 0xB1, 0xE5), + _INIT_CMD(0x00, 0xB3, 0x52), + _INIT_CMD(0x00, 0xB0, 0x00), + _INIT_CMD(0x00, 0xB3, 0x88), + _INIT_CMD(0x00, 0xB0, 0x04), + _INIT_CMD(0x00, 0xB8, 0x00), + _INIT_CMD(0x00, 0xB0, 0x00), + _INIT_CMD(0x00, 0xB2, 0x50), + _INIT_CMD(0x00, 0xB6, 0x03), + _INIT_CMD(0x00, 0xBA, 0x8B), + _INIT_CMD(0x00, 0xBF, 0x1A), + _INIT_CMD(0x00, 0xC0, 0x0F), + _INIT_CMD(0x00, 0xC2, 0x0C), + _INIT_CMD(0x00, 0xC3, 0x02), + _INIT_CMD(0x00, 0xC4, 0x0C), + _INIT_CMD(0x00, 0xC5, 0x02), + _INIT_CMD(0x00, 0xB0, 0x01), + _INIT_CMD(0x00, 0xE0, 0x26), + _INIT_CMD(0x00, 0xE1, 0x26), + _INIT_CMD(0x00, 0xDC, 0x00), + _INIT_CMD(0x00, 0xDD, 0x00), + _INIT_CMD(0x00, 0xCC, 0x26), + _INIT_CMD(0x00, 0xCD, 0x26), + _INIT_CMD(0x00, 0xC8, 0x00), + _INIT_CMD(0x00, 0xC9, 0x00), + _INIT_CMD(0x00, 0xD2, 0x04), + _INIT_CMD(0x00, 0xD3, 0x04), + _INIT_CMD(0x00, 0xE6, 0x03), + _INIT_CMD(0x00, 0xE7, 0x03), + _INIT_CMD(0x00, 0xC4, 0x08), + _INIT_CMD(0x00, 0xC5, 0x08), + _INIT_CMD(0x00, 0xD8, 0x07), + _INIT_CMD(0x00, 0xD9, 0x07), + _INIT_CMD(0x00, 0xC2, 0x06), + _INIT_CMD(0x00, 0xC3, 0x06), + _INIT_CMD(0x00, 0xD6, 0x05), + _INIT_CMD(0x00, 0xD7, 0x05), + _INIT_CMD(0x00, 0xC0, 0x0C), + _INIT_CMD(0x00, 0xC1, 0x0C), + _INIT_CMD(0x00, 0xD4, 0x0B), + _INIT_CMD(0x00, 0xD5, 0x0B), + _INIT_CMD(0x00, 0xCA, 0x0A), + _INIT_CMD(0x00, 0xCB, 0x0A), + _INIT_CMD(0x00, 0xDE, 0x09), + _INIT_CMD(0x00, 0xDF, 0x09), + _INIT_CMD(0x00, 0xC6, 0x26), + _INIT_CMD(0x00, 0xC7, 0x26), + _INIT_CMD(0x00, 0xCE, 0x00), + _INIT_CMD(0x00, 0xCF, 0x00), + _INIT_CMD(0x00, 0xDA, 0x26), + _INIT_CMD(0x00, 0xDB, 0x26), + _INIT_CMD(0x00, 0xE2, 0x00), + _INIT_CMD(0x00, 0xE3, 0x00), + _INIT_CMD(0x00, 0xB0, 0x02), + _INIT_CMD(0x00, 0xC0, 0x00), + _INIT_CMD(0x00, 0xC1, 0x07), + _INIT_CMD(0x00, 0xC2, 0x0D), + _INIT_CMD(0x00, 0xC3, 0x18), + _INIT_CMD(0x00, 0xC4, 0x27), + _INIT_CMD(0x00, 0xC5, 0x28), + _INIT_CMD(0x00, 0xC6, 0x30), + _INIT_CMD(0x00, 0xC7, 0x2E), + _INIT_CMD(0x00, 0xC8, 0x2F), + _INIT_CMD(0x00, 0xC9, 0x1A), + _INIT_CMD(0x00, 0xCA, 0x20), + _INIT_CMD(0x00, 0xCB, 0x29), + _INIT_CMD(0x00, 0xCC, 0x26), + _INIT_CMD(0x00, 0xCD, 0x32), + _INIT_CMD(0x00, 0xCE, 0x33), + _INIT_CMD(0x00, 0xCF, 0x31), + _INIT_CMD(0x00, 0xD0, 0x06), + _INIT_CMD(0x00, 0xD2, 0x00), + _INIT_CMD(0x00, 0xD3, 0x07), + _INIT_CMD(0x00, 0xD4, 0x12), + _INIT_CMD(0x00, 0xD5, 0x26), + _INIT_CMD(0x00, 0xD6, 0x3D), + _INIT_CMD(0x00, 0xD7, 0x3F), + _INIT_CMD(0x00, 0xD8, 0x3F), + _INIT_CMD(0x00, 0xD9, 0x3F), + _INIT_CMD(0x00, 0xDA, 0x3F), + _INIT_CMD(0x00, 0xDB, 0x3F), + _INIT_CMD(0x00, 0xDC, 0x3F), + _INIT_CMD(0x00, 0xDD, 0x3F), + _INIT_CMD(0x00, 0xDE, 0x3F), + _INIT_CMD(0x00, 0xDF, 0x3A), + _INIT_CMD(0x00, 0xE0, 0x37), + _INIT_CMD(0x00, 0xE1, 0x35), + _INIT_CMD(0x00, 0xE2, 0x07), + _INIT_CMD(0x00, 0xB0, 0x03), + _INIT_CMD(0x00, 0xC8, 0x0B), + _INIT_CMD(0x00, 0xC9, 0x07), + _INIT_CMD(0x00, 0xC3, 0x00), + _INIT_CMD(0x00, 0xE7, 0x00), + _INIT_CMD(0x00, 0xC5, 0x2A), + _INIT_CMD(0x00, 0xDE, 0x2A), + _INIT_CMD(0x00, 0xCA, 0x43), + _INIT_CMD(0x00, 0xC9, 0x07), + _INIT_CMD(0x00, 0xE4, 0xC0), + _INIT_CMD(0x00, 0xE5, 0x0D), + _INIT_CMD(0x00, 0xCB, 0x00), + _INIT_CMD(0x00, 0xB0, 0x06), + _INIT_CMD(0x00, 0xB8, 0xA5), + _INIT_CMD(0x00, 0xC0, 0xA5), + _INIT_CMD(0x00, 0xC7, 0x0F), + _INIT_CMD(0x00, 0xD5, 0x32), + _INIT_CMD(0x00, 0xB8, 0x00), + _INIT_CMD(0x00, 0xC0, 0x00), + _INIT_CMD(0x00, 0xBC, 0x00), + _INIT_CMD(0x00, 0xB0, 0x07), + _INIT_CMD(0x00, 0xB1, 0x00), + _INIT_CMD(0x00, 0xB2, 0x09), + _INIT_CMD(0x00, 0xB3, 0x19), + _INIT_CMD(0x00, 0xB4, 0x2F), + _INIT_CMD(0x00, 0xB5, 0x44), + _INIT_CMD(0x00, 0xB6, 0x52), + _INIT_CMD(0x00, 0xB7, 0x6A), + _INIT_CMD(0x00, 0xB8, 0x8A), + _INIT_CMD(0x00, 0xB9, 0xCA), + _INIT_CMD(0x00, 0xBA, 0x0C), + _INIT_CMD(0x00, 0xBB, 0x87), + _INIT_CMD(0x00, 0xBC, 0x06), + _INIT_CMD(0x00, 0xBD, 0x0A), + _INIT_CMD(0x00, 0xBE, 0x9B), + _INIT_CMD(0x00, 0xBF, 0x0C), + _INIT_CMD(0x00, 0xC0, 0x3D), + _INIT_CMD(0x00, 0xC1, 0x71), + _INIT_CMD(0x00, 0xC2, 0x90), + _INIT_CMD(0x00, 0xC3, 0xA0), + _INIT_CMD(0x00, 0xC4, 0xA8), + _INIT_CMD(0x00, 0xC5, 0xB1), + _INIT_CMD(0x00, 0xC6, 0xBB), + _INIT_CMD(0x00, 0xC7, 0xC0), + _INIT_CMD(0x00, 0xC8, 0xC4), + _INIT_CMD(0x00, 0xC9, 0x00), + _INIT_CMD(0x00, 0xCA, 0x00), + _INIT_CMD(0x00, 0xCB, 0x16), + _INIT_CMD(0x00, 0xCC, 0xAF), + _INIT_CMD(0x00, 0xCD, 0xFF), + _INIT_CMD(0x00, 0xCE, 0xFF), + _INIT_CMD(0x00, 0xB0, 0x08), + _INIT_CMD(0x00, 0xB1, 0x04), + _INIT_CMD(0x00, 0xB2, 0x08), + _INIT_CMD(0x00, 0xB3, 0x19), + _INIT_CMD(0x00, 0xB4, 0x31), + _INIT_CMD(0x00, 0xB5, 0x46), + _INIT_CMD(0x00, 0xB6, 0x55), + _INIT_CMD(0x00, 0xB7, 0x6E), + _INIT_CMD(0x00, 0xB8, 0x92), + _INIT_CMD(0x00, 0xB9, 0xD4), + _INIT_CMD(0x00, 0xBA, 0x1B), + _INIT_CMD(0x00, 0xBB, 0x9B), + _INIT_CMD(0x00, 0xBC, 0x28), + _INIT_CMD(0x00, 0xBD, 0x2D), + _INIT_CMD(0x00, 0xBE, 0xC3), + _INIT_CMD(0x00, 0xBF, 0x2F), + _INIT_CMD(0x00, 0xC0, 0x62), + _INIT_CMD(0x00, 0xC1, 0x99), + _INIT_CMD(0x00, 0xC2, 0xAB), + _INIT_CMD(0x00, 0xC3, 0xBF), + _INIT_CMD(0x00, 0xC4, 0xCF), + _INIT_CMD(0x00, 0xC5, 0xDF), + _INIT_CMD(0x00, 0xC6, 0xF0), + _INIT_CMD(0x00, 0xC7, 0xF9), + _INIT_CMD(0x00, 0xC8, 0xFC), + _INIT_CMD(0x00, 0xC9, 0x00), + _INIT_CMD(0x00, 0xCA, 0x00), + _INIT_CMD(0x00, 0xCB, 0x16), + _INIT_CMD(0x00, 0xCC, 0xAF), + _INIT_CMD(0x00, 0xCD, 0xFF), + _INIT_CMD(0x00, 0xCE, 0xFF), + _INIT_CMD(0x00, 0xB0, 0x09), + _INIT_CMD(0x00, 0xB1, 0x04), + _INIT_CMD(0x00, 0xB2, 0x05), + _INIT_CMD(0x00, 0xB3, 0x17), + _INIT_CMD(0x00, 0xB4, 0x2E), + _INIT_CMD(0x00, 0xB5, 0x42), + _INIT_CMD(0x00, 0xB6, 0x51), + _INIT_CMD(0x00, 0xB7, 0x69), + _INIT_CMD(0x00, 0xB8, 0x88), + _INIT_CMD(0x00, 0xB9, 0xC9), + _INIT_CMD(0x00, 0xBA, 0x0C), + _INIT_CMD(0x00, 0xBB, 0x86), + _INIT_CMD(0x00, 0xBC, 0x03), + _INIT_CMD(0x00, 0xBD, 0x08), + _INIT_CMD(0x00, 0xBE, 0x95), + _INIT_CMD(0x00, 0xBF, 0x05), + _INIT_CMD(0x00, 0xC0, 0x35), + _INIT_CMD(0x00, 0xC1, 0x62), + _INIT_CMD(0x00, 0xC2, 0x81), + _INIT_CMD(0x00, 0xC3, 0x96), + _INIT_CMD(0x00, 0xC4, 0x9E), + _INIT_CMD(0x00, 0xC5, 0xA5), + _INIT_CMD(0x00, 0xC6, 0xAD), + _INIT_CMD(0x00, 0xC7, 0xB1), + _INIT_CMD(0x00, 0xC8, 0xB4), + _INIT_CMD(0x00, 0xC9, 0x00), + _INIT_CMD(0x00, 0xCA, 0x00), + _INIT_CMD(0x00, 0xCB, 0x16), + _INIT_CMD(0x00, 0xCC, 0xAF), + _INIT_CMD(0x00, 0xCD, 0xFF), + _INIT_CMD(0x00, 0xCE, 0xFF), + _INIT_CMD(0x00, 0xB0, 0x0A), + _INIT_CMD(0x00, 0xB1, 0x00), + _INIT_CMD(0x00, 0xB2, 0x09), + _INIT_CMD(0x00, 0xB3, 0x19), + _INIT_CMD(0x00, 0xB4, 0x2F), + _INIT_CMD(0x00, 0xB5, 0x44), + _INIT_CMD(0x00, 0xB6, 0x52), + _INIT_CMD(0x00, 0xB7, 0x6A), + _INIT_CMD(0x00, 0xB8, 0x8A), + _INIT_CMD(0x00, 0xB9, 0xCA), + _INIT_CMD(0x00, 0xBA, 0x0C), + _INIT_CMD(0x00, 0xBB, 0x87), + _INIT_CMD(0x00, 0xBC, 0x06), + _INIT_CMD(0x00, 0xBD, 0x0A), + _INIT_CMD(0x00, 0xBE, 0x9B), + _INIT_CMD(0x00, 0xBF, 0x0C), + _INIT_CMD(0x00, 0xC0, 0x3D), + _INIT_CMD(0x00, 0xC1, 0x71), + _INIT_CMD(0x00, 0xC2, 0x90), + _INIT_CMD(0x00, 0xC3, 0xA0), + _INIT_CMD(0x00, 0xC4, 0xA8), + _INIT_CMD(0x00, 0xC5, 0xB1), + _INIT_CMD(0x00, 0xC6, 0xBB), + _INIT_CMD(0x00, 0xC7, 0xC0), + _INIT_CMD(0x00, 0xC8, 0xC4), + _INIT_CMD(0x00, 0xC9, 0x00), + _INIT_CMD(0x00, 0xCA, 0x00), + _INIT_CMD(0x00, 0xCB, 0x16), + _INIT_CMD(0x00, 0xCC, 0xAF), + _INIT_CMD(0x00, 0xCD, 0xFF), + _INIT_CMD(0x00, 0xCE, 0xFF), + _INIT_CMD(0x00, 0xB0, 0x0B), + _INIT_CMD(0x00, 0xB1, 0x04), + _INIT_CMD(0x00, 0xB2, 0x08), + _INIT_CMD(0x00, 0xB3, 0x19), + _INIT_CMD(0x00, 0xB4, 0x31), + _INIT_CMD(0x00, 0xB5, 0x46), + _INIT_CMD(0x00, 0xB6, 0x55), + _INIT_CMD(0x00, 0xB7, 0x6E), + _INIT_CMD(0x00, 0xB8, 0x92), + _INIT_CMD(0x00, 0xB9, 0xD4), + _INIT_CMD(0x00, 0xBA, 0x1B), + _INIT_CMD(0x00, 0xBB, 0x9B), + _INIT_CMD(0x00, 0xBC, 0x28), + _INIT_CMD(0x00, 0xBD, 0x2D), + _INIT_CMD(0x00, 0xBE, 0xC3), + _INIT_CMD(0x00, 0xBF, 0x2F), + _INIT_CMD(0x00, 0xC0, 0x62), + _INIT_CMD(0x00, 0xC1, 0x99), + _INIT_CMD(0x00, 0xC2, 0xAB), + _INIT_CMD(0x00, 0xC3, 0xBF), + _INIT_CMD(0x00, 0xC4, 0xCF), + _INIT_CMD(0x00, 0xC5, 0xDF), + _INIT_CMD(0x00, 0xC6, 0xF0), + _INIT_CMD(0x00, 0xC7, 0xF9), + _INIT_CMD(0x00, 0xC8, 0xFC), + _INIT_CMD(0x00, 0xC9, 0x00), + _INIT_CMD(0x00, 0xCA, 0x00), + _INIT_CMD(0x00, 0xCB, 0x16), + _INIT_CMD(0x00, 0xCC, 0xAF), + _INIT_CMD(0x00, 0xCD, 0xFF), + _INIT_CMD(0x00, 0xCE, 0xFF), + _INIT_CMD(0x00, 0xB0, 0x0C), + _INIT_CMD(0x00, 0xB1, 0x04), + _INIT_CMD(0x00, 0xB2, 0x05), + _INIT_CMD(0x00, 0xB3, 0x17), + _INIT_CMD(0x00, 0xB4, 0x2E), + _INIT_CMD(0x00, 0xB5, 0x42), + _INIT_CMD(0x00, 0xB6, 0x51), + _INIT_CMD(0x00, 0xB7, 0x69), + _INIT_CMD(0x00, 0xB8, 0x88), + _INIT_CMD(0x00, 0xB9, 0xC9), + _INIT_CMD(0x00, 0xBA, 0x0C), + _INIT_CMD(0x00, 0xBB, 0x86), + _INIT_CMD(0x00, 0xBC, 0x03), + _INIT_CMD(0x00, 0xBD, 0x08), + _INIT_CMD(0x00, 0xBE, 0x95), + _INIT_CMD(0x00, 0xBF, 0x05), + _INIT_CMD(0x00, 0xC0, 0x35), + _INIT_CMD(0x00, 0xC1, 0x62), + _INIT_CMD(0x00, 0xC2, 0x81), + _INIT_CMD(0x00, 0xC3, 0x96), + _INIT_CMD(0x00, 0xC4, 0x9E), + _INIT_CMD(0x00, 0xC5, 0xA5), + _INIT_CMD(0x00, 0xC6, 0xAD), + _INIT_CMD(0x00, 0xC7, 0xB1), + _INIT_CMD(0x00, 0xC8, 0xB4), + _INIT_CMD(0x00, 0xC9, 0x00), + _INIT_CMD(0x00, 0xCA, 0x00), + _INIT_CMD(0x00, 0xCB, 0x16), + _INIT_CMD(0x00, 0xCC, 0xAF), + _INIT_CMD(0x00, 0xCD, 0xFF), + _INIT_CMD(0x00, 0xCE, 0xFF), + _INIT_CMD(0x00, 0xB0, 0x00), + _INIT_CMD(0x00, 0xB3, 0x08), + _INIT_CMD(0x00, 0xB0, 0x04), + _INIT_CMD(0x64, 0xB8, 0x68), + + {}, +}; + +static const struct panel_cmd boe_himax8279d10p_off_cmds[] = { + _INIT_CMD(0x00, 0x28), + _INIT_CMD(0x00, 0x10), + + {}, +}; + +static const struct panel_desc boe_himax8279d10p_panel_desc = { + .display_mode = &boe_himax8279d10p_display_mode, + .bpc = 8, + .width = 135, + .height = 216, + .delay_t1 = 5000, + .reset_delay_t2 = 14000, + .reset_delay_t3 = 1000, + .reset_delay_t4 = 1000, + .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE | + MIPI_DSI_CLOCK_NON_CONTINUOUS | MIPI_DSI_MODE_LPM, + .format = MIPI_DSI_FMT_RGB888, + .lanes = 4, + .on_cmds = boe_himax8279d10p_on_cmds, + .off_cmds = boe_himax8279d10p_off_cmds, +}; + static const struct of_device_id panel_of_match[] = { - { .compatible = "boe,himax8279d", }, + { .compatible = "boe,himax8279d8p", + .data = &boe_himax8279d8p_panel_desc + }, + { .compatible = "boe,himax8279d10p", + .data = &boe_himax8279d10p_panel_desc + }, { } }; MODULE_DEVICE_TABLE(of, panel_of_match); @@ -462,43 +954,33 @@ MODULE_DEVICE_TABLE(of, panel_of_match); static int panel_add(struct panel_info *pinfo) { struct device *dev = &pinfo->link->dev; - struct device_node *np; int err; - pinfo->pp33000_gpio = devm_gpiod_get_optional(dev, - "pp33000", - GPIOD_OUT_HIGH); - if (IS_ERR(pinfo->pp33000_gpio)) { - err = PTR_ERR(pinfo->pp33000_gpio); - dev_err(dev, "failed to get pp33000 gpio: %d\n", err); - pinfo->pp33000_gpio = NULL; + pinfo->pp18_gpio = devm_gpiod_get_optional(dev, "pp18", GPIOD_OUT_LOW); + if (IS_ERR(pinfo->pp18_gpio)) { + err = PTR_ERR(pinfo->pp18_gpio); + dev_err(dev, "failed to get pp18 gpio: %d\n", err); + pinfo->pp18_gpio = NULL; } - pinfo->pp18000_gpio = devm_gpiod_get_optional(dev, - "pp18000", - GPIOD_OUT_HIGH); - if (IS_ERR(pinfo->pp18000_gpio)) { - err = PTR_ERR(pinfo->pp18000_gpio); - dev_err(dev, "failed to get pp18000 gpio: %d\n", err); - pinfo->pp18000_gpio = NULL; + pinfo->pp33_gpio = devm_gpiod_get_optional(dev, "pp33", GPIOD_OUT_LOW); + if (IS_ERR(pinfo->pp33_gpio)) { + err = PTR_ERR(pinfo->pp33_gpio); + dev_err(dev, "failed to get pp33 gpio: %d\n", err); + pinfo->pp33_gpio = NULL; } pinfo->reset_gpio = devm_gpiod_get_optional(dev, "enable", - GPIOD_OUT_HIGH); + GPIOD_OUT_LOW); if (IS_ERR(pinfo->reset_gpio)) { err = PTR_ERR(pinfo->reset_gpio); dev_err(dev, "failed to get enable gpio: %d\n", err); pinfo->reset_gpio = NULL; } - np = of_parse_phandle(dev->of_node, "backlight", 0); - if (np) { - pinfo->backlight = of_find_backlight_by_node(np); - of_node_put(np); - - if (!pinfo->backlight) - return -EPROBE_DEFER; - } + pinfo->backlight = devm_of_find_backlight(dev); + if (IS_ERR(pinfo->backlight)) + return PTR_ERR(pinfo->backlight); drm_panel_init(&pinfo->base); pinfo->base.funcs = &panel_funcs; @@ -506,35 +988,34 @@ static int panel_add(struct panel_info *pinfo) err = drm_panel_add(&pinfo->base); if (err < 0) - goto put_backlight; + return err; return 0; - -put_backlight: - put_device(&pinfo->backlight->dev); - - return err; } static void panel_del(struct panel_info *pinfo) { if (pinfo->base.dev) drm_panel_remove(&pinfo->base); - - put_device(&pinfo->backlight->dev); } static int panel_probe(struct mipi_dsi_device *dsi) { struct panel_info *pinfo; int err; + const struct panel_desc *desc; pinfo = devm_kzalloc(&dsi->dev, sizeof(*pinfo), GFP_KERNEL); if (!pinfo) return -ENOMEM; + desc = of_device_get_match_data(&dsi->dev); + dsi->mode_flags = desc->flags; + dsi->format = desc->format; + dsi->lanes = desc->lanes; + pinfo->desc = desc; + pinfo->link = dsi; - panel_parse_dt(pinfo); mipi_dsi_set_drvdata(dsi, pinfo); err = panel_add(pinfo); @@ -552,7 +1033,7 @@ static int panel_remove(struct mipi_dsi_device *dsi) err = panel_unprepare(&pinfo->base); if (err < 0) DRM_DEV_ERROR(&dsi->dev, "failed to unprepare panel: %d\n", - err); + err); err = panel_disable(&pinfo->base); if (err < 0) @@ -561,7 +1042,7 @@ static int panel_remove(struct mipi_dsi_device *dsi) err = mipi_dsi_detach(dsi); if (err < 0) DRM_DEV_ERROR(&dsi->dev, "failed to detach from DSI host: %d\n", - err); + err); drm_panel_detach(&pinfo->base); panel_del(pinfo); @@ -573,13 +1054,13 @@ static void panel_shutdown(struct mipi_dsi_device *dsi) { struct panel_info *pinfo = mipi_dsi_get_drvdata(dsi); - panel_unprepare(&pinfo->base); panel_disable(&pinfo->base); + panel_unprepare(&pinfo->base); } static struct mipi_dsi_driver panel_driver = { .driver = { - .name = "panel-innolux-ota7290b", + .name = "panel-boe-himax8279d", .of_match_table = panel_of_match, }, .probe = panel_probe, -- 2.17.1 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel