mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-10 04:48:04 +09:00
drm/rockchip: ebc-dev: release version 5.05 for kernel-6.1
Change-Id: If18ddadc1fda007fd4108bbf937cab1b2e4fdd10 Signed-off-by: Zorro Liu <lyx@rock-chips.com>
This commit is contained in:
@@ -5,10 +5,7 @@ menuconfig ROCKCHIP_EBC_DEV
|
||||
help
|
||||
Rockchip eBook Device Dirver could help to driver the electronic ink screen.
|
||||
|
||||
choice
|
||||
prompt "eink pmic sensor"
|
||||
depends on ROCKCHIP_EBC_DEV
|
||||
default EPD_TPS65185_SENSOR
|
||||
config EPD_TPS65185_SENSOR
|
||||
bool "Tps65185"
|
||||
endchoice
|
||||
bool "eink pmic Tps65185"
|
||||
depends on ROCKCHIP_EBC_DEV
|
||||
default y
|
||||
|
||||
@@ -6,4 +6,7 @@ obj-$(CONFIG_ROCKCHIP_EBC_DEV) += bufmanage/
|
||||
obj-$(CONFIG_ROCKCHIP_EBC_DEV) += pmic/
|
||||
obj-$(CONFIG_ROCKCHIP_EBC_DEV) += tcon/
|
||||
|
||||
AFLAGS_ebc_dev_v8.o += -march=armv8-a+lse
|
||||
AFLAGS_ebc_dev_y8_v8.o += -march=armv8-a+lse
|
||||
rkebc-$(CONFIG_ARM64) += ebc_dev_v8.o
|
||||
#rkebc-$(CONFIG_ARM64) += ebc_dev_y8_v8.o
|
||||
|
||||
@@ -28,8 +28,10 @@ struct buf_info_s {
|
||||
struct buf_list_s *dsp_buf_list; /* dispplay buffer list. */
|
||||
int dsp_buf_list_status;
|
||||
struct ebc_buf_s *osd_buf;
|
||||
|
||||
struct mutex dsp_lock;
|
||||
struct buf_list_s *osd_buf_list; /* dispplay buffer list. */
|
||||
struct mutex osd_buf_lock;
|
||||
struct mutex dsp_buf_lock;
|
||||
struct mutex ebc_buf_lock;
|
||||
};
|
||||
|
||||
static struct buf_info_s ebc_buf_info;
|
||||
@@ -54,86 +56,108 @@ int ebc_buf_release(struct ebc_buf_s *release_buf)
|
||||
return BUF_SUCCESS;
|
||||
}
|
||||
|
||||
int ebc_remove_from_dsp_buf_list(struct ebc_buf_s *remove_buf)
|
||||
static void do_dsp_buf_list(struct ebc_buf_s *dsp_buf)
|
||||
{
|
||||
mutex_lock(&ebc_buf_info.dsp_lock);
|
||||
if (ebc_buf_info.dsp_buf_list) {
|
||||
int pos;
|
||||
struct ebc_buf_s *temp_buf;
|
||||
int temp_pos;
|
||||
|
||||
pos = buf_list_get_pos(ebc_buf_info.dsp_buf_list, (int *)remove_buf);
|
||||
buf_list_remove(ebc_buf_info.dsp_buf_list, pos);
|
||||
if (ebc_buf_info.dsp_buf_list->nb_elt > 0) {
|
||||
temp_pos = ebc_buf_info.dsp_buf_list->nb_elt;
|
||||
while (temp_pos) {
|
||||
temp_pos--;
|
||||
temp_buf = (struct ebc_buf_s *)buf_list_get(ebc_buf_info.dsp_buf_list, temp_pos);
|
||||
if (temp_buf->needpic) {
|
||||
continue;
|
||||
} else {
|
||||
buf_list_remove(ebc_buf_info.dsp_buf_list, temp_pos);
|
||||
ebc_buf_release(temp_buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
mutex_unlock(&ebc_buf_info.dsp_lock);
|
||||
}
|
||||
|
||||
return BUF_SUCCESS;
|
||||
int ebc_drop_one_dsp_buf(void)
|
||||
{
|
||||
struct ebc_buf_s *temp_buf;
|
||||
int temp_pos;
|
||||
|
||||
mutex_lock(&ebc_buf_info.dsp_buf_lock);
|
||||
if (ebc_buf_info.dsp_buf_list) {
|
||||
if (ebc_buf_info.dsp_buf_list->nb_elt > 0) {
|
||||
temp_pos = ebc_buf_info.dsp_buf_list->nb_elt - 1;
|
||||
temp_buf = (struct ebc_buf_s *)buf_list_get(ebc_buf_info.dsp_buf_list, temp_pos);
|
||||
if (temp_buf->needpic == 2) {
|
||||
buf_list_remove(ebc_buf_info.dsp_buf_list, temp_pos);
|
||||
ebc_buf_release(temp_buf);
|
||||
mutex_unlock(&ebc_buf_info.dsp_buf_lock);
|
||||
return BUF_SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
mutex_unlock(&ebc_buf_info.dsp_buf_lock);
|
||||
|
||||
return BUF_ERROR;
|
||||
}
|
||||
|
||||
int ebc_add_to_dsp_buf_list(struct ebc_buf_s *dsp_buf)
|
||||
{
|
||||
struct ebc_buf_s *temp_buf;
|
||||
int temp_pos;
|
||||
int is_full_mode = 0;
|
||||
|
||||
mutex_lock(&ebc_buf_info.dsp_lock);
|
||||
mutex_lock(&ebc_buf_info.dsp_buf_lock);
|
||||
if (ebc_buf_info.dsp_buf_list) {
|
||||
switch (dsp_buf->buf_mode) {
|
||||
case EPD_DU:
|
||||
case EPD_SUSPEND:
|
||||
case EPD_RESUME:
|
||||
case EPD_POWER_OFF:
|
||||
case EPD_OVERLAY:
|
||||
case EPD_RESET:
|
||||
break;
|
||||
do_dsp_buf_list(dsp_buf);
|
||||
|
||||
default:
|
||||
if (ebc_buf_info.dsp_buf_list->nb_elt > 1) {
|
||||
temp_pos = ebc_buf_info.dsp_buf_list->nb_elt;
|
||||
while (--temp_pos) {
|
||||
temp_buf = (struct ebc_buf_s *)buf_list_get(ebc_buf_info.dsp_buf_list, temp_pos);
|
||||
if ((temp_buf->buf_mode != EPD_FULL_GC16) &&
|
||||
(temp_buf->buf_mode != EPD_FULL_GL16) &&
|
||||
(temp_buf->buf_mode != EPD_FULL_GLR16) &&
|
||||
(temp_buf->buf_mode != EPD_FULL_GLD16) &&
|
||||
(temp_buf->buf_mode != EPD_FULL_GCC16) &&
|
||||
(temp_buf->buf_mode != EPD_OVERLAY) &&
|
||||
(temp_buf->buf_mode != EPD_DU) &&
|
||||
(temp_buf->buf_mode != EPD_SUSPEND) &&
|
||||
(temp_buf->buf_mode != EPD_RESUME) &&
|
||||
(temp_buf->buf_mode != EPD_POWER_OFF)) {
|
||||
buf_list_remove(ebc_buf_info.dsp_buf_list, temp_pos);
|
||||
ebc_buf_release(temp_buf);
|
||||
} else if ((1 == is_full_mode) &&
|
||||
(temp_buf->buf_mode != EPD_DU) &&
|
||||
(temp_buf->buf_mode != EPD_OVERLAY) &&
|
||||
(temp_buf->buf_mode != EPD_SUSPEND) &&
|
||||
(temp_buf->buf_mode != EPD_RESUME) &&
|
||||
(temp_buf->buf_mode != EPD_POWER_OFF)) {
|
||||
buf_list_remove(ebc_buf_info.dsp_buf_list, temp_pos);
|
||||
ebc_buf_release(temp_buf);
|
||||
} else {
|
||||
is_full_mode = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
dsp_buf->status = buf_dsp;
|
||||
if (-1 == buf_list_add(ebc_buf_info.dsp_buf_list, (int *)dsp_buf, -1)) {
|
||||
mutex_unlock(&ebc_buf_info.dsp_lock);
|
||||
ebc_buf_release(dsp_buf);
|
||||
mutex_unlock(&ebc_buf_info.dsp_buf_lock);
|
||||
return BUF_ERROR;
|
||||
}
|
||||
|
||||
if (dsp_buf->status != buf_osd)
|
||||
dsp_buf->status = buf_dsp;
|
||||
}
|
||||
mutex_unlock(&ebc_buf_info.dsp_lock);
|
||||
mutex_unlock(&ebc_buf_info.dsp_buf_lock);
|
||||
|
||||
return BUF_SUCCESS;
|
||||
}
|
||||
|
||||
int ebc_add_to_osd_buf_list(struct ebc_buf_s *dsp_buf)
|
||||
{
|
||||
int ret = BUF_SUCCESS;
|
||||
|
||||
mutex_lock(&ebc_buf_info.osd_buf_lock);
|
||||
if (ebc_buf_info.osd_buf_list) {
|
||||
if (-1 == buf_list_add(ebc_buf_info.osd_buf_list, (int *)dsp_buf, -1)) {
|
||||
ebc_buf_release(dsp_buf);
|
||||
ret = BUF_ERROR;
|
||||
}
|
||||
}
|
||||
mutex_unlock(&ebc_buf_info.osd_buf_lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct ebc_buf_s *ebc_osd_buf_get(void)
|
||||
{
|
||||
struct ebc_buf_s *buf = NULL;
|
||||
|
||||
mutex_lock(&ebc_buf_info.osd_buf_lock);
|
||||
if (ebc_buf_info.osd_buf_list && (ebc_buf_info.osd_buf_list->nb_elt > 0)) {
|
||||
buf = (struct ebc_buf_s *)buf_list_get(ebc_buf_info.osd_buf_list, 0);
|
||||
buf_list_remove(ebc_buf_info.osd_buf_list, 0);
|
||||
}
|
||||
mutex_unlock(&ebc_buf_info.osd_buf_lock);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
int ebc_get_dsp_list_enum_num(void)
|
||||
{
|
||||
return ebc_buf_info.dsp_buf_list->nb_elt;
|
||||
}
|
||||
|
||||
int ebc_get_osd_list_enum_num(void)
|
||||
{
|
||||
return ebc_buf_info.osd_buf_list->nb_elt;
|
||||
}
|
||||
|
||||
struct ebc_buf_s *ebc_find_buf_by_phy_addr(unsigned long phy_addr)
|
||||
{
|
||||
struct ebc_buf_s *temp_buf;
|
||||
@@ -155,15 +179,17 @@ struct ebc_buf_s *ebc_dsp_buf_get(void)
|
||||
{
|
||||
struct ebc_buf_s *buf = NULL;
|
||||
|
||||
mutex_lock(&ebc_buf_info.dsp_lock);
|
||||
if (ebc_buf_info.dsp_buf_list && (ebc_buf_info.dsp_buf_list->nb_elt > 0))
|
||||
mutex_lock(&ebc_buf_info.dsp_buf_lock);
|
||||
if (ebc_buf_info.dsp_buf_list && (ebc_buf_info.dsp_buf_list->nb_elt > 0)) {
|
||||
buf = (struct ebc_buf_s *)buf_list_get(ebc_buf_info.dsp_buf_list, 0);
|
||||
mutex_unlock(&ebc_buf_info.dsp_lock);
|
||||
buf_list_remove(ebc_buf_info.dsp_buf_list, 0);
|
||||
}
|
||||
mutex_unlock(&ebc_buf_info.dsp_buf_lock);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
struct ebc_buf_s *ebc_osd_buf_get(void)
|
||||
struct ebc_buf_s *ebc_empty_osd_buf_get(void)
|
||||
{
|
||||
if (ebc_buf_info.osd_buf)
|
||||
return ebc_buf_info.osd_buf;
|
||||
@@ -185,12 +211,13 @@ struct ebc_buf_s *ebc_osd_buf_clone(void)
|
||||
return temp_buf;
|
||||
}
|
||||
|
||||
struct ebc_buf_s *ebc_empty_buf_get(void)
|
||||
struct ebc_buf_s *ebc_empty_buf_get(const char *tid_name)
|
||||
{
|
||||
struct ebc_buf_s *temp_buf;
|
||||
struct ebc_buf_s *temp_buf = NULL;
|
||||
int temp_pos;
|
||||
|
||||
if (ebc_buf_info.buf_list) {
|
||||
mutex_lock(&ebc_buf_info.ebc_buf_lock);
|
||||
while (ebc_buf_info.buf_list) {
|
||||
temp_pos = 0;
|
||||
|
||||
while (temp_pos < ebc_buf_info.buf_list->nb_elt) {
|
||||
@@ -198,23 +225,23 @@ struct ebc_buf_s *ebc_empty_buf_get(void)
|
||||
if (temp_buf) {
|
||||
if (temp_buf->status == buf_idle) {
|
||||
temp_buf->status = buf_user;
|
||||
memcpy(temp_buf->tid_name, current->comm, TASK_COMM_LEN); //store user thread name
|
||||
return temp_buf;
|
||||
memcpy(temp_buf->tid_name, tid_name, TASK_COMM_LEN - 1); //store user thread name
|
||||
goto OUT;
|
||||
}
|
||||
// one tid only can get one buf at one time
|
||||
else if ((temp_buf->status == buf_user) && (!strncmp(temp_buf->tid_name, current->comm, TASK_COMM_LEN - 7))) {
|
||||
return temp_buf;
|
||||
else if ((temp_buf->status == buf_user) && (!strncmp(temp_buf->tid_name, tid_name, TASK_COMM_LEN - 1))) {
|
||||
printk("[%s]: one tid only can get one buf at one time\n", tid_name);
|
||||
goto OUT;
|
||||
}
|
||||
}
|
||||
}
|
||||
ebc_buf_info.use_buf_is_empty = 1;
|
||||
|
||||
wait_event_interruptible(ebc_buf_wq, ebc_buf_info.use_buf_is_empty != 1);
|
||||
|
||||
return ebc_empty_buf_get();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
OUT:
|
||||
mutex_unlock(&ebc_buf_info.ebc_buf_lock);
|
||||
return temp_buf;
|
||||
}
|
||||
|
||||
unsigned long ebc_phy_buf_base_get(void)
|
||||
@@ -227,6 +254,23 @@ char *ebc_virt_buf_base_get(void)
|
||||
return ebc_buf_info.virt_mem_base;
|
||||
}
|
||||
|
||||
int ebc_buf_state_show(char *buf)
|
||||
{
|
||||
int i;
|
||||
int ret = 0;
|
||||
struct ebc_buf_s *temp_buf;
|
||||
|
||||
ret += sprintf(buf, "dsp_buf num = %d\n", ebc_buf_info.dsp_buf_list->nb_elt);
|
||||
if (ebc_buf_info.buf_list) {
|
||||
for (i = 0; i < ebc_buf_info.buf_list->nb_elt; i++) {
|
||||
temp_buf = (struct ebc_buf_s *)buf_list_get(ebc_buf_info.buf_list, i);
|
||||
ret += sprintf(buf + ret, "ebc_buf[%d]: s = %d, m = %d, tid = %s\n", i, temp_buf->status, temp_buf->buf_mode, temp_buf->tid_name);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ebc_buf_uninit(void)
|
||||
{
|
||||
struct ebc_buf_s *temp_buf;
|
||||
@@ -260,14 +304,21 @@ int ebc_buf_init(unsigned long phy_start, char *mem_start, int men_len, int dest
|
||||
if (NULL == mem_start)
|
||||
return BUF_ERROR;
|
||||
|
||||
mutex_init(&ebc_buf_info.dsp_lock);
|
||||
mutex_init(&ebc_buf_info.dsp_buf_lock);
|
||||
mutex_init(&ebc_buf_info.ebc_buf_lock);
|
||||
mutex_init(&ebc_buf_info.osd_buf_lock);
|
||||
|
||||
if (buf_list_init(&ebc_buf_info.buf_list, BUF_LIST_MAX_NUMBER))
|
||||
return BUF_ERROR;
|
||||
|
||||
if (buf_list_init(&ebc_buf_info.dsp_buf_list, BUF_LIST_MAX_NUMBER)) {
|
||||
res = BUF_ERROR;
|
||||
goto buf_list_err;
|
||||
goto dsp_list_err;
|
||||
}
|
||||
|
||||
if (buf_list_init(&ebc_buf_info.osd_buf_list, BUF_LIST_MAX_NUMBER)) {
|
||||
res = BUF_ERROR;
|
||||
goto osd_list_err;
|
||||
}
|
||||
|
||||
ebc_buf_info.buf_total_num = 0;
|
||||
@@ -317,10 +368,13 @@ int ebc_buf_init(unsigned long phy_start, char *mem_start, int men_len, int dest
|
||||
}
|
||||
|
||||
return BUF_SUCCESS;
|
||||
|
||||
exit:
|
||||
ebc_buf_uninit();
|
||||
buf_list_uninit(ebc_buf_info.osd_buf_list);
|
||||
osd_list_err:
|
||||
buf_list_uninit(ebc_buf_info.dsp_buf_list);
|
||||
buf_list_err:
|
||||
dsp_list_err:
|
||||
buf_list_uninit(ebc_buf_info.buf_list);
|
||||
|
||||
return res;
|
||||
|
||||
@@ -30,19 +30,24 @@ struct ebc_buf_s {
|
||||
int win_y1;
|
||||
int win_x2;
|
||||
int win_y2;
|
||||
int needpic;
|
||||
};
|
||||
|
||||
struct ebc_buf_s *ebc_osd_buf_get(void);
|
||||
int ebc_drop_one_dsp_buf(void);
|
||||
struct ebc_buf_s *ebc_empty_osd_buf_get(void);
|
||||
struct ebc_buf_s *ebc_osd_buf_clone(void);
|
||||
int ebc_buf_release(struct ebc_buf_s *release_buf);
|
||||
int ebc_remove_from_dsp_buf_list(struct ebc_buf_s *remove_buf);
|
||||
int ebc_add_to_dsp_buf_list(struct ebc_buf_s *dsp_buf);
|
||||
int ebc_add_to_osd_buf_list(struct ebc_buf_s *dsp_buf);
|
||||
int ebc_get_dsp_list_enum_num(void);
|
||||
int ebc_get_osd_list_enum_num(void);
|
||||
struct ebc_buf_s *ebc_dsp_buf_get(void);
|
||||
struct ebc_buf_s *ebc_osd_buf_get(void);
|
||||
struct ebc_buf_s *ebc_find_buf_by_phy_addr(unsigned long phy_addr);
|
||||
struct ebc_buf_s *ebc_empty_buf_get(void);
|
||||
struct ebc_buf_s *ebc_empty_buf_get(const char *tid_name);
|
||||
unsigned long ebc_phy_buf_base_get(void);
|
||||
char *ebc_virt_buf_base_get(void);
|
||||
int ebc_buf_state_show(char *buf);
|
||||
int ebc_buf_uninit(void);
|
||||
int ebc_buf_init(unsigned long phy_start, char *mem_start, int men_len, int dest_buf_len, int max_buf_num);
|
||||
#endif
|
||||
|
||||
@@ -11,20 +11,31 @@
|
||||
#include <linux/notifier.h>
|
||||
|
||||
/*
|
||||
* max support panel size 2232x1680
|
||||
* max support panel size 2560x1920
|
||||
* ebc module display buf use 4bit per pixel
|
||||
* eink module display buf use 8bit per pixel
|
||||
* ebc module direct mode display buf use 2bit per pixel
|
||||
*/
|
||||
#define EBC_FB_SIZE 0x200000 /* 2M */
|
||||
#define EINK_FB_SIZE 0x400000 /* 4M */
|
||||
#define DIRECT_FB_SIZE 0x100000 /* 1M */
|
||||
#define EINK_FB_SIZE 0x500000 /* 5M */
|
||||
#define DIRECT_FB_SIZE 0x200000 /* 2M */
|
||||
#define LUT_TABLE_SIZE 0x100000 /* 1M */
|
||||
#define FRAME_COUNT_SIZE 0x500000 /* 5M */
|
||||
|
||||
#define MAX_FB_NUM 4
|
||||
|
||||
#define EBC_SUCCESS (0)
|
||||
#define EBC_ERROR (-1)
|
||||
|
||||
#define WF_4BIT 16
|
||||
#define WF_5BIT 32
|
||||
|
||||
/*
|
||||
* ebc buf format
|
||||
*/
|
||||
#define EBC_Y4 (0)
|
||||
#define EBC_Y8 (1)
|
||||
|
||||
/*
|
||||
* ebc status notify
|
||||
*/
|
||||
@@ -36,14 +47,25 @@
|
||||
/*
|
||||
* ebc system ioctl command
|
||||
*/
|
||||
#define EBC_GET_BUFFER (0x7000)
|
||||
#define EBC_SEND_BUFFER (0x7001)
|
||||
#define EBC_GET_BUFFER_INFO (0x7002)
|
||||
#define EBC_GET_BUFFER (0x7000)
|
||||
#define EBC_SEND_BUFFER (0x7001)
|
||||
#define EBC_GET_BUFFER_INFO (0x7002)
|
||||
#define EBC_SET_FULL_MODE_NUM (0x7003)
|
||||
#define EBC_ENABLE_OVERLAY (0x7004)
|
||||
#define EBC_DISABLE_OVERLAY (0x7005)
|
||||
#define EBC_GET_OSD_BUFFER (0x7006)
|
||||
#define EBC_SEND_OSD_BUFFER (0x7007)
|
||||
#define EBC_ENABLE_OVERLAY (0x7004)
|
||||
#define EBC_DISABLE_OVERLAY (0x7005)
|
||||
#define EBC_GET_OSD_BUFFER (0x7006)
|
||||
#define EBC_SEND_OSD_BUFFER (0x7007)
|
||||
#define EBC_NEW_BUF_PREPARE (0x7008)
|
||||
#define EBC_SET_DIFF_PERCENT (0x7009)
|
||||
#define EBC_WAIT_NEW_BUF_TIME (0x700a)
|
||||
#define EBC_GET_OVERLAY_STATUS (0x700b)
|
||||
#define EBC_ENABLE_BG_CONTROL (0x700c)
|
||||
#define EBC_DISABLE_BG_CONTROL (0x700d)
|
||||
#define EBC_ENABLE_RESUME_COUNT (0x700e)
|
||||
#define EBC_DISABLE_RESUME_COUNT (0x700f)
|
||||
#define EBC_GET_BUF_FORMAT (0x7010)
|
||||
#define EBC_DROP_PREV_BUFFER (0x7011)
|
||||
#define EBC_GET_STATUS (0x7012)
|
||||
|
||||
/*
|
||||
* IMPORTANT: Those values is corresponding to android hardware program,
|
||||
@@ -64,13 +86,17 @@ enum panel_refresh_mode {
|
||||
EPD_PART_GLD16 = 10,
|
||||
EPD_PART_GCC16 = 11,
|
||||
EPD_A2 = 12,
|
||||
EPD_DU = 13,
|
||||
EPD_RESET = 14,
|
||||
EPD_SUSPEND = 15,
|
||||
EPD_RESUME = 16,
|
||||
EPD_POWER_OFF = 17,
|
||||
EPD_PART_EINK = 18,
|
||||
EPD_FULL_EINK = 19,
|
||||
EPD_A2_DITHER = 13,
|
||||
EPD_DU = 14,
|
||||
EPD_DU4 = 15,
|
||||
EPD_A2_ENTER = 16,
|
||||
EPD_RESET = 17,
|
||||
EPD_SUSPEND = 18,
|
||||
EPD_RESUME = 19,
|
||||
EPD_POWER_OFF = 20,
|
||||
EPD_FORCE_FULL = 21,
|
||||
EPD_AUTO_DU = 22,
|
||||
EPD_AUTO_DU4 = 23,
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -88,6 +114,8 @@ struct ebc_buf_info {
|
||||
int win_y2;
|
||||
int width_mm;
|
||||
int height_mm;
|
||||
int needpic; // 1: buf can not be drop by ebc, 0: buf can drop by ebc 2: regal buf, can not be drop by ebc
|
||||
char tid_name[16];
|
||||
};
|
||||
|
||||
#if IS_ENABLED(CONFIG_ROCKCHIP_EBC_DEV)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
99470
drivers/gpu/drm/rockchip/ebc-dev/ebc_dev_y8_v8.S
Normal file
99470
drivers/gpu/drm/rockchip/ebc-dev/ebc_dev_y8_v8.S
Normal file
File diff suppressed because it is too large
Load Diff
@@ -46,5 +46,7 @@ struct ebc_panel {
|
||||
u32 panel_16bit;
|
||||
u32 panel_color;
|
||||
u32 mirror;
|
||||
u32 disable_logo;
|
||||
u32 rearrange;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "../ebc_dev.h"
|
||||
#include "epd_lut.h"
|
||||
|
||||
static int (*lut_get)(struct epd_lut_data *, enum epd_lut_type, int);
|
||||
static int (*lut_get)(struct epd_lut_data *, enum epd_lut_type, int, int);
|
||||
|
||||
int epd_lut_from_mem_init(void *waveform)
|
||||
{
|
||||
@@ -66,7 +66,13 @@ const char *epd_lut_get_wf_version(void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int epd_lut_get(struct epd_lut_data *output, enum epd_lut_type lut_type, int temperture)
|
||||
int epd_lut_get(struct epd_lut_data *output, enum epd_lut_type lut_type, int temperture, int pic)
|
||||
{
|
||||
return lut_get(output, lut_type, temperture);
|
||||
return lut_get(output, lut_type, temperture, pic);
|
||||
}
|
||||
|
||||
//you can change overlay lut mode here
|
||||
int epd_overlay_lut(void)
|
||||
{
|
||||
return WF_TYPE_GRAY2;
|
||||
}
|
||||
@@ -8,38 +8,31 @@
|
||||
#ifndef EPD_LUT_H
|
||||
#define EPD_LUT_H
|
||||
|
||||
enum epd_lut_type {
|
||||
WF_TYPE_RESET = 1,
|
||||
WF_TYPE_GRAY16 = 2,
|
||||
WF_TYPE_GRAY4 = 3,
|
||||
WF_TYPE_GRAY2 = 4,
|
||||
WF_TYPE_AUTO = 5,
|
||||
WF_TYPE_A2 = 6,
|
||||
WF_TYPE_GC16 = 7,
|
||||
WF_TYPE_GL16 = 8,
|
||||
WF_TYPE_GLR16 = 9,
|
||||
WF_TYPE_GLD16 = 10,
|
||||
WF_TYPE_GCC16 = 11,
|
||||
WF_TYPE_MAX = 12,
|
||||
};
|
||||
#define WF_4BIT 16
|
||||
#define WF_5BIT 32
|
||||
|
||||
enum pvi_wf_mode {
|
||||
PVI_WF_RESET = 0,
|
||||
PVI_WF_DU = 1,
|
||||
PVI_WF_DU4 = 2,
|
||||
PVI_WF_GC16 = 3,
|
||||
PVI_WF_GL16 = 4,
|
||||
PVI_WF_GLR16 = 5,
|
||||
PVI_WF_GLD16 = 6,
|
||||
PVI_WF_A2 = 7,
|
||||
PVI_WF_GCC16 = 8,
|
||||
// same to pvi_wf_mode
|
||||
enum epd_lut_type {
|
||||
WF_TYPE_RESET = 0,
|
||||
WF_TYPE_GRAY2, // like DU
|
||||
WF_TYPE_GRAY4, // like DU4
|
||||
WF_TYPE_GC16,
|
||||
WF_TYPE_GL16,
|
||||
WF_TYPE_GLR16,
|
||||
WF_TYPE_GLD16,
|
||||
WF_TYPE_A2,
|
||||
WF_TYPE_GCC16,
|
||||
PVI_WF_MAX,
|
||||
|
||||
WF_TYPE_AUTO, // like GC16, rk define
|
||||
WF_TYPE_MAX,
|
||||
WF_TYPE_GRAY16,
|
||||
};
|
||||
|
||||
struct epd_lut_data {
|
||||
unsigned int frame_num;
|
||||
unsigned int *data;
|
||||
u8 *wf_table;
|
||||
u8 *wf_table[2];
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -48,19 +41,22 @@ struct epd_lut_data {
|
||||
int epd_lut_from_mem_init(void *waveform);
|
||||
int epd_lut_from_file_init(struct device *dev, void *waveform, int size);
|
||||
const char *epd_lut_get_wf_version(void);
|
||||
int epd_lut_get(struct epd_lut_data *output, enum epd_lut_type lut_type, int temperture);
|
||||
int epd_lut_get(struct epd_lut_data *output, enum epd_lut_type lut_type, int temperture, int pic);
|
||||
|
||||
//you can change overlay lut mode here
|
||||
int epd_overlay_lut(void);
|
||||
|
||||
/*
|
||||
* PVI Waveform Interfaces
|
||||
*/
|
||||
int pvi_wf_input(void *waveform_file);
|
||||
const char *pvi_wf_get_version(void);
|
||||
int pvi_wf_get_lut(struct epd_lut_data *output, enum epd_lut_type lut_type, int temperture);
|
||||
int pvi_wf_get_lut(struct epd_lut_data *output, enum epd_lut_type lut_type, int temperture, int pic);
|
||||
|
||||
/*
|
||||
* RKF Waveform Interfaces
|
||||
*/
|
||||
int rkf_wf_input(void *waveform_file);
|
||||
const char *rkf_wf_get_version(void);
|
||||
int rkf_wf_get_lut(struct epd_lut_data *output, enum epd_lut_type lut_type, int temperture);
|
||||
int rkf_wf_get_lut(struct epd_lut_data *output, enum epd_lut_type lut_type, int temperture, int pic);
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -506,6 +506,8 @@ static void papyrus_pm_resume(struct ebc_pmic *pmic)
|
||||
usleep_range(2 * 1000, 3 * 1000);
|
||||
mutex_unlock(&s->power_lock);
|
||||
|
||||
s->enable_reg_shadow = 0;
|
||||
|
||||
//trigger temperature measurement
|
||||
papyrus_hw_setreg(s, PAPYRUS_ADDR_TMST1, 0x80);
|
||||
queue_delayed_work(s->tmp_monitor_wq, &s->tmp_delay_work,
|
||||
@@ -580,12 +582,6 @@ static int papyrus_probe(struct ebc_pmic *pmic, struct i2c_client *client)
|
||||
return stat;
|
||||
}
|
||||
|
||||
sess->tmp_monitor_wq = alloc_ordered_workqueue("%s",
|
||||
WQ_MEM_RECLAIM | WQ_FREEZABLE, "tps-tmp-monitor-wq");
|
||||
INIT_DELAYED_WORK(&sess->tmp_delay_work, papyrus_tmp_work);
|
||||
queue_delayed_work(sess->tmp_monitor_wq, &sess->tmp_delay_work,
|
||||
msecs_to_jiffies(10000));
|
||||
|
||||
stat = papyrus_hw_init(sess);
|
||||
if (stat)
|
||||
return stat;
|
||||
@@ -607,6 +603,12 @@ static int papyrus_probe(struct ebc_pmic *pmic, struct i2c_client *client)
|
||||
pmic->pmic_power_req = papyrus_hw_power_req;
|
||||
pmic->pmic_read_temperature = papyrus_hw_read_temperature;
|
||||
|
||||
sess->tmp_monitor_wq = alloc_ordered_workqueue("%s",
|
||||
WQ_MEM_RECLAIM | WQ_FREEZABLE, "tps-tmp-monitor-wq");
|
||||
INIT_DELAYED_WORK(&sess->tmp_delay_work, papyrus_tmp_work);
|
||||
|
||||
queue_delayed_work(sess->tmp_monitor_wq, &sess->tmp_delay_work,
|
||||
msecs_to_jiffies(10000));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -639,8 +641,21 @@ static int tps65185_probe(struct i2c_client *client, const struct i2c_device_id
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0)
|
||||
static int tps65185_remove(struct i2c_client *client)
|
||||
#else
|
||||
static void tps65185_remove(struct i2c_client *client)
|
||||
#endif
|
||||
{
|
||||
struct ebc_pmic *pmic = i2c_get_clientdata(client);
|
||||
struct papyrus_sess *sess = pmic->drvpar;
|
||||
|
||||
if (sess->tmp_monitor_wq)
|
||||
destroy_workqueue(sess->tmp_monitor_wq);
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0)
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static const struct i2c_device_id tps65185_id[] = {
|
||||
|
||||
@@ -163,23 +163,37 @@ static inline void tcon_cfg_done(struct ebc_tcon *tcon)
|
||||
|
||||
static int tcon_enable(struct ebc_tcon *tcon, struct ebc_panel *panel)
|
||||
{
|
||||
u32 width, height, vir_width, vir_height;
|
||||
|
||||
clk_prepare_enable(tcon->hclk);
|
||||
clk_prepare_enable(tcon->dclk);
|
||||
pm_runtime_get_sync(tcon->dev);
|
||||
|
||||
if (panel->rearrange) {
|
||||
width = panel->width * 2;
|
||||
height = panel->height / 2;
|
||||
vir_width = panel->vir_width * 2;
|
||||
vir_height = panel->vir_height / 2;
|
||||
} else {
|
||||
width = panel->width;
|
||||
height = panel->height;
|
||||
vir_width = panel->vir_width;
|
||||
vir_height = panel->vir_height;
|
||||
}
|
||||
|
||||
/* panel timing and win info config */
|
||||
tcon_write(tcon, EBC_DSP_HTIMING0,
|
||||
DSP_HTOTAL(panel->lsl + panel->lbl + panel->ldl + panel->lel) | DSP_HS_END(panel->lsl + 2));
|
||||
DSP_HTOTAL(panel->lsl + panel->lbl + panel->ldl + panel->lel) | DSP_HS_END(panel->lsl));
|
||||
tcon_write(tcon, EBC_DSP_HTIMING1,
|
||||
DSP_HACT_END(panel->lsl + panel->lbl + panel->ldl) | DSP_HACT_ST(panel->lsl + panel->lbl - 1));
|
||||
tcon_write(tcon, EBC_DSP_VTIMING0,
|
||||
DSP_VTOTAL(panel->fsl + panel->fbl + panel->fdl + panel->fel) | DSP_VS_END(panel->fsl));
|
||||
tcon_write(tcon, EBC_DSP_VTIMING1,
|
||||
DSP_VACT_END(panel->fsl + panel->fbl + panel->fdl) | DSP_VACT_ST(panel->fsl + panel->fbl));
|
||||
tcon_write(tcon, EBC_DSP_ACT_INFO, DSP_HEIGHT(panel->height) | DSP_WIDTH(panel->width));
|
||||
tcon_write(tcon, EBC_WIN_VIR, WIN_VIR_HEIGHT(panel->vir_height) | WIN_VIR_WIDTH(panel->vir_width));
|
||||
tcon_write(tcon, EBC_WIN_ACT, WIN_ACT_HEIGHT(panel->height) | WIN_ACT_WIDTH(panel->width));
|
||||
tcon_write(tcon, EBC_WIN_DSP, WIN_DSP_HEIGHT(panel->height) | WIN_DSP_WIDTH(panel->width));
|
||||
tcon_write(tcon, EBC_DSP_ACT_INFO, DSP_HEIGHT(height) | DSP_WIDTH(width));
|
||||
tcon_write(tcon, EBC_WIN_VIR, WIN_VIR_HEIGHT(vir_height) | WIN_VIR_WIDTH(vir_width));
|
||||
tcon_write(tcon, EBC_WIN_ACT, WIN_ACT_HEIGHT(height) | WIN_ACT_WIDTH(width));
|
||||
tcon_write(tcon, EBC_WIN_DSP, WIN_DSP_HEIGHT(height) | WIN_DSP_WIDTH(width));
|
||||
tcon_write(tcon, EBC_WIN_DSP_ST, WIN_DSP_YST(panel->fsl + panel->fbl) | WIN_DSP_XST(panel->lsl + panel->lbl));
|
||||
|
||||
/* win2 fifo is 512x128, win fifo is 256x128, we set fifo almost value (fifo_size - 16)
|
||||
@@ -209,7 +223,7 @@ static int tcon_enable(struct ebc_tcon *tcon, struct ebc_panel *panel)
|
||||
| EPD_SDSHR(1));
|
||||
tcon_write(tcon, EBC_DSP_START, DSP_SDCE_WIDTH(panel->ldl) | SW_BURST_CTRL);
|
||||
tcon_write(tcon, EBC_DSP_CTRL,
|
||||
DSP_SWAP_MODE(panel->panel_16bit ? 2 : 3) | DSP_VCOM_MODE(1) | DSP_SDCLK_DIV(panel->panel_16bit ? 7 : 3));
|
||||
DSP_SWAP_MODE(panel->panel_16bit ? 2 : 3) | DSP_VCOM_MODE(1) | DSP_SDCLK_DIV(0));
|
||||
tcon_cfg_done(tcon);
|
||||
|
||||
enable_irq(tcon->irq);
|
||||
@@ -293,7 +307,7 @@ static irqreturn_t tcon_irq_hanlder(int irq, void *dev_id)
|
||||
intr_status = tcon_read(tcon, EBC_INT_STATUS);
|
||||
|
||||
if (intr_status & DSP_END_INT) {
|
||||
tcon_update_bits(tcon, EBC_INT_STATUS, DSP_END_INT_CLR, DSP_END_INT_CLR);
|
||||
tcon_update_bits(tcon, EBC_INT_STATUS, DSP_END_INT_CLR | LINE_FLAG_INT_CLR, DSP_END_INT_CLR | LINE_FLAG_INT_CLR);
|
||||
|
||||
if (tcon->dsp_end_callback)
|
||||
tcon->dsp_end_callback();
|
||||
|
||||
@@ -37,7 +37,6 @@ struct ebc_tcon {
|
||||
void (*frame_addr_set)(struct ebc_tcon *tcon, u32 frame_addr);
|
||||
int (*lut_data_set)(struct ebc_tcon *tcon, unsigned int *lut_data, int frame_count, int lut_32);
|
||||
void (*frame_start)(struct ebc_tcon *tcon, int frame_total);
|
||||
|
||||
void (*dsp_end_callback)(void);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user