/* * (C) Copyright 2008-2017 Fuzhou Rockchip Electronics Co., Ltd * * SPDX-License-Identifier: GPL-2.0+ */ #include #include #include #include #include #include #include #include #include "rockchip_display.h" #include "rockchip_crtc.h" #include "rockchip_connector.h" #include "rockchip_phy.h" static const struct rockchip_phy g_phy[] = { #ifdef CONFIG_ROCKCHIP_DW_MIPI_DSI { .compatible = "rockchip,rk3366-mipi-dphy", .funcs = &inno_mipi_dphy_funcs, }, { .compatible = "rockchip,rk3368-mipi-dphy", .funcs = &inno_mipi_dphy_funcs, }, #endif }; const struct rockchip_phy *rockchip_get_phy(const void *blob, int phy_node) { const char *name; int i; name = fdt_stringlist_get(blob, phy_node, "compatible", 0, NULL); for (i = 0; i < ARRAY_SIZE(g_phy); i++) { if (!strcmp(name, g_phy[i].compatible)) break; } if (i >= ARRAY_SIZE(g_phy)) return NULL; return &g_phy[i]; } int rockchip_phy_power_on(struct display_state *state) { struct connector_state *conn_state = &state->conn_state; const struct rockchip_phy *phy = conn_state->phy; if (!phy || !phy->funcs || !phy->funcs->power_on) { printf("%s: failed to find phy power on funcs\n", __func__); return -ENODEV; } return phy->funcs->power_on(state); } int rockchip_phy_power_off(struct display_state *state) { struct connector_state *conn_state = &state->conn_state; const struct rockchip_phy *phy = conn_state->phy; if (!phy || !phy->funcs || !phy->funcs->power_off) { printf("%s: failed to find phy power_off funcs\n", __func__); return -ENODEV; } return phy->funcs->power_off(state); } unsigned long rockchip_phy_set_pll(struct display_state *state, unsigned long rate) { struct connector_state *conn_state = &state->conn_state; const struct rockchip_phy *phy = conn_state->phy; if (!phy || !phy->funcs || !phy->funcs->set_pll) { printf("%s: failed to find phy set_pll funcs\n", __func__); return -ENODEV; } return phy->funcs->set_pll(state, rate); }