Commit 12f8030e authored by Egbert Eich's avatar Egbert Eich Committed by Dave Airlie

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: default avatarEgbert Eich <eich@suse.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent ab209c32
...@@ -4,16 +4,11 @@ ...@@ -4,16 +4,11 @@
#include "ast_drv.h" #include "ast_drv.h"
MODULE_FIRMWARE("ast_dp501_fw.bin"); 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; 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) static void send_ack(struct ast_private *ast)
...@@ -187,7 +182,7 @@ bool ast_backup_fw(struct drm_device *dev, u8 *addr, u32 size) ...@@ -187,7 +182,7 @@ bool ast_backup_fw(struct drm_device *dev, u8 *addr, u32 size)
return false; 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; struct ast_private *ast = dev->dev_private;
u32 i, data, len = 0; u32 i, data, len = 0;
...@@ -201,7 +196,11 @@ bool ast_launch_m68k(struct drm_device *dev) ...@@ -201,7 +196,11 @@ bool ast_launch_m68k(struct drm_device *dev)
if (ast->dp501_fw_addr) { if (ast->dp501_fw_addr) {
fw_addr = ast->dp501_fw_addr; fw_addr = ast->dp501_fw_addr;
len = 32*1024; 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; fw_addr = (u8 *)ast->dp501_fw->data;
len = ast->dp501_fw->size; len = ast->dp501_fw->size;
} }
...@@ -432,3 +431,11 @@ void ast_init_3rdtx(struct drm_device *dev) ...@@ -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); ...@@ -401,11 +401,10 @@ void ast_post_gpu(struct drm_device *dev);
u32 ast_mindwm(struct ast_private *ast, u32 r); u32 ast_mindwm(struct ast_private *ast, u32 r);
void ast_moutdwm(struct ast_private *ast, u32 r, u32 v); void ast_moutdwm(struct ast_private *ast, u32 r, u32 v);
/* ast dp501 */ /* ast dp501 */
int ast_load_dp501_microcode(struct drm_device *dev);
void ast_set_dp501_video_output(struct drm_device *dev, u8 mode); 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_backup_fw(struct drm_device *dev, u8 *addr, u32 size);
bool ast_dp501_read_edid(struct drm_device *dev, u8 *ediddata); bool ast_dp501_read_edid(struct drm_device *dev, u8 *ediddata);
u8 ast_get_dp501_max_clk(struct drm_device *dev); u8 ast_get_dp501_max_clk(struct drm_device *dev);
void ast_init_3rdtx(struct drm_device *dev); void ast_init_3rdtx(struct drm_device *dev);
void ast_release_firmware(struct drm_device *dev);
#endif #endif
...@@ -576,6 +576,7 @@ void ast_driver_unload(struct drm_device *dev) ...@@ -576,6 +576,7 @@ void ast_driver_unload(struct drm_device *dev)
{ {
struct ast_private *ast = dev->dev_private; struct ast_private *ast = dev->dev_private;
ast_release_firmware(dev);
kfree(ast->dp501_fw_addr); kfree(ast->dp501_fw_addr);
ast_mode_fini(dev); ast_mode_fini(dev);
ast_fbdev_fini(dev); ast_fbdev_fini(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment