// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) STMicroelectronics SA 2014 * Authors: Fabien Dessenne <[email protected]> for STMicroelectronics. */ #include <linux/delay.h> #include "bdisp.h" #include "bdisp-filter.h" #include "bdisp-reg.h" /* Max width of the source frame in a single node */ #define MAX_SRC_WIDTH … /* Reset & boot poll config */ #define POLL_RST_MAX … #define POLL_RST_DELAY_MS … enum bdisp_target_plan { … }; struct bdisp_op_cfg { … }; struct bdisp_filter_addr { … }; static const struct bdisp_filter_h_spec bdisp_h_spec[] = …; #define NB_H_FILTER … static const struct bdisp_filter_v_spec bdisp_v_spec[] = …; #define NB_V_FILTER … static struct bdisp_filter_addr bdisp_h_filter[NB_H_FILTER]; static struct bdisp_filter_addr bdisp_v_filter[NB_V_FILTER]; /** * bdisp_hw_reset * @bdisp: bdisp entity * * Resets HW * * RETURNS: * 0 on success. */ int bdisp_hw_reset(struct bdisp_dev *bdisp) { … } /** * bdisp_hw_get_and_clear_irq * @bdisp: bdisp entity * * Read then reset interrupt status * * RETURNS: * 0 if expected interrupt was raised. */ int bdisp_hw_get_and_clear_irq(struct bdisp_dev *bdisp) { … } /** * bdisp_hw_free_nodes * @ctx: bdisp context * * Free node memory * * RETURNS: * None */ void bdisp_hw_free_nodes(struct bdisp_ctx *ctx) { … } /** * bdisp_hw_alloc_nodes * @ctx: bdisp context * * Allocate dma memory for nodes * * RETURNS: * 0 on success */ int bdisp_hw_alloc_nodes(struct bdisp_ctx *ctx) { … } /** * bdisp_hw_free_filters * @dev: device * * Free filters memory * * RETURNS: * None */ void bdisp_hw_free_filters(struct device *dev) { … } /** * bdisp_hw_alloc_filters * @dev: device * * Allocate dma memory for filters * * RETURNS: * 0 on success */ int bdisp_hw_alloc_filters(struct device *dev) { … } /** * bdisp_hw_get_hf_addr * @inc: resize increment * * Find the horizontal filter table that fits the resize increment * * RETURNS: * table physical address */ static dma_addr_t bdisp_hw_get_hf_addr(u16 inc) { … } /** * bdisp_hw_get_vf_addr * @inc: resize increment * * Find the vertical filter table that fits the resize increment * * RETURNS: * table physical address */ static dma_addr_t bdisp_hw_get_vf_addr(u16 inc) { … } /** * bdisp_hw_get_inc * @from: input size * @to: output size * @inc: resize increment in 6.10 format * * Computes the increment (inverse of scale) in 6.10 format * * RETURNS: * 0 on success */ static int bdisp_hw_get_inc(u32 from, u32 to, u16 *inc) { … } /** * bdisp_hw_get_hv_inc * @ctx: device context * @h_inc: horizontal increment * @v_inc: vertical increment * * Computes the horizontal & vertical increments (inverse of scale) * * RETURNS: * 0 on success */ static int bdisp_hw_get_hv_inc(struct bdisp_ctx *ctx, u16 *h_inc, u16 *v_inc) { … } /** * bdisp_hw_get_op_cfg * @ctx: device context * @c: operation configuration * * Check which blitter operations are expected and sets the scaling increments * * RETURNS: * 0 on success */ static int bdisp_hw_get_op_cfg(struct bdisp_ctx *ctx, struct bdisp_op_cfg *c) { … } /** * bdisp_hw_color_format * @pixelformat: v4l2 pixel format * * v4l2 to bdisp pixel format convert * * RETURNS: * bdisp pixel format */ static u32 bdisp_hw_color_format(u32 pixelformat) { … } /** * bdisp_hw_build_node * @ctx: device context * @cfg: operation configuration * @node: node to be set * @t_plan: whether the node refers to a RGB/Y or a CbCr plane * @src_x_offset: x offset in the source image * * Build a node * * RETURNS: * None */ static void bdisp_hw_build_node(struct bdisp_ctx *ctx, struct bdisp_op_cfg *cfg, struct bdisp_node *node, enum bdisp_target_plan t_plan, int src_x_offset) { … } /** * bdisp_hw_build_all_nodes * @ctx: device context * * Build all the nodes for the blitter operation * * RETURNS: * 0 on success */ static int bdisp_hw_build_all_nodes(struct bdisp_ctx *ctx) { … } /** * bdisp_hw_save_request * @ctx: device context * * Save a copy of the request and of the built nodes * * RETURNS: * None */ static void bdisp_hw_save_request(struct bdisp_ctx *ctx) { … } /** * bdisp_hw_update * @ctx: device context * * Send the request to the HW * * RETURNS: * 0 on success */ int bdisp_hw_update(struct bdisp_ctx *ctx) { … }