diff options
author | Prakash Mortha <pmortha@escient.com> | 2008-10-14 11:30:06 -0400 |
---|---|---|
committer | Jean Delvare <khali@mahadeva.delvare> | 2008-10-14 11:30:06 -0400 |
commit | 596c88f4601e6245a15ea7619527674abbfdcf92 (patch) | |
tree | fb79f818844fb3109a702a5ac45f3f873fa5ad5b | |
parent | a10f9e7caf8d3028d8fb1d4c3d590492cde3df3e (diff) |
i2c: Restore i2c_smbus_process_call function
Restore the i2c_smbus_process_call() as one driver (for the
Micronas MAP5401) will need it soon.
[JD: Update documentation accordingly.]
Signed-off-by: Prakash Mortha <pmortha@escient.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
-rw-r--r-- | Documentation/i2c/smbus-protocol | 4 | ||||
-rw-r--r-- | Documentation/i2c/writing-clients | 4 | ||||
-rw-r--r-- | drivers/i2c/i2c-core.c | 22 |
3 files changed, 26 insertions, 4 deletions
diff --git a/Documentation/i2c/smbus-protocol b/Documentation/i2c/smbus-protocol index 24bfb65da17d..9df47441f0e7 100644 --- a/Documentation/i2c/smbus-protocol +++ b/Documentation/i2c/smbus-protocol | |||
@@ -109,8 +109,8 @@ specified through the Comm byte. | |||
109 | S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] P | 109 | S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] P |
110 | 110 | ||
111 | 111 | ||
112 | SMBus Process Call | 112 | SMBus Process Call: i2c_smbus_process_call() |
113 | ================== | 113 | ============================================= |
114 | 114 | ||
115 | This command selects a device register (through the Comm byte), sends | 115 | This command selects a device register (through the Comm byte), sends |
116 | 16 bits of data to it, and reads 16 bits of data in return. | 116 | 16 bits of data to it, and reads 16 bits of data in return. |
diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients index 6b61b3a2e90b..d73ee117a8ca 100644 --- a/Documentation/i2c/writing-clients +++ b/Documentation/i2c/writing-clients | |||
@@ -606,6 +606,8 @@ SMBus communication | |||
606 | extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command); | 606 | extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command); |
607 | extern s32 i2c_smbus_write_word_data(struct i2c_client * client, | 607 | extern s32 i2c_smbus_write_word_data(struct i2c_client * client, |
608 | u8 command, u16 value); | 608 | u8 command, u16 value); |
609 | extern s32 i2c_smbus_process_call(struct i2c_client *client, | ||
610 | u8 command, u16 value); | ||
609 | extern s32 i2c_smbus_read_block_data(struct i2c_client * client, | 611 | extern s32 i2c_smbus_read_block_data(struct i2c_client * client, |
610 | u8 command, u8 *values); | 612 | u8 command, u8 *values); |
611 | extern s32 i2c_smbus_write_block_data(struct i2c_client * client, | 613 | extern s32 i2c_smbus_write_block_data(struct i2c_client * client, |
@@ -621,8 +623,6 @@ These ones were removed from i2c-core because they had no users, but could | |||
621 | be added back later if needed: | 623 | be added back later if needed: |
622 | 624 | ||
623 | extern s32 i2c_smbus_write_quick(struct i2c_client * client, u8 value); | 625 | extern s32 i2c_smbus_write_quick(struct i2c_client * client, u8 value); |
624 | extern s32 i2c_smbus_process_call(struct i2c_client * client, | ||
625 | u8 command, u16 value); | ||
626 | extern s32 i2c_smbus_block_process_call(struct i2c_client *client, | 626 | extern s32 i2c_smbus_block_process_call(struct i2c_client *client, |
627 | u8 command, u8 length, | 627 | u8 command, u8 length, |
628 | u8 *values) | 628 | u8 *values) |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 80ae12048e85..42e852d79ffa 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -1688,6 +1688,28 @@ s32 i2c_smbus_write_word_data(struct i2c_client *client, u8 command, u16 value) | |||
1688 | EXPORT_SYMBOL(i2c_smbus_write_word_data); | 1688 | EXPORT_SYMBOL(i2c_smbus_write_word_data); |
1689 | 1689 | ||
1690 | /** | 1690 | /** |
1691 | * i2c_smbus_process_call - SMBus "process call" protocol | ||
1692 | * @client: Handle to slave device | ||
1693 | * @command: Byte interpreted by slave | ||
1694 | * @value: 16-bit "word" being written | ||
1695 | * | ||
1696 | * This executes the SMBus "process call" protocol, returning negative errno | ||
1697 | * else a 16-bit unsigned "word" received from the device. | ||
1698 | */ | ||
1699 | s32 i2c_smbus_process_call(struct i2c_client *client, u8 command, u16 value) | ||
1700 | { | ||
1701 | union i2c_smbus_data data; | ||
1702 | int status; | ||
1703 | data.word = value; | ||
1704 | |||
1705 | status = i2c_smbus_xfer(client->adapter, client->addr, client->flags, | ||
1706 | I2C_SMBUS_WRITE, command, | ||
1707 | I2C_SMBUS_PROC_CALL, &data); | ||
1708 | return (status < 0) ? status : data.word; | ||
1709 | } | ||
1710 | EXPORT_SYMBOL(i2c_smbus_process_call); | ||
1711 | |||
1712 | /** | ||
1691 | * i2c_smbus_read_block_data - SMBus "block read" protocol | 1713 | * i2c_smbus_read_block_data - SMBus "block read" protocol |
1692 | * @client: Handle to slave device | 1714 | * @client: Handle to slave device |
1693 | * @command: Byte interpreted by slave | 1715 | * @command: Byte interpreted by slave |