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

Commit 23b3f29a authored by Kiran Gunda's avatar Kiran Gunda
Browse files

backlight: qcom-wled: Add "qcom,sync-dly" device tree property



Add "qcom,sync-dly" DT property to make the "LED_IDAC_SYNC_DELAY"
register configurable.

Change-Id: I3dd82cc13924adef834e28716655d9c9e817073a
Signed-off-by: default avatarKiran Gunda <kgunda@codeaurora.org>
parent 2293d651
Loading
Loading
Loading
Loading
+26 −1
Original line number Diff line number Diff line
/* Copyright (c) 2015, Sony Mobile Communications, AB.
 *
 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -91,6 +91,7 @@
#define  WLED_SINK_REG_STR_MOD_EN	BIT(7)

#define WLED_SINK_SYNC_DLY_REG(n)	(0x51 + (n * 0x10))
#define  WLED_SINK_SYNC_DLY_MASK	GENMASK(2, 0)
#define WLED_SINK_FS_CURR_REG(n)	(0x52 + (n * 0x10))
#define  WLED_SINK_FS_MASK		GENMASK(3, 0)

@@ -207,6 +208,7 @@ struct wled_config {
	int string_cfg;
	int mod_sel;
	int cabc_sel;
	int sync_dly;
	bool en_cabc;
	bool ext_pfet_sc_pro_en;
	bool auto_calib_enabled;
@@ -1254,6 +1256,14 @@ static int wled4_setup(struct wled *wled)
			if (rc < 0)
				return rc;

			addr = wled->sink_addr +
					WLED_SINK_SYNC_DLY_REG(i);
			rc = regmap_update_bits(wled->regmap, addr,
						WLED_SINK_SYNC_DLY_MASK,
						wled->cfg.sync_dly);
			if (rc < 0)
				return rc;

			temp = i + WLED_SINK_CURR_SINK_SHFT;
			sink_en |= 1 << temp;
		}
@@ -1339,6 +1349,7 @@ static const struct wled_config wled4_config_defaults = {
	.fs_current = 10,
	.ovp = 1,
	.switch_freq = 11,
	.sync_dly = 2,
	.string_cfg = 0xf,
	.mod_sel = -EINVAL,
	.cabc_sel = -EINVAL,
@@ -1404,6 +1415,15 @@ static const struct wled_var_cfg wled4_ovp_cfg = {
	.size = ARRAY_SIZE(wled4_ovp_values),
};

static const u32 wled4_sync_dly_values[] = {
	0, 200, 400, 600, 800, 1000, 1200, 1400,
};

static const struct wled_var_cfg wled4_sync_dly_cfg = {
	.values = wled4_sync_dly_values,
	.size = ARRAY_SIZE(wled4_sync_dly_values),
};

static inline u32 wled5_ovp_values_fn(u32 idx)
{
	/*
@@ -2126,6 +2146,11 @@ static int wled_configure(struct wled *wled, struct device *dev)
			.val_ptr = &cfg->string_cfg,
			.cfg = &wled_string_cfg,
		},
		{
			.name = "qcom,sync-dly",
			.val_ptr = &cfg->sync_dly,
			.cfg = &wled4_sync_dly_cfg,
		},
	};

	const struct wled_u32_opts wled5_opts[] = {