Commit Graph

13 Commits

Author SHA1 Message Date
Subbaraman Narayanamurthy a582b8a0e5 pwm: qpnp: do not control EN_PWM_OUTPUT for LPG lite peripherals
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>
2015-03-14 04:29:33 -07:00
Subbaraman Narayanamurthy a088bc4e1c pwm: qpnp: Fix wrong usage of ramp control address
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>
2014-10-13 10:37:50 -07:00
Subbaraman Narayanamurthy 33094d5201 pwm: qpnp: Read dtest configuration before checking mode
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>
2014-09-11 18:28:07 -07:00
Subbaraman Narayanamurthy da9e0db11c pwm: qpnp: Add support for configuring LPG to DTEST
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>
2014-08-27 15:03:12 -07:00
Subbaraman Narayanamurthy 907b090a5a pwm: qpnp: Allocate the base for pwm chip automatically
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>
2014-08-19 16:20:38 -07:00
Prasad Sodagudi 17a5e3c020 pwm: qpnp: re-enable PWM or LUT output when configuration is changed
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>
2014-07-29 11:03:22 -07:00
Prasad Sodagudi 46883f3b59 pwm: qpnp: correct LUT mode LPG disable steps
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>
2014-07-16 23:25:05 +05:30
Mohan Pallaka 57b2345726 pwm: qpnp: add PWM sync for 8994 PMIC
PWM channels in PMIC 8994 use sync to update
the PWM values.

Change-Id: I72e6bac2a94ec745957764c4a9904d7ba08786e9
Signed-off-by: Mohan Pallaka <mpallaka@codeaurora.org>
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
2014-06-15 12:58:01 +05:30
Xu Kai 3044bc94e9 pwm: qpnp: use the correct parameter to check the change of PWM period
"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>
2014-04-21 17:23:03 +08:00
Xu Kai 82d4c56831 pwm: qpnp: provide both nsec/usec-supported pwm config() functions
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>
2013-12-12 12:47:55 +08:00
Prasad Sodagudi 3811a22bc7 qpnp: pwm: remove the PWM Channel ID dependency
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>
2013-09-13 13:59:16 +05:30
Prasad Sodagudi 94950490e5 qpnp: pwm: Force the pwm size selection
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>
2013-09-04 17:28:25 -07:00
Prasad Sodagudi 5f8d9ac84f pwm: Refactor Qualcomm pwm driver to support upstream pwm framework
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>
2013-09-04 17:24:26 -07:00