|
@@ -660,6 +660,8 @@ out:
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static const struct of_device_id pca953x_dt_ids[];
|
|
|
|
+
|
|
static int pca953x_probe(struct i2c_client *client,
|
|
static int pca953x_probe(struct i2c_client *client,
|
|
const struct i2c_device_id *id)
|
|
const struct i2c_device_id *id)
|
|
{
|
|
{
|
|
@@ -691,12 +693,18 @@ static int pca953x_probe(struct i2c_client *client,
|
|
chip->driver_data = id->driver_data;
|
|
chip->driver_data = id->driver_data;
|
|
} else {
|
|
} else {
|
|
const struct acpi_device_id *id;
|
|
const struct acpi_device_id *id;
|
|
|
|
+ const struct of_device_id *match;
|
|
|
|
|
|
- id = acpi_match_device(pca953x_acpi_ids, &client->dev);
|
|
|
|
- if (!id)
|
|
|
|
- return -ENODEV;
|
|
|
|
|
|
+ match = of_match_device(pca953x_dt_ids, &client->dev);
|
|
|
|
+ if (match) {
|
|
|
|
+ chip->driver_data = (int)(uintptr_t)match->data;
|
|
|
|
+ } else {
|
|
|
|
+ id = acpi_match_device(pca953x_acpi_ids, &client->dev);
|
|
|
|
+ if (!id)
|
|
|
|
+ return -ENODEV;
|
|
|
|
|
|
- chip->driver_data = id->driver_data;
|
|
|
|
|
|
+ chip->driver_data = id->driver_data;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
chip->chip_type = PCA_CHIP_TYPE(chip->driver_data);
|
|
chip->chip_type = PCA_CHIP_TYPE(chip->driver_data);
|
|
@@ -755,35 +763,39 @@ static int pca953x_remove(struct i2c_client *client)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/* convenience to stop overlong match-table lines */
|
|
|
|
+#define OF_953X(__nrgpio, __int) (void *)(__nrgpio | PCA953X_TYPE | __int)
|
|
|
|
+#define OF_957X(__nrgpio, __int) (void *)(__nrgpio | PCA957X_TYPE | __int)
|
|
|
|
+
|
|
static const struct of_device_id pca953x_dt_ids[] = {
|
|
static const struct of_device_id pca953x_dt_ids[] = {
|
|
- { .compatible = "nxp,pca9505", },
|
|
|
|
- { .compatible = "nxp,pca9534", },
|
|
|
|
- { .compatible = "nxp,pca9535", },
|
|
|
|
- { .compatible = "nxp,pca9536", },
|
|
|
|
- { .compatible = "nxp,pca9537", },
|
|
|
|
- { .compatible = "nxp,pca9538", },
|
|
|
|
- { .compatible = "nxp,pca9539", },
|
|
|
|
- { .compatible = "nxp,pca9554", },
|
|
|
|
- { .compatible = "nxp,pca9555", },
|
|
|
|
- { .compatible = "nxp,pca9556", },
|
|
|
|
- { .compatible = "nxp,pca9557", },
|
|
|
|
- { .compatible = "nxp,pca9574", },
|
|
|
|
- { .compatible = "nxp,pca9575", },
|
|
|
|
- { .compatible = "nxp,pca9698", },
|
|
|
|
-
|
|
|
|
- { .compatible = "maxim,max7310", },
|
|
|
|
- { .compatible = "maxim,max7312", },
|
|
|
|
- { .compatible = "maxim,max7313", },
|
|
|
|
- { .compatible = "maxim,max7315", },
|
|
|
|
-
|
|
|
|
- { .compatible = "ti,pca6107", },
|
|
|
|
- { .compatible = "ti,tca6408", },
|
|
|
|
- { .compatible = "ti,tca6416", },
|
|
|
|
- { .compatible = "ti,tca6424", },
|
|
|
|
-
|
|
|
|
- { .compatible = "onsemi,pca9654" },
|
|
|
|
-
|
|
|
|
- { .compatible = "exar,xra1202", },
|
|
|
|
|
|
+ { .compatible = "nxp,pca9505", .data = OF_953X(40, PCA_INT), },
|
|
|
|
+ { .compatible = "nxp,pca9534", .data = OF_953X( 8, PCA_INT), },
|
|
|
|
+ { .compatible = "nxp,pca9535", .data = OF_953X(16, PCA_INT), },
|
|
|
|
+ { .compatible = "nxp,pca9536", .data = OF_953X( 4, 0), },
|
|
|
|
+ { .compatible = "nxp,pca9537", .data = OF_953X( 4, PCA_INT), },
|
|
|
|
+ { .compatible = "nxp,pca9538", .data = OF_953X( 8, PCA_INT), },
|
|
|
|
+ { .compatible = "nxp,pca9539", .data = OF_953X(16, PCA_INT), },
|
|
|
|
+ { .compatible = "nxp,pca9554", .data = OF_953X( 8, PCA_INT), },
|
|
|
|
+ { .compatible = "nxp,pca9555", .data = OF_953X(16, PCA_INT), },
|
|
|
|
+ { .compatible = "nxp,pca9556", .data = OF_953X( 8, 0), },
|
|
|
|
+ { .compatible = "nxp,pca9557", .data = OF_953X( 8, 0), },
|
|
|
|
+ { .compatible = "nxp,pca9574", .data = OF_957X( 8, PCA_INT), },
|
|
|
|
+ { .compatible = "nxp,pca9575", .data = OF_957X(16, PCA_INT), },
|
|
|
|
+ { .compatible = "nxp,pca9698", .data = OF_953X(40, 0), },
|
|
|
|
+
|
|
|
|
+ { .compatible = "maxim,max7310", .data = OF_953X( 8, 0), },
|
|
|
|
+ { .compatible = "maxim,max7312", .data = OF_953X(16, PCA_INT), },
|
|
|
|
+ { .compatible = "maxim,max7313", .data = OF_953X(16, PCA_INT), },
|
|
|
|
+ { .compatible = "maxim,max7315", .data = OF_953X( 8, PCA_INT), },
|
|
|
|
+
|
|
|
|
+ { .compatible = "ti,pca6107", .data = OF_953X( 8, PCA_INT), },
|
|
|
|
+ { .compatible = "ti,tca6408", .data = OF_953X( 8, PCA_INT), },
|
|
|
|
+ { .compatible = "ti,tca6416", .data = OF_953X(16, PCA_INT), },
|
|
|
|
+ { .compatible = "ti,tca6424", .data = OF_953X(24, PCA_INT), },
|
|
|
|
+
|
|
|
|
+ { .compatible = "onsemi,pca9654", .data = OF_953X( 8, PCA_INT), },
|
|
|
|
+
|
|
|
|
+ { .compatible = "exar,xra1202", .data = OF_953X( 8, 0), },
|
|
{ }
|
|
{ }
|
|
};
|
|
};
|
|
|
|
|