mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-23 02:54:32 +08:00
drm/ast: Actually load DP501 firmware when required
The ast driver has a code to load the DP501 firmware, but it's never used. This patch implements its actual usage by requesting the firmware on demand, and release the firmware at exit as well. Also the path contains a few cleanups and makes relevant functions static. Signed-off-by: Egbert Eich <eich@suse.de> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
ab209c32f5
commit
12f8030e05
@ -4,16 +4,11 @@
|
||||
#include "ast_drv.h"
|
||||
MODULE_FIRMWARE("ast_dp501_fw.bin");
|
||||
|
||||
int ast_load_dp501_microcode(struct drm_device *dev)
|
||||
static int ast_load_dp501_microcode(struct drm_device *dev)
|
||||
{
|
||||
struct ast_private *ast = dev->dev_private;
|
||||
static char *fw_name = "ast_dp501_fw.bin";
|
||||
int err;
|
||||
err = request_firmware(&ast->dp501_fw, fw_name, dev->dev);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
return 0;
|
||||
return request_firmware(&ast->dp501_fw, "ast_dp501_fw.bin", dev->dev);
|
||||
}
|
||||
|
||||
static void send_ack(struct ast_private *ast)
|
||||
@ -187,7 +182,7 @@ bool ast_backup_fw(struct drm_device *dev, u8 *addr, u32 size)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ast_launch_m68k(struct drm_device *dev)
|
||||
static bool ast_launch_m68k(struct drm_device *dev)
|
||||
{
|
||||
struct ast_private *ast = dev->dev_private;
|
||||
u32 i, data, len = 0;
|
||||
@ -201,7 +196,11 @@ bool ast_launch_m68k(struct drm_device *dev)
|
||||
if (ast->dp501_fw_addr) {
|
||||
fw_addr = ast->dp501_fw_addr;
|
||||
len = 32*1024;
|
||||
} else if (ast->dp501_fw) {
|
||||
} else {
|
||||
if (!ast->dp501_fw &&
|
||||
ast_load_dp501_microcode(dev) < 0)
|
||||
return false;
|
||||
|
||||
fw_addr = (u8 *)ast->dp501_fw->data;
|
||||
len = ast->dp501_fw->size;
|
||||
}
|
||||
@ -432,3 +431,11 @@ void ast_init_3rdtx(struct drm_device *dev)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ast_release_firmware(struct drm_device *dev)
|
||||
{
|
||||
struct ast_private *ast = dev->dev_private;
|
||||
|
||||
release_firmware(ast->dp501_fw);
|
||||
ast->dp501_fw = NULL;
|
||||
}
|
||||
|
@ -401,11 +401,10 @@ void ast_post_gpu(struct drm_device *dev);
|
||||
u32 ast_mindwm(struct ast_private *ast, u32 r);
|
||||
void ast_moutdwm(struct ast_private *ast, u32 r, u32 v);
|
||||
/* ast dp501 */
|
||||
int ast_load_dp501_microcode(struct drm_device *dev);
|
||||
void ast_set_dp501_video_output(struct drm_device *dev, u8 mode);
|
||||
bool ast_launch_m68k(struct drm_device *dev);
|
||||
bool ast_backup_fw(struct drm_device *dev, u8 *addr, u32 size);
|
||||
bool ast_dp501_read_edid(struct drm_device *dev, u8 *ediddata);
|
||||
u8 ast_get_dp501_max_clk(struct drm_device *dev);
|
||||
void ast_init_3rdtx(struct drm_device *dev);
|
||||
void ast_release_firmware(struct drm_device *dev);
|
||||
#endif
|
||||
|
@ -576,6 +576,7 @@ void ast_driver_unload(struct drm_device *dev)
|
||||
{
|
||||
struct ast_private *ast = dev->dev_private;
|
||||
|
||||
ast_release_firmware(dev);
|
||||
kfree(ast->dp501_fw_addr);
|
||||
ast_mode_fini(dev);
|
||||
ast_fbdev_fini(dev);
|
||||
|
Loading…
Reference in New Issue
Block a user