Select Git revision
panel-newvision-nv3052c.c
panel-newvision-nv3052c.c 24.80 KiB
// SPDX-License-Identifier: GPL-2.0
/*
* NewVision NV3052C IPS LCD panel driver
*
* Copyright (C) 2020, Paul Cercueil <paul@crapouillou.net>
* Copyright (C) 2022, Christophe Branchereau <cbranchereau@gmail.com>
*/
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/gpio/consumer.h>
#include <linux/media-bus-format.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
#include <linux/spi/spi.h>
#include <video/mipi_display.h>
#include <drm/drm_mipi_dbi.h>
#include <drm/drm_modes.h>
#include <drm/drm_panel.h>
struct nv3052c_reg {
u8 cmd;
u8 val;
};
struct nv3052c_panel_info {
const struct drm_display_mode *display_modes;
unsigned int num_modes;
u16 width_mm, height_mm;
u32 bus_format, bus_flags;
const struct nv3052c_reg *panel_regs;
unsigned int panel_regs_len;
};
struct nv3052c {
struct device *dev;
struct drm_panel panel;
struct mipi_dbi dbi;
const struct nv3052c_panel_info *panel_info;
struct regulator *supply;
struct gpio_desc *reset_gpio;
};
static const struct nv3052c_reg ltk035c5444t_panel_regs[] = {
// EXTC Command set enable, select page 1
{ 0xff, 0x30 }, { 0xff, 0x52 }, { 0xff, 0x01 },
// Mostly unknown registers
{ 0xe3, 0x00 },
{ 0x40, 0x00 },
{ 0x03, 0x40 },
{ 0x04, 0x00 },
{ 0x05, 0x03 },
{ 0x08, 0x00 },
{ 0x09, 0x07 },
{ 0x0a, 0x01 },
{ 0x0b, 0x32 },
{ 0x0c, 0x32 },
{ 0x0d, 0x0b },
{ 0x0e, 0x00 },
{ 0x23, 0xa0 },
{ 0x24, 0x0c },
{ 0x25, 0x06 },
{ 0x26, 0x14 },
{ 0x27, 0x14 },
{ 0x38, 0xcc }, // VCOM_ADJ1
{ 0x39, 0xd7 }, // VCOM_ADJ2
{ 0x3a, 0x4a }, // VCOM_ADJ3
{ 0x28, 0x40 },