Loading...
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2016 BayLibre, SAS
4 * Author: Neil Armstrong <narmstrong@baylibre.com>
5 */
6
7/*
8 * Video Encoders
9 * - ENCI : Interlace Video Encoder
10 * - ENCI_DVI : Interlace Video Encoder for DVI/HDMI
11 * - ENCP : Progressive Video Encoder
12 */
13
14#ifndef __MESON_VENC_H
15#define __MESON_VENC_H
16
17struct drm_display_mode;
18
19enum {
20 MESON_VENC_MODE_NONE = 0,
21 MESON_VENC_MODE_CVBS_PAL,
22 MESON_VENC_MODE_CVBS_NTSC,
23 MESON_VENC_MODE_HDMI,
24};
25
26struct meson_cvbs_enci_mode {
27 unsigned int mode_tag;
28 unsigned int hso_begin; /* HSO begin position */
29 unsigned int hso_end; /* HSO end position */
30 unsigned int vso_even; /* VSO even line */
31 unsigned int vso_odd; /* VSO odd line */
32 unsigned int macv_max_amp; /* Macrovision max amplitude */
33 unsigned int video_prog_mode;
34 unsigned int video_mode;
35 unsigned int sch_adjust;
36 unsigned int yc_delay;
37 unsigned int pixel_start;
38 unsigned int pixel_end;
39 unsigned int top_field_line_start;
40 unsigned int top_field_line_end;
41 unsigned int bottom_field_line_start;
42 unsigned int bottom_field_line_end;
43 unsigned int video_saturation;
44 unsigned int video_contrast;
45 unsigned int video_brightness;
46 unsigned int video_hue;
47 unsigned int analog_sync_adj;
48};
49
50/* HDMI Clock parameters */
51enum drm_mode_status
52meson_venc_hdmi_supported_mode(const struct drm_display_mode *mode);
53bool meson_venc_hdmi_supported_vic(int vic);
54bool meson_venc_hdmi_venc_repeat(int vic);
55
56/* CVBS Timings and Parameters */
57extern struct meson_cvbs_enci_mode meson_cvbs_enci_pal;
58extern struct meson_cvbs_enci_mode meson_cvbs_enci_ntsc;
59
60void meson_venci_cvbs_mode_set(struct meson_drm *priv,
61 struct meson_cvbs_enci_mode *mode);
62void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic,
63 struct drm_display_mode *mode);
64unsigned int meson_venci_get_field(struct meson_drm *priv);
65
66void meson_venc_enable_vsync(struct meson_drm *priv);
67void meson_venc_disable_vsync(struct meson_drm *priv);
68
69void meson_venc_init(struct meson_drm *priv);
70
71#endif /* __MESON_VENC_H */
1/*
2 * Copyright (C) 2016 BayLibre, SAS
3 * Author: Neil Armstrong <narmstrong@baylibre.com>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, see <http://www.gnu.org/licenses/>.
17 */
18
19/*
20 * Video Encoders
21 * - ENCI : Interlace Video Encoder
22 * - ENCI_DVI : Interlace Video Encoder for DVI/HDMI
23 * - ENCP : Progressive Video Encoder
24 */
25
26#ifndef __MESON_VENC_H
27#define __MESON_VENC_H
28
29enum {
30 MESON_VENC_MODE_NONE = 0,
31 MESON_VENC_MODE_CVBS_PAL,
32 MESON_VENC_MODE_CVBS_NTSC,
33};
34
35struct meson_cvbs_enci_mode {
36 unsigned int mode_tag;
37 unsigned int hso_begin; /* HSO begin position */
38 unsigned int hso_end; /* HSO end position */
39 unsigned int vso_even; /* VSO even line */
40 unsigned int vso_odd; /* VSO odd line */
41 unsigned int macv_max_amp; /* Macrovision max amplitude */
42 unsigned int video_prog_mode;
43 unsigned int video_mode;
44 unsigned int sch_adjust;
45 unsigned int yc_delay;
46 unsigned int pixel_start;
47 unsigned int pixel_end;
48 unsigned int top_field_line_start;
49 unsigned int top_field_line_end;
50 unsigned int bottom_field_line_start;
51 unsigned int bottom_field_line_end;
52 unsigned int video_saturation;
53 unsigned int video_contrast;
54 unsigned int video_brightness;
55 unsigned int video_hue;
56 unsigned int analog_sync_adj;
57};
58
59/* CVBS Timings and Parameters */
60extern struct meson_cvbs_enci_mode meson_cvbs_enci_pal;
61extern struct meson_cvbs_enci_mode meson_cvbs_enci_ntsc;
62
63void meson_venci_cvbs_mode_set(struct meson_drm *priv,
64 struct meson_cvbs_enci_mode *mode);
65unsigned int meson_venci_get_field(struct meson_drm *priv);
66
67void meson_venc_enable_vsync(struct meson_drm *priv);
68void meson_venc_disable_vsync(struct meson_drm *priv);
69
70void meson_venc_init(struct meson_drm *priv);
71
72#endif /* __MESON_VENC_H */