Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 306583
b: refs/heads/master
c: d568778
h: refs/heads/master
i:
  306581: 764c390
  306579: 892dd74
  306575: 1cae49e
v: v3
  • Loading branch information
Dmitry Torokhov committed Apr 10, 2012
1 parent ec7166e commit bcc30cf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 38 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 98a84131926ebafe868c65631b69d4912922211e
refs/heads/master: d568778298f58330bcc8cc23845676d1143c8d33
41 changes: 4 additions & 37 deletions trunk/drivers/input/touchscreen/wacom_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ struct wacom_features {
struct wacom_i2c {
struct i2c_client *client;
struct input_dev *input;
unsigned int gpio;
u8 data[WACOM_QUERY_SIZE];
};

Expand Down Expand Up @@ -91,23 +90,6 @@ static int wacom_query_device(struct i2c_client *client,
return 0;
}

static int wacom_i2c_fetch_data(struct wacom_i2c *wac_i2c)
{
int retries = 0;
int ret;

do {
ret = i2c_master_recv(wac_i2c->client,
wac_i2c->data, sizeof(wac_i2c->data));
} while (gpio_get_value(wac_i2c->gpio) == 0 &&
retries++ < WACOM_RETRY_CNT);

if (retries >= WACOM_RETRY_CNT)
ret = -EIO;

return ret < 0 ? ret : 0;
}

static irqreturn_t wacom_i2c_irq(int irq, void *dev_id)
{
struct wacom_i2c *wac_i2c = dev_id;
Expand All @@ -117,8 +99,9 @@ static irqreturn_t wacom_i2c_irq(int irq, void *dev_id)
unsigned char tsw, f1, f2, ers;
int error;

error = wacom_i2c_fetch_data(wac_i2c);
if (error)
error = i2c_master_recv(wac_i2c->client,
wac_i2c->data, sizeof(wac_i2c->data));
if (error < 0)
goto out;

tsw = data[3] & 0x01;
Expand Down Expand Up @@ -147,12 +130,6 @@ static int wacom_i2c_open(struct input_dev *dev)
{
struct wacom_i2c *wac_i2c = input_get_drvdata(dev);
struct i2c_client *client = wac_i2c->client;
int error;

/* Clear the device buffer */
error = wacom_i2c_fetch_data(wac_i2c);
if (error)
return error;

enable_irq(client->irq);

Expand All @@ -173,22 +150,13 @@ static int __devinit wacom_i2c_probe(struct i2c_client *client,
struct wacom_i2c *wac_i2c;
struct input_dev *input;
struct wacom_features features;
int gpio;
int error;

if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
dev_err(&client->dev, "i2c_check_functionality error\n");
return -EIO;
}

gpio = irq_to_gpio(client->irq);
if (gpio < 0) {
error = gpio;
dev_err(&client->dev,
"irq_to_gpio() failed, error: %d\n", error);
return error;
}

error = wacom_query_device(client, &features);
if (error)
return error;
Expand All @@ -202,7 +170,6 @@ static int __devinit wacom_i2c_probe(struct i2c_client *client,

wac_i2c->client = client;
wac_i2c->input = input;
wac_i2c->gpio = gpio;

input->name = "Wacom I2C Digitizer";
input->id.bustype = BUS_I2C;
Expand All @@ -228,7 +195,7 @@ static int __devinit wacom_i2c_probe(struct i2c_client *client,
input_set_drvdata(input, wac_i2c);

error = request_threaded_irq(client->irq, NULL, wacom_i2c_irq,
IRQF_TRIGGER_FALLING,
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
"wacom_i2c", wac_i2c);
if (error) {
dev_err(&client->dev,
Expand Down

0 comments on commit bcc30cf

Please sign in to comment.