summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-09-05 09:44:03 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-05 09:44:03 -0700
commiteced5a0a5a8f7a3b07320e3b7d1d432e0f044735 (patch)
tree043192035e9d9fb77f052ae4dc6fa21ea257efc0 /drivers
parent7c049d086941a74c1babac6dc6901b88e1ce5b7e (diff)
parent9560dc1059222d059d494a64e5da4c54d23838da (diff)
Merge tag 'fbdev-3.12-omap-legacy-removal' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux
Pull OMAP specific fbdev changes from Tomi Valkeinen: "I've got this pull request separate from the main fbdev pull request, as this contains a bunch of OMAP board file changes and thus could possibly be rejected in case of bad conflicts. The removal of the old display drivers depend on the board file changes, so Tony Lindgren suggested taking them together via fbdev tree. These are in linux-next, and also Tony didn't see any conflicts with any of the branches he had, so they should go in clean. - Change the OMAP board files to use the new OMAP display drivers - Remove all the old drivers, and the related auxiliary code" * tag 'fbdev-3.12-omap-legacy-removal' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux: (35 commits) OMAPDSS: rename omap_dss_device's 'device' field to 'dst' OMAPDSS: rename omap_dss_device's 'output' to 'src' OMAPDSS: DSS: remove legacy dss bus support OMAPDSS: RFBI: remove code related to old panel model OMAPDSS: VENC: remove code related to old panel model OMAPDSS: SDI: remove code related to old panel model OMAPDSS: DSI: remove code related to old panel model OMAPDSS: HDMI: remove code related to old panel model OMAPDSS: DPI: remove code related to old panel model OMAPDSS: remove all old panel drivers OMAPDSS: DPI: change regulator handling OMAPDSS: SDI: change regulator handling OMAPDSS: fix DPI and SDI device ids OMAPDSS: remove omap_dss_device->channel field OMAPDSS: RFBI: Mark RFBI as broken ARM: OMAP2+: Remove old display drivers from omap2plus_defconfig ARM: OMAP: AM3517EVM: use new display drivers ARM: OMAP: Zoom: use new display drivers ARM: OMAP: Pandora: use new display drivers ARM: OMAP: OMAP3EVM: use new display drivers ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/omapdrm/omap_encoder.c2
-rw-r--r--drivers/video/omap2/Kconfig1
-rw-r--r--drivers/video/omap2/Makefile1
-rw-r--r--drivers/video/omap2/displays-new/encoder-tfp410.c14
-rw-r--r--drivers/video/omap2/displays-new/encoder-tpd12s015.c14
-rw-r--r--drivers/video/omap2/displays/Kconfig75
-rw-r--r--drivers/video/omap2/displays/Makefile11
-rw-r--r--drivers/video/omap2/displays/panel-acx565akm.c798
-rw-r--r--drivers/video/omap2/displays/panel-generic-dpi.c744
-rw-r--r--drivers/video/omap2/displays/panel-lgphilips-lb035q02.c262
-rw-r--r--drivers/video/omap2/displays/panel-n8x0.c616
-rw-r--r--drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c290
-rw-r--r--drivers/video/omap2/displays/panel-picodlp.c559
-rw-r--r--drivers/video/omap2/displays/panel-picodlp.h288
-rw-r--r--drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c198
-rw-r--r--drivers/video/omap2/displays/panel-taal.c1551
-rw-r--r--drivers/video/omap2/displays/panel-tfp410.c353
-rw-r--r--drivers/video/omap2/displays/panel-tpo-td043mtea1.c596
-rw-r--r--drivers/video/omap2/dss/Kconfig1
-rw-r--r--drivers/video/omap2/dss/Makefile5
-rw-r--r--drivers/video/omap2/dss/apply.c4
-rw-r--r--drivers/video/omap2/dss/core.c324
-rw-r--r--drivers/video/omap2/dss/dpi.c121
-rw-r--r--drivers/video/omap2/dss/dsi.c275
-rw-r--r--drivers/video/omap2/dss/dss.h45
-rw-r--r--drivers/video/omap2/dss/hdmi.c307
-rw-r--r--drivers/video/omap2/dss/hdmi_panel.c414
-rw-r--r--drivers/video/omap2/dss/output.c22
-rw-r--r--drivers/video/omap2/dss/rfbi.c135
-rw-r--r--drivers/video/omap2/dss/sdi.c119
-rw-r--r--drivers/video/omap2/dss/venc.c122
31 files changed, 181 insertions, 8086 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
index c29451ba65da..6a12e899235b 100644
--- a/drivers/gpu/drm/omapdrm/omap_encoder.c
+++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
@@ -133,7 +133,7 @@ int omap_encoder_update(struct drm_encoder *encoder,
struct omap_dss_driver *dssdrv = dssdev->driver;
int ret;
- dssdev->output->manager = mgr;
+ dssdev->src->manager = mgr;
if (dssdrv->check_timings) {
ret = dssdrv->check_timings(dssdev, timings);
diff --git a/drivers/video/omap2/Kconfig b/drivers/video/omap2/Kconfig
index 56cad0f5386c..63b23f87081d 100644
--- a/drivers/video/omap2/Kconfig
+++ b/drivers/video/omap2/Kconfig
@@ -5,7 +5,6 @@ if ARCH_OMAP2PLUS
source "drivers/video/omap2/dss/Kconfig"
source "drivers/video/omap2/omapfb/Kconfig"
-source "drivers/video/omap2/displays/Kconfig"
source "drivers/video/omap2/displays-new/Kconfig"
endif
diff --git a/drivers/video/omap2/Makefile b/drivers/video/omap2/Makefile
index 86873c2fbb27..bf8127df8c71 100644
--- a/drivers/video/omap2/Makefile
+++ b/drivers/video/omap2/Makefile
@@ -1,6 +1,5 @@
obj-$(CONFIG_OMAP2_VRFB) += vrfb.o
obj-$(CONFIG_OMAP2_DSS) += dss/
-obj-y += displays/
obj-y += displays-new/
obj-$(CONFIG_FB_OMAP2) += omapfb/
diff --git a/drivers/video/omap2/displays-new/encoder-tfp410.c b/drivers/video/omap2/displays-new/encoder-tfp410.c
index a04f65856d6b..4a291e756be9 100644
--- a/drivers/video/omap2/displays-new/encoder-tfp410.c
+++ b/drivers/video/omap2/displays-new/encoder-tfp410.c
@@ -43,8 +43,8 @@ static int tfp410_connect(struct omap_dss_device *dssdev,
if (r)
return r;
- dst->output = dssdev;
- dssdev->device = dst;
+ dst->src = dssdev;
+ dssdev->dst = dst;
return 0;
}
@@ -59,12 +59,12 @@ static void tfp410_disconnect(struct omap_dss_device *dssdev,
if (!omapdss_device_is_connected(dssdev))
return;
- WARN_ON(dst != dssdev->device);
- if (dst != dssdev->device)
+ WARN_ON(dst != dssdev->dst);
+ if (dst != dssdev->dst)
return;
- dst->output = NULL;
- dssdev->device = NULL;
+ dst->src = NULL;
+ dssdev->dst = NULL;
in->ops.dpi->disconnect(in, &ddata->dssdev);
}
@@ -244,7 +244,7 @@ static int __exit tfp410_remove(struct platform_device *pdev)
WARN_ON(omapdss_device_is_connected(dssdev));
if (omapdss_device_is_connected(dssdev))
- tfp410_disconnect(dssdev, dssdev->device);
+ tfp410_disconnect(dssdev, dssdev->dst);
omap_dss_put_device(in);
diff --git a/drivers/video/omap2/displays-new/encoder-tpd12s015.c b/drivers/video/omap2/displays-new/encoder-tpd12s015.c
index ce0e010026cb..798ef200b055 100644
--- a/drivers/video/omap2/displays-new/encoder-tpd12s015.c
+++ b/drivers/video/omap2/displays-new/encoder-tpd12s015.c
@@ -66,8 +66,8 @@ static int tpd_connect(struct omap_dss_device *dssdev,
if (r)
return r;
- dst->output = dssdev;
- dssdev->device = dst;
+ dst->src = dssdev;
+ dssdev->dst = dst;
INIT_COMPLETION(ddata->hpd_completion);
@@ -95,15 +95,15 @@ static void tpd_disconnect(struct omap_dss_device *dssdev,
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
- WARN_ON(dst != dssdev->device);
+ WARN_ON(dst != dssdev->dst);
- if (dst != dssdev->device)
+ if (dst != dssdev->dst)
return;
gpio_set_value_cansleep(ddata->ct_cp_hpd_gpio, 0);
- dst->output = NULL;
- dssdev->device = NULL;
+ dst->src = NULL;
+ dssdev->dst = NULL;
in->ops.hdmi->disconnect(in, &ddata->dssdev);
}
@@ -372,7 +372,7 @@ static int __exit tpd_remove(struct platform_device *pdev)
WARN_ON(omapdss_device_is_connected(dssdev));
if (omapdss_device_is_connected(dssdev))
- tpd_disconnect(dssdev, dssdev->device);
+ tpd_disconnect(dssdev, dssdev->dst);
omap_dss_put_device(in);
diff --git a/drivers/video/omap2/displays/Kconfig b/drivers/video/omap2/displays/Kconfig
deleted file mode 100644
index e80ac1c79561..000000000000
--- a/drivers/video/omap2/displays/Kconfig
+++ /dev/null
@@ -1,75 +0,0 @@
-menu "OMAP2/3 Display Device Drivers (old device model)"
- depends on OMAP2_DSS
-
-config PANEL_GENERIC_DPI
- tristate "Generic DPI Panel"
- depends on OMAP2_DSS_DPI
- help
- Generic DPI panel driver.
- Supports DVI output for Beagle and OMAP3 SDP.
- Supports LCD Panel used in TI SDP3430 and EVM boards,
- OMAP3517 EVM boards and CM-T35.
-
-config PANEL_TFP410
- tristate "TFP410 DPI-to-DVI chip"
- depends on OMAP2_DSS_DPI && I2C
- help
- Driver for TFP410 DPI-to-DVI chip. The driver uses i2c to read EDID
- information from the monitor.
-
-config PANEL_LGPHILIPS_LB035Q02
- tristate "LG.Philips LB035Q02 LCD Panel"
- depends on OMAP2_DSS_DPI && SPI
- help
- LCD Panel used on the Gumstix Overo Palo35
-
-config PANEL_SHARP_LS037V7DW01
- tristate "Sharp LS037V7DW01 LCD Panel"
- depends on OMAP2_DSS_DPI
- depends on BACKLIGHT_CLASS_DEVICE
- help
- LCD Panel used in TI's SDP3430 and EVM boards
-
-config PANEL_NEC_NL8048HL11_01B
- tristate "NEC NL8048HL11-01B Panel"
- depends on OMAP2_DSS_DPI
- depends on SPI
- depends on BACKLIGHT_CLASS_DEVICE
- help
- This NEC NL8048HL11-01B panel is TFT LCD
- used in the Zoom2/3/3630 sdp boards.
-
-config PANEL_PICODLP
- tristate "TI PICO DLP mini-projector"
- depends on OMAP2_DSS_DPI && I2C
- help
- A mini-projector used in TI's SDP4430 and EVM boards
- For more info please visit http://www.dlp.com/projector/
-
-config PANEL_TAAL
- tristate "Taal DSI Panel"
- depends on OMAP2_DSS_DSI
- depends on BACKLIGHT_CLASS_DEVICE
- help
- Taal DSI command mode panel from TPO.
-
-config PANEL_TPO_TD043MTEA1
- tristate "TPO TD043MTEA1 LCD Panel"
- depends on OMAP2_DSS_DPI && SPI
- help
- LCD Panel used in OMAP3 Pandora
-
-config PANEL_ACX565AKM
- tristate "ACX565AKM Panel"
- depends on OMAP2_DSS_SDI && SPI
- depends on BACKLIGHT_CLASS_DEVICE
- help
- This is the LCD panel used on Nokia N900
-
-config PANEL_N8X0
- tristate "N8X0 Panel"
- depends on OMAP2_DSS_RFBI && SPI
- depends on BACKLIGHT_CLASS_DEVICE
- help
- This is the LCD panel used on Nokia N8x0
-endmenu
diff --git a/drivers/video/omap2/displays/Makefile b/drivers/video/omap2/displays/Makefile
deleted file mode 100644
index 58a5176b07b0..000000000000
--- a/drivers/video/omap2/displays/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-obj-$(CONFIG_PANEL_GENERIC_DPI) += panel-generic-dpi.o
-obj-$(CONFIG_PANEL_TFP410) += panel-tfp410.o
-obj-$(CONFIG_PANEL_LGPHILIPS_LB035Q02) += panel-lgphilips-lb035q02.o
-obj-$(CONFIG_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o
-obj-$(CONFIG_PANEL_NEC_NL8048HL11_01B) += panel-nec-nl8048hl11-01b.o
-
-obj-$(CONFIG_PANEL_TAAL) += panel-taal.o
-obj-$(CONFIG_PANEL_PICODLP) += panel-picodlp.o
-obj-$(CONFIG_PANEL_TPO_TD043MTEA1) += panel-tpo-td043mtea1.o
-obj-$(CONFIG_PANEL_ACX565AKM) += panel-acx565akm.o
-obj-$(CONFIG_PANEL_N8X0) += panel-n8x0.o
diff --git a/drivers/video/omap2/displays/panel-acx565akm.c b/drivers/video/omap2/displays/panel-acx565akm.c
deleted file mode 100644
index 3fd100fc853e..000000000000
--- a/drivers/video/omap2/displays/panel-acx565akm.c
+++ /dev/null
@@ -1,798 +0,0 @@
-/*
- * Support for ACX565AKM LCD Panel used on Nokia N900
- *
- * Copyright (C) 2010 Nokia Corporation
- *
- * Original Driver Author: Imre Deak <imre.deak@nokia.com>
- * Based on panel-generic.c by Tomi Valkeinen <tomi.valkeinen@nokia.com>
- * Adapted to new DSS2 framework: Roger Quadros <roger.quadros@nokia.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published by
- * the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/delay.h>
-#include <linux/spi/spi.h>
-#include <linux/jiffies.h>
-#include <linux/sched.h>
-#include <linux/backlight.h>
-#include <linux/fb.h>
-#include <linux/gpio.h>
-
-#include <video/omapdss.h>
-#include <video/omap-panel-data.h>
-
-#define MIPID_CMD_READ_DISP_ID 0x04
-#define MIPID_CMD_READ_RED 0x06
-#define MIPID_CMD_READ_GREEN 0x07
-#define MIPID_CMD_READ_BLUE 0x08
-#define MIPID_CMD_READ_DISP_STATUS 0x09
-#define MIPID_CMD_RDDSDR 0x0F
-#define MIPID_CMD_SLEEP_IN 0x10
-#define MIPID_CMD_SLEEP_OUT 0x11
-#define MIPID_CMD_DISP_OFF 0x28
-#define MIPID_CMD_DISP_ON 0x29
-#define MIPID_CMD_WRITE_DISP_BRIGHTNESS 0x51
-#define MIPID_CMD_READ_DISP_BRIGHTNESS 0x52
-#define MIPID_CMD_WRITE_CTRL_DISP 0x53
-
-#define CTRL_DISP_BRIGHTNESS_CTRL_ON (1 << 5)
-#define CTRL_DISP_AMBIENT_LIGHT_CTRL_ON (1 << 4)
-#define CTRL_DISP_BACKLIGHT_ON (1 << 2)
-#define CTRL_DISP_AUTO_BRIGHTNESS_ON (1 << 1)
-
-#define MIPID_CMD_READ_CTRL_DISP 0x54
-#define MIPID_CMD_WRITE_CABC 0x55
-#define MIPID_CMD_READ_CABC 0x56
-
-#define MIPID_VER_LPH8923 3
-#define MIPID_VER_LS041Y3 4
-#define MIPID_VER_L4F00311 8
-#define MIPID_VER_ACX565AKM 9
-
-struct acx565akm_device {
- char *name;
- int enabled;
- int model;
- int revision;
- u8 display_id[3];
- unsigned has_bc:1;
- unsigned has_cabc:1;
- unsigned cabc_mode;
- unsigned long hw_guard_end; /* next value of jiffies
- when we can issue the
- next sleep in/out command */
- unsigned long hw_guard_wait; /* max guard time in jiffies */
-
- struct spi_device *spi;
- struct mutex mutex;
-
- struct omap_dss_device *dssdev;
- struct backlight_device *bl_dev;
-};
-
-static struct acx565akm_device acx_dev;
-static int acx565akm_bl_update_status(struct backlight_device *dev);
-
-/*--------------------MIPID interface-----------------------------*/
-
-static void acx565akm_transfer(struct acx565akm_device *md, int cmd,
- const u8 *wbuf, int wlen, u8 *rbuf, int rlen)
-{
- struct spi_message m;
- struct spi_transfer *x, xfer[5];
- int r;
-
- BUG_ON(md->spi == NULL);
-
- spi_message_init(&m);
-
- memset(xfer, 0, sizeof(xfer));
- x = &xfer[0];
-
- cmd &= 0xff;
- x->tx_buf = &cmd;
- x->bits_per_word = 9;
- x->len = 2;
-
- if (rlen > 1 && wlen == 0) {
- /*
- * Between the command and the response data there is a
- * dummy clock cycle. Add an extra bit after the command
- * word to account for this.
- */
- x->bits_per_word = 10;
- cmd <<= 1;
- }
- spi_message_add_tail(x, &m);
-
- if (wlen) {
- x++;
- x->tx_buf = wbuf;
- x->len = wlen;
- x->bits_per_word = 9;
- spi_message_add_tail(x, &m);
- }
-
- if (rlen) {
- x++;
- x->rx_buf = rbuf;
- x->len = rlen;
- spi_message_add_tail(x, &m);
- }
-
- r = spi_sync(md->spi, &m);
- if (r < 0)
- dev_dbg(&md->spi->dev, "spi_sync %d\n", r);
-}
-
-static inline void acx565akm_cmd(struct acx565akm_device *md, int cmd)
-{
- acx565akm_transfer(md, cmd, NULL, 0, NULL, 0);
-}
-
-static inline void acx565akm_write(struct acx565akm_device *md,
- int reg, const u8 *buf, int len)
-{
- acx565akm_transfer(md, reg, buf, len, NULL, 0);
-}
-
-static inline void acx565akm_read(struct acx565akm_device *md,
- int reg, u8 *buf, int len)
-{
- acx565akm_transfer(md, reg, NULL, 0, buf, len);
-}
-
-static void hw_guard_start(struct acx565akm_device *md, int guard_msec)
-{
- md->hw_guard_wait = msecs_to_jiffies(guard_msec);
- md->hw_guard_end = jiffies + md->hw_guard_wait;
-}
-
-static void hw_guard_wait(struct acx565akm_device *md)
-{
- unsigned long wait = md->hw_guard_end - jiffies;
-
- if ((long)wait > 0 && wait <= md->hw_guard_wait) {
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(wait);
- }
-}
-
-/*----------------------MIPID wrappers----------------------------*/
-
-static void set_sleep_mode(struct acx565akm_device *md, int on)
-{
- int cmd;
-
- if (on)
- cmd = MIPID_CMD_SLEEP_IN;
- else
- cmd = MIPID_CMD_SLEEP_OUT;
- /*
- * We have to keep 120msec between sleep in/out commands.
- * (8.2.15, 8.2.16).
- */
- hw_guard_wait(md);
- acx565akm_cmd(md, cmd);
- hw_guard_start(md, 120);
-}
-
-static void set_display_state(struct acx565akm_device *md, int enabled)
-{
- int cmd = enabled ? MIPID_CMD_DISP_ON : MIPID_CMD_DISP_OFF;
-
- acx565akm_cmd(md, cmd);
-}
-
-static int panel_enabled(struct acx565akm_device *md)
-{
- u32 disp_status;
- int enabled;
-
- acx565akm_read(md, MIPID_CMD_READ_DISP_STATUS, (u8 *)&disp_status, 4);
- disp_status = __be32_to_cpu(disp_status);
- enabled = (disp_status & (1 << 17)) && (disp_status & (1 << 10));
- dev_dbg(&md->spi->dev,
- "LCD panel %senabled by bootloader (status 0x%04x)\n",
- enabled ? "" : "not ", disp_status);
- return enabled;
-}
-
-static int panel_detect(struct acx565akm_device *md)
-{
- acx565akm_read(md, MIPID_CMD_READ_DISP_ID, md->display_id, 3);
- dev_dbg(&md->spi->dev, "MIPI display ID: %02x%02x%02x\n",
- md->display_id[0], md->display_id[1], md->display_id[2]);
-
- switch (md->display_id[0]) {
- case 0x10:
- md->model = MIPID_VER_ACX565AKM;
- md->name = "acx565akm";
- md->has_bc = 1;
- md->has_cabc = 1;
- break;
- case 0x29:
- md->model = MIPID_VER_L4F00311;
- md->name = "l4f00311";
- break;
- case 0x45:
- md->model = MIPID_VER_LPH8923;
- md->name = "lph8923";
- break;
- case 0x83:
- md->model = MIPID_VER_LS041Y3;
- md->name = "ls041y3";
- break;
- default:
- md->name = "unknown";
- dev_err(&md->spi->dev, "invalid display ID\n");
- return -ENODEV;
- }
-
- md->revision = md->display_id[1];
-
- dev_info(&md->spi->dev, "omapfb: %s rev %02x LCD detected\n",
- md->name, md->revision);
-
- return 0;
-}
-
-/*----------------------Backlight Control-------------------------*/
-
-static void enable_backlight_ctrl(struct acx565akm_device *md, int enable)
-{
- u16 ctrl;
-
- acx565akm_read(md, MIPID_CMD_READ_CTRL_DISP, (u8 *)&ctrl, 1);
- if (enable) {
- ctrl |= CTRL_DISP_BRIGHTNESS_CTRL_ON |
- CTRL_DISP_BACKLIGHT_ON;
- } else {
- ctrl &= ~(CTRL_DISP_BRIGHTNESS_CTRL_ON |
- CTRL_DISP_BACKLIGHT_ON);
- }
-
- ctrl |= 1 << 8;
- acx565akm_write(md, MIPID_CMD_WRITE_CTRL_DISP, (u8 *)&ctrl, 2);
-}
-
-static void set_cabc_mode(struct acx565akm_device *md, unsigned mode)
-{
- u16 cabc_ctrl;
-
- md->cabc_mode = mode;
- if (!md->enabled)
- return;
- cabc_ctrl = 0;
- acx565akm_read(md, MIPID_CMD_READ_CABC, (u8 *)&cabc_ctrl, 1);
- cabc_ctrl &= ~3;
- cabc_ctrl |= (1 << 8) | (mode & 3);
- acx565akm_write(md, MIPID_CMD_WRITE_CABC, (u8 *)&cabc_ctrl, 2);
-}
-
-static unsigned get_cabc_mode(struct acx565akm_device *md)
-{
- return md->cabc_mode;
-}
-
-static unsigned get_hw_cabc_mode(struct acx565akm_device *md)
-{
- u8 cabc_ctrl;
-
- acx565akm_read(md, MIPID_CMD_READ_CABC, &cabc_ctrl, 1);
- return cabc_ctrl & 3;
-}
-
-static void acx565akm_set_brightness(struct acx565akm_device *md, int level)
-{
- int bv;
-
- bv = level | (1 << 8);
- acx565akm_write(md, MIPID_CMD_WRITE_DISP_BRIGHTNESS, (u8 *)&bv, 2);
-
- if (level)
- enable_backlight_ctrl(md, 1);
- else
- enable_backlight_ctrl(md, 0);
-}
-
-static int acx565akm_get_actual_brightness(struct acx565akm_device *md)
-{
- u8 bv;
-
- acx565akm_read(md, MIPID_CMD_READ_DISP_BRIGHTNESS, &bv, 1);
-
- return bv;
-}
-
-
-static int acx565akm_bl_update_status(struct backlight_device *dev)
-{
- struct acx565akm_device *md = dev_get_drvdata(&dev->dev);
- int r;
- int level;
-
- dev_dbg(&md->spi->dev, "%s\n", __func__);
-
- mutex_lock(&md->mutex);
-
- if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
- dev->props.power == FB_BLANK_UNBLANK)
- level = dev->props.brightness;
- else
- level = 0;
-
- r = 0;
- if (md->has_bc)
- acx565akm_set_brightness(md, level);
- else
- r = -ENODEV;
-
- mutex_unlock(&md->mutex);
-
- return r;
-}
-
-static int acx565akm_bl_get_intensity(struct backlight_device *dev)
-{
- struct acx565akm_device *md = dev_get_drvdata(&dev->dev);
-
- dev_dbg(&dev->dev, "%s\n", __func__);
-
- if (!md->has_bc)
- return -ENODEV;
-
- if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
- dev->props.power == FB_BLANK_UNBLANK) {
- if (md->has_bc)
- return acx565akm_get_actual_brightness(md);
- else
- return dev->props.brightness;
- }
-
- return 0;
-}
-
-static const struct backlight_ops acx565akm_bl_ops = {
- .get_brightness = acx565akm_bl_get_intensity,
- .update_status = acx565akm_bl_update_status,
-};
-
-/*--------------------Auto Brightness control via Sysfs---------------------*/
-
-static const char *cabc_modes[] = {
- "off", /* always used when CABC is not supported */
- "ui",
- "still-image",
- "moving-image",
-};
-
-static ssize_t show_cabc_mode(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct acx565akm_device *md = dev_get_drvdata(dev);
- const char *mode_str;
- int mode;
- int len;
-
- if (!md->has_cabc)
- mode = 0;
- else
- mode = get_cabc_mode(md);
- mode_str = "unknown";
- if (mode >= 0 && mode < ARRAY_SIZE(cabc_modes))
- mode_str = cabc_modes[mode];
- len = snprintf(buf, PAGE_SIZE, "%s\n", mode_str);
-
- return len < PAGE_SIZE - 1 ? len : PAGE_SIZE - 1;
-}
-
-static ssize_t store_cabc_mode(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
- struct acx565akm_device *md = dev_get_drvdata(dev);
- int i;
-
- for (i = 0; i < ARRAY_SIZE(cabc_modes); i++) {
- const char *mode_str = cabc_modes[i];
- int cmp_len = strlen(mode_str);
-
- if (count > 0 && buf[count - 1] == '\n')
- count--;
- if (count != cmp_len)
- continue;
-
- if (strncmp(buf, mode_str, cmp_len) == 0)
- break;
- }
-
- if (i == ARRAY_SIZE(cabc_modes))
- return -EINVAL;
-
- if (!md->has_cabc && i != 0)
- return -EINVAL;
-
- mutex_lock(&md->mutex);
- set_cabc_mode(md, i);
- mutex_unlock(&md->mutex);
-
- return count;
-}
-
-static ssize_t show_cabc_available_modes(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct acx565akm_device *md = dev_get_drvdata(dev);
- int len;
- int i;
-
- if (!md->has_cabc)
- return snprintf(buf, PAGE_SIZE, "%s\n", cabc_modes[0]);
-
- for (i = 0, len = 0;
- len < PAGE_SIZE && i < ARRAY_SIZE(cabc_modes); i++)
- len += snprintf(&buf[len], PAGE_SIZE - len, "%s%s%s",
- i ? " " : "", cabc_modes[i],
- i == ARRAY_SIZE(cabc_modes) - 1 ? "\n" : "");
-
- return len < PAGE_SIZE ? len : PAGE_SIZE - 1;
-}
-
-static DEVICE_ATTR(cabc_mode, S_IRUGO | S_IWUSR,
- show_cabc_mode, store_cabc_mode);
-static DEVICE_ATTR(cabc_available_modes, S_IRUGO,
- show_cabc_available_modes, NULL);
-
-static struct attribute *bldev_attrs[] = {
- &dev_attr_cabc_mode.attr,
- &dev_attr_cabc_available_modes.attr,
- NULL,
-};
-
-static struct attribute_group bldev_attr_group = {
- .attrs = bldev_attrs,
-};
-
-
-/*---------------------------ACX Panel----------------------------*/
-
-static int acx_get_recommended_bpp(struct omap_dss_device *dssdev)
-{
- return 16;
-}
-
-static struct omap_video_timings acx_panel_timings = {
- .x_res = 800,
- .y_res = 480,
- .pixel_clock = 24000,
- .hfp = 28,
- .hsw = 4,
- .hbp = 24,
- .vfp = 3,
- .vsw = 3,
- .vbp = 4,
-
- .vsync_level = OMAPDSS_SIG_ACTIVE_LOW,
- .hsync_level = OMAPDSS_SIG_ACTIVE_LOW,
-
- .data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
- .de_level = OMAPDSS_SIG_ACTIVE_HIGH,
- .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
-};
-
-static struct panel_acx565akm_data *get_panel_data(struct omap_dss_device *dssdev)
-{
- return (struct panel_acx565akm_data *) dssdev->data;
-}
-
-static int acx_panel_probe(struct omap_dss_device *dssdev)
-{
- int r;
- struct acx565akm_device *md = &acx_dev;
- struct panel_acx565akm_data *panel_data = get_panel_data(dssdev);
- struct backlight_device *bldev;
- int max_brightness, brightness;
- struct backlight_properties props;
-
- dev_dbg(dssdev->dev, "%s\n", __func__);
-
- if (!panel_data)
- return -EINVAL;
-
- /* FIXME AC bias ? */
- dssdev->panel.timings = acx_panel_timings;
-
- if (gpio_is_valid(panel_data->reset_gpio)) {
- r = devm_gpio_request_one(dssdev->dev, panel_data->reset_gpio,
- GPIOF_OUT_INIT_LOW, "lcd reset");
- if (r)
- return r;
- }
-
- if (gpio_is_valid(panel_data->reset_gpio))
- gpio_set_value(panel_data->reset_gpio, 1);
-
- /*
- * After reset we have to wait 5 msec before the first
- * command can be sent.
- */
- msleep(5);
-
- md->enabled = panel_enabled(md);
-
- r = panel_detect(md);
- if (r) {
- dev_err(dssdev->dev, "%s panel detect error\n", __func__);
- if (!md->enabled && gpio_is_valid(panel_data->reset_gpio))
- gpio_set_value(panel_data->reset_gpio, 0);
-
- return r;
- }
-
- mutex_lock(&acx_dev.mutex);
- acx_dev.dssdev = dssdev;
- mutex_unlock(&acx_dev.mutex);
-
- if (!md->enabled) {
- if (gpio_is_valid(panel_data->reset_gpio))
- gpio_set_value(panel_data->reset_gpio, 0);
- }
-
- /*------- Backlight control --------*/
-
- memset(&props, 0, sizeof(props));
- props.fb_blank = FB_BLANK_UNBLANK;
- props.power = FB_BLANK_UNBLANK;
- props.type = BACKLIGHT_RAW;
-
- bldev = backlight_device_register("acx565akm", &md->spi->dev,
- md, &acx565akm_bl_ops, &props);
- md->bl_dev = bldev;
- if (md->has_cabc) {
- r = sysfs_create_group(&bldev->dev.kobj, &bldev_attr_group);
- if (r) {
- dev_err(&bldev->dev,
- "%s failed to create sysfs files\n", __func__);
- backlight_device_unregister(bldev);
- return r;
- }
- md->cabc_mode = get_hw_cabc_mode(md);
- }
-
- max_brightness = 255;
-
- if (md->has_bc)
- brightness = acx565akm_get_actual_brightness(md);
- else
- brightness = 0;
-
- bldev->props.max_brightness = max_brightness;
- bldev->props.brightness = brightness;
-
- acx565akm_bl_update_status(bldev);
- return 0;
-}
-
-static void acx_panel_remove(struct omap_dss_device *dssdev)
-{
- struct acx565akm_device *md = &acx_dev;
-
- dev_dbg(dssdev->dev, "%s\n", __func__);
- sysfs_remove_group(&md->bl_dev->dev.kobj, &bldev_attr_group);
- backlight_device_unregister(md->bl_dev);
- mutex_lock(&acx_dev.mutex);
- acx_dev.dssdev = NULL;
- mutex_unlock(&acx_dev.mutex);
-}
-
-static int acx_panel_power_on(struct omap_dss_device *dssdev)
-{
- struct acx565akm_device *md = &acx_dev;
- struct panel_acx565akm_data *panel_data = get_panel_data(dssdev);
- int r;
-
- dev_dbg(dssdev->dev, "%s\n", __func__);
-
- if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
- return 0;
-
- mutex_lock(&md->mutex);
-
- omapdss_sdi_set_timings(dssdev, &dssdev->panel.timings);
- omapdss_sdi_set_datapairs(dssdev, dssdev->phy.sdi.datapairs);
-
- r = omapdss_sdi_display_enable(dssdev);
- if (r) {
- pr_err("%s sdi enable failed\n", __func__);
- goto fail_unlock;
- }
-
- /*FIXME tweak me */
- msleep(50);
-
- if (gpio_is_valid(panel_data->reset_gpio))
- gpio_set_value(panel_data->reset_gpio, 1);
-
- if (md->enabled) {
- dev_dbg(&md->spi->dev, "panel already enabled\n");
- mutex_unlock(&md->mutex);
- return 0;
- }
-
- /*
- * We have to meet all the following delay requirements:
- * 1. tRW: reset pulse width 10usec (7.12.1)
- * 2. tRT: reset cancel time 5msec (7.12.1)
- * 3. Providing PCLK,HS,V