mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
drm/rockchip: rk618: remove unused files
Change-Id: I76e3e24d8aa391b5491e05474357bfec139d3827 Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
This commit is contained in:
@@ -1,384 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Rockchip Electronics Co. Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "rk618_output.h"
|
||||
|
||||
static inline struct rk618_output *encoder_to_output(struct drm_encoder *e)
|
||||
{
|
||||
return container_of(e, struct rk618_output, encoder);
|
||||
}
|
||||
|
||||
static inline
|
||||
struct rk618_output *connector_to_output(struct drm_connector *c)
|
||||
{
|
||||
return container_of(c, struct rk618_output, connector);
|
||||
}
|
||||
|
||||
static inline struct rk618_output *bridge_to_output(struct drm_bridge *b)
|
||||
{
|
||||
return container_of(b, struct rk618_output, bridge);
|
||||
}
|
||||
|
||||
static struct drm_encoder *
|
||||
rk618_output_connector_best_encoder(struct drm_connector *connector)
|
||||
{
|
||||
struct rk618_output *output = connector_to_output(connector);
|
||||
|
||||
return &output->encoder;
|
||||
}
|
||||
|
||||
static int rk618_output_connector_get_modes(struct drm_connector *connector)
|
||||
{
|
||||
struct rk618_output *output = connector_to_output(connector);
|
||||
struct drm_display_info *info = &connector->display_info;
|
||||
struct drm_display_mode *mode;
|
||||
int num_modes;
|
||||
|
||||
num_modes = drm_panel_get_modes(output->panel);
|
||||
|
||||
list_for_each_entry(mode, &connector->probed_modes, head) {
|
||||
if (mode->type & DRM_MODE_TYPE_PREFERRED)
|
||||
drm_mode_copy(&output->panel_mode, mode);
|
||||
}
|
||||
|
||||
if (info->num_bus_formats)
|
||||
output->bus_format = info->bus_formats[0];
|
||||
|
||||
return num_modes;
|
||||
}
|
||||
|
||||
static const struct drm_connector_helper_funcs
|
||||
rk618_output_connector_helper_funcs = {
|
||||
.get_modes = rk618_output_connector_get_modes,
|
||||
.best_encoder = rk618_output_connector_best_encoder,
|
||||
};
|
||||
|
||||
static enum drm_connector_status
|
||||
rk618_output_connector_detect(struct drm_connector *connector, bool force)
|
||||
{
|
||||
return connector_status_connected;
|
||||
}
|
||||
|
||||
static void rk618_output_connector_destroy(struct drm_connector *connector)
|
||||
{
|
||||
struct rk618_output *output = connector_to_output(connector);
|
||||
|
||||
drm_panel_detach(output->panel);
|
||||
drm_connector_cleanup(connector);
|
||||
}
|
||||
|
||||
static const struct drm_connector_funcs rk618_output_connector_funcs = {
|
||||
.dpms = drm_atomic_helper_connector_dpms,
|
||||
.detect = rk618_output_connector_detect,
|
||||
.fill_modes = drm_helper_probe_single_connector_modes,
|
||||
.destroy = rk618_output_connector_destroy,
|
||||
.reset = drm_atomic_helper_connector_reset,
|
||||
.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
|
||||
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
|
||||
};
|
||||
|
||||
static void rk618_output_encoder_enable(struct drm_encoder *encoder)
|
||||
{
|
||||
struct rk618_output *output = encoder_to_output(encoder);
|
||||
|
||||
rk618_dither_frc_dclk_invert(output->parent);
|
||||
|
||||
clk_set_parent(output->dither_clk, output->vif_clk);
|
||||
|
||||
if (output->funcs->pre_enable)
|
||||
output->funcs->pre_enable(output);
|
||||
|
||||
if (output->panel)
|
||||
drm_panel_prepare(output->panel);
|
||||
|
||||
if (output->funcs->enable)
|
||||
output->funcs->enable(output);
|
||||
|
||||
if (output->panel)
|
||||
drm_panel_enable(output->panel);
|
||||
}
|
||||
|
||||
static void rk618_output_encoder_disable(struct drm_encoder *encoder)
|
||||
{
|
||||
struct rk618_output *output = encoder_to_output(encoder);
|
||||
|
||||
if (output->panel)
|
||||
drm_panel_disable(output->panel);
|
||||
|
||||
if (output->funcs->disable)
|
||||
output->funcs->disable(output);
|
||||
|
||||
if (output->panel)
|
||||
drm_panel_unprepare(output->panel);
|
||||
|
||||
if (output->funcs->post_disable)
|
||||
output->funcs->post_disable(output);
|
||||
}
|
||||
|
||||
static void rk618_output_encoder_mode_set(struct drm_encoder *encoder,
|
||||
struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted)
|
||||
{
|
||||
struct rk618_output *output = encoder_to_output(encoder);
|
||||
|
||||
drm_mode_copy(&output->panel_mode, adjusted);
|
||||
|
||||
if (output->funcs->mode_set)
|
||||
output->funcs->mode_set(output, adjusted);
|
||||
}
|
||||
|
||||
static int
|
||||
rk618_output_encoder_atomic_check(struct drm_encoder *encoder,
|
||||
struct drm_crtc_state *crtc_state,
|
||||
struct drm_connector_state *conn_state)
|
||||
{
|
||||
struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc_state);
|
||||
|
||||
s->output_mode = ROCKCHIP_OUT_MODE_P888;
|
||||
s->output_type = DRM_MODE_CONNECTOR_LVDS;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct drm_encoder_helper_funcs
|
||||
rk618_output_encoder_helper_funcs = {
|
||||
.enable = rk618_output_encoder_enable,
|
||||
.disable = rk618_output_encoder_disable,
|
||||
.mode_set = rk618_output_encoder_mode_set,
|
||||
.atomic_check = rk618_output_encoder_atomic_check,
|
||||
};
|
||||
|
||||
static const struct drm_encoder_funcs rk618_output_encoder_funcs = {
|
||||
.destroy = drm_encoder_cleanup,
|
||||
};
|
||||
|
||||
static void rk618_output_bridge_pre_enable(struct drm_bridge *bridge)
|
||||
{
|
||||
struct rk618_output *output = bridge_to_output(bridge);
|
||||
const struct drm_display_mode *src = &output->scale_mode;
|
||||
const struct drm_display_mode *dst = &output->panel_mode;
|
||||
unsigned long sclk_rate, dclk_rate = src->clock * 1000;
|
||||
long rate;
|
||||
|
||||
sclk_rate = dclk_rate * dst->vdisplay * dst->htotal;
|
||||
do_div(sclk_rate, src->vdisplay * src->htotal);
|
||||
|
||||
dev_dbg(output->dev, "dclk rate: %ld, sclk rate: %ld\n",
|
||||
dclk_rate, sclk_rate);
|
||||
|
||||
clk_set_parent(output->dither_clk, output->scaler_clk);
|
||||
|
||||
rate = clk_round_rate(output->scaler_clk, sclk_rate);
|
||||
clk_set_rate(output->scaler_clk, rate);
|
||||
|
||||
clk_prepare_enable(output->scaler_clk);
|
||||
|
||||
rk618_scaler_configure(output->parent,
|
||||
&output->scale_mode, &output->panel_mode);
|
||||
rk618_scaler_enable(output->parent);
|
||||
|
||||
if (output->funcs->pre_enable)
|
||||
output->funcs->pre_enable(output);
|
||||
|
||||
if (output->panel)
|
||||
drm_panel_prepare(output->panel);
|
||||
}
|
||||
|
||||
static void rk618_output_bridge_enable(struct drm_bridge *bridge)
|
||||
{
|
||||
struct rk618_output *output = bridge_to_output(bridge);
|
||||
|
||||
if (output->funcs->enable)
|
||||
output->funcs->enable(output);
|
||||
|
||||
if (output->panel)
|
||||
drm_panel_enable(output->panel);
|
||||
}
|
||||
|
||||
static void rk618_output_bridge_disable(struct drm_bridge *bridge)
|
||||
{
|
||||
struct rk618_output *output = bridge_to_output(bridge);
|
||||
|
||||
if (output->panel)
|
||||
drm_panel_disable(output->panel);
|
||||
|
||||
if (output->funcs->disable)
|
||||
output->funcs->disable(output);
|
||||
}
|
||||
|
||||
static void rk618_output_bridge_post_disable(struct drm_bridge *bridge)
|
||||
{
|
||||
struct rk618_output *output = bridge_to_output(bridge);
|
||||
|
||||
if (output->panel)
|
||||
drm_panel_unprepare(output->panel);
|
||||
|
||||
if (output->funcs->post_disable)
|
||||
output->funcs->post_disable(output);
|
||||
|
||||
rk618_scaler_disable(output->parent);
|
||||
clk_disable_unprepare(output->scaler_clk);
|
||||
}
|
||||
|
||||
static void rk618_output_bridge_mode_set(struct drm_bridge *bridge,
|
||||
struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted)
|
||||
{
|
||||
struct rk618_output *output = bridge_to_output(bridge);
|
||||
|
||||
drm_mode_copy(&output->scale_mode, adjusted);
|
||||
|
||||
if (output->funcs->mode_set)
|
||||
output->funcs->mode_set(output, &output->panel_mode);
|
||||
}
|
||||
|
||||
static const struct drm_bridge_funcs rk618_output_bridge_funcs = {
|
||||
.pre_enable = rk618_output_bridge_pre_enable,
|
||||
.enable = rk618_output_bridge_enable,
|
||||
.disable = rk618_output_bridge_disable,
|
||||
.post_disable = rk618_output_bridge_post_disable,
|
||||
.mode_set = rk618_output_bridge_mode_set,
|
||||
};
|
||||
|
||||
int rk618_output_register(struct rk618_output *output)
|
||||
{
|
||||
struct device *dev = output->dev;
|
||||
struct device_node *endpoint, *remote = NULL, *port;
|
||||
int ret;
|
||||
|
||||
output->dither_clk = devm_clk_get(dev, "dither");
|
||||
if (IS_ERR(output->dither_clk)) {
|
||||
ret = PTR_ERR(output->dither_clk);
|
||||
dev_err(dev, "failed to get dither clock: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
output->vif_clk = devm_clk_get(dev, "vif");
|
||||
if (IS_ERR(output->vif_clk)) {
|
||||
ret = PTR_ERR(output->vif_clk);
|
||||
dev_err(dev, "failed to get vif clock: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
output->scaler_clk = devm_clk_get(dev, "scaler");
|
||||
if (IS_ERR(output->scaler_clk)) {
|
||||
ret = PTR_ERR(output->scaler_clk);
|
||||
dev_err(dev, "failed to get scaler clock: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
port = of_graph_get_port_by_id(dev->of_node, 1);
|
||||
if (!port) {
|
||||
dev_err(dev, "can't found port point.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
for_each_child_of_node(port, endpoint) {
|
||||
remote = of_graph_get_remote_port_parent(endpoint);
|
||||
if (!remote) {
|
||||
dev_err(dev, "can't found panel node, please init!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!of_device_is_available(remote)) {
|
||||
of_node_put(remote);
|
||||
remote = NULL;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!remote) {
|
||||
dev_err(dev, "no valid remote node\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
output->panel_node = remote;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(rk618_output_register);
|
||||
|
||||
int rk618_output_bind(struct rk618_output *output, struct drm_device *drm,
|
||||
int encoder_type, int connector_type)
|
||||
{
|
||||
struct device *dev = output->dev;
|
||||
struct drm_encoder *encoder = &output->encoder;
|
||||
struct drm_connector *connector = &output->connector;
|
||||
struct drm_bridge *bridge = &output->bridge;
|
||||
int ret;
|
||||
|
||||
output->panel = of_drm_find_panel(output->panel_node);
|
||||
if (!output->panel)
|
||||
output->ext_bridge = of_drm_find_bridge(output->panel_node);
|
||||
|
||||
if (!output->panel && !output->ext_bridge) {
|
||||
dev_info(dev, "Waiting for panel or bridge driver\n");
|
||||
return -EPROBE_DEFER;
|
||||
}
|
||||
|
||||
encoder->possible_crtcs = drm_of_find_possible_crtcs(drm,
|
||||
dev->of_node);
|
||||
drm_encoder_init(drm, encoder, &rk618_output_encoder_funcs,
|
||||
encoder_type, NULL);
|
||||
drm_encoder_helper_add(encoder, &rk618_output_encoder_helper_funcs);
|
||||
|
||||
if (output->ext_bridge) {
|
||||
output->ext_bridge->encoder = encoder;
|
||||
ret = drm_bridge_attach(drm, output->ext_bridge);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to attach bridge\n");
|
||||
return ret;
|
||||
}
|
||||
encoder->bridge = output->ext_bridge;
|
||||
} else {
|
||||
connector->port = dev->of_node;
|
||||
ret = drm_connector_init(drm, connector,
|
||||
&rk618_output_connector_funcs,
|
||||
connector_type);
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to init connector with drm\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
drm_connector_helper_add(connector,
|
||||
&rk618_output_connector_helper_funcs);
|
||||
|
||||
drm_mode_connector_attach_encoder(connector, encoder);
|
||||
|
||||
ret = drm_panel_attach(output->panel, connector);
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to attach panel\n");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
bridge->funcs = &rk618_output_bridge_funcs;
|
||||
bridge->of_node = dev->of_node;
|
||||
ret = drm_bridge_add(bridge);
|
||||
if (ret) {
|
||||
DRM_ERROR("failed to add bridge\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(rk618_output_bind);
|
||||
|
||||
void rk618_output_unbind(struct rk618_output *output)
|
||||
{
|
||||
drm_bridge_remove(&output->bridge);
|
||||
drm_connector_cleanup(&output->connector);
|
||||
drm_encoder_cleanup(&output->encoder);
|
||||
}
|
||||
EXPORT_SYMBOL(rk618_output_unbind);
|
||||
@@ -1,178 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Rockchip Electronics Co. Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _RK618_OUTPUT_
|
||||
#define _RK618_OUTPUT_
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/of.h>
|
||||
#include <video/of_display_timing.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/mfd/rk618.h>
|
||||
|
||||
#include <drm/drmP.h>
|
||||
#include <drm/drm_of.h>
|
||||
#include <drm/drm_atomic.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_panel.h>
|
||||
#include <drm/drm_mipi_dsi.h>
|
||||
|
||||
#include <video/videomode.h>
|
||||
|
||||
#include "../rockchip_drm_drv.h"
|
||||
#include "../rockchip_drm_vop.h"
|
||||
|
||||
#define UPDATE(x, h, l) (((x) << (l)) & GENMASK((h), (l)))
|
||||
#define HIWORD_UPDATE(v, h, l) (((v) << (l)) | (GENMASK((h), (l)) << 16))
|
||||
|
||||
#define RK618_LVDS_CON 0x0084
|
||||
#define LVDS_CON_START_PHASE(x) HIWORD_UPDATE(x, 14, 14)
|
||||
#define LVDS_DCLK_INV HIWORD_UPDATE(1, 13, 13)
|
||||
#define LVDS_CON_CHADS_10PF HIWORD_UPDATE(3, 12, 11)
|
||||
#define LVDS_CON_CHADS_5PF HIWORD_UPDATE(2, 12, 11)
|
||||
#define LVDS_CON_CHADS_7PF HIWORD_UPDATE(1, 12, 11)
|
||||
#define LVDS_CON_CHADS_3PF HIWORD_UPDATE(0, 12, 11)
|
||||
#define LVDS_CON_CHA1TTL_ENABLE HIWORD_UPDATE(1, 10, 10)
|
||||
#define LVDS_CON_CHA1TTL_DISABLE HIWORD_UPDATE(0, 10, 10)
|
||||
#define LVDS_CON_CHA0TTL_ENABLE HIWORD_UPDATE(1, 9, 9)
|
||||
#define LVDS_CON_CHA0TTL_DISABLE HIWORD_UPDATE(0, 9, 9)
|
||||
#define LVDS_CON_CHA1_POWER_UP HIWORD_UPDATE(1, 8, 8)
|
||||
#define LVDS_CON_CHA1_POWER_DOWN HIWORD_UPDATE(0, 8, 8)
|
||||
#define LVDS_CON_CHA0_POWER_UP HIWORD_UPDATE(1, 7, 7)
|
||||
#define LVDS_CON_CHA0_POWER_DOWN HIWORD_UPDATE(0, 7, 7)
|
||||
#define LVDS_CON_CBG_POWER_UP HIWORD_UPDATE(1, 6, 6)
|
||||
#define LVDS_CON_CBG_POWER_DOWN HIWORD_UPDATE(0, 6, 6)
|
||||
#define LVDS_CON_PLL_POWER_DOWN HIWORD_UPDATE(1, 5, 5)
|
||||
#define LVDS_CON_PLL_POWER_UP HIWORD_UPDATE(0, 5, 5)
|
||||
#define LVDS_CON_START_SEL_EVEN_PIXEL HIWORD_UPDATE(1, 4, 4)
|
||||
#define LVDS_CON_START_SEL_ODD_PIXEL HIWORD_UPDATE(0, 4, 4)
|
||||
#define LVDS_CON_CHASEL_DOUBLE_CHANNEL HIWORD_UPDATE(1, 3, 3)
|
||||
#define LVDS_CON_CHASEL_SINGLE_CHANNEL HIWORD_UPDATE(0, 3, 3)
|
||||
#define LVDS_CON_MSBSEL_D7 HIWORD_UPDATE(1, 2, 2)
|
||||
#define LVDS_CON_MSBSEL_D0 HIWORD_UPDATE(0, 2, 2)
|
||||
#define LVDS_CON_SELECT(x) HIWORD_UPDATE(x, 1, 0)
|
||||
#define LVDS_CON_SELECT_6BIT_MODE HIWORD_UPDATE(3, 1, 0)
|
||||
#define LVDS_CON_SELECT_8BIT_MODE_3 HIWORD_UPDATE(2, 1, 0)
|
||||
#define LVDS_CON_SELECT_8BIT_MODE_2 HIWORD_UPDATE(1, 1, 0)
|
||||
#define LVDS_CON_SELECT_8BIT_MODE_1 HIWORD_UPDATE(0, 1, 0)
|
||||
#define RK618_IO_CON0 0x0088
|
||||
#define VIF1_SYNC_MODE_ENABLE HIWORD_UPDATE(1, 15, 15)
|
||||
#define VIF1_SYNC_MODE_DISABLE HIWORD_UPDATE(0, 15, 15)
|
||||
#define VIF0_SYNC_MODE_ENABLE HIWORD_UPDATE(1, 14, 14)
|
||||
#define VIF0_SYNC_MODE_DISABLE HIWORD_UPDATE(0, 14, 14)
|
||||
#define PORT2_OUTPUT_LVDS HIWORD_UPDATE(1, 11, 11)
|
||||
#define PORT2_OUTPUT_TTL HIWORD_UPDATE(0, 11, 11)
|
||||
#define PORT1_OUTPUT_TTL_DISABLE HIWORD_UPDATE(1, 10, 10)
|
||||
#define PORT1_OUTPUT_TTL_ENABLE HIWORD_UPDATE(0, 10, 10)
|
||||
#define PORT2_IO_PULL_DOWN_DISABLE HIWORD_UPDATE(1, 9, 9)
|
||||
#define PORT2_IO_PULL_DOWN_ENABLE HIWORD_UPDATE(0, 9, 9)
|
||||
#define PORT1_IO_PULL_DOWN_DISABLE HIWORD_UPDATE(1, 8, 8)
|
||||
#define PORT1_IO_PULL_DOWN_ENABLE HIWORD_UPDATE(0, 8, 8)
|
||||
#define PORT0_IO_PULL_DOWN_DISABLE HIWORD_UPDATE(1, 7, 7)
|
||||
#define PORT0_IO_PULL_DOWN_ENABLE HIWORD_UPDATE(0, 7, 7)
|
||||
#define HDMI_IO_PULL_UP_DISABLE HIWORD_UPDATE(1, 6, 6)
|
||||
#define HDMI_IO_PULL_UP_ENABLE HIWORD_UPDATE(0, 6, 6)
|
||||
#define I2C_IO_PULL_UP_DISABLE HIWORD_UPDATE(1, 2, 2)
|
||||
#define I2C_IO_PULL_UP_ENABLE HIWORD_UPDATE(0, 2, 2)
|
||||
#define INT_IO_PULL_UP HIWORD_UPDATE(1, 1, 1)
|
||||
#define INT_IO_PULL_DOWN HIWORD_UPDATE(0, 1, 1)
|
||||
#define CLKIN_IO_PULL_UP HIWORD_UPDATE(1, 0, 0)
|
||||
#define CLKIN_IO_PULL_DOWN HIWORD_UPDATE(0, 0, 0)
|
||||
#define RK618_IO_CON1 0x008c
|
||||
#define PORT2_IO_SCHMITT_INPUT_ENABLE HIWORD_UPDATE(1, 9, 9)
|
||||
#define PORT2_IO_SCHMITT_INPUT_DISABLE HIWORD_UPDATE(0, 9, 9)
|
||||
#define PORT1_IO_SCHMITT_INPUT_ENABLE HIWORD_UPDATE(1, 8, 8)
|
||||
#define PORT1_IO_SCHMITT_INPUT_DISABLE HIWORD_UPDATE(0, 8, 8)
|
||||
#define PORT0_IO_SCHMITT_INPUT_ENABLE HIWORD_UPDATE(1, 7, 7)
|
||||
#define PORT0_IO_SCHMITT_INPUT_DISABLE HIWORD_UPDATE(0, 7, 7)
|
||||
#define HDMI_IO_SCHMITT_INPUT_ENABLE HIWORD_UPDATE(1, 6, 6)
|
||||
#define HDMI_IO_SCHMITT_INPUT_DISABLE HIWORD_UPDATE(0, 6, 6)
|
||||
#define I2C_IO_SCHMITT_INPUT_ENABLE HIWORD_UPDATE(1, 2, 2)
|
||||
#define I2C_IO_SCHMITT_INPUT_DISABLE HIWORD_UPDATE(0, 2, 2)
|
||||
#define INT_IO_SCHMITT_INPUT_ENABLE HIWORD_UPDATE(1, 1, 1)
|
||||
#define INT_IO_SCHMITT_INPUT_DISABLE HIWORD_UPDATE(0, 1, 1)
|
||||
#define CLKIN_IO_SCHMITT_INPUT_ENABLE HIWORD_UPDATE(1, 0, 0)
|
||||
#define CLKIN_IO_SCHMITT_INPUT_DISABLE HIWORD_UPDATE(0, 0, 0)
|
||||
#define RK618_MISC_CON 0x009c
|
||||
#define HDMI_INT_STATUS BIT(20)
|
||||
#define MIPI_INT_STATUS BIT(19)
|
||||
#define MIPI_EDPI_HALT BIT(16)
|
||||
#define HDMI_HSYNC_POL_INV BIT(15)
|
||||
#define HDMI_VSYNC_POL_INV BIT(14)
|
||||
#define HDMI_CLK_SEL_MASK GENMASK(13, 12)
|
||||
#define HDMI_CLK_SEL_VIDEO_INF0_CLK UPDATE(2, 13, 12)
|
||||
#define HDMI_CLK_SEL_SCALER_CLK UPDATE(1, 13, 12)
|
||||
#define HDMI_CLK_SEL_VIDEO_INF1_CLK 0
|
||||
#define INT_ACTIVE_LOW BIT(5)
|
||||
#define INT_ACTIVE_HIGH 0
|
||||
#define DOUBLE_CH_LVDS_DEN_POLARITY BIT(4)
|
||||
#define DOUBLE_CH_LVDS_DEN_LOW BIT(4)
|
||||
#define DOUBLE_CH_LVDS_DEN_HIGH 0
|
||||
#define DOUBLE_CH_LVDS_HSYNC_POLARITY BIT(3)
|
||||
#define DOUBLE_CH_LVDS_HSYNC_LOW BIT(3)
|
||||
#define DOUBLE_CH_LVDS_HSYNC_HIGH 0
|
||||
#define MIPI_DPICOLOM BIT(2)
|
||||
#define MIPI_DPISHUTDN BIT(1)
|
||||
|
||||
struct rk618_output;
|
||||
|
||||
struct rk618_output_funcs {
|
||||
void (*pre_enable)(struct rk618_output *output);
|
||||
void (*enable)(struct rk618_output *output);
|
||||
void (*post_disable)(struct rk618_output *output);
|
||||
void (*disable)(struct rk618_output *output);
|
||||
void (*mode_set)(struct rk618_output *output,
|
||||
const struct drm_display_mode *mode);
|
||||
};
|
||||
|
||||
struct rk618_output {
|
||||
struct drm_encoder encoder;
|
||||
struct drm_connector connector;
|
||||
struct drm_bridge bridge;
|
||||
struct drm_panel *panel;
|
||||
struct drm_display_mode panel_mode;
|
||||
struct drm_display_mode scale_mode;
|
||||
u32 bus_format;
|
||||
struct drm_bridge *ext_bridge;
|
||||
|
||||
struct device *dev;
|
||||
struct device_node *panel_node;
|
||||
struct rk618 *parent;
|
||||
struct clk *dither_clk;
|
||||
struct clk *vif_clk;
|
||||
struct clk *scaler_clk;
|
||||
|
||||
const struct rk618_output_funcs *funcs;
|
||||
};
|
||||
|
||||
int rk618_output_register(struct rk618_output *output);
|
||||
int rk618_output_bind(struct rk618_output *output, struct drm_device *drm,
|
||||
int encoder_type, int connector_type);
|
||||
void rk618_output_unbind(struct rk618_output *output);
|
||||
|
||||
void rk618_scaler_enable(struct rk618 *rk618);
|
||||
void rk618_scaler_disable(struct rk618 *rk618);
|
||||
void rk618_scaler_configure(struct rk618 *rk618,
|
||||
const struct drm_display_mode *scale_mode,
|
||||
const struct drm_display_mode *panel_mode);
|
||||
|
||||
void rk618_dither_enable(struct rk618 *rk618);
|
||||
void rk618_dither_disable(struct rk618 *rk618);
|
||||
void rk618_dither_frc_dclk_invert(struct rk618 *rk618);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user