diff options
-rw-r--r-- | drivers/gpio/sx150x.c | 26 | ||||
-rw-r--r-- | include/linux/i2c/sx150x.h | 4 |
2 files changed, 25 insertions, 5 deletions
diff --git a/drivers/gpio/sx150x.c b/drivers/gpio/sx150x.c index b42f42ca70c3..823559ab0e24 100644 --- a/drivers/gpio/sx150x.c +++ b/drivers/gpio/sx150x.c | |||
@@ -459,17 +459,33 @@ static int sx150x_init_io(struct sx150x_chip *chip, u8 base, u16 cfg) | |||
459 | return err; | 459 | return err; |
460 | } | 460 | } |
461 | 461 | ||
462 | static int sx150x_init_hw(struct sx150x_chip *chip, | 462 | static int sx150x_reset(struct sx150x_chip *chip) |
463 | struct sx150x_platform_data *pdata) | ||
464 | { | 463 | { |
465 | int err = 0; | 464 | int err; |
466 | 465 | ||
467 | err = i2c_smbus_write_word_data(chip->client, | 466 | err = i2c_smbus_write_byte_data(chip->client, |
468 | chip->dev_cfg->reg_reset, | 467 | chip->dev_cfg->reg_reset, |
469 | 0x3412); | 468 | 0x12); |
470 | if (err < 0) | 469 | if (err < 0) |
471 | return err; | 470 | return err; |
472 | 471 | ||
472 | err = i2c_smbus_write_byte_data(chip->client, | ||
473 | chip->dev_cfg->reg_reset, | ||
474 | 0x34); | ||
475 | return err; | ||
476 | } | ||
477 | |||
478 | static int sx150x_init_hw(struct sx150x_chip *chip, | ||
479 | struct sx150x_platform_data *pdata) | ||
480 | { | ||
481 | int err = 0; | ||
482 | |||
483 | if (pdata->reset_during_probe) { | ||
484 | err = sx150x_reset(chip); | ||
485 | if (err < 0) | ||
486 | return err; | ||
487 | } | ||
488 | |||
473 | err = sx150x_i2c_write(chip->client, | 489 | err = sx150x_i2c_write(chip->client, |
474 | chip->dev_cfg->reg_misc, | 490 | chip->dev_cfg->reg_misc, |
475 | 0x01); | 491 | 0x01); |
diff --git a/include/linux/i2c/sx150x.h b/include/linux/i2c/sx150x.h index ee3049cb9ba5..52baa79d69a7 100644 --- a/include/linux/i2c/sx150x.h +++ b/include/linux/i2c/sx150x.h | |||
@@ -63,6 +63,9 @@ | |||
63 | * IRQ lines will appear. Similarly to gpio_base, the expander | 63 | * IRQ lines will appear. Similarly to gpio_base, the expander |
64 | * will create a block of irqs beginning at this number. | 64 | * will create a block of irqs beginning at this number. |
65 | * This value is ignored if irq_summary is < 0. | 65 | * This value is ignored if irq_summary is < 0. |
66 | * @reset_during_probe: If set to true, the driver will trigger a full | ||
67 | * reset of the chip at the beginning of the probe | ||
68 | * in order to place it in a known state. | ||
66 | */ | 69 | */ |
67 | struct sx150x_platform_data { | 70 | struct sx150x_platform_data { |
68 | unsigned gpio_base; | 71 | unsigned gpio_base; |
@@ -73,6 +76,7 @@ struct sx150x_platform_data { | |||
73 | u16 io_polarity; | 76 | u16 io_polarity; |
74 | int irq_summary; | 77 | int irq_summary; |
75 | unsigned irq_base; | 78 | unsigned irq_base; |
79 | bool reset_during_probe; | ||
76 | }; | 80 | }; |
77 | 81 | ||
78 | #endif /* __LINUX_I2C_SX150X_H */ | 82 | #endif /* __LINUX_I2C_SX150X_H */ |