#include <linux/delay.h>
#include <linux/firmware.h>
#include <linux/module.h>
#include <drm/drm_atomic_state_helper.h>
#include <drm/drm_edid.h>
#include <drm/drm_modeset_helper_vtables.h>
#include <drm/drm_probe_helper.h>
#include "ast_drv.h"
MODULE_FIRMWARE(…) …;
static void ast_release_firmware(void *data)
{ … }
static int ast_load_dp501_microcode(struct drm_device *dev)
{ … }
static void send_ack(struct ast_device *ast)
{ … }
static void send_nack(struct ast_device *ast)
{ … }
static bool wait_ack(struct ast_device *ast)
{ … }
static bool wait_nack(struct ast_device *ast)
{ … }
static void set_cmd_trigger(struct ast_device *ast)
{ … }
static void clear_cmd_trigger(struct ast_device *ast)
{ … }
#if 0
static bool wait_fw_ready(struct ast_device *ast)
{
u8 waitready;
u32 retry = 0;
do {
waitready = ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xd2, 0xff);
waitready &= 0x40;
udelay(100);
} while ((!waitready) && (retry++ < 1000));
if (retry < 1000)
return true;
else
return false;
}
#endif
static bool ast_write_cmd(struct drm_device *dev, u8 data)
{ … }
static bool ast_write_data(struct drm_device *dev, u8 data)
{ … }
#if 0
static bool ast_read_data(struct drm_device *dev, u8 *data)
{
struct ast_device *ast = to_ast_device(dev);
u8 tmp;
*data = 0;
if (wait_ack(ast) == false)
return false;
tmp = ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xd3, 0xff);
*data = tmp;
if (wait_nack(ast) == false) {
send_nack(ast);
return false;
}
send_nack(ast);
return true;
}
static void clear_cmd(struct ast_device *ast)
{
send_nack(ast);
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0x9a, 0x00, 0x00);
}
#endif
static void ast_set_dp501_video_output(struct drm_device *dev, u8 mode)
{ … }
static u32 get_fw_base(struct ast_device *ast)
{ … }
bool ast_backup_fw(struct drm_device *dev, u8 *addr, u32 size)
{ … }
static bool ast_launch_m68k(struct drm_device *dev)
{ … }
static bool ast_dp501_is_connected(struct ast_device *ast)
{ … }
static int ast_dp512_read_edid_block(void *data, u8 *buf, unsigned int block, size_t len)
{ … }
static bool ast_init_dvo(struct drm_device *dev)
{ … }
static void ast_init_analog(struct drm_device *dev)
{ … }
void ast_init_3rdtx(struct drm_device *dev)
{ … }
static const struct drm_encoder_funcs ast_dp501_encoder_funcs = …;
static void ast_dp501_encoder_helper_atomic_enable(struct drm_encoder *encoder,
struct drm_atomic_state *state)
{ … }
static void ast_dp501_encoder_helper_atomic_disable(struct drm_encoder *encoder,
struct drm_atomic_state *state)
{ … }
static const struct drm_encoder_helper_funcs ast_dp501_encoder_helper_funcs = …;
static int ast_dp501_connector_helper_get_modes(struct drm_connector *connector)
{ … }
static int ast_dp501_connector_helper_detect_ctx(struct drm_connector *connector,
struct drm_modeset_acquire_ctx *ctx,
bool force)
{ … }
static const struct drm_connector_helper_funcs ast_dp501_connector_helper_funcs = …;
static const struct drm_connector_funcs ast_dp501_connector_funcs = …;
static int ast_dp501_connector_init(struct drm_device *dev, struct drm_connector *connector)
{ … }
int ast_dp501_output_init(struct ast_device *ast)
{ … }