video/drm: rockchip_phy: support set_mode callback

This patch adds generic PHY modes to the phy_mode enum, to
allow configuring generic PHYs to the MIPI/LVDS/TTL mode by
using the set_mode callback.

Change-Id: I28c5cdf905026b246f928eb8f75a212408df281b
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
This commit is contained in:
Wyon Bi 2018-12-08 11:51:35 +08:00 committed by Kever Yang
parent 340f659492
commit 396701fd2f
2 changed files with 20 additions and 0 deletions

View File

@ -73,3 +73,14 @@ long rockchip_phy_round_rate(struct rockchip_phy *phy, unsigned long rate)
return 0;
}
int rockchip_phy_set_mode(struct rockchip_phy *phy, enum phy_mode mode)
{
if (!phy)
return -ENODEV;
if (phy->funcs && phy->funcs->set_mode)
return phy->funcs->set_mode(phy, mode);
return 0;
}

View File

@ -7,6 +7,13 @@
#ifndef _ROCKCHIP_PHY_H_
#define _ROCKCHIP_PHY_H_
enum phy_mode {
PHY_MODE_INVALID,
PHY_MODE_VIDEO_MIPI,
PHY_MODE_VIDEO_LVDS,
PHY_MODE_VIDEO_TTL,
};
struct rockchip_phy;
struct rockchip_phy_funcs {
@ -16,6 +23,7 @@ struct rockchip_phy_funcs {
unsigned long (*set_pll)(struct rockchip_phy *phy, unsigned long rate);
int (*set_bus_width)(struct rockchip_phy *phy, u32 bus_width);
long (*round_rate)(struct rockchip_phy *phy, unsigned long rate);
int (*set_mode)(struct rockchip_phy *phy, enum phy_mode mode);
};
struct rockchip_phy {
@ -31,5 +39,6 @@ unsigned long rockchip_phy_set_pll(struct rockchip_phy *phy,
unsigned long rate);
int rockchip_phy_set_bus_width(struct rockchip_phy *phy, u32 bus_width);
long rockchip_phy_round_rate(struct rockchip_phy *phy, unsigned long rate);
int rockchip_phy_set_mode(struct rockchip_phy *phy, enum phy_mode mode);
#endif