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

Commit 6955d6b4 authored by Ping Li's avatar Ping Li
Browse files

msm: mdss: Read the max brightness level from device tree



Parse the maximum brightness level supported by different targets from
device tree instead of defining a macro for all targets.

Change-Id: If997f87c75d763395844cc11dbb8b8c0c24f4212
Signed-off-by: default avatarPing Li <quicpingli@codeaurora.org>
parent 446a396c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -142,6 +142,8 @@ Optional properties:
					0 = default value.
- qcom,mdss-dsi-bl-max-level:		Specifies the max backlight level supported by the panel.
					255 = default value.
- qcom,mdss-brightness-max-level:	Specifies the max brightness level supported.
					255 = default value.
- qcom,mdss-dsi-interleave-mode:	Specifies interleave mode.
					0 = default value.
- qcom,mdss-dsi-panel-type:		Specifies the panel operating mode.
+2 −0
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@ Optional properties

Optional properties:
- qcom,cont-splash-enabled:             Boolean used to enable continuous splash mode.
- qcom,mdss-brightness-max-level:	Specifies the max brightness level supported.
					255 = default value.

Example:
	mdss_edp: qcom,mdss_edp@fd923400 {
+2 −0
Original line number Diff line number Diff line
@@ -810,6 +810,8 @@ static int mdss_panel_parse_dt(struct device_node *np,
			ctrl_pdata->bklt_ctrl = BL_DCS_CMD;
		}
	}
	rc = of_property_read_u32(np, "qcom,mdss-brightness-max-level", &tmp);
	pinfo->brightness_max = (!rc ? tmp : MDSS_MAX_BL_BRIGHTNESS);
	rc = of_property_read_u32(np, "qcom,mdss-dsi-bl-min-level", &tmp);
	pinfo->bl_min = (!rc ? tmp : 0);
	rc = of_property_read_u32(np, "qcom,mdss-dsi-bl-max-level", &tmp);
+6 −0
Original line number Diff line number Diff line
@@ -714,10 +714,16 @@ static int mdss_edp_remove(struct platform_device *pdev)
static int mdss_edp_device_register(struct mdss_edp_drv_pdata *edp_drv)
{
	int ret;
	u32 tmp;

	mdss_edp_edid2pinfo(edp_drv);
	edp_drv->panel_data.panel_info.bl_min = 1;
	edp_drv->panel_data.panel_info.bl_max = 255;
	ret = of_property_read_u32(edp_drv->pdev->dev.of_node,
		"qcom,mdss-brightness-max-level", &tmp);
	edp_drv->panel_data.panel_info.brightness_max =
		(!ret ? tmp : MDSS_MAX_BL_BRIGHTNESS);

	edp_drv->panel_data.panel_info.edp.frame_rate =
				DEFAULT_FRAME_RATE;/* 60 fps */

+5 −3
Original line number Diff line number Diff line
@@ -155,13 +155,13 @@ static void mdss_fb_set_bl_brightness(struct led_classdev *led_cdev,
	struct msm_fb_data_type *mfd = dev_get_drvdata(led_cdev->dev->parent);
	int bl_lvl;

	if (value > MDSS_MAX_BL_BRIGHTNESS)
		value = MDSS_MAX_BL_BRIGHTNESS;
	if (value > mfd->panel_info->brightness_max)
		value = mfd->panel_info->brightness_max;

	/* This maps android backlight level 0 to 255 into
	   driver backlight level 0 to bl_max with rounding */
	MDSS_BRIGHT_TO_BL(bl_lvl, value, mfd->panel_info->bl_max,
						MDSS_MAX_BL_BRIGHTNESS);
				mfd->panel_info->brightness_max);

	if (!bl_lvl && value)
		bl_lvl = 1;
@@ -376,6 +376,8 @@ static int mdss_fb_probe(struct platform_device *pdev)

	/* android supports only one lcd-backlight/lcd for now */
	if (!lcd_backlight_registered) {
		backlight_led.brightness = mfd->panel_info->brightness_max;
		backlight_led.max_brightness = mfd->panel_info->brightness_max;
		if (led_classdev_register(&pdev->dev, &backlight_led))
			pr_err("led_classdev_register failed\n");
		else
Loading