@@ -558,6 +558,9 @@ static inline int gpio_pca_series_reg_cache_read(const struct device *dev,
558558 * @return int 0 if success
559559 * -EINVAL if invalid arguments
560560 * -EACCES if register is uncacheable
561+ *
562+ * @note the buffer must be little-endian, the same as I2C register layout,
563+ * regardless of host machine endianness.
561564 */
562565static inline int gpio_pca_series_reg_cache_update (const struct device * dev ,
563566 enum gpio_pca_series_reg_type reg_type ,
@@ -1664,23 +1667,12 @@ static void gpio_pca_series_interrupt_handler_standard(const struct device *dev,
16641667 int_fall = gpio_pca_series_reg_cache_mini_get (dev )-> int_fall ;
16651668#endif /* CONFIG_GPIO_PCA_SERIES_CACHE_ALL */
16661669
1667- /** check if any interrupt enabled */
1668- if ((!int_rise ) && (!int_fall )) {
1669- goto out ;
1670- }
1671-
16721670 /** read current input value, and clear status if reg is present */
16731671 ret = gpio_pca_series_reg_read (dev , PCA_REG_TYPE_1B_INPUT_PORT , (uint8_t * )& input );
16741672 if (ret ) {
16751673 goto out ;
16761674 }
16771675 input = sys_le32_to_cpu (input );
1678- /** compare input to input_old to get transitioned_pins */
1679- transitioned_pins = input_old ^ input ;
1680-
1681- /** Mask gpio transactions with rising/falling edge interrupt config */
1682- int_status = (int_rise & transitioned_pins & input )
1683- | (int_fall & transitioned_pins & (~input ));
16841676
16851677 /** update current input to cache */
16861678#ifdef CONFIG_GPIO_PCA_SERIES_CACHE_ALL
@@ -1692,6 +1684,18 @@ static void gpio_pca_series_interrupt_handler_standard(const struct device *dev,
16921684 gpio_pca_series_reg_cache_mini_get (dev )-> input_old = input ;
16931685#endif /* CONFIG_GPIO_PCA_SERIES_CACHE_ALL */
16941686
1687+ /** check if any interrupt enabled */
1688+ if ((!int_rise ) && (!int_fall )) {
1689+ goto out ;
1690+ }
1691+
1692+ /** compare input to input_old to get transitioned_pins */
1693+ transitioned_pins = input_old ^ input ;
1694+
1695+ /** Mask gpio transactions with rising/falling edge interrupt config */
1696+ int_status = (int_rise & transitioned_pins & input )
1697+ | (int_fall & transitioned_pins & (~input ));
1698+
16951699out :
16961700 k_sem_give (& data -> lock );
16971701
@@ -2253,12 +2257,12 @@ const struct gpio_pca_series_part_config gpio_pca_series_part_cfg_pca9555 = {
22532257#define GPIO_PCA_PART_CFG_PCA_PART_NO_PCA6416 (&gpio_pca_series_part_cfg_pca6416)
22542258
22552259const struct gpio_pca_series_part_config gpio_pca_series_part_cfg_pca6416 = {
2256- .port_no = GPIO_PCA_PORT_NO_PCA_PART_NO_PCA6408 ,
2257- .flags = GPIO_PCA_FLAG_PCA_PART_NO_PCA6408 ,
2260+ .port_no = GPIO_PCA_PORT_NO_PCA_PART_NO_PCA6416 ,
2261+ .flags = GPIO_PCA_FLAG_PCA_PART_NO_PCA6416 ,
22582262 .regs = gpio_pca_series_reg_pca9539 ,
22592263#ifdef CONFIG_GPIO_PCA_SERIES_CACHE_ALL
22602264# ifdef GPIO_NXP_PCA_SERIES_DEBUG
2261- .cache_size = GPIO_PCA_GET_CACHE_SIZE_BY_PART_NO (PCA_PART_NO_PCA6408 ),
2265+ .cache_size = GPIO_PCA_GET_CACHE_SIZE_BY_PART_NO (PCA_PART_NO_PCA6416 ),
22622266# endif /* GPIO_NXP_PCA_SERIES_DEBUG */
22632267 .cache_map = gpio_pca_series_cache_map_pca953x ,
22642268#endif /* CONFIG_GPIO_PCA_SERIES_CACHE_ALL */
0 commit comments