leds-lp55xx: cleanup 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-lp55xx: cleanup 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.
leds-lp55xx: cleanup 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.
leds-lp55xx: cleanup deinit leds in lp5521/5523

 To make LED unregistration code simple, new function, _unregister_leds()
 is added at each driver.
 This patch is a preceding step for lp55xx common driver architecture.
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.
leds-lp55xx: do chip specific configuration on device init

 Chip specific function is configured during the device initialization.
 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().
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
leds-lp55xx: replace name of data structure

 Change 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.
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.

 lp55xx_chip          : Common data between lp5521_chip and lp5523_chip
 lp55xx_led           : Common LED structure bettwen lp5521_led and lp5523_led
 lp55xx_platform_data : Common platform data between lp5521_platform_data and
                        lp5523_platform_data
leds-lp55xx: use lp55xx common init function in _probe()

 LP5521 and LP5523 driver have separate device init function, but
 they can be merged into one common init function.

 Driver specific functions are replaced with consolidated functions.

  lp5521/lp5523_init_device()   => lp55xx_init_device()
  lp5521/lp5523_reset_device()  => lp55xx_reset_device()
  lp5521/lp5523_detect_device() => lp55xx_detect_device()
  lp5521/lp5523_configure()     => lp55xx_post_init_device()

 Reset, detection and chip configuration depend the device.
 For the device specific fucntions, 'lp55xx_device_config' is configured
 in each driver.

 Unnecessary code are removed.
 a) Engine initialization in lp5521_init_engine() and lp5523_init_engine()
   With reset command, internal LED engines are initialized automatically.
   Therefore this function is duplicated, unnecessary.

 b) Engine verification in lp5523_configure()
   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.
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().
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:
 When LED registration failure occurs, device should be de-initialized
 rather than unregistering LEDs.

 This patch is not complete one because LED registration needs
 additional patches. Please refer next patches.
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'.
leds-lp55xx: use lp55xx_set_brightness() for brightness control

 lp5521_set_brightness() and lp5523_set_brightness() are replaced with
 common lp55xx_set_brightness().
 This common 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().
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.

 show_max_current()  => lp55xx_show_max_current()
 show_current()      => lp55xx_show_current()
 store_current()     => lp55xx_store_current()

 Current registers are device specific, so configurable function is added
 in each driver.
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.
leds-lp55xx: fix error condition in lp55xx_register_leds()

  Use lp55xx_unregister_leds() rather than duplicate code.
leds-lp55xx: add new lp55xx_register_sysfs() for FW 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.
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
leds-lp55xx: 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 for LP5521
  engine1_mode
  engine2_mode
  engine3_mode
  engine1_load
  engine2_load
  engine3_load
  led_pattern

 Removed device attributes for LP5523
  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'.