Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 271352
b: refs/heads/master
c: 2572df9
h: refs/heads/master
v: v3
  • Loading branch information
Timur Tabi authored and Florian Tobias Schandinat committed Oct 5, 2011
1 parent 7bc013d commit e725b53
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 49 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 760af8f83d73dcd2ddf0dc8ebefcf4f0569c1a89
refs/heads/master: 2572df91d5528dfc639e52b7caaed98e3dec1e18
94 changes: 46 additions & 48 deletions trunk/drivers/video/fsl-diu-fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,16 @@ struct fsl_diu_data {
enum fsl_diu_monitor_port monitor_port;
};

enum mfb_index {
PLANE0 = 0, /* Plane 0, only one AOI that fills the screen */
PLANE1_AOI0, /* Plane 1, first AOI */
PLANE1_AOI1, /* Plane 1, second AOI */
PLANE2_AOI0, /* Plane 2, first AOI */
PLANE2_AOI1, /* Plane 2, second AOI */
};

struct mfb_info {
int index;
enum mfb_index index;
int type;
char *id;
int registered;
Expand All @@ -378,17 +386,17 @@ struct mfb_info {


static struct mfb_info mfb_template[] = {
{ /* AOI 0 for plane 0 */
.index = 0,
{
.index = PLANE0,
.type = MFB_TYPE_OUTPUT,
.id = "Panel0",
.registered = 0,
.count = 0,
.x_aoi_d = 0,
.y_aoi_d = 0,
},
{ /* AOI 0 for plane 1 */
.index = 1,
{
.index = PLANE1_AOI0,
.type = MFB_TYPE_OUTPUT,
.id = "Panel1 AOI0",
.registered = 0,
Expand All @@ -397,8 +405,8 @@ static struct mfb_info mfb_template[] = {
.x_aoi_d = 0,
.y_aoi_d = 0,
},
{ /* AOI 1 for plane 1 */
.index = 2,
{
.index = PLANE1_AOI1,
.type = MFB_TYPE_OUTPUT,
.id = "Panel1 AOI1",
.registered = 0,
Expand All @@ -407,8 +415,8 @@ static struct mfb_info mfb_template[] = {
.x_aoi_d = 0,
.y_aoi_d = 480,
},
{ /* AOI 0 for plane 2 */
.index = 3,
{
.index = PLANE2_AOI0,
.type = MFB_TYPE_OUTPUT,
.id = "Panel2 AOI0",
.registered = 0,
Expand All @@ -417,8 +425,8 @@ static struct mfb_info mfb_template[] = {
.x_aoi_d = 640,
.y_aoi_d = 0,
},
{ /* AOI 1 for plane 2 */
.index = 4,
{
.index = PLANE2_AOI1,
.type = MFB_TYPE_OUTPUT,
.id = "Panel2 AOI1",
.registered = 0,
Expand Down Expand Up @@ -519,11 +527,11 @@ static int fsl_diu_enable_panel(struct fb_info *info)

if (mfbi->type != MFB_TYPE_OFF) {
switch (mfbi->index) {
case 0: /* plane 0 */
case PLANE0:
if (hw->desc[0] != ad->paddr)
wr_reg_wa(&hw->desc[0], ad->paddr);
break;
case 1: /* plane 1 AOI 0 */
case PLANE1_AOI0:
cmfbi = machine_data->fsl_diu_info[2]->par;
if (hw->desc[1] != ad->paddr) { /* AOI0 closed */
if (cmfbi->count > 0) /* AOI1 open */
Expand All @@ -534,7 +542,7 @@ static int fsl_diu_enable_panel(struct fb_info *info)
wr_reg_wa(&hw->desc[1], ad->paddr);
}
break;
case 3: /* plane 2 AOI 0 */
case PLANE2_AOI0:
cmfbi = machine_data->fsl_diu_info[4]->par;
if (hw->desc[2] != ad->paddr) { /* AOI0 closed */
if (cmfbi->count > 0) /* AOI1 open */
Expand All @@ -545,45 +553,41 @@ static int fsl_diu_enable_panel(struct fb_info *info)
wr_reg_wa(&hw->desc[2], ad->paddr);
}
break;
case 2: /* plane 1 AOI 1 */
case PLANE1_AOI1:
pmfbi = machine_data->fsl_diu_info[1]->par;
ad->next_ad = 0;
if (hw->desc[1] == machine_data->dummy_ad->paddr)
wr_reg_wa(&hw->desc[1], ad->paddr);
else /* AOI0 open */
pmfbi->ad->next_ad = cpu_to_le32(ad->paddr);
break;
case 4: /* plane 2 AOI 1 */
case PLANE2_AOI1:
pmfbi = machine_data->fsl_diu_info[3]->par;
ad->next_ad = 0;
if (hw->desc[2] == machine_data->dummy_ad->paddr)
wr_reg_wa(&hw->desc[2], ad->paddr);
else /* AOI0 was open */
pmfbi->ad->next_ad = cpu_to_le32(ad->paddr);
break;
default:
res = -EINVAL;
break;
}
} else
res = -EINVAL;
return res;
}

static int fsl_diu_disable_panel(struct fb_info *info)
static void fsl_diu_disable_panel(struct fb_info *info)
{
struct mfb_info *pmfbi, *cmfbi, *mfbi = info->par;
struct diu *hw = dr.diu_reg;
struct diu_ad *ad = mfbi->ad;
struct fsl_diu_data *machine_data = mfbi->parent;
int res = 0;

switch (mfbi->index) {
case 0: /* plane 0 */
case PLANE0:
if (hw->desc[0] != machine_data->dummy_ad->paddr)
wr_reg_wa(&hw->desc[0], machine_data->dummy_ad->paddr);
break;
case 1: /* plane 1 AOI 0 */
case PLANE1_AOI0:
cmfbi = machine_data->fsl_diu_info[2]->par;
if (cmfbi->count > 0) /* AOI1 is open */
wr_reg_wa(&hw->desc[1], cmfbi->ad->paddr);
Expand All @@ -592,7 +596,7 @@ static int fsl_diu_disable_panel(struct fb_info *info)
wr_reg_wa(&hw->desc[1], machine_data->dummy_ad->paddr);
/* close AOI 0 */
break;
case 3: /* plane 2 AOI 0 */
case PLANE2_AOI0:
cmfbi = machine_data->fsl_diu_info[4]->par;
if (cmfbi->count > 0) /* AOI1 is open */
wr_reg_wa(&hw->desc[2], cmfbi->ad->paddr);
Expand All @@ -601,7 +605,7 @@ static int fsl_diu_disable_panel(struct fb_info *info)
wr_reg_wa(&hw->desc[2], machine_data->dummy_ad->paddr);
/* close AOI 0 */
break;
case 2: /* plane 1 AOI 1 */
case PLANE1_AOI1:
pmfbi = machine_data->fsl_diu_info[1]->par;
if (hw->desc[1] != ad->paddr) {
/* AOI1 is not the first in the chain */
Expand All @@ -612,7 +616,7 @@ static int fsl_diu_disable_panel(struct fb_info *info)
wr_reg_wa(&hw->desc[1], machine_data->dummy_ad->paddr);
/* close AOI 1 */
break;
case 4: /* plane 2 AOI 1 */
case PLANE2_AOI1:
pmfbi = machine_data->fsl_diu_info[3]->par;
if (hw->desc[2] != ad->paddr) {
/* AOI1 is not the first in the chain */
Expand All @@ -623,12 +627,7 @@ static int fsl_diu_disable_panel(struct fb_info *info)
wr_reg_wa(&hw->desc[2], machine_data->dummy_ad->paddr);
/* close AOI 1 */
break;
default:
res = -EINVAL;
break;
}

return res;
}

static void enable_lcdc(struct fb_info *info)
Expand Down Expand Up @@ -660,7 +659,8 @@ static void adjust_aoi_size_position(struct fb_var_screeninfo *var,
{
struct mfb_info *lower_aoi_mfbi, *upper_aoi_mfbi, *mfbi = info->par;
struct fsl_diu_data *machine_data = mfbi->parent;
int available_height, upper_aoi_bottom, index = mfbi->index;
int available_height, upper_aoi_bottom;
enum mfb_index index = mfbi->index;
int lower_aoi_is_open, upper_aoi_is_open;
__u32 base_plane_width, base_plane_height, upper_aoi_height;

Expand All @@ -672,14 +672,14 @@ static void adjust_aoi_size_position(struct fb_var_screeninfo *var,
if (mfbi->y_aoi_d < 0)
mfbi->y_aoi_d = 0;
switch (index) {
case 0:
case PLANE0:
if (mfbi->x_aoi_d != 0)
mfbi->x_aoi_d = 0;
if (mfbi->y_aoi_d != 0)
mfbi->y_aoi_d = 0;
break;
case 1: /* AOI 0 */
case 3:
case PLANE1_AOI0:
case PLANE2_AOI0:
lower_aoi_mfbi = machine_data->fsl_diu_info[index+1]->par;
lower_aoi_is_open = lower_aoi_mfbi->count > 0 ? 1 : 0;
if (var->xres > base_plane_width)
Expand All @@ -696,8 +696,8 @@ static void adjust_aoi_size_position(struct fb_var_screeninfo *var,
if ((mfbi->y_aoi_d + var->yres) > available_height)
mfbi->y_aoi_d = available_height - var->yres;
break;
case 2: /* AOI 1 */
case 4:
case PLANE1_AOI1:
case PLANE2_AOI1:
upper_aoi_mfbi = machine_data->fsl_diu_info[index-1]->par;
upper_aoi_height =
machine_data->fsl_diu_info[index-1]->var.yres;
Expand Down Expand Up @@ -1002,7 +1002,7 @@ static int fsl_diu_set_par(struct fb_info *info)
ad->ckmin_g = 255;
ad->ckmin_b = 255;

if (mfbi->index == 0)
if (mfbi->index == PLANE0)
update_lcdc(info);
return 0;
}
Expand Down Expand Up @@ -1195,7 +1195,7 @@ static int fsl_diu_open(struct fb_info *info, int user)
int res = 0;

/* free boot splash memory on first /dev/fb0 open */
if (!mfbi->index && diu_ops.release_bootmem)
if ((mfbi->index == PLANE0) && diu_ops.release_bootmem)
diu_ops.release_bootmem();

spin_lock(&diu_lock);
Expand Down Expand Up @@ -1225,11 +1225,9 @@ static int fsl_diu_release(struct fb_info *info, int user)

spin_lock(&diu_lock);
mfbi->count--;
if (mfbi->count == 0) {
res = fsl_diu_disable_panel(info);
if (res < 0)
mfbi->count++;
}
if (mfbi->count == 0)
fsl_diu_disable_panel(info);

spin_unlock(&diu_lock);
return res;
}
Expand Down Expand Up @@ -1275,7 +1273,7 @@ static int __devinit install_fb(struct fb_info *info)
if (init_fbinfo(info))
return -EINVAL;

if (mfbi->index == 0) { /* plane 0 */
if (mfbi->index == PLANE0) {
if (mfbi->edid_data) {
/* Now build modedb from EDID */
fb_edid_to_monspecs(mfbi->edid_data, &info->monspecs);
Expand All @@ -1296,7 +1294,7 @@ static int __devinit install_fb(struct fb_info *info)
* For plane 0 we continue and look into
* driver's internal modedb.
*/
if (mfbi->index == 0 && mfbi->edid_data)
if ((mfbi->index == PLANE0) && mfbi->edid_data)
has_default_mode = 0;
else
return -EINVAL;
Expand Down Expand Up @@ -1360,7 +1358,7 @@ static void uninstall_fb(struct fb_info *info)
if (!mfbi->registered)
return;

if (mfbi->index == 0)
if (mfbi->index == PLANE0)
kfree(mfbi->edid_data);

unregister_framebuffer(info);
Expand Down Expand Up @@ -1565,7 +1563,7 @@ static int __devinit fsl_diu_probe(struct platform_device *pdev)
memcpy(mfbi, &mfb_template[i], sizeof(struct mfb_info));
mfbi->parent = machine_data;

if (mfbi->index == 0) {
if (mfbi->index == PLANE0) {
const u8 *prop;
int len;

Expand Down

0 comments on commit e725b53

Please sign in to comment.