drivers: gpio_pca95xx: add support for pin validation
Add the common config structure as a prefix of the driver-specific config structure and use the devicetree GPIO pin counts to initialize it. Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
parent
d68807a391
commit
71873c8a16
1 changed files with 6 additions and 0 deletions
|
@ -52,6 +52,9 @@ LOG_MODULE_REGISTER(gpio_pca95xx);
|
||||||
|
|
||||||
/** Configuration data */
|
/** Configuration data */
|
||||||
struct gpio_pca95xx_config {
|
struct gpio_pca95xx_config {
|
||||||
|
/* gpio_driver_config needs to be first */
|
||||||
|
struct gpio_driver_config common;
|
||||||
|
|
||||||
/** The master I2C device's name */
|
/** The master I2C device's name */
|
||||||
const char * const i2c_master_dev_name;
|
const char * const i2c_master_dev_name;
|
||||||
|
|
||||||
|
@ -589,6 +592,9 @@ static int gpio_pca95xx_init(struct device *dev)
|
||||||
|
|
||||||
#define GPIO_PCA95XX_DEVICE_INSTANCE(inst) \
|
#define GPIO_PCA95XX_DEVICE_INSTANCE(inst) \
|
||||||
static const struct gpio_pca95xx_config gpio_pca95xx_##inst##_cfg = { \
|
static const struct gpio_pca95xx_config gpio_pca95xx_##inst##_cfg = { \
|
||||||
|
.common = { \
|
||||||
|
.port_pin_mask = GPIO_PORT_PIN_MASK_FROM_NGPIOS(DT_INST_##inst##_NXP_PCA95XX_NGPIOS), \
|
||||||
|
}, \
|
||||||
.i2c_master_dev_name = DT_INST_##inst##_NXP_PCA95XX_BUS_NAME, \
|
.i2c_master_dev_name = DT_INST_##inst##_NXP_PCA95XX_BUS_NAME, \
|
||||||
.i2c_slave_addr = DT_INST_##inst##_NXP_PCA95XX_BASE_ADDRESS, \
|
.i2c_slave_addr = DT_INST_##inst##_NXP_PCA95XX_BASE_ADDRESS, \
|
||||||
.capabilities = \
|
.capabilities = \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue