| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Xilinx Video IP Core |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 6 | 7 | * |
|---|
| 7 | 8 | * Contacts: Hyun Kwon <hyun.kwon@xilinx.com> |
|---|
| 8 | 9 | * Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 11 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 12 | | - * published by the Free Software Foundation. |
|---|
| 13 | 10 | */ |
|---|
| 14 | 11 | |
|---|
| 15 | 12 | #ifndef __XILINX_VIP_H__ |
|---|
| 16 | 13 | #define __XILINX_VIP_H__ |
|---|
| 17 | 14 | |
|---|
| 15 | +#include <linux/bitops.h> |
|---|
| 18 | 16 | #include <linux/io.h> |
|---|
| 19 | 17 | #include <media/v4l2-subdev.h> |
|---|
| 20 | 18 | |
|---|
| .. | .. |
|---|
| 38 | 36 | |
|---|
| 39 | 37 | /* Xilinx Video IP Control Registers */ |
|---|
| 40 | 38 | #define XVIP_CTRL_CONTROL 0x0000 |
|---|
| 41 | | -#define XVIP_CTRL_CONTROL_SW_ENABLE (1 << 0) |
|---|
| 42 | | -#define XVIP_CTRL_CONTROL_REG_UPDATE (1 << 1) |
|---|
| 43 | | -#define XVIP_CTRL_CONTROL_BYPASS (1 << 4) |
|---|
| 44 | | -#define XVIP_CTRL_CONTROL_TEST_PATTERN (1 << 5) |
|---|
| 45 | | -#define XVIP_CTRL_CONTROL_FRAME_SYNC_RESET (1 << 30) |
|---|
| 46 | | -#define XVIP_CTRL_CONTROL_SW_RESET (1 << 31) |
|---|
| 39 | +#define XVIP_CTRL_CONTROL_SW_ENABLE BIT(0) |
|---|
| 40 | +#define XVIP_CTRL_CONTROL_REG_UPDATE BIT(1) |
|---|
| 41 | +#define XVIP_CTRL_CONTROL_BYPASS BIT(4) |
|---|
| 42 | +#define XVIP_CTRL_CONTROL_TEST_PATTERN BIT(5) |
|---|
| 43 | +#define XVIP_CTRL_CONTROL_FRAME_SYNC_RESET BIT(30) |
|---|
| 44 | +#define XVIP_CTRL_CONTROL_SW_RESET BIT(31) |
|---|
| 47 | 45 | #define XVIP_CTRL_STATUS 0x0004 |
|---|
| 48 | | -#define XVIP_CTRL_STATUS_PROC_STARTED (1 << 0) |
|---|
| 49 | | -#define XVIP_CTRL_STATUS_EOF (1 << 1) |
|---|
| 46 | +#define XVIP_CTRL_STATUS_PROC_STARTED BIT(0) |
|---|
| 47 | +#define XVIP_CTRL_STATUS_EOF BIT(1) |
|---|
| 50 | 48 | #define XVIP_CTRL_ERROR 0x0008 |
|---|
| 51 | | -#define XVIP_CTRL_ERROR_SLAVE_EOL_EARLY (1 << 0) |
|---|
| 52 | | -#define XVIP_CTRL_ERROR_SLAVE_EOL_LATE (1 << 1) |
|---|
| 53 | | -#define XVIP_CTRL_ERROR_SLAVE_SOF_EARLY (1 << 2) |
|---|
| 54 | | -#define XVIP_CTRL_ERROR_SLAVE_SOF_LATE (1 << 3) |
|---|
| 49 | +#define XVIP_CTRL_ERROR_SLAVE_EOL_EARLY BIT(0) |
|---|
| 50 | +#define XVIP_CTRL_ERROR_SLAVE_EOL_LATE BIT(1) |
|---|
| 51 | +#define XVIP_CTRL_ERROR_SLAVE_SOF_EARLY BIT(2) |
|---|
| 52 | +#define XVIP_CTRL_ERROR_SLAVE_SOF_LATE BIT(3) |
|---|
| 55 | 53 | #define XVIP_CTRL_IRQ_ENABLE 0x000c |
|---|
| 56 | | -#define XVIP_CTRL_IRQ_ENABLE_PROC_STARTED (1 << 0) |
|---|
| 57 | | -#define XVIP_CTRL_IRQ_EOF (1 << 1) |
|---|
| 54 | +#define XVIP_CTRL_IRQ_ENABLE_PROC_STARTED BIT(0) |
|---|
| 55 | +#define XVIP_CTRL_IRQ_EOF BIT(1) |
|---|
| 58 | 56 | #define XVIP_CTRL_VERSION 0x0010 |
|---|
| 59 | 57 | #define XVIP_CTRL_VERSION_MAJOR_MASK (0xff << 24) |
|---|
| 60 | 58 | #define XVIP_CTRL_VERSION_MAJOR_SHIFT 24 |
|---|
| .. | .. |
|---|
| 111 | 109 | * @code: media bus format code |
|---|
| 112 | 110 | * @bpp: bytes per pixel (when stored in memory) |
|---|
| 113 | 111 | * @fourcc: V4L2 pixel format FCC identifier |
|---|
| 114 | | - * @description: format description, suitable for userspace |
|---|
| 115 | 112 | */ |
|---|
| 116 | 113 | struct xvip_video_format { |
|---|
| 117 | 114 | unsigned int vf_code; |
|---|
| .. | .. |
|---|
| 120 | 117 | unsigned int code; |
|---|
| 121 | 118 | unsigned int bpp; |
|---|
| 122 | 119 | u32 fourcc; |
|---|
| 123 | | - const char *description; |
|---|
| 124 | 120 | }; |
|---|
| 125 | 121 | |
|---|
| 126 | 122 | const struct xvip_video_format *xvip_get_format_by_code(unsigned int code); |
|---|