diff options
author | Andrey Shvetsov <andrey.shvetsov@k2l.de> | 2016-09-15 16:19:07 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-09-15 19:23:29 +0200 |
commit | a85ee2aa99684321274b85052a9d5b692d814296 (patch) | |
tree | 8b36ab3e903a1f36558cc2f9dbfd1ef5e9cd3885 /drivers/staging/most | |
parent | 6631c5c9b0c3698f3977caf5694e8ece6a36f48b (diff) | |
download | linux-a85ee2aa99684321274b85052a9d5b692d814296.tar.gz linux-a85ee2aa99684321274b85052a9d5b692d814296.tar.bz2 linux-a85ee2aa99684321274b85052a9d5b692d814296.zip |
staging: most: hdm-dim2: round up DBR memory for async/ctrl
As the DBR memory is allocated in units of DBR_BLOCK_SIZE, it is more
efficient to configure the DIM2 IP to use whole blocks of the DBR memory.
This patch ceils the DBR memory size used by the DIM2 IP for async/ctrl
channels.
Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/most')
-rw-r--r-- | drivers/staging/most/hdm-dim2/dim2_hal.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index 0c58ab86281f..11abce7818b3 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -49,6 +49,8 @@ #define DBR_SIZE (16 * 1024) /* specified by IP */ #define DBR_BLOCK_SIZE (DBR_SIZE / 32 / DBR_MAP_SIZE) +#define ROUND_UP_TO(x, d) (((x) + (d) - 1) / (d) * (d)) + /* -------------------------------------------------------------------------- */ /* generic helper functions and macros */ @@ -698,7 +700,7 @@ static u8 init_ctrl_async(struct dim_channel *ch, u8 type, u8 is_tx, if (!check_channel_address(ch_address)) return DIM_INIT_ERR_CHANNEL_ADDRESS; - ch->dbr_size = hw_buffer_size; + ch->dbr_size = ROUND_UP_TO(hw_buffer_size, DBR_BLOCK_SIZE); ch->dbr_addr = alloc_dbr(ch->dbr_size); if (ch->dbr_addr >= DBR_SIZE) return DIM_INIT_ERR_OUT_OF_MEMORY; |