Skip to content

Commit

Permalink
S5PC11X: LCD: Add the mutex to prevent sending command
Browse files Browse the repository at this point in the history
Move the ldi_enable = 0 and add the mutex to prevent sending command

Change-Id: I4e5df6dcadcc92616db4cf074fce4478d4f5363a
Signed-off-by: sl47.kim <sl47.kim@samsung.com>
  • Loading branch information
sl47.kim authored and swetland committed Nov 15, 2010
1 parent 554fd3a commit 2c92825
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions drivers/video/samsung/s3cfb_tl2796.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ struct s5p_lcd{
int ldi_enable;
int bl;
const struct tl2796_gamma_adj_points *gamma_adj_points;
struct mutex lock;
struct device *dev;
struct spi_device *g_spi;
struct s5p_panel_data *data;
Expand Down Expand Up @@ -218,26 +219,34 @@ static void update_brightness(struct s5p_lcd *lcd)
gamma_regs[26] = 0x0000;

setup_gamma_regs(lcd, gamma_regs + 2);

s6e63m0_panel_send_sequence(lcd, gamma_regs);
}

static void tl2796_ldi_enable(struct s5p_lcd *lcd)
{
struct s5p_panel_data *pdata = lcd->data;

mutex_lock(&lcd->lock);

s6e63m0_panel_send_sequence(lcd, pdata->seq_display_set);
update_brightness(lcd);
s6e63m0_panel_send_sequence(lcd, pdata->seq_etc_set);

lcd->ldi_enable = 1;

mutex_unlock(&lcd->lock);
}

static void tl2796_ldi_disable(struct s5p_lcd *lcd)
{
struct s5p_panel_data *pdata = lcd->data;

s6e63m0_panel_send_sequence(lcd, pdata->standby_on);
mutex_lock(&lcd->lock);

lcd->ldi_enable = 0;
s6e63m0_panel_send_sequence(lcd, pdata->standby_on);

mutex_unlock(&lcd->lock);
}

static int s5p_bl_update_status(struct backlight_device *bd)
Expand All @@ -251,14 +260,16 @@ static int s5p_bl_update_status(struct backlight_device *bd)
if (bl < 0 || bl > 255)
return -EINVAL;

lcd->bl = bl;
mutex_lock(&lcd->lock);

if (!lcd->ldi_enable)
return 0;
lcd->bl = bl;

pr_debug("\n bl :%d\n", bl);
if (lcd->ldi_enable) {
pr_debug("\n bl :%d\n", bl);
update_brightness(lcd);
}

update_brightness(lcd);
mutex_unlock(&lcd->lock);

return 0;
}
Expand Down Expand Up @@ -296,6 +307,7 @@ static int __devinit tl2796_probe(struct spi_device *spi)
ret = -ENOMEM;
goto err_alloc;
}
mutex_init(&lcd->lock);

spi->bits_per_word = 9;
if (spi_setup(spi)) {
Expand Down Expand Up @@ -348,6 +360,7 @@ static int __devinit tl2796_probe(struct spi_device *spi)
return 0;

err_setup:
mutex_destroy(&lcd->lock);
kfree(lcd);

err_alloc:
Expand Down

0 comments on commit 2c92825

Please sign in to comment.