23 #include <linux/kernel.h>
24 #include <linux/module.h>
29 #include <linux/sched.h>
35 #define MIPID_CMD_READ_DISP_ID 0x04
36 #define MIPID_CMD_READ_RED 0x06
37 #define MIPID_CMD_READ_GREEN 0x07
38 #define MIPID_CMD_READ_BLUE 0x08
39 #define MIPID_CMD_READ_DISP_STATUS 0x09
40 #define MIPID_CMD_RDDSDR 0x0F
41 #define MIPID_CMD_SLEEP_IN 0x10
42 #define MIPID_CMD_SLEEP_OUT 0x11
43 #define MIPID_CMD_DISP_OFF 0x28
44 #define MIPID_CMD_DISP_ON 0x29
45 #define MIPID_CMD_WRITE_DISP_BRIGHTNESS 0x51
46 #define MIPID_CMD_READ_DISP_BRIGHTNESS 0x52
47 #define MIPID_CMD_WRITE_CTRL_DISP 0x53
49 #define CTRL_DISP_BRIGHTNESS_CTRL_ON (1 << 5)
50 #define CTRL_DISP_AMBIENT_LIGHT_CTRL_ON (1 << 4)
51 #define CTRL_DISP_BACKLIGHT_ON (1 << 2)
52 #define CTRL_DISP_AUTO_BRIGHTNESS_ON (1 << 1)
54 #define MIPID_CMD_READ_CTRL_DISP 0x54
55 #define MIPID_CMD_WRITE_CABC 0x55
56 #define MIPID_CMD_READ_CABC 0x56
58 #define MIPID_VER_LPH8923 3
59 #define MIPID_VER_LS041Y3 4
60 #define MIPID_VER_L4F00311 8
61 #define MIPID_VER_ACX565AKM 9
90 const u8 *wbuf,
int wlen,
u8 *rbuf,
int rlen)
100 memset(xfer, 0,
sizeof(xfer));
108 if (rlen > 1 && wlen == 0) {
117 spi_message_add_tail(x, &
m);
124 spi_message_add_tail(x, &
m);
131 spi_message_add_tail(x, &
m);
141 acx565akm_transfer(md, cmd,
NULL, 0,
NULL, 0);
147 acx565akm_transfer(md, reg, buf, len,
NULL, 0);
153 acx565akm_transfer(md, reg,
NULL, 0, buf, len);
166 if ((
long)wait > 0 && wait <= md->hw_guard_wait) {
187 acx565akm_cmd(md, cmd);
188 hw_guard_start(md, 120);
195 acx565akm_cmd(md, cmd);
205 enabled = (disp_status & (1 << 17)) && (disp_status & (1 << 10));
207 "LCD panel %senabled by bootloader (status 0x%04x)\n",
208 enabled ?
"" :
"not ", disp_status);
215 dev_dbg(&md->
spi->dev,
"MIPI display ID: %02x%02x%02x\n",
221 md->
name =
"acx565akm";
227 md->
name =
"l4f00311";
231 md->
name =
"lph8923";
235 md->
name =
"ls041y3";
238 md->
name =
"unknown";
239 dev_err(&md->
spi->dev,
"invalid display ID\n");
245 dev_info(&md->
spi->dev,
"omapfb: %s rev %02x LCD detected\n",
280 cabc_ctrl |= (1 << 8) | (mode & 3);
294 return cabc_ctrl & 3;
301 bv = level | (1 << 8);
305 enable_backlight_ctrl(md, 1);
307 enable_backlight_ctrl(md, 0);
332 level = dev->
props.brightness;
338 acx565akm_set_brightness(md, level);
339 else if (md->
dssdev->set_backlight)
361 return acx565akm_get_actual_brightness(md);
363 return dev->
props.brightness;
370 .get_brightness = acx565akm_bl_get_intensity,
371 .update_status = acx565akm_bl_update_status,
376 static const char *cabc_modes[] = {
388 const char *mode_str;
395 mode = get_cabc_mode(md);
396 mode_str =
"unknown";
397 if (mode >= 0 && mode <
ARRAY_SIZE(cabc_modes))
398 mode_str = cabc_modes[
mode];
406 const char *buf,
size_t count)
411 for (i = 0; i <
ARRAY_SIZE(cabc_modes); i++) {
412 const char *mode_str = cabc_modes[
i];
413 int cmp_len =
strlen(mode_str);
415 if (count > 0 && buf[count - 1] ==
'\n')
417 if (count != cmp_len)
420 if (
strncmp(buf, mode_str, cmp_len) == 0)
431 set_cabc_mode(md, i);
451 i ?
" " :
"", cabc_modes[i],
458 show_cabc_mode, store_cabc_mode);
460 show_cabc_available_modes,
NULL);
462 static struct attribute *bldev_attrs[] = {
463 &dev_attr_cabc_mode.attr,
464 &dev_attr_cabc_available_modes.attr,
469 .attrs = bldev_attrs,
483 .pixel_clock = 24000,
510 dssdev->
panel.timings = acx_panel_timings;
520 md->
enabled = panel_enabled(md);
522 r = panel_detect(md);
524 dev_err(&dssdev->
dev,
"%s panel detect error\n", __func__);
541 memset(&props, 0,
sizeof(props));
547 md, &acx565akm_bl_ops, &props);
553 "%s failed to create sysfs files\n", __func__);
561 max_brightness = 255;
566 brightness = acx565akm_get_actual_brightness(md);
575 acx565akm_bl_update_status(bldev);
587 acx_dev.dssdev =
NULL;
608 pr_err(
"%s sdi enable failed\n", __func__);
622 dev_dbg(&md->
spi->dev,
"panel already enabled\n");
637 set_sleep_mode(md, 0);
642 set_display_state(md, 1);
647 return acx565akm_bl_update_status(md->
bl_dev);
670 set_display_state(md, 0);
671 set_sleep_mode(md, 1);
697 r = acx_panel_power_on(dssdev);
709 acx_panel_power_off(dssdev);
716 acx_panel_power_off(dssdev);
726 r = acx_panel_power_on(dssdev);
739 dssdev->
panel.timings = *timings;
750 .probe = acx_panel_probe,
751 .remove = acx_panel_remove,
753 .enable = acx_panel_enable,
754 .disable = acx_panel_disable,
755 .suspend = acx_panel_suspend,
756 .resume = acx_panel_resume,
758 .set_timings = acx_panel_set_timings,
759 .check_timings = acx_panel_check_timings,
761 .get_recommended_bpp = acx_get_recommended_bpp,
764 .name =
"panel-acx565akm",
797 static struct spi_driver acx565akm_spi_driver = {
802 .probe = acx565akm_spi_probe,