2 * Sony ACX565AKM LCD Panel driver
4 * Copyright (C) 2010 Nokia Corporation
6 * Original Driver Author: Imre Deak <imre.deak@nokia.com>
7 * Based on panel-generic.c by Tomi Valkeinen <tomi.valkeinen@nokia.com>
8 * Adapted to new DSS2 framework: Roger Quadros <roger.quadros@nokia.com>
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License version 2 as published by
12 * the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19 * You should have received a copy of the GNU General Public License along with
20 * this program. If not, see <http://www.gnu.org/licenses/>.
23 #include <linux/kernel.h>
24 #include <linux/module.h>
25 #include <linux/platform_device.h>
26 #include <linux/delay.h>
27 #include <linux/spi/spi.h>
28 #include <linux/jiffies.h>
29 #include <linux/sched.h>
30 #include <linux/backlight.h>
32 #include <linux/gpio/consumer.h>
34 #include <linux/of_gpio.h>
36 #include <video/omap-panel-data.h>
38 #include "../dss/omapdss.h"
40 #define MIPID_CMD_READ_DISP_ID 0x04
41 #define MIPID_CMD_READ_RED 0x06
42 #define MIPID_CMD_READ_GREEN 0x07
43 #define MIPID_CMD_READ_BLUE 0x08
44 #define MIPID_CMD_READ_DISP_STATUS 0x09
45 #define MIPID_CMD_RDDSDR 0x0F
46 #define MIPID_CMD_SLEEP_IN 0x10
47 #define MIPID_CMD_SLEEP_OUT 0x11
48 #define MIPID_CMD_DISP_OFF 0x28
49 #define MIPID_CMD_DISP_ON 0x29
50 #define MIPID_CMD_WRITE_DISP_BRIGHTNESS 0x51
51 #define MIPID_CMD_READ_DISP_BRIGHTNESS 0x52
52 #define MIPID_CMD_WRITE_CTRL_DISP 0x53
54 #define CTRL_DISP_BRIGHTNESS_CTRL_ON (1 << 5)
55 #define CTRL_DISP_AMBIENT_LIGHT_CTRL_ON (1 << 4)
56 #define CTRL_DISP_BACKLIGHT_ON (1 << 2)
57 #define CTRL_DISP_AUTO_BRIGHTNESS_ON (1 << 1)
59 #define MIPID_CMD_READ_CTRL_DISP 0x54
60 #define MIPID_CMD_WRITE_CABC 0x55
61 #define MIPID_CMD_READ_CABC 0x56
63 #define MIPID_VER_LPH8923 3
64 #define MIPID_VER_LS041Y3 4
65 #define MIPID_VER_L4F00311 8
66 #define MIPID_VER_ACX565AKM 9
68 struct panel_drv_data
{
69 struct omap_dss_device dssdev
;
70 struct omap_dss_device
*in
;
75 struct omap_video_timings videomode
;
85 unsigned long hw_guard_end
; /* next value of jiffies
87 next sleep in/out command */
88 unsigned long hw_guard_wait
; /* max guard time in jiffies */
90 struct spi_device
*spi
;
93 struct backlight_device
*bl_dev
;
96 static const struct omap_video_timings acx565akm_panel_timings
= {
99 .pixelclock
= 24000000,
107 .vsync_level
= OMAPDSS_SIG_ACTIVE_LOW
,
108 .hsync_level
= OMAPDSS_SIG_ACTIVE_LOW
,
110 .data_pclk_edge
= OMAPDSS_DRIVE_SIG_RISING_EDGE
,
111 .de_level
= OMAPDSS_SIG_ACTIVE_HIGH
,
112 .sync_pclk_edge
= OMAPDSS_DRIVE_SIG_FALLING_EDGE
,
115 #define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
117 static void acx565akm_transfer(struct panel_drv_data
*ddata
, int cmd
,
118 const u8
*wbuf
, int wlen
, u8
*rbuf
, int rlen
)
120 struct spi_message m
;
121 struct spi_transfer
*x
, xfer
[5];
124 BUG_ON(ddata
->spi
== NULL
);
126 spi_message_init(&m
);
128 memset(xfer
, 0, sizeof(xfer
));
133 x
->bits_per_word
= 9;
136 if (rlen
> 1 && wlen
== 0) {
138 * Between the command and the response data there is a
139 * dummy clock cycle. Add an extra bit after the command
140 * word to account for this.
142 x
->bits_per_word
= 10;
145 spi_message_add_tail(x
, &m
);
151 x
->bits_per_word
= 9;
152 spi_message_add_tail(x
, &m
);
159 spi_message_add_tail(x
, &m
);
162 r
= spi_sync(ddata
->spi
, &m
);
164 dev_dbg(&ddata
->spi
->dev
, "spi_sync %d\n", r
);
167 static inline void acx565akm_cmd(struct panel_drv_data
*ddata
, int cmd
)
169 acx565akm_transfer(ddata
, cmd
, NULL
, 0, NULL
, 0);
172 static inline void acx565akm_write(struct panel_drv_data
*ddata
,
173 int reg
, const u8
*buf
, int len
)
175 acx565akm_transfer(ddata
, reg
, buf
, len
, NULL
, 0);
178 static inline void acx565akm_read(struct panel_drv_data
*ddata
,
179 int reg
, u8
*buf
, int len
)
181 acx565akm_transfer(ddata
, reg
, NULL
, 0, buf
, len
);
184 static void hw_guard_start(struct panel_drv_data
*ddata
, int guard_msec
)
186 ddata
->hw_guard_wait
= msecs_to_jiffies(guard_msec
);
187 ddata
->hw_guard_end
= jiffies
+ ddata
->hw_guard_wait
;
190 static void hw_guard_wait(struct panel_drv_data
*ddata
)
192 unsigned long wait
= ddata
->hw_guard_end
- jiffies
;
194 if ((long)wait
> 0 && wait
<= ddata
->hw_guard_wait
) {
195 set_current_state(TASK_UNINTERRUPTIBLE
);
196 schedule_timeout(wait
);
200 static void set_sleep_mode(struct panel_drv_data
*ddata
, int on
)
205 cmd
= MIPID_CMD_SLEEP_IN
;
207 cmd
= MIPID_CMD_SLEEP_OUT
;
209 * We have to keep 120msec between sleep in/out commands.
212 hw_guard_wait(ddata
);
213 acx565akm_cmd(ddata
, cmd
);
214 hw_guard_start(ddata
, 120);
217 static void set_display_state(struct panel_drv_data
*ddata
, int enabled
)
219 int cmd
= enabled
? MIPID_CMD_DISP_ON
: MIPID_CMD_DISP_OFF
;
221 acx565akm_cmd(ddata
, cmd
);
224 static int panel_enabled(struct panel_drv_data
*ddata
)
229 acx565akm_read(ddata
, MIPID_CMD_READ_DISP_STATUS
,
230 (u8
*)&disp_status
, 4);
231 disp_status
= __be32_to_cpu(disp_status
);
232 enabled
= (disp_status
& (1 << 17)) && (disp_status
& (1 << 10));
233 dev_dbg(&ddata
->spi
->dev
,
234 "LCD panel %senabled by bootloader (status 0x%04x)\n",
235 enabled
? "" : "not ", disp_status
);
239 static int panel_detect(struct panel_drv_data
*ddata
)
241 acx565akm_read(ddata
, MIPID_CMD_READ_DISP_ID
, ddata
->display_id
, 3);
242 dev_dbg(&ddata
->spi
->dev
, "MIPI display ID: %02x%02x%02x\n",
243 ddata
->display_id
[0],
244 ddata
->display_id
[1],
245 ddata
->display_id
[2]);
247 switch (ddata
->display_id
[0]) {
249 ddata
->model
= MIPID_VER_ACX565AKM
;
250 ddata
->name
= "acx565akm";
255 ddata
->model
= MIPID_VER_L4F00311
;
256 ddata
->name
= "l4f00311";
259 ddata
->model
= MIPID_VER_LPH8923
;
260 ddata
->name
= "lph8923";
263 ddata
->model
= MIPID_VER_LS041Y3
;
264 ddata
->name
= "ls041y3";
267 ddata
->name
= "unknown";
268 dev_err(&ddata
->spi
->dev
, "invalid display ID\n");
272 ddata
->revision
= ddata
->display_id
[1];
274 dev_info(&ddata
->spi
->dev
, "omapfb: %s rev %02x LCD detected\n",
275 ddata
->name
, ddata
->revision
);
280 /*----------------------Backlight Control-------------------------*/
282 static void enable_backlight_ctrl(struct panel_drv_data
*ddata
, int enable
)
286 acx565akm_read(ddata
, MIPID_CMD_READ_CTRL_DISP
, (u8
*)&ctrl
, 1);
288 ctrl
|= CTRL_DISP_BRIGHTNESS_CTRL_ON
|
289 CTRL_DISP_BACKLIGHT_ON
;
291 ctrl
&= ~(CTRL_DISP_BRIGHTNESS_CTRL_ON
|
292 CTRL_DISP_BACKLIGHT_ON
);
296 acx565akm_write(ddata
, MIPID_CMD_WRITE_CTRL_DISP
, (u8
*)&ctrl
, 2);
299 static void set_cabc_mode(struct panel_drv_data
*ddata
, unsigned mode
)
303 ddata
->cabc_mode
= mode
;
307 acx565akm_read(ddata
, MIPID_CMD_READ_CABC
, (u8
*)&cabc_ctrl
, 1);
309 cabc_ctrl
|= (1 << 8) | (mode
& 3);
310 acx565akm_write(ddata
, MIPID_CMD_WRITE_CABC
, (u8
*)&cabc_ctrl
, 2);
313 static unsigned get_cabc_mode(struct panel_drv_data
*ddata
)
315 return ddata
->cabc_mode
;
318 static unsigned get_hw_cabc_mode(struct panel_drv_data
*ddata
)
322 acx565akm_read(ddata
, MIPID_CMD_READ_CABC
, &cabc_ctrl
, 1);
323 return cabc_ctrl
& 3;
326 static void acx565akm_set_brightness(struct panel_drv_data
*ddata
, int level
)
330 bv
= level
| (1 << 8);
331 acx565akm_write(ddata
, MIPID_CMD_WRITE_DISP_BRIGHTNESS
, (u8
*)&bv
, 2);
334 enable_backlight_ctrl(ddata
, 1);
336 enable_backlight_ctrl(ddata
, 0);
339 static int acx565akm_get_actual_brightness(struct panel_drv_data
*ddata
)
343 acx565akm_read(ddata
, MIPID_CMD_READ_DISP_BRIGHTNESS
, &bv
, 1);
349 static int acx565akm_bl_update_status(struct backlight_device
*dev
)
351 struct panel_drv_data
*ddata
= dev_get_drvdata(&dev
->dev
);
354 dev_dbg(&ddata
->spi
->dev
, "%s\n", __func__
);
356 if (dev
->props
.fb_blank
== FB_BLANK_UNBLANK
&&
357 dev
->props
.power
== FB_BLANK_UNBLANK
)
358 level
= dev
->props
.brightness
;
363 acx565akm_set_brightness(ddata
, level
);
370 static int acx565akm_bl_get_intensity(struct backlight_device
*dev
)
372 struct panel_drv_data
*ddata
= dev_get_drvdata(&dev
->dev
);
374 dev_dbg(&dev
->dev
, "%s\n", __func__
);
379 if (dev
->props
.fb_blank
== FB_BLANK_UNBLANK
&&
380 dev
->props
.power
== FB_BLANK_UNBLANK
) {
382 return acx565akm_get_actual_brightness(ddata
);
384 return dev
->props
.brightness
;
390 static int acx565akm_bl_update_status_locked(struct backlight_device
*dev
)
392 struct panel_drv_data
*ddata
= dev_get_drvdata(&dev
->dev
);
395 mutex_lock(&ddata
->mutex
);
396 r
= acx565akm_bl_update_status(dev
);
397 mutex_unlock(&ddata
->mutex
);
402 static int acx565akm_bl_get_intensity_locked(struct backlight_device
*dev
)
404 struct panel_drv_data
*ddata
= dev_get_drvdata(&dev
->dev
);
407 mutex_lock(&ddata
->mutex
);
408 r
= acx565akm_bl_get_intensity(dev
);
409 mutex_unlock(&ddata
->mutex
);
414 static const struct backlight_ops acx565akm_bl_ops
= {
415 .get_brightness
= acx565akm_bl_get_intensity_locked
,
416 .update_status
= acx565akm_bl_update_status_locked
,
419 /*--------------------Auto Brightness control via Sysfs---------------------*/
421 static const char * const cabc_modes
[] = {
422 "off", /* always used when CABC is not supported */
428 static ssize_t
show_cabc_mode(struct device
*dev
,
429 struct device_attribute
*attr
,
432 struct panel_drv_data
*ddata
= dev_get_drvdata(dev
);
433 const char *mode_str
;
437 if (!ddata
->has_cabc
)
440 mode
= get_cabc_mode(ddata
);
441 mode_str
= "unknown";
442 if (mode
>= 0 && mode
< ARRAY_SIZE(cabc_modes
))
443 mode_str
= cabc_modes
[mode
];
444 len
= snprintf(buf
, PAGE_SIZE
, "%s\n", mode_str
);
446 return len
< PAGE_SIZE
- 1 ? len
: PAGE_SIZE
- 1;
449 static ssize_t
store_cabc_mode(struct device
*dev
,
450 struct device_attribute
*attr
,
451 const char *buf
, size_t count
)
453 struct panel_drv_data
*ddata
= dev_get_drvdata(dev
);
456 for (i
= 0; i
< ARRAY_SIZE(cabc_modes
); i
++) {
457 const char *mode_str
= cabc_modes
[i
];
458 int cmp_len
= strlen(mode_str
);
460 if (count
> 0 && buf
[count
- 1] == '\n')
462 if (count
!= cmp_len
)
465 if (strncmp(buf
, mode_str
, cmp_len
) == 0)
469 if (i
== ARRAY_SIZE(cabc_modes
))
472 if (!ddata
->has_cabc
&& i
!= 0)
475 mutex_lock(&ddata
->mutex
);
476 set_cabc_mode(ddata
, i
);
477 mutex_unlock(&ddata
->mutex
);
482 static ssize_t
show_cabc_available_modes(struct device
*dev
,
483 struct device_attribute
*attr
,
486 struct panel_drv_data
*ddata
= dev_get_drvdata(dev
);
490 if (!ddata
->has_cabc
)
491 return snprintf(buf
, PAGE_SIZE
, "%s\n", cabc_modes
[0]);
494 len
< PAGE_SIZE
&& i
< ARRAY_SIZE(cabc_modes
); i
++)
495 len
+= snprintf(&buf
[len
], PAGE_SIZE
- len
, "%s%s%s",
496 i
? " " : "", cabc_modes
[i
],
497 i
== ARRAY_SIZE(cabc_modes
) - 1 ? "\n" : "");
499 return len
< PAGE_SIZE
? len
: PAGE_SIZE
- 1;
502 static DEVICE_ATTR(cabc_mode
, S_IRUGO
| S_IWUSR
,
503 show_cabc_mode
, store_cabc_mode
);
504 static DEVICE_ATTR(cabc_available_modes
, S_IRUGO
,
505 show_cabc_available_modes
, NULL
);
507 static struct attribute
*bldev_attrs
[] = {
508 &dev_attr_cabc_mode
.attr
,
509 &dev_attr_cabc_available_modes
.attr
,
513 static struct attribute_group bldev_attr_group
= {
514 .attrs
= bldev_attrs
,
517 static int acx565akm_connect(struct omap_dss_device
*dssdev
)
519 struct panel_drv_data
*ddata
= to_panel_data(dssdev
);
520 struct omap_dss_device
*in
= ddata
->in
;
523 if (omapdss_device_is_connected(dssdev
))
526 r
= in
->ops
.sdi
->connect(in
, dssdev
);
533 static void acx565akm_disconnect(struct omap_dss_device
*dssdev
)
535 struct panel_drv_data
*ddata
= to_panel_data(dssdev
);
536 struct omap_dss_device
*in
= ddata
->in
;
538 if (!omapdss_device_is_connected(dssdev
))
541 in
->ops
.sdi
->disconnect(in
, dssdev
);
544 static int acx565akm_panel_power_on(struct omap_dss_device
*dssdev
)
546 struct panel_drv_data
*ddata
= to_panel_data(dssdev
);
547 struct omap_dss_device
*in
= ddata
->in
;
550 dev_dbg(&ddata
->spi
->dev
, "%s\n", __func__
);
552 in
->ops
.sdi
->set_timings(in
, &ddata
->videomode
);
554 if (ddata
->datapairs
> 0)
555 in
->ops
.sdi
->set_datapairs(in
, ddata
->datapairs
);
557 r
= in
->ops
.sdi
->enable(in
);
559 pr_err("%s sdi enable failed\n", __func__
);
566 if (gpio_is_valid(ddata
->reset_gpio
))
567 gpio_set_value(ddata
->reset_gpio
, 1);
569 if (ddata
->enabled
) {
570 dev_dbg(&ddata
->spi
->dev
, "panel already enabled\n");
575 * We have to meet all the following delay requirements:
576 * 1. tRW: reset pulse width 10usec (7.12.1)
577 * 2. tRT: reset cancel time 5msec (7.12.1)
578 * 3. Providing PCLK,HS,VS signals for 2 frames = ~50msec worst
580 * 4. 120msec before the sleep out command (7.12.1)
584 set_sleep_mode(ddata
, 0);
587 /* 5msec between sleep out and the next command. (8.2.16) */
588 usleep_range(5000, 10000);
589 set_display_state(ddata
, 1);
590 set_cabc_mode(ddata
, ddata
->cabc_mode
);
592 return acx565akm_bl_update_status(ddata
->bl_dev
);
595 static void acx565akm_panel_power_off(struct omap_dss_device
*dssdev
)
597 struct panel_drv_data
*ddata
= to_panel_data(dssdev
);
598 struct omap_dss_device
*in
= ddata
->in
;
600 dev_dbg(dssdev
->dev
, "%s\n", __func__
);
605 set_display_state(ddata
, 0);
606 set_sleep_mode(ddata
, 1);
609 * We have to provide PCLK,HS,VS signals for 2 frames (worst case
610 * ~50msec) after sending the sleep in command and asserting the
611 * reset signal. We probably could assert the reset w/o the delay
612 * but we still delay to avoid possible artifacts. (7.6.1)
616 if (gpio_is_valid(ddata
->reset_gpio
))
617 gpio_set_value(ddata
->reset_gpio
, 0);
619 /* FIXME need to tweak this delay */
622 in
->ops
.sdi
->disable(in
);
625 static int acx565akm_enable(struct omap_dss_device
*dssdev
)
627 struct panel_drv_data
*ddata
= to_panel_data(dssdev
);
630 dev_dbg(dssdev
->dev
, "%s\n", __func__
);
632 if (!omapdss_device_is_connected(dssdev
))
635 if (omapdss_device_is_enabled(dssdev
))
638 mutex_lock(&ddata
->mutex
);
639 r
= acx565akm_panel_power_on(dssdev
);
640 mutex_unlock(&ddata
->mutex
);
644 dssdev
->state
= OMAP_DSS_DISPLAY_ACTIVE
;
649 static void acx565akm_disable(struct omap_dss_device
*dssdev
)
651 struct panel_drv_data
*ddata
= to_panel_data(dssdev
);
653 dev_dbg(dssdev
->dev
, "%s\n", __func__
);
655 if (!omapdss_device_is_enabled(dssdev
))
658 mutex_lock(&ddata
->mutex
);
659 acx565akm_panel_power_off(dssdev
);
660 mutex_unlock(&ddata
->mutex
);
662 dssdev
->state
= OMAP_DSS_DISPLAY_DISABLED
;
665 static void acx565akm_set_timings(struct omap_dss_device
*dssdev
,
666 struct omap_video_timings
*timings
)
668 struct panel_drv_data
*ddata
= to_panel_data(dssdev
);
669 struct omap_dss_device
*in
= ddata
->in
;
671 ddata
->videomode
= *timings
;
672 dssdev
->panel
.timings
= *timings
;
674 in
->ops
.sdi
->set_timings(in
, timings
);
677 static void acx565akm_get_timings(struct omap_dss_device
*dssdev
,
678 struct omap_video_timings
*timings
)
680 struct panel_drv_data
*ddata
= to_panel_data(dssdev
);
682 *timings
= ddata
->videomode
;
685 static int acx565akm_check_timings(struct omap_dss_device
*dssdev
,
686 struct omap_video_timings
*timings
)
688 struct panel_drv_data
*ddata
= to_panel_data(dssdev
);
689 struct omap_dss_device
*in
= ddata
->in
;
691 return in
->ops
.sdi
->check_timings(in
, timings
);
694 static struct omap_dss_driver acx565akm_ops
= {
695 .connect
= acx565akm_connect
,
696 .disconnect
= acx565akm_disconnect
,
698 .enable
= acx565akm_enable
,
699 .disable
= acx565akm_disable
,
701 .set_timings
= acx565akm_set_timings
,
702 .get_timings
= acx565akm_get_timings
,
703 .check_timings
= acx565akm_check_timings
,
705 .get_resolution
= omapdss_default_get_resolution
,
708 static int acx565akm_probe_pdata(struct spi_device
*spi
)
710 const struct panel_acx565akm_platform_data
*pdata
;
711 struct panel_drv_data
*ddata
= dev_get_drvdata(&spi
->dev
);
712 struct omap_dss_device
*dssdev
, *in
;
714 pdata
= dev_get_platdata(&spi
->dev
);
716 ddata
->reset_gpio
= pdata
->reset_gpio
;
718 in
= omap_dss_find_output(pdata
->source
);
720 dev_err(&spi
->dev
, "failed to find video source '%s'\n",
722 return -EPROBE_DEFER
;
726 ddata
->datapairs
= pdata
->datapairs
;
728 dssdev
= &ddata
->dssdev
;
729 dssdev
->name
= pdata
->name
;
734 static int acx565akm_probe_of(struct spi_device
*spi
)
736 struct panel_drv_data
*ddata
= dev_get_drvdata(&spi
->dev
);
737 struct device_node
*np
= spi
->dev
.of_node
;
739 ddata
->reset_gpio
= of_get_named_gpio(np
, "reset-gpios", 0);
741 ddata
->in
= omapdss_of_find_source_for_first_ep(np
);
742 if (IS_ERR(ddata
->in
)) {
743 dev_err(&spi
->dev
, "failed to find video source\n");
744 return PTR_ERR(ddata
->in
);
750 static int acx565akm_probe(struct spi_device
*spi
)
752 struct panel_drv_data
*ddata
;
753 struct omap_dss_device
*dssdev
;
754 struct backlight_device
*bldev
;
755 int max_brightness
, brightness
;
756 struct backlight_properties props
;
759 dev_dbg(&spi
->dev
, "%s\n", __func__
);
761 spi
->mode
= SPI_MODE_3
;
763 ddata
= devm_kzalloc(&spi
->dev
, sizeof(*ddata
), GFP_KERNEL
);
767 dev_set_drvdata(&spi
->dev
, ddata
);
771 mutex_init(&ddata
->mutex
);
773 if (dev_get_platdata(&spi
->dev
)) {
774 r
= acx565akm_probe_pdata(spi
);
777 } else if (spi
->dev
.of_node
) {
778 r
= acx565akm_probe_of(spi
);
782 dev_err(&spi
->dev
, "platform data missing!\n");
786 if (gpio_is_valid(ddata
->reset_gpio
)) {
787 r
= devm_gpio_request_one(&spi
->dev
, ddata
->reset_gpio
,
788 GPIOF_OUT_INIT_LOW
, "lcd reset");
793 if (gpio_is_valid(ddata
->reset_gpio
))
794 gpio_set_value(ddata
->reset_gpio
, 1);
797 * After reset we have to wait 5 msec before the first
798 * command can be sent.
800 usleep_range(5000, 10000);
802 ddata
->enabled
= panel_enabled(ddata
);
804 r
= panel_detect(ddata
);
806 if (!ddata
->enabled
&& gpio_is_valid(ddata
->reset_gpio
))
807 gpio_set_value(ddata
->reset_gpio
, 0);
810 dev_err(&spi
->dev
, "%s panel detect error\n", __func__
);
814 memset(&props
, 0, sizeof(props
));
815 props
.fb_blank
= FB_BLANK_UNBLANK
;
816 props
.power
= FB_BLANK_UNBLANK
;
817 props
.type
= BACKLIGHT_RAW
;
819 bldev
= backlight_device_register("acx565akm", &ddata
->spi
->dev
,
820 ddata
, &acx565akm_bl_ops
, &props
);
825 ddata
->bl_dev
= bldev
;
826 if (ddata
->has_cabc
) {
827 r
= sysfs_create_group(&bldev
->dev
.kobj
, &bldev_attr_group
);
830 "%s failed to create sysfs files\n", __func__
);
833 ddata
->cabc_mode
= get_hw_cabc_mode(ddata
);
836 max_brightness
= 255;
839 brightness
= acx565akm_get_actual_brightness(ddata
);
843 bldev
->props
.max_brightness
= max_brightness
;
844 bldev
->props
.brightness
= brightness
;
846 acx565akm_bl_update_status(bldev
);
849 ddata
->videomode
= acx565akm_panel_timings
;
851 dssdev
= &ddata
->dssdev
;
852 dssdev
->dev
= &spi
->dev
;
853 dssdev
->driver
= &acx565akm_ops
;
854 dssdev
->type
= OMAP_DISPLAY_TYPE_SDI
;
855 dssdev
->owner
= THIS_MODULE
;
856 dssdev
->panel
.timings
= ddata
->videomode
;
858 r
= omapdss_register_display(dssdev
);
860 dev_err(&spi
->dev
, "Failed to register panel\n");
867 sysfs_remove_group(&bldev
->dev
.kobj
, &bldev_attr_group
);
869 backlight_device_unregister(bldev
);
873 omap_dss_put_device(ddata
->in
);
877 static int acx565akm_remove(struct spi_device
*spi
)
879 struct panel_drv_data
*ddata
= dev_get_drvdata(&spi
->dev
);
880 struct omap_dss_device
*dssdev
= &ddata
->dssdev
;
881 struct omap_dss_device
*in
= ddata
->in
;
883 dev_dbg(&ddata
->spi
->dev
, "%s\n", __func__
);
885 sysfs_remove_group(&ddata
->bl_dev
->dev
.kobj
, &bldev_attr_group
);
886 backlight_device_unregister(ddata
->bl_dev
);
888 omapdss_unregister_display(dssdev
);
890 acx565akm_disable(dssdev
);
891 acx565akm_disconnect(dssdev
);
893 omap_dss_put_device(in
);
898 static const struct of_device_id acx565akm_of_match
[] = {
899 { .compatible
= "omapdss,sony,acx565akm", },
902 MODULE_DEVICE_TABLE(of
, acx565akm_of_match
);
904 static struct spi_driver acx565akm_driver
= {
907 .of_match_table
= acx565akm_of_match
,
908 .suppress_bind_attrs
= true,
910 .probe
= acx565akm_probe
,
911 .remove
= acx565akm_remove
,
914 module_spi_driver(acx565akm_driver
);
916 MODULE_AUTHOR("Nokia Corporation");
917 MODULE_DESCRIPTION("acx565akm LCD Driver");
918 MODULE_LICENSE("GPL");