mirror of
https://github.com/armbian/linux.git
synced 2026-01-06 10:13:00 -08:00
drm/rockchip: tve: Get tve preferred mode from dts
Change-Id: I597328fd9a02ffd774d452497ae378c9d8204a21 Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
This commit is contained in:
@@ -14,6 +14,8 @@ Required properties:
|
||||
- rockchip,lumafilter2: the value for TVE_LUMA_FILTER3(0x1c)
|
||||
- rockchip,daclevel: the value is used to adjust the voltage amplitude of the CVBS
|
||||
- rockchip,dac1level: only for rv1108 rk322x and rk3328
|
||||
Optional properties:
|
||||
- rockchip,tvemode: tve preferred mode, 0 for PAL, 1 for NTSC
|
||||
|
||||
Example:
|
||||
tve: tve@ff373e00 {
|
||||
@@ -28,6 +30,7 @@ Example:
|
||||
rockchip,lumafilter2 = <0xf332d70c>;
|
||||
rockchip,daclevel = <0x22>;
|
||||
rockchip,dac1level = <0x7>;
|
||||
rockchip,tvemode = <0>;
|
||||
status = "disabled";
|
||||
|
||||
ports {
|
||||
|
||||
@@ -22,8 +22,7 @@
|
||||
#define RK322X_VDAC_STANDARD 0x15
|
||||
|
||||
static const struct drm_display_mode cvbs_mode[] = {
|
||||
{ DRM_MODE("720x576i", DRM_MODE_TYPE_DRIVER |
|
||||
DRM_MODE_TYPE_PREFERRED, 13500, 720, 753,
|
||||
{ DRM_MODE("720x576i", DRM_MODE_TYPE_DRIVER, 13500, 720, 753,
|
||||
816, 864, 0, 576, 580, 586, 625, 0,
|
||||
DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
|
||||
DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK),
|
||||
@@ -49,11 +48,15 @@ static int
|
||||
rockchip_tve_get_modes(struct drm_connector *connector)
|
||||
{
|
||||
int count;
|
||||
struct rockchip_tve *tve = connector_to_tve(connector);
|
||||
|
||||
for (count = 0; count < ARRAY_SIZE(cvbs_mode); count++) {
|
||||
struct drm_display_mode *mode_ptr;
|
||||
|
||||
mode_ptr = drm_mode_duplicate(connector->dev, &cvbs_mode[count]);
|
||||
mode_ptr = drm_mode_duplicate(connector->dev,
|
||||
&cvbs_mode[count]);
|
||||
if (tve->preferred_mode == count)
|
||||
mode_ptr->type |= DRM_MODE_TYPE_PREFERRED;
|
||||
drm_mode_probed_add(connector, mode_ptr);
|
||||
}
|
||||
|
||||
@@ -329,6 +332,15 @@ static int tve_parse_dt(struct device_node *np,
|
||||
struct nvmem_cell *cell;
|
||||
unsigned char *efuse_buf;
|
||||
|
||||
ret = of_property_read_u32(np, "rockchip,tvemode", &val);
|
||||
if (ret < 0) {
|
||||
tve->preferred_mode = 0;
|
||||
} else if (val > 1) {
|
||||
dev_err(tve->dev, "tve mode value invalid\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
tve->preferred_mode = val;
|
||||
|
||||
ret = of_property_read_u32(np, "rockchip,saturation", &val);
|
||||
if (val == 0 || ret < 0)
|
||||
return -EINVAL;
|
||||
|
||||
@@ -157,6 +157,7 @@ struct rockchip_tve {
|
||||
u32 lumafilter2;
|
||||
u32 daclevel;
|
||||
u32 dac1level;
|
||||
u32 preferred_mode;
|
||||
struct mutex suspend_lock; /* mutex for tve resume operation*/
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user