aboutsummaryrefslogtreecommitdiff
path: root/drivers/video
diff options
context:
space:
mode:
authorAndy Green <andy@openmoko.com>2008-11-19 17:11:17 +0000
committerAndy Green <andy@openmoko.com>2008-11-19 17:11:17 +0000
commit6ecab98a3b8632e127c230611fe4c2c4ecc1d3c7 (patch)
tree1ba9e089a6ddaa36a7e07b4ff16ef432d58842c8 /drivers/video
parent2c10eff0891ac43dcd9f79f7d136e1c6f621ed59 (diff)
meddle-wsod.patch
Signed-off-by: Andy Green <andy@openmoko.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/display/jbt6k74.c82
1 files changed, 81 insertions, 1 deletions
diff --git a/drivers/video/display/jbt6k74.c b/drivers/video/display/jbt6k74.c
index 77f9528ff5a..754ac02213b 100644
--- a/drivers/video/display/jbt6k74.c
+++ b/drivers/video/display/jbt6k74.c
@@ -533,10 +533,51 @@ static ssize_t gamma_write(struct device *dev, struct device_attribute *attr,
return count;
}
+static ssize_t reset_write(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct jbt_info *jbt = dev_get_drvdata(dev);
+ struct jbt6k74_platform_data *jbt6k74_pdata = jbt->spi_dev->dev.platform_data;
+ int rc;
+
+ dev_info(dev, "**** jbt6k74 reset\n");
+
+ /* hard reset the jbt6k74 */
+
+ (jbt6k74_pdata->reset)(0, 0);
+ mdelay(1);
+ (jbt6k74_pdata->reset)(0, 1);
+ mdelay(120);
+
+ rc = jbt_reg_write_nodata(jbt, 0x01);
+ if (rc < 0)
+ dev_err(dev, "cannot soft reset\n");
+
+ mdelay(120);
+
+ jbt->state = JBT_STATE_DEEP_STANDBY;
+
+ switch (jbt->last_state) {
+ case JBT_STATE_QVGA_NORMAL:
+ jbt6k74_enter_state(jbt, JBT_STATE_QVGA_NORMAL);
+ break;
+ default:
+ jbt6k74_enter_state(jbt, JBT_STATE_NORMAL);
+ break;
+ }
+
+ rc = jbt6k74_display_onoff(jbt, 1);
+ if (rc < 0)
+ dev_err(dev, "cannot switch display on\n");
+
+ return count;
+}
+
static DEVICE_ATTR(gamma_fine1, 0644, gamma_read, gamma_write);
static DEVICE_ATTR(gamma_fine2, 0644, gamma_read, gamma_write);
static DEVICE_ATTR(gamma_inclination, 0644, gamma_read, gamma_write);
static DEVICE_ATTR(gamma_blue_offset, 0644, gamma_read, gamma_write);
+static DEVICE_ATTR(reset, 0600, NULL, reset_write);
static struct attribute *jbt_sysfs_entries[] = {
&dev_attr_state.attr,
@@ -544,6 +585,7 @@ static struct attribute *jbt_sysfs_entries[] = {
&dev_attr_gamma_fine2.attr,
&dev_attr_gamma_inclination.attr,
&dev_attr_gamma_blue_offset.attr,
+ &dev_attr_reset.attr,
NULL,
};
@@ -592,6 +634,7 @@ static int __devinit jbt_probe(struct spi_device *spi)
{
int rc;
struct jbt_info *jbt;
+ struct jbt6k74_platform_data *jbt6k74_pdata = spi->dev.platform_data;
/* the controller doesn't have a MISO pin; we can't do detection */
@@ -615,6 +658,20 @@ static int __devinit jbt_probe(struct spi_device *spi)
dev_set_drvdata(&spi->dev, jbt);
+ /* hard reset the jbt6k74 */
+
+ (jbt6k74_pdata->reset)(0, 0);
+ mdelay(1);
+ (jbt6k74_pdata->reset)(0, 1);
+ mdelay(120);
+
+ rc = jbt_reg_write_nodata(jbt, 0x01);
+ if (rc < 0)
+ dev_err(&spi->dev, "cannot soft reset\n");
+
+ mdelay(120);
+
+
rc = jbt6k74_enter_state(jbt, JBT_STATE_NORMAL);
if (rc < 0) {
dev_err(&spi->dev, "cannot enter NORMAL state\n");
@@ -691,7 +748,25 @@ int jbt6k74_resume(struct spi_device *spi)
{
struct jbt_info *jbt = dev_get_drvdata(&spi->dev);
struct jbt6k74_platform_data *jbt6k74_pdata = spi->dev.platform_data;
+ int rc;
+ dev_info(&spi->dev, "**** jbt6k74 resume start\n");
+
+ /* hard reset the jbt6k74 */
+
+ (jbt6k74_pdata->reset)(0, 0);
+ mdelay(1);
+ (jbt6k74_pdata->reset)(0, 1);
+ mdelay(120);
+
+ rc = jbt_reg_write_nodata(jbt, 0x01);
+ if (rc < 0)
+ dev_err(&spi->dev, "cannot soft reset\n");
+
+ mdelay(120);
+
+ jbt->state = JBT_STATE_DEEP_STANDBY;
+
switch (jbt->last_state) {
case JBT_STATE_QVGA_NORMAL:
jbt6k74_enter_state(jbt, JBT_STATE_QVGA_NORMAL);
@@ -700,11 +775,16 @@ int jbt6k74_resume(struct spi_device *spi)
jbt6k74_enter_state(jbt, JBT_STATE_NORMAL);
break;
}
- jbt6k74_display_onoff(jbt, 1);
+
+ rc = jbt6k74_display_onoff(jbt, 1);
+ if (rc < 0)
+ dev_err(&spi->dev, "cannot switch display on\n");
if (jbt6k74_pdata->resuming)
(jbt6k74_pdata->resuming)(0);
+ dev_info(&spi->dev, "**** jbt6k74 resume end\n");
+
return 0;
}
EXPORT_SYMBOL_GPL(jbt6k74_resume);