pwm: qti-lpg: Read tick duration via device tree
Tick duration defines the tick duration (in microseconds) for the clock that PPG uses which is used to program the ramp step duration for the pattern. If unspecified, the default value is 7800 us. Change-Id: I7cd96d74a39becffbf9a008610c0092ad2462446 Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
This commit is contained in:
parent
6d56178cb7
commit
fe41af3d8f
@ -173,6 +173,7 @@ struct qpnp_lpg_lut {
|
||||
enum ppg_num_nvmems nvmem_count;
|
||||
u32 reg_base;
|
||||
u32 *pattern; /* patterns in percentage */
|
||||
u32 ramp_step_tick_us;
|
||||
};
|
||||
|
||||
struct qpnp_lpg_channel {
|
||||
@ -550,8 +551,8 @@ static int qpnp_lpg_set_sdam_ramp_config(struct qpnp_lpg_channel *lpg)
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Set ramp step duration, one WAIT_TICK is 7.8ms */
|
||||
val = (ramp->step_ms * 1000 / 7800) & 0xff;
|
||||
/* Set ramp step duration, in ticks */
|
||||
val = (ramp->step_ms * 1000 / lpg->chip->lut->ramp_step_tick_us) & 0xff;
|
||||
if (val > 0)
|
||||
val--;
|
||||
addr = SDAM_REG_RAMP_STEP_DURATION;
|
||||
@ -1549,6 +1550,7 @@ static int qpnp_lpg_get_nvmem_dt(struct qpnp_lpg_chip *chip)
|
||||
return rc;
|
||||
}
|
||||
|
||||
#define DEFAULT_TICK_DURATION_US 7800
|
||||
static int qpnp_lpg_parse_dt(struct qpnp_lpg_chip *chip)
|
||||
{
|
||||
int rc = 0, i;
|
||||
@ -1608,6 +1610,10 @@ static int qpnp_lpg_parse_dt(struct qpnp_lpg_chip *chip)
|
||||
return rc;
|
||||
}
|
||||
|
||||
chip->lut->ramp_step_tick_us = DEFAULT_TICK_DURATION_US;
|
||||
of_property_read_u32(chip->dev->of_node, "qcom,tick-period-us",
|
||||
&chip->lut->ramp_step_tick_us);
|
||||
|
||||
rc = qpnp_lpg_parse_pattern_dt(chip, SDAM_LUT_COUNT_MAX);
|
||||
if (rc < 0) {
|
||||
of_node_put(chip->pbs_dev_node);
|
||||
|
Loading…
Reference in New Issue
Block a user