regmap: add regmap_bulk_write() for register write

The bulk_write() supports the data transfer to multi
register which takes the data into cpu_endianness format
and does formatting of data to device format before
sending to device.
The transfer can be completed in single transfer or multiple
transfer based on data formatting.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
mfd: Use regmap for tps65910 register access.

Using regmap apis for accessing the device registers and
using RBTREE caching mechanims for caching registers.

Enabling caching of the registers which is used for voltage
controls. By doing this, the modify_bits operation is faster as
it does not involve the i2c register read from device, just read
from cache. This results faster set voltage operation.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>

Conflicts:
	drivers/mfd/tps65910.c
mfd: Use correct variable name for tps65910 regmap config

This was the copy-paste issue in reg cache support code where
variable name for regmap config was not really starting from
the device name, it was starting from some other device name.
Fixing this so that variable name contains actual device name.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
regulator: tps65910: Sleep control through external inputs

Add support for sleep controls of different regulator through
external inputs EN1, EN2 or EN3.
Each regulator's output will be active when its external
input is high and turns to OFF/Low power mode when its
external input is low.
The configuration parameters for sleep control is provided through
board specific platform data.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
regulator: tps65910: Sleep off rails when ext sleep configured

Keep the rails OFF in sleep mode only when the rails are
controlled by external sleep control.
The devices tps65910 and tps65911, both has the sleep input.
The tps65911's sleep input is not same as tps65910's EN3 and hence
taking care of SLEEP input as separate external sleep control input.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
gpio: tps65910: Add sleep control support

The device tps65910/tps65911 supports the sleep
functionality in some of gpios. If gpio is configured
in output mode and sleep is enabled then during device
sleep state, the output of gpio becomes LOW regardless
of non-sleep output value.
Such gpio can be used to control regulator switch such
that output of regulator is off in device sleep state.

Conflict by prior application of
regulator: tps65910: Sleep control through external inputs

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Linus Walleij <linus.walleij@linaro.org>

Conflicts:
	include/linux/mfd/tps65910.h
mfd: Add support for tps65910 device sleep

Adding support for device sleep through the external input control
signal "SLEEP".
Changing the SLEEP signal state can switch the device into SLEEP and
ACTIVE state.
Also adding sleep configuration for different resources so that they
should be keep on during sleep state of device.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
mfd: Fix tps65910 section annotations

A warning was being generated by the reference from tps65910_i2c_probe()
to tps65910_sleepinit() since the latter was annotated as __init but the
former was unannotated. Since these functions can only be called during
device init make them both __devinit, and while we're at it also annotate
tps65910_i2c_remove() __devexit for symmetry.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
mfd: Commonize tps65910 regmap access through header

This change removes the read/write callback functions in favor of common
regmap accessors inside the header file. This change also makes use of
regmap_read/write for single register access which maps better onto what this
driver actually needs.

Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>

Conflicts:
	drivers/regulator/tps65910-regulator.c
	include/linux/mfd/tps65910.h
mfd: tps65910: Add alarm interrupt of TPS65910 RTC to mfd device list

Add RTC alarm interrupt details to TPS65910 MFD device list, to support
RTC alarm events.

Signed-off-by: Venu Byravarasu <vbyravarasu@nvidia.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
rtc: tps65910: add RTC driver for TPS65910 PMIC RTC

TPS65910 PMIC is a MFD with RTC as one of the device.  Adding RTC driver
for supporting RTC device present inside TPS65910 PMIC.

Only support for RTC alarm is implemented as part of this patch.

Signed-off-by: Venu Byravarasu <vbyravarasu@nvidia.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/rtc/rtc-tps65910.c: use platform_get_irq() to get RTC irq details

As RTC driver needs only irq number from platform data, using
platform_get_irq(), instead of generic dev_get_platdata().

Signed-off-by: Venu Byravarasu <vbyravarasu@nvidia.com>
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/rtc/rtc-tps65910.c: fix invalid pointer access on _remove()

The tps65910_rtc data is registered as the platform driver data in
_probe(= ).  Therefore the tps65910_rtc should be used on unregistering
the rtc device.  And device pointer should be retrieved from the
platform_device structure.

This patch fixes the below oops:

 Unable to handle kernel NULL pointer dereference at virtual address 00000008
 Modules linked in: rtc_tps65910(-)
 CPU: 0    Not tainted  (3.7.0-rc7-next-20121128-g6b1f974-dirty #7)
 PC is at tps65910_rtc_alarm_irq_enable+0x20/0x2c [rtc_tps65910]
     (tps65910_rtc_alarm_irq_enable+0x20/0x2c [rtc_tps65910])
     (tps65910_rtc_remove+0x18/0x28 [rtc_tps65910])
     (platform_drv_remove+0x18/0x1c)
     (__device_release_driver+0x70/0xcc)
     (driver_detach+0xb4/0xb8)
     (bus_remove_driver+0x7c/0xc0)
     (sys_delete_module+0x148/0x21c)

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Merge branch 'tps65910-rtc' into pia335x-dev

* tps65910-rtc:
  drivers/rtc/rtc-tps65910.c: fix invalid pointer access on _remove()
  drivers/rtc/rtc-tps65910.c: use platform_get_irq() to get RTC irq details
  rtc: tps65910: add RTC driver for TPS65910 PMIC RTC
  mfd: tps65910: Add alarm interrupt of TPS65910 RTC to mfd device list
  mfd: Commonize tps65910 regmap access through header
  mfd: Fix tps65910 section annotations
  mfd: Add support for tps65910 device sleep
  gpio: tps65910: Add sleep control support
  regulator: tps65910: Sleep off rails when ext sleep configured
  regulator: tps65910: Sleep control through external inputs
  mfd: Use correct variable name for tps65910 regmap config
  mfd: Use regmap for tps65910 register access.
  regmap: add regmap_bulk_write() for register write
regmap: Bypassing cache when initializing cache

During regcache_init, if client has not passed the
default data of cached register then it is directly
read from the hw to initialize cache. This hw register
read happens before cache ops are initialized and hence
avoiding register read to check for the data available
on cache or not by enabling flag of cache_bypass.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
pia-am335x-mmi: fix board revision check

- don't compare with id but revision number

Signed-off-by: Björn Krombholz <b.krombholz@pironex.de>
Revert "video: da8xx-fb: fix Newhaven Display naming"

This reverts commit 5326d526f724ade94fbb90a4363d517da6320be0.
arm: pia-am335x: add ids for LCD expansion boards

Signed-off-by: Björn Krombholz <b.krombholz@pironex.de>
arm: pia-am335x: add more flexible board detection

- put out EEPROM content into the id struct
- .setup functions for at24 gets called even if no device is present,
  handle it appropriatly. Move the special PM module without EEPROM
  case to the expansion_setup routine. It will be called with
  pm_setup_done == 0, so we now we have not initalized any processor
  board yet.
- don't use the board id for read_eeprom as we need to handle special,
  cases for each board, where there can be 2 expansion boards. Also LCD
  boards can be on I2C2@0x50 or 0x51. Using a pointer to the target
  struct for the read and parse functions allows more flexible handling of
  such cases.

Signed-off-by: Björn Krombholz <b.krombholz@pironex.de>
arm: pia-am335x-mmi: add support for LCD expansion

- integrate the LCD expansion board into the board detection mechanism
- Fix EEPROM bus. It's on 2 not 1
- do LCD expansion intialization via .setup from at24 device as for
  normal expansion boards.

Signed-off-by: Björn Krombholz <b.krombholz@pironex.de>