static void hisifb_bl_workqueue_handler(struct hisi_fb_data_type *hisifd)
#endif
{
	struct hisi_fb_panel_data *pdata = NULL;
#ifdef CONFIG_HISI_FB_BACKLIGHT_DELAY
	struct hisifb_backlight *pbacklight = NULL;
	struct hisi_fb_data_type *hisifd = NULL;

	pbacklight = container_of(to_delayed_work(work), struct hisifb_backlight, bl_worker);
	BUG_ON(pbacklight == NULL);

	hisifd = container_of(pbacklight, struct hisi_fb_data_type, backlight);
#endif

	BUG_ON(hisifd == NULL);
	pdata = dev_get_platdata(&hisifd->pdev->dev);
	BUG_ON(pdata == NULL);

	if (!hisifd->backlight.bl_updated) {
		down(&hisifd->blank_sem);
		hisifd->backlight.bl_updated = 1;
		if (is_recovery_mode) {
			hisifd->bl_level = HISI_FB_DEFAULT_BL_LEVEL;
		}
		hisifb_set_backlight(hisifd, hisifd->bl_level);
		up(&hisifd->blank_sem);
	}
}
static void hisifb_sbl_work(struct work_struct *work)
{
	struct hisifb_backlight *pbacklight = NULL;
	struct hisi_fb_data_type *hisifd = NULL;

	char __iomem *sbl_base = NULL;
	uint32_t bkl_from_AD = 0;

	pbacklight = container_of(work, struct hisifb_backlight, sbl_work);
	BUG_ON(pbacklight == NULL);
	hisifd = container_of(pbacklight, struct hisi_fb_data_type, backlight);
	BUG_ON(hisifd == NULL);

	down(&hisifd->blank_sem);

	if (!hisifd->panel_power_on) {
		up(&hisifd->blank_sem);
		return;
	}

	sbl_base = hisifd->dss_base + DSS_DPP_SBL_OFFSET;
	bkl_from_AD = (inp32(sbl_base + SBL_BACKLIGHT_OUT_H) << 8)
		| inp32(sbl_base + SBL_BACKLIGHT_OUT_L);
	hisifb_set_backlight(hisifd, bkl_from_AD);

	up(&hisifd->blank_sem);
}
static void hisi_fb_set_bl_brightness(struct led_classdev *led_cdev,
	enum led_brightness value)
{
	struct hisi_fb_data_type *hisifd = NULL;
	int bl_lvl = 0;

	BUG_ON(led_cdev == NULL);
	hisifd = dev_get_drvdata(led_cdev->dev->parent);
	BUG_ON(hisifd == NULL);

	if (value < 0)
		value = 0;

	if (value > MAX_BACKLIGHT_BRIGHTNESS)
		value = MAX_BACKLIGHT_BRIGHTNESS;

	/* This maps android backlight level 0 to 255 into
	   driver backlight level 0 to bl_max with rounding */
	bl_lvl = (2 * value * hisifd->panel_info.bl_max + MAX_BACKLIGHT_BRIGHTNESS)
		/(2 * MAX_BACKLIGHT_BRIGHTNESS);

	if (!bl_lvl && value)
		bl_lvl = 1;

	down(&hisifd->blank_sem);
	hisifb_set_backlight(hisifd, bl_lvl);
	up(&hisifd->blank_sem);
}
Пример #4
0
void hisifb_sbl_isr_handler(struct hisi_fb_data_type *hisifd)
{
	char __iomem *sbl_base = NULL;
	uint32_t bkl_from_AD = 0;

	BUG_ON(hisifd == NULL);

	if ((hisifd->sbl_enable == 0) || (hisifd->panel_info.sbl_support == 0)) {
		return;
	}

	sbl_base = hisifd->dss_base + DSS_DPP_SBL_OFFSET;
	bkl_from_AD = (inp32(sbl_base + SBL_BACKLIGHT_OUT_H) << 8)
		| inp32(sbl_base + SBL_BACKLIGHT_OUT_L);
	hisifb_set_backlight(hisifd, bkl_from_AD);
}
static int hisi_fb_bl_update_status(struct backlight_device *pbd)
{
	struct hisi_fb_data_type *hisifd = NULL;
	uint32_t bl_lvl = 0;

	BUG_ON(pbd == NULL);
	hisifd = bl_get_data(pbd);
	BUG_ON(hisifd == NULL);

	bl_lvl = pbd->props.brightness;
	bl_lvl = hisifd->fbi->bl_curve[bl_lvl];

	down(&hisifd->blank_sem);
	hisifb_set_backlight(hisifd, bl_lvl);
	up(&hisifd->blank_sem);

	return 0;
}