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

Commit 7c0d64dc authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "backlight: qcom-spmi-wled: Update flash sink config in auto calibration"

parents 3ad92b26 c5bc46fb
Loading
Loading
Loading
Loading
+16 −9
Original line number Diff line number Diff line
@@ -278,6 +278,8 @@ static const u8 wled5_brt_wid_sel_reg[MOD_MAX] = {
	[MOD_B] = WLED5_SINK_MOD_B_BR_WID_SEL_REG,
};

static int wled_flash_setup(struct wled *wled);

static inline bool is_wled4(struct wled *wled)
{
	if (*wled->version == WLED_PMI8998 || *wled->version == WLED_PM660L)
@@ -833,6 +835,15 @@ static int wled_auto_calibrate(struct wled *wled)
		goto failed_calib;
	}

	if (is_wled5(wled)) {
		/* Update the flash sink configuration as well */
		rc = regmap_update_bits(wled->regmap,
				wled->sink_addr + WLED5_SINK_FLASH_SINK_EN_REG,
				WLED_SINK_CURR_SINK_MASK, sink_config);
		if (rc < 0)
			return rc;
	}

	/* MODULATOR_EN setting for valid sinks */
	if (is_wled4(wled)) {
		for (i = 0; (string_cfg >> i) != 0; i++) {
@@ -1065,6 +1076,11 @@ static int wled5_setup(struct wled *wled)
	u32 val;
	u8 string_cfg = wled->cfg.string_cfg;

	rc = wled_flash_setup(wled);
	if (rc < 0)
		dev_err(&wled->pdev->dev, "failed to setup WLED flash/torch rc:%d\n",
			rc);

	rc = regmap_update_bits(wled->regmap,
			wled->ctrl_addr + WLED_CTRL_OVP,
			WLED5_CTRL_OVP_MASK, wled->cfg.ovp);
@@ -1999,10 +2015,6 @@ static int wled_flash_setup(struct wled *wled)
	int rc, i;
	u8 val;

	/* Not supported */
	if (is_wled4(wled))
		return 0;

	/* Set FLASH_VREF_ADIM_HDIM to maximum */
	rc = regmap_write(wled->regmap,
			wled->ctrl_addr + WLED5_CTRL_FLASH_HDRM_REG, 0xF);
@@ -2359,11 +2371,6 @@ static int wled_probe(struct platform_device *pdev)
		return rc;
	}

	rc = wled_flash_setup(wled);
	if (rc < 0)
		dev_err(&pdev->dev, "failed to setup WLED flash/torch rc:%d\n",
			rc);

	return rc;
}