In previous merged commit: e7bca9b9, there is a bug about NULL
pointer dereference in qpnp_xxx_set functions. When led_mode
is MANUAL_MODE, there will be no PWM config data, so "pwm_cfg"
is a NULL pointer in this situation. Fix this by using it only
when the PWM config data exists.
CRs-Fixed: 622683
Change-Id: Ife218cc352e9620e86e0dda96335b6a43bdb65fb
Signed-off-by: Xu Kai <kaixu@codeaurora.org>
Some leds use PWM wave to control the brightness. The original
period granularity is using microsecond by default, it's a very
large granularity and will cause some user experience issues on
leds' brightness.
Auto select the PWM period granularity between microsecond and
nanosecond according to the range that hardware can support.
CRs-Fixed: 622683
Change-Id: I0669a0c88ca2ba491f0a53be6070476d61374d72
Signed-off-by: Xu Kai <kaixu@codeaurora.org>
MPP ports provide LEDs with current from 5mA to 40mA with a resolution
of 5mA. Due to this PMIC feature, MPP based LED intensity should be
rounded to reflect actual hardware status.
Change-Id: I306f19df0dd455dbaad9a364fb0df5694015d9ea
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
Add code to handle if there is only one regulator for
both flash and torch.
Change-Id: Ib88867cc56f48d589dcf5346c64964efbd4ad5a5
Signed-off-by: Abinaya P <abinayap@codeaurora.org>
If the strobe is from hardware, vreg_ok parameter is set to
0x40 and if the strobe is from software, vreg_ok parameter
is set to 0x80.
Change-Id: Ic692bee1e40c3ee0d69e319bf80cb8b135d6833c
Signed-off-by: Abinaya P <abinayap@codeaurora.org>
Since the last parameter of qpnp_led_masked_write function is
of type 'u8', make sure that only value of type 'u8' is passed
to this parameter of function to avoid truncation.
Change-Id: If047f844fc45713b77c4561a88253dade3c4c478
Signed-off-by: Abinaya P <abinayap@codeaurora.org>
The strobe bit is set to 1 when the flash led uses HW strobe and it is
set to 0 when the flash led uses SW strobe.
CRs-Fixed: 585414
Change-Id: Id65e9e70bc6c84ca5c8a9e65fd86e67b513e6745
Signed-off-by: Abinaya P <abinayap@codeaurora.org>
The enumerator WLED_OVP_37V is renamed to WLED_OVP_27V in
order to comply with the register documentation.
Change-Id: I78f885268194b53bb7c690a733ba2fe03cc33bfe
CRs-Fixed: 592660
Signed-off-by: Himanshu Aggarwal <haggarwa@codeaurora.org>
Kernel 3.10 defines pwm_config() to use nanosecond parameters, but
now some qcom drivers still use pwm_config() to pass microsecond
parameters. pwm-qpnp driver has already provided a new API called
pwm_config_us() to support microsecond parameters, so we should
modify to use pwm_config_us() instead of pwm_config() for these
drivers.
CRs-Fixed: 587715
Change-Id: I222440bb7636972b9ae35eba175ddffc58095ce8
Signed-off-by: Xu Kai <kaixu@codeaurora.org>
Flash duration is between 0ms and 1280ms in increments of 10ms and can
be stored in an 8-bit value. The current conversion formula to u8
results in shrinking of this value, which leads to a loss of
most-significant bit in flash duration. This erroneous calcuation
is corrected in the driver.
Change-Id: I43b486743703ed8007e2366e94ce145fdd4dc56e
CRs-Fixed: 582957
Signed-off-by: Himanshu Aggarwal <haggarwa@codeaurora.org>
Add missing NULL terminator for device match table in drivers leds-qpnp.c.
Without this, of_dev_lookup() may run off the end of the array looking
for bogus data.
Change-Id: Ie6c61b4500a5fbe792e3154a761c235573c7e6bf
CRs-Fixed: 582141
Signed-off-by: Himanshu Aggarwal <haggarwa@codeaurora.org>
Reset WLED enable register in wled initialization function to avoid
unnecessary power consumption during the device boots up.
CRs-Fixed: 546571
Change-Id: Id8d8ed9d3c20e2209847457c711b7645d5de45b3
Signed-off-by: Sarada Prasanna Garnayak <c_sgarna@codeaurora.org>
This change removes source files from the kernel tree that
were not being used during make. The list of used files
was generated using an annotated make log and was then
compared with new files added since the public release of
kernel version 3.10.00. New files which were added but
not used have been removed from the tree.
A diff was also run to determine the list of files that had
been modified since the release of kernel version 3.10.00.
These files were then scrubbed based on the current kernel
configuration, removing invalid and unused conditionals.
Some files which support planned functionality or are
useful in debugging have been excluded from this reap.
Change-Id: Ia44a224d3cea7bc78dd45e8a8279860d35d4b008
Signed-off-by: Ian Maund <imaund@codeaurora.org>
Upstream has removed <asm/system.h> so remove it from legacy uses. As all
the platforms we support utilize device tree we no longer need to include
<asm/mach-types.h>.
Change-Id: I8e53b1fd96ad26711fae59f081a8892f8bb184b7
Signed-off-by: Kumar Gala <galak@codeaurora.org>
Remove the redundant and extra schedule_work() call during
wled initialization sequence as __qpnp_led_work() call just
before schedule_work() has already does the wled initialization.
CRs-Fixed: 554413
Change-Id: Ib206cb6b67db0d53ddeb285a28940abca7c9fe6e
Signed-off-by: Sarada Prasanna Garnayak <c_sgarna@codeaurora.org>
MPP based LEDs may be powered by regulators. Regulator support is
necessary to properly use MPP based LEDs.
Change-Id: Ib3c328f0d5f35be8b171fdd76c75c4e85539c833
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
Flash LEDs require VIN_CHG to reach 5V to fire stabely. Adding delay
between flash enable and assert strobe when flash LEDs are turned on
and between flash strobe desert and module disable provides an improved
proformance. This also simplifies enable sequence so that the current
module enable sequence 0x00 to 0x80 before going to 0xE0 un-necessary.
CRs-Fixed: 539632, 548259
Change-Id: I26472c9ba445f3a311814ede8a821fa580f460b8
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
commit 61abeba5222895d6900b13115f5d8eba7988d7d6 upstream.
The wm831x-status driver was not converted to use a REG resource when they
were introduced and the rest of the wm831x drivers converted, causing it
to fail to probe due to requesting the wrong resource type.
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Add brightness control by changing the current supplied
to leds in manual mode.
CRs-fixed: 539440
Change-Id: I3170e0edb2e5a963ee006923cb6d80172290bc88
Signed-off-by: Mohan Pallaka <mpallaka@codeaurora.org>
Change WLED_MAX_CURR_MASK to 0x1F as max current value in
LED1_FULL_SCALE_CURRENT register occupies 5 bits
CRs-fixed: 540299
Change-Id: I5297adceae6052e97750fe95aa96a05dd3625b08
Signed-off-by: Himanshu Aggarwal <haggarwa@codeaurora.org>
The PWM controller in Qualcomm PMIC chipset needs to re-enabled
if the underlying PWM configuration is changed. With the
introduction of generic PWM framework in 3.10, the framework does not
pass through the PWM enable request if it finds that the PWM is
already enabled and silently discards the request. So add a check
to disable PWM before sending an enable request.
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
Set correct current sink when 1, 2 or 3 strings are in use.
Also, when using debug dumps, print all relevant registers.
Change-Id: Ib9ae9a959c3fcee0dcbb7b2882434cc6bcd126a3
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
Flash LED raises module temperature when turned on. Current
implementation disables timers in torch mode and this creates
potential risk of module damage due to raised temperature.
When flash LED is used as torch, watchdog timer should be enabled
to allow hardware to turn LEDs off according to predefined
duration.
Change-Id: I3768a04abd59c12f6bd1c355a5e194b1fa5b2bc4
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
Existing implementation turns on and off both flash LEDs simultaneously
due to earlier hardware bug. With hardware bug removed, enabling flash
LED individual control allows user to turn on or off one flash LED at a
time.
CRs-Fixed: 498526
Change-Id: I95448e1886dc2aba2da7bb4845c1b5993b3fe0da
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
Flash LED torch mode is not supported from hardware perspective
on PMIC with single flash LED module. Enabling torch mode on such
PMIC chips requires detection of PMIC peripheral subtype and
use flash mode with a lower current to implement torch.
Change-Id: I77228068c2c0ec4a0ed5614f4a991a3bce5db013
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
Flash LED uses sync boost as power source in torch mode. Enabling
sync boost when flash LED is used as torch light can make flash
LED working when battery is low.
Change-Id: Iab757de65087ee1a4312a5a9ec4d87c8bf3d5555
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
New hardware has different settings than old hardware, which
is no longer supported. Update settings as needed.
Change-Id: I91ae32ddb112bf64211bb7212b68152349a0457c
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
Previous implementation does not give a concise logic and is
not easy to operate regulators for LED when other LEDs are in
need. By modularizing regulator operation, it is easy to use the
logic when other LEDs need to use regulators.
Change-Id: I633c7e7d5af804c54adea6d8ac8f6567bdee2cc2
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
Keypad Backlight module supports LUT mode. Add
support for LUT mode and parse the parameters
from DTS file.
Change-Id: Ie293c46b32f1bb9a09ee4ddaae54632249e17256
Signed-off-by: Mohan Pallaka <mpallaka@codeaurora.org>
MPP can support input voltages from vin0 to vin3. Parse
this data from Device Tree and program appropriate MPP
registers. Also add support for minimum brightness that
MPP LED can support.
Change-Id: Ieb4f924321f224b1915539befe33abf3b03f6ac3
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
Signed-off-by: Mohan Pallaka <mpallaka@codeaurora.org>
the flash led pins flash_en and flash_now are connected with msm gpios.
add led gpio flash driver for qrd board.
Change-Id: I057958f8756c8fc31ba1a5032cf096d7a7e27e17
Signed-off-by: Tingting Yang <tingting@codeaurora.org>
Flash LED requires a max current of 200mA when used as torch light.
Existing implementation 1A for torch light and this might cause
issue for flash usage.
Change-Id: I44f1a9e73f27b6613356f82e20cf123f42172f8d
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
Allow user to control properties such as pwm period and
duty cycles at runtime through sysfs.
Change-Id: Icec7f3de25d0f4bc89666639402317ef8446e803
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
Regulator operation requires non-atomic context and current driver
does not put LED to sleep. This causes APPs crash. By introducing
work queue, the problem is solved.
Change-Id: Ifbd9f37fee893cb48c06e41a82202b93f3313704
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
Hardware team suggests another value for VREG_OK register because
current value used may potentially cause flash LED issue.
Change-Id: I8ff8aab409adcd1ca3fa306a0381c083c5bd0bf7
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
The current design enables PWM LPG high bank with out
checking the max current. So enable PWM LPG low bank when max
current configured as 4mA and enable PWM LPG high bank when
the max current configured as 8mA. Enabled both PWM LPG low bank
and PWM LPG high bank when max current configure as 12mA.
CRs-Fixed: 486318
Change-Id: Ib7177aafc63c4c33b8c144d665a11d5aaf0ef584
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
Add support for blink entry. When blink entry is used,
switch to LPG mode if not already in LPG mode, and switch
back when blink is done.
Change-Id: Id32e50f8484628bbf2ecc15e13cafa0dfee84829
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
Enable SMBB boost regulator when flash LED is turned on in flash
mode and disable it when flash LED is turned off. This avoids
losing USB when flash is turned on.
Change-Id: I31f22dc0f127bd4765466621e3c0882e15838d22
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
Create a new LED structure specific for PWM and include
it in necessary structures, RGB, MPP and KPDBL.
Change-Id: I28b3722ffb4b0e711a83d08fb62b0247e8e2b959
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
Update default settings for flash LED to optimize for
camera use, and set current flash LEDs to these values.
CRs-fixed: 474728
Change-Id: I9ad142eedf39ee1c3ba774863ad5571924024a33
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
Change torch trigger API by adding a separate torch node in DT and
by controlling that torch node to turn on and turn off torch led.
This eliminated sysfs entry to turn on torch mode.
Change-Id: Ia443f4bb21262df2c1d394f05bd72db08a079b7e
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
Add masks for mode ctrl and source select, so that
settings must be correctly set in device tree.
Change-Id: Ie6a30e2fb52be2124320d11fc6a7d673fefccccb
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
MPP Led call is missing a "break" in qpnp_led_set switch
statment. Add this in so that functions reserved for
differnet LED types are not called.
Change-Id: I7d8e76927db8cc3bc7d0d7c300bdbf886d0c0714
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
Add support for keypad backlight supported by PMIC.
The supporting parameters are parsed from DTS.
CRs-fixed: 446817
Change-Id: Ied5e1d6d333d1b9543cf7e1466c36a98c2bb7d2b
Signed-off-by: Mohan Pallaka <mpallaka@codeaurora.org>
Add appropriate settings to allow software to control
leds via MPP ports.
Change-Id: I923e31756526b6afa91ec41efc64414f63b8b888
Acked-by: Chun Zhang <chunz@qti.qualcomm.com>
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
Led values for PWM mode are integers, not u8. Read
in from device tree correctly to not lose any values.
CRs-fixed: 474766
Change-Id: Ibc0850375107c00b64e096e34f87713b863a2ca7
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
"Torch mode" is when the flash led is left on for an
undetermined amount of time. To accomplish this, secure
PMIC registers must be accessed and programmed. After
utilizing torch mode, the initial duration timeout
must be re-implemented.
CRs-Fixed: 454787
Change-Id: I061540e6f0a0ccd726dea619a81efda949608cb3
Acked-by: Chun Zhang <chunz@qti.qualcomm.com>
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
Change op_fdbck attribute in wled from bool to 8-bit int.
LED datasheet shows this variable should be able to select
LED outputs.
CRs-Fixed: 459520
Change-Id: I41c2408ca8c9e04040ac0d45cd6973f1d221264f
Acked-by: Chun Zhang <chunz@qti.qualcomm.com>
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
Settings for pause-hi, pause-lo, ramp step and flags were
previously set by default. For some patterns, they need to
be set to other values, so add them to device settings. Also
clarify other settings in documentation.
Change-Id: Ica9b254273ce700e27a84442f6682e3190777b5e
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
Brightness can be set with up to 12 bits, so use all 12.
Set this change in both driver and display settings.
CRs-fixed: 457937
Change-Id: I669e031afddc828068758752dbaac3576e34b2dd
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
Max current for all wleds will still be used to set
general properties, such as max brightness, but for
each string an individual max can be set.
CRs-Fixed: 377988
Change-Id: I73284176b04e016e315d36d680cef02119dec370
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
Add ability to choose which WLEDs to turn on, instead of
only 1, 2 or 3 starting from the left side.
Change-Id: I1c2ae88e9150801d98f9f85bbc4d2edf693de658
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
Flash headroom address should be offset 0x4a, not 0x49.
Additionally, WLED_MOD_SRC_SEL_REG must be set.
CRs-fixed: 452968
Change-Id: I102be8d420126fbe7743b41dcbd01d5f3a34ed95
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
Disable flash enable registers when the flash LED is not in use
in order to save power.
Also, correctly set FLASH_VREG_OK_FORCE register after each LED
flash so that software retains control of power_ok signal.
Change-Id: I9e2001434a540da521432c53f175f9bab2a4687b
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
In case a led is turned on by default, add an option to set the amount of
time in milliseconds before turn off.
Change-Id: I983c7c0e8091e57d512a5656152dc14dd86774bb
Signed-off-by: Asaf Penso <apenso@codeaurora.org>
An improper number of wleds string current sink registers are written
when the number of wled strings > 1. This must be corrected by shifting
the register bit over.
CRs-fixed: 434911
Change-Id: I3d729fcaa6ed3052d5ff4cc96719714c19f5072f
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
With existing mask in use, one bit of another functionality
of the register is at risk of being overwritten. Add a new
mask to leave bit <4> untouched.
CRs-fixed: 426193
Change-Id: I04a9d3496ef9ac569523f0d48569b0beee1bb509
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
There are 4 errors during the probe of leds-qpnp:
1) dev_kzalloc should only be called when num_leds > 0
2) led->num_leds is only set for the first child led node
3) return path does not unregister leds in all cases
4) cleanup for more than 1 led in probe fails
These must be corrected.
CRs-fixed: 422575
Change-Id: Ie0c4f3d8ee12dfabe48c1f78162941aedb5dbb52
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
Some of the register macros are incorrectly used. Fix
them to be used properly.
CRs-fixed: 421968
Change-Id: I036b6cc0146c6a5d6276f7a48e313d3cd948c8ef
Signed-off-by: Mohan Pallaka <mpallaka@codeaurora.org>
Add support to driver for RGB (red/green/blue, tri color)
LEDs. Support with PWM and LPG modes.
Change-Id: I0e48d4008bf9b1ddeb415e1edd5ea084c321ec36
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
Read in flash LED info from device tree, initialize then
enable leds when triggered at specified current.
Change-Id: I123af80ea7e6a077a7e291c096a347a7ed9e7569
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
This requires modifying current dt files for devices compatible
with leds-qpnp to use child nodes for each led. This is desirable
to support different types of LEDs in the future.
Change-Id: I839cb1e4b7ee4118ffcb69f1c46eadefe682338d
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
Triggers are called with spinlock and therefore we cannot
use mutex when setting led brightness levels.
Change-Id: I2078108286d40c2892681367988e984216acd4de
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
Content adaptive backlight control (CABC) support is needed to
control backlight by external PWM. It can be enabled by setting
"cabc_en = true" in the platform data wled_cfg structure.
CRs-fixed: 379347
Change-Id: If30defd3a3ca61283233c97ab26f255a3a62ad7c
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
QPNP (Qualcomm Plug N Play) LEDs driver is used for
controlling LEDs that are part of PMIC on Qualcomm reference
platforms. The PMIC is connected to Host processor via
SPMI bus. This driver supports various LED modules such as
WLED (white LED), RGB LED and flash LED. The first version of
the driver supports WLED and other features are added in the
next versions.
Change-Id: Ib2962c784cf566905f909faa0d46f8ebfee77b2d
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
Disable RGB module when the LED is turned off and enable the
module when the LED is on.
CRs-fixed: 381623
Change-Id: I0861c6a38fff19c9499d169deaa02d05696bd148
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
Add support for tricolor leds on Qualcomm's MSM
boards.
Change-Id: Ib05d6129f98cf67e7d208465a13cc6b1300c6277
Signed-off-by: Mohan Pallaka <mpallaka@codeaurora.org>
Make /sys/class/leds/lcd-brightness/max_brightness writable. This
will help limiting the max brightness and control the heat generated
by the LCD.
Change-Id: Ieb297f72f5fc26c19ca09c542e3a4140d01865d4
Signed-off-by: Praveen Chidambaram <pchidamb@codeaurora.org>
BUG=NONE
TEST=Built and ran on st1.5
Signed-off-by: Horace Fu <horace.fu@quantatw.com>
CRs-Fixed: 245334
Change-Id: Ifc589ff9f9e41c9a7b5672001637f849eb0fde3c
Signed-off-by: Karthik Parsha <kparsha@codeaurora.org>
Add PMIC8058 based keyboard backlight and low current leds driver.
keyboard backlight led supports upto 16 levels of backlight intensity,
which is mapped to 0..255 levels of brightness of led subsystem.
Three low current(40mA) led drivers of PMIC are also supported
in this driver.
CRs-Fixed: 211772
Change-Id: Ia65b083f6070666aaad95851c9b843332ce35c82
Signed-off-by: Trilok Soni <tsoni@qualcomm.com>
Add support for LEDs which are connected to PMIC MPPs.
Change-Id: Ib53510dbcb745e92e2100c1afc6dc2d94938fc85
CRs-fixed: 354967
Signed-off-by: Mohan Pallaka <mpallaka@codeaurora.org>
Add support for Qualcomm PMIC8XXX keyboard
backlight, flash and low current leds.
Change-Id: I460480e0c7f98da4cb27c76ca7ac65807df74a7f
Signed-off-by: Trilok Soni <tsoni@codeaurora.org>
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
During the development of this driver an in-house register documentation
was used. The last week some integration tests were done and this
problem was found. It turned out that the released register
documentation is wrong.
The fix is very simple: shift all masks by one.
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Bryan Wu <cooloney@gmail.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
GENERIC_GPIO now synonymous with GPIOLIB. There are no longer any valid
cases for enableing GENERIC_GPIO without GPIOLIB, even though it is
possible to do so which has been causing confusion and breakage. This
branch does the work to completely eliminate GENERIC_GPIO.
However, it is not trivial to just create a branch to remove it. Over
the course of the v3.9 cycle more code referencing GENERIC_GPIO has been
added to linux-next that conflicts with this branch. The following must
be done to resolve the conflicts when merging this branch into mainline:
* "git grep CONFIG_GENERIC_GPIO" should return 0 hits. Matches should be
replaced with CONFIG_GPIOLIB
* "git grep '\bGENERIC_GPIO\b'" should return 1 hit in the Chinese
documentation.
* Selectors of GENERIC_GPIO should be turned into selectors of GPIOLIB
* definitions of the option in architecture Kconfig code should be deleted.
Stephen has 3 merge fixup patches[1] that do the above. They are currently
applicable on mainline as of May 2nd.
[1] http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg428056.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iQIcBAABAgAGBQJRifUnAAoJEEFnBt12D9kBs2YP/0U6+ia+xYvkVaJc28PDVIzn
OReZNcJOYU8D5voxz0voaRD0EdcPwjbMu9Kp9aXMHlk4VxevF+8jCc/us0bIjtO1
VcB5VmSCIhMhxdnBlum11Mk7Vr5MCweyl9NBsypnPt8cl4obMBZHf2yzoodFktNb
wtyYlOb6FALtc6iDbOO6dG3w9F7FAOLvskUFzdv89m8mupTsBu9jw9NqFDbJHOex
rxq0Sdd+kWF/nkJVcV5Y6jIdletRlhpipefMJ9diexreHvwqh+c4kJEYZaXgB5+m
ha95cPbReK1d+RqzM3A8d4irzSVSmq4k7ijI6QkFOr48+AH7XsgKv5so885LKzMN
IIXg2Phm9i0H8+ecEvhcc4oIYBHJiEKK54Y0qUD9dqbFoDGPTCSqMHdSSMbpAY+J
bIIXlVzj1En3PPNUJLPt8q8Qz6WxCT9mDST3QSGYnD4o90HT+1R9j92RxGL6McOq
rUOyJDwmzFvpBvKK4raGdOU435M+ps2NPKKNIRaIGQPPY9rM1kN4YqvhXukEsC9L
3a3+3cQLh7iKxBHncxeQsJfethP1CPkJnzvF9r+ZZLf2rcPH4pbQIE2uO0XnX/nd
5/DKi0nGgAJ//GMMzdo3RiOA5zGFjIZ/KMvfhQldpP6qFJRhqdGi6FPlAcwr1z1n
YnCByPwwlvfC4LTXFOGL
=xodc
-----END PGP SIGNATURE-----
Merge tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux
Pull removal of GENERIC_GPIO from Grant Likely:
"GENERIC_GPIO now synonymous with GPIOLIB. There are no longer any
valid cases for enableing GENERIC_GPIO without GPIOLIB, even though it
is possible to do so which has been causing confusion and breakage.
This branch does the work to completely eliminate GENERIC_GPIO."
* tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux:
gpio: update gpio Chinese documentation
Remove GENERIC_GPIO config option
Convert selectors of GENERIC_GPIO to GPIOLIB
blackfin: force use of gpiolib
m68k: coldfire: use gpiolib
mips: pnx833x: remove requirement for GENERIC_GPIO
openrisc: default GENERIC_GPIO to false
avr32: default GENERIC_GPIO to false
xtensa: remove explicit selection of GENERIC_GPIO
sh: replace CONFIG_GENERIC_GPIO by CONFIG_GPIOLIB
powerpc: remove redundant GENERIC_GPIO selection
unicore32: default GENERIC_GPIO to false
unicore32: remove unneeded select GENERIC_GPIO
arm: plat-orion: use GPIO driver on CONFIG_GPIOLIB
arm: remove redundant GENERIC_GPIO selection
mips: alchemy: require gpiolib
mips: txx9: change GENERIC_GPIO to GPIOLIB
mips: loongson: use GPIO driver on CONFIG_GPIOLIB
mips: remove redundant GENERIC_GPIO select
GENERIC_GPIO is now equivalent to GPIOLIB and features that depended on
GENERIC_GPIO can now depend on GPIOLIB to allow removal of this option.
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Switch to using SIMPLE_DEV_PM_OPS macro to declare the driver's
pm_ops. It reduces code size. Also, CONFIG_PM_SLEEP is added to
suspend/ resume functions to prevent build warnings when
CONFIG_PM_SLEEP is not selected.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Add CONFIG_PM_SLEEP to suspend/resume functions to fix the following
build warning when CONFIG_PM_SLEEP is not selected. This is because
sleep PM callbacks defined by SIMPLE_DEV_PM_OPS are only used when
the CONFIG_PM_SLEEP is enabled.
drivers/leds/leds-bd2802.c:766:12: warning: 'bd2802_suspend' defined but not used [-Wunused-function]
drivers/leds/leds-bd2802.c:776:12: warning: 'bd2802_resume' defined but not used [-Wunused-function]
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Now LP55xx provides automatic clock detection API, lp55xx_is_extclk_used().
The clock configuration can be done by the driver itself.
(a) Concept
The default value is set by each driver with clock selection.
The internal clock selection bit is updated in case that the external clock
is not detected or clock rate is not 32KHz.
(b) Change on LP55xx platform data
The clock configuration is done automatically, so no need to define
'update_config' in the platform side.
Correlated information are removed in the documentations and header.
(c) Definitions moved from header to driver files
CONFIG register values are moved each driver, LP5521 and LP5562.
Not necessary definitions are removed also.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Program execution is timed with 32768Hz clock in the LP55xx family devices.
To run LED functionalities, LP55xx devices provide two options.
One is using internal clock. The other is using external clock.
This patch enables external clock detection automatically.
If external clock is not detected, then the internal clock will be used in the
LP55xx driver.
Valid clock rate is 32768Hz in LP55xx devices.
This new API is used in each LP55xx driver like LP5521 and LP5562.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
This patch fixes a regression introduced by commit 72052fcc10
("leds: leds-ns2: add device tree binding").
When the driver is initialized with device tree data, platform_data
pointer is NULL. This causes a kernel oops at removal.
To fix this bug, num_leds is moved into driver_data and platform_data
is not longer used from ns2_led_remove().
Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Call to led_pwm_set() can happen inside atomic context, like triggers.
If the PWM call can sleep, defer using a worker.
Signed-off-by: Florian Vaussard <florian.vaussard@epfl.ch>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
According to a sysfs documentation(Documentation/filesystem/sysfs.txt),
scnprintf() should be used in a read operation method.
It guarantees safe buffer size(PAGE_SIZE) which is allocated by the sysfs.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
LM355x and LM3642 support flash and torch functionality.
(Camera driver) (LED trigger for camera) (LED driver)
Turn on the flash ...> ledtrig_flash_ctrl(true) ...> LM355x or LM3642
brightness ctrl
<actual driving here>
Flash/torch LEDs are controlled by other driver using LED camera trigger
APIs, ledtrig_flash_ctrl()/ledtrig_torch_ctrl().
Then, actual device control is activated by each LED driver such like
LM355x or LM3642.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Some LED devices support flash/torch functionality through the LED subsystem.
This patch enables direct LED trigger controls by the driver.
Flash on/off and torch on/off can be done simply by other driver space.
Two trigger APIs are added, ledtrig_flash_ctrl() and ledtrig_torch_ctrl().
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
This eliminates having an #ifdef returning NULL for the case
when OF is disabled.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Provide some trace, though the hardware is most likely non-functional if
this happens.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
The gpio_request_one() flags parameter was set to:
GPIOF_DIR_OUT | !!brightness
GPIOF_DIR_OUT and GPIOF_DIR_IN are defined as below:
GPIOF_DIR_OUT (0 << 0)
GPIOF_DIR_IN (1 << 0)
So, when '!!brightness' is 1, the gpio pin can be set as input,
instead of output.
To prevent this problem, GPIOF_OUT_INIT flags should be used when
using gpio_request_one().
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
The devm_gpio_request_one() flags parameter was set to:
GPIOF_DIR_OUT | gpio_get_value(template->cmd)
GPIOF_DIR_OUT and GPIOF_DIR_IN are defined as below:
GPIOF_DIR_OUT (0 << 0)
GPIOF_DIR_IN (1 << 0)
So, when 'gpio_get_value(template->cmd)' is 1, the gpio pin can
be set as input, instead of output.
To prevent this problem, GPIOF_OUT_INIT flags should be used when
using devm_gpio_request_one().
Same goes for 'gpio_get_value(template->slow)' case.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
The devm_gpio_request_one() flags parameter was set to:
GPIOF_DIR_OUT | state
GPIOF_DIR_OUT and GPIOF_DIR_IN are defined as below:
GPIOF_DIR_OUT (0 << 0)
GPIOF_DIR_IN (1 << 0)
So, when 'state' is 1, the gpio pin can be set as input, instead
of output.
To prevent this problem, GPIOF_OUT_INIT flags should be used when
using devm_gpio_request_one().
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
CONFIG_HOTPLUG was removed, so __devexit or __exit of remove()
should not be used.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
CONFIG_HOTPLUG was removed, so __devexit or __exit of remove()
should not be used.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
For better driver management, new subdirectory, 'trigger' is created.
All LED trigger drivers are moved into this directory.
Internal header, 'leds.h' is included in each LED trigger drivers.
Fix the location of header file, "leds.h" -> "../leds.h" in driver files.
One exception is here, 'ledtrig-timer.c'.
There is no need to include 'leds.h'. so '#include "leds.h"' line was removed.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
LP5562 can drive up to 4 channels, RGB and White.
LEDs can be controlled directly via the led class control interface.
LP55xx common driver
LP5562 is one of LP55xx family device, so LP55xx common code are used.
On the other hand, chip specific configuration is defined in the structure
'lp55xx_device_config'
LED pattern data
LP5562 has also internal program memory which is used for running various LED
patterns. LP5562 driver supports the firmware interface and the predefined
pattern data as well.
LP5562 device attributes: 'led_pattern' and 'engine_mux'
A 'led_pattern' is an index code which runs the predefined pattern data.
And 'engine_mux' is updated with the firmware interface is activated.
Detailed description has been updated in the documentation files,
'leds-lp55xx.txt' and 'leds-lp5562.txt'.
Changes on the header file
LP5562 configurable definitions are added.
Pattern RGB data is fixed as constant value.
(No side effect on other devices, LP5521 or LP5523.)
(cooloney@gmail.com: remove redundant mutex_unlock(). Reported by Dan
Carpenter <dan.carpenter@oracle.com>)
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Pull LED subsystem update from Bryan Wu.
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds: (61 commits)
leds: leds-sunfire: use dev_err()/pr_err() instead of printk()
leds: 88pm860x: Add missing of_node_put()
leds: tca6507: Use of_get_child_count()
leds: leds-pwm: make it depend on PWM and not HAVE_PWM
Documentation: leds: update LP55xx family devices
leds-lp55xx: fix problem on removing LED attributes
leds-lp5521/5523: add author and copyright description
leds-lp5521/5523: use new lp55xx common header
leds-lp55xx: clean up headers
leds-lp55xx: clean up definitions
leds-lp55xx: clean up unused data and functions
leds-lp55xx: clean up _remove()
leds-lp55xx: add new function for removing device attribtues
leds-lp55xx: code refactoring on selftest function
leds-lp55xx: use common device attribute driver function
leds-lp55xx: support device specific attributes
leds-lp5523: use generic firmware interface
leds-lp5521: use generic firmware interface
leds-lp55xx: support firmware interface
leds-lp55xx: add new lp55xx_register_sysfs() for the firmware interface
...
Fixed the checkpatch errors and warnings as below:
ERROR: spaces required around that '=' (ctx:VxW)
WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
of_find_node_by_name() returns a node pointer with refcount incremented, use
of_node_put() on it when done.
of_find_node_by_name() will call of_node_put() against from parameter,
thus we also need to call of_node_get(from) before calling
of_find_node_by_name().
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
The correct dependency for the leds-pwm is PWM and not HAVE_PWM
since PWM drivers now have their own subsystem.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
LP55XX common device attributes, 'led_current' and 'max_current' are created
while loading the driver.
Those are LED device attributes which are removed automatically on releasing
led class devices - led_classdev_unregister().
Therefore, this duplicate code should be removed.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Now LP5521 and LP5523 drivers are based on new lp55xx structure.
So the author and copyrights are updated.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Remove unused definitions and change hex values to capital letters
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Old data structures and I2C function are not used any more.
Each driver uses the lp55xx common data and functions.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Replace lp5521/5523_unregister_sysfs() with lp55xx_unregister_sysfs().
On unloading the driver, running engines should be stopped.
Use explicit driver function, lp5521/5523_stop_engine().
Unused functions are removed.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
lp55xx_unregister_sysfs() is used for removing lp55xx device attributes.
Chip specific and engine attributes are removed on unloading the driver.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
LP5521 and LP5523 have a selftest function which is run via the sysfs.
Use lp55xx driver data and R/W functions rather than lp5521/5523 private data
and functions.
Additionally, if-statements are changed for code simplicity.
Unused functions, lp5521/5523_read() are removed.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
lp5521/5523_register_sysfs() are replaced with lp55xx common driver function,
lp55xx_register_sysfs().
Chip specific device attributes are configurable using 'dev_attr_group'.
Error condition name is changed:
use specific error condition, 'err_register_sysfs' rather than unclear name,
'fail2'.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
To support device specific attributes, new common driver function is added.
Eventually those are created on registering the sysfs with common dev attrs.
Furthermore, this patch makes adding device attributes simple in each driver.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
LP55xx common driver provides generic firmware interface
for running a LED pattern.
LP5521 and LP5523 have many device attributes for running patterns.
This patch cleans up those complex code.
Removed device attributes:
engine1_mode
engine2_mode
engine3_mode
engine1_load
engine2_load
engine3_load
engine1_leds
engine2_leds
engine3_leds
All device attributes and functions are replaced with two callback functions,
'firmware_cb' and 'run_engine'.
New engine functions:
lp5523_load/stop/run_engine(), lp5523_update_program_memory() and
lp5523_wait_opmode_done()
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
LP55xx common driver provides generic firmware interface
for running a LED pattern.
LP5521 and LP5523 have many device attributes for running patterns.
This patch cleans up those complex code.
Removed device attributes:
engine1_mode
engine2_mode
engine3_mode
engine1_load
engine2_load
engine3_load
led_pattern
All device attributes and functions are replaced with two callback functions,
'firmware_cb' and 'run_engine'.
New engine functions:
lp5521_load/stop/run_engine(), lp5521_update_program_memory() and
lp5521_wait_opmode_done()
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
This patch provides additional device attributes which enable
loading the firmware. ('select_engine' and 'run_engine')
To run a LED pattern, two parts of driver should be enabled.
Common features : lp55xx-common
===============================
Firmware interface for loading LED patterns
Chip specific features : leds-lp5521, leds-lp5523
=================================================
Register addresses for loading firmware data
Register addresses for running selected engine
Pattern programming sequence
============================
LP55xx chips have three program engines.
To load and run a LED pattern, the programming sequence is as follows.
(1) Select an engine number (1/2/3)
(2) Set engine mode to load
(3) Write pattern data into selected area
(4) Set engine mode to run
This sequence is almost same as the firmware interface.
(1) Select an engine number : 'select_engine' dev attribute
(2) Mode change to load : 'loading' of firmware class
(3) Write pattern data into selected area : 'data' of firmware class
(4) Mode change to run : 'run_engine' dev attribute
(1) and (4) are device specific features which provide callback functions
(2) and (3) are common features.
For example,
echo 1 or 2 or 3 > /sys/bus/i2c/devices/xxxx/select_engine
echo 1 > /sys/class/firmware/lp5521/loading
echo "4000600040FF6000" > /sys/class/firmware/lp5521/data
echo 0 > /sys/class/firmware/lp5521/loading
echo 1 > /sys/bus/i2c/devices/xxxx/run_engine
As soon as 'loading' is set to 0, registered callback is called.
Inside the callback, the selected engine is loaded and memory is updated.
To run programmed pattern, 'run_engine' attribute should be enabled.
Device specific data structure
==============================
o Firmware callback
load selected engine and update program memory
o Run engine
change the engine mode
o 'engine_idx' and firmware data, 'fw'
Those are used in the driver internally with callback functions
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
LP55xx family chips have internal program memory which run various patterns.
Using this memory, LEDs continue on blinking/dimming without continuous I2C
commands. That means the I2C HOST can be entered into sleep once the memory
is updated.
An application can get hex data from a file and write them into
the program memory through the I2C. This is general firwmare interface.
This patch is the initial step for adding the firmware interface.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Use lp55xx_unregister_leds() rather than duplicate code.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
To unregister led class devices and sysfs attributes,
LP5521 and LP5523 have each driver function.
This patch makes both drivers simple using common driver function,
lp55xx_unregister_leds().
And some unused variables are removed.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
LED current is configurable via the sysfs.
Max current is a read-only attribute.
These attributes code can be shared in lp55xx common driver.
Device attributes: 'led_current' and 'max_current'
move to lp55xx common driver
Replaced functions:
show_max_current() => lp55xx_show_max_current()
show_current() => lp55xx_show_current()
store_current() => lp55xx_store_current()
LED setting function: set_led_current()
Current registers are device specific, so configurable function is added
in each driver.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
lp5521_set_brightness() and lp5523_set_brightness() are replaced with
common function, lp55xx_set_brightness().
This function is invoked when the brightness of each LED channel is updated.
LP5521 and LP5523 have different register address for the brightness control,
so this work is done by chip specific brightness_work_fn().
lp5521/5523_led_brightness_work():
use lp55xx_led and lp55xx_chip data structure.
use lp55xx write function.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
lp5521_init_led() and lp5523_init_led() are replaced with one common function,
lp55xx_init_led().
Max channels is configurable, so it's used in lp55xx_init_led().
'LP5523_LEDS' are changed to 'LP5523_MAX_LEDS'.
lp55xx_set_brightness, lp55xx_led_attributes: skeleton
Will be filled in next patches.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
LED class devices are registered in lp5521_register_leds() and
lp5523_register_leds().
Two separate functions are merged into consolidated lp55xx function,
lp55xx_register_leds().
Error handling fix:
Unregistering LEDS are handled in lp55xx_register_leds() when LED registration
failure occurs. So each driver error handler is changed to 'err_register_leds'
Chip dependency: 'brightness_work_fn' and 'set_led_current'
To make the structure abstract, both functions are configured in each driver.
Those functions should be done by each driver because register control is
chip-dependant work.
lp55xx_init_led: skeleton
Will be filled in next patch
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Two separate de-init functions are merged into one common function.
And it is used in err_post_init of lp55xx_init_device().
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
lp5521/5523_init_device() are replaced with lp55xx common function,
lp55xx_init_device().
Error handler in init_device:
deinit function are matched with 'err_post_init' section in
lp55xx_init_device().
Remove LP5523 engine intialization code:
Engine functionality is not mandatory but optional.
Moreover engine initialization is done internally with device reset command.
Therefore, this code is unnecessary.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
LP5521/5523 chip configuration is replaced with lp55xx common function,
lp55xx_post_init_device().
Name change:
lp5521/5523_configure() to lp5521/5523_post_init_device()
These are called in init function.
Register access function
Argument type is changed from 'i2c_client' to 'lp55xx_chip'.
Use exported R/W functions of lp55xx common driver.
Temporary variables in lp5521/5523_init_device()
These functions will be removed but temporary variables are needed for
blocking build warnings - incompatible pointer.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
LP5521/5523 chip detection functions are replaced with lp55xx common function,
lp55xx_detect_device().
Chip dependent address and values are configurable in each driver.
In init function, chip detection is executed.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
LP5521/5523 reset device functions are moved to lp55xx common driver.
Value of register address and value are chip dependent.
Those are configured in each driver.
In init function, reset command is executed.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
LP5521/5523 platform data functions are moved to lp55xx common driver.
New init function, lp55xx_init_device() is created.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
This patch is a preceding step for making common lp55xx init function.
Return code:
Do not use 'OR' arithmetic for the result.
If some error occurs, just return it.
Remove engine verification code:
To check whether internal engine works or not, many lines of code are executed.
However, this job is unnecessary during the chip initialization because
the engine usage is not mandatory but optional function.
LED engines are enabled when specific LED pattern is loaded.
Therefore, this verification code is removed.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
This patch is a preceding step for making common lp55xx init function.
LP5521_REG_R_CURRENT register code moved:
Chip specific code moved from lp5521_init_device() to lp5521_configure().
Remove engine init function:
LP5521 has internal program engines which are used for running LED patterns.
(blinking, ramp up/down and other emotional visual effects)
Engine initialization is done by reset command in lp5521_init_device().
Remove this duplicate code.
Return code:
Do not use 'OR' arithmetic for the result.
If some error occus, just return it.
Enable latency:
Use explicit named function, lp5521_wait_enable_done().
According to the datasheet, 500us is guaranteed time.
Thus wait time is changed from 1000us to 500us.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
LP5521 and LP5523 data structures have common features.
Use common lp55xx data structures rather than chip specific data.
Legacy code in probe is replaced with this new data structures.
lp55xx_chip : Common data between lp5521_chip and lp5523_chip
lp55xx_led : Common LED structure between lp5521_led and lp5523_led
lp55xx_platform_data : Common platform data between lp5521_platform_data and
lp5523_platform_data
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Change the name of chip data structure and platform data.
This patch is a preceding step for cleaning up lp5521/5523 probe and remove.
These data will be replaced with new lp55xx common data structures
in next patch.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
This patch supports basic common driver code for LP5521, LP5523/55231 devices.
( Driver Structure Data )
lp55xx_led and lp55xx_chip
In lp55xx common driver, two different data structure is used.
o lp55xx_led
control multi output LED channels such as led current, channel index.
o lp55xx_chip
general chip control such like the I2C and platform data.
For example, LP5521 has maximum 3 LED channels.
LP5523/55231 has 9 output channels.
lp55xx_chip for LP5521 ... lp55xx_led #1
lp55xx_led #2
lp55xx_led #3
lp55xx_chip for LP5523 ... lp55xx_led #1
lp55xx_led #2
.
.
lp55xx_led #9
( Platform Data )
LP5521 and LP5523/55231 have own specific platform data.
However, this data can be handled with just one platform data structure.
The lp55xx platform data is declared in the header.
This structure is derived from leds-lp5521.h and leds-lp5523.h
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Chip specific function is configured when the device is initialized.
So _configure() is moved to each device init function.
If chip configuration gets failed, the device is de-initialized in
each _init_device(), not probe().
For compile error fix, function type declarations are added.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Use explicit each driver function rather than raw command.
These function will be merged into the lp55xx common driver.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
To make LED unregistration code simple, new function, _unregister_leds()
is added in each driver.
This patch is a preceding step for lp55xx common driver architecture.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
To make LED initialization code simple, new function, _register_leds()
is added at each driver.
This patch is a preceding step for lp55xx common driver architecture.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Device de-initialization code is moved to _deinit_device() at each driver.
This patch is a preceding step for lp55xx common driver architecture.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
To make _probe() simple, device initialization code is moved to
_init_device() at each driver.
This patch is a preceding step for lp55xx common driver architecture.
leds-lp5521:
When 'lp5521_init_device()' gets failed, error handling should be 'fail1'
rather than 'fail2'.
fail1: releasing platform resource and return code
fail2: releasing allocated LED devices with handling 'fail1'
The 'lp5521_init_device()' is called before creating LED devices.
Thus, 'goto fail1' is proper error handler of this function.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
This macro is used to create a struct pci_device_id array.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>