Add support for configuring user-defined ramp-pause-hi/lo count in SDAM
to support PPG with the following device tree properties.
- qcom,ramp-pause-hi-count
- qcom,ramp-pause-lo-count
The qpnp_lpg_parse_pattern_dt() function has been refactored to fix the
cyclomatic complexity warning.
Change-Id: Ib35dbe8ef0ff354ea84aeed8a24d41868a1b7502
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
PWM channels that are configured to support Variable Frequency Mode
generate a signal of fixed duty cycle (50%) and variable frequency. In
such cases, the desired frequency setting is calculated differently
internally, according to a new formula.
Change-Id: I5cbbab9fa75fdd22c75811e5f61e69b8f4abe020
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
Currently, an error log is printed every time when parsing a DT
property fails because of probe deferral. Fix it.
Change-Id: Ic63c18393494b38bfb09a7ca85fd738dd2de56fd
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
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>
PM8350C PWM PPG does away with the need to directly manage the PBS
triggering via the PBS driver APIs by using a single register write to
an SDAM register instead. A PBS sequence thus triggered should be duly
cleared before next use. The existing scheme is also retained for
backward compatibility with targets that use a single-nvmem scheme.
The new PBS triggering scheme also expects a change in the way the high
and low indices pertaining to the pattern are specified.
Change-Id: I7d07dc611f98ce32cf5e8ba7de758fbbc3513f4b
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
On PMICs such as PM8350C, the lookup table containing the pattern data
is stored in a separate nvmem device from the one where the per-channel
data is stored.
Add two separate nvmems to handle this case while maintaining backward
compatibility for those targets that use only a single nvmem device.
Differentiate between the two schemes via an enum.
Change-Id: I2826a9acc8cee4d83b6cf2bf2d4d60b1ec3b67d7
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
The memory allocated for the lookup table (LUT) is getting cleared even
when a valid nvmem and PBS configuration is detected. Fix this by
ensuring that this happens only when neither a LUT peripheral's address
nor a valid nvmem configuration is detected.
Fixes: 218908e84878 ("pwm: pwm-qti-lpg: Refactor qpnp_lpg_parse_dt() for
readability").
Change-Id: I59467d46779e0a01bf0843863680ec2a8f85f2ce
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
Add helper functions to parse pattern-related properties and related
init logic, and clarify the qpnp_lpg_parse_dt function to make the code
flow clear in the cases wherein either SDAM or LUT, or neither of the
two is specified. Also add of_node_put() statements for the PBS node in
error paths.
Change-Id: I8055c61db9a8283e6c4d9dacf57012ff1d9227dd
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
Due to commit 95b65195d5 ("nvmem: core: Always reference the device
returned by nvmem_device_get()") failures in nvmem device lookup return
-EPROBE_DEFER instead of NULL. This causes probe failure of the
pwm-qti-lpg driver when pwm devices are defined in the device tree
without nvmem nodes, which is undesirable.
Fix this by attempting to get the nvmem device only if it is present.
Change-Id: Ifa136bb9b78e4b9e0894854768e9a6cc060d5261
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
The QTI PWM LPG driver supports the configuration of PWM/LPG channels on
QTI PMICs.
This is a snapshot of the driver taken from msm-4.19 as of commit
cf2cbb63fb60 ("Merge "input: touchscreen: synaptics_tcm: enable touch
driver"") with the following modifications:
- Remove config_extend callback and pwm_get_period_extend()
- Remove struct output_pattern and all its references
- Remove enable, disable and config pwm_ops callbacks and instead use
only apply()
- Remove output_type callbacks
- Remove support for dbg_show callback
Change-Id: I28571a8c6d5b0d5ac0cad113e77f3b5de8bf97c4
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
[quic_collinsd@quicinc.com: fixed "sychronization" typo]
Signed-off-by: David Collins <quic_collinsd@quicinc.com>