Commit graph

825 commits

Author SHA1 Message Date
Olof Johansson 33fc94506b leds: pwm: Remove a warning on non-DT platforms
This removes a warning on non-DT-enabled platforms:

drivers/leds/leds-pwm.c: In function 'led_pwm_create_of':
drivers/leds/leds-pwm.c:88:22: warning: unused variable 'node'

Really caused by the local variable that is assigned to and then never
used. Just do away with the local var, it's not needed.

Technically this code path can never be entered without DT enabled,
since there's an earlier check about number of children in the calling
function, but the compiler can't see that.

Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2014-01-27 17:28:51 -08:00
Xiubo Li fc1aee038b leds: leds-pwm: fix duty time overflow.
Overflow maybe occurs when calculates the duty time. For instance,
the period time is 990000000ns, and the max_brightness is 127, when
setting the brightness to 12, the duty value will be 25906026ns, but
it should be 93543307ns.

Signed-off-by: Bryan Wu <cooloney@gmail.com>
2014-01-27 17:28:50 -08:00
Alexander Shiyan 3df22c06b9 leds: leds-mc13783: Remove unneeded mc13xxx_{un}lock
LED registers are used only in this driver, so no additional
locking is needed. Read-Modify-Write cycle in workqueue is already
protected by regmap.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2014-01-27 17:28:50 -08:00
Alexander Shiyan 01a7a063e8 leds: leds-mc13783: Remove duplicate field in platform data
LED platform data are overwhelmed by excessive field "max_cur"
which just replicates few bits of "led_control" field.
This patch removes this field and adds a definition for the
current settings in the header.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2014-01-27 17:28:49 -08:00
Chen Gang 33ca15325f drivers: leds: leds-tca6507: check CONFIG_GPIOLIB whether defined for 'gpio_base'
Need check CONFIG_GPIOLIB whether defined, just like another area has
done within this file. Or can not pass compiling when CONFIG_GPIOLIB
disabled.

The related error (with allmodconfig for metag):

    CC [M]  drivers/leds/leds-tca6507.o
  drivers/leds/leds-tca6507.c: In function 'tca6507_led_dt_init':
  drivers/leds/leds-tca6507.c:731: error: 'struct tca6507_platform_data' has no member named 'gpio_base'

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2014-01-27 17:28:49 -08:00
Milo Kim 93ad8a1d59 leds: lp5523: Support LED MUX configuration on running a pattern
There are two ways to run a pattern in LP5523.
One is using legacy sysfs files such as 'enginex_mode','enginex_load' and
'enginex_leds'. ('x' is from 1 to 3).
Among them, 'enginex_leds' are used for selecting specific LED channel MUX.
(MUX means which LEDs are used for running a pattern from LED 1 to 9.)

The other way is using the firmware interface.
In this mode, the default LED MUX strings are used.
In other words, LED MUX is not configurable on the fly.

This patch enables dynamic LED MUX configuration when the firmware is loaded.
By accessing the sysfs file 'enginex_leds', the LED channels can be configured.
To synchronize the operation mode, each engine mode should be set to 'LOAD'.

The documentation is updated as well.

Cc: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2014-01-27 17:28:48 -08:00
Milo Kim 28c9266b38 leds: lp5521/5523: Fix multiple engine usage bug
Whenever the engine is loaded by the user-application, the operation mode is
reset first. But it has a problem in case of multiple engine used because
previous engine settings are cleared.
The driver should update not whole 8bits but each engine bit by masking.

On the other hands, whole engines should be reset when the driver is unloaded
and on initializing the LP5523 driver.
So, new functions are used for this handling - lp5521/5523_stop_all_engines().

Cc: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2014-01-27 17:28:48 -08:00
NeilBrown 1f431afdb4 LEDS: tca6507 - fix up some comments.
In particular fix the capitalisation of GPIO and LED and
correct TCA6507_MAKE_CPIO, but also rewrite the comment about
platform-data to include reference to devicetree.

Also re-wrap comments to fit 80 columns.

Reported-by: Bryan Wu <cooloney@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2014-01-27 17:28:47 -08:00
NeilBrown 10ead6e599 LEDS: tca6507: add device-tree support for GPIO configuration.
The 7 lines driven by the TCA6507 can either drive LEDs or act as output-only
GPIOs.

To make this distinction in devicetree we use the "compatible" property.

If the device attached to a line is "compatible" with "gpio", we treat it
like a GPIO.  If it is "compatible" with "led" (or if no "compatible" value
is set) we treat it like an LED.

(cooloney@gmail.com: fix typo in the subject)

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2014-01-27 17:28:46 -08:00
NeilBrown 9334129e8e LEDS: tca6507 - fix bugs in parsing of device-tree configuration.
1/ The led_info array must be allocated to allow the full number
  of LEDs even if not all are present.  The array maybe be sparsely
  filled but it is indexed by device address so we must at least
  allocate as many slots as the highest address used.  It is easiest
  just to allocate all 7.

2/ range check the 'reg' value properly.

3/ led.flags must be initialised to zero, else all leds could
   be treated as GPIOs (depending on what happens to be on the stack).

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2014-01-27 17:28:42 -08:00
Linus Torvalds bb1281f2aa Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
Pull trivial tree updates from Jiri Kosina:
 "Usual rocket science stuff from trivial.git"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (39 commits)
  neighbour.h: fix comment
  sched: Fix warning on make htmldocs caused by wait.h
  slab: struct kmem_cache is protected by slab_mutex
  doc: Fix typo in USB Gadget Documentation
  of/Kconfig: Spelling s/one/once/
  mkregtable: Fix sscanf handling
  lp5523, lp8501: comment improvements
  thermal: rcar: comment spelling
  treewide: fix comments and printk msgs
  IXP4xx: remove '1 &&' from a condition check in ixp4xx_restart()
  Documentation: update /proc/uptime field description
  Documentation: Fix size parameter for snprintf
  arm: fix comment header and macro name
  asm-generic: uaccess: Spelling s/a ny/any/
  mtd: onenand: fix comment header
  doc: driver-model/platform.txt: fix a typo
  drivers: fix typo in DEVTMPFS_MOUNT Kconfig help text
  doc: Fix typo (acces_process_vm -> access_process_vm)
  treewide: Fix typos in printk
  drivers/gpu/drm/qxl/Kconfig: reformat the help text
  ...
2014-01-22 21:21:55 -08:00
Linus Torvalds 8e50966072 GPIO tree bulk changes for v3.14
A big set this merge window, as we have much going on in
 this subsystem. Major changes this time:
 
 - Some core improvements and cleanups to the new GPIO
   descriptor API. This seems to be working now so we can
   start the exodus to this API, moving gradually away from
   the global GPIO numberspace.
 
 - Incremental improvements to the ACPI GPIO core, and move
   the few GPIO ACPI clients we have to the GPIO descriptor
   API right *now* before we go any further. We actually
   managed to contain this *before* we started to litter
   the kernel with yet another hackish global numberspace for
   the ACPI GPIOs, which is a big win.
 
 - The RFkill GPIO driver and all platforms using it have
   been migrated to use the GPIO descriptors rather than
   fixed number assignments. Tegra machine has been migrated
   as part of this.
 
 - New drivers for MOXA ART, Xtensa GPIO32 and SMSC SCH311x.
   Those should be really good examples of how I expect a
   nice GPIO driver to look these days.
 
 - Do away with custom GPIO implementations on a major
   part of the ARM machines: ks8695, lpc32xx, mv78xx0.
   Make a first step towards the same in the horribly
   convoluted Samsung S3C include forest. We expect to
   continue to clean this up as we move forward.
 
 - Flag GPIO lines used for IRQ on adnp, bcm-kona, em,
   intel-mid and lynxpoint.
   This makes the GPIOlib core aware that a certain GPIO line
   is used for IRQs and can then enforce some semantics such
   as disallowing a GPIO line marked as in use for IRQ to be
   switched to output mode.
 
 - Drop all use of irq_set_chip_and_handler_name().
   The name provided in these cases were just unhelpful
   tags like "mux" or "demux".
 
 - Extend the MCP23s08 driver to handle interrupts.
 
 - Minor incremental improvements for rcar, lynxpoint, em
   74x164 and msm drivers.
 
 - Some non-urgent bug fixes here and there, duplicate
   #includes and that usual kind of cleanups.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJS3i/MAAoJEEEQszewGV1zVB8P/Rjzgx8To0gQPn49M4u/A1Mk
 mAzpUoKa05ILTKBm/bpWPYZPpg9PDqUxOYPsIDEAkc70BKMPTXxrYiE+LSfIzwaJ
 a8IRwOzNL7Iwc+zPNS/GrmRJyxymb4lmMD/fypk/YaumZ6j4Hbo+9R8Zct9gbZ5Q
 ZbKtz6kLhbkbNCc71bVMgk6yacSBx1ak8Xpd12HlW85NgOCoBj7/DI1Lb61x1ImY
 NYpSpmtfGGTkQLtBl5dTLefZOvL1dKSct9TMOsA2jzNqf3zA1YA6XOxPGHK/qtjq
 3s9cN1sIVF/g7sm1+qoKXe0OTQrXHT7SX8BH9/tb3MiKO8ItactlQUJlYNR3WFSN
 zm1PNe5zWr+GWzV0iUrqoMN4XX8nThiFDOxZpOwBTZcUD6qtDFIZp41M3qxwFTbJ
 hCtSQ8gUO1Ce+xtOQYYOwEkRS7FZa1Z+p/lendTFuGDh6DcXy97SrKkTktM4Q98B
 LhqrwUzCdES0ecNDi2+P5y4Fc7M0cMMn9SnFvbSBObLB89TF9uzMIn8jUBCZMvrM
 eAeZlRBYk8F+6F12higaWqZyiBKIEubXo/Z8T0L2KEDm/z/ddJvhQgBKvWlf3rqi
 RToD446rda+RhFBnxLZ3mTui5nZ2WyKTOqhVqeBuriJhE/cTUaQHUBUrbOwx20kE
 Xb9mQ2n3GRk2157n1CLY
 =lW2i
 -----END PGP SIGNATURE-----

Merge tag 'gpio-v3.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio

Pull GPIO tree bulk changes from Linus Walleij:
 "A big set this merge window, as we have much going on in this
  subsystem.  The changes to other subsystems (notably a slew of ARM
  machines as I am doing away with their custom APIs) have all been
  ACKed to the extent possible.

  Major changes this time:

   - Some core improvements and cleanups to the new GPIO descriptor API.
     This seems to be working now so we can start the exodus to this
     API, moving gradually away from the global GPIO numberspace.

   - Incremental improvements to the ACPI GPIO core, and move the few
     GPIO ACPI clients we have to the GPIO descriptor API right *now*
     before we go any further.  We actually managed to contain this
     *before* we started to litter the kernel with yet another hackish
     global numberspace for the ACPI GPIOs, which is a big win.

   - The RFkill GPIO driver and all platforms using it have been
     migrated to use the GPIO descriptors rather than fixed number
     assignments.  Tegra machine has been migrated as part of this.

   - New drivers for MOXA ART, Xtensa GPIO32 and SMSC SCH311x.  Those
     should be really good examples of how I expect a nice GPIO driver
     to look these days.

   - Do away with custom GPIO implementations on a major part of the ARM
     machines: ks8695, lpc32xx, mv78xx0.  Make a first step towards the
     same in the horribly convoluted Samsung S3C include forest.  We
     expect to continue to clean this up as we move forward.

   - Flag GPIO lines used for IRQ on adnp, bcm-kona, em, intel-mid and
     lynxpoint.

     This makes the GPIOlib core aware that a certain GPIO line is used
     for IRQs and can then enforce some semantics such as disallowing a
     GPIO line marked as in use for IRQ to be switched to output mode.

   - Drop all use of irq_set_chip_and_handler_name().  The name provided
     in these cases were just unhelpful tags like "mux" or "demux".

   - Extend the MCP23s08 driver to handle interrupts.

   - Minor incremental improvements for rcar, lynxpoint, em 74x164 and
     msm drivers.

   - Some non-urgent bug fixes here and there, duplicate #includes and
     that usual kind of cleanups"

Fix up broken Kconfig file manually to make this all compile.

* tag 'gpio-v3.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (71 commits)
  gpio: mcp23s08: fix casting caused build warning
  gpio: mcp23s08: depend on OF_GPIO
  gpio: mcp23s08: Add irq functionality for i2c chips
  ARM: S5P[v210|c100|64x0]: Fix build error
  gpio: pxa: clamp gpio get value to [0,1]
  ARM: s3c24xx: explicit dependency on <plat/gpio-cfg.h>
  ARM: S3C[24|64]xx: move includes back under <mach/> scope
  Documentation / ACPI: update to GPIO descriptor API
  gpio / ACPI: get rid of acpi_gpio.h
  gpio / ACPI: register to ACPI events automatically
  mmc: sdhci-acpi: convert to use GPIO descriptor API
  ARM: s3c24xx: fix build error
  gpio: f7188x: set can_sleep attribute
  gpio: samsung: Update documentation
  gpio: samsung: Remove hardware.h inclusion
  gpio: xtensa: depend on HAVE_XTENSA_GPIO32
  gpio: clps711x: Enable driver compilation with COMPILE_TEST
  gpio: clps711x: Use of_match_ptr()
  net: rfkill: gpio: convert to descriptor-based GPIO interface
  leds: s3c24xx: Fix build failure
  ...
2014-01-21 10:09:12 -08:00
Milo Kim e70988d1aa leds: lp5521/5523: Remove duplicate mutex
It can be a problem when a pattern is loaded via the firmware interface.
LP55xx common driver has already locked the mutex in 'lp55xx_firmware_loaded()'.
So it should be deleted.

On the other hand, locks are required in store_engine_load()
on updating program memory.

Reported-by: Pali Rohár <pali.rohar@gmail.com>
Reported-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Cc: <stable@vger.kernel.org>
2014-01-10 14:48:07 -08:00
Pavel Machek bfb18d824c lp5523, lp8501: comment improvements
Add some comments that are not obvious from first look at the driver
to lp5523, fix typo in lp8501.

Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-01-10 11:44:44 +01:00
Tushar Behera 224feb33a6 leds: s3c24xx: Fix build failure
Commit c67d0f2926 ("ARM: s3c24xx: get rid of custom <mach/gpio.h>")
removed the usage of mach/gpio.h file, but we need to include>
plat/gpio-cfg.h to avoid following build error.

Fixes following build error.
drivers/leds/leds-s3c24xx.c: In function ‘s3c24xx_led_probe’:
drivers/leds/leds-s3c24xx.c💯2: error: implicit declaration of
function ‘s3c_gpio_setpull’ [-Werror=implicit-function-declaration]

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
Acked-by: Bryan Wu <cooloney@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-01-07 18:39:48 +01:00
Peter Ujfalusi aa1a6d6d74 leds: pwm: Fix for deferred probe in DT booted mode
We need to make sure that the error code from devm_of_pwm_get() is the one
the module returns in case of failure.
Restructure the code to make this possible for DT booted case.
With this patch the driver can ask for deferred probing when the board is
booted with DT.
Fixes for example omap4-sdp board's keyboard backlight led.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-12-02 11:53:17 -08:00
Sebastian Reichel 30dae2f986 leds: lp55xx: handle enable pin in driver
This patch moves the handling of the chip's enable pin from the board
code into the driver. It also updates all board-code files using the
driver to incorporate this change.

This is needed for device tree support of the enable pin.

Signed-off-by: Sebastian Reichel <sre@debian.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-10-25 10:13:25 -07:00
Josh Wu b0bb83df0a leds-gpio: of: led should not be created if its status is disabled
now the leds-gpio driver will create every child led node without
checking the status is disabled or not.

for example, if we have a led node like d3, and its status is disabled:
	leds {
		d3 {
			label = "d3";
			gpios = <&pioE 24 0>;
			status = "disabled";
		};
	};

we except the d3 should not be created. And the gpios should not be
request as well.

But current driver will create d3 and request its gpio.

This patch fix this by using for_each_available_child_of_node() and
of_get_available_child_count() to enumerate all child nodes. So the
disabled node will be inavailable.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-10-25 10:12:55 -07:00
Maximilian Güntner bb6febdc90 leds: Added driver for the NXP PCA9685 I2C chip
The NXP PCA9685 supports 16 channels/leds using a 12-bit PWM (4095
levels of brightness)
This driver supports configuration using platform_data.

Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-10-22 10:57:35 -07:00
Sachin Kamat 1e08f72dd2 leds: pwm: Remove redundant of_match_ptr
The data structure of_match_ptr() protects is always compiled in.
Hence of_match_ptr() is not needed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-10-22 10:57:34 -07:00
Sachin Kamat c68f46dd6a leds: Include linux/of.h header
'of_match_ptr' is defined in linux/of.h. Include it explicitly.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-10-22 10:57:34 -07:00
Sachin Kamat b4f31ad618 leds: dac124s085: Remove redundant spi_set_drvdata
Driver core sets driver data to NULL upon failure or remove.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Guennadi Liakhovetski <lg@denx.de>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-10-22 10:57:34 -07:00
Linus Walleij f65f0a1a98 leds: lp55xx: enable setting default trigger
This enables setting a default trigger on an LP55xx channel,
either from platform data or device tree. This mechanism is
identical to the mechanism for GPIO LEDs and references the
common LEDs device tree bindings.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Milo Kim <milo.kim@ti.com>
Acked-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-10-22 10:57:34 -07:00
Sachin Kamat 2491c5c8c9 leds: blinkm: Remove redundant break
'break' after return is redundant. Remove it.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Jan-Simon Möller <dl9pf@gmx.de>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-10-22 10:57:34 -07:00
Linus Torvalds 5223161dc0 Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds
Pull led updates from Bryan Wu:
 "Sorry for the late pull request, since I'm just back from vacation.

  LED subsystem updates for 3.12:
   - pca9633 driver DT supporting and pca9634 chip supporting
   - restore legacy device attributes for lp5521
   - other fixing and updates"

* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds: (28 commits)
  leds: wm831x-status: Request a REG resource
  leds: trigger: ledtrig-backlight: Fix invalid memory access in fb_event notification callback
  leds-pca963x: Fix device tree parsing
  leds-pca9633: Rename to leds-pca963x
  leds-pca9633: Add mutex to the ledout register
  leds-pca9633: Unique naming of the LEDs
  leds-pca9633: Add support for PCA9634
  leds: lp5562: use LP55xx common macros for device attributes
  Documentation: leds-lp5521,lp5523: update device attribute information
  leds: lp5523: remove unnecessary writing commands
  leds: lp5523: restore legacy device attributes
  leds: lp5523: LED MUX configuration on initializing
  leds: lp5523: make separate API for loading engine
  leds: lp5521: remove unnecessary writing commands
  leds: lp5521: restore legacy device attributes
  leds: lp55xx: add common macros for device attributes
  leds: lp55xx: add common data structure for program
  Documentation: leds: Fix a typo
  leds: ss4200: Fix incorrect placement of __initdata
  leds: clevo-mail: Fix incorrect placement of __initdata
  ...
2013-09-12 11:35:33 -07:00
Linus Torvalds 44598f98b9 ARM: SoC board updates for 3.12
Board updates for 3.12. Again, a bit of domain overlap with SoC and DT branches,
 but most of this is around legacy code and board support. We've found that
 platform maintainers have a hard time separating all of these out and might
 move towards fewer branches for next release.
 
 - Removal of a number of Marvell Kirkwood board files, since contents
   is now common and mostly configured via DT.
 - Device-tree updates for Marvell Dove, including irqchip and clocksource
   setup.
 - Defconfig updates. Gotta go somewhere. One new one for Renesas Lager.
 - New backlight drivers for backlights used on Renesas shmobile platforms.
 - Removal of Renesas leds driver.
 - Shuffling of some of the new Broadcom platforms to give room for others in
   the same mach directory. More in 2.13.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJSKhrfAAoJEIwa5zzehBx3OOAQAJCWhoYaHvWmyAf+xCOQNpX2
 YgAngENW04VpHFOyn6BtoGv6+5JypdB2TmK3GHHlVJd1Im5mD1wgm8hAfgyV8lQ4
 UeJULdA2HZAstKeTirO65BIyUb5QIrWakF24ccfIfg2xeScM8FV0m8cmzeo3fYAf
 DmmeoSCmvTdu/cDWBNlsQZ/as8qCQwyF+5kZg+SMl1btA1Publu2I5lDE02TH46d
 sc5mN+ihw0JG62EJV7pov6uVyeFLExoTbrNfQZ4rixmKkMDS/jq5ZbBS5c0i8ULF
 s1UMSZtYTcUO9rAPv3+MOIc7fq7nKo9lLuwMrA1HHUEDJ2BEi8DIp99F+ZYm/MSL
 WpVxYNwOobPcMJBYGR2fy4GgpIyWB285GgrBUxcq7t0Xi4uBbptwjLhDE4d7LREV
 8guW251R+OEVPYcwFctsubnox0MViyC3CQ1FaAAdtTjpSKomlhk/yaxaQ9nGrxls
 QCZgXHWm4Ir3QYv8XfOn0X9vdP81EnX11SiwtrRSJ71QMs814nB8NdPDqU4VHsw8
 exKmqjq/Lt+F9Kpxn/FevNNuYOdefZNQi00yl3ERchdIGdvRwE/0yA0D69mpwIVr
 E41UwvH3g43vazCo2PMdWPWuFlpGMR3iZ4pXnDLH/w33ppfJWfokYwKSRQ/mu/MN
 LMjkwoZn1X+fZzNSh9/G
 =EGua
 -----END PGP SIGNATURE-----

Merge tag 'boards-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc

Pull ARM SoC board updates from Olof Johansson:
 "Board updates for 3.12.  Again, a bit of domain overlap with SoC and
  DT branches, but most of this is around legacy code and board support.
  We've found that platform maintainers have a hard time separating all
  of these out and might move towards fewer branches for next release.

   - Removal of a number of Marvell Kirkwood board files, since contents
     is now common and mostly configured via DT.
   - Device-tree updates for Marvell Dove, including irqchip and
     clocksource setup.
   - Defconfig updates.  Gotta go somewhere.  One new one for Renesas
     Lager.
   - New backlight drivers for backlights used on Renesas shmobile
     platforms.
   - Removal of Renesas leds driver.
   - Shuffling of some of the new Broadcom platforms to give room for
     others in the same mach directory.  More in 3.13"

* tag 'boards-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (67 commits)
  mmc: sdhci-bcm-kona: Staticize sdhci_bcm_kona_card_event
  mmc: sdhci-bcm-kona: Remove unneeded version.h inclusion
  ARM: bcm: Make secure API call optional
  ARM: DT: binding fixup to align with vendor-prefixes.txt (drivers)
  ARM: mmc: fix NONREMOVABLE test in sdhci-bcm-kona
  ARM: bcm: Rename board_bcm
  mmc: sdhci-bcm-kona: make linker-section warning go away
  ARM: tegra: defconfig updates
  ARM: dove: add initial DT file for Globalscale D2Plug
  ARM: dove: add GPIO IR receiver node to SolidRun CuBox
  ARM: dove: add common pinmux functions to DT
  ARM: dove: add cpu device tree node
  ARM: dove: update dove_defconfig with SI5351, PCI, and xHCI
  arch/arm/mach-kirkwood: Avoid using ARRAY_AND_SIZE(e) as a function argument
  ARM: kirkwood: fix DT building and update defconfig
  ARM: kirkwood: Remove all remaining trace of DNS-320/325 platform code
  ARM: configs: disable DEBUG_LL in bcm_defconfig
  ARM: bcm281xx: Board specific reboot code
  ARM bcm281xx: Turn on socket & network support.
  ARM: bcm281xx: Turn on L2 cache.
  ...
2013-09-06 13:34:43 -07:00
Mark Brown 61abeba522 leds: wm831x-status: Request a REG resource
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>
Cc: stable@vger.kernel.org # v3.7+
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-08-30 10:17:45 -07:00
Manfred Schlaegl c945cbcf45 leds: trigger: ledtrig-backlight: Fix invalid memory access in fb_event notification callback
fb_notifier_callback is called on any event fired by
fb_notifier_call_chain. Events may, or may not contain some data
(fb_event.data). In case of FB_EVENT_BLANK fb_event.data contains a
pointer to an integer holdingthe blank state. The Problem is, that in
ledtrig-backlight.c - fb_notifier_callback the pointer to blank state
is dereferenced BEFORE the event-type is checked.

Obviously this leads to problems with other events than FB_EVENT_BLANK,
where fb_event.data is undefined or NULL. It seems, that this problem
existed ever since the driver was added.

Like in drivers/video/backlight/backlight.c line 43 I would suggest to
return immediately on events other than FB_EVENT_BLANK.

Signed-off-by: Manfred Schlaegl <manfred.schlaegl@gmx.at>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-08-26 17:46:36 -07:00
Ricardo Ribalda Delgado 8a6acd648c leds-pca963x: Fix device tree parsing
A malformed device tree could lead into a segmentation fault if the reg
value of a led is bigger than the number of leds.

A valid device tree could have only information about the last led of the
chip. Fix the device tree parsing to handle those cases.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-08-26 17:22:14 -07:00
Ricardo Ribalda Delgado 56a1740c21 leds-pca9633: Rename to leds-pca963x
The driver now supports the chips pca9633 and pca9634, therefore we
rename the files to more generic and meaningul names

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-08-26 17:22:14 -07:00
Ricardo Ribalda Delgado a7d0e9884f leds-pca9633: Add mutex to the ledout register
To update an LED a register has to be read, updated and writen. If
another LED whas been updated at the same time, this could lead into
wrong updates.

This patch adds a common mutex to all the leds of the same chip to
protect the ledout register.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-08-26 17:22:14 -07:00
Ricardo Ribalda Delgado a5cd98b796 leds-pca9633: Unique naming of the LEDs
If there is more than one pca963x chips on the system and there are
some LEDs without platform_data names, the driver wont be able to
provide unique naming to them.

This will cause led_class_dev_register to fail, unregistering all the
LEDs of the chip.

This patch adds the i2c address to the name of the unnamed LEDs, making
them unique.

[  555.346827] ------------[ cut here ]------------
[  555.346844] WARNING: at /build/linux-voe0Su/linux-3.9.8/fs/sysfs/dir.c:536 sysfs_add_one+0x8b/0x9d()
[  555.346847] Hardware name: QT5022
[  555.346850] sysfs: cannot create duplicate filename '/class/leds/pca9633:6'
[  555.346853] Modules linked in: qt5038_platform(O+) leds_pca9633(O) hid_generic ledtrig_default_on rfcomm bnep bluetooth binfmt_misc nfsd auth_rpcgss nfs_acl nfs lockd dns_resolver fscache sunrpc nls_utf8 nls_cp437 vfat fat loop fuse joydev hid_multitouch usbhid hid acpi_cpufreq mperf kvm_amd kvm evdev pn533 nfc arc4 microcode pcspkr efivars k10temp ath9k ath9k_common ath9k_hw ath fglrx(PO) mac80211 cfg80211 video rfkill processor thermal_sys sp5100_tco button i2c_piix4 ext4 crc16 jbd2 mbcache sg sd_mod crc_t10dif ahci libahci igb i2c_algo_bit i2c_core dca ptp pps_core ehci_pci ohci_hcd ehci_hcd libata usbcore usb_common scsi_mod [last unloaded: leds_pca963x]
[  555.346940] Pid: 4766, comm: insmod Tainted: P        W  O 3.9-1-amd64 #1 Debian 3.9.8-1
[  555.346943] Call Trace:
[  555.346956]  [<ffffffff8103d153>] ? warn_slowpath_common+0x76/0x8c
[  555.346962]  [<ffffffff8103d202>] ? warn_slowpath_fmt+0x47/0x49
[  555.346968]  [<ffffffff8116005d>] ? sysfs_pathname+0x3b/0x41
[  555.346973]  [<ffffffff81160767>] ? sysfs_add_one+0x8b/0x9d
[  555.346978]  [<ffffffff811610a4>] ? sysfs_do_create_link_sd+0xe8/0x174
[  555.346985]  [<ffffffff81279250>] ? device_add+0x243/0x5ab
[  555.346991]  [<ffffffff81060a16>] ? complete_all+0x31/0x40
[  555.346998]  [<ffffffff8104991a>] ? init_timer_key+0xc/0x56
[  555.347004]  [<ffffffff8127964c>] ? device_create_vargs+0x82/0xb6
[  555.347009]  [<ffffffff812796af>] ? device_create+0x2f/0x31
[  555.347014]  [<ffffffff81060add>] ? should_resched+0x5/0x23
[  555.347021]  [<ffffffff812a3a92>] ? led_classdev_register+0x24/0x103
[  555.347028]  [<ffffffffa09d01c0>] ? pca9633_probe+0x173/0x239 [leds_pca9633]
[  555.347035]  [<ffffffff8127b504>] ? __driver_attach+0x73/0x73
[  555.347049]  [<ffffffffa009dfc9>] ? i2c_device_probe+0x63/0x88 [i2c_core]
[  555.347057]  [<ffffffff8127b373>] ? driver_probe_device+0x92/0x1b0
[  555.347064]  [<ffffffff81279c5c>] ? bus_for_each_drv+0x43/0x7d
[  555.347070]  [<ffffffff8127b2af>] ? device_attach+0x68/0x83
[  555.347078]  [<ffffffff8127a990>] ? bus_probe_device+0x25/0x8d
[  555.347083]  [<ffffffff812793f7>] ? device_add+0x3ea/0x5ab
[  555.347088]  [<ffffffff81060a16>] ? complete_all+0x31/0x40
[  555.347094]  [<ffffffff8104991a>] ? init_timer_key+0xc/0x56
[  555.347104]  [<ffffffffa009d3a1>] ? i2c_new_device+0x10d/0x179 [i2c_core]
[  555.347112]  [<ffffffffa008f036>] ? qt5038_init+0x36/0x1000 [qt5038_platform]
[  555.347119]  [<ffffffffa008f000>] ? 0xffffffffa008efff
[  555.347125]  [<ffffffff8100209e>] ? do_one_initcall+0x74/0x128
[  555.347131]  [<ffffffffa008f000>] ? 0xffffffffa008efff
[  555.347137]  [<ffffffff810836f5>] ? load_module+0x1af7/0x1dfc
[  555.347144]  [<ffffffff810801c5>] ? free_notes_attrs+0x3c/0x3c
[  555.347150]  [<ffffffff81083a98>] ? sys_init_module+0x9e/0xab
[  555.347157]  [<ffffffff8138be29>] ? system_call_fastpath+0x16/0x1b
[  555.347161] ---[ end trace ad00b85794e0de4d ]---
[  555.347448] leds-pca9633: probe of 0-006b failed with error -17

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-08-26 17:22:14 -07:00
Ricardo Ribalda Delgado af67384f01 leds-pca9633: Add support for PCA9634
Add support for PCA9634 chip, which belongs to the same family as the
9633 but with support for 8 outputs instead of 4.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-08-26 17:22:14 -07:00
Milo Kim daa124b1fe leds: lp5562: use LP55xx common macros for device attributes
Signed-off-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-08-26 17:22:13 -07:00
Milo Kim 2f733cad36 leds: lp5523: remove unnecessary writing commands
This patch reduces the number of programming commands.

(Count of sending commands)
Old code: 32 + program size (32 counts for clearing program memory)
New code: 32

Pattern buffer is initialized to 0 in this function.
Just update new program data and remaining buffers are filled with 0.
So it's needless to clear whole area.

Signed-off-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-08-26 17:22:13 -07:00
Milo Kim 45e611bfbe leds: lp5523: restore legacy device attributes
git commit db6eaf8388
(leds-lp5523: use generic firmware interface) causes an application conflict.
This interface should be maintained for compatibility.

Restored device attributes are 'engineN_mode', 'engineN_load' and
'engineN_leds'. (N = 1, 2 or 3)
A 'selftest' attribute macro is replaced with LP55xx common macro.
Those are accessed when a LED pattern is run by an application.

Use a mutex in lp5523_update_program_memory()
: This function is called when an user-application writes a 'engineN_load' file
or pattern data is loaded from generic firmware interface.
So, writing program memory should be protected.
If an error occurs on accessing this area, just it returns as -EINVAL quickly.
This error code is exact same as old driver function, lp5523_do_store_load()
because it should be kept for an user-application compatibility.
Even the driver is changed, we can use the application without re-compiling
sources.

Reported-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-08-26 17:22:13 -07:00
Milo Kim 224604389a leds: lp5523: LED MUX configuration on initializing
LED MUX start and stop address should be updated in the program memory
on LP5523 initialization.
LED pattern doesn't work without additional MUX address configuration.
This handling is done by new function, lp5523_init_program_engine().
Eventually, it's called during device initialization, lp5523_post_init_device().

This is a conflict after git commit 632418bf65
(leds-lp5523: clean up lp5523_configure()).
So it should be fixed.

Cc: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-08-26 17:22:13 -07:00
Milo Kim b9e1730b29 leds: lp5523: make separate API for loading engine
lp5523_load_engine()
  It is called whenever the operation mode is changed to 'load'.
  It is used for simple operation mode change.
  It will be used when engine mode and LED selection is updated in later patch.

lp5523_load_engine_and_select_page()
  Change the operation mode to 'load' and select program page number.
  This is used for programming a LED pattern at a time.
  So load_engine() is replaced with new API, load_engine_and_select_page()
  in lp5523_firmware_loaded().

Signed-off-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-08-26 17:22:13 -07:00
Milo Kim 1eca0b3ab8 leds: lp5521: remove unnecessary writing commands
This patch reduces the number of programming commands.

(Count of sending commands)
Old code: 32 + program size (32 counts for clearing program memory)
New code: 32

Pattern buffer is initialized to 0 in this function.
Just update new program data and remaining buffers are filled with 0.
So it's needless to clear whole area.

Signed-off-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-08-26 17:22:12 -07:00
Milo Kim c0e5e9b542 leds: lp5521: restore legacy device attributes
git commit 9ce7cb170f
may cause an application confict, engineN_mode and engineN_load.
This interface should be maintained for compatibility.

Restored device attributes are 'engineN_mode' and 'engineN_load'.
A 'selftest' attribute macro is replaced with LP55xx common macro.

Use a mutex in lp5521_update_program_memory()
: This function is called when an user-application writes a 'engineN_load' file
or pattern data is loaded from generic firmware interface.
So, writing program memory should be protected.
If an error occurs on accessing this area, just it returns as -EINVAL quickly.
This error code is exact same as old driver function, lp5521_do_store_load()
because it should be kept for an user-application compatibility.
Even the driver is changed, we can use the application without re-compiling
sources.

'led_pattern' attribute is not included
: engineN_mode and _load were created for custom user-application.
'led_pattern' is an exception. I added this attribute not for custom application
but for simple test. Now it is used only in LP5562 driver, not LP5521.

Signed-off-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-08-26 17:22:12 -07:00
Milo Kim 36030978f5 leds: lp55xx: add common macros for device attributes
This patch provides common macros for LP5521 and LP5523 device attributes and
functions.

(Device attributes)
LP5521: 'mode', 'load' and 'selftest'
LP5523: 'mode', 'load', 'leds' and 'selftest'

(Permissions)
mode: R/W
load: Write-only
leds: R/W
selftest: Read-only

Couple of lines are duplicate, so use these macros for adding device attributes
in LP5521 and LP5523 drivers.

Signed-off-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-08-26 17:22:12 -07:00
Milo Kim 6841a91dc5 leds: lp55xx: add common data structure for program
LP55xx family devices have internal three program engines which are used for
loading LED patterns. To maintain legacy device attributes, specific data
structure is used, 'mode' and 'led_mux'. The mode is used for showing/storing
current engine mode such like disabled, load and run. Then led_mux is used for
showing/storing current output LED selection.

This is only for LP5523/55231.

Signed-off-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-08-26 17:22:12 -07:00
Sachin Kamat b06cf2d7ec leds: ss4200: Fix incorrect placement of __initdata
__initdata should be placed between the variable name and equal
sign for the variable to be placed in the intended section.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Dave Hansen <dave@sr71.net>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-08-26 17:22:12 -07:00
Sachin Kamat 939086ea55 leds: clevo-mail: Fix incorrect placement of __initdata
__initdata should be placed between the variable name and equal
sign for the variable to be placed in the intended section.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Márton Németh <nm127@freemail.hu>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-08-26 17:22:11 -07:00
Simon Guinot d6d240bf52 leds: leds-netxbig: depends on ARCH_KIRKWOOD
With the DT conversion, the board Kconfig symbols MACH_ are going to be
removed. In order to prepare this removal, this patch replaces alls the
machines dependencies for leds-netxbig by ARCH_KIRKWOOD.

Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-08-26 17:22:11 -07:00
Simon Guinot d6626d1052 leds: leds-ns2: depends on ARCH_KIRKWOOD
With the DT conversion, the board Kconfig symbols MACH_ are going to be
removed. In order to prepare this removal, this patch replaces alls the
machines dependencies for leds-ns2 by ARCH_KIRKWOOD.

Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-08-26 17:22:11 -07:00
Antonio Ospite 29ab311c44 leds: leds-lp3944, fix "sparse" warning "mixing different enum types"
Fix a warning from "sparse":

drivers/leds/leds-lp3944.c:292:23: warning: mixing different enum types
drivers/leds/leds-lp3944.c:292:23:     int enum led_brightness  versus
drivers/leds/leds-lp3944.c:292:23:     int enum lp3944_status

Keeping track of LP3944_LED_STATUS_OFF and LP3944_LED_STATUS_ON only in
lp3944_led_set_brightness() is OK, as the handling of DIM (blinking)
mode[s] is in lp3944_led_set_blink().

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Reviewed-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-08-26 17:22:11 -07:00
Jingoo Han 2e87c09209 leds: leds-ss4200: Staticize nasgpio_led_get_attr()
nasgpio_led_get_attr() is used only in this file.
Fix the following sparse warning:

drivers/leds/leds-ss4200.c:200:5: warning: symbol 'nasgpio_led_get_attr' was not declared. Should it be static?

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-08-26 17:22:11 -07:00
Jingoo Han 87aae1ea82 leds: use dev_get_platdata()
Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-08-26 17:22:11 -07:00
Mark A. Greer 8465b01827 leds: pca9633: Add hardware blink support
Add hardware blinking support to the pca9633 driver.

NOTE: Hardware blinking violates the leds infrastructure
driver interface since the hardware only supports
blinking all LEDs with the same delay_on/delay_off
rates.  That is, only the LEDs that are set to blink
will actually blink but all LEDs that are set to blink
will blink in identical fashion.  The delay_on/delay_off
values of the last LED that is set to blink will be used
for all of the blinking LEDs.  If the hardware doesn't
support the requested blinking pattern, a default of
500ms on and off will be used.

Hardware blinking is disabled by default but can be enabled
by setting the 'blink_type' member in the platform_data
struct to 'PCA9633_HW_BLINK' or by adding the 'nxp,hw-blink'
property to the DTS.

(fengguang.wu@intel.com: Removes unneeded semicolon.)

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-08-26 17:22:10 -07:00
Kim, Milo 33b3a561f4 leds: support new LP8501 device - another LP55xx common
LP8501 can drive up to 9 channels like LP5523.
LEDs can be controlled directly via the I2C and programmable engines are
supported.

LP55xx common driver
 LP8501 is one of LP55xx family device, so LP55xx common code are used.
 Chip specific data is defined in the structure, 'lp55xx_device_config'.

Differences between LP8501 and LP5523
 Different register layout for LED output control and others.
 LP8501 specific feature for separate output power selection.
 LP8501 doesn't support external clock detection.
 Different programming engine data.

LP8501 specific feature - output power selection
 Output channels are selected by power selection - Vout or Vdd.
 Separate power for VDD1-6 and VDD7-9 are available.
 It is configurable in the platform data.
 To support this feature, LP55xx DT structure and header are changed.
 Device tree binding is updated as well.

LED pattern data
 Example pattern data is updated in the driver documentation.

Signed-off-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-08-26 17:22:10 -07:00
Tony Lindgren 81d2287809 leds: Add device tree binding for pca9633
Similar to tca6507, we can just parse the standard LED
properties for pca9633.

Tested on a pca9632, which is compatible with pca9633.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-08-26 17:22:10 -07:00
Greg Kroah-Hartman 5baa7503a7 leds: convert class code to use dev_groups
The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the led class code to use the
correct field.

Acked-by: Bryan Wu <cooloney@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26 18:05:17 -07:00
Laurent Pinchart ae3e4c2776 leds: Remove leds-renesas-tpu driver
The driver is superseded by the generic pwm-renesas-tpu driver used with
leds-pwm.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Bryan Wu <cooloney@gmail.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
2013-07-22 10:16:54 +09:00
Alexander Shiyan cf3b1c2ba3 leds: mc13783: Fix "uninitialized variable" warning
drivers/leds/leds-mc13783.c: In function 'mc13xxx_led_probe':
drivers/leds/leds-mc13783.c:195:2: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-07-02 08:44:02 -07:00
Shuah Khan 73e1ab41a8 leds: Convert led class driver from legacy pm ops to dev_pm_ops
Convert drivers/leds/led-class to use dev_pm_ops for power management and
remove Legacy PM ops hooks. With this change, led class registers
suspend/resume callbacks via class->pm (dev_pm_ops) instead of Legacy
class->suspend/resume. When __device_suspend() runs call-backs, it will
find class->pm ops for the led class.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-06-20 17:36:45 -07:00
Alexander Shiyan ae6cdb03ef leds: leds-mc13783: Add MC13892 LED support
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Tested-by: Philippe Retornaz <philippe.retornaz@epfl.ch>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-06-20 16:21:34 -07:00
Alexander Shiyan 9d263813c2 leds: leds-mc13783: Prepare driver to support MC13892 LEDs
This patch rewrite driver code to be ready to add support for
MC13892 LEDs and probe from devicetree.

(cooloney@gmail.com: fix one coding style issue when apply this patch)

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Tested-by: Philippe Retornaz <philippe.retornaz@epfl.ch>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-06-20 16:21:34 -07:00
Dan Carpenter fb277f5b3a leds: renesas-tpu: cleanup a small type issue
Static checkers complain that, although this is declared as an
unsigned long, we can only use the lower 32 bits.  For anything
higher, we hit bugs widening then bitwise negate or wrapping bugs
doing the left shift.

From looking at the context, this is not a problem because we only
use 16 bits.  I've changed some types to make it more clear.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-06-20 16:21:33 -07:00
Jingoo Han 84196a2ffb leds: use platform_{get,set}_drvdata()
Use the wrapper functions for getting and setting the driver data using
platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev,
so we can directly pass a struct platform_device.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-06-20 16:21:33 -07:00
Fabio Estevam bfa855bad3 leds: leds-gpio: Let device core handle pinctrl
Since commit ab78029 (drivers/pinctrl: grab default handles from device core)
we can rely on device core for handling pinctrl, so remove
devm_pinctrl_get_select_default() from the driver.

Reported-by: Stephen Warren <warren@wwwdotorg.org>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-06-20 16:21:33 -07:00
Axel Lin 28720cff9f leds: lp5562: Properly setup of_device_id table
Don't mix of_device_id entry in i2c_device_id table.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-06-20 16:21:33 -07:00
Axel Lin 33c88b67f3 leds: lp5523: Properly setup of_device_id table
Don't mix of_device_id entry in i2c_device_id table.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-06-20 16:21:33 -07:00
Axel Lin b548a34ba4 leds: lp5521: Properly setup of_device_id table
Don't mix of_device_id entry in i2c_device_id table.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-06-20 16:21:32 -07:00
Kim, Milo e015050cc5 leds: lp5562: support the device tree feature
The LP55xx DT structure is applicable to the LP5562 device.
The driver and documentation are updated.

Compatible property of the DT
: LP5521 and LP5223 were manufactured by National Semiconductor.
  LP5562 is a new device from Texas Instruments.

Cc: Gabriel Fernandez <gabriel.fernandez@stericsson.com>
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-06-20 16:21:32 -07:00
Kim, Milo 2dac912809 leds: lp55xx: support dynamic channel settings in the device tree structure
Currently, the LP55xx DT structure supports max 3 channels.
However, LP5523 has max 9 channels and LP5562 has 4 channels.
To enhance this constraint, the DT structure has been changed.

 (a) Use the child node for various channel settings instead of fixed array
 (b) Remove 'num_channel' property.
     This value can be retrieved by counting the children node.
 (c) 'chan-name' property supported
 (d) Documentation updates for LP5521 and LP5523

(cooloney@gmail.com: fix a coding style issue in leds-lp55xx.txt)

Cc: Gabriel Fernandez <gabriel.fernandez@stericsson.com>
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-06-20 16:21:32 -07:00
Jingoo Han a036e4cde5 leds: leds-ns2: remove unnecessary platform_set_drvdata()
The driver core clears the driver data to NULL after device_release
or on probe failure, since commit 0998d06310
(device-core: Ensure drvdata = NULL when no driver is bound).
Thus, it is not needed to manually clear the device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-06-20 16:21:32 -07:00
Jingoo Han cda7f61e26 leds: leds-mc13783: remove unnecessary platform_set_drvdata()
The driver core clears the driver data to NULL after device_release
or on probe failure, since commit 0998d06310
(device-core: Ensure drvdata = NULL when no driver is bound).
Thus, it is not needed to manually clear the device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-06-20 16:21:32 -07:00
Jingoo Han d9041d5886 leds: leds-gpio: remove unnecessary platform_set_drvdata()
The driver core clears the driver data to NULL after device_release
or on probe failure, since commit 0998d06310
(device-core: Ensure drvdata = NULL when no driver is bound).
Thus, it is not needed to manually clear the device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-06-20 16:21:32 -07:00
Jingoo Han a0f50b52ba leds: atmel-pwm: remove unnecessary platform_set_drvdata()
The driver core clears the driver data to NULL after device_release
or on probe failure, since commit 0998d06310
(device-core: Ensure drvdata = NULL when no driver is bound).
Thus, it is not needed to manually clear the device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-06-20 16:21:31 -07:00
Linus Walleij 7542a04b15 leds: lp55xx: add support for Device Tree bindings
This patch allows the lp5521 driver to be successfully probed and
initialised when Device Tree support is enabled.

Based on a patch by Gabriel Fernandez, rewritten in accordance
with review feedback.

Cc: Gabriel Fernandez <gabriel.fernandez@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-06-20 16:21:31 -07:00
Christian Gmeiner 4b949b8af1 drivers/leds/leds-ot200.c: fix error caused by shifted mask
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>
2013-05-24 16:22:51 -07:00
Timo Teräs 803d19d57a leds: leds-gpio: reserve gpio before using it
This reverts commit a99d76f (leds: leds-gpio: use gpio_request_one)
and commit 2d7c22f (leds: leds-gpio: set devm_gpio_request_one()
flags param correctly) which was a fix of the first one.

The conversion to devm_gpio_request in commit e3b1d44c (leds:
leds-gpio: use devm_gpio_request_one) is not reverted.

The problem is that gpio_cansleep() and gpio_get_value_cansleep()
calls can crash if the gpio is not first reserved. Incidentally this
same bug existed earlier and was fixed similarly in commit d95cbe61
(leds: Fix potential leds-gpio oops). But the OOPS is real. It happens
when GPIOs are provided by module which is not yet loaded.

So this fixes the following BUG during my ALIX boot (3.9.2-vanilla):

BUG: unable to handle kernel NULL pointer dereference at 0000004c
IP: [<c11287d6>] __gpio_cansleep+0xe/0x1a
*pde = 00000000
Oops: 0000 [#1] SMP
Modules linked in: leds_gpio(+) via_rhine mii cs5535_mfd mfd_core
geode_rng rng_core geode_aes isofs nls_utf8 nls_cp437 vfat fat
ata_generic pata_amd pata_cs5536 pata_acpi libata ehci_pci ehci_hcd
ohci_hcd usb_storage usbcore usb_common sd_mod scsi_mod squashfs loop
Pid: 881, comm: modprobe Not tainted 3.9.2 #1-Alpine
EIP: 0060:[<c11287d6>] EFLAGS: 00010282 CPU: 0
EIP is at __gpio_cansleep+0xe/0x1a
EAX: 00000000 EBX: cf364018 ECX: c132b8b9 EDX: 00000000
ESI: c13993a4 EDI: c1399370 EBP: cded9dbc ESP: cded9dbc
 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
CR0: 8005003b CR2: 0000004c CR3: 0f0c4000 CR4: 00000090
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: ffff0ff0 DR7: 00000400
Process modprobe (pid: 881, ti=cded8000 task=cf094aa0 task.ti=cded8000)
Stack:
 cded9de0 d09471cb 00000000 c1399260 cf364014 00000000 c1399260 c1399254
 d0949014 cded9df4 c118cd59 c1399260 d0949014 d0949014 cded9e08 c118ba47
 c1399260 d0949014 c1399294 cded9e1c c118bb75 cded9e24 d0949014 00000000
Call Trace:
 [<d09471cb>] gpio_led_probe+0xba/0x203 [leds_gpio]
 [<c118cd59>] platform_drv_probe+0x26/0x48
 [<c118ba47>] driver_probe_device+0x75/0x15c
 [<c118bb75>] __driver_attach+0x47/0x63
 [<c118a727>] bus_for_each_dev+0x3c/0x66
 [<c118b6f9>] driver_attach+0x14/0x16
 [<c118bb2e>] ? driver_probe_device+0x15c/0x15c
 [<c118b3d5>] bus_add_driver+0xbd/0x1bc
 [<d08b4000>] ? 0xd08b3fff
 [<d08b4000>] ? 0xd08b3fff
 [<c118bffc>] driver_register+0x74/0xec
 [<d08b4000>] ? 0xd08b3fff
 [<c118c8e8>] platform_driver_register+0x38/0x3a
 [<d08b400d>] gpio_led_driver_init+0xd/0x1000 [leds_gpio]
 [<c100116c>] do_one_initcall+0x6b/0x10f
 [<d08b4000>] ? 0xd08b3fff
 [<c105e918>] load_module+0x1631/0x1907
 [<c10975d6>] ? insert_vmalloc_vmlist+0x14/0x43
 [<c1098d5b>] ? __vmalloc_node_range+0x13e/0x15f
 [<c105ec50>] sys_init_module+0x62/0x77
 [<c1257888>] syscall_call+0x7/0xb
EIP: [<c11287d6>] __gpio_cansleep+0xe/0x1a SS:ESP 0068:cded9dbc
CR2: 000000000000004c
 ---[ end trace 5308fb20d2514822 ]---

Signed-off-by: Timo Teräs <timo.teras@iki.f>
Cc: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Raphael Assenat <raph@8d.com>
Cc: Trent Piepho <tpiepho@freescale.com>
Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Cc: Arnaud Patard <arnaud.patard@rtp-net.org>
Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Acked-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-05-21 11:26:53 -07:00
Linus Torvalds 5647ac0ad4 Removal of GENERIC_GPIO for v3.10
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
2013-05-09 09:59:16 -07:00
Alexandre Courbot 76ec9d18b8 Convert selectors of GENERIC_GPIO to GPIOLIB
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>
2013-04-16 18:47:14 +09:00
Jingoo Han df92d5ff5e leds: leds-asic3: switch to using SIMPLE_DEV_PM_OPS
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>
2013-04-01 11:04:54 -07:00
Jingoo Han cceba0e4b8 leds: leds-bd2802: add CONFIG_PM_SLEEP to suspend/resume functions
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>
2013-04-01 11:04:53 -07:00
Kim, Milo 81f2a5b4a0 leds: lp55xx: configure the clock detection
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>
2013-04-01 11:04:53 -07:00
Kim, Milo 53b4192266 leds: lp55xx: use common clock framework when external clock is used
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>
2013-04-01 11:04:53 -07:00
Simon Guinot 3de1929ba6 leds: leds-ns2: fix oops at module removal
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>
2013-04-01 11:04:52 -07:00
Florian Vaussard c971ff185f leds: leds-pwm: Defer led_pwm_set() if PWM can sleep
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>
2013-04-01 11:04:50 -07:00
Kim, Milo 24d3212847 leds: lp55xx: fix the sysfs read operation
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>
2013-04-01 11:04:50 -07:00
Kim, Milo 313bf0b1a0 leds: lm355x, lm3642: support camera LED triggers for flash and torch
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>
2013-04-01 11:04:50 -07:00
Kim, Milo 48a1d032c9 leds: add camera LED triggers
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>
2013-04-01 11:04:50 -07:00
Sachin Kamat fbd9df28fa leds: tca6507: Use of_match_ptr() macro
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>
2013-04-01 11:04:50 -07:00
Mark Brown d67eb8e66c leds: wm8350: Complain if we fail to reenable DCDC
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>
2013-04-01 11:04:49 -07:00
Jingoo Han 901b74a3c4 leds: renesas: set gpio_request_one() flags param correctly
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>
2013-04-01 11:04:49 -07:00
Jingoo Han 9d04cbaadf leds: leds-ns2: set devm_gpio_request_one() flags param correctly
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>
2013-04-01 11:04:49 -07:00
Jingoo Han 84f6942cde leds: leds-lt3593: set devm_gpio_request_one() flags param correctly
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>
2013-04-01 11:04:49 -07:00
Jingoo Han e9dd68cf14 leds: leds-bd2802: remove erroneous __exit annotation
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>
2013-04-01 11:04:49 -07:00
Jingoo Han 6fd7962791 leds: atmel-pwm: remove erroneous __exit annotation
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>
2013-04-01 11:04:48 -07:00
Kim, Milo f07fb52107 leds: move LED trigger drivers into new subdirectory
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>
2013-04-01 11:04:48 -07:00
Kim, Milo ff45262a85 leds: add new LP5562 LED driver
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>
2013-04-01 11:04:48 -07:00
Linus Torvalds 0512c04a2b Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds
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
  ...
2013-02-26 09:29:02 -08:00
Jingoo Han 4b07c5d512 leds: leds-sunfire: use dev_err()/pr_err() instead of printk()
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>
2013-02-06 16:00:43 -08:00
Axel Lin 61d4eb2724 leds: 88pm860x: Add missing of_node_put()
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>
2013-02-06 16:00:43 -08:00
Axel Lin ef754e88e3 leds: tca6507: Use of_get_child_count()
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-02-06 16:00:42 -08:00
Peter Ujfalusi ad0ba85fab leds: leds-pwm: make it depend on PWM and not HAVE_PWM
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>
2013-02-06 16:00:42 -08:00
Milo(Woogyom) Kim 109b833071 leds-lp55xx: fix problem on removing LED attributes
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>
2013-02-06 15:59:30 -08:00
Milo(Woogyom) Kim a2387cb9f6 leds-lp5521/5523: add author and copyright description
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>
2013-02-06 15:59:30 -08:00
Milo(Woogyom) Kim 79bcc10b8c leds-lp55xx: clean up headers
Remove unused headers and sort them alphabetically

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-02-06 15:59:30 -08:00
Milo(Woogyom) Kim 12f022d27b leds-lp55xx: clean up definitions
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>
2013-02-06 15:59:30 -08:00
Milo(Woogyom) Kim 93ca4093ad leds-lp55xx: clean up unused data and functions
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>
2013-02-06 15:59:30 -08:00
Milo(Woogyom) Kim 87cc4bde2a leds-lp55xx: clean up _remove()
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>
2013-02-06 15:59:29 -08:00
Milo(Woogyom) Kim ba6fa84651 leds-lp55xx: add new function for removing device attribtues
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>
2013-02-06 15:59:29 -08:00
Milo(Woogyom) Kim 9ca3bd8022 leds-lp55xx: code refactoring on selftest function
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>
2013-02-06 15:59:29 -08:00
Milo(Woogyom) Kim e73c0ce6be leds-lp55xx: use common device attribute driver function
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>
2013-02-06 15:59:29 -08:00
Milo(Woogyom) Kim 240085e255 leds-lp55xx: support device specific attributes
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>
2013-02-06 15:59:29 -08:00
Milo(Woogyom) Kim db6eaf8388 leds-lp5523: use generic firmware interface
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>
2013-02-06 15:59:29 -08:00
Milo(Woogyom) Kim 9ce7cb170f leds-lp5521: use generic firmware interface
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>
2013-02-06 15:59:29 -08:00
Milo(Woogyom) Kim 10c06d178d leds-lp55xx: support firmware interface
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>
2013-02-06 15:59:28 -08:00
Milo(Woogyom) Kim b3b6f8119d leds-lp55xx: add new lp55xx_register_sysfs() for the firmware interface
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>
2013-02-06 15:59:28 -08:00
Milo(Woogyom) Kim d9067d2846 leds-lp55xx: fix error condition in lp55xx_register_leds()
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>
2013-02-06 15:59:28 -08:00
Milo(Woogyom) Kim c3a68ebfcd leds-lp55xx: use lp55xx_unregister_leds()
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>
2013-02-06 15:59:28 -08:00
Milo(Woogyom) Kim a96bfa135d leds-lp55xx: provide common LED current setting
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>
2013-02-06 15:59:28 -08:00
Milo(Woogyom) Kim a6e4679a09 leds-lp55xx: use lp55xx_set_brightness()
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>
2013-02-06 15:59:28 -08:00
Milo(Woogyom) Kim 0e2023463a leds-lp55xx: use lp55xx_init_led() common function
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>
2013-02-06 15:59:28 -08:00
Milo(Woogyom) Kim 9e9b3db1b2 leds-lp55xx: use lp55xx common led registration function
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>
2013-02-06 15:59:28 -08:00
Milo(Woogyom) Kim 6ce6176263 leds-lp55xx: use lp55xx common deinit function
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>
2013-02-06 15:59:27 -08:00
Milo(Woogyom) Kim 22ebeb488b leds-lp55xx: clean up init function
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>
2013-02-06 15:59:27 -08:00
Milo(Woogyom) Kim ffbdccdbba leds-lp55xx: use lp55xx common init function - post int
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>
2013-02-06 15:59:27 -08:00
Milo(Woogyom) Kim e3a700d8aa leds-lp55xx: use lp55xx common init function - detect
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>
2013-02-06 15:59:27 -08:00
Milo(Woogyom) Kim 48068d5de1 leds-lp55xx: use lp55xx common init function - reset
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>
2013-02-06 15:59:27 -08:00
Milo(Woogyom) Kim a85908dd77 leds-lp55xx: use lp55xx common init function - platform data
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>
2013-02-06 15:59:27 -08:00
Milo(Woogyom) Kim 632418bf65 leds-lp5523: clean up lp5523_configure()
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>
2013-02-06 15:59:27 -08:00
Milo(Woogyom) Kim 9448217403 leds-lp5521: clean up lp5521_configure()
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>
2013-02-06 15:59:26 -08:00
Milo(Woogyom) Kim 6a0c9a4796 leds-lp55xx: use common lp55xx data structure in _probe()
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>
2013-02-06 15:59:26 -08:00
Milo(Woogyom) Kim 945c700746 leds-lp55xx: replace name of data structure
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>
2013-02-06 15:59:26 -08:00
Milo(Woogyom) Kim c93d08fa75 leds-lp55xx: add new common driver for lp5521/5523
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>
2013-02-06 15:59:26 -08:00
Milo(Woogyom) Kim f6c64c6fc8 leds-lp55xx: do chip specific configuration on device init
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>
2013-02-06 15:59:26 -08:00
Milo(Woogyom) Kim 86eb7748ce leds-lp55xx: add device reset function in lp5521/5523
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>
2013-02-06 15:59:26 -08:00
Milo(Woogyom) Kim 1904f83d56 leds-lp55xx: clean up deinit leds in lp5521/5523
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>
2013-02-06 15:59:26 -08:00
Milo(Woogyom) Kim f652480802 leds-lp55xx: clean up init leds in lp5521/5523
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>
2013-02-06 15:59:26 -08:00
Milo(Woogyom) Kim 1a9914855d leds-lp55xx: clean up deinit_device() in lp5521/5523
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>
2013-02-06 15:59:26 -08:00
Milo(Woogyom) Kim 944f7b1ded leds-lp55xx: clean up init_device() in lp5521/5523
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>
2013-02-06 15:59:25 -08:00
Jingoo Han 8a4529a38d leds: wm831x: add missing const
Fixed the checkpatch warning as below:

  WARNING: static const char * array should probably be static const char * const

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-02-01 17:47:06 -08:00
Jingoo Han d7789430de leds: leds-ss4200: use DEFINE_PCI_DEVICE_TABLE
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>
2013-02-01 17:47:06 -08:00
Jingoo Han 962363ceda leds: pca9532: fix suspect code indent for conditional statements
Fixed the checkpatch warning as below:

  WARNING: suspect code indent for conditional statements (8, 8)

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-02-01 17:47:06 -08:00
Jingoo Han 85b4b756f1 leds: lm3642: rename devAttr to avoid CamelCase
Fixed the checkpatch warning as below:

  WARNING: Avoid CamelCase: <devAttr>

Rename devAttr to attr.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-02-01 17:47:06 -08:00
Jingoo Han 0c0d9067ac leds: lm355x: rename devAttr to avoid CamelCase
Fixed the checkpatch warning as below:

  WARNING: Avoid CamelCase: <devAttr>

Rename devAttr to attr.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-02-01 17:47:06 -08:00
Axel Lin 4d79833245 leds: renesas-tpu: Improve the readability to pick the lowest acceptable rate
I spent a few minutes to understand why the code catching the mismatch case
by checking if k is 0 or not. And the code using "k - 1" as array index is
unusual.

This patch checks acceptable rate from the lowest rate, and then we don't need
to subtract k by 1. This change improves the readability.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-02-01 17:47:06 -08:00
Axel Lin 5e3b7c6b1c leds: lm3530: Ensure drvdata->enable has correct status if regulator_disable fails
Add lm3530_led_enable() and lm3530_led_disable() helper functions.
This ensures setting drvdata->enable to correct status if regulator_disable
fails.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Shreshtha Kumar SAHU <shreshthakumar.sahu@stericsson.com>
Acked-by: Milo Kim <milo.kim@ti.com>
Tested-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-02-01 17:47:06 -08:00
Kim, Milo a1932edf8b leds-lp8788: fix a parent device in _probe()
The lp8788-keyled is a platform driver of lp8788-mfd. The platform
device is allocated when mfd_add_devices() is called in lp8788-mfd.
On the other hand, 'lp->dev' is the i2c client device.

Therefore, this 'platform_device' is a proper parent device in case
of resource managed mem alloc, registering led device and device
kernel messages.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-02-01 17:47:05 -08:00
Peter Ujfalusi 08541cbcc7 leds: leds-pwm: Add device tree bindings
The DT binding for the pwm-leds devices are similar to the gpio-leds type.
LEDs are represented as sub-nodes of the pwm-leds device.
The code for handling the DT boot is based on the code found in the
leds-gpio driver and adapted to use PWMs instead of GPIOs.
To avoid having custom cleanup code in case of DT boot the newly created
devm_of_pwm_get() API is used to get the correct PWM instance.

For usage see:
Documentation/devicetree/bindings/leds/leds-pwm.txt

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-02-01 17:47:05 -08:00
Peter Ujfalusi 8a66a57908 leds: leds-pwm: Simplify cleanup code
The code looks more nicer if we use:

while (i--)

instead:
if (i > 0)
	for (i = i - 1; i >= 0; i--)

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-02-01 17:47:05 -08:00
Peter Ujfalusi 0f86815ad0 leds: leds-pwm: Preparing the driver for device tree support
In order to be able to add device tree support for leds-pwm driver we need
to rearrange the data structures used by the drivers.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-02-01 17:47:04 -08:00
Peter Ujfalusi 9ea6cdac9b leds: leds-pwm: Convert to use devm_get_pwm
Update the driver to use the new API for requesting pwm so we can take
advantage of the pwm_lookup table to find the correct pwm to be used for the
LED functionality.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-02-01 17:47:04 -08:00
Axel Lin 8614fb4663 leds: pca9532: Convert to devm_input_allocate_device()
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-02-01 17:47:04 -08:00
Marek Belisko 0c596a7ebb leds/tca6507: Add support for devicetree.
Support added only for leds (not for gpio's).

(cooloney@gmail.com: fix 2 building errors)

Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-02-01 17:47:04 -08:00
Kees Cook 5e0b080d48 drivers/leds: remove depends on CONFIG_EXPERIMENTAL
The CONFIG_EXPERIMENTAL config item has not carried much meaning for a
while now and is almost always enabled by default. As agreed during the
Linux kernel summit, remove it from any "depends on" lines in Kconfigs.

CC: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-21 14:52:44 -08:00
Javier Martinez Canillas 2d7c22f67d leds: leds-gpio: set devm_gpio_request_one() flags param correctly
commit a99d76f leds: leds-gpio: use gpio_request_one

changed the leds-gpio driver to use gpio_request_one() instead
of gpio_request() + gpio_direction_output()

Unfortunately, it also made a semantic change that breaks the
leds-gpio driver.

The gpio_request_one() flags parameter was set to:

GPIOF_DIR_OUT | (led_dat->active_low ^ state)

Since GPIOF_DIR_OUT is 0, the final flags value will just be the
XOR'ed value of led_dat->active_low and state.

This value were used to distinguish between HIGH/LOW output initial
level and call gpio_direction_output() accordingly.

With this new semantic gpio_request_one() will take the flags value
of 1 as a configuration of input direction (GPIOF_DIR_IN) and will
call gpio_direction_input() instead of gpio_direction_output().

int gpio_request_one(unsigned gpio, unsigned long flags, const char *label)
{
..
	if (flags & GPIOF_DIR_IN)
		err = gpio_direction_input(gpio);
	else
		err = gpio_direction_output(gpio,
				(flags & GPIOF_INIT_HIGH) ? 1 : 0);
..
}

The right semantic is to evaluate led_dat->active_low ^ state and
set the output initial level explicitly.

Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Reported-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Tested-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-01-02 17:58:41 -08:00
Linus Torvalds e81d372ff9 Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds
Pull LED subsystem update from Bryan Wu.

* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds: (47 commits)
  leds: leds-lp5521: return an error code on error in probe()
  leds: leds-clevo-mail: Use pr_* instead of printks
  leds: leds-rb532: Fix checkpatch errors
  leds: led-triggers: Fix checkpatch warnings
  leds: ledtrig-backlight: Fix checkpatch error
  leds: leds-wrap: Use <linux/io.h> instead of <asm/io.h>
  leds: leds-wm8350: Use dev_err instead of printk
  leds: leds-pwm: Fix checkpatch warning
  leds: leds-pca955x: Use dev_info instead of printk
  leds: leds-net48xx: Use linux/io.h instead of asm/io.h
  leds: leds-lt3593: Fix checkpatch warnings
  leds: leds-gpio: Use dev_info instead of printk
  leds: leds-da903x: Fix checkpatch error and warnings
  leds: leds-bd2802: Fix checkpatch warnings
  leds: leds-adp5520: Fix checkpatch warnings
  leds: led-class: Fix checkpatch warning
  leds: leds-ns2: use devm_gpio_request_one
  leds: leds-lt3593: use devm_gpio_request_one
  leds: leds-gpio: use devm_gpio_request_one
  leds: lp3944: Fix return value
  ...
2012-12-15 12:52:42 -08:00
Linus Torvalds cf4af01221 ARM: arm-soc: Board updates for 3.8
This branch contains a set of various board updates for ARM platforms.
 
 A few shmobile platforms that are stale have been removed, some
 defconfig updates for various boards selecting new features such as
 pinctrl subsystem support, and various updates enabling peripherals, etc.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJQyLD0AAoJEIwa5zzehBx3nNYQAI8a1cS/0U1GGXhmYJs4ZJjM
 9yeFKOQmv7kQMmqC9b9UhoCtqwsxR4s2qjUps3464q8pZmEXysc+Z5kH/av9ULJw
 zp62iTxa/qBfnF+UKCt4PAxoL9KvN36XgPH6OADiQ9rvsJ20zF8Agq22CiSF+8AR
 CfX60joQnd/BEBORP86Zm5AlAeXiah/MrUBQuiCgNq+Ew9bQ0/I15UKZzlLKeQST
 eYviHjlGPFcXWaxuIgNUQ5KzFfKtSERHHHsiIy9DEi0zq7fLhiwY+eIYUWN34aDp
 K+bV7wmh6ufa3/Z024Du5FkSI4fIOLz6b5hlJxOzgvQ3AZJ7JK8IYSXCibgUjWxO
 gFxpVj/MYGf+FlWVQpaf/niMuhYqRAbWy1rsGcmyn8+rb8cHxDHs/3Z4dQTmgxMf
 6lEdR4npULAP22MSB71yQtPjn9XW1338a0/a5GPdvihZjwpMH2ZXRxAkGuGpamFT
 /oXwADuh5a+1uMctXQqb/1FnJcmH/mbEp40bU90AwSqJ6Y8FJts4P5B3H9RQ5rO7
 uz/KVB4ilUHGONtrTiNohYbrNLj3t2kNUt8QrQINMWBHSDFHLUbK48QcoqK4uJPB
 9RFu9mtovUvfJXVivOoO/BRVnKomUba7fhET1VP4UXiCc7WNtmj36kiXSHbfu3NV
 /ox1FAH3UU8jB91OeEqV
 =sgYz
 -----END PGP SIGNATURE-----

Merge tag 'boards' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc

Pull ARM SoC board updates from Olof Johansson:
 "This branch contains a set of various board updates for ARM platforms.

  A few shmobile platforms that are stale have been removed, some
  defconfig updates for various boards selecting new features such as
  pinctrl subsystem support, and various updates enabling peripherals,
  etc."

Fix up conflicts mostly as per Olof.

* tag 'boards' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (58 commits)
  ARM: S3C64XX: Add dummy supplies for Glenfarclas LDOs
  ARM: S3C64XX: Add registration of WM2200 Bells device on Cragganmore
  ARM: kirkwood: Add Plat'Home OpenBlocks A6 support
  ARM: Dove: update defconfig
  ARM: Kirkwood: update defconfig for new boards
  arm: orion5x: add DT related options in defconfig
  arm: orion5x: convert 'LaCie Ethernet Disk mini v2' to Device Tree
  arm: orion5x: basic Device Tree support
  arm: orion5x: mechanical defconfig update
  ARM: kirkwood: Add support for the MPL CEC4
  arm: kirkwood: add support for ZyXEL NSA310
  ARM: Kirkwood: new board USI Topkick
  ARM: kirkwood: use gpio-fan DT binding on lsxl
  ARM: Kirkwood: add Netspace boards to defconfig
  ARM: kirkwood: DT board setup for Network Space Mini v2
  ARM: kirkwood: DT board setup for Network Space Lite v2
  ARM: kirkwood: DT board setup for Network Space v2 and parents
  leds: leds-ns2: add device tree binding
  ARM: Kirkwood: Enable the second I2C bus
  ARM: mmp: select pinctrl driver
  ...
2012-12-12 12:14:06 -08:00
Linus Torvalds cff2f741b8 Driver core updates for 3.8-rc1
Here's the large driver core updates for 3.8-rc1.
 
 The biggest thing here is the various __dev* marking removals.  This is
 going to be a pain for the merge with different subsystem trees, I know,
 but all of the patches included here have been ACKed by their various
 subsystem maintainers, as they wanted them to go through here.
 
 If this is too much of a pain, I can pull all of them out of this tree
 and just send you one with the other fixes/updates and then, after
 3.8-rc1 is out, do the rest of the removals to ensure we catch them all,
 it's up to you.  The merges should all be trivial, and Stephen has been
 doing them all in linux-next for a few weeks now quite easily.
 
 Other than the __dev* marking removals, there's nothing major here, some
 firmware loading updates and other minor things in the driver core.
 
 All of these have (much to Stephen's annoyance), been in linux-next for
 a while.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.19 (GNU/Linux)
 
 iEYEABECAAYFAlDHkPkACgkQMUfUDdst+ykaWgCfW7AM30cv0nzoVO08ax6KjlG1
 KVYAn3z/KYazvp4B6LMvrW9y0G34Wmad
 =yvVr
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-3.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core updates from Greg Kroah-Hartman:
 "Here's the large driver core updates for 3.8-rc1.

  The biggest thing here is the various __dev* marking removals.  This
  is going to be a pain for the merge with different subsystem trees, I
  know, but all of the patches included here have been ACKed by their
  various subsystem maintainers, as they wanted them to go through here.

  If this is too much of a pain, I can pull all of them out of this tree
  and just send you one with the other fixes/updates and then, after
  3.8-rc1 is out, do the rest of the removals to ensure we catch them
  all, it's up to you.  The merges should all be trivial, and Stephen
  has been doing them all in linux-next for a few weeks now quite
  easily.

  Other than the __dev* marking removals, there's nothing major here,
  some firmware loading updates and other minor things in the driver
  core.

  All of these have (much to Stephen's annoyance), been in linux-next
  for a while.

  Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"

Fixed up trivial conflicts in drivers/gpio/gpio-{em,stmpe}.c due to gpio
update.

* tag 'driver-core-3.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (93 commits)
  modpost.c: Stop checking __dev* section mismatches
  init.h: Remove __dev* sections from the kernel
  acpi: remove use of __devinit
  PCI: Remove __dev* markings
  PCI: Always build setup-bus when PCI is enabled
  PCI: Move pci_uevent into pci-driver.c
  PCI: Remove CONFIG_HOTPLUG ifdefs
  unicore32/PCI: Remove CONFIG_HOTPLUG ifdefs
  sh/PCI: Remove CONFIG_HOTPLUG ifdefs
  powerpc/PCI: Remove CONFIG_HOTPLUG ifdefs
  mips/PCI: Remove CONFIG_HOTPLUG ifdefs
  microblaze/PCI: Remove CONFIG_HOTPLUG ifdefs
  dma: remove use of __devinit
  dma: remove use of __devexit_p
  firewire: remove use of __devinitdata
  firewire: remove use of __devinit
  leds: remove use of __devexit
  leds: remove use of __devinit
  leds: remove use of __devexit_p
  mmc: remove use of __devexit
  ...
2012-12-11 13:13:55 -08:00
Dan Carpenter 2f05e1d445 leds: leds-lp5521: return an error code on error in probe()
If "buf" wasn't equal to LP5521_REG_R_CURR_DEFAULT the probe fails but
we still return zero.  I've changed it to print an error message and
return -EINVAL.

Reported-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-12-03 11:16:58 -08:00
Sachin Kamat 5c6f844cee leds: leds-clevo-mail: Use pr_* instead of printks
Silences checkpatch warnings related to the use of printks.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-28 15:12:54 -08:00
Sachin Kamat 7a0eff4d83 leds: leds-rb532: Fix checkpatch errors
Fixes the following issues:
ERROR: code indent should use tabs where possible
WARNING: please, no spaces at the start of a line

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-28 15:12:53 -08:00
Bill Pemberton 678e8a6be9 leds: remove use of __devexit
CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Jan-Simon Moeller <jansimon.moeller@gmx.de>
Acked-by: Bryan Wu <cooloney@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-28 12:35:06 -08:00
Bill Pemberton 98ea1ea20c leds: remove use of __devinit
CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Jan-Simon Moeller <jansimon.moeller@gmx.de>
Acked-by: Bryan Wu <cooloney@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-28 12:34:57 -08:00
Bill Pemberton df07cf8126 leds: remove use of __devexit_p
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Jan-Simon Moeller <jansimon.moeller@gmx.de>
Acked-by: Bryan Wu <cooloney@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-28 12:33:20 -08:00
Sachin Kamat 09f5fe7563 leds: led-triggers: Fix checkpatch warnings
Fixes the following type of warnings:
WARNING: Prefer netdev_warn(netdev, ... then dev_warn(dev, ...
then pr_warn(...  to printk(KERN_WARNING ...
WARNING: quoted string split across lines

While at it also fix a coding style issue w.r.t braces.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-27 14:49:30 -08:00
Sachin Kamat 18e6f1392d leds: ledtrig-backlight: Fix checkpatch error
Fixes the following checkpatch error:
ERROR: space prohibited before that ':' (ctx:WxE)

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-27 14:49:30 -08:00
Sachin Kamat 572dc62078 leds: leds-wrap: Use <linux/io.h> instead of <asm/io.h>
Fixes the following checkpatch warning:
WARNING: Use #include <linux/io.h> instead of <asm/io.h>

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-27 14:49:30 -08:00
Sachin Kamat b75d280272 leds: leds-wm8350: Use dev_err instead of printk
Fixes the following type of checkpatch warnings:
WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ...
then pr_err(...  to printk(KERN_ERR ...

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-27 14:49:29 -08:00
Sachin Kamat dcba91056f leds: leds-pwm: Fix checkpatch warning
Fixes the following checkpatch warning:
WARNING: please, no space before tabs
	FILE: leds/leds-pwm.c:29:
		^Iunsigned int ^I^Iactive_low;$

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-27 14:49:28 -08:00
Sachin Kamat b40b0c17d7 leds: leds-pca955x: Use dev_info instead of printk
Fixes the following checkpatch warning:
WARNING: Prefer netdev_info(netdev, ... then dev_info(dev, ...
then pr_info(...  to printk(KERN_INFO ...

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-27 14:49:28 -08:00
Sachin Kamat 6023ff738a leds: leds-net48xx: Use linux/io.h instead of asm/io.h
Fixes the following checkpatch warning:
WARNING: Use #include <linux/io.h> instead of <asm/io.h>

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-27 14:49:28 -08:00
Sachin Kamat 30e5c3e6b7 leds: leds-lt3593: Fix checkpatch warnings
Fixes the following type of checkpatch warnings:
WARNING: Prefer netdev_info(netdev, ... then dev_info(dev, ...
then pr_info(...  to printk(KERN_INFO ...

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-27 14:49:27 -08:00
Sachin Kamat 39de81a963 leds: leds-gpio: Use dev_info instead of printk
Fixes the following checkpatch warning:
WARNING: Prefer netdev_info(netdev, ... then dev_info(dev, ... then pr_info(...  to printk(KERN_INFO ...
FILE: leds/leds-gpio.c:105:
		printk(KERN_INFO "Skipping unavailable LED gpio %d (%s)\n",

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-27 14:49:27 -08:00
Sachin Kamat 141bfeea56 leds: leds-da903x: Fix checkpatch error and warnings
Fixes the following type of checkpatch error and warnings:
WARNING: please, no space before tabs
ERROR: trailing whitespace
WARNING: quoted string split across lines

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-27 14:49:26 -08:00
Sachin Kamat 6b8aa97262 leds: leds-bd2802: Fix checkpatch warnings
Fixes the following type of checkpatch warnings:
WARNING: please, no space before tabs

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-27 14:49:26 -08:00
Sachin Kamat ef73416275 leds: leds-adp5520: Fix checkpatch warnings
Fixes the following type of checkpatch warnings:
WARNING: please, no space before tabs

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-27 14:49:25 -08:00
Sachin Kamat d23e7b8b61 leds: led-class: Fix checkpatch warning
Fixes the following checkpatch warning:
WARNING: Prefer netdev_dbg(netdev, ... then dev_dbg(dev, ... then pr_debug(...  to printk(KERN_DEBUG ...
FILE: leds/led-class.c:214:
	printk(KERN_DEBUG "Registered led device: %s\n",

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-27 14:49:25 -08:00
Sachin Kamat 04195823aa leds: leds-ns2: use devm_gpio_request_one
devm_gpio_request_one is device managed and makes error handling
and cleanup simpler.

Cc: Simon Guinot <sguinot@lacie.com>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-27 14:49:24 -08:00
Sachin Kamat 95a8ff8356 leds: leds-lt3593: use devm_gpio_request_one
devm_gpio_request_one is device managed and makes error handling
and cleanup simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-27 14:49:24 -08:00
Sachin Kamat e3b1d44c35 leds: leds-gpio: use devm_gpio_request_one
devm_gpio_request_one is device managed and makes error handling
and cleanup simpler.

Cc: Raphael Assenat <raph@8d.com>
Cc: Trent Piepho <tpiepho@freescale.com>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-27 14:49:24 -08:00
Sachin Kamat 4401e48737 leds: lp3944: Fix return value
Return the value obtained from i2c_smbus_read_byte_data() instead of
-EINVAL. Silences the following smatch warning:
drivers/leds/leds-lp3944.c:89 lp3944_reg_read() info:
why not propagate 'tmp' from i2c_smbus_read_byte_data() instead of -22?

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-26 14:43:55 -08:00
Sachin Kamat 5ebab74a71 leds: lp5523: Fix return value
Return the value obtained from i2c_smbus_read_byte_data() instead of
-EIO. Silences the following smatch warning:
drivers/leds/leds-lp5523.c:174 lp5523_read() info:
why not propagate 'ret' from i2c_smbus_read_byte_data() instead of -5?

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-26 14:43:55 -08:00
Sachin Kamat 313e8b50c8 leds: lp5521: Fix return value
Return the value obtained from i2c_smbus_read_byte_data() instead of
-EIO. Silences the following smatch warning:
drivers/leds/leds-lp5521.c:155 lp5521_read() info:
why not propagate 'ret' from i2c_smbus_read_byte_data() instead of -5?

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-26 14:43:54 -08:00
Jingoo Han eef4aa652c leds: leds-lp5523: replace strict_strtoul() with kstrtoul()
The usage of strict_strtoul() is not preferred, because
strict_strtoul() is obsolete. Thus, kstrtoul() should be
used.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-26 14:28:51 -08:00
Jingoo Han 69b44c1630 leds: leds-lp5521: replace strict_strtoul() with kstrtoul()
The usage of strict_strtoul() is not preferred, because
strict_strtoul() is obsolete. Thus, kstrtoul() should be
used.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-26 14:28:51 -08:00
Fabio Baltieri a8df7b1ab7 leds: add led_trigger_rename function
Implements a "led_trigger_rename" function to rename a trigger with
proper locking.

This assumes that led name was originally allocated in non-constant
storage.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
Cc: Kurt Van Dijck <kurt.van.dijck@eia.be>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-26 14:28:50 -08:00
Axel Lin 5cce0105c8 leds: lm3642: Fix up world writable sysfs files
We don't need these sysfs files to be world writable or group writable.
These files are write-only, change them to S_IWUSR (0200).

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: G.Shark Jeong <gshark.jeong@gmail.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-26 14:28:50 -08:00
Axel Lin 5bbf150cca leds: lm355x: Fix up world writable sysfs file
We don't need the sysfs file to be world writable or group writable.
This file is write-only, change it to S_IWUSR (0200).

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: G.Shark Jeong <gshark.jeong@gmail.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-26 14:28:49 -08:00
Jingoo Han 3651c4b904 leds: leds-88pm860x: drop devm_kfree of devm_kzalloc'd data
The devm_kfree function allocates memory that is released
when a driver detaches. Thus, there is no reason to explicitly
call devm_kfree in probe or remove functions.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-26 14:28:49 -08:00
Jingoo Han 1b21ec5a28 leds: leds-lp5523: fix build warnings
This patch fixes build warnings as below:

drivers/leds/leds-lp5523.c: In function 'lp5523_selftest':
drivers/leds/leds-lp5523.c:496:18: warning: 'adc' may be used uninitialized in this function [-Wuninitialized]
drivers/leds/leds-lp5523.c:471:5: warning: 'vdd' may be used uninitialized in this function [-Wuninitialized]
drivers/leds/leds-lp5523.c: In function 'lp5523_probe':
drivers/leds/leds-lp5523.c:252:9: warning: 'status' may be used uninitialized in this function [-Wuninitialized]
drivers/leds/leds-lp5523.c:201:5: note: 'status' was declared here

If lp5523_read() returns an error, problems will happen. Thus,
when lp5523_read() returns an error, it should be handled.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-26 14:28:49 -08:00
Roland Stigge 04553e925b leds: leds-gpio: Defer probing in case of deferred gpio probing
This patch makes leds-gpio's probe() return -EPROBE_DEFER if any of the gpios
to register are deferred themselves. This makes a change of
gpio_leds_create_of()'s return value necessary: Instead of returning NULL on
error, we now use ERR_PTR() error coding.

Signed-off-by: Roland Stigge <stigge@antcom.de>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-26 14:28:49 -08:00
Jingoo Han e8941928fa leds: ledtrig-gpio: replace strict_strtoul() with kstrtoul()
The usage of strict_strtoul() is not preferred, because
strict_strtoul() is obsolete. Thus, kstrtoul() should be
used.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-26 14:28:49 -08:00
Jingoo Han 75253b3cff leds: ledtrig-backlight: replace strict_strtoul() with kstrtoul()
The usage of strict_strtoul() is not preferred, because
strict_strtoul() is obsolete. Thus, kstrtoul() should be
used.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-26 14:28:48 -08:00
Jingoo Han d3b6492afa leds: leds-ss4200: replace strict_strtoul() with kstrtoul()
The usage of strict_strtoul() is not preferred, because
strict_strtoul() is obsolete. Thus, kstrtoul() should be
used.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-26 14:28:48 -08:00
Jingoo Han 3874350c59 leds: leds-ns2: replace strict_strtoul() with kstrtoul()
The usage of strict_strtoul() is not preferred, because
strict_strtoul() is obsolete. Thus, kstrtoul() should be
used.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-26 14:28:48 -08:00
Jingoo Han 7517611a4c leds: leds-netxbig: replace strict_strtoul() with kstrtoul()
The usage of strict_strtoul() is not preferred, because
strict_strtoul() is obsolete. Thus, kstrtoul() should be
used.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-26 14:28:47 -08:00
Jingoo Han fd80fc762c leds: leds-bd2802: replace strict_strtoul() with kstrtoul()
The usage of strict_strtoul() is not preferred, because
strict_strtoul() is obsolete. Thus, kstrtoul() should be
used.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-26 14:28:47 -08:00
Jingoo Han f9e007fffd leds: renesas: use devm_ functions
The devm_ functions allocate memory that is released when a driver
detaches. This makes the code smaller and a bit simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-26 14:28:46 -08:00
Jingoo Han f87ef10105 leds: leds-cobalt-qube: use devm_ioremap
The devm_ functions allocate memory that is released when a driver
detaches. This patch uses devm_ioremap() for these functions.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-26 14:28:46 -08:00
Jingoo Han 50e5194385 leds: leds-cobalt-raq: use devm_ioremap
The devm_ functions allocate memory that is released when a driver
detaches. This patch uses devm_ioremap() for these functions.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-26 14:28:45 -08:00
Jingoo Han aa2dcf9dc1 leds: leds-fsg: use devm_ioremap
The devm_ functions allocate memory that is released when a driver
detaches. This patch uses devm_ioremap() for these functions.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-26 14:28:45 -08:00
Jingoo Han b0053aaa23 leds: renesas: use gpio_request_one
Using gpio_request_one can make the code simpler because it can
set the direction and initial value in one shot.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-26 14:28:44 -08:00
Jingoo Han 31c3dc7488 leds: leds-ns2: use gpio_request_one
Using gpio_request_one can make the code simpler because it can
set the direction and initial value in one shot.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-26 14:28:44 -08:00
Jingoo Han 507d967bc1 leds: leds-lt3593: use gpio_request_one
Using gpio_request_one can make the code simpler because it can
set the direction and initial value in one shot.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2012-11-26 14:28:43 -08:00