|
57 | 57 |
|
58 | 58 | #define PCA954X_IRQ_OFFSET 4
|
59 | 59 |
|
| 60 | +/* |
| 61 | + * MAX7357's configuration register is writeable after POR, but |
| 62 | + * can be locked by setting the basic mode bit. MAX7358 configuration |
| 63 | + * register is locked by default and needs to be unlocked first. |
| 64 | + * The configuration register holds the following settings: |
| 65 | + */ |
| 66 | +#define MAX7357_CONF_INT_ENABLE BIT(0) |
| 67 | +#define MAX7357_CONF_FLUSH_OUT BIT(1) |
| 68 | +#define MAX7357_CONF_RELEASE_INT BIT(2) |
| 69 | +#define MAX7357_CONF_DISCON_SINGLE_CHAN BIT(4) |
| 70 | +#define MAX7357_CONF_PRECONNECT_TEST BIT(7) |
| 71 | + |
| 72 | +#define MAX7357_POR_DEFAULT_CONF MAX7357_CONF_INT_ENABLE |
| 73 | + |
60 | 74 | enum pca_type {
|
61 | 75 | max_7356,
|
62 | 76 | max_7357,
|
@@ -470,7 +484,34 @@ static int pca954x_init(struct i2c_client *client, struct pca954x *data)
|
470 | 484 | else
|
471 | 485 | data->last_chan = 0; /* Disconnect multiplexer */
|
472 | 486 |
|
473 |
| - ret = i2c_smbus_write_byte(client, data->last_chan); |
| 487 | + if (device_is_compatible(&client->dev, "maxim,max7357")) { |
| 488 | + if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { |
| 489 | + u8 conf = MAX7357_POR_DEFAULT_CONF; |
| 490 | + /* |
| 491 | + * The interrupt signal is shared with the reset pin. Release the |
| 492 | + * interrupt after 1.6 seconds to allow using the pin as reset. |
| 493 | + */ |
| 494 | + conf |= MAX7357_CONF_RELEASE_INT; |
| 495 | + |
| 496 | + if (device_property_read_bool(&client->dev, "maxim,isolate-stuck-channel")) |
| 497 | + conf |= MAX7357_CONF_DISCON_SINGLE_CHAN; |
| 498 | + if (device_property_read_bool(&client->dev, |
| 499 | + "maxim,send-flush-out-sequence")) |
| 500 | + conf |= MAX7357_CONF_FLUSH_OUT; |
| 501 | + if (device_property_read_bool(&client->dev, |
| 502 | + "maxim,preconnection-wiggle-test-enable")) |
| 503 | + conf |= MAX7357_CONF_PRECONNECT_TEST; |
| 504 | + |
| 505 | + ret = i2c_smbus_write_byte_data(client, data->last_chan, conf); |
| 506 | + } else { |
| 507 | + dev_warn(&client->dev, "Write byte data not supported." |
| 508 | + "Cannot enable enhanced mode features\n"); |
| 509 | + ret = i2c_smbus_write_byte(client, data->last_chan); |
| 510 | + } |
| 511 | + } else { |
| 512 | + ret = i2c_smbus_write_byte(client, data->last_chan); |
| 513 | + } |
| 514 | + |
474 | 515 | if (ret < 0)
|
475 | 516 | data->last_chan = 0;
|
476 | 517 |
|
|
0 commit comments