| .. | .. |
|---|
| 16 | 16 | * warranty of any kind, whether express or implied. |
|---|
| 17 | 17 | */ |
|---|
| 18 | 18 | |
|---|
| 19 | +#include <linux/bitops.h> |
|---|
| 19 | 20 | #include <linux/delay.h> |
|---|
| 20 | 21 | #include <linux/device.h> |
|---|
| 21 | 22 | #include <linux/i2c.h> |
|---|
| 22 | 23 | #include <linux/i2c-mux.h> |
|---|
| 23 | 24 | #include <linux/jiffies.h> |
|---|
| 24 | 25 | #include <linux/module.h> |
|---|
| 25 | | -#include <linux/platform_data/pca954x.h> |
|---|
| 26 | 26 | #include <linux/slab.h> |
|---|
| 27 | 27 | |
|---|
| 28 | 28 | /* |
|---|
| .. | .. |
|---|
| 43 | 43 | #define PCA9541_CONTROL 0x01 |
|---|
| 44 | 44 | #define PCA9541_ISTAT 0x02 |
|---|
| 45 | 45 | |
|---|
| 46 | | -#define PCA9541_CTL_MYBUS (1 << 0) |
|---|
| 47 | | -#define PCA9541_CTL_NMYBUS (1 << 1) |
|---|
| 48 | | -#define PCA9541_CTL_BUSON (1 << 2) |
|---|
| 49 | | -#define PCA9541_CTL_NBUSON (1 << 3) |
|---|
| 50 | | -#define PCA9541_CTL_BUSINIT (1 << 4) |
|---|
| 51 | | -#define PCA9541_CTL_TESTON (1 << 6) |
|---|
| 52 | | -#define PCA9541_CTL_NTESTON (1 << 7) |
|---|
| 46 | +#define PCA9541_CTL_MYBUS BIT(0) |
|---|
| 47 | +#define PCA9541_CTL_NMYBUS BIT(1) |
|---|
| 48 | +#define PCA9541_CTL_BUSON BIT(2) |
|---|
| 49 | +#define PCA9541_CTL_NBUSON BIT(3) |
|---|
| 50 | +#define PCA9541_CTL_BUSINIT BIT(4) |
|---|
| 51 | +#define PCA9541_CTL_TESTON BIT(6) |
|---|
| 52 | +#define PCA9541_CTL_NTESTON BIT(7) |
|---|
| 53 | 53 | |
|---|
| 54 | | -#define PCA9541_ISTAT_INTIN (1 << 0) |
|---|
| 55 | | -#define PCA9541_ISTAT_BUSINIT (1 << 1) |
|---|
| 56 | | -#define PCA9541_ISTAT_BUSOK (1 << 2) |
|---|
| 57 | | -#define PCA9541_ISTAT_BUSLOST (1 << 3) |
|---|
| 58 | | -#define PCA9541_ISTAT_MYTEST (1 << 6) |
|---|
| 59 | | -#define PCA9541_ISTAT_NMYTEST (1 << 7) |
|---|
| 54 | +#define PCA9541_ISTAT_INTIN BIT(0) |
|---|
| 55 | +#define PCA9541_ISTAT_BUSINIT BIT(1) |
|---|
| 56 | +#define PCA9541_ISTAT_BUSOK BIT(2) |
|---|
| 57 | +#define PCA9541_ISTAT_BUSLOST BIT(3) |
|---|
| 58 | +#define PCA9541_ISTAT_MYTEST BIT(6) |
|---|
| 59 | +#define PCA9541_ISTAT_NMYTEST BIT(7) |
|---|
| 60 | 60 | |
|---|
| 61 | 61 | #define BUSON (PCA9541_CTL_BUSON | PCA9541_CTL_NBUSON) |
|---|
| 62 | 62 | #define MYBUS (PCA9541_CTL_MYBUS | PCA9541_CTL_NMYBUS) |
|---|
| .. | .. |
|---|
| 287 | 287 | const struct i2c_device_id *id) |
|---|
| 288 | 288 | { |
|---|
| 289 | 289 | struct i2c_adapter *adap = client->adapter; |
|---|
| 290 | | - struct pca954x_platform_data *pdata = dev_get_platdata(&client->dev); |
|---|
| 291 | 290 | struct i2c_mux_core *muxc; |
|---|
| 292 | 291 | struct pca9541 *data; |
|---|
| 293 | | - int force; |
|---|
| 294 | 292 | int ret; |
|---|
| 295 | 293 | |
|---|
| 296 | 294 | if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE_DATA)) |
|---|
| .. | .. |
|---|
| 306 | 304 | |
|---|
| 307 | 305 | /* Create mux adapter */ |
|---|
| 308 | 306 | |
|---|
| 309 | | - force = 0; |
|---|
| 310 | | - if (pdata) |
|---|
| 311 | | - force = pdata->modes[0].adap_id; |
|---|
| 312 | 307 | muxc = i2c_mux_alloc(adap, &client->dev, 1, sizeof(*data), |
|---|
| 313 | 308 | I2C_MUX_ARBITRATOR, |
|---|
| 314 | 309 | pca9541_select_chan, pca9541_release_chan); |
|---|
| .. | .. |
|---|
| 320 | 315 | |
|---|
| 321 | 316 | i2c_set_clientdata(client, muxc); |
|---|
| 322 | 317 | |
|---|
| 323 | | - ret = i2c_mux_add_adapter(muxc, force, 0, 0); |
|---|
| 318 | + ret = i2c_mux_add_adapter(muxc, 0, 0, 0); |
|---|
| 324 | 319 | if (ret) |
|---|
| 325 | 320 | return ret; |
|---|
| 326 | 321 | |
|---|