drivers: can: mcan: add generic support for can_get_max_filters()

Add generic support for can_get_max_filters() to the Bosch M_CAN
base driver and use it in all driver frontends.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This commit is contained in:
Henrik Brix Andersen 2022-03-18 10:37:37 +01:00 committed by Anas Nashif
commit 5fd079bd68
6 changed files with 17 additions and 23 deletions

View file

@ -828,6 +828,17 @@ static int can_mcan_get_free_std(volatile struct can_mcan_std_filter *filters)
return -ENOSPC;
}
int can_mcan_get_max_filters(const struct device *dev, enum can_ide id_type)
{
ARG_UNUSED(dev);
if (id_type == CAN_STANDARD_IDENTIFIER) {
return NUM_STD_FILTER_DATA;
} else {
return NUM_EXT_FILTER_DATA;
}
}
/* Use masked configuration only for simplicity. If someone needs more than
* 28 standard filters, dual mode needs to be implemented.
* Dual mode gets tricky, because we can only activate both filters.