Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 07df1c4f authored by Eric Miao's avatar Eric Miao
Browse files

[ARM] pxafb: small cleanup of the smart panel code



Group smart panel related code in a more compact fasion, avoid abused
usage of #ifdef .. #endif.

Also fix the incorrect condition in pxafb_smart_init() to decide if it
is a smart panel or not. (should be '&' instead of '|')

Signed-off-by: default avatarEric Miao <eric.miao@marvell.com>
parent 09e647d3
Loading
Loading
Loading
Loading
+12 −15
Original line number Original line Diff line number Diff line
@@ -800,14 +800,19 @@ static int pxafb_smart_thread(void *arg)


static int pxafb_smart_init(struct pxafb_info *fbi)
static int pxafb_smart_init(struct pxafb_info *fbi)
{
{
	if (!(fbi->lccr0 | LCCR0_LCDT))
	if (!(fbi->lccr0 & LCCR0_LCDT))
		return 0;
		return 0;


	fbi->smart_cmds = (uint16_t *) fbi->dma_buff->cmd_buff;
	fbi->n_smart_cmds = 0;

	init_completion(&fbi->command_done);
	init_completion(&fbi->refresh_done);

	fbi->smart_thread = kthread_run(pxafb_smart_thread, fbi,
	fbi->smart_thread = kthread_run(pxafb_smart_thread, fbi,
					"lcd_refresh");
					"lcd_refresh");
	if (IS_ERR(fbi->smart_thread)) {
	if (IS_ERR(fbi->smart_thread)) {
		printk(KERN_ERR "%s: unable to create kernel thread\n",
		pr_err("%s: unable to create kernel thread\n", __func__);
				__func__);
		return PTR_ERR(fbi->smart_thread);
		return PTR_ERR(fbi->smart_thread);
	}
	}


@@ -823,7 +828,9 @@ int pxafb_smart_flush(struct fb_info *info)
{
{
	return 0;
	return 0;
}
}
#endif /* CONFIG_FB_SMART_PANEL */

static inline int pxafb_smart_init(struct pxafb_info *fbi) { return 0; }
#endif /* CONFIG_FB_PXA_SMARTPANEL */


static void setup_parallel_timing(struct pxafb_info *fbi,
static void setup_parallel_timing(struct pxafb_info *fbi,
				  struct fb_var_screeninfo *var)
				  struct fb_var_screeninfo *var)
@@ -1286,11 +1293,6 @@ static int __devinit pxafb_map_video_memory(struct pxafb_info *fbi)
		fbi->palette_cpu = (u16 *) fbi->dma_buff->palette;
		fbi->palette_cpu = (u16 *) fbi->dma_buff->palette;


	        pr_debug("pxafb: palette_mem_size = 0x%08x\n", fbi->palette_size*sizeof(u16));
	        pr_debug("pxafb: palette_mem_size = 0x%08x\n", fbi->palette_size*sizeof(u16));

#ifdef CONFIG_FB_PXA_SMARTPANEL
		fbi->smart_cmds = (uint16_t *) fbi->dma_buff->cmd_buff;
		fbi->n_smart_cmds = 0;
#endif
	}
	}


	return fbi->map_cpu ? 0 : -ENOMEM;
	return fbi->map_cpu ? 0 : -ENOMEM;
@@ -1412,10 +1414,6 @@ static struct pxafb_info * __devinit pxafb_init_fbinfo(struct device *dev)
	INIT_WORK(&fbi->task, pxafb_task);
	INIT_WORK(&fbi->task, pxafb_task);
	mutex_init(&fbi->ctrlr_lock);
	mutex_init(&fbi->ctrlr_lock);
	init_completion(&fbi->disable_done);
	init_completion(&fbi->disable_done);
#ifdef CONFIG_FB_PXA_SMARTPANEL
	init_completion(&fbi->command_done);
	init_completion(&fbi->refresh_done);
#endif


	return fbi;
	return fbi;
}
}
@@ -1747,13 +1745,12 @@ static int __devinit pxafb_probe(struct platform_device *dev)
		goto failed_free_mem;
		goto failed_free_mem;
	}
	}


#ifdef CONFIG_FB_PXA_SMARTPANEL
	ret = pxafb_smart_init(fbi);
	ret = pxafb_smart_init(fbi);
	if (ret) {
	if (ret) {
		dev_err(&dev->dev, "failed to initialize smartpanel\n");
		dev_err(&dev->dev, "failed to initialize smartpanel\n");
		goto failed_free_irq;
		goto failed_free_irq;
	}
	}
#endif

	/*
	/*
	 * This makes sure that our colour bitfield
	 * This makes sure that our colour bitfield
	 * descriptors are correctly initialised.
	 * descriptors are correctly initialised.