Commit Graph

11 Commits

Author SHA1 Message Date
Axel Lin 5ff92e7ab3 power_supply: Convert i2c drivers to module_i2c_driver
Factor out some boilerplate code for i2c driver registration
into module_i2c_driver.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Woogyom Kim <milo.kim@ti.com>
Cc: Daniel Jeong <daniel.jeong@ti.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Peter Edwards <sweetlilmre@gmail.com>
Acked-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Acked-by: Rhyland Klein <rklein@nvidia.com>
Acked-by: Ryan Mallon <rmallon@gmail.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-03-26 20:41:22 +04:00
Axel Lin e2c5f7db78 lp8727_charger: Add MODULE_DEVICE_TABLE
Add MODULE_DEVICE_TABLE to setup modalias for lp8727. Allows auto
modprobing.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-03-26 20:41:21 +04:00
Kim, Milo f7bae49aa1 lp8727_charger: Correct typos on the comment
intergrated charger -> integrated charger
    ^

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-03-26 20:40:59 +04:00
Kim, Milo 7336880e3d lp8727_charger: Fix wrong code style
Definition of STATUS2
: remove space before tabs.

Return code of lp8727_is_dedicated_charger(), lp8727_is_usb_charger()
: remove parentheses when return is not a function.

MODULE_AUTHOR section
: remove space at the start of a line.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-03-26 20:40:56 +04:00
Kim, Milo 27aefa3b7d lp8727_charger: Change i2c functions
On writing single byte via i2c, use i2c_smbus_write_byte_data()
rather than i2c_smbus_write_i2c_block_data().

Name changes :
lp8727_i2c_read() -> lp8727_read_bytes()
lp8727_i2c_write() -> removed
lp8727_i2c_read_byte() -> lp8727_read_byte()
lp8727_i2c_write_byte() -> lp8727_write_byte()

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-03-26 20:40:55 +04:00
Kim, Milo 7da6334e73 lp8727_charger: Add error check routine on probe()
Add error checking on initializing registers and interrupt handler.

Initializing registers - lp8727_init_device()
: check i2c error during probing the driver.

Initializing interrupt handler - lp8727_intr_config()
: check an error on creating the irq thread.

If an error occurs on probing lp8727 driver, allocated lp8727 driver memory is freed.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-03-26 20:40:54 +04:00
Kim, Milo e39b828f53 lp8727_charger: Add company name and description
Add 'Texas Instruments' because TI acquired National semiconductor at 2011.
And the driver information is added in the header file.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-03-26 20:40:52 +04:00
Axel Lin 455a0e2cd8 lp8727_charger: Add terminating entry for i2c_device_id table
The i2c_device_id table is supposed to be zero-terminated.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-02-01 21:34:26 +04:00
Kim, Milo ce09affc59 lp8727_charger: Coding style changes
1. Useless braces were omitted
2. Useless void casts were omitted
3. module exit name changed
   lp8727_chg_exit -> lp8727_exit
4. Pointer coding style changes
   no space between pointer('*') and pointer name
   ex) u8 * data -> u8 *data
5. Author information change : email and additional author

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-04 09:05:51 +04:00
Kim, Milo 998a8e7a72 lp8727_charger: Add supported i2c functionality check routine
lp8727 i2c r/w functions are based on SMBUS I2C BLOCK. So the driver needs to
check whether i2c bus supports this functionality or not.

Signed-off-by: Woogyom Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-04 08:34:20 +04:00
Woogyom Kim 2165c8a45b power_supply: Add LP8727 charger driver
National Semiconductor LP8727 is the battery charger with Micro/Mini
USB interface. This IC includes below functions:

- I2C interface for accessing user registers
- Single input Li-Ion battery charger
- Charger input ID detection from Micro/Mini USB
- Multiplexing switches on USB, UART

Signed-off-by: Woogyom Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-04 08:29:43 +04:00