In LPG lite peripherals, the EN_PWM_OUTPUT bit controls whether
or not the LPG_OUT signal is output onto DTEST as opposed to
whether or not the LPG_OUT signal is output in general. DTEST
output is not desired so ensure that the EN_PWM_OUTPUT bit is
never set for LPG lite peripherals.
CRs-Fixed: 803896
Change-Id: I34b7832e2b15e60b5bf2d9bcc0837af67f6d5400
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
Currently, the ramp control address is determined only by checking the
HW revision of LPG. However, that only applies to LPG peripherals of
LPG_CHAN subtype. Read the subtype as well so that the proper address
offset for ramp control can be determined and used.
CRs-Fixed: 733418
Change-Id: I404c66695eb8a9ab942b0a5d8a82c17b6016953a
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
In certain cases like PWM configuration handoff from the bootloader,
it's not required to configure the PWM channel during probe. So
mode-select will not be specified. Without mode-select, driver will
skip reading dtest related configuration. However this has to be
still read from the device tree and stored for controlling the
PWM configuration further. Hence move reading the dtest related
configuration before reading the mode-select.
Change-Id: Ia3378d98e172b55f47ac6acebbc4e8c525cb963e
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
LPG channel outputs can be configured to route them to DTEST
lines so that they can be made available externally on MPP or
GPIO pins. This will be helpful for testing the channel output.
CRs-Fixed: 705733
Change-Id: I8e04344fa1df677400bd4b2a50af5f0d04f1c346
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
Currently we're setting the base of a pwm chip with the channel number
while adding the pwm chip. Generic pwm driver maintains a single
bitmap for the channels from multiple devices. If there are multiple
PWM hardware blocks with the same channel number, this causes a
probe failure for the second device as that base is allocated already
for the first device. Fix that by setting the base to be allocated
automatically.
Change-Id: If533ab0e70b5e32adac9ab53efdb6cd30edacadb
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
The PWM controller in Qualcomm PMIC chipset needs to re-enabled
if the underlying PWM configuration is changed. Currently all
the PWM client drivers are disabling pwm before changing configuration
and there is no output from PWM while changing the configuration.
Hence re-enable PWM or LUT output whenever the PWM or LUT
configuration is changed. This will allow clients to change
the configuration without first calling pwm_disable().
Change-Id: I3dd1b6644c2c04bdfb053ee7c6d18c59ae129295
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
Modify the pwm-qpnp driver in order to remove RAMP_CONTROL
register writes during LPG disable while in LUT mode.
This is needed to fix the LED blink functionality
when LPG enable/disable operations are performed continously
CRs-Fixed: 593837
Change-Id: I915eb7620902911ef8d3f8d44c9b75986bc69bd1
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
"pwm->period" is an external parameter that will be updated out
of the pwm-qpnp driver unexpectedly. It's improper to use this
parameter to check whether the expected period is different from
the one being used. "chip->pwm_config.pwm_period" is a pwm-qpnp
internal parameter, which always represents the current period,
so use it to fix the problem.
Change-Id: I455b828c8c9270ef0f32ab3533daa1bc2c7d183d
Signed-off-by: Xu Kai <kaixu@codeaurora.org>
Kernel 3.10 introduces pwm framework, and the standard pwm_config()
API uses nanosecond-level parameters, so we should implement it.
But Qualcomm platform should support 384 seconds pwm-period at most,
the above standard API couldn't satisfy the requirement of the bigger
period, so we also provide pwm_config_us() this such platform related
API.
CRs-Fixed: 587715
Change-Id: Ia3ea9904141f69c1f40a8619ba8d9fe891e3460a
Signed-off-by: Xu Kai <kaixu@codeaurora.org>
Existing driver uses the PWM channel ID to identify
PWM sizes are supported and to enable RAMP_CONTROL
register in LUT mode.
To support more than one PMIC chip in system,
this channel ID dependency breaks LPG functionality.
So add supported_sizes field for every LPG/PWM to
dynamically identify supported sizes of LPG/PWM channel.
Also to start the ramp in LPG mode, ramp_index is required
for every LPG to update the RAMP_CONTROL register without
depending on channel ID.
Change-Id: Ic4a73c7ea1b8d581d71687a7baaf411b67851f0e
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
For certain use cases pwm size need to restricted
to avoid dynamic pwm size selection based on the
pwm period value. Currently pwm freqency and pwm
sizes are selected for a given pwm period. Restrict
pwm size to a specific value and select pwm frequency
closest to pwm period requested.
CRs-Fixed: 529920
Change-Id: I42d4d9621312adf25061b7a9b52056806f8d9b2b
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
Linux 3.10 version includes generic PWM framework support,
therefore update the existing Qualcomm PWM drivers to use the
framework. Rename the qpnp-pwm driver to align with upstream
pwm file nomenclature. Also, revert the pwm header back to linux 3.10.
The changes to the pwm drivers are backward compatible so that they
do not break existing clients. Subsequent patches should include
changes to both PWM drivers and their clients so that usage of
deprecated APIs (i.e. pwm_request) can be removed.
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>