mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
Remove a workaround since BCM20793 chip default is 7 bits address.
Change-Id: I7bd48f154b8a14b452adc181bb69fe23bd7749ef Reviewed-on: http://mcrd1-5.corpnet.asus/code-review/master/68171 Tested-by: Joy Huang <Joy_Huang@asus.com> Reviewed-by: Leslie Yu <Leslie_Yu@asus.com>
This commit is contained in:
parent
71058c072c
commit
98abd5816b
1 changed files with 2 additions and 58 deletions
|
@ -89,60 +89,6 @@ static void bcm2079x_enable_irq(struct bcm2079x_dev *bcm2079x_dev)
|
|||
spin_unlock_irqrestore(&bcm2079x_dev->irq_enabled_lock, flags);
|
||||
}
|
||||
|
||||
/*
|
||||
The alias address 0x79, when sent as a 7-bit address from the host processor
|
||||
will match the first byte (highest 2 bits) of the default client address
|
||||
(0x1FA) that is programmed in bcm20791.
|
||||
When used together with the first byte (0xFA) of the byte sequence below,
|
||||
it can be used to address the bcm20791 in a system that does not support
|
||||
10-bit address and change the default address to 0x38.
|
||||
the new address can be changed by changing the CLIENT_ADDRESS below if 0x38
|
||||
conflicts with other device on the same i2c bus.
|
||||
*/
|
||||
#define ALIAS_ADDRESS 0x79
|
||||
|
||||
static int change_client_addr(struct bcm2079x_dev *bcm2079x_dev, int addr)
|
||||
{
|
||||
struct i2c_client *client;
|
||||
int ret;
|
||||
int i;
|
||||
char addr_data[] = {
|
||||
0xFA, 0xF2, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x2A
|
||||
};
|
||||
client = bcm2079x_dev->client;
|
||||
client->addr = ALIAS_ADDRESS;
|
||||
client->flags &= ~I2C_CLIENT_TEN;
|
||||
|
||||
addr_data[5] = addr & 0xFF;
|
||||
ret = 0;
|
||||
for (i = 1; i < sizeof(addr_data) - 1; ++i)
|
||||
ret += addr_data[i];
|
||||
addr_data[sizeof(addr_data) - 1] = (ret & 0xFF);
|
||||
dev_info(&client->dev,
|
||||
"Change client device from (0x%04X) flag = "\
|
||||
"%04x, addr_data[%d] = %02x\n",
|
||||
client->addr, client->flags, sizeof(addr_data) - 1,
|
||||
addr_data[sizeof(addr_data) - 1]);
|
||||
ret = i2c_master_send(client, addr_data, sizeof(addr_data));
|
||||
if (ret != sizeof(addr_data)) {
|
||||
client->addr = ALIAS_ADDRESS;
|
||||
client->flags &= ~I2C_CLIENT_TEN;
|
||||
dev_info(&client->dev,
|
||||
"Change client device from (0x%04X) flag = "\
|
||||
"%04x, addr_data[%d] = %02x\n",
|
||||
client->addr, client->flags, sizeof(addr_data) - 1,
|
||||
addr_data[sizeof(addr_data) - 1]);
|
||||
ret = i2c_master_send(client, addr_data, sizeof(addr_data));
|
||||
}
|
||||
client->addr = addr_data[5];
|
||||
|
||||
dev_info(&client->dev,
|
||||
"Change client device changed to (0x%04X) flag = %04x, ret = %d\n",
|
||||
client->addr, client->flags, ret);
|
||||
|
||||
return (ret == sizeof(addr_data) ? 0 : -EIO);
|
||||
}
|
||||
|
||||
static irqreturn_t bcm2079x_dev_irq_handler(int irq, void *dev_id)
|
||||
{
|
||||
struct bcm2079x_dev *bcm2079x_dev = dev_id;
|
||||
|
@ -295,11 +241,9 @@ static long bcm2079x_dev_unlocked_ioctl(struct file *filp,
|
|||
break;
|
||||
case BCMNFC_READ_MULTI_PACKETS:
|
||||
break;
|
||||
/* Remove a workaround since BCM20793 chip default is 7 bits address */
|
||||
case BCMNFC_CHANGE_ADDR:
|
||||
dev_info(&bcm2079x_dev->client->dev,
|
||||
"%s, BCMNFC_CHANGE_ADDR (%x, %lx):\n", __func__, cmd,
|
||||
arg);
|
||||
return change_client_addr(bcm2079x_dev, arg);
|
||||
break;
|
||||
case BCMNFC_POWER_CTL:
|
||||
gpio_set_value(bcm2079x_dev->en_gpio, arg);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue