mirror of
https://github.com/torvalds/linux.git
synced 2026-07-30 19:21:28 +02:00
pwm: pwm-qti-lpg: Fix pause_hi_count & pause_lo_count initialization
Currently, if qcom,ramp-pause-hi-count or qcom,ramp-pause-lo-count property is not defined in DT, then pause_hi_count/pause_lo_count will be initialized with incorrect values. Fix this. Change-Id: I1bd91b64a795730bfbae406111c53a691e314196 Signed-off-by: Anjelique Melendez <quic_amelende@quicinc.com>
This commit is contained in:
parent
642889346a
commit
db8db967e1
|
|
@ -1,7 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2021-2022, Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) "%s: " fmt, __func__
|
||||
|
|
@ -1551,19 +1551,21 @@ static int qpnp_lpg_parse_ramp_props_dt(struct device_node *node,
|
|||
ramp->pattern_repeat = of_property_read_bool(node,
|
||||
"qcom,ramp-pattern-repeat");
|
||||
|
||||
ramp->pause_hi_count = 0;
|
||||
rc = of_property_read_u32(node, "qcom,ramp-pause-hi-count", &tmp);
|
||||
if (rc < 0)
|
||||
ramp->pause_hi_count = 0;
|
||||
else if (chip->use_sdam && tmp > SDAM_PAUSE_COUNT_MAX)
|
||||
return -EINVAL;
|
||||
ramp->pause_hi_count = (u8)tmp;
|
||||
if (!rc) {
|
||||
if (chip->use_sdam && tmp > SDAM_PAUSE_COUNT_MAX)
|
||||
return -EINVAL;
|
||||
ramp->pause_hi_count = (u8)tmp;
|
||||
}
|
||||
|
||||
ramp->pause_lo_count = 0;
|
||||
rc = of_property_read_u32(node, "qcom,ramp-pause-lo-count", &tmp);
|
||||
if (rc < 0)
|
||||
ramp->pause_lo_count = 0;
|
||||
else if (chip->use_sdam && tmp > SDAM_PAUSE_COUNT_MAX)
|
||||
return -EINVAL;
|
||||
ramp->pause_lo_count = (u8)tmp;
|
||||
if (!rc) {
|
||||
if (chip->use_sdam && tmp > SDAM_PAUSE_COUNT_MAX)
|
||||
return -EINVAL;
|
||||
ramp->pause_lo_count = (u8)tmp;
|
||||
}
|
||||
|
||||
if (chip->use_sdam)
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user