diff options
author | Fancy Fang <chen.fang@nxp.com> | 2017-03-11 17:08:42 +0800 |
---|---|---|
committer | Anson Huang <Anson.Huang@nxp.com> | 2017-06-09 22:19:56 +0800 |
commit | d3a69fb0536060a96c014c2dad579effb2bfddf4 (patch) | |
tree | 8b08806611fc24667d3d593c6dcf22a4e04bbd21 | |
parent | deff1fd5d88f0fe0457bb1ab2b78ea435d7027a7 (diff) |
MLK-14314-5 dma: pxp-v3: divide whole pxp into four parts
According to the pxp high level architecture diagram,
it is better to divide the whole big pxp module into
four sub-modules:
1. 2D operation module(legacy pxp and input fetch & store).
2. Dithering module.
3. WFE_A module.
4. WFE_B module.
This division will simplify driver implementations and
management.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 5e57840b41adb195515bd652d9624feaadf3448e)
-rw-r--r-- | drivers/dma/pxp/pxp_dma_v3.c | 133 | ||||
-rw-r--r-- | include/uapi/linux/pxp_dma.h | 9 |
2 files changed, 75 insertions, 67 deletions
diff --git a/drivers/dma/pxp/pxp_dma_v3.c b/drivers/dma/pxp/pxp_dma_v3.c index 76078915574f..8cd98d6ecec6 100644 --- a/drivers/dma/pxp/pxp_dma_v3.c +++ b/drivers/dma/pxp/pxp_dma_v3.c @@ -1265,83 +1265,82 @@ static int pxp_config(struct pxps *pxp, struct pxp_channel *pxp_chan) struct pxp_config_data *pxp_conf_data = &pxp->pxp_conf_state; struct pxp_proc_data *proc_data = &pxp_conf_data->proc_data; - if ((proc_data->working_mode & PXP_MODE_STANDARD) == PXP_MODE_STANDARD) { - /* now only test dithering feature */ - if ((proc_data->engine_enable & PXP_ENABLE_DITHER) == PXP_ENABLE_DITHER) { - pxp_dithering_process(pxp); - if (pxp_is_v3p(pxp)) { - __raw_writel( - BM_PXP_CTRL_ENABLE | - BM_PXP_CTRL_ENABLE_DITHER | - BM_PXP_CTRL_ENABLE_CSC2 | - BM_PXP_CTRL_ENABLE_LUT | - BM_PXP_CTRL_ENABLE_ROTATE0 | - BM_PXP_CTRL_ENABLE_PS_AS_OUT, - pxp->base + HW_PXP_CTRL_SET); - return 0; - } + switch (proc_data->op_type) { + case PXP_OP_2D: + /* Configure PxP regs */ + pxp_set_ctrl(pxp); + + pxp_set_s0param(pxp); + pxp_set_s0crop(pxp); + pxp_set_scaling(pxp); + pxp_set_s0colorkey(pxp); + if (pxp_conf_data->layer_nr == 2) { + /* disable AS engine */ + __raw_writel(BF_PXP_OUT_AS_ULC_X(1) | + BF_PXP_OUT_AS_ULC_Y(1), + pxp->base + HW_PXP_OUT_AS_ULC); + __raw_writel(BF_PXP_OUT_AS_LRC_X(0) | + BF_PXP_OUT_AS_LRC_Y(0), + pxp->base + HW_PXP_OUT_AS_LRC); + } else + pxp_set_oln(0, pxp); + pxp_set_olparam(0, pxp); + pxp_set_olcolorkey(0, pxp); + + pxp_set_csc(pxp); + pxp_set_bg(pxp); + pxp_set_lut(pxp); + + pxp_set_s0buf(pxp); + pxp_set_outbuf(pxp); + break; + case PXP_OP_DITHER: + pxp_dithering_process(pxp); + if (pxp_is_v3p(pxp)) { + __raw_writel( + BM_PXP_CTRL_ENABLE | + BM_PXP_CTRL_ENABLE_DITHER | + BM_PXP_CTRL_ENABLE_CSC2 | + BM_PXP_CTRL_ENABLE_LUT | + BM_PXP_CTRL_ENABLE_ROTATE0 | + BM_PXP_CTRL_ENABLE_PS_AS_OUT, + pxp->base + HW_PXP_CTRL_SET); + return 0; } - - if ((proc_data->engine_enable & PXP_ENABLE_WFE_A) == PXP_ENABLE_WFE_A) - { - pxp_luts_deactivate(pxp, proc_data->lut_sels); - - if (proc_data->lut_cleanup == 0) { - /* We should enable histogram in standard mode - * in wfe_a processing for waveform mode selection - */ - pxp_histogram_enable(pxp, pxp_conf_data->wfe_a_fetch_param[0].width, + break; + case PXP_OP_WFE_A: + pxp_luts_deactivate(pxp, proc_data->lut_sels); + + if (proc_data->lut_cleanup == 0) { + /* We should enable histogram in standard mode + * in wfe_a processing for waveform mode selection + */ + pxp_histogram_enable(pxp, pxp_conf_data->wfe_a_fetch_param[0].width, pxp_conf_data->wfe_a_fetch_param[0].height); - pxp_luts_activate(pxp, (u64)proc_data->lut_status_1 | + pxp_luts_activate(pxp, (u64)proc_data->lut_status_1 | ((u64)proc_data->lut_status_2 << 32)); - /* collision detection should be always enable in standard mode */ - pxp_collision_detection_enable(pxp, pxp_conf_data->wfe_a_fetch_param[0].width, - pxp_conf_data->wfe_a_fetch_param[0].height); - } - - if (pxp->devdata && pxp->devdata->pxp_wfe_a_configure) - pxp->devdata->pxp_wfe_a_configure(pxp); - if (pxp->devdata && pxp->devdata->pxp_wfe_a_process) - pxp->devdata->pxp_wfe_a_process(pxp); + /* collision detection should be always enable in standard mode */ + pxp_collision_detection_enable(pxp, pxp_conf_data->wfe_a_fetch_param[0].width, + pxp_conf_data->wfe_a_fetch_param[0].height); } - if ((proc_data->engine_enable & PXP_ENABLE_WFE_B) == PXP_ENABLE_WFE_B) { - pxp_wfe_b_configure(pxp); - pxp_wfe_b_process(pxp); - } + if (pxp->devdata && pxp->devdata->pxp_wfe_a_configure) + pxp->devdata->pxp_wfe_a_configure(pxp); + if (pxp->devdata && pxp->devdata->pxp_wfe_a_process) + pxp->devdata->pxp_wfe_a_process(pxp); - return 0; + break; + case PXP_OP_WFE_B: + pxp_wfe_b_configure(pxp); + pxp_wfe_b_process(pxp); + break; + default: + pr_err("Invalid pxp operation type passed\n"); + return -EINVAL; } - /* Configure PxP regs */ - pxp_set_ctrl(pxp); - pxp_set_s0param(pxp); - pxp_set_s0crop(pxp); - pxp_set_scaling(pxp); - pxp_set_s0colorkey(pxp); - - if (pxp_conf_data->layer_nr == 2) { - /* disable AS engine */ - __raw_writel(BF_PXP_OUT_AS_ULC_X(1) | - BF_PXP_OUT_AS_ULC_Y(1), - pxp->base + HW_PXP_OUT_AS_ULC); - __raw_writel(BF_PXP_OUT_AS_LRC_X(0) | - BF_PXP_OUT_AS_LRC_Y(0), - pxp->base + HW_PXP_OUT_AS_LRC); - } else - pxp_set_oln(0, pxp); - pxp_set_olparam(0, pxp); - pxp_set_olcolorkey(0, pxp); - - pxp_set_csc(pxp); - pxp_set_bg(pxp); - pxp_set_lut(pxp); - - pxp_set_s0buf(pxp); - pxp_set_outbuf(pxp); - return 0; } diff --git a/include/uapi/linux/pxp_dma.h b/include/uapi/linux/pxp_dma.h index 2cfa8e412fc7..a370e0e44430 100644 --- a/include/uapi/linux/pxp_dma.h +++ b/include/uapi/linux/pxp_dma.h @@ -153,6 +153,13 @@ enum pxp_engine_ctrl { PXP_ENABLE_DITHER_BYPASS = 0x2000, }; +enum pxp_op_type { + PXP_OP_2D = 0x001, + PXP_OP_DITHER = 0x002, + PXP_OP_WFE_A = 0x004, + PXP_OP_WFE_B = 0x008, +}; + struct rect { int top; /* Upper left coordinate of rectangle */ int left; @@ -230,6 +237,8 @@ struct pxp_proc_data { bool lut_map_updated; /* Map recently changed */ bool combine_enable; + enum pxp_op_type op_type; + /* LUT cleanup */ __u64 lut_sels; |